From b375285efa3564bdc23e6330fe228821f1e1a7fd Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 24 May 2023 15:38:31 +0100 Subject: [PATCH 01/44] WIP --- .gitignore | 1 + internal/generated/.openapi-generator-ignore | 4 + internal/generated/.openapi-generator/FILES | 90 + internal/generated/.openapi-generator/VERSION | 1 + internal/generated/api_access_tracking_cmd.go | 165 ++ .../generated/api_access_tracking_store.go | 45 + .../generated/api_alert_configurations_cmd.go | 471 ++++ .../api_alert_configurations_store.go | 105 + internal/generated/api_alerts_cmd.go | 263 ++ internal/generated/api_alerts_store.go | 65 + internal/generated/api_atlas_search_cmd.go | 315 +++ internal/generated/api_atlas_search_store.go | 75 + internal/generated/api_auditing_cmd.go | 129 + internal/generated/api_auditing_store.go | 45 + .../generated/api_aws_clusters_dns_cmd.go | 129 + .../generated/api_aws_clusters_dns_store.go | 45 + internal/generated/api_cloud_backups_cmd.go | 1692 +++++++++++++ internal/generated/api_cloud_backups_store.go | 315 +++ .../api_cloud_migration_service_cmd.go | 450 ++++ .../api_cloud_migration_service_store.go | 105 + .../api_cloud_provider_access_cmd.go | 297 +++ .../api_cloud_provider_access_store.go | 75 + .../api_cluster_outage_simulation_cmd.go | 190 ++ .../api_cluster_outage_simulation_store.go | 55 + internal/generated/api_clusters_cmd.go | 529 +++++ internal/generated/api_clusters_store.go | 115 + .../api_custom_database_roles_cmd.go | 294 +++ .../api_custom_database_roles_store.go | 75 + internal/generated/api_data_federation_cmd.go | 816 +++++++ .../generated/api_data_federation_store.go | 165 ++ .../generated/api_data_lake_pipelines_cmd.go | 764 ++++++ .../api_data_lake_pipelines_store.go | 155 ++ internal/generated/api_database_users_cmd.go | 312 +++ .../generated/api_database_users_store.go | 75 + ..._rest_using_customer_key_management_cmd.go | 129 + ...est_using_customer_key_management_store.go | 45 + internal/generated/api_events_cmd.go | 290 +++ internal/generated/api_events_store.go | 65 + .../api_federated_authentication_cmd.go | 847 +++++++ .../api_federated_authentication_store.go | 175 ++ internal/generated/api_global_clusters_cmd.go | 306 +++ .../generated/api_global_clusters_store.go | 75 + internal/generated/api_invoices_cmd.go | 248 ++ internal/generated/api_invoices_store.go | 65 + .../generated/api_ldap_configuration_cmd.go | 288 +++ .../generated/api_ldap_configuration_store.go | 75 + internal/generated/api_legacy_backup_cmd.go | 623 +++++ .../api_legacy_backup_restore_jobs_cmd.go | 80 + .../api_legacy_backup_restore_jobs_store.go | 35 + internal/generated/api_legacy_backup_store.go | 125 + .../generated/api_maintenance_windows__cmd.go | 285 +++ .../api_maintenance_windows__store.go | 75 + .../generated/api_mongo_db_cloud_users_cmd.go | 178 ++ .../api_mongo_db_cloud_users_store.go | 55 + .../generated/api_monitoring_and_logs_cmd.go | 945 ++++++++ .../api_monitoring_and_logs_store.go | 165 ++ .../generated/api_multi_cloud_clusters_cmd.go | 361 +++ .../api_multi_cloud_clusters_store.go | 85 + internal/generated/api_network_peering_cmd.go | 752 ++++++ .../generated/api_network_peering_store.go | 155 ++ internal/generated/api_online_archive_cmd.go | 382 +++ .../generated/api_online_archive_store.go | 85 + internal/generated/api_organizations_cmd.go | 844 +++++++ internal/generated/api_organizations_store.go | 175 ++ .../generated/api_performance_advisor_cmd.go | 336 +++ .../api_performance_advisor_store.go | 75 + .../api_private_endpoint_services_cmd.go | 532 +++++ .../api_private_endpoint_services_store.go | 115 + .../api_programmatic_api_keys_cmd.go | 834 +++++++ .../api_programmatic_api_keys_store.go | 165 ++ .../api_project_ip_access_list_cmd.go | 312 +++ .../api_project_ip_access_list_store.go | 75 + internal/generated/api_projects_cmd.go | 1110 +++++++++ internal/generated/api_projects_store.go | 225 ++ internal/generated/api_rolling_index_cmd.go | 80 + internal/generated/api_rolling_index_store.go | 35 + internal/generated/api_root_cmd.go | 74 + internal/generated/api_root_store.go | 35 + .../generated/api_serverless_instances_cmd.go | 303 +++ .../api_serverless_instances_store.go | 75 + .../api_serverless_private_endpoints_cmd.go | 309 +++ .../api_serverless_private_endpoints_store.go | 75 + .../api_shared_tier_restore_jobs_cmd.go | 193 ++ .../api_shared_tier_restore_jobs_store.go | 55 + .../api_shared_tier_snapshots_cmd.go | 193 ++ .../api_shared_tier_snapshots_store.go | 55 + internal/generated/api_teams_cmd.go | 755 ++++++ internal/generated/api_teams_store.go | 155 ++ internal/generated/api_test__cmd.go | 77 + internal/generated/api_test__store.go | 35 + .../api_third_party_integrations_cmd.go | 324 +++ .../api_third_party_integrations_store.go | 75 + .../generated/api_x509_authentication_cmd.go | 196 ++ .../api_x509_authentication_store.go | 55 + .../config/.openapi-generator-ignore | 4 + tools/openapi-generator/config/config.yaml | 15 + .../config/go-templates/cmd.mustache | 81 + .../go-templates/partial_header.mustache | 15 + .../config/go-templates/store.mustache | 24 + tools/openapi-generator/openapitools.json | 7 + tools/openapi-generator/package-lock.json | 2107 +++++++++++++++++ tools/openapi-generator/package.json | 24 + 102 files changed, 25650 insertions(+) create mode 100644 internal/generated/.openapi-generator-ignore create mode 100644 internal/generated/.openapi-generator/FILES create mode 100644 internal/generated/.openapi-generator/VERSION create mode 100644 internal/generated/api_access_tracking_cmd.go create mode 100644 internal/generated/api_access_tracking_store.go create mode 100644 internal/generated/api_alert_configurations_cmd.go create mode 100644 internal/generated/api_alert_configurations_store.go create mode 100644 internal/generated/api_alerts_cmd.go create mode 100644 internal/generated/api_alerts_store.go create mode 100644 internal/generated/api_atlas_search_cmd.go create mode 100644 internal/generated/api_atlas_search_store.go create mode 100644 internal/generated/api_auditing_cmd.go create mode 100644 internal/generated/api_auditing_store.go create mode 100644 internal/generated/api_aws_clusters_dns_cmd.go create mode 100644 internal/generated/api_aws_clusters_dns_store.go create mode 100644 internal/generated/api_cloud_backups_cmd.go create mode 100644 internal/generated/api_cloud_backups_store.go create mode 100644 internal/generated/api_cloud_migration_service_cmd.go create mode 100644 internal/generated/api_cloud_migration_service_store.go create mode 100644 internal/generated/api_cloud_provider_access_cmd.go create mode 100644 internal/generated/api_cloud_provider_access_store.go create mode 100644 internal/generated/api_cluster_outage_simulation_cmd.go create mode 100644 internal/generated/api_cluster_outage_simulation_store.go create mode 100644 internal/generated/api_clusters_cmd.go create mode 100644 internal/generated/api_clusters_store.go create mode 100644 internal/generated/api_custom_database_roles_cmd.go create mode 100644 internal/generated/api_custom_database_roles_store.go create mode 100644 internal/generated/api_data_federation_cmd.go create mode 100644 internal/generated/api_data_federation_store.go create mode 100644 internal/generated/api_data_lake_pipelines_cmd.go create mode 100644 internal/generated/api_data_lake_pipelines_store.go create mode 100644 internal/generated/api_database_users_cmd.go create mode 100644 internal/generated/api_database_users_store.go create mode 100644 internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go create mode 100644 internal/generated/api_encryption_at_rest_using_customer_key_management_store.go create mode 100644 internal/generated/api_events_cmd.go create mode 100644 internal/generated/api_events_store.go create mode 100644 internal/generated/api_federated_authentication_cmd.go create mode 100644 internal/generated/api_federated_authentication_store.go create mode 100644 internal/generated/api_global_clusters_cmd.go create mode 100644 internal/generated/api_global_clusters_store.go create mode 100644 internal/generated/api_invoices_cmd.go create mode 100644 internal/generated/api_invoices_store.go create mode 100644 internal/generated/api_ldap_configuration_cmd.go create mode 100644 internal/generated/api_ldap_configuration_store.go create mode 100644 internal/generated/api_legacy_backup_cmd.go create mode 100644 internal/generated/api_legacy_backup_restore_jobs_cmd.go create mode 100644 internal/generated/api_legacy_backup_restore_jobs_store.go create mode 100644 internal/generated/api_legacy_backup_store.go create mode 100644 internal/generated/api_maintenance_windows__cmd.go create mode 100644 internal/generated/api_maintenance_windows__store.go create mode 100644 internal/generated/api_mongo_db_cloud_users_cmd.go create mode 100644 internal/generated/api_mongo_db_cloud_users_store.go create mode 100644 internal/generated/api_monitoring_and_logs_cmd.go create mode 100644 internal/generated/api_monitoring_and_logs_store.go create mode 100644 internal/generated/api_multi_cloud_clusters_cmd.go create mode 100644 internal/generated/api_multi_cloud_clusters_store.go create mode 100644 internal/generated/api_network_peering_cmd.go create mode 100644 internal/generated/api_network_peering_store.go create mode 100644 internal/generated/api_online_archive_cmd.go create mode 100644 internal/generated/api_online_archive_store.go create mode 100644 internal/generated/api_organizations_cmd.go create mode 100644 internal/generated/api_organizations_store.go create mode 100644 internal/generated/api_performance_advisor_cmd.go create mode 100644 internal/generated/api_performance_advisor_store.go create mode 100644 internal/generated/api_private_endpoint_services_cmd.go create mode 100644 internal/generated/api_private_endpoint_services_store.go create mode 100644 internal/generated/api_programmatic_api_keys_cmd.go create mode 100644 internal/generated/api_programmatic_api_keys_store.go create mode 100644 internal/generated/api_project_ip_access_list_cmd.go create mode 100644 internal/generated/api_project_ip_access_list_store.go create mode 100644 internal/generated/api_projects_cmd.go create mode 100644 internal/generated/api_projects_store.go create mode 100644 internal/generated/api_rolling_index_cmd.go create mode 100644 internal/generated/api_rolling_index_store.go create mode 100644 internal/generated/api_root_cmd.go create mode 100644 internal/generated/api_root_store.go create mode 100644 internal/generated/api_serverless_instances_cmd.go create mode 100644 internal/generated/api_serverless_instances_store.go create mode 100644 internal/generated/api_serverless_private_endpoints_cmd.go create mode 100644 internal/generated/api_serverless_private_endpoints_store.go create mode 100644 internal/generated/api_shared_tier_restore_jobs_cmd.go create mode 100644 internal/generated/api_shared_tier_restore_jobs_store.go create mode 100644 internal/generated/api_shared_tier_snapshots_cmd.go create mode 100644 internal/generated/api_shared_tier_snapshots_store.go create mode 100644 internal/generated/api_teams_cmd.go create mode 100644 internal/generated/api_teams_store.go create mode 100644 internal/generated/api_test__cmd.go create mode 100644 internal/generated/api_test__store.go create mode 100644 internal/generated/api_third_party_integrations_cmd.go create mode 100644 internal/generated/api_third_party_integrations_store.go create mode 100644 internal/generated/api_x509_authentication_cmd.go create mode 100644 internal/generated/api_x509_authentication_store.go create mode 100644 tools/openapi-generator/config/.openapi-generator-ignore create mode 100644 tools/openapi-generator/config/config.yaml create mode 100644 tools/openapi-generator/config/go-templates/cmd.mustache create mode 100644 tools/openapi-generator/config/go-templates/partial_header.mustache create mode 100644 tools/openapi-generator/config/go-templates/store.mustache create mode 100644 tools/openapi-generator/openapitools.json create mode 100644 tools/openapi-generator/package-lock.json create mode 100644 tools/openapi-generator/package.json diff --git a/.gitignore b/.gitignore index f3b0b9acc2..463b3f431c 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ gon_arm64.json *.idea *.vscode +node_modules diff --git a/internal/generated/.openapi-generator-ignore b/internal/generated/.openapi-generator-ignore new file mode 100644 index 0000000000..925547ae88 --- /dev/null +++ b/internal/generated/.openapi-generator-ignore @@ -0,0 +1,4 @@ +**/* +*.* +!*_cmd.go +!api_*_store.go diff --git a/internal/generated/.openapi-generator/FILES b/internal/generated/.openapi-generator/FILES new file mode 100644 index 0000000000..4251fca3c0 --- /dev/null +++ b/internal/generated/.openapi-generator/FILES @@ -0,0 +1,90 @@ +api_access_tracking_cmd.go +api_access_tracking_store.go +api_alert_configurations_cmd.go +api_alert_configurations_store.go +api_alerts_cmd.go +api_alerts_store.go +api_atlas_search_cmd.go +api_atlas_search_store.go +api_auditing_cmd.go +api_auditing_store.go +api_aws_clusters_dns_cmd.go +api_aws_clusters_dns_store.go +api_cloud_backups_cmd.go +api_cloud_backups_store.go +api_cloud_migration_service_cmd.go +api_cloud_migration_service_store.go +api_cloud_provider_access_cmd.go +api_cloud_provider_access_store.go +api_cluster_outage_simulation_cmd.go +api_cluster_outage_simulation_store.go +api_clusters_cmd.go +api_clusters_store.go +api_custom_database_roles_cmd.go +api_custom_database_roles_store.go +api_data_federation_cmd.go +api_data_federation_store.go +api_data_lake_pipelines_cmd.go +api_data_lake_pipelines_store.go +api_database_users_cmd.go +api_database_users_store.go +api_encryption_at_rest_using_customer_key_management_cmd.go +api_encryption_at_rest_using_customer_key_management_store.go +api_events_cmd.go +api_events_store.go +api_federated_authentication_cmd.go +api_federated_authentication_store.go +api_global_clusters_cmd.go +api_global_clusters_store.go +api_invoices_cmd.go +api_invoices_store.go +api_ldap_configuration_cmd.go +api_ldap_configuration_store.go +api_legacy_backup_cmd.go +api_legacy_backup_restore_jobs_cmd.go +api_legacy_backup_restore_jobs_store.go +api_legacy_backup_store.go +api_maintenance_windows__cmd.go +api_maintenance_windows__store.go +api_mongo_db_cloud_users_cmd.go +api_mongo_db_cloud_users_store.go +api_monitoring_and_logs_cmd.go +api_monitoring_and_logs_store.go +api_multi_cloud_clusters_cmd.go +api_multi_cloud_clusters_store.go +api_network_peering_cmd.go +api_network_peering_store.go +api_online_archive_cmd.go +api_online_archive_store.go +api_organizations_cmd.go +api_organizations_store.go +api_performance_advisor_cmd.go +api_performance_advisor_store.go +api_private_endpoint_services_cmd.go +api_private_endpoint_services_store.go +api_programmatic_api_keys_cmd.go +api_programmatic_api_keys_store.go +api_project_ip_access_list_cmd.go +api_project_ip_access_list_store.go +api_projects_cmd.go +api_projects_store.go +api_rolling_index_cmd.go +api_rolling_index_store.go +api_root_cmd.go +api_root_store.go +api_serverless_instances_cmd.go +api_serverless_instances_store.go +api_serverless_private_endpoints_cmd.go +api_serverless_private_endpoints_store.go +api_shared_tier_restore_jobs_cmd.go +api_shared_tier_restore_jobs_store.go +api_shared_tier_snapshots_cmd.go +api_shared_tier_snapshots_store.go +api_teams_cmd.go +api_teams_store.go +api_test__cmd.go +api_test__store.go +api_third_party_integrations_cmd.go +api_third_party_integrations_store.go +api_x509_authentication_cmd.go +api_x509_authentication_store.go diff --git a/internal/generated/.openapi-generator/VERSION b/internal/generated/.openapi-generator/VERSION new file mode 100644 index 0000000000..cd802a1ec4 --- /dev/null +++ b/internal/generated/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go new file mode 100644 index 0000000000..e9b52f893b --- /dev/null +++ b/internal/generated/api_access_tracking_cmd.go @@ -0,0 +1,165 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type ListAccessLogsByClusterNameOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAccessLogsByClusterNameOperation + groupId string + clusterName string + authResult bool + end int64 + ipAddress string + nLogs int32 + start int64 +} + +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 *ListAccessLogsByClusterNameOpts) Run() error { + params := &atlasv2.ListAccessLogsByClusterNameApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + AuthResult: opts.authResult, + End: opts.end, + IpAddress: opts.ipAddress, + NLogs: opts.nLogs, + Start: opts.start, + } + resp, _, err := opts.store.ListAccessLogsByClusterName(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAccessLogsByClusterNameTemplate = "<>" + +func ListAccessLogsByClusterNameBuilder() cobra.Command { + opts := ListAccessLogsByClusterNameOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAccessLogsByClusterNameTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.authResult, "authResult", "", "usage description") + cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") + cmd.Flags().StringVar(&opts.nLogs, "nLogs", "", "usage description") + cmd.Flags().StringVar(&opts.start, "start", "", "usage description") + + return cmd +} +type ListAccessLogsByHostnameOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAccessLogsByHostnameOperation + groupId string + hostname string + authResult bool + end int64 + ipAddress string + nLogs int32 + start int64 +} + +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 *ListAccessLogsByHostnameOpts) Run() error { + params := &atlasv2.ListAccessLogsByHostnameApiParams{ + GroupId: opts.groupId, + Hostname: opts.hostname, + AuthResult: opts.authResult, + End: opts.end, + IpAddress: opts.ipAddress, + NLogs: opts.nLogs, + Start: opts.start, + } + resp, _, err := opts.store.ListAccessLogsByHostname(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAccessLogsByHostnameTemplate = "<>" + +func ListAccessLogsByHostnameBuilder() cobra.Command { + opts := ListAccessLogsByHostnameOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAccessLogsByHostnameTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.hostname, "hostname", "", "usage description") + cmd.Flags().StringVar(&opts.authResult, "authResult", "", "usage description") + cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") + cmd.Flags().StringVar(&opts.nLogs, "nLogs", "", "usage description") + cmd.Flags().StringVar(&opts.start, "start", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_access_tracking_store.go b/internal/generated/api_access_tracking_store.go new file mode 100644 index 0000000000..02a1e60cb9 --- /dev/null +++ b/internal/generated/api_access_tracking_store.go @@ -0,0 +1,45 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_access_tracking_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas ListAccessLogsByClusterNameOperation, ListAccessLogsByHostnameOperation + +type ListAccessLogsByClusterNameOperation interface { + ListAccessLogsByClusterName (*atlasv2.ListAccessLogsByClusterNameApiParams) (*atlasv2.MongoDBAccessLogsList, error) +} + +// ListAccessLogsByClusterName encapsulates the logic to manage different cloud providers. +func (s *Store) ListAccessLogsByClusterName(params *atlasv2.ListAccessLogsByClusterNameApiParams) (*atlasv2.MongoDBAccessLogsList, error) { + result, _, err := s.clientv2.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListAccessLogsByHostnameOperation interface { + ListAccessLogsByHostname (*atlasv2.ListAccessLogsByHostnameApiParams) (*atlasv2.MongoDBAccessLogsList, error) +} + +// ListAccessLogsByHostname encapsulates the logic to manage different cloud providers. +func (s *Store) ListAccessLogsByHostname(params *atlasv2.ListAccessLogsByHostnameApiParams) (*atlasv2.MongoDBAccessLogsList, error) { + result, _, err := s.clientv2.AccessTrackingApi.ListAccessLogsByHostnameWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go new file mode 100644 index 0000000000..3ee9480df6 --- /dev/null +++ b/internal/generated/api_alert_configurations_cmd.go @@ -0,0 +1,471 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateAlertConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateAlertConfigurationOperation + groupId string +} + +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 *CreateAlertConfigurationOpts) Run() error { + params := &atlasv2.CreateAlertConfigurationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateAlertConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateAlertConfigurationTemplate = "<>" + +func CreateAlertConfigurationBuilder() cobra.Command { + opts := CreateAlertConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateAlertConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeleteAlertConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteAlertConfigurationOperation + groupId string + alertConfigId string +} + +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 *DeleteAlertConfigurationOpts) Run() error { + params := &atlasv2.DeleteAlertConfigurationApiParams{ + GroupId: opts.groupId, + AlertConfigId: opts.alertConfigId, + } + _, err := opts.store.DeleteAlertConfiguration(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DeleteAlertConfigurationTemplate = "<>" + +func DeleteAlertConfigurationBuilder() cobra.Command { + opts := DeleteAlertConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteAlertConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + + return cmd +} +type GetAlertConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetAlertConfigurationOperation + groupId string + alertConfigId string +} + +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 *GetAlertConfigurationOpts) Run() error { + params := &atlasv2.GetAlertConfigurationApiParams{ + GroupId: opts.groupId, + AlertConfigId: opts.alertConfigId, + } + resp, _, err := opts.store.GetAlertConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetAlertConfigurationTemplate = "<>" + +func GetAlertConfigurationBuilder() cobra.Command { + opts := GetAlertConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetAlertConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + + return cmd +} +type ListAlertConfigurationMatchersFieldNamesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAlertConfigurationMatchersFieldNamesOperation +} + +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 *ListAlertConfigurationMatchersFieldNamesOpts) Run() error { + params := &atlasv2.ListAlertConfigurationMatchersFieldNamesApiParams{ + } + resp, _, err := opts.store.ListAlertConfigurationMatchersFieldNames(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAlertConfigurationMatchersFieldNamesTemplate = "<>" + +func ListAlertConfigurationMatchersFieldNamesBuilder() cobra.Command { + opts := ListAlertConfigurationMatchersFieldNamesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationMatchersFieldNamesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + + return cmd +} +type ListAlertConfigurationsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAlertConfigurationsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListAlertConfigurationsOpts) Run() error { + params := &atlasv2.ListAlertConfigurationsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListAlertConfigurations(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAlertConfigurationsTemplate = "<>" + +func ListAlertConfigurationsBuilder() cobra.Command { + opts := ListAlertConfigurationsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListAlertConfigurationsByAlertIdOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAlertConfigurationsByAlertIdOperation + groupId string + alertId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListAlertConfigurationsByAlertIdOpts) Run() error { + params := &atlasv2.ListAlertConfigurationsByAlertIdApiParams{ + GroupId: opts.groupId, + AlertId: opts.alertId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListAlertConfigurationsByAlertId(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAlertConfigurationsByAlertIdTemplate = "<>" + +func ListAlertConfigurationsByAlertIdBuilder() cobra.Command { + opts := ListAlertConfigurationsByAlertIdOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationsByAlertIdTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ToggleAlertConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ToggleAlertConfigurationOperation + groupId string + alertConfigId string +} + +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 *ToggleAlertConfigurationOpts) Run() error { + params := &atlasv2.ToggleAlertConfigurationApiParams{ + GroupId: opts.groupId, + AlertConfigId: opts.alertConfigId, + } + resp, _, err := opts.store.ToggleAlertConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ToggleAlertConfigurationTemplate = "<>" + +func ToggleAlertConfigurationBuilder() cobra.Command { + opts := ToggleAlertConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ToggleAlertConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + + return cmd +} +type UpdateAlertConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateAlertConfigurationOperation + groupId string + alertConfigId string +} + +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 *UpdateAlertConfigurationOpts) Run() error { + params := &atlasv2.UpdateAlertConfigurationApiParams{ + GroupId: opts.groupId, + AlertConfigId: opts.alertConfigId, + } + resp, _, err := opts.store.UpdateAlertConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateAlertConfigurationTemplate = "<>" + +func UpdateAlertConfigurationBuilder() cobra.Command { + opts := UpdateAlertConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateAlertConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_alert_configurations_store.go b/internal/generated/api_alert_configurations_store.go new file mode 100644 index 0000000000..2bcb885b0d --- /dev/null +++ b/internal/generated/api_alert_configurations_store.go @@ -0,0 +1,105 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_alert_configurations_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateAlertConfigurationOperation, DeleteAlertConfigurationOperation, GetAlertConfigurationOperation, ListAlertConfigurationMatchersFieldNamesOperation, ListAlertConfigurationsOperation, ListAlertConfigurationsByAlertIdOperation, ToggleAlertConfigurationOperation, UpdateAlertConfigurationOperation + +type CreateAlertConfigurationOperation interface { + CreateAlertConfiguration (*atlasv2.CreateAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) +} + +// CreateAlertConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) CreateAlertConfiguration(params *atlasv2.CreateAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) { + result, _, err := s.clientv2.AlertConfigurationsApi.CreateAlertConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteAlertConfigurationOperation interface { + DeleteAlertConfiguration (*atlasv2.DeleteAlertConfigurationApiParams) (, error) +} + +// DeleteAlertConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteAlertConfiguration(params *atlasv2.DeleteAlertConfigurationApiParams) (error) { + _, err := s.clientv2.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(s.ctx, params).Execute() + return err +} + +type GetAlertConfigurationOperation interface { + GetAlertConfiguration (*atlasv2.GetAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) +} + +// GetAlertConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) GetAlertConfiguration(params *atlasv2.GetAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) { + result, _, err := s.clientv2.AlertConfigurationsApi.GetAlertConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListAlertConfigurationMatchersFieldNamesOperation interface { + ListAlertConfigurationMatchersFieldNames (*atlasv2.ListAlertConfigurationMatchersFieldNamesApiParams) (*atlasv2.[]MatcherField, error) +} + +// ListAlertConfigurationMatchersFieldNames encapsulates the logic to manage different cloud providers. +func (s *Store) ListAlertConfigurationMatchersFieldNames(params *atlasv2.ListAlertConfigurationMatchersFieldNamesApiParams) (*atlasv2.[]MatcherField, error) { + result, _, err := s.clientv2.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListAlertConfigurationsOperation interface { + ListAlertConfigurations (*atlasv2.ListAlertConfigurationsApiParams) (*atlasv2.PaginatedAlertConfig, error) +} + +// ListAlertConfigurations encapsulates the logic to manage different cloud providers. +func (s *Store) ListAlertConfigurations(params *atlasv2.ListAlertConfigurationsApiParams) (*atlasv2.PaginatedAlertConfig, error) { + result, _, err := s.clientv2.AlertConfigurationsApi.ListAlertConfigurationsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListAlertConfigurationsByAlertIdOperation interface { + ListAlertConfigurationsByAlertId (*atlasv2.ListAlertConfigurationsByAlertIdApiParams) (*atlasv2.PaginatedAlertConfig, error) +} + +// ListAlertConfigurationsByAlertId encapsulates the logic to manage different cloud providers. +func (s *Store) ListAlertConfigurationsByAlertId(params *atlasv2.ListAlertConfigurationsByAlertIdApiParams) (*atlasv2.PaginatedAlertConfig, error) { + result, _, err := s.clientv2.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(s.ctx, params).Execute() + return &result, err +} + +type ToggleAlertConfigurationOperation interface { + ToggleAlertConfiguration (*atlasv2.ToggleAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) +} + +// ToggleAlertConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) ToggleAlertConfiguration(params *atlasv2.ToggleAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) { + result, _, err := s.clientv2.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateAlertConfigurationOperation interface { + UpdateAlertConfiguration (*atlasv2.UpdateAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) +} + +// UpdateAlertConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateAlertConfiguration(params *atlasv2.UpdateAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) { + result, _, err := s.clientv2.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go new file mode 100644 index 0000000000..e2d43fc776 --- /dev/null +++ b/internal/generated/api_alerts_cmd.go @@ -0,0 +1,263 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type AcknowledgeAlertOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.AcknowledgeAlertOperation + groupId string + alertId string +} + +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 *AcknowledgeAlertOpts) Run() error { + params := &atlasv2.AcknowledgeAlertApiParams{ + GroupId: opts.groupId, + AlertId: opts.alertId, + } + resp, _, err := opts.store.AcknowledgeAlert(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const AcknowledgeAlertTemplate = "<>" + +func AcknowledgeAlertBuilder() cobra.Command { + opts := AcknowledgeAlertOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), AcknowledgeAlertTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") + + return cmd +} +type GetAlertOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetAlertOperation + groupId string + alertId string +} + +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 *GetAlertOpts) Run() error { + params := &atlasv2.GetAlertApiParams{ + GroupId: opts.groupId, + AlertId: opts.alertId, + } + resp, _, err := opts.store.GetAlert(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetAlertTemplate = "<>" + +func GetAlertBuilder() cobra.Command { + opts := GetAlertOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetAlertTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") + + return cmd +} +type ListAlertsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAlertsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 + status string +} + +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 *ListAlertsOpts) Run() error { + params := &atlasv2.ListAlertsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + Status: opts.status, + } + resp, _, err := opts.store.ListAlerts(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAlertsTemplate = "<>" + +func ListAlertsBuilder() cobra.Command { + opts := ListAlertsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAlertsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.status, "status", "", "usage description") + + return cmd +} +type ListAlertsByAlertConfigurationIdOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAlertsByAlertConfigurationIdOperation + groupId string + alertConfigId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListAlertsByAlertConfigurationIdOpts) Run() error { + params := &atlasv2.ListAlertsByAlertConfigurationIdApiParams{ + GroupId: opts.groupId, + AlertConfigId: opts.alertConfigId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListAlertsByAlertConfigurationId(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAlertsByAlertConfigurationIdTemplate = "<>" + +func ListAlertsByAlertConfigurationIdBuilder() cobra.Command { + opts := ListAlertsByAlertConfigurationIdOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAlertsByAlertConfigurationIdTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_alerts_store.go b/internal/generated/api_alerts_store.go new file mode 100644 index 0000000000..0f5a7f95d2 --- /dev/null +++ b/internal/generated/api_alerts_store.go @@ -0,0 +1,65 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_alerts_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas AcknowledgeAlertOperation, GetAlertOperation, ListAlertsOperation, ListAlertsByAlertConfigurationIdOperation + +type AcknowledgeAlertOperation interface { + AcknowledgeAlert (*atlasv2.AcknowledgeAlertApiParams) (*atlasv2.AlertViewForNdsGroup, error) +} + +// AcknowledgeAlert encapsulates the logic to manage different cloud providers. +func (s *Store) AcknowledgeAlert(params *atlasv2.AcknowledgeAlertApiParams) (*atlasv2.AlertViewForNdsGroup, error) { + result, _, err := s.clientv2.AlertsApi.AcknowledgeAlertWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetAlertOperation interface { + GetAlert (*atlasv2.GetAlertApiParams) (*atlasv2.AlertViewForNdsGroup, error) +} + +// GetAlert encapsulates the logic to manage different cloud providers. +func (s *Store) GetAlert(params *atlasv2.GetAlertApiParams) (*atlasv2.AlertViewForNdsGroup, error) { + result, _, err := s.clientv2.AlertsApi.GetAlertWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListAlertsOperation interface { + ListAlerts (*atlasv2.ListAlertsApiParams) (*atlasv2.PaginatedAlert, error) +} + +// ListAlerts encapsulates the logic to manage different cloud providers. +func (s *Store) ListAlerts(params *atlasv2.ListAlertsApiParams) (*atlasv2.PaginatedAlert, error) { + result, _, err := s.clientv2.AlertsApi.ListAlertsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListAlertsByAlertConfigurationIdOperation interface { + ListAlertsByAlertConfigurationId (*atlasv2.ListAlertsByAlertConfigurationIdApiParams) (*atlasv2.PaginatedAlert, error) +} + +// ListAlertsByAlertConfigurationId encapsulates the logic to manage different cloud providers. +func (s *Store) ListAlertsByAlertConfigurationId(params *atlasv2.ListAlertsByAlertConfigurationIdApiParams) (*atlasv2.PaginatedAlert, error) { + result, _, err := s.clientv2.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go new file mode 100644 index 0000000000..b5f056597b --- /dev/null +++ b/internal/generated/api_atlas_search_cmd.go @@ -0,0 +1,315 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateAtlasSearchIndexOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateAtlasSearchIndexOperation + groupId string + clusterName string +} + +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 *CreateAtlasSearchIndexOpts) Run() error { + params := &atlasv2.CreateAtlasSearchIndexApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.CreateAtlasSearchIndex(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateAtlasSearchIndexTemplate = "<>" + +func CreateAtlasSearchIndexBuilder() cobra.Command { + opts := CreateAtlasSearchIndexOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateAtlasSearchIndexTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type DeleteAtlasSearchIndexOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteAtlasSearchIndexOperation + groupId string + clusterName string + indexId string +} + +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 *DeleteAtlasSearchIndexOpts) Run() error { + params := &atlasv2.DeleteAtlasSearchIndexApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IndexId: opts.indexId, + } + resp, _, err := opts.store.DeleteAtlasSearchIndex(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteAtlasSearchIndexTemplate = "<>" + +func DeleteAtlasSearchIndexBuilder() cobra.Command { + opts := DeleteAtlasSearchIndexOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteAtlasSearchIndexTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") + + return cmd +} +type GetAtlasSearchIndexOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetAtlasSearchIndexOperation + groupId string + clusterName string + indexId string +} + +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 *GetAtlasSearchIndexOpts) Run() error { + params := &atlasv2.GetAtlasSearchIndexApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IndexId: opts.indexId, + } + resp, _, err := opts.store.GetAtlasSearchIndex(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetAtlasSearchIndexTemplate = "<>" + +func GetAtlasSearchIndexBuilder() cobra.Command { + opts := GetAtlasSearchIndexOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetAtlasSearchIndexTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") + + return cmd +} +type ListAtlasSearchIndexesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAtlasSearchIndexesOperation + groupId string + clusterName string + collectionName string + databaseName string +} + +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 *ListAtlasSearchIndexesOpts) Run() error { + params := &atlasv2.ListAtlasSearchIndexesApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + CollectionName: opts.collectionName, + DatabaseName: opts.databaseName, + } + resp, _, err := opts.store.ListAtlasSearchIndexes(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAtlasSearchIndexesTemplate = "<>" + +func ListAtlasSearchIndexesBuilder() cobra.Command { + opts := ListAtlasSearchIndexesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAtlasSearchIndexesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + + return cmd +} +type UpdateAtlasSearchIndexOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateAtlasSearchIndexOperation + groupId string + clusterName string + indexId string +} + +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 *UpdateAtlasSearchIndexOpts) Run() error { + params := &atlasv2.UpdateAtlasSearchIndexApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IndexId: opts.indexId, + } + resp, _, err := opts.store.UpdateAtlasSearchIndex(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateAtlasSearchIndexTemplate = "<>" + +func UpdateAtlasSearchIndexBuilder() cobra.Command { + opts := UpdateAtlasSearchIndexOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateAtlasSearchIndexTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_atlas_search_store.go b/internal/generated/api_atlas_search_store.go new file mode 100644 index 0000000000..6181d5f1cc --- /dev/null +++ b/internal/generated/api_atlas_search_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_atlas_search_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateAtlasSearchIndexOperation, DeleteAtlasSearchIndexOperation, GetAtlasSearchIndexOperation, ListAtlasSearchIndexesOperation, UpdateAtlasSearchIndexOperation + +type CreateAtlasSearchIndexOperation interface { + CreateAtlasSearchIndex (*atlasv2.CreateAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) +} + +// CreateAtlasSearchIndex encapsulates the logic to manage different cloud providers. +func (s *Store) CreateAtlasSearchIndex(params *atlasv2.CreateAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) { + result, _, err := s.clientv2.AtlasSearchApi.CreateAtlasSearchIndexWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteAtlasSearchIndexOperation interface { + DeleteAtlasSearchIndex (*atlasv2.DeleteAtlasSearchIndexApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteAtlasSearchIndex encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteAtlasSearchIndex(params *atlasv2.DeleteAtlasSearchIndexApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetAtlasSearchIndexOperation interface { + GetAtlasSearchIndex (*atlasv2.GetAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) +} + +// GetAtlasSearchIndex encapsulates the logic to manage different cloud providers. +func (s *Store) GetAtlasSearchIndex(params *atlasv2.GetAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) { + result, _, err := s.clientv2.AtlasSearchApi.GetAtlasSearchIndexWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListAtlasSearchIndexesOperation interface { + ListAtlasSearchIndexes (*atlasv2.ListAtlasSearchIndexesApiParams) (*atlasv2.[]FTSIndex, error) +} + +// ListAtlasSearchIndexes encapsulates the logic to manage different cloud providers. +func (s *Store) ListAtlasSearchIndexes(params *atlasv2.ListAtlasSearchIndexesApiParams) (*atlasv2.[]FTSIndex, error) { + result, _, err := s.clientv2.AtlasSearchApi.ListAtlasSearchIndexesWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateAtlasSearchIndexOperation interface { + UpdateAtlasSearchIndex (*atlasv2.UpdateAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) +} + +// UpdateAtlasSearchIndex encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateAtlasSearchIndex(params *atlasv2.UpdateAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) { + result, _, err := s.clientv2.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go new file mode 100644 index 0000000000..aa1d01b76e --- /dev/null +++ b/internal/generated/api_auditing_cmd.go @@ -0,0 +1,129 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type GetAuditingConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetAuditingConfigurationOperation + groupId string +} + +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 *GetAuditingConfigurationOpts) Run() error { + params := &atlasv2.GetAuditingConfigurationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetAuditingConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetAuditingConfigurationTemplate = "<>" + +func GetAuditingConfigurationBuilder() cobra.Command { + opts := GetAuditingConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetAuditingConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpdateAuditingConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateAuditingConfigurationOperation + groupId string +} + +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 *UpdateAuditingConfigurationOpts) Run() error { + params := &atlasv2.UpdateAuditingConfigurationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpdateAuditingConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateAuditingConfigurationTemplate = "<>" + +func UpdateAuditingConfigurationBuilder() cobra.Command { + opts := UpdateAuditingConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateAuditingConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_auditing_store.go b/internal/generated/api_auditing_store.go new file mode 100644 index 0000000000..287f30bd4b --- /dev/null +++ b/internal/generated/api_auditing_store.go @@ -0,0 +1,45 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_auditing_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetAuditingConfigurationOperation, UpdateAuditingConfigurationOperation + +type GetAuditingConfigurationOperation interface { + GetAuditingConfiguration (*atlasv2.GetAuditingConfigurationApiParams) (*atlasv2.AuditLog, error) +} + +// GetAuditingConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) GetAuditingConfiguration(params *atlasv2.GetAuditingConfigurationApiParams) (*atlasv2.AuditLog, error) { + result, _, err := s.clientv2.AuditingApi.GetAuditingConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateAuditingConfigurationOperation interface { + UpdateAuditingConfiguration (*atlasv2.UpdateAuditingConfigurationApiParams) (*atlasv2.AuditLog, error) +} + +// UpdateAuditingConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateAuditingConfiguration(params *atlasv2.UpdateAuditingConfigurationApiParams) (*atlasv2.AuditLog, error) { + result, _, err := s.clientv2.AuditingApi.UpdateAuditingConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go new file mode 100644 index 0000000000..5aeb264b7d --- /dev/null +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -0,0 +1,129 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type GetAWSCustomDNSOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetAWSCustomDNSOperation + groupId string +} + +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 *GetAWSCustomDNSOpts) Run() error { + params := &atlasv2.GetAWSCustomDNSApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetAWSCustomDNS(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetAWSCustomDNSTemplate = "<>" + +func GetAWSCustomDNSBuilder() cobra.Command { + opts := GetAWSCustomDNSOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetAWSCustomDNSTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type ToggleAWSCustomDNSOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ToggleAWSCustomDNSOperation + groupId string +} + +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 *ToggleAWSCustomDNSOpts) Run() error { + params := &atlasv2.ToggleAWSCustomDNSApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.ToggleAWSCustomDNS(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ToggleAWSCustomDNSTemplate = "<>" + +func ToggleAWSCustomDNSBuilder() cobra.Command { + opts := ToggleAWSCustomDNSOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ToggleAWSCustomDNSTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_aws_clusters_dns_store.go b/internal/generated/api_aws_clusters_dns_store.go new file mode 100644 index 0000000000..b82cd96e25 --- /dev/null +++ b/internal/generated/api_aws_clusters_dns_store.go @@ -0,0 +1,45 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_aws_clusters_dns_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetAWSCustomDNSOperation, ToggleAWSCustomDNSOperation + +type GetAWSCustomDNSOperation interface { + GetAWSCustomDNS (*atlasv2.GetAWSCustomDNSApiParams) (*atlasv2.AWSCustomDNSEnabled, error) +} + +// GetAWSCustomDNS encapsulates the logic to manage different cloud providers. +func (s *Store) GetAWSCustomDNS(params *atlasv2.GetAWSCustomDNSApiParams) (*atlasv2.AWSCustomDNSEnabled, error) { + result, _, err := s.clientv2.AWSClustersDNSApi.GetAWSCustomDNSWithParams(s.ctx, params).Execute() + return &result, err +} + +type ToggleAWSCustomDNSOperation interface { + ToggleAWSCustomDNS (*atlasv2.ToggleAWSCustomDNSApiParams) (*atlasv2.AWSCustomDNSEnabled, error) +} + +// ToggleAWSCustomDNS encapsulates the logic to manage different cloud providers. +func (s *Store) ToggleAWSCustomDNS(params *atlasv2.ToggleAWSCustomDNSApiParams) (*atlasv2.AWSCustomDNSEnabled, error) { + result, _, err := s.clientv2.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go new file mode 100644 index 0000000000..a716b18e37 --- /dev/null +++ b/internal/generated/api_cloud_backups_cmd.go @@ -0,0 +1,1692 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CancelBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CancelBackupRestoreJobOperation + groupId string + clusterName string + restoreJobId string +} + +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 *CancelBackupRestoreJobOpts) Run() error { + params := &atlasv2.CancelBackupRestoreJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + RestoreJobId: opts.restoreJobId, + } + resp, _, err := opts.store.CancelBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CancelBackupRestoreJobTemplate = "<>" + +func CancelBackupRestoreJobBuilder() cobra.Command { + opts := CancelBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CancelBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") + + return cmd +} +type CreateBackupExportJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateBackupExportJobOperation + groupId string + clusterName string +} + +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 *CreateBackupExportJobOpts) Run() error { + params := &atlasv2.CreateBackupExportJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.CreateBackupExportJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateBackupExportJobTemplate = "<>" + +func CreateBackupExportJobBuilder() cobra.Command { + opts := CreateBackupExportJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateBackupExportJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type CreateBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateBackupRestoreJobOperation + groupId string + clusterName string +} + +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 *CreateBackupRestoreJobOpts) Run() error { + params := &atlasv2.CreateBackupRestoreJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.CreateBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateBackupRestoreJobTemplate = "<>" + +func CreateBackupRestoreJobBuilder() cobra.Command { + opts := CreateBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type CreateExportBucketOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateExportBucketOperation + groupId string +} + +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 *CreateExportBucketOpts) Run() error { + params := &atlasv2.CreateExportBucketApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateExportBucket(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateExportBucketTemplate = "<>" + +func CreateExportBucketBuilder() cobra.Command { + opts := CreateExportBucketOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateExportBucketTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type CreateServerlessBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateServerlessBackupRestoreJobOperation + groupId string + clusterName string +} + +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 *CreateServerlessBackupRestoreJobOpts) Run() error { + params := &atlasv2.CreateServerlessBackupRestoreJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.CreateServerlessBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateServerlessBackupRestoreJobTemplate = "<>" + +func CreateServerlessBackupRestoreJobBuilder() cobra.Command { + opts := CreateServerlessBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateServerlessBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type DeleteAllBackupSchedulesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteAllBackupSchedulesOperation + groupId string + clusterName string +} + +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 *DeleteAllBackupSchedulesOpts) Run() error { + params := &atlasv2.DeleteAllBackupSchedulesApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.DeleteAllBackupSchedules(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteAllBackupSchedulesTemplate = "<>" + +func DeleteAllBackupSchedulesBuilder() cobra.Command { + opts := DeleteAllBackupSchedulesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteAllBackupSchedulesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type DeleteExportBucketOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteExportBucketOperation + groupId string + exportBucketId string +} + +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 *DeleteExportBucketOpts) Run() error { + params := &atlasv2.DeleteExportBucketApiParams{ + GroupId: opts.groupId, + ExportBucketId: opts.exportBucketId, + } + resp, _, err := opts.store.DeleteExportBucket(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteExportBucketTemplate = "<>" + +func DeleteExportBucketBuilder() cobra.Command { + opts := DeleteExportBucketOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteExportBucketTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "usage description") + + return cmd +} +type DeleteReplicaSetBackupOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteReplicaSetBackupOperation + groupId string + clusterName string + snapshotId string +} + +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 *DeleteReplicaSetBackupOpts) Run() error { + params := &atlasv2.DeleteReplicaSetBackupApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.DeleteReplicaSetBackup(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteReplicaSetBackupTemplate = "<>" + +func DeleteReplicaSetBackupBuilder() cobra.Command { + opts := DeleteReplicaSetBackupOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteReplicaSetBackupTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type DeleteShardedClusterBackupOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteShardedClusterBackupOperation + groupId string + clusterName string + snapshotId string +} + +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 *DeleteShardedClusterBackupOpts) Run() error { + params := &atlasv2.DeleteShardedClusterBackupApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.DeleteShardedClusterBackup(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteShardedClusterBackupTemplate = "<>" + +func DeleteShardedClusterBackupBuilder() cobra.Command { + opts := DeleteShardedClusterBackupOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteShardedClusterBackupTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type GetBackupExportJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetBackupExportJobOperation + groupId string + clusterName string + exportId string +} + +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 *GetBackupExportJobOpts) Run() error { + params := &atlasv2.GetBackupExportJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + ExportId: opts.exportId, + } + resp, _, err := opts.store.GetBackupExportJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetBackupExportJobTemplate = "<>" + +func GetBackupExportJobBuilder() cobra.Command { + opts := GetBackupExportJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetBackupExportJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.exportId, "exportId", "", "usage description") + + return cmd +} +type GetBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetBackupRestoreJobOperation + groupId string + clusterName string + restoreJobId string +} + +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 *GetBackupRestoreJobOpts) Run() error { + params := &atlasv2.GetBackupRestoreJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + RestoreJobId: opts.restoreJobId, + } + resp, _, err := opts.store.GetBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetBackupRestoreJobTemplate = "<>" + +func GetBackupRestoreJobBuilder() cobra.Command { + opts := GetBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") + + return cmd +} +type GetBackupScheduleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetBackupScheduleOperation + groupId string + clusterName string +} + +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 *GetBackupScheduleOpts) Run() error { + params := &atlasv2.GetBackupScheduleApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetBackupSchedule(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetBackupScheduleTemplate = "<>" + +func GetBackupScheduleBuilder() cobra.Command { + opts := GetBackupScheduleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetBackupScheduleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type GetDataProtectionSettingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetDataProtectionSettingsOperation + groupId string +} + +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 *GetDataProtectionSettingsOpts) Run() error { + params := &atlasv2.GetDataProtectionSettingsApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetDataProtectionSettings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetDataProtectionSettingsTemplate = "<>" + +func GetDataProtectionSettingsBuilder() cobra.Command { + opts := GetDataProtectionSettingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetDataProtectionSettingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetExportBucketOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetExportBucketOperation + groupId string + exportBucketId string +} + +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 *GetExportBucketOpts) Run() error { + params := &atlasv2.GetExportBucketApiParams{ + GroupId: opts.groupId, + ExportBucketId: opts.exportBucketId, + } + resp, _, err := opts.store.GetExportBucket(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetExportBucketTemplate = "<>" + +func GetExportBucketBuilder() cobra.Command { + opts := GetExportBucketOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetExportBucketTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "usage description") + + return cmd +} +type GetReplicaSetBackupOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetReplicaSetBackupOperation + groupId string + clusterName string + snapshotId string +} + +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 *GetReplicaSetBackupOpts) Run() error { + params := &atlasv2.GetReplicaSetBackupApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.GetReplicaSetBackup(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetReplicaSetBackupTemplate = "<>" + +func GetReplicaSetBackupBuilder() cobra.Command { + opts := GetReplicaSetBackupOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetReplicaSetBackupTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type GetServerlessBackupOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetServerlessBackupOperation + groupId string + clusterName string + snapshotId string +} + +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 *GetServerlessBackupOpts) Run() error { + params := &atlasv2.GetServerlessBackupApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.GetServerlessBackup(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetServerlessBackupTemplate = "<>" + +func GetServerlessBackupBuilder() cobra.Command { + opts := GetServerlessBackupOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetServerlessBackupTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type GetServerlessBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetServerlessBackupRestoreJobOperation + groupId string + clusterName string + restoreJobId string +} + +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 *GetServerlessBackupRestoreJobOpts) Run() error { + params := &atlasv2.GetServerlessBackupRestoreJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + RestoreJobId: opts.restoreJobId, + } + resp, _, err := opts.store.GetServerlessBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetServerlessBackupRestoreJobTemplate = "<>" + +func GetServerlessBackupRestoreJobBuilder() cobra.Command { + opts := GetServerlessBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetServerlessBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") + + return cmd +} +type GetShardedClusterBackupOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetShardedClusterBackupOperation + groupId string + clusterName string + snapshotId string +} + +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 *GetShardedClusterBackupOpts) Run() error { + params := &atlasv2.GetShardedClusterBackupApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.GetShardedClusterBackup(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetShardedClusterBackupTemplate = "<>" + +func GetShardedClusterBackupBuilder() cobra.Command { + opts := GetShardedClusterBackupOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetShardedClusterBackupTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type ListBackupExportJobsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListBackupExportJobsOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListBackupExportJobsOpts) Run() error { + params := &atlasv2.ListBackupExportJobsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListBackupExportJobs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListBackupExportJobsTemplate = "<>" + +func ListBackupExportJobsBuilder() cobra.Command { + opts := ListBackupExportJobsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListBackupExportJobsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListBackupRestoreJobsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListBackupRestoreJobsOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListBackupRestoreJobsOpts) Run() error { + params := &atlasv2.ListBackupRestoreJobsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListBackupRestoreJobs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListBackupRestoreJobsTemplate = "<>" + +func ListBackupRestoreJobsBuilder() cobra.Command { + opts := ListBackupRestoreJobsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListBackupRestoreJobsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListExportBucketsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListExportBucketsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListExportBucketsOpts) Run() error { + params := &atlasv2.ListExportBucketsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListExportBuckets(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListExportBucketsTemplate = "<>" + +func ListExportBucketsBuilder() cobra.Command { + opts := ListExportBucketsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListExportBucketsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListReplicaSetBackupsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListReplicaSetBackupsOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListReplicaSetBackupsOpts) Run() error { + params := &atlasv2.ListReplicaSetBackupsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListReplicaSetBackups(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListReplicaSetBackupsTemplate = "<>" + +func ListReplicaSetBackupsBuilder() cobra.Command { + opts := ListReplicaSetBackupsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListReplicaSetBackupsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListServerlessBackupRestoreJobsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListServerlessBackupRestoreJobsOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListServerlessBackupRestoreJobsOpts) Run() error { + params := &atlasv2.ListServerlessBackupRestoreJobsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListServerlessBackupRestoreJobs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListServerlessBackupRestoreJobsTemplate = "<>" + +func ListServerlessBackupRestoreJobsBuilder() cobra.Command { + opts := ListServerlessBackupRestoreJobsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListServerlessBackupRestoreJobsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListServerlessBackupsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListServerlessBackupsOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListServerlessBackupsOpts) Run() error { + params := &atlasv2.ListServerlessBackupsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListServerlessBackups(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListServerlessBackupsTemplate = "<>" + +func ListServerlessBackupsBuilder() cobra.Command { + opts := ListServerlessBackupsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListServerlessBackupsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListShardedClusterBackupsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListShardedClusterBackupsOperation + groupId string + clusterName string +} + +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 *ListShardedClusterBackupsOpts) Run() error { + params := &atlasv2.ListShardedClusterBackupsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.ListShardedClusterBackups(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListShardedClusterBackupsTemplate = "<>" + +func ListShardedClusterBackupsBuilder() cobra.Command { + opts := ListShardedClusterBackupsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListShardedClusterBackupsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type TakeSnapshotOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.TakeSnapshotOperation + groupId string + clusterName string +} + +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 *TakeSnapshotOpts) Run() error { + params := &atlasv2.TakeSnapshotApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.TakeSnapshot(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const TakeSnapshotTemplate = "<>" + +func TakeSnapshotBuilder() cobra.Command { + opts := TakeSnapshotOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), TakeSnapshotTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type UpdateBackupScheduleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateBackupScheduleOperation + groupId string + clusterName string +} + +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 *UpdateBackupScheduleOpts) Run() error { + params := &atlasv2.UpdateBackupScheduleApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.UpdateBackupSchedule(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateBackupScheduleTemplate = "<>" + +func UpdateBackupScheduleBuilder() cobra.Command { + opts := UpdateBackupScheduleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateBackupScheduleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type UpdateDataProtectionSettingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateDataProtectionSettingsOperation + groupId string +} + +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 *UpdateDataProtectionSettingsOpts) Run() error { + params := &atlasv2.UpdateDataProtectionSettingsApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpdateDataProtectionSettings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateDataProtectionSettingsTemplate = "<>" + +func UpdateDataProtectionSettingsBuilder() cobra.Command { + opts := UpdateDataProtectionSettingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateDataProtectionSettingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpdateSnapshotRetentionOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateSnapshotRetentionOperation + groupId string + clusterName string + snapshotId string +} + +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 *UpdateSnapshotRetentionOpts) Run() error { + params := &atlasv2.UpdateSnapshotRetentionApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.UpdateSnapshotRetention(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateSnapshotRetentionTemplate = "<>" + +func UpdateSnapshotRetentionBuilder() cobra.Command { + opts := UpdateSnapshotRetentionOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateSnapshotRetentionTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_cloud_backups_store.go b/internal/generated/api_cloud_backups_store.go new file mode 100644 index 0000000000..63f198382f --- /dev/null +++ b/internal/generated/api_cloud_backups_store.go @@ -0,0 +1,315 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_cloud_backups_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CancelBackupRestoreJobOperation, CreateBackupExportJobOperation, CreateBackupRestoreJobOperation, CreateExportBucketOperation, CreateServerlessBackupRestoreJobOperation, DeleteAllBackupSchedulesOperation, DeleteExportBucketOperation, DeleteReplicaSetBackupOperation, DeleteShardedClusterBackupOperation, GetBackupExportJobOperation, GetBackupRestoreJobOperation, GetBackupScheduleOperation, GetDataProtectionSettingsOperation, GetExportBucketOperation, GetReplicaSetBackupOperation, GetServerlessBackupOperation, GetServerlessBackupRestoreJobOperation, GetShardedClusterBackupOperation, ListBackupExportJobsOperation, ListBackupRestoreJobsOperation, ListExportBucketsOperation, ListReplicaSetBackupsOperation, ListServerlessBackupRestoreJobsOperation, ListServerlessBackupsOperation, ListShardedClusterBackupsOperation, TakeSnapshotOperation, UpdateBackupScheduleOperation, UpdateDataProtectionSettingsOperation, UpdateSnapshotRetentionOperation + +type CancelBackupRestoreJobOperation interface { + CancelBackupRestoreJob (*atlasv2.CancelBackupRestoreJobApiParams) (*atlasv2.map[string]interface{}, error) +} + +// CancelBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) CancelBackupRestoreJob(params *atlasv2.CancelBackupRestoreJobApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.CloudBackupsApi.CancelBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateBackupExportJobOperation interface { + CreateBackupExportJob (*atlasv2.CreateBackupExportJobApiParams) (*atlasv2.DiskBackupExportJob, error) +} + +// CreateBackupExportJob encapsulates the logic to manage different cloud providers. +func (s *Store) CreateBackupExportJob(params *atlasv2.CreateBackupExportJobApiParams) (*atlasv2.DiskBackupExportJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.CreateBackupExportJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateBackupRestoreJobOperation interface { + CreateBackupRestoreJob (*atlasv2.CreateBackupRestoreJobApiParams) (*atlasv2.DiskBackupRestoreJob, error) +} + +// CreateBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) CreateBackupRestoreJob(params *atlasv2.CreateBackupRestoreJobApiParams) (*atlasv2.DiskBackupRestoreJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.CreateBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateExportBucketOperation interface { + CreateExportBucket (*atlasv2.CreateExportBucketApiParams) (*atlasv2.DiskBackupSnapshotAWSExportBucket, error) +} + +// CreateExportBucket encapsulates the logic to manage different cloud providers. +func (s *Store) CreateExportBucket(params *atlasv2.CreateExportBucketApiParams) (*atlasv2.DiskBackupSnapshotAWSExportBucket, error) { + result, _, err := s.clientv2.CloudBackupsApi.CreateExportBucketWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateServerlessBackupRestoreJobOperation interface { + CreateServerlessBackupRestoreJob (*atlasv2.CreateServerlessBackupRestoreJobApiParams) (*atlasv2.ServerlessBackupRestoreJob, error) +} + +// CreateServerlessBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) CreateServerlessBackupRestoreJob(params *atlasv2.CreateServerlessBackupRestoreJobApiParams) (*atlasv2.ServerlessBackupRestoreJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteAllBackupSchedulesOperation interface { + DeleteAllBackupSchedules (*atlasv2.DeleteAllBackupSchedulesApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) +} + +// DeleteAllBackupSchedules encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteAllBackupSchedules(params *atlasv2.DeleteAllBackupSchedulesApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) { + result, _, err := s.clientv2.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteExportBucketOperation interface { + DeleteExportBucket (*atlasv2.DeleteExportBucketApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteExportBucket encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteExportBucket(params *atlasv2.DeleteExportBucketApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.CloudBackupsApi.DeleteExportBucketWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteReplicaSetBackupOperation interface { + DeleteReplicaSetBackup (*atlasv2.DeleteReplicaSetBackupApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteReplicaSetBackup encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteReplicaSetBackup(params *atlasv2.DeleteReplicaSetBackupApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.CloudBackupsApi.DeleteReplicaSetBackupWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteShardedClusterBackupOperation interface { + DeleteShardedClusterBackup (*atlasv2.DeleteShardedClusterBackupApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteShardedClusterBackup encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteShardedClusterBackup(params *atlasv2.DeleteShardedClusterBackupApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.CloudBackupsApi.DeleteShardedClusterBackupWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetBackupExportJobOperation interface { + GetBackupExportJob (*atlasv2.GetBackupExportJobApiParams) (*atlasv2.DiskBackupExportJob, error) +} + +// GetBackupExportJob encapsulates the logic to manage different cloud providers. +func (s *Store) GetBackupExportJob(params *atlasv2.GetBackupExportJobApiParams) (*atlasv2.DiskBackupExportJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetBackupExportJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetBackupRestoreJobOperation interface { + GetBackupRestoreJob (*atlasv2.GetBackupRestoreJobApiParams) (*atlasv2.DiskBackupRestoreJob, error) +} + +// GetBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) GetBackupRestoreJob(params *atlasv2.GetBackupRestoreJobApiParams) (*atlasv2.DiskBackupRestoreJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetBackupScheduleOperation interface { + GetBackupSchedule (*atlasv2.GetBackupScheduleApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) +} + +// GetBackupSchedule encapsulates the logic to manage different cloud providers. +func (s *Store) GetBackupSchedule(params *atlasv2.GetBackupScheduleApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetBackupScheduleWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetDataProtectionSettingsOperation interface { + GetDataProtectionSettings (*atlasv2.GetDataProtectionSettingsApiParams) (*atlasv2.DataProtectionSettings, error) +} + +// GetDataProtectionSettings encapsulates the logic to manage different cloud providers. +func (s *Store) GetDataProtectionSettings(params *atlasv2.GetDataProtectionSettingsApiParams) (*atlasv2.DataProtectionSettings, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetDataProtectionSettingsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetExportBucketOperation interface { + GetExportBucket (*atlasv2.GetExportBucketApiParams) (*atlasv2.DiskBackupSnapshotAWSExportBucket, error) +} + +// GetExportBucket encapsulates the logic to manage different cloud providers. +func (s *Store) GetExportBucket(params *atlasv2.GetExportBucketApiParams) (*atlasv2.DiskBackupSnapshotAWSExportBucket, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetExportBucketWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetReplicaSetBackupOperation interface { + GetReplicaSetBackup (*atlasv2.GetReplicaSetBackupApiParams) (*atlasv2.DiskBackupReplicaSet, error) +} + +// GetReplicaSetBackup encapsulates the logic to manage different cloud providers. +func (s *Store) GetReplicaSetBackup(params *atlasv2.GetReplicaSetBackupApiParams) (*atlasv2.DiskBackupReplicaSet, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetReplicaSetBackupWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetServerlessBackupOperation interface { + GetServerlessBackup (*atlasv2.GetServerlessBackupApiParams) (*atlasv2.ServerlessBackupSnapshot, error) +} + +// GetServerlessBackup encapsulates the logic to manage different cloud providers. +func (s *Store) GetServerlessBackup(params *atlasv2.GetServerlessBackupApiParams) (*atlasv2.ServerlessBackupSnapshot, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetServerlessBackupWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetServerlessBackupRestoreJobOperation interface { + GetServerlessBackupRestoreJob (*atlasv2.GetServerlessBackupRestoreJobApiParams) (*atlasv2.ServerlessBackupRestoreJob, error) +} + +// GetServerlessBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) GetServerlessBackupRestoreJob(params *atlasv2.GetServerlessBackupRestoreJobApiParams) (*atlasv2.ServerlessBackupRestoreJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetShardedClusterBackupOperation interface { + GetShardedClusterBackup (*atlasv2.GetShardedClusterBackupApiParams) (*atlasv2.DiskBackupShardedClusterSnapshot, error) +} + +// GetShardedClusterBackup encapsulates the logic to manage different cloud providers. +func (s *Store) GetShardedClusterBackup(params *atlasv2.GetShardedClusterBackupApiParams) (*atlasv2.DiskBackupShardedClusterSnapshot, error) { + result, _, err := s.clientv2.CloudBackupsApi.GetShardedClusterBackupWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListBackupExportJobsOperation interface { + ListBackupExportJobs (*atlasv2.ListBackupExportJobsApiParams) (*atlasv2.PaginatedApiAtlasDiskBackupExportJob, error) +} + +// ListBackupExportJobs encapsulates the logic to manage different cloud providers. +func (s *Store) ListBackupExportJobs(params *atlasv2.ListBackupExportJobsApiParams) (*atlasv2.PaginatedApiAtlasDiskBackupExportJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.ListBackupExportJobsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListBackupRestoreJobsOperation interface { + ListBackupRestoreJobs (*atlasv2.ListBackupRestoreJobsApiParams) (*atlasv2.PaginatedCloudBackupRestoreJob, error) +} + +// ListBackupRestoreJobs encapsulates the logic to manage different cloud providers. +func (s *Store) ListBackupRestoreJobs(params *atlasv2.ListBackupRestoreJobsApiParams) (*atlasv2.PaginatedCloudBackupRestoreJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.ListBackupRestoreJobsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListExportBucketsOperation interface { + ListExportBuckets (*atlasv2.ListExportBucketsApiParams) (*atlasv2.PaginatedBackupSnapshotExportBucket, error) +} + +// ListExportBuckets encapsulates the logic to manage different cloud providers. +func (s *Store) ListExportBuckets(params *atlasv2.ListExportBucketsApiParams) (*atlasv2.PaginatedBackupSnapshotExportBucket, error) { + result, _, err := s.clientv2.CloudBackupsApi.ListExportBucketsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListReplicaSetBackupsOperation interface { + ListReplicaSetBackups (*atlasv2.ListReplicaSetBackupsApiParams) (*atlasv2.PaginatedCloudBackupReplicaSet, error) +} + +// ListReplicaSetBackups encapsulates the logic to manage different cloud providers. +func (s *Store) ListReplicaSetBackups(params *atlasv2.ListReplicaSetBackupsApiParams) (*atlasv2.PaginatedCloudBackupReplicaSet, error) { + result, _, err := s.clientv2.CloudBackupsApi.ListReplicaSetBackupsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListServerlessBackupRestoreJobsOperation interface { + ListServerlessBackupRestoreJobs (*atlasv2.ListServerlessBackupRestoreJobsApiParams) (*atlasv2.PaginatedApiAtlasServerlessBackupRestoreJob, error) +} + +// ListServerlessBackupRestoreJobs encapsulates the logic to manage different cloud providers. +func (s *Store) ListServerlessBackupRestoreJobs(params *atlasv2.ListServerlessBackupRestoreJobsApiParams) (*atlasv2.PaginatedApiAtlasServerlessBackupRestoreJob, error) { + result, _, err := s.clientv2.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListServerlessBackupsOperation interface { + ListServerlessBackups (*atlasv2.ListServerlessBackupsApiParams) (*atlasv2.PaginatedApiAtlasServerlessBackupSnapshot, error) +} + +// ListServerlessBackups encapsulates the logic to manage different cloud providers. +func (s *Store) ListServerlessBackups(params *atlasv2.ListServerlessBackupsApiParams) (*atlasv2.PaginatedApiAtlasServerlessBackupSnapshot, error) { + result, _, err := s.clientv2.CloudBackupsApi.ListServerlessBackupsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListShardedClusterBackupsOperation interface { + ListShardedClusterBackups (*atlasv2.ListShardedClusterBackupsApiParams) (*atlasv2.PaginatedCloudBackupShardedClusterSnapshot, error) +} + +// ListShardedClusterBackups encapsulates the logic to manage different cloud providers. +func (s *Store) ListShardedClusterBackups(params *atlasv2.ListShardedClusterBackupsApiParams) (*atlasv2.PaginatedCloudBackupShardedClusterSnapshot, error) { + result, _, err := s.clientv2.CloudBackupsApi.ListShardedClusterBackupsWithParams(s.ctx, params).Execute() + return &result, err +} + +type TakeSnapshotOperation interface { + TakeSnapshot (*atlasv2.TakeSnapshotApiParams) (*atlasv2.DiskBackupSnapshot, error) +} + +// TakeSnapshot encapsulates the logic to manage different cloud providers. +func (s *Store) TakeSnapshot(params *atlasv2.TakeSnapshotApiParams) (*atlasv2.DiskBackupSnapshot, error) { + result, _, err := s.clientv2.CloudBackupsApi.TakeSnapshotWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateBackupScheduleOperation interface { + UpdateBackupSchedule (*atlasv2.UpdateBackupScheduleApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) +} + +// UpdateBackupSchedule encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateBackupSchedule(params *atlasv2.UpdateBackupScheduleApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) { + result, _, err := s.clientv2.CloudBackupsApi.UpdateBackupScheduleWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateDataProtectionSettingsOperation interface { + UpdateDataProtectionSettings (*atlasv2.UpdateDataProtectionSettingsApiParams) (*atlasv2.DataProtectionSettings, error) +} + +// UpdateDataProtectionSettings encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateDataProtectionSettings(params *atlasv2.UpdateDataProtectionSettingsApiParams) (*atlasv2.DataProtectionSettings, error) { + result, _, err := s.clientv2.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateSnapshotRetentionOperation interface { + UpdateSnapshotRetention (*atlasv2.UpdateSnapshotRetentionApiParams) (*atlasv2.DiskBackupReplicaSet, error) +} + +// UpdateSnapshotRetention encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateSnapshotRetention(params *atlasv2.UpdateSnapshotRetentionApiParams) (*atlasv2.DiskBackupReplicaSet, error) { + result, _, err := s.clientv2.CloudBackupsApi.UpdateSnapshotRetentionWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go new file mode 100644 index 0000000000..f968c15b77 --- /dev/null +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -0,0 +1,450 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateLinkTokenOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateLinkTokenOperation + orgId string +} + +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 *CreateLinkTokenOpts) Run() error { + params := &atlasv2.CreateLinkTokenApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.CreateLinkToken(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateLinkTokenTemplate = "<>" + +func CreateLinkTokenBuilder() cobra.Command { + opts := CreateLinkTokenOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateLinkTokenTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type CreatePushMigrationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreatePushMigrationOperation + groupId string +} + +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 *CreatePushMigrationOpts) Run() error { + params := &atlasv2.CreatePushMigrationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreatePushMigration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreatePushMigrationTemplate = "<>" + +func CreatePushMigrationBuilder() cobra.Command { + opts := CreatePushMigrationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreatePushMigrationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type CutoverMigrationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CutoverMigrationOperation + groupId string + liveMigrationId string +} + +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 *CutoverMigrationOpts) Run() error { + params := &atlasv2.CutoverMigrationApiParams{ + GroupId: opts.groupId, + LiveMigrationId: opts.liveMigrationId, + } + _, err := opts.store.CutoverMigration(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const CutoverMigrationTemplate = "<>" + +func CutoverMigrationBuilder() cobra.Command { + opts := CutoverMigrationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CutoverMigrationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "usage description") + + return cmd +} +type DeleteLinkTokenOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteLinkTokenOperation + orgId string +} + +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 *DeleteLinkTokenOpts) Run() error { + params := &atlasv2.DeleteLinkTokenApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.DeleteLinkToken(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteLinkTokenTemplate = "<>" + +func DeleteLinkTokenBuilder() cobra.Command { + opts := DeleteLinkTokenOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteLinkTokenTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type GetPushMigrationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetPushMigrationOperation + groupId string + liveMigrationId string +} + +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 *GetPushMigrationOpts) Run() error { + params := &atlasv2.GetPushMigrationApiParams{ + GroupId: opts.groupId, + LiveMigrationId: opts.liveMigrationId, + } + resp, _, err := opts.store.GetPushMigration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetPushMigrationTemplate = "<>" + +func GetPushMigrationBuilder() cobra.Command { + opts := GetPushMigrationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetPushMigrationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "usage description") + + return cmd +} +type GetValidationStatusOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetValidationStatusOperation + groupId string + validationId string +} + +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 *GetValidationStatusOpts) Run() error { + params := &atlasv2.GetValidationStatusApiParams{ + GroupId: opts.groupId, + ValidationId: opts.validationId, + } + resp, _, err := opts.store.GetValidationStatus(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetValidationStatusTemplate = "<>" + +func GetValidationStatusBuilder() cobra.Command { + opts := GetValidationStatusOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetValidationStatusTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.validationId, "validationId", "", "usage description") + + return cmd +} +type ListSourceProjectsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListSourceProjectsOperation + orgId string +} + +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 *ListSourceProjectsOpts) Run() error { + params := &atlasv2.ListSourceProjectsApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.ListSourceProjects(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListSourceProjectsTemplate = "<>" + +func ListSourceProjectsBuilder() cobra.Command { + opts := ListSourceProjectsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListSourceProjectsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type ValidateMigrationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ValidateMigrationOperation + groupId string +} + +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 *ValidateMigrationOpts) Run() error { + params := &atlasv2.ValidateMigrationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.ValidateMigration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ValidateMigrationTemplate = "<>" + +func ValidateMigrationBuilder() cobra.Command { + opts := ValidateMigrationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ValidateMigrationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_cloud_migration_service_store.go b/internal/generated/api_cloud_migration_service_store.go new file mode 100644 index 0000000000..69f5e88b64 --- /dev/null +++ b/internal/generated/api_cloud_migration_service_store.go @@ -0,0 +1,105 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_cloud_migration_service_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateLinkTokenOperation, CreatePushMigrationOperation, CutoverMigrationOperation, DeleteLinkTokenOperation, GetPushMigrationOperation, GetValidationStatusOperation, ListSourceProjectsOperation, ValidateMigrationOperation + +type CreateLinkTokenOperation interface { + CreateLinkToken (*atlasv2.CreateLinkTokenApiParams) (*atlasv2.TargetOrg, error) +} + +// CreateLinkToken encapsulates the logic to manage different cloud providers. +func (s *Store) CreateLinkToken(params *atlasv2.CreateLinkTokenApiParams) (*atlasv2.TargetOrg, error) { + result, _, err := s.clientv2.CloudMigrationServiceApi.CreateLinkTokenWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreatePushMigrationOperation interface { + CreatePushMigration (*atlasv2.CreatePushMigrationApiParams) (*atlasv2.LiveMigrationResponse, error) +} + +// CreatePushMigration encapsulates the logic to manage different cloud providers. +func (s *Store) CreatePushMigration(params *atlasv2.CreatePushMigrationApiParams) (*atlasv2.LiveMigrationResponse, error) { + result, _, err := s.clientv2.CloudMigrationServiceApi.CreatePushMigrationWithParams(s.ctx, params).Execute() + return &result, err +} + +type CutoverMigrationOperation interface { + CutoverMigration (*atlasv2.CutoverMigrationApiParams) (, error) +} + +// CutoverMigration encapsulates the logic to manage different cloud providers. +func (s *Store) CutoverMigration(params *atlasv2.CutoverMigrationApiParams) (error) { + _, err := s.clientv2.CloudMigrationServiceApi.CutoverMigrationWithParams(s.ctx, params).Execute() + return err +} + +type DeleteLinkTokenOperation interface { + DeleteLinkToken (*atlasv2.DeleteLinkTokenApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteLinkToken encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteLinkToken(params *atlasv2.DeleteLinkTokenApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.CloudMigrationServiceApi.DeleteLinkTokenWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetPushMigrationOperation interface { + GetPushMigration (*atlasv2.GetPushMigrationApiParams) (*atlasv2.LiveMigrationResponse, error) +} + +// GetPushMigration encapsulates the logic to manage different cloud providers. +func (s *Store) GetPushMigration(params *atlasv2.GetPushMigrationApiParams) (*atlasv2.LiveMigrationResponse, error) { + result, _, err := s.clientv2.CloudMigrationServiceApi.GetPushMigrationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetValidationStatusOperation interface { + GetValidationStatus (*atlasv2.GetValidationStatusApiParams) (*atlasv2.Validation, error) +} + +// GetValidationStatus encapsulates the logic to manage different cloud providers. +func (s *Store) GetValidationStatus(params *atlasv2.GetValidationStatusApiParams) (*atlasv2.Validation, error) { + result, _, err := s.clientv2.CloudMigrationServiceApi.GetValidationStatusWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListSourceProjectsOperation interface { + ListSourceProjects (*atlasv2.ListSourceProjectsApiParams) (*atlasv2.[]AvailableProject, error) +} + +// ListSourceProjects encapsulates the logic to manage different cloud providers. +func (s *Store) ListSourceProjects(params *atlasv2.ListSourceProjectsApiParams) (*atlasv2.[]AvailableProject, error) { + result, _, err := s.clientv2.CloudMigrationServiceApi.ListSourceProjectsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ValidateMigrationOperation interface { + ValidateMigration (*atlasv2.ValidateMigrationApiParams) (*atlasv2.Validation, error) +} + +// ValidateMigration encapsulates the logic to manage different cloud providers. +func (s *Store) ValidateMigration(params *atlasv2.ValidateMigrationApiParams) (*atlasv2.Validation, error) { + result, _, err := s.clientv2.CloudMigrationServiceApi.ValidateMigrationWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go new file mode 100644 index 0000000000..33e1074601 --- /dev/null +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -0,0 +1,297 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type AuthorizeCloudProviderAccessRoleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.AuthorizeCloudProviderAccessRoleOperation + groupId string + roleId string +} + +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 *AuthorizeCloudProviderAccessRoleOpts) Run() error { + params := &atlasv2.AuthorizeCloudProviderAccessRoleApiParams{ + GroupId: opts.groupId, + RoleId: opts.roleId, + } + resp, _, err := opts.store.AuthorizeCloudProviderAccessRole(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const AuthorizeCloudProviderAccessRoleTemplate = "<>" + +func AuthorizeCloudProviderAccessRoleBuilder() cobra.Command { + opts := AuthorizeCloudProviderAccessRoleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), AuthorizeCloudProviderAccessRoleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") + + return cmd +} +type CreateCloudProviderAccessRoleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateCloudProviderAccessRoleOperation + groupId string +} + +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 *CreateCloudProviderAccessRoleOpts) Run() error { + params := &atlasv2.CreateCloudProviderAccessRoleApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateCloudProviderAccessRole(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateCloudProviderAccessRoleTemplate = "<>" + +func CreateCloudProviderAccessRoleBuilder() cobra.Command { + opts := CreateCloudProviderAccessRoleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateCloudProviderAccessRoleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeauthorizeCloudProviderAccessRoleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeauthorizeCloudProviderAccessRoleOperation + groupId string + cloudProvider string + roleId string +} + +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 *DeauthorizeCloudProviderAccessRoleOpts) Run() error { + params := &atlasv2.DeauthorizeCloudProviderAccessRoleApiParams{ + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + RoleId: opts.roleId, + } + _, err := opts.store.DeauthorizeCloudProviderAccessRole(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DeauthorizeCloudProviderAccessRoleTemplate = "<>" + +func DeauthorizeCloudProviderAccessRoleBuilder() cobra.Command { + opts := DeauthorizeCloudProviderAccessRoleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeauthorizeCloudProviderAccessRoleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") + + return cmd +} +type GetCloudProviderAccessRoleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetCloudProviderAccessRoleOperation + groupId string + roleId string +} + +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 *GetCloudProviderAccessRoleOpts) Run() error { + params := &atlasv2.GetCloudProviderAccessRoleApiParams{ + GroupId: opts.groupId, + RoleId: opts.roleId, + } + resp, _, err := opts.store.GetCloudProviderAccessRole(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetCloudProviderAccessRoleTemplate = "<>" + +func GetCloudProviderAccessRoleBuilder() cobra.Command { + opts := GetCloudProviderAccessRoleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetCloudProviderAccessRoleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") + + return cmd +} +type ListCloudProviderAccessRolesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListCloudProviderAccessRolesOperation + groupId string +} + +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 *ListCloudProviderAccessRolesOpts) Run() error { + params := &atlasv2.ListCloudProviderAccessRolesApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.ListCloudProviderAccessRoles(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListCloudProviderAccessRolesTemplate = "<>" + +func ListCloudProviderAccessRolesBuilder() cobra.Command { + opts := ListCloudProviderAccessRolesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListCloudProviderAccessRolesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_cloud_provider_access_store.go b/internal/generated/api_cloud_provider_access_store.go new file mode 100644 index 0000000000..5553d5e995 --- /dev/null +++ b/internal/generated/api_cloud_provider_access_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_cloud_provider_access_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas AuthorizeCloudProviderAccessRoleOperation, CreateCloudProviderAccessRoleOperation, DeauthorizeCloudProviderAccessRoleOperation, GetCloudProviderAccessRoleOperation, ListCloudProviderAccessRolesOperation + +type AuthorizeCloudProviderAccessRoleOperation interface { + AuthorizeCloudProviderAccessRole (*atlasv2.AuthorizeCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccessRole, error) +} + +// AuthorizeCloudProviderAccessRole encapsulates the logic to manage different cloud providers. +func (s *Store) AuthorizeCloudProviderAccessRole(params *atlasv2.AuthorizeCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccessRole, error) { + result, _, err := s.clientv2.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateCloudProviderAccessRoleOperation interface { + CreateCloudProviderAccessRole (*atlasv2.CreateCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccessRole, error) +} + +// CreateCloudProviderAccessRole encapsulates the logic to manage different cloud providers. +func (s *Store) CreateCloudProviderAccessRole(params *atlasv2.CreateCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccessRole, error) { + result, _, err := s.clientv2.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeauthorizeCloudProviderAccessRoleOperation interface { + DeauthorizeCloudProviderAccessRole (*atlasv2.DeauthorizeCloudProviderAccessRoleApiParams) (, error) +} + +// DeauthorizeCloudProviderAccessRole encapsulates the logic to manage different cloud providers. +func (s *Store) DeauthorizeCloudProviderAccessRole(params *atlasv2.DeauthorizeCloudProviderAccessRoleApiParams) (error) { + _, err := s.clientv2.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(s.ctx, params).Execute() + return err +} + +type GetCloudProviderAccessRoleOperation interface { + GetCloudProviderAccessRole (*atlasv2.GetCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccess, error) +} + +// GetCloudProviderAccessRole encapsulates the logic to manage different cloud providers. +func (s *Store) GetCloudProviderAccessRole(params *atlasv2.GetCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccess, error) { + result, _, err := s.clientv2.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListCloudProviderAccessRolesOperation interface { + ListCloudProviderAccessRoles (*atlasv2.ListCloudProviderAccessRolesApiParams) (*atlasv2.CloudProviderAccess, error) +} + +// ListCloudProviderAccessRoles encapsulates the logic to manage different cloud providers. +func (s *Store) ListCloudProviderAccessRoles(params *atlasv2.ListCloudProviderAccessRolesApiParams) (*atlasv2.CloudProviderAccess, error) { + result, _, err := s.clientv2.CloudProviderAccessApi.ListCloudProviderAccessRolesWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go new file mode 100644 index 0000000000..4e2333f1b6 --- /dev/null +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -0,0 +1,190 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type EndOutageSimulationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.EndOutageSimulationOperation + groupId string + clusterName string +} + +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 *EndOutageSimulationOpts) Run() error { + params := &atlasv2.EndOutageSimulationApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.EndOutageSimulation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const EndOutageSimulationTemplate = "<>" + +func EndOutageSimulationBuilder() cobra.Command { + opts := EndOutageSimulationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), EndOutageSimulationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type GetOutageSimulationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetOutageSimulationOperation + groupId string + clusterName string +} + +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 *GetOutageSimulationOpts) Run() error { + params := &atlasv2.GetOutageSimulationApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetOutageSimulation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetOutageSimulationTemplate = "<>" + +func GetOutageSimulationBuilder() cobra.Command { + opts := GetOutageSimulationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetOutageSimulationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type StartOutageSimulationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.StartOutageSimulationOperation + groupId string + clusterName string +} + +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 *StartOutageSimulationOpts) Run() error { + params := &atlasv2.StartOutageSimulationApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.StartOutageSimulation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const StartOutageSimulationTemplate = "<>" + +func StartOutageSimulationBuilder() cobra.Command { + opts := StartOutageSimulationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), StartOutageSimulationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_cluster_outage_simulation_store.go b/internal/generated/api_cluster_outage_simulation_store.go new file mode 100644 index 0000000000..74b0be7b8c --- /dev/null +++ b/internal/generated/api_cluster_outage_simulation_store.go @@ -0,0 +1,55 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_cluster_outage_simulation_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas EndOutageSimulationOperation, GetOutageSimulationOperation, StartOutageSimulationOperation + +type EndOutageSimulationOperation interface { + EndOutageSimulation (*atlasv2.EndOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) +} + +// EndOutageSimulation encapsulates the logic to manage different cloud providers. +func (s *Store) EndOutageSimulation(params *atlasv2.EndOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) { + result, _, err := s.clientv2.ClusterOutageSimulationApi.EndOutageSimulationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetOutageSimulationOperation interface { + GetOutageSimulation (*atlasv2.GetOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) +} + +// GetOutageSimulation encapsulates the logic to manage different cloud providers. +func (s *Store) GetOutageSimulation(params *atlasv2.GetOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) { + result, _, err := s.clientv2.ClusterOutageSimulationApi.GetOutageSimulationWithParams(s.ctx, params).Execute() + return &result, err +} + +type StartOutageSimulationOperation interface { + StartOutageSimulation (*atlasv2.StartOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) +} + +// StartOutageSimulation encapsulates the logic to manage different cloud providers. +func (s *Store) StartOutageSimulation(params *atlasv2.StartOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) { + result, _, err := s.clientv2.ClusterOutageSimulationApi.StartOutageSimulationWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go new file mode 100644 index 0000000000..1ebabedc0d --- /dev/null +++ b/internal/generated/api_clusters_cmd.go @@ -0,0 +1,529 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type GetClusterAdvancedConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetClusterAdvancedConfigurationOperation + groupId string + clusterName string +} + +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 *GetClusterAdvancedConfigurationOpts) Run() error { + params := &atlasv2.GetClusterAdvancedConfigurationApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetClusterAdvancedConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetClusterAdvancedConfigurationTemplate = "<>" + +func GetClusterAdvancedConfigurationBuilder() cobra.Command { + opts := GetClusterAdvancedConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetClusterAdvancedConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type GetClusterStatusOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetClusterStatusOperation + groupId string + clusterName string +} + +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 *GetClusterStatusOpts) Run() error { + params := &atlasv2.GetClusterStatusApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetClusterStatus(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetClusterStatusTemplate = "<>" + +func GetClusterStatusBuilder() cobra.Command { + opts := GetClusterStatusOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetClusterStatusTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type GetSampleDatasetLoadStatusOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetSampleDatasetLoadStatusOperation + groupId string + sampleDatasetId string +} + +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 *GetSampleDatasetLoadStatusOpts) Run() error { + params := &atlasv2.GetSampleDatasetLoadStatusApiParams{ + GroupId: opts.groupId, + SampleDatasetId: opts.sampleDatasetId, + } + resp, _, err := opts.store.GetSampleDatasetLoadStatus(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetSampleDatasetLoadStatusTemplate = "<>" + +func GetSampleDatasetLoadStatusBuilder() cobra.Command { + opts := GetSampleDatasetLoadStatusOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetSampleDatasetLoadStatusTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", "usage description") + + return cmd +} +type ListCloudProviderRegionsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListCloudProviderRegionsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 + providers []string + tier string +} + +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 *ListCloudProviderRegionsOpts) Run() error { + params := &atlasv2.ListCloudProviderRegionsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + Providers: opts.providers, + Tier: opts.tier, + } + resp, _, err := opts.store.ListCloudProviderRegions(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListCloudProviderRegionsTemplate = "<>" + +func ListCloudProviderRegionsBuilder() cobra.Command { + opts := ListCloudProviderRegionsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListCloudProviderRegionsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.providers, "providers", "", "usage description") + cmd.Flags().StringVar(&opts.tier, "tier", "", "usage description") + + return cmd +} +type ListClustersForAllProjectsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListClustersForAllProjectsOperation + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListClustersForAllProjectsOpts) Run() error { + params := &atlasv2.ListClustersForAllProjectsApiParams{ + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListClustersForAllProjects(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListClustersForAllProjectsTemplate = "<>" + +func ListClustersForAllProjectsBuilder() cobra.Command { + opts := ListClustersForAllProjectsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListClustersForAllProjectsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type LoadSampleDatasetOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.LoadSampleDatasetOperation + groupId string + name string +} + +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 *LoadSampleDatasetOpts) Run() error { + params := &atlasv2.LoadSampleDatasetApiParams{ + GroupId: opts.groupId, + Name: opts.name, + } + resp, _, err := opts.store.LoadSampleDataset(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const LoadSampleDatasetTemplate = "<>" + +func LoadSampleDatasetBuilder() cobra.Command { + opts := LoadSampleDatasetOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), LoadSampleDatasetTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + + return cmd +} +type UpdateClusterAdvancedConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateClusterAdvancedConfigurationOperation + groupId string + clusterName string +} + +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 *UpdateClusterAdvancedConfigurationOpts) Run() error { + params := &atlasv2.UpdateClusterAdvancedConfigurationApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.UpdateClusterAdvancedConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateClusterAdvancedConfigurationTemplate = "<>" + +func UpdateClusterAdvancedConfigurationBuilder() cobra.Command { + opts := UpdateClusterAdvancedConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateClusterAdvancedConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type UpgradeSharedClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpgradeSharedClusterOperation + groupId string +} + +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 *UpgradeSharedClusterOpts) Run() error { + params := &atlasv2.UpgradeSharedClusterApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpgradeSharedCluster(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpgradeSharedClusterTemplate = "<>" + +func UpgradeSharedClusterBuilder() cobra.Command { + opts := UpgradeSharedClusterOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpgradeSharedClusterTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpgradeSharedClusterToServerlessOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpgradeSharedClusterToServerlessOperation + groupId string +} + +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 *UpgradeSharedClusterToServerlessOpts) Run() error { + params := &atlasv2.UpgradeSharedClusterToServerlessApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpgradeSharedClusterToServerless(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpgradeSharedClusterToServerlessTemplate = "<>" + +func UpgradeSharedClusterToServerlessBuilder() cobra.Command { + opts := UpgradeSharedClusterToServerlessOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpgradeSharedClusterToServerlessTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_clusters_store.go b/internal/generated/api_clusters_store.go new file mode 100644 index 0000000000..0b981a278d --- /dev/null +++ b/internal/generated/api_clusters_store.go @@ -0,0 +1,115 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_clusters_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetClusterAdvancedConfigurationOperation, GetClusterStatusOperation, GetSampleDatasetLoadStatusOperation, ListCloudProviderRegionsOperation, ListClustersForAllProjectsOperation, LoadSampleDatasetOperation, UpdateClusterAdvancedConfigurationOperation, UpgradeSharedClusterOperation, UpgradeSharedClusterToServerlessOperation + +type GetClusterAdvancedConfigurationOperation interface { + GetClusterAdvancedConfiguration (*atlasv2.GetClusterAdvancedConfigurationApiParams) (*atlasv2.ClusterDescriptionProcessArgs, error) +} + +// GetClusterAdvancedConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) GetClusterAdvancedConfiguration(params *atlasv2.GetClusterAdvancedConfigurationApiParams) (*atlasv2.ClusterDescriptionProcessArgs, error) { + result, _, err := s.clientv2.ClustersApi.GetClusterAdvancedConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetClusterStatusOperation interface { + GetClusterStatus (*atlasv2.GetClusterStatusApiParams) (*atlasv2.ClusterStatus, error) +} + +// GetClusterStatus encapsulates the logic to manage different cloud providers. +func (s *Store) GetClusterStatus(params *atlasv2.GetClusterStatusApiParams) (*atlasv2.ClusterStatus, error) { + result, _, err := s.clientv2.ClustersApi.GetClusterStatusWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetSampleDatasetLoadStatusOperation interface { + GetSampleDatasetLoadStatus (*atlasv2.GetSampleDatasetLoadStatusApiParams) (*atlasv2.SampleDatasetStatus, error) +} + +// GetSampleDatasetLoadStatus encapsulates the logic to manage different cloud providers. +func (s *Store) GetSampleDatasetLoadStatus(params *atlasv2.GetSampleDatasetLoadStatusApiParams) (*atlasv2.SampleDatasetStatus, error) { + result, _, err := s.clientv2.ClustersApi.GetSampleDatasetLoadStatusWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListCloudProviderRegionsOperation interface { + ListCloudProviderRegions (*atlasv2.ListCloudProviderRegionsApiParams) (*atlasv2.PaginatedApiAtlasProviderRegions, error) +} + +// ListCloudProviderRegions encapsulates the logic to manage different cloud providers. +func (s *Store) ListCloudProviderRegions(params *atlasv2.ListCloudProviderRegionsApiParams) (*atlasv2.PaginatedApiAtlasProviderRegions, error) { + result, _, err := s.clientv2.ClustersApi.ListCloudProviderRegionsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListClustersForAllProjectsOperation interface { + ListClustersForAllProjects (*atlasv2.ListClustersForAllProjectsApiParams) (*atlasv2.PaginatedOrgGroup, error) +} + +// ListClustersForAllProjects encapsulates the logic to manage different cloud providers. +func (s *Store) ListClustersForAllProjects(params *atlasv2.ListClustersForAllProjectsApiParams) (*atlasv2.PaginatedOrgGroup, error) { + result, _, err := s.clientv2.ClustersApi.ListClustersForAllProjectsWithParams(s.ctx, params).Execute() + return &result, err +} + +type LoadSampleDatasetOperation interface { + LoadSampleDataset (*atlasv2.LoadSampleDatasetApiParams) (*atlasv2.SampleDatasetStatus, error) +} + +// LoadSampleDataset encapsulates the logic to manage different cloud providers. +func (s *Store) LoadSampleDataset(params *atlasv2.LoadSampleDatasetApiParams) (*atlasv2.SampleDatasetStatus, error) { + result, _, err := s.clientv2.ClustersApi.LoadSampleDatasetWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateClusterAdvancedConfigurationOperation interface { + UpdateClusterAdvancedConfiguration (*atlasv2.UpdateClusterAdvancedConfigurationApiParams) (*atlasv2.ClusterDescriptionProcessArgs, error) +} + +// UpdateClusterAdvancedConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateClusterAdvancedConfiguration(params *atlasv2.UpdateClusterAdvancedConfigurationApiParams) (*atlasv2.ClusterDescriptionProcessArgs, error) { + result, _, err := s.clientv2.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpgradeSharedClusterOperation interface { + UpgradeSharedCluster (*atlasv2.UpgradeSharedClusterApiParams) (*atlasv2.LegacyClusterDescription, error) +} + +// UpgradeSharedCluster encapsulates the logic to manage different cloud providers. +func (s *Store) UpgradeSharedCluster(params *atlasv2.UpgradeSharedClusterApiParams) (*atlasv2.LegacyClusterDescription, error) { + result, _, err := s.clientv2.ClustersApi.UpgradeSharedClusterWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpgradeSharedClusterToServerlessOperation interface { + UpgradeSharedClusterToServerless (*atlasv2.UpgradeSharedClusterToServerlessApiParams) (*atlasv2.ServerlessInstanceDescription, error) +} + +// UpgradeSharedClusterToServerless encapsulates the logic to manage different cloud providers. +func (s *Store) UpgradeSharedClusterToServerless(params *atlasv2.UpgradeSharedClusterToServerlessApiParams) (*atlasv2.ServerlessInstanceDescription, error) { + result, _, err := s.clientv2.ClustersApi.UpgradeSharedClusterToServerlessWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go new file mode 100644 index 0000000000..b4d8ca3037 --- /dev/null +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -0,0 +1,294 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateCustomDatabaseRoleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateCustomDatabaseRoleOperation + groupId string +} + +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 *CreateCustomDatabaseRoleOpts) Run() error { + params := &atlasv2.CreateCustomDatabaseRoleApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateCustomDatabaseRole(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateCustomDatabaseRoleTemplate = "<>" + +func CreateCustomDatabaseRoleBuilder() cobra.Command { + opts := CreateCustomDatabaseRoleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateCustomDatabaseRoleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeleteCustomDatabaseRoleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteCustomDatabaseRoleOperation + groupId string + roleName string +} + +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 *DeleteCustomDatabaseRoleOpts) Run() error { + params := &atlasv2.DeleteCustomDatabaseRoleApiParams{ + GroupId: opts.groupId, + RoleName: opts.roleName, + } + _, err := opts.store.DeleteCustomDatabaseRole(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DeleteCustomDatabaseRoleTemplate = "<>" + +func DeleteCustomDatabaseRoleBuilder() cobra.Command { + opts := DeleteCustomDatabaseRoleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteCustomDatabaseRoleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") + + return cmd +} +type GetCustomDatabaseRoleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetCustomDatabaseRoleOperation + groupId string + roleName string +} + +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 *GetCustomDatabaseRoleOpts) Run() error { + params := &atlasv2.GetCustomDatabaseRoleApiParams{ + GroupId: opts.groupId, + RoleName: opts.roleName, + } + resp, _, err := opts.store.GetCustomDatabaseRole(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetCustomDatabaseRoleTemplate = "<>" + +func GetCustomDatabaseRoleBuilder() cobra.Command { + opts := GetCustomDatabaseRoleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetCustomDatabaseRoleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") + + return cmd +} +type ListCustomDatabaseRolesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListCustomDatabaseRolesOperation + groupId string +} + +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 *ListCustomDatabaseRolesOpts) Run() error { + params := &atlasv2.ListCustomDatabaseRolesApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.ListCustomDatabaseRoles(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListCustomDatabaseRolesTemplate = "<>" + +func ListCustomDatabaseRolesBuilder() cobra.Command { + opts := ListCustomDatabaseRolesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListCustomDatabaseRolesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpdateCustomDatabaseRoleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateCustomDatabaseRoleOperation + groupId string + roleName string +} + +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 *UpdateCustomDatabaseRoleOpts) Run() error { + params := &atlasv2.UpdateCustomDatabaseRoleApiParams{ + GroupId: opts.groupId, + RoleName: opts.roleName, + } + resp, _, err := opts.store.UpdateCustomDatabaseRole(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateCustomDatabaseRoleTemplate = "<>" + +func UpdateCustomDatabaseRoleBuilder() cobra.Command { + opts := UpdateCustomDatabaseRoleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateCustomDatabaseRoleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_custom_database_roles_store.go b/internal/generated/api_custom_database_roles_store.go new file mode 100644 index 0000000000..b00ebb0e7e --- /dev/null +++ b/internal/generated/api_custom_database_roles_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_custom_database_roles_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateCustomDatabaseRoleOperation, DeleteCustomDatabaseRoleOperation, GetCustomDatabaseRoleOperation, ListCustomDatabaseRolesOperation, UpdateCustomDatabaseRoleOperation + +type CreateCustomDatabaseRoleOperation interface { + CreateCustomDatabaseRole (*atlasv2.CreateCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) +} + +// CreateCustomDatabaseRole encapsulates the logic to manage different cloud providers. +func (s *Store) CreateCustomDatabaseRole(params *atlasv2.CreateCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) { + result, _, err := s.clientv2.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteCustomDatabaseRoleOperation interface { + DeleteCustomDatabaseRole (*atlasv2.DeleteCustomDatabaseRoleApiParams) (, error) +} + +// DeleteCustomDatabaseRole encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteCustomDatabaseRole(params *atlasv2.DeleteCustomDatabaseRoleApiParams) (error) { + _, err := s.clientv2.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(s.ctx, params).Execute() + return err +} + +type GetCustomDatabaseRoleOperation interface { + GetCustomDatabaseRole (*atlasv2.GetCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) +} + +// GetCustomDatabaseRole encapsulates the logic to manage different cloud providers. +func (s *Store) GetCustomDatabaseRole(params *atlasv2.GetCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) { + result, _, err := s.clientv2.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListCustomDatabaseRolesOperation interface { + ListCustomDatabaseRoles (*atlasv2.ListCustomDatabaseRolesApiParams) (*atlasv2.[]CustomDBRole, error) +} + +// ListCustomDatabaseRoles encapsulates the logic to manage different cloud providers. +func (s *Store) ListCustomDatabaseRoles(params *atlasv2.ListCustomDatabaseRolesApiParams) (*atlasv2.[]CustomDBRole, error) { + result, _, err := s.clientv2.CustomDatabaseRolesApi.ListCustomDatabaseRolesWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateCustomDatabaseRoleOperation interface { + UpdateCustomDatabaseRole (*atlasv2.UpdateCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) +} + +// UpdateCustomDatabaseRole encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateCustomDatabaseRole(params *atlasv2.UpdateCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) { + result, _, err := s.clientv2.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go new file mode 100644 index 0000000000..be9a391b26 --- /dev/null +++ b/internal/generated/api_data_federation_cmd.go @@ -0,0 +1,816 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateDataFederationPrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateDataFederationPrivateEndpointOperation + groupId string +} + +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 *CreateDataFederationPrivateEndpointOpts) Run() error { + params := &atlasv2.CreateDataFederationPrivateEndpointApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateDataFederationPrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateDataFederationPrivateEndpointTemplate = "<>" + +func CreateDataFederationPrivateEndpointBuilder() cobra.Command { + opts := CreateDataFederationPrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateDataFederationPrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type CreateFederatedDatabaseOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateFederatedDatabaseOperation + groupId string + skipRoleValidation bool +} + +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 *CreateFederatedDatabaseOpts) Run() error { + params := &atlasv2.CreateFederatedDatabaseApiParams{ + GroupId: opts.groupId, + SkipRoleValidation: opts.skipRoleValidation, + } + resp, _, err := opts.store.CreateFederatedDatabase(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateFederatedDatabaseTemplate = "<>" + +func CreateFederatedDatabaseBuilder() cobra.Command { + opts := CreateFederatedDatabaseOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateFederatedDatabaseTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", "", "usage description") + + return cmd +} +type CreateOneDataFederationQueryLimitOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateOneDataFederationQueryLimitOperation + groupId string + tenantName string + limitName string +} + +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 *CreateOneDataFederationQueryLimitOpts) Run() error { + params := &atlasv2.CreateOneDataFederationQueryLimitApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + LimitName: opts.limitName, + } + resp, _, err := opts.store.CreateOneDataFederationQueryLimit(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateOneDataFederationQueryLimitTemplate = "<>" + +func CreateOneDataFederationQueryLimitBuilder() cobra.Command { + opts := CreateOneDataFederationQueryLimitOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateOneDataFederationQueryLimitTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + + return cmd +} +type DeleteDataFederationPrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteDataFederationPrivateEndpointOperation + groupId string + endpointId string +} + +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 *DeleteDataFederationPrivateEndpointOpts) Run() error { + params := &atlasv2.DeleteDataFederationPrivateEndpointApiParams{ + GroupId: opts.groupId, + EndpointId: opts.endpointId, + } + resp, _, err := opts.store.DeleteDataFederationPrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteDataFederationPrivateEndpointTemplate = "<>" + +func DeleteDataFederationPrivateEndpointBuilder() cobra.Command { + opts := DeleteDataFederationPrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteDataFederationPrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + + return cmd +} +type DeleteFederatedDatabaseOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteFederatedDatabaseOperation + groupId string + tenantName string +} + +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 *DeleteFederatedDatabaseOpts) Run() error { + params := &atlasv2.DeleteFederatedDatabaseApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + } + resp, _, err := opts.store.DeleteFederatedDatabase(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteFederatedDatabaseTemplate = "<>" + +func DeleteFederatedDatabaseBuilder() cobra.Command { + opts := DeleteFederatedDatabaseOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteFederatedDatabaseTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + + return cmd +} +type DeleteOneDataFederationInstanceQueryLimitOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteOneDataFederationInstanceQueryLimitOperation + groupId string + tenantName string + limitName string +} + +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 *DeleteOneDataFederationInstanceQueryLimitOpts) Run() error { + params := &atlasv2.DeleteOneDataFederationInstanceQueryLimitApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + LimitName: opts.limitName, + } + resp, _, err := opts.store.DeleteOneDataFederationInstanceQueryLimit(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteOneDataFederationInstanceQueryLimitTemplate = "<>" + +func DeleteOneDataFederationInstanceQueryLimitBuilder() cobra.Command { + opts := DeleteOneDataFederationInstanceQueryLimitOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteOneDataFederationInstanceQueryLimitTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + + return cmd +} +type DownloadFederatedDatabaseQueryLogsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DownloadFederatedDatabaseQueryLogsOperation + groupId string + tenantName string + endDate int64 + startDate int64 +} + +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 *DownloadFederatedDatabaseQueryLogsOpts) Run() error { + params := &atlasv2.DownloadFederatedDatabaseQueryLogsApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + EndDate: opts.endDate, + StartDate: opts.startDate, + } + resp, _, err := opts.store.DownloadFederatedDatabaseQueryLogs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DownloadFederatedDatabaseQueryLogsTemplate = "<>" + +func DownloadFederatedDatabaseQueryLogsBuilder() cobra.Command { + opts := DownloadFederatedDatabaseQueryLogsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DownloadFederatedDatabaseQueryLogsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") + cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") + + return cmd +} +type GetDataFederationPrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetDataFederationPrivateEndpointOperation + groupId string + endpointId string +} + +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 *GetDataFederationPrivateEndpointOpts) Run() error { + params := &atlasv2.GetDataFederationPrivateEndpointApiParams{ + GroupId: opts.groupId, + EndpointId: opts.endpointId, + } + resp, _, err := opts.store.GetDataFederationPrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetDataFederationPrivateEndpointTemplate = "<>" + +func GetDataFederationPrivateEndpointBuilder() cobra.Command { + opts := GetDataFederationPrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetDataFederationPrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + + return cmd +} +type GetFederatedDatabaseOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetFederatedDatabaseOperation + groupId string + tenantName string +} + +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 *GetFederatedDatabaseOpts) Run() error { + params := &atlasv2.GetFederatedDatabaseApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + } + resp, _, err := opts.store.GetFederatedDatabase(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetFederatedDatabaseTemplate = "<>" + +func GetFederatedDatabaseBuilder() cobra.Command { + opts := GetFederatedDatabaseOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetFederatedDatabaseTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + + return cmd +} +type ListDataFederationPrivateEndpointsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListDataFederationPrivateEndpointsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListDataFederationPrivateEndpointsOpts) Run() error { + params := &atlasv2.ListDataFederationPrivateEndpointsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListDataFederationPrivateEndpoints(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListDataFederationPrivateEndpointsTemplate = "<>" + +func ListDataFederationPrivateEndpointsBuilder() cobra.Command { + opts := ListDataFederationPrivateEndpointsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListDataFederationPrivateEndpointsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListFederatedDatabasesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListFederatedDatabasesOperation + groupId string + type_ string +} + +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 *ListFederatedDatabasesOpts) Run() error { + params := &atlasv2.ListFederatedDatabasesApiParams{ + GroupId: opts.groupId, + Type_: opts.type_, + } + resp, _, err := opts.store.ListFederatedDatabases(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListFederatedDatabasesTemplate = "<>" + +func ListFederatedDatabasesBuilder() cobra.Command { + opts := ListFederatedDatabasesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListFederatedDatabasesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.type_, "type_", "", "usage description") + + return cmd +} +type ReturnFederatedDatabaseQueryLimitOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ReturnFederatedDatabaseQueryLimitOperation + groupId string + tenantName string + limitName string +} + +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 *ReturnFederatedDatabaseQueryLimitOpts) Run() error { + params := &atlasv2.ReturnFederatedDatabaseQueryLimitApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + LimitName: opts.limitName, + } + resp, _, err := opts.store.ReturnFederatedDatabaseQueryLimit(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ReturnFederatedDatabaseQueryLimitTemplate = "<>" + +func ReturnFederatedDatabaseQueryLimitBuilder() cobra.Command { + opts := ReturnFederatedDatabaseQueryLimitOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ReturnFederatedDatabaseQueryLimitTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + + return cmd +} +type ReturnFederatedDatabaseQueryLimitsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ReturnFederatedDatabaseQueryLimitsOperation + groupId string + tenantName string +} + +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 *ReturnFederatedDatabaseQueryLimitsOpts) Run() error { + params := &atlasv2.ReturnFederatedDatabaseQueryLimitsApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + } + resp, _, err := opts.store.ReturnFederatedDatabaseQueryLimits(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ReturnFederatedDatabaseQueryLimitsTemplate = "<>" + +func ReturnFederatedDatabaseQueryLimitsBuilder() cobra.Command { + opts := ReturnFederatedDatabaseQueryLimitsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ReturnFederatedDatabaseQueryLimitsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + + return cmd +} +type UpdateFederatedDatabaseOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateFederatedDatabaseOperation + groupId string + tenantName string + skipRoleValidation bool +} + +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 *UpdateFederatedDatabaseOpts) Run() error { + params := &atlasv2.UpdateFederatedDatabaseApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + SkipRoleValidation: opts.skipRoleValidation, + } + resp, _, err := opts.store.UpdateFederatedDatabase(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateFederatedDatabaseTemplate = "<>" + +func UpdateFederatedDatabaseBuilder() cobra.Command { + opts := UpdateFederatedDatabaseOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateFederatedDatabaseTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_data_federation_store.go b/internal/generated/api_data_federation_store.go new file mode 100644 index 0000000000..287c5d974b --- /dev/null +++ b/internal/generated/api_data_federation_store.go @@ -0,0 +1,165 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_data_federation_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateDataFederationPrivateEndpointOperation, CreateFederatedDatabaseOperation, CreateOneDataFederationQueryLimitOperation, DeleteDataFederationPrivateEndpointOperation, DeleteFederatedDatabaseOperation, DeleteOneDataFederationInstanceQueryLimitOperation, DownloadFederatedDatabaseQueryLogsOperation, GetDataFederationPrivateEndpointOperation, GetFederatedDatabaseOperation, ListDataFederationPrivateEndpointsOperation, ListFederatedDatabasesOperation, ReturnFederatedDatabaseQueryLimitOperation, ReturnFederatedDatabaseQueryLimitsOperation, UpdateFederatedDatabaseOperation + +type CreateDataFederationPrivateEndpointOperation interface { + CreateDataFederationPrivateEndpoint (*atlasv2.CreateDataFederationPrivateEndpointApiParams) (*atlasv2.PaginatedPrivateNetworkEndpointIdEntry, error) +} + +// CreateDataFederationPrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) CreateDataFederationPrivateEndpoint(params *atlasv2.CreateDataFederationPrivateEndpointApiParams) (*atlasv2.PaginatedPrivateNetworkEndpointIdEntry, error) { + result, _, err := s.clientv2.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateFederatedDatabaseOperation interface { + CreateFederatedDatabase (*atlasv2.CreateFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) +} + +// CreateFederatedDatabase encapsulates the logic to manage different cloud providers. +func (s *Store) CreateFederatedDatabase(params *atlasv2.CreateFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) { + result, _, err := s.clientv2.DataFederationApi.CreateFederatedDatabaseWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateOneDataFederationQueryLimitOperation interface { + CreateOneDataFederationQueryLimit (*atlasv2.CreateOneDataFederationQueryLimitApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) +} + +// CreateOneDataFederationQueryLimit encapsulates the logic to manage different cloud providers. +func (s *Store) CreateOneDataFederationQueryLimit(params *atlasv2.CreateOneDataFederationQueryLimitApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) { + result, _, err := s.clientv2.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteDataFederationPrivateEndpointOperation interface { + DeleteDataFederationPrivateEndpoint (*atlasv2.DeleteDataFederationPrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteDataFederationPrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteDataFederationPrivateEndpoint(params *atlasv2.DeleteDataFederationPrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteFederatedDatabaseOperation interface { + DeleteFederatedDatabase (*atlasv2.DeleteFederatedDatabaseApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteFederatedDatabase encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteFederatedDatabase(params *atlasv2.DeleteFederatedDatabaseApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.DataFederationApi.DeleteFederatedDatabaseWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteOneDataFederationInstanceQueryLimitOperation interface { + DeleteOneDataFederationInstanceQueryLimit (*atlasv2.DeleteOneDataFederationInstanceQueryLimitApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteOneDataFederationInstanceQueryLimit encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteOneDataFederationInstanceQueryLimit(params *atlasv2.DeleteOneDataFederationInstanceQueryLimitApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(s.ctx, params).Execute() + return &result, err +} + +type DownloadFederatedDatabaseQueryLogsOperation interface { + DownloadFederatedDatabaseQueryLogs (*atlasv2.DownloadFederatedDatabaseQueryLogsApiParams) (*atlasv2.*os.File, error) +} + +// DownloadFederatedDatabaseQueryLogs encapsulates the logic to manage different cloud providers. +func (s *Store) DownloadFederatedDatabaseQueryLogs(params *atlasv2.DownloadFederatedDatabaseQueryLogsApiParams) (*atlasv2.*os.File, error) { + result, _, err := s.clientv2.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetDataFederationPrivateEndpointOperation interface { + GetDataFederationPrivateEndpoint (*atlasv2.GetDataFederationPrivateEndpointApiParams) (*atlasv2.PrivateNetworkEndpointIdEntry, error) +} + +// GetDataFederationPrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) GetDataFederationPrivateEndpoint(params *atlasv2.GetDataFederationPrivateEndpointApiParams) (*atlasv2.PrivateNetworkEndpointIdEntry, error) { + result, _, err := s.clientv2.DataFederationApi.GetDataFederationPrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetFederatedDatabaseOperation interface { + GetFederatedDatabase (*atlasv2.GetFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) +} + +// GetFederatedDatabase encapsulates the logic to manage different cloud providers. +func (s *Store) GetFederatedDatabase(params *atlasv2.GetFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) { + result, _, err := s.clientv2.DataFederationApi.GetFederatedDatabaseWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListDataFederationPrivateEndpointsOperation interface { + ListDataFederationPrivateEndpoints (*atlasv2.ListDataFederationPrivateEndpointsApiParams) (*atlasv2.PaginatedPrivateNetworkEndpointIdEntry, error) +} + +// ListDataFederationPrivateEndpoints encapsulates the logic to manage different cloud providers. +func (s *Store) ListDataFederationPrivateEndpoints(params *atlasv2.ListDataFederationPrivateEndpointsApiParams) (*atlasv2.PaginatedPrivateNetworkEndpointIdEntry, error) { + result, _, err := s.clientv2.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListFederatedDatabasesOperation interface { + ListFederatedDatabases (*atlasv2.ListFederatedDatabasesApiParams) (*atlasv2.[]DataLakeTenant, error) +} + +// ListFederatedDatabases encapsulates the logic to manage different cloud providers. +func (s *Store) ListFederatedDatabases(params *atlasv2.ListFederatedDatabasesApiParams) (*atlasv2.[]DataLakeTenant, error) { + result, _, err := s.clientv2.DataFederationApi.ListFederatedDatabasesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ReturnFederatedDatabaseQueryLimitOperation interface { + ReturnFederatedDatabaseQueryLimit (*atlasv2.ReturnFederatedDatabaseQueryLimitApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) +} + +// ReturnFederatedDatabaseQueryLimit encapsulates the logic to manage different cloud providers. +func (s *Store) ReturnFederatedDatabaseQueryLimit(params *atlasv2.ReturnFederatedDatabaseQueryLimitApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) { + result, _, err := s.clientv2.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(s.ctx, params).Execute() + return &result, err +} + +type ReturnFederatedDatabaseQueryLimitsOperation interface { + ReturnFederatedDatabaseQueryLimits (*atlasv2.ReturnFederatedDatabaseQueryLimitsApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) +} + +// ReturnFederatedDatabaseQueryLimits encapsulates the logic to manage different cloud providers. +func (s *Store) ReturnFederatedDatabaseQueryLimits(params *atlasv2.ReturnFederatedDatabaseQueryLimitsApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) { + result, _, err := s.clientv2.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateFederatedDatabaseOperation interface { + UpdateFederatedDatabase (*atlasv2.UpdateFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) +} + +// UpdateFederatedDatabase encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateFederatedDatabase(params *atlasv2.UpdateFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) { + result, _, err := s.clientv2.DataFederationApi.UpdateFederatedDatabaseWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go new file mode 100644 index 0000000000..25e72782fe --- /dev/null +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -0,0 +1,764 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreatePipelineOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreatePipelineOperation + groupId string +} + +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 *CreatePipelineOpts) Run() error { + params := &atlasv2.CreatePipelineApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreatePipeline(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreatePipelineTemplate = "<>" + +func CreatePipelineBuilder() cobra.Command { + opts := CreatePipelineOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreatePipelineTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeletePipelineOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeletePipelineOperation + groupId string + pipelineName string +} + +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 *DeletePipelineOpts) Run() error { + params := &atlasv2.DeletePipelineApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + } + resp, _, err := opts.store.DeletePipeline(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeletePipelineTemplate = "<>" + +func DeletePipelineBuilder() cobra.Command { + opts := DeletePipelineOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeletePipelineTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + + return cmd +} +type DeletePipelineRunDatasetOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeletePipelineRunDatasetOperation + groupId string + pipelineName string + pipelineRunId string +} + +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 *DeletePipelineRunDatasetOpts) Run() error { + params := &atlasv2.DeletePipelineRunDatasetApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + PipelineRunId: opts.pipelineRunId, + } + resp, _, err := opts.store.DeletePipelineRunDataset(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeletePipelineRunDatasetTemplate = "<>" + +func DeletePipelineRunDatasetBuilder() cobra.Command { + opts := DeletePipelineRunDatasetOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeletePipelineRunDatasetTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "usage description") + + return cmd +} +type GetPipelineOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetPipelineOperation + groupId string + pipelineName string +} + +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 *GetPipelineOpts) Run() error { + params := &atlasv2.GetPipelineApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + } + resp, _, err := opts.store.GetPipeline(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetPipelineTemplate = "<>" + +func GetPipelineBuilder() cobra.Command { + opts := GetPipelineOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetPipelineTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + + return cmd +} +type GetPipelineRunOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetPipelineRunOperation + groupId string + pipelineName string + pipelineRunId string +} + +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 *GetPipelineRunOpts) Run() error { + params := &atlasv2.GetPipelineRunApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + PipelineRunId: opts.pipelineRunId, + } + resp, _, err := opts.store.GetPipelineRun(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetPipelineRunTemplate = "<>" + +func GetPipelineRunBuilder() cobra.Command { + opts := GetPipelineRunOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetPipelineRunTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "usage description") + + return cmd +} +type ListPipelineRunsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPipelineRunsOperation + groupId string + pipelineName string + includeCount bool + itemsPerPage int32 + pageNum int32 + createdBefore time.Time +} + +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 *ListPipelineRunsOpts) Run() error { + params := &atlasv2.ListPipelineRunsApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + CreatedBefore: opts.createdBefore, + } + resp, _, err := opts.store.ListPipelineRuns(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPipelineRunsTemplate = "<>" + +func ListPipelineRunsBuilder() cobra.Command { + opts := ListPipelineRunsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPipelineRunsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", "usage description") + + return cmd +} +type ListPipelineSchedulesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPipelineSchedulesOperation + groupId string + pipelineName string +} + +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 *ListPipelineSchedulesOpts) Run() error { + params := &atlasv2.ListPipelineSchedulesApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + } + resp, _, err := opts.store.ListPipelineSchedules(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPipelineSchedulesTemplate = "<>" + +func ListPipelineSchedulesBuilder() cobra.Command { + opts := ListPipelineSchedulesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPipelineSchedulesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + + return cmd +} +type ListPipelineSnapshotsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPipelineSnapshotsOperation + groupId string + pipelineName string + includeCount bool + itemsPerPage int32 + pageNum int32 + completedAfter time.Time +} + +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 *ListPipelineSnapshotsOpts) Run() error { + params := &atlasv2.ListPipelineSnapshotsApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + CompletedAfter: opts.completedAfter, + } + resp, _, err := opts.store.ListPipelineSnapshots(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPipelineSnapshotsTemplate = "<>" + +func ListPipelineSnapshotsBuilder() cobra.Command { + opts := ListPipelineSnapshotsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPipelineSnapshotsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", "usage description") + + return cmd +} +type ListPipelinesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPipelinesOperation + groupId string +} + +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 *ListPipelinesOpts) Run() error { + params := &atlasv2.ListPipelinesApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.ListPipelines(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPipelinesTemplate = "<>" + +func ListPipelinesBuilder() cobra.Command { + opts := ListPipelinesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPipelinesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type PausePipelineOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.PausePipelineOperation + groupId string + pipelineName string +} + +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 *PausePipelineOpts) Run() error { + params := &atlasv2.PausePipelineApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + } + resp, _, err := opts.store.PausePipeline(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const PausePipelineTemplate = "<>" + +func PausePipelineBuilder() cobra.Command { + opts := PausePipelineOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), PausePipelineTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + + return cmd +} +type ResumePipelineOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ResumePipelineOperation + groupId string + pipelineName string +} + +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 *ResumePipelineOpts) Run() error { + params := &atlasv2.ResumePipelineApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + } + resp, _, err := opts.store.ResumePipeline(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ResumePipelineTemplate = "<>" + +func ResumePipelineBuilder() cobra.Command { + opts := ResumePipelineOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ResumePipelineTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + + return cmd +} +type TriggerSnapshotIngestionOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.TriggerSnapshotIngestionOperation + groupId string + pipelineName string +} + +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 *TriggerSnapshotIngestionOpts) Run() error { + params := &atlasv2.TriggerSnapshotIngestionApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + } + resp, _, err := opts.store.TriggerSnapshotIngestion(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const TriggerSnapshotIngestionTemplate = "<>" + +func TriggerSnapshotIngestionBuilder() cobra.Command { + opts := TriggerSnapshotIngestionOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), TriggerSnapshotIngestionTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + + return cmd +} +type UpdatePipelineOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdatePipelineOperation + groupId string + pipelineName string +} + +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 *UpdatePipelineOpts) Run() error { + params := &atlasv2.UpdatePipelineApiParams{ + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + } + resp, _, err := opts.store.UpdatePipeline(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdatePipelineTemplate = "<>" + +func UpdatePipelineBuilder() cobra.Command { + opts := UpdatePipelineOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdatePipelineTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_data_lake_pipelines_store.go b/internal/generated/api_data_lake_pipelines_store.go new file mode 100644 index 0000000000..7e698928f4 --- /dev/null +++ b/internal/generated/api_data_lake_pipelines_store.go @@ -0,0 +1,155 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_data_lake_pipelines_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreatePipelineOperation, DeletePipelineOperation, DeletePipelineRunDatasetOperation, GetPipelineOperation, GetPipelineRunOperation, ListPipelineRunsOperation, ListPipelineSchedulesOperation, ListPipelineSnapshotsOperation, ListPipelinesOperation, PausePipelineOperation, ResumePipelineOperation, TriggerSnapshotIngestionOperation, UpdatePipelineOperation + +type CreatePipelineOperation interface { + CreatePipeline (*atlasv2.CreatePipelineApiParams) (*atlasv2.IngestionPipeline, error) +} + +// CreatePipeline encapsulates the logic to manage different cloud providers. +func (s *Store) CreatePipeline(params *atlasv2.CreatePipelineApiParams) (*atlasv2.IngestionPipeline, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.CreatePipelineWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeletePipelineOperation interface { + DeletePipeline (*atlasv2.DeletePipelineApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeletePipeline encapsulates the logic to manage different cloud providers. +func (s *Store) DeletePipeline(params *atlasv2.DeletePipelineApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.DeletePipelineWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeletePipelineRunDatasetOperation interface { + DeletePipelineRunDataset (*atlasv2.DeletePipelineRunDatasetApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeletePipelineRunDataset encapsulates the logic to manage different cloud providers. +func (s *Store) DeletePipelineRunDataset(params *atlasv2.DeletePipelineRunDatasetApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetPipelineOperation interface { + GetPipeline (*atlasv2.GetPipelineApiParams) (*atlasv2.IngestionPipeline, error) +} + +// GetPipeline encapsulates the logic to manage different cloud providers. +func (s *Store) GetPipeline(params *atlasv2.GetPipelineApiParams) (*atlasv2.IngestionPipeline, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.GetPipelineWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetPipelineRunOperation interface { + GetPipelineRun (*atlasv2.GetPipelineRunApiParams) (*atlasv2.IngestionPipelineRun, error) +} + +// GetPipelineRun encapsulates the logic to manage different cloud providers. +func (s *Store) GetPipelineRun(params *atlasv2.GetPipelineRunApiParams) (*atlasv2.IngestionPipelineRun, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.GetPipelineRunWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPipelineRunsOperation interface { + ListPipelineRuns (*atlasv2.ListPipelineRunsApiParams) (*atlasv2.PaginatedPipelineRun, error) +} + +// ListPipelineRuns encapsulates the logic to manage different cloud providers. +func (s *Store) ListPipelineRuns(params *atlasv2.ListPipelineRunsApiParams) (*atlasv2.PaginatedPipelineRun, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.ListPipelineRunsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPipelineSchedulesOperation interface { + ListPipelineSchedules (*atlasv2.ListPipelineSchedulesApiParams) (*atlasv2.[]PolicyItem, error) +} + +// ListPipelineSchedules encapsulates the logic to manage different cloud providers. +func (s *Store) ListPipelineSchedules(params *atlasv2.ListPipelineSchedulesApiParams) (*atlasv2.[]PolicyItem, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.ListPipelineSchedulesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPipelineSnapshotsOperation interface { + ListPipelineSnapshots (*atlasv2.ListPipelineSnapshotsApiParams) (*atlasv2.PaginatedBackupSnapshot, error) +} + +// ListPipelineSnapshots encapsulates the logic to manage different cloud providers. +func (s *Store) ListPipelineSnapshots(params *atlasv2.ListPipelineSnapshotsApiParams) (*atlasv2.PaginatedBackupSnapshot, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPipelinesOperation interface { + ListPipelines (*atlasv2.ListPipelinesApiParams) (*atlasv2.[]IngestionPipeline, error) +} + +// ListPipelines encapsulates the logic to manage different cloud providers. +func (s *Store) ListPipelines(params *atlasv2.ListPipelinesApiParams) (*atlasv2.[]IngestionPipeline, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.ListPipelinesWithParams(s.ctx, params).Execute() + return &result, err +} + +type PausePipelineOperation interface { + PausePipeline (*atlasv2.PausePipelineApiParams) (*atlasv2.IngestionPipeline, error) +} + +// PausePipeline encapsulates the logic to manage different cloud providers. +func (s *Store) PausePipeline(params *atlasv2.PausePipelineApiParams) (*atlasv2.IngestionPipeline, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.PausePipelineWithParams(s.ctx, params).Execute() + return &result, err +} + +type ResumePipelineOperation interface { + ResumePipeline (*atlasv2.ResumePipelineApiParams) (*atlasv2.IngestionPipeline, error) +} + +// ResumePipeline encapsulates the logic to manage different cloud providers. +func (s *Store) ResumePipeline(params *atlasv2.ResumePipelineApiParams) (*atlasv2.IngestionPipeline, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.ResumePipelineWithParams(s.ctx, params).Execute() + return &result, err +} + +type TriggerSnapshotIngestionOperation interface { + TriggerSnapshotIngestion (*atlasv2.TriggerSnapshotIngestionApiParams) (*atlasv2.IngestionPipelineRun, error) +} + +// TriggerSnapshotIngestion encapsulates the logic to manage different cloud providers. +func (s *Store) TriggerSnapshotIngestion(params *atlasv2.TriggerSnapshotIngestionApiParams) (*atlasv2.IngestionPipelineRun, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdatePipelineOperation interface { + UpdatePipeline (*atlasv2.UpdatePipelineApiParams) (*atlasv2.IngestionPipeline, error) +} + +// UpdatePipeline encapsulates the logic to manage different cloud providers. +func (s *Store) UpdatePipeline(params *atlasv2.UpdatePipelineApiParams) (*atlasv2.IngestionPipeline, error) { + result, _, err := s.clientv2.DataLakePipelinesApi.UpdatePipelineWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go new file mode 100644 index 0000000000..8918b7509b --- /dev/null +++ b/internal/generated/api_database_users_cmd.go @@ -0,0 +1,312 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateDatabaseUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateDatabaseUserOperation + groupId string +} + +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 *CreateDatabaseUserOpts) Run() error { + params := &atlasv2.CreateDatabaseUserApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateDatabaseUser(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateDatabaseUserTemplate = "<>" + +func CreateDatabaseUserBuilder() cobra.Command { + opts := CreateDatabaseUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateDatabaseUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeleteDatabaseUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteDatabaseUserOperation + groupId string + databaseName string + username string +} + +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 *DeleteDatabaseUserOpts) Run() error { + params := &atlasv2.DeleteDatabaseUserApiParams{ + GroupId: opts.groupId, + DatabaseName: opts.databaseName, + Username: opts.username, + } + resp, _, err := opts.store.DeleteDatabaseUser(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteDatabaseUserTemplate = "<>" + +func DeleteDatabaseUserBuilder() cobra.Command { + opts := DeleteDatabaseUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteDatabaseUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + + return cmd +} +type GetDatabaseUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetDatabaseUserOperation + groupId string + databaseName string + username string +} + +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 *GetDatabaseUserOpts) Run() error { + params := &atlasv2.GetDatabaseUserApiParams{ + GroupId: opts.groupId, + DatabaseName: opts.databaseName, + Username: opts.username, + } + resp, _, err := opts.store.GetDatabaseUser(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetDatabaseUserTemplate = "<>" + +func GetDatabaseUserBuilder() cobra.Command { + opts := GetDatabaseUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetDatabaseUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + + return cmd +} +type ListDatabaseUsersOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListDatabaseUsersOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListDatabaseUsersOpts) Run() error { + params := &atlasv2.ListDatabaseUsersApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListDatabaseUsers(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListDatabaseUsersTemplate = "<>" + +func ListDatabaseUsersBuilder() cobra.Command { + opts := ListDatabaseUsersOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListDatabaseUsersTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type UpdateDatabaseUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateDatabaseUserOperation + groupId string + databaseName string + username string +} + +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 *UpdateDatabaseUserOpts) Run() error { + params := &atlasv2.UpdateDatabaseUserApiParams{ + GroupId: opts.groupId, + DatabaseName: opts.databaseName, + Username: opts.username, + } + resp, _, err := opts.store.UpdateDatabaseUser(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateDatabaseUserTemplate = "<>" + +func UpdateDatabaseUserBuilder() cobra.Command { + opts := UpdateDatabaseUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateDatabaseUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_database_users_store.go b/internal/generated/api_database_users_store.go new file mode 100644 index 0000000000..66b73ca822 --- /dev/null +++ b/internal/generated/api_database_users_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_database_users_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateDatabaseUserOperation, DeleteDatabaseUserOperation, GetDatabaseUserOperation, ListDatabaseUsersOperation, UpdateDatabaseUserOperation + +type CreateDatabaseUserOperation interface { + CreateDatabaseUser (*atlasv2.CreateDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) +} + +// CreateDatabaseUser encapsulates the logic to manage different cloud providers. +func (s *Store) CreateDatabaseUser(params *atlasv2.CreateDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) { + result, _, err := s.clientv2.DatabaseUsersApi.CreateDatabaseUserWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteDatabaseUserOperation interface { + DeleteDatabaseUser (*atlasv2.DeleteDatabaseUserApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteDatabaseUser encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteDatabaseUser(params *atlasv2.DeleteDatabaseUserApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.DatabaseUsersApi.DeleteDatabaseUserWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetDatabaseUserOperation interface { + GetDatabaseUser (*atlasv2.GetDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) +} + +// GetDatabaseUser encapsulates the logic to manage different cloud providers. +func (s *Store) GetDatabaseUser(params *atlasv2.GetDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) { + result, _, err := s.clientv2.DatabaseUsersApi.GetDatabaseUserWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListDatabaseUsersOperation interface { + ListDatabaseUsers (*atlasv2.ListDatabaseUsersApiParams) (*atlasv2.PaginatedApiAtlasDatabaseUser, error) +} + +// ListDatabaseUsers encapsulates the logic to manage different cloud providers. +func (s *Store) ListDatabaseUsers(params *atlasv2.ListDatabaseUsersApiParams) (*atlasv2.PaginatedApiAtlasDatabaseUser, error) { + result, _, err := s.clientv2.DatabaseUsersApi.ListDatabaseUsersWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateDatabaseUserOperation interface { + UpdateDatabaseUser (*atlasv2.UpdateDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) +} + +// UpdateDatabaseUser encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateDatabaseUser(params *atlasv2.UpdateDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) { + result, _, err := s.clientv2.DatabaseUsersApi.UpdateDatabaseUserWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go new file mode 100644 index 0000000000..8d376c7a7a --- /dev/null +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -0,0 +1,129 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type GetEncryptionAtRestOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetEncryptionAtRestOperation + groupId string +} + +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 *GetEncryptionAtRestOpts) Run() error { + params := &atlasv2.GetEncryptionAtRestApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetEncryptionAtRest(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetEncryptionAtRestTemplate = "<>" + +func GetEncryptionAtRestBuilder() cobra.Command { + opts := GetEncryptionAtRestOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetEncryptionAtRestTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpdateEncryptionAtRestOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateEncryptionAtRestOperation + groupId string +} + +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 *UpdateEncryptionAtRestOpts) Run() error { + params := &atlasv2.UpdateEncryptionAtRestApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpdateEncryptionAtRest(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateEncryptionAtRestTemplate = "<>" + +func UpdateEncryptionAtRestBuilder() cobra.Command { + opts := UpdateEncryptionAtRestOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateEncryptionAtRestTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_store.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_store.go new file mode 100644 index 0000000000..74969d0789 --- /dev/null +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_store.go @@ -0,0 +1,45 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_encryption_at_rest_using_customer_key_management_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetEncryptionAtRestOperation, UpdateEncryptionAtRestOperation + +type GetEncryptionAtRestOperation interface { + GetEncryptionAtRest (*atlasv2.GetEncryptionAtRestApiParams) (*atlasv2.EncryptionAtRest, error) +} + +// GetEncryptionAtRest encapsulates the logic to manage different cloud providers. +func (s *Store) GetEncryptionAtRest(params *atlasv2.GetEncryptionAtRestApiParams) (*atlasv2.EncryptionAtRest, error) { + result, _, err := s.clientv2.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRestWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateEncryptionAtRestOperation interface { + UpdateEncryptionAtRest (*atlasv2.UpdateEncryptionAtRestApiParams) (*atlasv2.EncryptionAtRest, error) +} + +// UpdateEncryptionAtRest encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateEncryptionAtRest(params *atlasv2.UpdateEncryptionAtRestApiParams) (*atlasv2.EncryptionAtRest, error) { + result, _, err := s.clientv2.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go new file mode 100644 index 0000000000..a6ed367121 --- /dev/null +++ b/internal/generated/api_events_cmd.go @@ -0,0 +1,290 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type GetOrganizationEventOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetOrganizationEventOperation + orgId string + eventId string + includeRaw bool +} + +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 *GetOrganizationEventOpts) Run() error { + params := &atlasv2.GetOrganizationEventApiParams{ + OrgId: opts.orgId, + EventId: opts.eventId, + IncludeRaw: opts.includeRaw, + } + resp, _, err := opts.store.GetOrganizationEvent(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetOrganizationEventTemplate = "<>" + +func GetOrganizationEventBuilder() cobra.Command { + opts := GetOrganizationEventOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetOrganizationEventTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.eventId, "eventId", "", "usage description") + cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") + + return cmd +} +type GetProjectEventOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetProjectEventOperation + groupId string + eventId string + includeRaw bool +} + +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 *GetProjectEventOpts) Run() error { + params := &atlasv2.GetProjectEventApiParams{ + GroupId: opts.groupId, + EventId: opts.eventId, + IncludeRaw: opts.includeRaw, + } + resp, _, err := opts.store.GetProjectEvent(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetProjectEventTemplate = "<>" + +func GetProjectEventBuilder() cobra.Command { + opts := GetProjectEventOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetProjectEventTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.eventId, "eventId", "", "usage description") + cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") + + return cmd +} +type ListOrganizationEventsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListOrganizationEventsOperation + orgId string + includeCount bool + itemsPerPage int32 + pageNum int32 + eventType []map[string]interface{} + includeRaw bool + maxDate time.Time + minDate time.Time +} + +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 *ListOrganizationEventsOpts) Run() error { + params := &atlasv2.ListOrganizationEventsApiParams{ + OrgId: opts.orgId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + EventType: opts.eventType, + IncludeRaw: opts.includeRaw, + MaxDate: opts.maxDate, + MinDate: opts.minDate, + } + resp, _, err := opts.store.ListOrganizationEvents(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListOrganizationEventsTemplate = "<>" + +func ListOrganizationEventsBuilder() cobra.Command { + opts := ListOrganizationEventsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListOrganizationEventsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.eventType, "eventType", "", "usage description") + cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") + cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", "usage description") + cmd.Flags().StringVar(&opts.minDate, "minDate", "", "usage description") + + return cmd +} +type ListProjectEventsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListProjectEventsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 + clusterNames []string + eventType EventTypeForNdsGroup + includeRaw bool + maxDate time.Time + minDate time.Time +} + +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 *ListProjectEventsOpts) Run() error { + params := &atlasv2.ListProjectEventsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + ClusterNames: opts.clusterNames, + EventType: opts.eventType, + IncludeRaw: opts.includeRaw, + MaxDate: opts.maxDate, + MinDate: opts.minDate, + } + resp, _, err := opts.store.ListProjectEvents(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListProjectEventsTemplate = "<>" + +func ListProjectEventsBuilder() cobra.Command { + opts := ListProjectEventsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListProjectEventsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.clusterNames, "clusterNames", "", "usage description") + cmd.Flags().StringVar(&opts.eventType, "eventType", "", "usage description") + cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") + cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", "usage description") + cmd.Flags().StringVar(&opts.minDate, "minDate", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_events_store.go b/internal/generated/api_events_store.go new file mode 100644 index 0000000000..fe97519329 --- /dev/null +++ b/internal/generated/api_events_store.go @@ -0,0 +1,65 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_events_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetOrganizationEventOperation, GetProjectEventOperation, ListOrganizationEventsOperation, ListProjectEventsOperation + +type GetOrganizationEventOperation interface { + GetOrganizationEvent (*atlasv2.GetOrganizationEventApiParams) (*atlasv2.EventViewForOrg, error) +} + +// GetOrganizationEvent encapsulates the logic to manage different cloud providers. +func (s *Store) GetOrganizationEvent(params *atlasv2.GetOrganizationEventApiParams) (*atlasv2.EventViewForOrg, error) { + result, _, err := s.clientv2.EventsApi.GetOrganizationEventWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetProjectEventOperation interface { + GetProjectEvent (*atlasv2.GetProjectEventApiParams) (*atlasv2.EventViewForNdsGroup, error) +} + +// GetProjectEvent encapsulates the logic to manage different cloud providers. +func (s *Store) GetProjectEvent(params *atlasv2.GetProjectEventApiParams) (*atlasv2.EventViewForNdsGroup, error) { + result, _, err := s.clientv2.EventsApi.GetProjectEventWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListOrganizationEventsOperation interface { + ListOrganizationEvents (*atlasv2.ListOrganizationEventsApiParams) (*atlasv2.OrgPaginatedEvent, error) +} + +// ListOrganizationEvents encapsulates the logic to manage different cloud providers. +func (s *Store) ListOrganizationEvents(params *atlasv2.ListOrganizationEventsApiParams) (*atlasv2.OrgPaginatedEvent, error) { + result, _, err := s.clientv2.EventsApi.ListOrganizationEventsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListProjectEventsOperation interface { + ListProjectEvents (*atlasv2.ListProjectEventsApiParams) (*atlasv2.GroupPaginatedEvent, error) +} + +// ListProjectEvents encapsulates the logic to manage different cloud providers. +func (s *Store) ListProjectEvents(params *atlasv2.ListProjectEventsApiParams) (*atlasv2.GroupPaginatedEvent, error) { + result, _, err := s.clientv2.EventsApi.ListProjectEventsWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go new file mode 100644 index 0000000000..67edba0b59 --- /dev/null +++ b/internal/generated/api_federated_authentication_cmd.go @@ -0,0 +1,847 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateRoleMappingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateRoleMappingOperation + federationSettingsId string + orgId string +} + +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 *CreateRoleMappingOpts) Run() error { + params := &atlasv2.CreateRoleMappingApiParams{ + FederationSettingsId: opts.federationSettingsId, + OrgId: opts.orgId, + } + resp, _, err := opts.store.CreateRoleMapping(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateRoleMappingTemplate = "<>" + +func CreateRoleMappingBuilder() cobra.Command { + opts := CreateRoleMappingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateRoleMappingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type DeleteFederationAppOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteFederationAppOperation + federationSettingsId string +} + +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 *DeleteFederationAppOpts) Run() error { + params := &atlasv2.DeleteFederationAppApiParams{ + FederationSettingsId: opts.federationSettingsId, + } + _, err := opts.store.DeleteFederationApp(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DeleteFederationAppTemplate = "<>" + +func DeleteFederationAppBuilder() cobra.Command { + opts := DeleteFederationAppOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteFederationAppTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + + return cmd +} +type DeleteRoleMappingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteRoleMappingOperation + federationSettingsId string + id string + orgId string +} + +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 *DeleteRoleMappingOpts) Run() error { + params := &atlasv2.DeleteRoleMappingApiParams{ + FederationSettingsId: opts.federationSettingsId, + Id: opts.id, + OrgId: opts.orgId, + } + _, err := opts.store.DeleteRoleMapping(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DeleteRoleMappingTemplate = "<>" + +func DeleteRoleMappingBuilder() cobra.Command { + opts := DeleteRoleMappingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteRoleMappingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.id, "id", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type GetConnectedOrgConfigOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetConnectedOrgConfigOperation + federationSettingsId string + orgId string +} + +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 *GetConnectedOrgConfigOpts) Run() error { + params := &atlasv2.GetConnectedOrgConfigApiParams{ + FederationSettingsId: opts.federationSettingsId, + OrgId: opts.orgId, + } + resp, _, err := opts.store.GetConnectedOrgConfig(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetConnectedOrgConfigTemplate = "<>" + +func GetConnectedOrgConfigBuilder() cobra.Command { + opts := GetConnectedOrgConfigOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetConnectedOrgConfigTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type GetFederationSettingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetFederationSettingsOperation + orgId string +} + +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 *GetFederationSettingsOpts) Run() error { + params := &atlasv2.GetFederationSettingsApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.GetFederationSettings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetFederationSettingsTemplate = "<>" + +func GetFederationSettingsBuilder() cobra.Command { + opts := GetFederationSettingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetFederationSettingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type GetIdentityProviderOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetIdentityProviderOperation + federationSettingsId string + identityProviderId string +} + +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 *GetIdentityProviderOpts) Run() error { + params := &atlasv2.GetIdentityProviderApiParams{ + FederationSettingsId: opts.federationSettingsId, + IdentityProviderId: opts.identityProviderId, + } + resp, _, err := opts.store.GetIdentityProvider(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetIdentityProviderTemplate = "<>" + +func GetIdentityProviderBuilder() cobra.Command { + opts := GetIdentityProviderOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetIdentityProviderTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") + + return cmd +} +type GetIdentityProviderMetadataOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetIdentityProviderMetadataOperation + federationSettingsId string + identityProviderId string +} + +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 *GetIdentityProviderMetadataOpts) Run() error { + params := &atlasv2.GetIdentityProviderMetadataApiParams{ + FederationSettingsId: opts.federationSettingsId, + IdentityProviderId: opts.identityProviderId, + } + resp, _, err := opts.store.GetIdentityProviderMetadata(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetIdentityProviderMetadataTemplate = "<>" + +func GetIdentityProviderMetadataBuilder() cobra.Command { + opts := GetIdentityProviderMetadataOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetIdentityProviderMetadataTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") + + return cmd +} +type GetRoleMappingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetRoleMappingOperation + federationSettingsId string + id string + orgId string +} + +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 *GetRoleMappingOpts) Run() error { + params := &atlasv2.GetRoleMappingApiParams{ + FederationSettingsId: opts.federationSettingsId, + Id: opts.id, + OrgId: opts.orgId, + } + resp, _, err := opts.store.GetRoleMapping(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetRoleMappingTemplate = "<>" + +func GetRoleMappingBuilder() cobra.Command { + opts := GetRoleMappingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetRoleMappingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.id, "id", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type ListConnectedOrgConfigsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListConnectedOrgConfigsOperation + federationSettingsId string +} + +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 *ListConnectedOrgConfigsOpts) Run() error { + params := &atlasv2.ListConnectedOrgConfigsApiParams{ + FederationSettingsId: opts.federationSettingsId, + } + resp, _, err := opts.store.ListConnectedOrgConfigs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListConnectedOrgConfigsTemplate = "<>" + +func ListConnectedOrgConfigsBuilder() cobra.Command { + opts := ListConnectedOrgConfigsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListConnectedOrgConfigsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + + return cmd +} +type ListIdentityProvidersOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListIdentityProvidersOperation + federationSettingsId string +} + +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 *ListIdentityProvidersOpts) Run() error { + params := &atlasv2.ListIdentityProvidersApiParams{ + FederationSettingsId: opts.federationSettingsId, + } + resp, _, err := opts.store.ListIdentityProviders(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListIdentityProvidersTemplate = "<>" + +func ListIdentityProvidersBuilder() cobra.Command { + opts := ListIdentityProvidersOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListIdentityProvidersTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + + return cmd +} +type ListRoleMappingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListRoleMappingsOperation + federationSettingsId string + orgId string +} + +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 *ListRoleMappingsOpts) Run() error { + params := &atlasv2.ListRoleMappingsApiParams{ + FederationSettingsId: opts.federationSettingsId, + OrgId: opts.orgId, + } + resp, _, err := opts.store.ListRoleMappings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListRoleMappingsTemplate = "<>" + +func ListRoleMappingsBuilder() cobra.Command { + opts := ListRoleMappingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListRoleMappingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type RemoveConnectedOrgConfigOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.RemoveConnectedOrgConfigOperation + federationSettingsId string + orgId string +} + +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 *RemoveConnectedOrgConfigOpts) Run() error { + params := &atlasv2.RemoveConnectedOrgConfigApiParams{ + FederationSettingsId: opts.federationSettingsId, + OrgId: opts.orgId, + } + resp, _, err := opts.store.RemoveConnectedOrgConfig(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const RemoveConnectedOrgConfigTemplate = "<>" + +func RemoveConnectedOrgConfigBuilder() cobra.Command { + opts := RemoveConnectedOrgConfigOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), RemoveConnectedOrgConfigTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type UpdateConnectedOrgConfigOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateConnectedOrgConfigOperation + federationSettingsId string + orgId string +} + +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 *UpdateConnectedOrgConfigOpts) Run() error { + params := &atlasv2.UpdateConnectedOrgConfigApiParams{ + FederationSettingsId: opts.federationSettingsId, + OrgId: opts.orgId, + } + resp, _, err := opts.store.UpdateConnectedOrgConfig(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateConnectedOrgConfigTemplate = "<>" + +func UpdateConnectedOrgConfigBuilder() cobra.Command { + opts := UpdateConnectedOrgConfigOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateConnectedOrgConfigTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type UpdateIdentityProviderOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateIdentityProviderOperation + federationSettingsId string + identityProviderId string +} + +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 *UpdateIdentityProviderOpts) Run() error { + params := &atlasv2.UpdateIdentityProviderApiParams{ + FederationSettingsId: opts.federationSettingsId, + IdentityProviderId: opts.identityProviderId, + } + resp, _, err := opts.store.UpdateIdentityProvider(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateIdentityProviderTemplate = "<>" + +func UpdateIdentityProviderBuilder() cobra.Command { + opts := UpdateIdentityProviderOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateIdentityProviderTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") + + return cmd +} +type UpdateRoleMappingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateRoleMappingOperation + federationSettingsId string + id string + orgId string +} + +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 *UpdateRoleMappingOpts) Run() error { + params := &atlasv2.UpdateRoleMappingApiParams{ + FederationSettingsId: opts.federationSettingsId, + Id: opts.id, + OrgId: opts.orgId, + } + resp, _, err := opts.store.UpdateRoleMapping(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateRoleMappingTemplate = "<>" + +func UpdateRoleMappingBuilder() cobra.Command { + opts := UpdateRoleMappingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateRoleMappingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.id, "id", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_federated_authentication_store.go b/internal/generated/api_federated_authentication_store.go new file mode 100644 index 0000000000..b12b17a43f --- /dev/null +++ b/internal/generated/api_federated_authentication_store.go @@ -0,0 +1,175 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_federated_authentication_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateRoleMappingOperation, DeleteFederationAppOperation, DeleteRoleMappingOperation, GetConnectedOrgConfigOperation, GetFederationSettingsOperation, GetIdentityProviderOperation, GetIdentityProviderMetadataOperation, GetRoleMappingOperation, ListConnectedOrgConfigsOperation, ListIdentityProvidersOperation, ListRoleMappingsOperation, RemoveConnectedOrgConfigOperation, UpdateConnectedOrgConfigOperation, UpdateIdentityProviderOperation, UpdateRoleMappingOperation + +type CreateRoleMappingOperation interface { + CreateRoleMapping (*atlasv2.CreateRoleMappingApiParams) (*atlasv2.RoleMapping, error) +} + +// CreateRoleMapping encapsulates the logic to manage different cloud providers. +func (s *Store) CreateRoleMapping(params *atlasv2.CreateRoleMappingApiParams) (*atlasv2.RoleMapping, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.CreateRoleMappingWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteFederationAppOperation interface { + DeleteFederationApp (*atlasv2.DeleteFederationAppApiParams) (, error) +} + +// DeleteFederationApp encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteFederationApp(params *atlasv2.DeleteFederationAppApiParams) (error) { + _, err := s.clientv2.FederatedAuthenticationApi.DeleteFederationAppWithParams(s.ctx, params).Execute() + return err +} + +type DeleteRoleMappingOperation interface { + DeleteRoleMapping (*atlasv2.DeleteRoleMappingApiParams) (, error) +} + +// DeleteRoleMapping encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteRoleMapping(params *atlasv2.DeleteRoleMappingApiParams) (error) { + _, err := s.clientv2.FederatedAuthenticationApi.DeleteRoleMappingWithParams(s.ctx, params).Execute() + return err +} + +type GetConnectedOrgConfigOperation interface { + GetConnectedOrgConfig (*atlasv2.GetConnectedOrgConfigApiParams) (*atlasv2.ConnectedOrgConfig, error) +} + +// GetConnectedOrgConfig encapsulates the logic to manage different cloud providers. +func (s *Store) GetConnectedOrgConfig(params *atlasv2.GetConnectedOrgConfigApiParams) (*atlasv2.ConnectedOrgConfig, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetFederationSettingsOperation interface { + GetFederationSettings (*atlasv2.GetFederationSettingsApiParams) (*atlasv2.OrgFederationSettings, error) +} + +// GetFederationSettings encapsulates the logic to manage different cloud providers. +func (s *Store) GetFederationSettings(params *atlasv2.GetFederationSettingsApiParams) (*atlasv2.OrgFederationSettings, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.GetFederationSettingsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetIdentityProviderOperation interface { + GetIdentityProvider (*atlasv2.GetIdentityProviderApiParams) (*atlasv2.IdentityProvider, error) +} + +// GetIdentityProvider encapsulates the logic to manage different cloud providers. +func (s *Store) GetIdentityProvider(params *atlasv2.GetIdentityProviderApiParams) (*atlasv2.IdentityProvider, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.GetIdentityProviderWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetIdentityProviderMetadataOperation interface { + GetIdentityProviderMetadata (*atlasv2.GetIdentityProviderMetadataApiParams) (*atlasv2.string, error) +} + +// GetIdentityProviderMetadata encapsulates the logic to manage different cloud providers. +func (s *Store) GetIdentityProviderMetadata(params *atlasv2.GetIdentityProviderMetadataApiParams) (*atlasv2.string, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetRoleMappingOperation interface { + GetRoleMapping (*atlasv2.GetRoleMappingApiParams) (*atlasv2.RoleMapping, error) +} + +// GetRoleMapping encapsulates the logic to manage different cloud providers. +func (s *Store) GetRoleMapping(params *atlasv2.GetRoleMappingApiParams) (*atlasv2.RoleMapping, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.GetRoleMappingWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListConnectedOrgConfigsOperation interface { + ListConnectedOrgConfigs (*atlasv2.ListConnectedOrgConfigsApiParams) (*atlasv2.[]ConnectedOrgConfig, error) +} + +// ListConnectedOrgConfigs encapsulates the logic to manage different cloud providers. +func (s *Store) ListConnectedOrgConfigs(params *atlasv2.ListConnectedOrgConfigsApiParams) (*atlasv2.[]ConnectedOrgConfig, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.ListConnectedOrgConfigsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListIdentityProvidersOperation interface { + ListIdentityProviders (*atlasv2.ListIdentityProvidersApiParams) (*atlasv2.[]IdentityProvider, error) +} + +// ListIdentityProviders encapsulates the logic to manage different cloud providers. +func (s *Store) ListIdentityProviders(params *atlasv2.ListIdentityProvidersApiParams) (*atlasv2.[]IdentityProvider, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.ListIdentityProvidersWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListRoleMappingsOperation interface { + ListRoleMappings (*atlasv2.ListRoleMappingsApiParams) (*atlasv2.[]RoleMapping, error) +} + +// ListRoleMappings encapsulates the logic to manage different cloud providers. +func (s *Store) ListRoleMappings(params *atlasv2.ListRoleMappingsApiParams) (*atlasv2.[]RoleMapping, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.ListRoleMappingsWithParams(s.ctx, params).Execute() + return &result, err +} + +type RemoveConnectedOrgConfigOperation interface { + RemoveConnectedOrgConfig (*atlasv2.RemoveConnectedOrgConfigApiParams) (*atlasv2.map[string]interface{}, error) +} + +// RemoveConnectedOrgConfig encapsulates the logic to manage different cloud providers. +func (s *Store) RemoveConnectedOrgConfig(params *atlasv2.RemoveConnectedOrgConfigApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateConnectedOrgConfigOperation interface { + UpdateConnectedOrgConfig (*atlasv2.UpdateConnectedOrgConfigApiParams) (*atlasv2.ConnectedOrgConfig, error) +} + +// UpdateConnectedOrgConfig encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateConnectedOrgConfig(params *atlasv2.UpdateConnectedOrgConfigApiParams) (*atlasv2.ConnectedOrgConfig, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateIdentityProviderOperation interface { + UpdateIdentityProvider (*atlasv2.UpdateIdentityProviderApiParams) (*atlasv2.IdentityProvider, error) +} + +// UpdateIdentityProvider encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateIdentityProvider(params *atlasv2.UpdateIdentityProviderApiParams) (*atlasv2.IdentityProvider, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateRoleMappingOperation interface { + UpdateRoleMapping (*atlasv2.UpdateRoleMappingApiParams) (*atlasv2.RoleMapping, error) +} + +// UpdateRoleMapping encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateRoleMapping(params *atlasv2.UpdateRoleMappingApiParams) (*atlasv2.RoleMapping, error) { + result, _, err := s.clientv2.FederatedAuthenticationApi.UpdateRoleMappingWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go new file mode 100644 index 0000000000..ba15f5914b --- /dev/null +++ b/internal/generated/api_global_clusters_cmd.go @@ -0,0 +1,306 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateCustomZoneMappingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateCustomZoneMappingOperation + groupId string + clusterName string +} + +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 *CreateCustomZoneMappingOpts) Run() error { + params := &atlasv2.CreateCustomZoneMappingApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.CreateCustomZoneMapping(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateCustomZoneMappingTemplate = "<>" + +func CreateCustomZoneMappingBuilder() cobra.Command { + opts := CreateCustomZoneMappingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateCustomZoneMappingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type CreateManagedNamespaceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateManagedNamespaceOperation + groupId string + clusterName string +} + +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 *CreateManagedNamespaceOpts) Run() error { + params := &atlasv2.CreateManagedNamespaceApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.CreateManagedNamespace(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateManagedNamespaceTemplate = "<>" + +func CreateManagedNamespaceBuilder() cobra.Command { + opts := CreateManagedNamespaceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateManagedNamespaceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type DeleteAllCustomZoneMappingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteAllCustomZoneMappingsOperation + groupId string + clusterName string +} + +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 *DeleteAllCustomZoneMappingsOpts) Run() error { + params := &atlasv2.DeleteAllCustomZoneMappingsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.DeleteAllCustomZoneMappings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteAllCustomZoneMappingsTemplate = "<>" + +func DeleteAllCustomZoneMappingsBuilder() cobra.Command { + opts := DeleteAllCustomZoneMappingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteAllCustomZoneMappingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type DeleteManagedNamespaceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteManagedNamespaceOperation + clusterName string + groupId string + db string + collection string +} + +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 *DeleteManagedNamespaceOpts) Run() error { + params := &atlasv2.DeleteManagedNamespaceApiParams{ + ClusterName: opts.clusterName, + GroupId: opts.groupId, + Db: opts.db, + Collection: opts.collection, + } + resp, _, err := opts.store.DeleteManagedNamespace(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteManagedNamespaceTemplate = "<>" + +func DeleteManagedNamespaceBuilder() cobra.Command { + opts := DeleteManagedNamespaceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteManagedNamespaceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.db, "db", "", "usage description") + cmd.Flags().StringVar(&opts.collection, "collection", "", "usage description") + + return cmd +} +type GetManagedNamespaceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetManagedNamespaceOperation + groupId string + clusterName string +} + +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 *GetManagedNamespaceOpts) Run() error { + params := &atlasv2.GetManagedNamespaceApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetManagedNamespace(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetManagedNamespaceTemplate = "<>" + +func GetManagedNamespaceBuilder() cobra.Command { + opts := GetManagedNamespaceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetManagedNamespaceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_global_clusters_store.go b/internal/generated/api_global_clusters_store.go new file mode 100644 index 0000000000..a4bcbd9b01 --- /dev/null +++ b/internal/generated/api_global_clusters_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_global_clusters_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateCustomZoneMappingOperation, CreateManagedNamespaceOperation, DeleteAllCustomZoneMappingsOperation, DeleteManagedNamespaceOperation, GetManagedNamespaceOperation + +type CreateCustomZoneMappingOperation interface { + CreateCustomZoneMapping (*atlasv2.CreateCustomZoneMappingApiParams) (*atlasv2.GeoSharding, error) +} + +// CreateCustomZoneMapping encapsulates the logic to manage different cloud providers. +func (s *Store) CreateCustomZoneMapping(params *atlasv2.CreateCustomZoneMappingApiParams) (*atlasv2.GeoSharding, error) { + result, _, err := s.clientv2.GlobalClustersApi.CreateCustomZoneMappingWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateManagedNamespaceOperation interface { + CreateManagedNamespace (*atlasv2.CreateManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) +} + +// CreateManagedNamespace encapsulates the logic to manage different cloud providers. +func (s *Store) CreateManagedNamespace(params *atlasv2.CreateManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) { + result, _, err := s.clientv2.GlobalClustersApi.CreateManagedNamespaceWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteAllCustomZoneMappingsOperation interface { + DeleteAllCustomZoneMappings (*atlasv2.DeleteAllCustomZoneMappingsApiParams) (*atlasv2.GeoSharding, error) +} + +// DeleteAllCustomZoneMappings encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteAllCustomZoneMappings(params *atlasv2.DeleteAllCustomZoneMappingsApiParams) (*atlasv2.GeoSharding, error) { + result, _, err := s.clientv2.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteManagedNamespaceOperation interface { + DeleteManagedNamespace (*atlasv2.DeleteManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) +} + +// DeleteManagedNamespace encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteManagedNamespace(params *atlasv2.DeleteManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) { + result, _, err := s.clientv2.GlobalClustersApi.DeleteManagedNamespaceWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetManagedNamespaceOperation interface { + GetManagedNamespace (*atlasv2.GetManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) +} + +// GetManagedNamespace encapsulates the logic to manage different cloud providers. +func (s *Store) GetManagedNamespace(params *atlasv2.GetManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) { + result, _, err := s.clientv2.GlobalClustersApi.GetManagedNamespaceWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go new file mode 100644 index 0000000000..359f2b9b49 --- /dev/null +++ b/internal/generated/api_invoices_cmd.go @@ -0,0 +1,248 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type DownloadInvoiceCSVOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DownloadInvoiceCSVOperation + orgId string + invoiceId string +} + +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 *DownloadInvoiceCSVOpts) Run() error { + params := &atlasv2.DownloadInvoiceCSVApiParams{ + OrgId: opts.orgId, + InvoiceId: opts.invoiceId, + } + _, err := opts.store.DownloadInvoiceCSV(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DownloadInvoiceCSVTemplate = "<>" + +func DownloadInvoiceCSVBuilder() cobra.Command { + opts := DownloadInvoiceCSVOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DownloadInvoiceCSVTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "usage description") + + return cmd +} +type GetInvoiceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetInvoiceOperation + orgId string + invoiceId string +} + +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 *GetInvoiceOpts) Run() error { + params := &atlasv2.GetInvoiceApiParams{ + OrgId: opts.orgId, + InvoiceId: opts.invoiceId, + } + resp, _, err := opts.store.GetInvoice(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetInvoiceTemplate = "<>" + +func GetInvoiceBuilder() cobra.Command { + opts := GetInvoiceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetInvoiceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "usage description") + + return cmd +} +type ListInvoicesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListInvoicesOperation + orgId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListInvoicesOpts) Run() error { + params := &atlasv2.ListInvoicesApiParams{ + OrgId: opts.orgId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListInvoices(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListInvoicesTemplate = "<>" + +func ListInvoicesBuilder() cobra.Command { + opts := ListInvoicesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListInvoicesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListPendingInvoicesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPendingInvoicesOperation + orgId string +} + +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 *ListPendingInvoicesOpts) Run() error { + params := &atlasv2.ListPendingInvoicesApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.ListPendingInvoices(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPendingInvoicesTemplate = "<>" + +func ListPendingInvoicesBuilder() cobra.Command { + opts := ListPendingInvoicesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPendingInvoicesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_invoices_store.go b/internal/generated/api_invoices_store.go new file mode 100644 index 0000000000..a48981b9ae --- /dev/null +++ b/internal/generated/api_invoices_store.go @@ -0,0 +1,65 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_invoices_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DownloadInvoiceCSVOperation, GetInvoiceOperation, ListInvoicesOperation, ListPendingInvoicesOperation + +type DownloadInvoiceCSVOperation interface { + DownloadInvoiceCSV (*atlasv2.DownloadInvoiceCSVApiParams) (, error) +} + +// DownloadInvoiceCSV encapsulates the logic to manage different cloud providers. +func (s *Store) DownloadInvoiceCSV(params *atlasv2.DownloadInvoiceCSVApiParams) (error) { + _, err := s.clientv2.InvoicesApi.DownloadInvoiceCSVWithParams(s.ctx, params).Execute() + return err +} + +type GetInvoiceOperation interface { + GetInvoice (*atlasv2.GetInvoiceApiParams) (*atlasv2.Invoice, error) +} + +// GetInvoice encapsulates the logic to manage different cloud providers. +func (s *Store) GetInvoice(params *atlasv2.GetInvoiceApiParams) (*atlasv2.Invoice, error) { + result, _, err := s.clientv2.InvoicesApi.GetInvoiceWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListInvoicesOperation interface { + ListInvoices (*atlasv2.ListInvoicesApiParams) (*atlasv2.PaginatedApiInvoice, error) +} + +// ListInvoices encapsulates the logic to manage different cloud providers. +func (s *Store) ListInvoices(params *atlasv2.ListInvoicesApiParams) (*atlasv2.PaginatedApiInvoice, error) { + result, _, err := s.clientv2.InvoicesApi.ListInvoicesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPendingInvoicesOperation interface { + ListPendingInvoices (*atlasv2.ListPendingInvoicesApiParams) (*atlasv2.PaginatedApiInvoice, error) +} + +// ListPendingInvoices encapsulates the logic to manage different cloud providers. +func (s *Store) ListPendingInvoices(params *atlasv2.ListPendingInvoicesApiParams) (*atlasv2.PaginatedApiInvoice, error) { + result, _, err := s.clientv2.InvoicesApi.ListPendingInvoicesWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go new file mode 100644 index 0000000000..c9b6a59707 --- /dev/null +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -0,0 +1,288 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type DeleteLDAPConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteLDAPConfigurationOperation + groupId string +} + +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 *DeleteLDAPConfigurationOpts) Run() error { + params := &atlasv2.DeleteLDAPConfigurationApiParams{ + GroupId: opts.groupId, + } + _, err := opts.store.DeleteLDAPConfiguration(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DeleteLDAPConfigurationTemplate = "<>" + +func DeleteLDAPConfigurationBuilder() cobra.Command { + opts := DeleteLDAPConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteLDAPConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetLDAPConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetLDAPConfigurationOperation + groupId string +} + +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 *GetLDAPConfigurationOpts) Run() error { + params := &atlasv2.GetLDAPConfigurationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetLDAPConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetLDAPConfigurationTemplate = "<>" + +func GetLDAPConfigurationBuilder() cobra.Command { + opts := GetLDAPConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetLDAPConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetLDAPConfigurationStatusOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetLDAPConfigurationStatusOperation + groupId string + requestId string +} + +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 *GetLDAPConfigurationStatusOpts) Run() error { + params := &atlasv2.GetLDAPConfigurationStatusApiParams{ + GroupId: opts.groupId, + RequestId: opts.requestId, + } + resp, _, err := opts.store.GetLDAPConfigurationStatus(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetLDAPConfigurationStatusTemplate = "<>" + +func GetLDAPConfigurationStatusBuilder() cobra.Command { + opts := GetLDAPConfigurationStatusOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetLDAPConfigurationStatusTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.requestId, "requestId", "", "usage description") + + return cmd +} +type SaveLDAPConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.SaveLDAPConfigurationOperation + groupId string +} + +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 *SaveLDAPConfigurationOpts) Run() error { + params := &atlasv2.SaveLDAPConfigurationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.SaveLDAPConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const SaveLDAPConfigurationTemplate = "<>" + +func SaveLDAPConfigurationBuilder() cobra.Command { + opts := SaveLDAPConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), SaveLDAPConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type VerifyLDAPConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.VerifyLDAPConfigurationOperation + groupId string +} + +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 *VerifyLDAPConfigurationOpts) Run() error { + params := &atlasv2.VerifyLDAPConfigurationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.VerifyLDAPConfiguration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const VerifyLDAPConfigurationTemplate = "<>" + +func VerifyLDAPConfigurationBuilder() cobra.Command { + opts := VerifyLDAPConfigurationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), VerifyLDAPConfigurationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_ldap_configuration_store.go b/internal/generated/api_ldap_configuration_store.go new file mode 100644 index 0000000000..ead27b8a63 --- /dev/null +++ b/internal/generated/api_ldap_configuration_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_ldap_configuration_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DeleteLDAPConfigurationOperation, GetLDAPConfigurationOperation, GetLDAPConfigurationStatusOperation, SaveLDAPConfigurationOperation, VerifyLDAPConfigurationOperation + +type DeleteLDAPConfigurationOperation interface { + DeleteLDAPConfiguration (*atlasv2.DeleteLDAPConfigurationApiParams) (, error) +} + +// DeleteLDAPConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteLDAPConfiguration(params *atlasv2.DeleteLDAPConfigurationApiParams) (error) { + _, err := s.clientv2.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(s.ctx, params).Execute() + return err +} + +type GetLDAPConfigurationOperation interface { + GetLDAPConfiguration (*atlasv2.GetLDAPConfigurationApiParams) (*atlasv2.UserSecurity, error) +} + +// GetLDAPConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) GetLDAPConfiguration(params *atlasv2.GetLDAPConfigurationApiParams) (*atlasv2.UserSecurity, error) { + result, _, err := s.clientv2.LDAPConfigurationApi.GetLDAPConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetLDAPConfigurationStatusOperation interface { + GetLDAPConfigurationStatus (*atlasv2.GetLDAPConfigurationStatusApiParams) (*atlasv2.NDSLDAPVerifyConnectivityJobRequest, error) +} + +// GetLDAPConfigurationStatus encapsulates the logic to manage different cloud providers. +func (s *Store) GetLDAPConfigurationStatus(params *atlasv2.GetLDAPConfigurationStatusApiParams) (*atlasv2.NDSLDAPVerifyConnectivityJobRequest, error) { + result, _, err := s.clientv2.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(s.ctx, params).Execute() + return &result, err +} + +type SaveLDAPConfigurationOperation interface { + SaveLDAPConfiguration (*atlasv2.SaveLDAPConfigurationApiParams) (*atlasv2.UserSecurity, error) +} + +// SaveLDAPConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) SaveLDAPConfiguration(params *atlasv2.SaveLDAPConfigurationApiParams) (*atlasv2.UserSecurity, error) { + result, _, err := s.clientv2.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + +type VerifyLDAPConfigurationOperation interface { + VerifyLDAPConfiguration (*atlasv2.VerifyLDAPConfigurationApiParams) (*atlasv2.NDSLDAPVerifyConnectivityJobRequest, error) +} + +// VerifyLDAPConfiguration encapsulates the logic to manage different cloud providers. +func (s *Store) VerifyLDAPConfiguration(params *atlasv2.VerifyLDAPConfigurationApiParams) (*atlasv2.NDSLDAPVerifyConnectivityJobRequest, error) { + result, _, err := s.clientv2.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go new file mode 100644 index 0000000000..00d78c9616 --- /dev/null +++ b/internal/generated/api_legacy_backup_cmd.go @@ -0,0 +1,623 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type DeleteLegacySnapshotOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteLegacySnapshotOperation + groupId string + clusterName string + snapshotId string +} + +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 *DeleteLegacySnapshotOpts) Run() error { + params := &atlasv2.DeleteLegacySnapshotApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.DeleteLegacySnapshot(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteLegacySnapshotTemplate = "<>" + +func DeleteLegacySnapshotBuilder() cobra.Command { + opts := DeleteLegacySnapshotOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteLegacySnapshotTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type GetLegacyBackupCheckpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetLegacyBackupCheckpointOperation + groupId string + checkpointId string + clusterName string +} + +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 *GetLegacyBackupCheckpointOpts) Run() error { + params := &atlasv2.GetLegacyBackupCheckpointApiParams{ + GroupId: opts.groupId, + CheckpointId: opts.checkpointId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetLegacyBackupCheckpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetLegacyBackupCheckpointTemplate = "<>" + +func GetLegacyBackupCheckpointBuilder() cobra.Command { + opts := GetLegacyBackupCheckpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetLegacyBackupCheckpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type GetLegacyBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetLegacyBackupRestoreJobOperation + groupId string + clusterName string + jobId string +} + +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 *GetLegacyBackupRestoreJobOpts) Run() error { + params := &atlasv2.GetLegacyBackupRestoreJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + JobId: opts.jobId, + } + resp, _, err := opts.store.GetLegacyBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetLegacyBackupRestoreJobTemplate = "<>" + +func GetLegacyBackupRestoreJobBuilder() cobra.Command { + opts := GetLegacyBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetLegacyBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.jobId, "jobId", "", "usage description") + + return cmd +} +type GetLegacySnapshotOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetLegacySnapshotOperation + groupId string + clusterName string + snapshotId string +} + +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 *GetLegacySnapshotOpts) Run() error { + params := &atlasv2.GetLegacySnapshotApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.GetLegacySnapshot(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetLegacySnapshotTemplate = "<>" + +func GetLegacySnapshotBuilder() cobra.Command { + opts := GetLegacySnapshotOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetLegacySnapshotTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type GetLegacySnapshotScheduleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetLegacySnapshotScheduleOperation + groupId string + clusterName string +} + +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 *GetLegacySnapshotScheduleOpts) Run() error { + params := &atlasv2.GetLegacySnapshotScheduleApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetLegacySnapshotSchedule(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetLegacySnapshotScheduleTemplate = "<>" + +func GetLegacySnapshotScheduleBuilder() cobra.Command { + opts := GetLegacySnapshotScheduleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetLegacySnapshotScheduleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type ListLegacyBackupCheckpointsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListLegacyBackupCheckpointsOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListLegacyBackupCheckpointsOpts) Run() error { + params := &atlasv2.ListLegacyBackupCheckpointsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListLegacyBackupCheckpoints(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListLegacyBackupCheckpointsTemplate = "<>" + +func ListLegacyBackupCheckpointsBuilder() cobra.Command { + opts := ListLegacyBackupCheckpointsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListLegacyBackupCheckpointsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListLegacyBackupRestoreJobsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListLegacyBackupRestoreJobsOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 + batchId string +} + +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 *ListLegacyBackupRestoreJobsOpts) Run() error { + params := &atlasv2.ListLegacyBackupRestoreJobsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + BatchId: opts.batchId, + } + resp, _, err := opts.store.ListLegacyBackupRestoreJobs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListLegacyBackupRestoreJobsTemplate = "<>" + +func ListLegacyBackupRestoreJobsBuilder() cobra.Command { + opts := ListLegacyBackupRestoreJobsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListLegacyBackupRestoreJobsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.batchId, "batchId", "", "usage description") + + return cmd +} +type ListLegacySnapshotsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListLegacySnapshotsOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 + completed string +} + +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 *ListLegacySnapshotsOpts) Run() error { + params := &atlasv2.ListLegacySnapshotsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + Completed: opts.completed, + } + resp, _, err := opts.store.ListLegacySnapshots(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListLegacySnapshotsTemplate = "<>" + +func ListLegacySnapshotsBuilder() cobra.Command { + opts := ListLegacySnapshotsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListLegacySnapshotsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.completed, "completed", "", "usage description") + + return cmd +} +type UpdateLegacySnapshotRetentionOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateLegacySnapshotRetentionOperation + groupId string + clusterName string + snapshotId string +} + +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 *UpdateLegacySnapshotRetentionOpts) Run() error { + params := &atlasv2.UpdateLegacySnapshotRetentionApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.UpdateLegacySnapshotRetention(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateLegacySnapshotRetentionTemplate = "<>" + +func UpdateLegacySnapshotRetentionBuilder() cobra.Command { + opts := UpdateLegacySnapshotRetentionOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateLegacySnapshotRetentionTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type UpdateLegacySnapshotScheduleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateLegacySnapshotScheduleOperation + groupId string + clusterName string +} + +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 *UpdateLegacySnapshotScheduleOpts) Run() error { + params := &atlasv2.UpdateLegacySnapshotScheduleApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.UpdateLegacySnapshotSchedule(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateLegacySnapshotScheduleTemplate = "<>" + +func UpdateLegacySnapshotScheduleBuilder() cobra.Command { + opts := UpdateLegacySnapshotScheduleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateLegacySnapshotScheduleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go new file mode 100644 index 0000000000..7233992723 --- /dev/null +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -0,0 +1,80 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateLegacyBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateLegacyBackupRestoreJobOperation + groupId string + clusterName string +} + +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 *CreateLegacyBackupRestoreJobOpts) Run() error { + params := &atlasv2.CreateLegacyBackupRestoreJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.CreateLegacyBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateLegacyBackupRestoreJobTemplate = "<>" + +func CreateLegacyBackupRestoreJobBuilder() cobra.Command { + opts := CreateLegacyBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateLegacyBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_legacy_backup_restore_jobs_store.go b/internal/generated/api_legacy_backup_restore_jobs_store.go new file mode 100644 index 0000000000..99deb643a3 --- /dev/null +++ b/internal/generated/api_legacy_backup_restore_jobs_store.go @@ -0,0 +1,35 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_legacy_backup_restore_jobs_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateLegacyBackupRestoreJobOperation + +type CreateLegacyBackupRestoreJobOperation interface { + CreateLegacyBackupRestoreJob (*atlasv2.CreateLegacyBackupRestoreJobApiParams) (*atlasv2.PaginatedRestoreJob, error) +} + +// CreateLegacyBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) CreateLegacyBackupRestoreJob(params *atlasv2.CreateLegacyBackupRestoreJobApiParams) (*atlasv2.PaginatedRestoreJob, error) { + result, _, err := s.clientv2.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_legacy_backup_store.go b/internal/generated/api_legacy_backup_store.go new file mode 100644 index 0000000000..1002feda45 --- /dev/null +++ b/internal/generated/api_legacy_backup_store.go @@ -0,0 +1,125 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_legacy_backup_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DeleteLegacySnapshotOperation, GetLegacyBackupCheckpointOperation, GetLegacyBackupRestoreJobOperation, GetLegacySnapshotOperation, GetLegacySnapshotScheduleOperation, ListLegacyBackupCheckpointsOperation, ListLegacyBackupRestoreJobsOperation, ListLegacySnapshotsOperation, UpdateLegacySnapshotRetentionOperation, UpdateLegacySnapshotScheduleOperation + +type DeleteLegacySnapshotOperation interface { + DeleteLegacySnapshot (*atlasv2.DeleteLegacySnapshotApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteLegacySnapshot encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteLegacySnapshot(params *atlasv2.DeleteLegacySnapshotApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.LegacyBackupApi.DeleteLegacySnapshotWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetLegacyBackupCheckpointOperation interface { + GetLegacyBackupCheckpoint (*atlasv2.GetLegacyBackupCheckpointApiParams) (*atlasv2.Checkpoint, error) +} + +// GetLegacyBackupCheckpoint encapsulates the logic to manage different cloud providers. +func (s *Store) GetLegacyBackupCheckpoint(params *atlasv2.GetLegacyBackupCheckpointApiParams) (*atlasv2.Checkpoint, error) { + result, _, err := s.clientv2.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetLegacyBackupRestoreJobOperation interface { + GetLegacyBackupRestoreJob (*atlasv2.GetLegacyBackupRestoreJobApiParams) (*atlasv2.RestoreJob, error) +} + +// GetLegacyBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) GetLegacyBackupRestoreJob(params *atlasv2.GetLegacyBackupRestoreJobApiParams) (*atlasv2.RestoreJob, error) { + result, _, err := s.clientv2.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetLegacySnapshotOperation interface { + GetLegacySnapshot (*atlasv2.GetLegacySnapshotApiParams) (*atlasv2.Snapshot, error) +} + +// GetLegacySnapshot encapsulates the logic to manage different cloud providers. +func (s *Store) GetLegacySnapshot(params *atlasv2.GetLegacySnapshotApiParams) (*atlasv2.Snapshot, error) { + result, _, err := s.clientv2.LegacyBackupApi.GetLegacySnapshotWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetLegacySnapshotScheduleOperation interface { + GetLegacySnapshotSchedule (*atlasv2.GetLegacySnapshotScheduleApiParams) (*atlasv2.SnapshotSchedule, error) +} + +// GetLegacySnapshotSchedule encapsulates the logic to manage different cloud providers. +func (s *Store) GetLegacySnapshotSchedule(params *atlasv2.GetLegacySnapshotScheduleApiParams) (*atlasv2.SnapshotSchedule, error) { + result, _, err := s.clientv2.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListLegacyBackupCheckpointsOperation interface { + ListLegacyBackupCheckpoints (*atlasv2.ListLegacyBackupCheckpointsApiParams) (*atlasv2.PaginatedApiAtlasCheckpoint, error) +} + +// ListLegacyBackupCheckpoints encapsulates the logic to manage different cloud providers. +func (s *Store) ListLegacyBackupCheckpoints(params *atlasv2.ListLegacyBackupCheckpointsApiParams) (*atlasv2.PaginatedApiAtlasCheckpoint, error) { + result, _, err := s.clientv2.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListLegacyBackupRestoreJobsOperation interface { + ListLegacyBackupRestoreJobs (*atlasv2.ListLegacyBackupRestoreJobsApiParams) (*atlasv2.PaginatedRestoreJob, error) +} + +// ListLegacyBackupRestoreJobs encapsulates the logic to manage different cloud providers. +func (s *Store) ListLegacyBackupRestoreJobs(params *atlasv2.ListLegacyBackupRestoreJobsApiParams) (*atlasv2.PaginatedRestoreJob, error) { + result, _, err := s.clientv2.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListLegacySnapshotsOperation interface { + ListLegacySnapshots (*atlasv2.ListLegacySnapshotsApiParams) (*atlasv2.PaginatedSnapshot, error) +} + +// ListLegacySnapshots encapsulates the logic to manage different cloud providers. +func (s *Store) ListLegacySnapshots(params *atlasv2.ListLegacySnapshotsApiParams) (*atlasv2.PaginatedSnapshot, error) { + result, _, err := s.clientv2.LegacyBackupApi.ListLegacySnapshotsWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateLegacySnapshotRetentionOperation interface { + UpdateLegacySnapshotRetention (*atlasv2.UpdateLegacySnapshotRetentionApiParams) (*atlasv2.Snapshot, error) +} + +// UpdateLegacySnapshotRetention encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateLegacySnapshotRetention(params *atlasv2.UpdateLegacySnapshotRetentionApiParams) (*atlasv2.Snapshot, error) { + result, _, err := s.clientv2.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateLegacySnapshotScheduleOperation interface { + UpdateLegacySnapshotSchedule (*atlasv2.UpdateLegacySnapshotScheduleApiParams) (*atlasv2.SnapshotSchedule, error) +} + +// UpdateLegacySnapshotSchedule encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateLegacySnapshotSchedule(params *atlasv2.UpdateLegacySnapshotScheduleApiParams) (*atlasv2.SnapshotSchedule, error) { + result, _, err := s.clientv2.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go new file mode 100644 index 0000000000..7e115a3e8c --- /dev/null +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -0,0 +1,285 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type DeferMaintenanceWindowOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeferMaintenanceWindowOperation + groupId string +} + +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 *DeferMaintenanceWindowOpts) Run() error { + params := &atlasv2.DeferMaintenanceWindowApiParams{ + GroupId: opts.groupId, + } + _, err := opts.store.DeferMaintenanceWindow(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DeferMaintenanceWindowTemplate = "<>" + +func DeferMaintenanceWindowBuilder() cobra.Command { + opts := DeferMaintenanceWindowOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeferMaintenanceWindowTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetMaintenanceWindowOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetMaintenanceWindowOperation + groupId string +} + +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 *GetMaintenanceWindowOpts) Run() error { + params := &atlasv2.GetMaintenanceWindowApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetMaintenanceWindow(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetMaintenanceWindowTemplate = "<>" + +func GetMaintenanceWindowBuilder() cobra.Command { + opts := GetMaintenanceWindowOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetMaintenanceWindowTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type ResetMaintenanceWindowOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ResetMaintenanceWindowOperation + groupId string +} + +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 *ResetMaintenanceWindowOpts) Run() error { + params := &atlasv2.ResetMaintenanceWindowApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.ResetMaintenanceWindow(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ResetMaintenanceWindowTemplate = "<>" + +func ResetMaintenanceWindowBuilder() cobra.Command { + opts := ResetMaintenanceWindowOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ResetMaintenanceWindowTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type ToggleMaintenanceAutoDeferOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ToggleMaintenanceAutoDeferOperation + groupId string +} + +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 *ToggleMaintenanceAutoDeferOpts) Run() error { + params := &atlasv2.ToggleMaintenanceAutoDeferApiParams{ + GroupId: opts.groupId, + } + _, err := opts.store.ToggleMaintenanceAutoDefer(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const ToggleMaintenanceAutoDeferTemplate = "<>" + +func ToggleMaintenanceAutoDeferBuilder() cobra.Command { + opts := ToggleMaintenanceAutoDeferOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ToggleMaintenanceAutoDeferTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpdateMaintenanceWindowOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateMaintenanceWindowOperation + groupId string +} + +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 *UpdateMaintenanceWindowOpts) Run() error { + params := &atlasv2.UpdateMaintenanceWindowApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpdateMaintenanceWindow(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateMaintenanceWindowTemplate = "<>" + +func UpdateMaintenanceWindowBuilder() cobra.Command { + opts := UpdateMaintenanceWindowOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateMaintenanceWindowTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_maintenance_windows__store.go b/internal/generated/api_maintenance_windows__store.go new file mode 100644 index 0000000000..421173054d --- /dev/null +++ b/internal/generated/api_maintenance_windows__store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_maintenance_windows__store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DeferMaintenanceWindowOperation, GetMaintenanceWindowOperation, ResetMaintenanceWindowOperation, ToggleMaintenanceAutoDeferOperation, UpdateMaintenanceWindowOperation + +type DeferMaintenanceWindowOperation interface { + DeferMaintenanceWindow (*atlasv2.DeferMaintenanceWindowApiParams) (, error) +} + +// DeferMaintenanceWindow encapsulates the logic to manage different cloud providers. +func (s *Store) DeferMaintenanceWindow(params *atlasv2.DeferMaintenanceWindowApiParams) (error) { + _, err := s.clientv2.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(s.ctx, params).Execute() + return err +} + +type GetMaintenanceWindowOperation interface { + GetMaintenanceWindow (*atlasv2.GetMaintenanceWindowApiParams) (*atlasv2.GroupMaintenanceWindow, error) +} + +// GetMaintenanceWindow encapsulates the logic to manage different cloud providers. +func (s *Store) GetMaintenanceWindow(params *atlasv2.GetMaintenanceWindowApiParams) (*atlasv2.GroupMaintenanceWindow, error) { + result, _, err := s.clientv2.MaintenanceWindowsApi.GetMaintenanceWindowWithParams(s.ctx, params).Execute() + return &result, err +} + +type ResetMaintenanceWindowOperation interface { + ResetMaintenanceWindow (*atlasv2.ResetMaintenanceWindowApiParams) (*atlasv2.map[string]interface{}, error) +} + +// ResetMaintenanceWindow encapsulates the logic to manage different cloud providers. +func (s *Store) ResetMaintenanceWindow(params *atlasv2.ResetMaintenanceWindowApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(s.ctx, params).Execute() + return &result, err +} + +type ToggleMaintenanceAutoDeferOperation interface { + ToggleMaintenanceAutoDefer (*atlasv2.ToggleMaintenanceAutoDeferApiParams) (, error) +} + +// ToggleMaintenanceAutoDefer encapsulates the logic to manage different cloud providers. +func (s *Store) ToggleMaintenanceAutoDefer(params *atlasv2.ToggleMaintenanceAutoDeferApiParams) (error) { + _, err := s.clientv2.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(s.ctx, params).Execute() + return err +} + +type UpdateMaintenanceWindowOperation interface { + UpdateMaintenanceWindow (*atlasv2.UpdateMaintenanceWindowApiParams) (*atlasv2.map[string]interface{}, error) +} + +// UpdateMaintenanceWindow encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateMaintenanceWindow(params *atlasv2.UpdateMaintenanceWindowApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go new file mode 100644 index 0000000000..0532c7d67e --- /dev/null +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -0,0 +1,178 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateUserOperation +} + +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 *CreateUserOpts) Run() error { + params := &atlasv2.CreateUserApiParams{ + } + resp, _, err := opts.store.CreateUser(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateUserTemplate = "<>" + +func CreateUserBuilder() cobra.Command { + opts := CreateUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + + return cmd +} +type GetUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetUserOperation + userId string +} + +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 *GetUserOpts) Run() error { + params := &atlasv2.GetUserApiParams{ + UserId: opts.userId, + } + resp, _, err := opts.store.GetUser(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetUserTemplate = "<>" + +func GetUserBuilder() cobra.Command { + opts := GetUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") + + return cmd +} +type GetUserByUsernameOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetUserByUsernameOperation + userName string +} + +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 *GetUserByUsernameOpts) Run() error { + params := &atlasv2.GetUserByUsernameApiParams{ + UserName: opts.userName, + } + resp, _, err := opts.store.GetUserByUsername(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetUserByUsernameTemplate = "<>" + +func GetUserByUsernameBuilder() cobra.Command { + opts := GetUserByUsernameOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetUserByUsernameTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.userName, "userName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_mongo_db_cloud_users_store.go b/internal/generated/api_mongo_db_cloud_users_store.go new file mode 100644 index 0000000000..4879eaaf46 --- /dev/null +++ b/internal/generated/api_mongo_db_cloud_users_store.go @@ -0,0 +1,55 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_mongo_db_cloud_users_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateUserOperation, GetUserOperation, GetUserByUsernameOperation + +type CreateUserOperation interface { + CreateUser (*atlasv2.CreateUserApiParams) (*atlasv2.AppUser, error) +} + +// CreateUser encapsulates the logic to manage different cloud providers. +func (s *Store) CreateUser(params *atlasv2.CreateUserApiParams) (*atlasv2.AppUser, error) { + result, _, err := s.clientv2.MongoDBCloudUsersApi.CreateUserWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetUserOperation interface { + GetUser (*atlasv2.GetUserApiParams) (*atlasv2.AppUser, error) +} + +// GetUser encapsulates the logic to manage different cloud providers. +func (s *Store) GetUser(params *atlasv2.GetUserApiParams) (*atlasv2.AppUser, error) { + result, _, err := s.clientv2.MongoDBCloudUsersApi.GetUserWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetUserByUsernameOperation interface { + GetUserByUsername (*atlasv2.GetUserByUsernameApiParams) (*atlasv2.AppUser, error) +} + +// GetUserByUsername encapsulates the logic to manage different cloud providers. +func (s *Store) GetUserByUsername(params *atlasv2.GetUserByUsernameApiParams) (*atlasv2.AppUser, error) { + result, _, err := s.clientv2.MongoDBCloudUsersApi.GetUserByUsernameWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go new file mode 100644 index 0000000000..44eae421be --- /dev/null +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -0,0 +1,945 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type GetAtlasProcessOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetAtlasProcessOperation + groupId string + processId string +} + +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 *GetAtlasProcessOpts) Run() error { + params := &atlasv2.GetAtlasProcessApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + } + resp, _, err := opts.store.GetAtlasProcess(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetAtlasProcessTemplate = "<>" + +func GetAtlasProcessBuilder() cobra.Command { + opts := GetAtlasProcessOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetAtlasProcessTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + + return cmd +} +type GetDatabaseOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetDatabaseOperation + groupId string + databaseName string + processId string +} + +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 *GetDatabaseOpts) Run() error { + params := &atlasv2.GetDatabaseApiParams{ + GroupId: opts.groupId, + DatabaseName: opts.databaseName, + ProcessId: opts.processId, + } + resp, _, err := opts.store.GetDatabase(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetDatabaseTemplate = "<>" + +func GetDatabaseBuilder() cobra.Command { + opts := GetDatabaseOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetDatabaseTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + + return cmd +} +type GetDatabaseMeasurementsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetDatabaseMeasurementsOperation + groupId string + databaseName string + processId string + m []string + granularity string + period string + start time.Time + end time.Time +} + +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 *GetDatabaseMeasurementsOpts) Run() error { + params := &atlasv2.GetDatabaseMeasurementsApiParams{ + GroupId: opts.groupId, + DatabaseName: opts.databaseName, + ProcessId: opts.processId, + M: opts.m, + Granularity: opts.granularity, + Period: opts.period, + Start: opts.start, + End: opts.end, + } + resp, _, err := opts.store.GetDatabaseMeasurements(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetDatabaseMeasurementsTemplate = "<>" + +func GetDatabaseMeasurementsBuilder() cobra.Command { + opts := GetDatabaseMeasurementsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetDatabaseMeasurementsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.m, "m", "", "usage description") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") + cmd.Flags().StringVar(&opts.period, "period", "", "usage description") + cmd.Flags().StringVar(&opts.start, "start", "", "usage description") + cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + + return cmd +} +type GetDiskMeasurementsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetDiskMeasurementsOperation + groupId string + partitionName string + processId string + m []string + granularity string + period string + start time.Time + end time.Time +} + +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 *GetDiskMeasurementsOpts) Run() error { + params := &atlasv2.GetDiskMeasurementsApiParams{ + GroupId: opts.groupId, + PartitionName: opts.partitionName, + ProcessId: opts.processId, + M: opts.m, + Granularity: opts.granularity, + Period: opts.period, + Start: opts.start, + End: opts.end, + } + resp, _, err := opts.store.GetDiskMeasurements(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetDiskMeasurementsTemplate = "<>" + +func GetDiskMeasurementsBuilder() cobra.Command { + opts := GetDiskMeasurementsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetDiskMeasurementsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.m, "m", "", "usage description") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") + cmd.Flags().StringVar(&opts.period, "period", "", "usage description") + cmd.Flags().StringVar(&opts.start, "start", "", "usage description") + cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + + return cmd +} +type GetHostLogsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetHostLogsOperation + groupId string + hostName string + logName string + endDate int64 + startDate int64 +} + +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 *GetHostLogsOpts) Run() error { + params := &atlasv2.GetHostLogsApiParams{ + GroupId: opts.groupId, + HostName: opts.hostName, + LogName: opts.logName, + EndDate: opts.endDate, + StartDate: opts.startDate, + } + resp, _, err := opts.store.GetHostLogs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetHostLogsTemplate = "<>" + +func GetHostLogsBuilder() cobra.Command { + opts := GetHostLogsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetHostLogsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.hostName, "hostName", "", "usage description") + cmd.Flags().StringVar(&opts.logName, "logName", "", "usage description") + cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") + cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") + + return cmd +} +type GetHostMeasurementsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetHostMeasurementsOperation + groupId string + processId string + m []string + period string + granularity string + start time.Time + end time.Time +} + +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 *GetHostMeasurementsOpts) Run() error { + params := &atlasv2.GetHostMeasurementsApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + M: opts.m, + Period: opts.period, + Granularity: opts.granularity, + Start: opts.start, + End: opts.end, + } + resp, _, err := opts.store.GetHostMeasurements(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetHostMeasurementsTemplate = "<>" + +func GetHostMeasurementsBuilder() cobra.Command { + opts := GetHostMeasurementsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetHostMeasurementsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.m, "m", "", "usage description") + cmd.Flags().StringVar(&opts.period, "period", "", "usage description") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") + cmd.Flags().StringVar(&opts.start, "start", "", "usage description") + cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + + return cmd +} +type GetIndexMetricsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetIndexMetricsOperation + processId string + indexName string + databaseName string + collectionName string + groupId string + granularity string + period string + start time.Time + end time.Time + metrics []string +} + +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 *GetIndexMetricsOpts) Run() error { + params := &atlasv2.GetIndexMetricsApiParams{ + ProcessId: opts.processId, + IndexName: opts.indexName, + DatabaseName: opts.databaseName, + CollectionName: opts.collectionName, + GroupId: opts.groupId, + Granularity: opts.granularity, + Period: opts.period, + Start: opts.start, + End: opts.end, + Metrics: opts.metrics, + } + resp, _, err := opts.store.GetIndexMetrics(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetIndexMetricsTemplate = "<>" + +func GetIndexMetricsBuilder() cobra.Command { + opts := GetIndexMetricsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetIndexMetricsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.indexName, "indexName", "", "usage description") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") + cmd.Flags().StringVar(&opts.period, "period", "", "usage description") + cmd.Flags().StringVar(&opts.start, "start", "", "usage description") + cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + cmd.Flags().StringVar(&opts.metrics, "metrics", "", "usage description") + + return cmd +} +type GetMeasurementsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetMeasurementsOperation + processId string + groupId string + granularity string + period string + start time.Time + end time.Time + metrics []string +} + +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 *GetMeasurementsOpts) Run() error { + params := &atlasv2.GetMeasurementsApiParams{ + ProcessId: opts.processId, + GroupId: opts.groupId, + Granularity: opts.granularity, + Period: opts.period, + Start: opts.start, + End: opts.end, + Metrics: opts.metrics, + } + resp, _, err := opts.store.GetMeasurements(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetMeasurementsTemplate = "<>" + +func GetMeasurementsBuilder() cobra.Command { + opts := GetMeasurementsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetMeasurementsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") + cmd.Flags().StringVar(&opts.period, "period", "", "usage description") + cmd.Flags().StringVar(&opts.start, "start", "", "usage description") + cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + cmd.Flags().StringVar(&opts.metrics, "metrics", "", "usage description") + + return cmd +} +type ListAtlasProcessesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListAtlasProcessesOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListAtlasProcessesOpts) Run() error { + params := &atlasv2.ListAtlasProcessesApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListAtlasProcesses(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListAtlasProcessesTemplate = "<>" + +func ListAtlasProcessesBuilder() cobra.Command { + opts := ListAtlasProcessesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListAtlasProcessesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListDatabasesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListDatabasesOperation + groupId string + processId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListDatabasesOpts) Run() error { + params := &atlasv2.ListDatabasesApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListDatabases(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListDatabasesTemplate = "<>" + +func ListDatabasesBuilder() cobra.Command { + opts := ListDatabasesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListDatabasesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListDiskMeasurementsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListDiskMeasurementsOperation + partitionName string + groupId string + processId string +} + +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 *ListDiskMeasurementsOpts) Run() error { + params := &atlasv2.ListDiskMeasurementsApiParams{ + PartitionName: opts.partitionName, + GroupId: opts.groupId, + ProcessId: opts.processId, + } + resp, _, err := opts.store.ListDiskMeasurements(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListDiskMeasurementsTemplate = "<>" + +func ListDiskMeasurementsBuilder() cobra.Command { + opts := ListDiskMeasurementsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListDiskMeasurementsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + + return cmd +} +type ListDiskPartitionsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListDiskPartitionsOperation + groupId string + processId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListDiskPartitionsOpts) Run() error { + params := &atlasv2.ListDiskPartitionsApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListDiskPartitions(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListDiskPartitionsTemplate = "<>" + +func ListDiskPartitionsBuilder() cobra.Command { + opts := ListDiskPartitionsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListDiskPartitionsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListIndexMetricsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListIndexMetricsOperation + processId string + databaseName string + collectionName string + groupId string + granularity string + period string + start time.Time + end time.Time + metrics []string +} + +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 *ListIndexMetricsOpts) Run() error { + params := &atlasv2.ListIndexMetricsApiParams{ + ProcessId: opts.processId, + DatabaseName: opts.databaseName, + CollectionName: opts.collectionName, + GroupId: opts.groupId, + Granularity: opts.granularity, + Period: opts.period, + Start: opts.start, + End: opts.end, + Metrics: opts.metrics, + } + resp, _, err := opts.store.ListIndexMetrics(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListIndexMetricsTemplate = "<>" + +func ListIndexMetricsBuilder() cobra.Command { + opts := ListIndexMetricsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListIndexMetricsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") + cmd.Flags().StringVar(&opts.period, "period", "", "usage description") + cmd.Flags().StringVar(&opts.start, "start", "", "usage description") + cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + cmd.Flags().StringVar(&opts.metrics, "metrics", "", "usage description") + + return cmd +} +type ListMetricTypesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListMetricTypesOperation + processId string + groupId string +} + +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 *ListMetricTypesOpts) Run() error { + params := &atlasv2.ListMetricTypesApiParams{ + ProcessId: opts.processId, + GroupId: opts.groupId, + } + resp, _, err := opts.store.ListMetricTypes(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListMetricTypesTemplate = "<>" + +func ListMetricTypesBuilder() cobra.Command { + opts := ListMetricTypesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListMetricTypesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_monitoring_and_logs_store.go b/internal/generated/api_monitoring_and_logs_store.go new file mode 100644 index 0000000000..df99d50cdb --- /dev/null +++ b/internal/generated/api_monitoring_and_logs_store.go @@ -0,0 +1,165 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_monitoring_and_logs_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetAtlasProcessOperation, GetDatabaseOperation, GetDatabaseMeasurementsOperation, GetDiskMeasurementsOperation, GetHostLogsOperation, GetHostMeasurementsOperation, GetIndexMetricsOperation, GetMeasurementsOperation, ListAtlasProcessesOperation, ListDatabasesOperation, ListDiskMeasurementsOperation, ListDiskPartitionsOperation, ListIndexMetricsOperation, ListMetricTypesOperation + +type GetAtlasProcessOperation interface { + GetAtlasProcess (*atlasv2.GetAtlasProcessApiParams) (*atlasv2.HostViewAtlas, error) +} + +// GetAtlasProcess encapsulates the logic to manage different cloud providers. +func (s *Store) GetAtlasProcess(params *atlasv2.GetAtlasProcessApiParams) (*atlasv2.HostViewAtlas, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.GetAtlasProcessWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetDatabaseOperation interface { + GetDatabase (*atlasv2.GetDatabaseApiParams) (*atlasv2.Database, error) +} + +// GetDatabase encapsulates the logic to manage different cloud providers. +func (s *Store) GetDatabase(params *atlasv2.GetDatabaseApiParams) (*atlasv2.Database, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.GetDatabaseWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetDatabaseMeasurementsOperation interface { + GetDatabaseMeasurements (*atlasv2.GetDatabaseMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) +} + +// GetDatabaseMeasurements encapsulates the logic to manage different cloud providers. +func (s *Store) GetDatabaseMeasurements(params *atlasv2.GetDatabaseMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetDiskMeasurementsOperation interface { + GetDiskMeasurements (*atlasv2.GetDiskMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) +} + +// GetDiskMeasurements encapsulates the logic to manage different cloud providers. +func (s *Store) GetDiskMeasurements(params *atlasv2.GetDiskMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetHostLogsOperation interface { + GetHostLogs (*atlasv2.GetHostLogsApiParams) (*atlasv2.*os.File, error) +} + +// GetHostLogs encapsulates the logic to manage different cloud providers. +func (s *Store) GetHostLogs(params *atlasv2.GetHostLogsApiParams) (*atlasv2.*os.File, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.GetHostLogsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetHostMeasurementsOperation interface { + GetHostMeasurements (*atlasv2.GetHostMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) +} + +// GetHostMeasurements encapsulates the logic to manage different cloud providers. +func (s *Store) GetHostMeasurements(params *atlasv2.GetHostMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.GetHostMeasurementsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetIndexMetricsOperation interface { + GetIndexMetrics (*atlasv2.GetIndexMetricsApiParams) (*atlasv2.MeasurementsIndexes, error) +} + +// GetIndexMetrics encapsulates the logic to manage different cloud providers. +func (s *Store) GetIndexMetrics(params *atlasv2.GetIndexMetricsApiParams) (*atlasv2.MeasurementsIndexes, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.GetIndexMetricsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetMeasurementsOperation interface { + GetMeasurements (*atlasv2.GetMeasurementsApiParams) (*atlasv2.MeasurementsNonIndex, error) +} + +// GetMeasurements encapsulates the logic to manage different cloud providers. +func (s *Store) GetMeasurements(params *atlasv2.GetMeasurementsApiParams) (*atlasv2.MeasurementsNonIndex, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.GetMeasurementsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListAtlasProcessesOperation interface { + ListAtlasProcesses (*atlasv2.ListAtlasProcessesApiParams) (*atlasv2.PaginatedHostViewAtlas, error) +} + +// ListAtlasProcesses encapsulates the logic to manage different cloud providers. +func (s *Store) ListAtlasProcesses(params *atlasv2.ListAtlasProcessesApiParams) (*atlasv2.PaginatedHostViewAtlas, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.ListAtlasProcessesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListDatabasesOperation interface { + ListDatabases (*atlasv2.ListDatabasesApiParams) (*atlasv2.PaginatedDatabase, error) +} + +// ListDatabases encapsulates the logic to manage different cloud providers. +func (s *Store) ListDatabases(params *atlasv2.ListDatabasesApiParams) (*atlasv2.PaginatedDatabase, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.ListDatabasesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListDiskMeasurementsOperation interface { + ListDiskMeasurements (*atlasv2.ListDiskMeasurementsApiParams) (*atlasv2.DiskPartition, error) +} + +// ListDiskMeasurements encapsulates the logic to manage different cloud providers. +func (s *Store) ListDiskMeasurements(params *atlasv2.ListDiskMeasurementsApiParams) (*atlasv2.DiskPartition, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListDiskPartitionsOperation interface { + ListDiskPartitions (*atlasv2.ListDiskPartitionsApiParams) (*atlasv2.PaginatedDiskPartition, error) +} + +// ListDiskPartitions encapsulates the logic to manage different cloud providers. +func (s *Store) ListDiskPartitions(params *atlasv2.ListDiskPartitionsApiParams) (*atlasv2.PaginatedDiskPartition, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.ListDiskPartitionsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListIndexMetricsOperation interface { + ListIndexMetrics (*atlasv2.ListIndexMetricsApiParams) (*atlasv2.MeasurementsIndexes, error) +} + +// ListIndexMetrics encapsulates the logic to manage different cloud providers. +func (s *Store) ListIndexMetrics(params *atlasv2.ListIndexMetricsApiParams) (*atlasv2.MeasurementsIndexes, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.ListIndexMetricsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListMetricTypesOperation interface { + ListMetricTypes (*atlasv2.ListMetricTypesApiParams) (*atlasv2.FTSMetrics, error) +} + +// ListMetricTypes encapsulates the logic to manage different cloud providers. +func (s *Store) ListMetricTypes(params *atlasv2.ListMetricTypesApiParams) (*atlasv2.FTSMetrics, error) { + result, _, err := s.clientv2.MonitoringAndLogsApi.ListMetricTypesWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go new file mode 100644 index 0000000000..7a7ede0916 --- /dev/null +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -0,0 +1,361 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateClusterOperation + groupId string +} + +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 *CreateClusterOpts) Run() error { + params := &atlasv2.CreateClusterApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateCluster(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateClusterTemplate = "<>" + +func CreateClusterBuilder() cobra.Command { + opts := CreateClusterOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateClusterTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeleteClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteClusterOperation + groupId string + clusterName string + retainBackups bool +} + +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 *DeleteClusterOpts) Run() error { + params := &atlasv2.DeleteClusterApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + RetainBackups: opts.retainBackups, + } + _, err := opts.store.DeleteCluster(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DeleteClusterTemplate = "<>" + +func DeleteClusterBuilder() cobra.Command { + opts := DeleteClusterOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteClusterTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.retainBackups, "retainBackups", "", "usage description") + + return cmd +} +type GetClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetClusterOperation + groupId string + clusterName string +} + +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 *GetClusterOpts) Run() error { + params := &atlasv2.GetClusterApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetCluster(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetClusterTemplate = "<>" + +func GetClusterBuilder() cobra.Command { + opts := GetClusterOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetClusterTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type ListClustersOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListClustersOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListClustersOpts) Run() error { + params := &atlasv2.ListClustersApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListClusters(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListClustersTemplate = "<>" + +func ListClustersBuilder() cobra.Command { + opts := ListClustersOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListClustersTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type TestFailoverOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.TestFailoverOperation + groupId string + clusterName string +} + +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 *TestFailoverOpts) Run() error { + params := &atlasv2.TestFailoverApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + _, err := opts.store.TestFailover(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const TestFailoverTemplate = "<>" + +func TestFailoverBuilder() cobra.Command { + opts := TestFailoverOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), TestFailoverTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type UpdateClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateClusterOperation + groupId string + clusterName string +} + +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 *UpdateClusterOpts) Run() error { + params := &atlasv2.UpdateClusterApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.UpdateCluster(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateClusterTemplate = "<>" + +func UpdateClusterBuilder() cobra.Command { + opts := UpdateClusterOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateClusterTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_multi_cloud_clusters_store.go b/internal/generated/api_multi_cloud_clusters_store.go new file mode 100644 index 0000000000..1f62304653 --- /dev/null +++ b/internal/generated/api_multi_cloud_clusters_store.go @@ -0,0 +1,85 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_multi_cloud_clusters_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateClusterOperation, DeleteClusterOperation, GetClusterOperation, ListClustersOperation, TestFailoverOperation, UpdateClusterOperation + +type CreateClusterOperation interface { + CreateCluster (*atlasv2.CreateClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) +} + +// CreateCluster encapsulates the logic to manage different cloud providers. +func (s *Store) CreateCluster(params *atlasv2.CreateClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) { + result, _, err := s.clientv2.MultiCloudClustersApi.CreateClusterWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteClusterOperation interface { + DeleteCluster (*atlasv2.DeleteClusterApiParams) (, error) +} + +// DeleteCluster encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteCluster(params *atlasv2.DeleteClusterApiParams) (error) { + _, err := s.clientv2.MultiCloudClustersApi.DeleteClusterWithParams(s.ctx, params).Execute() + return err +} + +type GetClusterOperation interface { + GetCluster (*atlasv2.GetClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) +} + +// GetCluster encapsulates the logic to manage different cloud providers. +func (s *Store) GetCluster(params *atlasv2.GetClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) { + result, _, err := s.clientv2.MultiCloudClustersApi.GetClusterWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListClustersOperation interface { + ListClusters (*atlasv2.ListClustersApiParams) (*atlasv2.PaginatedClusterDescriptionV15, error) +} + +// ListClusters encapsulates the logic to manage different cloud providers. +func (s *Store) ListClusters(params *atlasv2.ListClustersApiParams) (*atlasv2.PaginatedClusterDescriptionV15, error) { + result, _, err := s.clientv2.MultiCloudClustersApi.ListClustersWithParams(s.ctx, params).Execute() + return &result, err +} + +type TestFailoverOperation interface { + TestFailover (*atlasv2.TestFailoverApiParams) (, error) +} + +// TestFailover encapsulates the logic to manage different cloud providers. +func (s *Store) TestFailover(params *atlasv2.TestFailoverApiParams) (error) { + _, err := s.clientv2.MultiCloudClustersApi.TestFailoverWithParams(s.ctx, params).Execute() + return err +} + +type UpdateClusterOperation interface { + UpdateCluster (*atlasv2.UpdateClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) +} + +// UpdateCluster encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateCluster(params *atlasv2.UpdateClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) { + result, _, err := s.clientv2.MultiCloudClustersApi.UpdateClusterWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go new file mode 100644 index 0000000000..93ab605d1b --- /dev/null +++ b/internal/generated/api_network_peering_cmd.go @@ -0,0 +1,752 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreatePeeringConnectionOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreatePeeringConnectionOperation + groupId string +} + +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 *CreatePeeringConnectionOpts) Run() error { + params := &atlasv2.CreatePeeringConnectionApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreatePeeringConnection(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreatePeeringConnectionTemplate = "<>" + +func CreatePeeringConnectionBuilder() cobra.Command { + opts := CreatePeeringConnectionOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreatePeeringConnectionTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type CreatePeeringContainerOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreatePeeringContainerOperation + groupId string +} + +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 *CreatePeeringContainerOpts) Run() error { + params := &atlasv2.CreatePeeringContainerApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreatePeeringContainer(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreatePeeringContainerTemplate = "<>" + +func CreatePeeringContainerBuilder() cobra.Command { + opts := CreatePeeringContainerOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreatePeeringContainerTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeletePeeringConnectionOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeletePeeringConnectionOperation + groupId string + peerId string +} + +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 *DeletePeeringConnectionOpts) Run() error { + params := &atlasv2.DeletePeeringConnectionApiParams{ + GroupId: opts.groupId, + PeerId: opts.peerId, + } + resp, _, err := opts.store.DeletePeeringConnection(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeletePeeringConnectionTemplate = "<>" + +func DeletePeeringConnectionBuilder() cobra.Command { + opts := DeletePeeringConnectionOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeletePeeringConnectionTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") + + return cmd +} +type DeletePeeringContainerOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeletePeeringContainerOperation + groupId string + containerId string +} + +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 *DeletePeeringContainerOpts) Run() error { + params := &atlasv2.DeletePeeringContainerApiParams{ + GroupId: opts.groupId, + ContainerId: opts.containerId, + } + resp, _, err := opts.store.DeletePeeringContainer(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeletePeeringContainerTemplate = "<>" + +func DeletePeeringContainerBuilder() cobra.Command { + opts := DeletePeeringContainerOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeletePeeringContainerTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") + + return cmd +} +type DisablePeeringOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DisablePeeringOperation + groupId string +} + +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 *DisablePeeringOpts) Run() error { + params := &atlasv2.DisablePeeringApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.DisablePeering(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DisablePeeringTemplate = "<>" + +func DisablePeeringBuilder() cobra.Command { + opts := DisablePeeringOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DisablePeeringTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetPeeringConnectionOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetPeeringConnectionOperation + groupId string + peerId string +} + +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 *GetPeeringConnectionOpts) Run() error { + params := &atlasv2.GetPeeringConnectionApiParams{ + GroupId: opts.groupId, + PeerId: opts.peerId, + } + resp, _, err := opts.store.GetPeeringConnection(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetPeeringConnectionTemplate = "<>" + +func GetPeeringConnectionBuilder() cobra.Command { + opts := GetPeeringConnectionOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetPeeringConnectionTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") + + return cmd +} +type GetPeeringContainerOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetPeeringContainerOperation + groupId string + containerId string +} + +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 *GetPeeringContainerOpts) Run() error { + params := &atlasv2.GetPeeringContainerApiParams{ + GroupId: opts.groupId, + ContainerId: opts.containerId, + } + resp, _, err := opts.store.GetPeeringContainer(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetPeeringContainerTemplate = "<>" + +func GetPeeringContainerBuilder() cobra.Command { + opts := GetPeeringContainerOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetPeeringContainerTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") + + return cmd +} +type ListPeeringConnectionsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPeeringConnectionsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 + providerName string +} + +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 *ListPeeringConnectionsOpts) Run() error { + params := &atlasv2.ListPeeringConnectionsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + ProviderName: opts.providerName, + } + resp, _, err := opts.store.ListPeeringConnections(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPeeringConnectionsTemplate = "<>" + +func ListPeeringConnectionsBuilder() cobra.Command { + opts := ListPeeringConnectionsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPeeringConnectionsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.providerName, "providerName", "", "usage description") + + return cmd +} +type ListPeeringContainerByCloudProviderOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPeeringContainerByCloudProviderOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 + providerName string +} + +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 *ListPeeringContainerByCloudProviderOpts) Run() error { + params := &atlasv2.ListPeeringContainerByCloudProviderApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + ProviderName: opts.providerName, + } + resp, _, err := opts.store.ListPeeringContainerByCloudProvider(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPeeringContainerByCloudProviderTemplate = "<>" + +func ListPeeringContainerByCloudProviderBuilder() cobra.Command { + opts := ListPeeringContainerByCloudProviderOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPeeringContainerByCloudProviderTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.providerName, "providerName", "", "usage description") + + return cmd +} +type ListPeeringContainersOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPeeringContainersOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListPeeringContainersOpts) Run() error { + params := &atlasv2.ListPeeringContainersApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListPeeringContainers(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPeeringContainersTemplate = "<>" + +func ListPeeringContainersBuilder() cobra.Command { + opts := ListPeeringContainersOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPeeringContainersTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type UpdatePeeringConnectionOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdatePeeringConnectionOperation + groupId string + peerId string +} + +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 *UpdatePeeringConnectionOpts) Run() error { + params := &atlasv2.UpdatePeeringConnectionApiParams{ + GroupId: opts.groupId, + PeerId: opts.peerId, + } + resp, _, err := opts.store.UpdatePeeringConnection(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdatePeeringConnectionTemplate = "<>" + +func UpdatePeeringConnectionBuilder() cobra.Command { + opts := UpdatePeeringConnectionOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdatePeeringConnectionTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") + + return cmd +} +type UpdatePeeringContainerOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdatePeeringContainerOperation + groupId string + containerId string +} + +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 *UpdatePeeringContainerOpts) Run() error { + params := &atlasv2.UpdatePeeringContainerApiParams{ + GroupId: opts.groupId, + ContainerId: opts.containerId, + } + resp, _, err := opts.store.UpdatePeeringContainer(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdatePeeringContainerTemplate = "<>" + +func UpdatePeeringContainerBuilder() cobra.Command { + opts := UpdatePeeringContainerOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdatePeeringContainerTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") + + return cmd +} +type VerifyConnectViaPeeringOnlyModeForOneProjectOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.VerifyConnectViaPeeringOnlyModeForOneProjectOperation + groupId string +} + +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 *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) Run() error { + params := &atlasv2.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.VerifyConnectViaPeeringOnlyModeForOneProject(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const VerifyConnectViaPeeringOnlyModeForOneProjectTemplate = "<>" + +func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() cobra.Command { + opts := VerifyConnectViaPeeringOnlyModeForOneProjectOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), VerifyConnectViaPeeringOnlyModeForOneProjectTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_network_peering_store.go b/internal/generated/api_network_peering_store.go new file mode 100644 index 0000000000..667f024e74 --- /dev/null +++ b/internal/generated/api_network_peering_store.go @@ -0,0 +1,155 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_network_peering_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreatePeeringConnectionOperation, CreatePeeringContainerOperation, DeletePeeringConnectionOperation, DeletePeeringContainerOperation, DisablePeeringOperation, GetPeeringConnectionOperation, GetPeeringContainerOperation, ListPeeringConnectionsOperation, ListPeeringContainerByCloudProviderOperation, ListPeeringContainersOperation, UpdatePeeringConnectionOperation, UpdatePeeringContainerOperation, VerifyConnectViaPeeringOnlyModeForOneProjectOperation + +type CreatePeeringConnectionOperation interface { + CreatePeeringConnection (*atlasv2.CreatePeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) +} + +// CreatePeeringConnection encapsulates the logic to manage different cloud providers. +func (s *Store) CreatePeeringConnection(params *atlasv2.CreatePeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.CreatePeeringConnectionWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreatePeeringContainerOperation interface { + CreatePeeringContainer (*atlasv2.CreatePeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) +} + +// CreatePeeringContainer encapsulates the logic to manage different cloud providers. +func (s *Store) CreatePeeringContainer(params *atlasv2.CreatePeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.CreatePeeringContainerWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeletePeeringConnectionOperation interface { + DeletePeeringConnection (*atlasv2.DeletePeeringConnectionApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeletePeeringConnection encapsulates the logic to manage different cloud providers. +func (s *Store) DeletePeeringConnection(params *atlasv2.DeletePeeringConnectionApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.NetworkPeeringApi.DeletePeeringConnectionWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeletePeeringContainerOperation interface { + DeletePeeringContainer (*atlasv2.DeletePeeringContainerApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeletePeeringContainer encapsulates the logic to manage different cloud providers. +func (s *Store) DeletePeeringContainer(params *atlasv2.DeletePeeringContainerApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.NetworkPeeringApi.DeletePeeringContainerWithParams(s.ctx, params).Execute() + return &result, err +} + +type DisablePeeringOperation interface { + DisablePeering (*atlasv2.DisablePeeringApiParams) (*atlasv2.PrivateIPMode, error) +} + +// DisablePeering encapsulates the logic to manage different cloud providers. +func (s *Store) DisablePeering(params *atlasv2.DisablePeeringApiParams) (*atlasv2.PrivateIPMode, error) { + result, _, err := s.clientv2.NetworkPeeringApi.DisablePeeringWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetPeeringConnectionOperation interface { + GetPeeringConnection (*atlasv2.GetPeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) +} + +// GetPeeringConnection encapsulates the logic to manage different cloud providers. +func (s *Store) GetPeeringConnection(params *atlasv2.GetPeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.GetPeeringConnectionWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetPeeringContainerOperation interface { + GetPeeringContainer (*atlasv2.GetPeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) +} + +// GetPeeringContainer encapsulates the logic to manage different cloud providers. +func (s *Store) GetPeeringContainer(params *atlasv2.GetPeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.GetPeeringContainerWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPeeringConnectionsOperation interface { + ListPeeringConnections (*atlasv2.ListPeeringConnectionsApiParams) (*atlasv2.PaginatedContainerPeer, error) +} + +// ListPeeringConnections encapsulates the logic to manage different cloud providers. +func (s *Store) ListPeeringConnections(params *atlasv2.ListPeeringConnectionsApiParams) (*atlasv2.PaginatedContainerPeer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.ListPeeringConnectionsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPeeringContainerByCloudProviderOperation interface { + ListPeeringContainerByCloudProvider (*atlasv2.ListPeeringContainerByCloudProviderApiParams) (*atlasv2.PaginatedCloudProviderContainer, error) +} + +// ListPeeringContainerByCloudProvider encapsulates the logic to manage different cloud providers. +func (s *Store) ListPeeringContainerByCloudProvider(params *atlasv2.ListPeeringContainerByCloudProviderApiParams) (*atlasv2.PaginatedCloudProviderContainer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPeeringContainersOperation interface { + ListPeeringContainers (*atlasv2.ListPeeringContainersApiParams) (*atlasv2.PaginatedCloudProviderContainer, error) +} + +// ListPeeringContainers encapsulates the logic to manage different cloud providers. +func (s *Store) ListPeeringContainers(params *atlasv2.ListPeeringContainersApiParams) (*atlasv2.PaginatedCloudProviderContainer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.ListPeeringContainersWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdatePeeringConnectionOperation interface { + UpdatePeeringConnection (*atlasv2.UpdatePeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) +} + +// UpdatePeeringConnection encapsulates the logic to manage different cloud providers. +func (s *Store) UpdatePeeringConnection(params *atlasv2.UpdatePeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.UpdatePeeringConnectionWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdatePeeringContainerOperation interface { + UpdatePeeringContainer (*atlasv2.UpdatePeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) +} + +// UpdatePeeringContainer encapsulates the logic to manage different cloud providers. +func (s *Store) UpdatePeeringContainer(params *atlasv2.UpdatePeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) { + result, _, err := s.clientv2.NetworkPeeringApi.UpdatePeeringContainerWithParams(s.ctx, params).Execute() + return &result, err +} + +type VerifyConnectViaPeeringOnlyModeForOneProjectOperation interface { + VerifyConnectViaPeeringOnlyModeForOneProject (*atlasv2.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams) (*atlasv2.PrivateIPMode, error) +} + +// VerifyConnectViaPeeringOnlyModeForOneProject encapsulates the logic to manage different cloud providers. +func (s *Store) VerifyConnectViaPeeringOnlyModeForOneProject(params *atlasv2.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams) (*atlasv2.PrivateIPMode, error) { + result, _, err := s.clientv2.NetworkPeeringApi.VerifyConnectViaPeeringOnlyModeForOneProjectWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go new file mode 100644 index 0000000000..a8a8f5659e --- /dev/null +++ b/internal/generated/api_online_archive_cmd.go @@ -0,0 +1,382 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateOnlineArchiveOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateOnlineArchiveOperation + groupId string + clusterName string +} + +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 *CreateOnlineArchiveOpts) Run() error { + params := &atlasv2.CreateOnlineArchiveApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.CreateOnlineArchive(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateOnlineArchiveTemplate = "<>" + +func CreateOnlineArchiveBuilder() cobra.Command { + opts := CreateOnlineArchiveOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateOnlineArchiveTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type DeleteOnlineArchiveOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteOnlineArchiveOperation + groupId string + archiveId string + clusterName string +} + +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 *DeleteOnlineArchiveOpts) Run() error { + params := &atlasv2.DeleteOnlineArchiveApiParams{ + GroupId: opts.groupId, + ArchiveId: opts.archiveId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.DeleteOnlineArchive(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteOnlineArchiveTemplate = "<>" + +func DeleteOnlineArchiveBuilder() cobra.Command { + opts := DeleteOnlineArchiveOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteOnlineArchiveTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type DownloadOnlineArchiveQueryLogsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DownloadOnlineArchiveQueryLogsOperation + groupId string + clusterName string + startDate int64 + endDate int64 + archiveOnly bool +} + +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 *DownloadOnlineArchiveQueryLogsOpts) Run() error { + params := &atlasv2.DownloadOnlineArchiveQueryLogsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + StartDate: opts.startDate, + EndDate: opts.endDate, + ArchiveOnly: opts.archiveOnly, + } + resp, _, err := opts.store.DownloadOnlineArchiveQueryLogs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DownloadOnlineArchiveQueryLogsTemplate = "<>" + +func DownloadOnlineArchiveQueryLogsBuilder() cobra.Command { + opts := DownloadOnlineArchiveQueryLogsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DownloadOnlineArchiveQueryLogsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") + cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") + cmd.Flags().StringVar(&opts.archiveOnly, "archiveOnly", "", "usage description") + + return cmd +} +type GetOnlineArchiveOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetOnlineArchiveOperation + groupId string + archiveId string + clusterName string +} + +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 *GetOnlineArchiveOpts) Run() error { + params := &atlasv2.GetOnlineArchiveApiParams{ + GroupId: opts.groupId, + ArchiveId: opts.archiveId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.GetOnlineArchive(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetOnlineArchiveTemplate = "<>" + +func GetOnlineArchiveBuilder() cobra.Command { + opts := GetOnlineArchiveOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetOnlineArchiveTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} +type ListOnlineArchivesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListOnlineArchivesOperation + groupId string + clusterName string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListOnlineArchivesOpts) Run() error { + params := &atlasv2.ListOnlineArchivesApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListOnlineArchives(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListOnlineArchivesTemplate = "<>" + +func ListOnlineArchivesBuilder() cobra.Command { + opts := ListOnlineArchivesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListOnlineArchivesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type UpdateOnlineArchiveOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateOnlineArchiveOperation + groupId string + archiveId string + clusterName string +} + +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 *UpdateOnlineArchiveOpts) Run() error { + params := &atlasv2.UpdateOnlineArchiveApiParams{ + GroupId: opts.groupId, + ArchiveId: opts.archiveId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.UpdateOnlineArchive(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateOnlineArchiveTemplate = "<>" + +func UpdateOnlineArchiveBuilder() cobra.Command { + opts := UpdateOnlineArchiveOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateOnlineArchiveTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_online_archive_store.go b/internal/generated/api_online_archive_store.go new file mode 100644 index 0000000000..73eeadaee7 --- /dev/null +++ b/internal/generated/api_online_archive_store.go @@ -0,0 +1,85 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_online_archive_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateOnlineArchiveOperation, DeleteOnlineArchiveOperation, DownloadOnlineArchiveQueryLogsOperation, GetOnlineArchiveOperation, ListOnlineArchivesOperation, UpdateOnlineArchiveOperation + +type CreateOnlineArchiveOperation interface { + CreateOnlineArchive (*atlasv2.CreateOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) +} + +// CreateOnlineArchive encapsulates the logic to manage different cloud providers. +func (s *Store) CreateOnlineArchive(params *atlasv2.CreateOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) { + result, _, err := s.clientv2.OnlineArchiveApi.CreateOnlineArchiveWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteOnlineArchiveOperation interface { + DeleteOnlineArchive (*atlasv2.DeleteOnlineArchiveApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteOnlineArchive encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteOnlineArchive(params *atlasv2.DeleteOnlineArchiveApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.OnlineArchiveApi.DeleteOnlineArchiveWithParams(s.ctx, params).Execute() + return &result, err +} + +type DownloadOnlineArchiveQueryLogsOperation interface { + DownloadOnlineArchiveQueryLogs (*atlasv2.DownloadOnlineArchiveQueryLogsApiParams) (*atlasv2.*os.File, error) +} + +// DownloadOnlineArchiveQueryLogs encapsulates the logic to manage different cloud providers. +func (s *Store) DownloadOnlineArchiveQueryLogs(params *atlasv2.DownloadOnlineArchiveQueryLogsApiParams) (*atlasv2.*os.File, error) { + result, _, err := s.clientv2.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetOnlineArchiveOperation interface { + GetOnlineArchive (*atlasv2.GetOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) +} + +// GetOnlineArchive encapsulates the logic to manage different cloud providers. +func (s *Store) GetOnlineArchive(params *atlasv2.GetOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) { + result, _, err := s.clientv2.OnlineArchiveApi.GetOnlineArchiveWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListOnlineArchivesOperation interface { + ListOnlineArchives (*atlasv2.ListOnlineArchivesApiParams) (*atlasv2.PaginatedOnlineArchive, error) +} + +// ListOnlineArchives encapsulates the logic to manage different cloud providers. +func (s *Store) ListOnlineArchives(params *atlasv2.ListOnlineArchivesApiParams) (*atlasv2.PaginatedOnlineArchive, error) { + result, _, err := s.clientv2.OnlineArchiveApi.ListOnlineArchivesWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateOnlineArchiveOperation interface { + UpdateOnlineArchive (*atlasv2.UpdateOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) +} + +// UpdateOnlineArchive encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateOnlineArchive(params *atlasv2.UpdateOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) { + result, _, err := s.clientv2.OnlineArchiveApi.UpdateOnlineArchiveWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go new file mode 100644 index 0000000000..55d3a60b54 --- /dev/null +++ b/internal/generated/api_organizations_cmd.go @@ -0,0 +1,844 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateOrganizationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateOrganizationOperation +} + +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 *CreateOrganizationOpts) Run() error { + params := &atlasv2.CreateOrganizationApiParams{ + } + resp, _, err := opts.store.CreateOrganization(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateOrganizationTemplate = "<>" + +func CreateOrganizationBuilder() cobra.Command { + opts := CreateOrganizationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateOrganizationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + + return cmd +} +type CreateOrganizationInvitationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateOrganizationInvitationOperation + orgId string +} + +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 *CreateOrganizationInvitationOpts) Run() error { + params := &atlasv2.CreateOrganizationInvitationApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.CreateOrganizationInvitation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateOrganizationInvitationTemplate = "<>" + +func CreateOrganizationInvitationBuilder() cobra.Command { + opts := CreateOrganizationInvitationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateOrganizationInvitationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type DeleteOrganizationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteOrganizationOperation + orgId string +} + +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 *DeleteOrganizationOpts) Run() error { + params := &atlasv2.DeleteOrganizationApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.DeleteOrganization(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteOrganizationTemplate = "<>" + +func DeleteOrganizationBuilder() cobra.Command { + opts := DeleteOrganizationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteOrganizationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type DeleteOrganizationInvitationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteOrganizationInvitationOperation + orgId string + invitationId string +} + +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 *DeleteOrganizationInvitationOpts) Run() error { + params := &atlasv2.DeleteOrganizationInvitationApiParams{ + OrgId: opts.orgId, + InvitationId: opts.invitationId, + } + resp, _, err := opts.store.DeleteOrganizationInvitation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteOrganizationInvitationTemplate = "<>" + +func DeleteOrganizationInvitationBuilder() cobra.Command { + opts := DeleteOrganizationInvitationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteOrganizationInvitationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + + return cmd +} +type GetOrganizationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetOrganizationOperation + orgId string +} + +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 *GetOrganizationOpts) Run() error { + params := &atlasv2.GetOrganizationApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.GetOrganization(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetOrganizationTemplate = "<>" + +func GetOrganizationBuilder() cobra.Command { + opts := GetOrganizationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetOrganizationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type GetOrganizationInvitationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetOrganizationInvitationOperation + orgId string + invitationId string +} + +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 *GetOrganizationInvitationOpts) Run() error { + params := &atlasv2.GetOrganizationInvitationApiParams{ + OrgId: opts.orgId, + InvitationId: opts.invitationId, + } + resp, _, err := opts.store.GetOrganizationInvitation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetOrganizationInvitationTemplate = "<>" + +func GetOrganizationInvitationBuilder() cobra.Command { + opts := GetOrganizationInvitationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetOrganizationInvitationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + + return cmd +} +type GetOrganizationSettingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetOrganizationSettingsOperation + orgId string +} + +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 *GetOrganizationSettingsOpts) Run() error { + params := &atlasv2.GetOrganizationSettingsApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.GetOrganizationSettings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetOrganizationSettingsTemplate = "<>" + +func GetOrganizationSettingsBuilder() cobra.Command { + opts := GetOrganizationSettingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetOrganizationSettingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type ListOrganizationInvitationsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListOrganizationInvitationsOperation + orgId string + username string +} + +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 *ListOrganizationInvitationsOpts) Run() error { + params := &atlasv2.ListOrganizationInvitationsApiParams{ + OrgId: opts.orgId, + Username: opts.username, + } + resp, _, err := opts.store.ListOrganizationInvitations(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListOrganizationInvitationsTemplate = "<>" + +func ListOrganizationInvitationsBuilder() cobra.Command { + opts := ListOrganizationInvitationsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListOrganizationInvitationsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + + return cmd +} +type ListOrganizationProjectsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListOrganizationProjectsOperation + orgId string + includeCount bool + itemsPerPage int32 + pageNum int32 + name string +} + +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 *ListOrganizationProjectsOpts) Run() error { + params := &atlasv2.ListOrganizationProjectsApiParams{ + OrgId: opts.orgId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + Name: opts.name, + } + resp, _, err := opts.store.ListOrganizationProjects(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListOrganizationProjectsTemplate = "<>" + +func ListOrganizationProjectsBuilder() cobra.Command { + opts := ListOrganizationProjectsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListOrganizationProjectsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + + return cmd +} +type ListOrganizationUsersOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListOrganizationUsersOperation + orgId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListOrganizationUsersOpts) Run() error { + params := &atlasv2.ListOrganizationUsersApiParams{ + OrgId: opts.orgId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListOrganizationUsers(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListOrganizationUsersTemplate = "<>" + +func ListOrganizationUsersBuilder() cobra.Command { + opts := ListOrganizationUsersOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListOrganizationUsersTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListOrganizationsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListOrganizationsOperation + includeCount bool + itemsPerPage int32 + pageNum int32 + name string +} + +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 *ListOrganizationsOpts) Run() error { + params := &atlasv2.ListOrganizationsApiParams{ + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + Name: opts.name, + } + resp, _, err := opts.store.ListOrganizations(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListOrganizationsTemplate = "<>" + +func ListOrganizationsBuilder() cobra.Command { + opts := ListOrganizationsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListOrganizationsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + + return cmd +} +type RenameOrganizationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.RenameOrganizationOperation + orgId string +} + +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 *RenameOrganizationOpts) Run() error { + params := &atlasv2.RenameOrganizationApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.RenameOrganization(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const RenameOrganizationTemplate = "<>" + +func RenameOrganizationBuilder() cobra.Command { + opts := RenameOrganizationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), RenameOrganizationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type UpdateOrganizationInvitationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateOrganizationInvitationOperation + orgId string +} + +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 *UpdateOrganizationInvitationOpts) Run() error { + params := &atlasv2.UpdateOrganizationInvitationApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.UpdateOrganizationInvitation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateOrganizationInvitationTemplate = "<>" + +func UpdateOrganizationInvitationBuilder() cobra.Command { + opts := UpdateOrganizationInvitationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationInvitationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type UpdateOrganizationInvitationByIdOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateOrganizationInvitationByIdOperation + orgId string + invitationId string +} + +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 *UpdateOrganizationInvitationByIdOpts) Run() error { + params := &atlasv2.UpdateOrganizationInvitationByIdApiParams{ + OrgId: opts.orgId, + InvitationId: opts.invitationId, + } + resp, _, err := opts.store.UpdateOrganizationInvitationById(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateOrganizationInvitationByIdTemplate = "<>" + +func UpdateOrganizationInvitationByIdBuilder() cobra.Command { + opts := UpdateOrganizationInvitationByIdOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationInvitationByIdTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + + return cmd +} +type UpdateOrganizationSettingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateOrganizationSettingsOperation + orgId string +} + +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 *UpdateOrganizationSettingsOpts) Run() error { + params := &atlasv2.UpdateOrganizationSettingsApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.UpdateOrganizationSettings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateOrganizationSettingsTemplate = "<>" + +func UpdateOrganizationSettingsBuilder() cobra.Command { + opts := UpdateOrganizationSettingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationSettingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_organizations_store.go b/internal/generated/api_organizations_store.go new file mode 100644 index 0000000000..bfaaf8654d --- /dev/null +++ b/internal/generated/api_organizations_store.go @@ -0,0 +1,175 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_organizations_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateOrganizationOperation, CreateOrganizationInvitationOperation, DeleteOrganizationOperation, DeleteOrganizationInvitationOperation, GetOrganizationOperation, GetOrganizationInvitationOperation, GetOrganizationSettingsOperation, ListOrganizationInvitationsOperation, ListOrganizationProjectsOperation, ListOrganizationUsersOperation, ListOrganizationsOperation, RenameOrganizationOperation, UpdateOrganizationInvitationOperation, UpdateOrganizationInvitationByIdOperation, UpdateOrganizationSettingsOperation + +type CreateOrganizationOperation interface { + CreateOrganization (*atlasv2.CreateOrganizationApiParams) (*atlasv2.CreateOrganizationResponse, error) +} + +// CreateOrganization encapsulates the logic to manage different cloud providers. +func (s *Store) CreateOrganization(params *atlasv2.CreateOrganizationApiParams) (*atlasv2.CreateOrganizationResponse, error) { + result, _, err := s.clientv2.OrganizationsApi.CreateOrganizationWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateOrganizationInvitationOperation interface { + CreateOrganizationInvitation (*atlasv2.CreateOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) +} + +// CreateOrganizationInvitation encapsulates the logic to manage different cloud providers. +func (s *Store) CreateOrganizationInvitation(params *atlasv2.CreateOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) { + result, _, err := s.clientv2.OrganizationsApi.CreateOrganizationInvitationWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteOrganizationOperation interface { + DeleteOrganization (*atlasv2.DeleteOrganizationApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteOrganization encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteOrganization(params *atlasv2.DeleteOrganizationApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.OrganizationsApi.DeleteOrganizationWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteOrganizationInvitationOperation interface { + DeleteOrganizationInvitation (*atlasv2.DeleteOrganizationInvitationApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteOrganizationInvitation encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteOrganizationInvitation(params *atlasv2.DeleteOrganizationInvitationApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.OrganizationsApi.DeleteOrganizationInvitationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetOrganizationOperation interface { + GetOrganization (*atlasv2.GetOrganizationApiParams) (*atlasv2.Organization, error) +} + +// GetOrganization encapsulates the logic to manage different cloud providers. +func (s *Store) GetOrganization(params *atlasv2.GetOrganizationApiParams) (*atlasv2.Organization, error) { + result, _, err := s.clientv2.OrganizationsApi.GetOrganizationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetOrganizationInvitationOperation interface { + GetOrganizationInvitation (*atlasv2.GetOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) +} + +// GetOrganizationInvitation encapsulates the logic to manage different cloud providers. +func (s *Store) GetOrganizationInvitation(params *atlasv2.GetOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) { + result, _, err := s.clientv2.OrganizationsApi.GetOrganizationInvitationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetOrganizationSettingsOperation interface { + GetOrganizationSettings (*atlasv2.GetOrganizationSettingsApiParams) (*atlasv2.OrganizationSettings, error) +} + +// GetOrganizationSettings encapsulates the logic to manage different cloud providers. +func (s *Store) GetOrganizationSettings(params *atlasv2.GetOrganizationSettingsApiParams) (*atlasv2.OrganizationSettings, error) { + result, _, err := s.clientv2.OrganizationsApi.GetOrganizationSettingsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListOrganizationInvitationsOperation interface { + ListOrganizationInvitations (*atlasv2.ListOrganizationInvitationsApiParams) (*atlasv2.[]OrganizationInvitation, error) +} + +// ListOrganizationInvitations encapsulates the logic to manage different cloud providers. +func (s *Store) ListOrganizationInvitations(params *atlasv2.ListOrganizationInvitationsApiParams) (*atlasv2.[]OrganizationInvitation, error) { + result, _, err := s.clientv2.OrganizationsApi.ListOrganizationInvitationsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListOrganizationProjectsOperation interface { + ListOrganizationProjects (*atlasv2.ListOrganizationProjectsApiParams) (*atlasv2.PaginatedAtlasGroup, error) +} + +// ListOrganizationProjects encapsulates the logic to manage different cloud providers. +func (s *Store) ListOrganizationProjects(params *atlasv2.ListOrganizationProjectsApiParams) (*atlasv2.PaginatedAtlasGroup, error) { + result, _, err := s.clientv2.OrganizationsApi.ListOrganizationProjectsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListOrganizationUsersOperation interface { + ListOrganizationUsers (*atlasv2.ListOrganizationUsersApiParams) (*atlasv2.PaginatedAppUser, error) +} + +// ListOrganizationUsers encapsulates the logic to manage different cloud providers. +func (s *Store) ListOrganizationUsers(params *atlasv2.ListOrganizationUsersApiParams) (*atlasv2.PaginatedAppUser, error) { + result, _, err := s.clientv2.OrganizationsApi.ListOrganizationUsersWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListOrganizationsOperation interface { + ListOrganizations (*atlasv2.ListOrganizationsApiParams) (*atlasv2.PaginatedOrganization, error) +} + +// ListOrganizations encapsulates the logic to manage different cloud providers. +func (s *Store) ListOrganizations(params *atlasv2.ListOrganizationsApiParams) (*atlasv2.PaginatedOrganization, error) { + result, _, err := s.clientv2.OrganizationsApi.ListOrganizationsWithParams(s.ctx, params).Execute() + return &result, err +} + +type RenameOrganizationOperation interface { + RenameOrganization (*atlasv2.RenameOrganizationApiParams) (*atlasv2.Organization, error) +} + +// RenameOrganization encapsulates the logic to manage different cloud providers. +func (s *Store) RenameOrganization(params *atlasv2.RenameOrganizationApiParams) (*atlasv2.Organization, error) { + result, _, err := s.clientv2.OrganizationsApi.RenameOrganizationWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateOrganizationInvitationOperation interface { + UpdateOrganizationInvitation (*atlasv2.UpdateOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) +} + +// UpdateOrganizationInvitation encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateOrganizationInvitation(params *atlasv2.UpdateOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) { + result, _, err := s.clientv2.OrganizationsApi.UpdateOrganizationInvitationWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateOrganizationInvitationByIdOperation interface { + UpdateOrganizationInvitationById (*atlasv2.UpdateOrganizationInvitationByIdApiParams) (*atlasv2.OrganizationInvitation, error) +} + +// UpdateOrganizationInvitationById encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateOrganizationInvitationById(params *atlasv2.UpdateOrganizationInvitationByIdApiParams) (*atlasv2.OrganizationInvitation, error) { + result, _, err := s.clientv2.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateOrganizationSettingsOperation interface { + UpdateOrganizationSettings (*atlasv2.UpdateOrganizationSettingsApiParams) (*atlasv2.OrganizationSettings, error) +} + +// UpdateOrganizationSettings encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateOrganizationSettings(params *atlasv2.UpdateOrganizationSettingsApiParams) (*atlasv2.OrganizationSettings, error) { + result, _, err := s.clientv2.OrganizationsApi.UpdateOrganizationSettingsWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go new file mode 100644 index 0000000000..194dfa95c0 --- /dev/null +++ b/internal/generated/api_performance_advisor_cmd.go @@ -0,0 +1,336 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type DisableSlowOperationThresholdingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DisableSlowOperationThresholdingOperation + groupId string +} + +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 *DisableSlowOperationThresholdingOpts) Run() error { + params := &atlasv2.DisableSlowOperationThresholdingApiParams{ + GroupId: opts.groupId, + } + _, err := opts.store.DisableSlowOperationThresholding(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const DisableSlowOperationThresholdingTemplate = "<>" + +func DisableSlowOperationThresholdingBuilder() cobra.Command { + opts := DisableSlowOperationThresholdingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DisableSlowOperationThresholdingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type EnableSlowOperationThresholdingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.EnableSlowOperationThresholdingOperation + groupId string +} + +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 *EnableSlowOperationThresholdingOpts) Run() error { + params := &atlasv2.EnableSlowOperationThresholdingApiParams{ + GroupId: opts.groupId, + } + _, err := opts.store.EnableSlowOperationThresholding(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const EnableSlowOperationThresholdingTemplate = "<>" + +func EnableSlowOperationThresholdingBuilder() cobra.Command { + opts := EnableSlowOperationThresholdingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), EnableSlowOperationThresholdingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type ListSlowQueriesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListSlowQueriesOperation + groupId string + processId string + duration int64 + namespaces []string + nLogs int64 + since int64 +} + +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 *ListSlowQueriesOpts) Run() error { + params := &atlasv2.ListSlowQueriesApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + Duration: opts.duration, + Namespaces: opts.namespaces, + NLogs: opts.nLogs, + Since: opts.since, + } + resp, _, err := opts.store.ListSlowQueries(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListSlowQueriesTemplate = "<>" + +func ListSlowQueriesBuilder() cobra.Command { + opts := ListSlowQueriesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListSlowQueriesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.duration, "duration", "", "usage description") + cmd.Flags().StringVar(&opts.namespaces, "namespaces", "", "usage description") + cmd.Flags().StringVar(&opts.nLogs, "nLogs", "", "usage description") + cmd.Flags().StringVar(&opts.since, "since", "", "usage description") + + return cmd +} +type ListSlowQueryNamespacesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListSlowQueryNamespacesOperation + groupId string + processId string + duration int64 + since int64 +} + +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 *ListSlowQueryNamespacesOpts) Run() error { + params := &atlasv2.ListSlowQueryNamespacesApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + Duration: opts.duration, + Since: opts.since, + } + resp, _, err := opts.store.ListSlowQueryNamespaces(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListSlowQueryNamespacesTemplate = "<>" + +func ListSlowQueryNamespacesBuilder() cobra.Command { + opts := ListSlowQueryNamespacesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListSlowQueryNamespacesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.duration, "duration", "", "usage description") + cmd.Flags().StringVar(&opts.since, "since", "", "usage description") + + return cmd +} +type ListSuggestedIndexesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListSuggestedIndexesOperation + groupId string + processId string + includeCount bool + itemsPerPage int32 + pageNum int32 + duration int64 + namespaces []string + nExamples int64 + nIndexes int64 + since int64 +} + +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 *ListSuggestedIndexesOpts) Run() error { + params := &atlasv2.ListSuggestedIndexesApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + Duration: opts.duration, + Namespaces: opts.namespaces, + NExamples: opts.nExamples, + NIndexes: opts.nIndexes, + Since: opts.since, + } + resp, _, err := opts.store.ListSuggestedIndexes(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListSuggestedIndexesTemplate = "<>" + +func ListSuggestedIndexesBuilder() cobra.Command { + opts := ListSuggestedIndexesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListSuggestedIndexesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.duration, "duration", "", "usage description") + cmd.Flags().StringVar(&opts.namespaces, "namespaces", "", "usage description") + cmd.Flags().StringVar(&opts.nExamples, "nExamples", "", "usage description") + cmd.Flags().StringVar(&opts.nIndexes, "nIndexes", "", "usage description") + cmd.Flags().StringVar(&opts.since, "since", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_performance_advisor_store.go b/internal/generated/api_performance_advisor_store.go new file mode 100644 index 0000000000..5317268789 --- /dev/null +++ b/internal/generated/api_performance_advisor_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_performance_advisor_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DisableSlowOperationThresholdingOperation, EnableSlowOperationThresholdingOperation, ListSlowQueriesOperation, ListSlowQueryNamespacesOperation, ListSuggestedIndexesOperation + +type DisableSlowOperationThresholdingOperation interface { + DisableSlowOperationThresholding (*atlasv2.DisableSlowOperationThresholdingApiParams) (, error) +} + +// DisableSlowOperationThresholding encapsulates the logic to manage different cloud providers. +func (s *Store) DisableSlowOperationThresholding(params *atlasv2.DisableSlowOperationThresholdingApiParams) (error) { + _, err := s.clientv2.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(s.ctx, params).Execute() + return err +} + +type EnableSlowOperationThresholdingOperation interface { + EnableSlowOperationThresholding (*atlasv2.EnableSlowOperationThresholdingApiParams) (, error) +} + +// EnableSlowOperationThresholding encapsulates the logic to manage different cloud providers. +func (s *Store) EnableSlowOperationThresholding(params *atlasv2.EnableSlowOperationThresholdingApiParams) (error) { + _, err := s.clientv2.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(s.ctx, params).Execute() + return err +} + +type ListSlowQueriesOperation interface { + ListSlowQueries (*atlasv2.ListSlowQueriesApiParams) (*atlasv2.PerformanceAdvisorSlowQueryList, error) +} + +// ListSlowQueries encapsulates the logic to manage different cloud providers. +func (s *Store) ListSlowQueries(params *atlasv2.ListSlowQueriesApiParams) (*atlasv2.PerformanceAdvisorSlowQueryList, error) { + result, _, err := s.clientv2.PerformanceAdvisorApi.ListSlowQueriesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListSlowQueryNamespacesOperation interface { + ListSlowQueryNamespaces (*atlasv2.ListSlowQueryNamespacesApiParams) (*atlasv2.Namespaces, error) +} + +// ListSlowQueryNamespaces encapsulates the logic to manage different cloud providers. +func (s *Store) ListSlowQueryNamespaces(params *atlasv2.ListSlowQueryNamespacesApiParams) (*atlasv2.Namespaces, error) { + result, _, err := s.clientv2.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListSuggestedIndexesOperation interface { + ListSuggestedIndexes (*atlasv2.ListSuggestedIndexesApiParams) (*atlasv2.PerformanceAdvisorResponse, error) +} + +// ListSuggestedIndexes encapsulates the logic to manage different cloud providers. +func (s *Store) ListSuggestedIndexes(params *atlasv2.ListSuggestedIndexesApiParams) (*atlasv2.PerformanceAdvisorResponse, error) { + result, _, err := s.clientv2.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go new file mode 100644 index 0000000000..e1970312da --- /dev/null +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -0,0 +1,532 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreatePrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreatePrivateEndpointOperation + groupId string + cloudProvider string + endpointServiceId string +} + +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 *CreatePrivateEndpointOpts) Run() error { + params := &atlasv2.CreatePrivateEndpointApiParams{ + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + EndpointServiceId: opts.endpointServiceId, + } + resp, _, err := opts.store.CreatePrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreatePrivateEndpointTemplate = "<>" + +func CreatePrivateEndpointBuilder() cobra.Command { + opts := CreatePrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreatePrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + + return cmd +} +type CreatePrivateEndpointServiceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreatePrivateEndpointServiceOperation + groupId string +} + +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 *CreatePrivateEndpointServiceOpts) Run() error { + params := &atlasv2.CreatePrivateEndpointServiceApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreatePrivateEndpointService(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreatePrivateEndpointServiceTemplate = "<>" + +func CreatePrivateEndpointServiceBuilder() cobra.Command { + opts := CreatePrivateEndpointServiceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreatePrivateEndpointServiceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeletePrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeletePrivateEndpointOperation + groupId string + cloudProvider string + endpointId string + endpointServiceId string +} + +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 *DeletePrivateEndpointOpts) Run() error { + params := &atlasv2.DeletePrivateEndpointApiParams{ + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + EndpointId: opts.endpointId, + EndpointServiceId: opts.endpointServiceId, + } + resp, _, err := opts.store.DeletePrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeletePrivateEndpointTemplate = "<>" + +func DeletePrivateEndpointBuilder() cobra.Command { + opts := DeletePrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeletePrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + + return cmd +} +type DeletePrivateEndpointServiceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeletePrivateEndpointServiceOperation + groupId string + cloudProvider string + endpointServiceId string +} + +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 *DeletePrivateEndpointServiceOpts) Run() error { + params := &atlasv2.DeletePrivateEndpointServiceApiParams{ + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + EndpointServiceId: opts.endpointServiceId, + } + resp, _, err := opts.store.DeletePrivateEndpointService(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeletePrivateEndpointServiceTemplate = "<>" + +func DeletePrivateEndpointServiceBuilder() cobra.Command { + opts := DeletePrivateEndpointServiceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeletePrivateEndpointServiceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + + return cmd +} +type GetPrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetPrivateEndpointOperation + groupId string + cloudProvider string + endpointId string + endpointServiceId string +} + +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 *GetPrivateEndpointOpts) Run() error { + params := &atlasv2.GetPrivateEndpointApiParams{ + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + EndpointId: opts.endpointId, + EndpointServiceId: opts.endpointServiceId, + } + resp, _, err := opts.store.GetPrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetPrivateEndpointTemplate = "<>" + +func GetPrivateEndpointBuilder() cobra.Command { + opts := GetPrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetPrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + + return cmd +} +type GetPrivateEndpointServiceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetPrivateEndpointServiceOperation + groupId string + cloudProvider string + endpointServiceId string +} + +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 *GetPrivateEndpointServiceOpts) Run() error { + params := &atlasv2.GetPrivateEndpointServiceApiParams{ + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + EndpointServiceId: opts.endpointServiceId, + } + resp, _, err := opts.store.GetPrivateEndpointService(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetPrivateEndpointServiceTemplate = "<>" + +func GetPrivateEndpointServiceBuilder() cobra.Command { + opts := GetPrivateEndpointServiceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetPrivateEndpointServiceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + + return cmd +} +type GetRegionalizedPrivateEndpointSettingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetRegionalizedPrivateEndpointSettingOperation + groupId string +} + +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 *GetRegionalizedPrivateEndpointSettingOpts) Run() error { + params := &atlasv2.GetRegionalizedPrivateEndpointSettingApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetRegionalizedPrivateEndpointSetting(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetRegionalizedPrivateEndpointSettingTemplate = "<>" + +func GetRegionalizedPrivateEndpointSettingBuilder() cobra.Command { + opts := GetRegionalizedPrivateEndpointSettingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetRegionalizedPrivateEndpointSettingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type ListPrivateEndpointServicesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListPrivateEndpointServicesOperation + groupId string + cloudProvider string +} + +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 *ListPrivateEndpointServicesOpts) Run() error { + params := &atlasv2.ListPrivateEndpointServicesApiParams{ + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + } + resp, _, err := opts.store.ListPrivateEndpointServices(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListPrivateEndpointServicesTemplate = "<>" + +func ListPrivateEndpointServicesBuilder() cobra.Command { + opts := ListPrivateEndpointServicesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListPrivateEndpointServicesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + + return cmd +} +type ToggleRegionalizedPrivateEndpointSettingOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ToggleRegionalizedPrivateEndpointSettingOperation + groupId string +} + +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 *ToggleRegionalizedPrivateEndpointSettingOpts) Run() error { + params := &atlasv2.ToggleRegionalizedPrivateEndpointSettingApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.ToggleRegionalizedPrivateEndpointSetting(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ToggleRegionalizedPrivateEndpointSettingTemplate = "<>" + +func ToggleRegionalizedPrivateEndpointSettingBuilder() cobra.Command { + opts := ToggleRegionalizedPrivateEndpointSettingOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ToggleRegionalizedPrivateEndpointSettingTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_private_endpoint_services_store.go b/internal/generated/api_private_endpoint_services_store.go new file mode 100644 index 0000000000..6f5327e11f --- /dev/null +++ b/internal/generated/api_private_endpoint_services_store.go @@ -0,0 +1,115 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_private_endpoint_services_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreatePrivateEndpointOperation, CreatePrivateEndpointServiceOperation, DeletePrivateEndpointOperation, DeletePrivateEndpointServiceOperation, GetPrivateEndpointOperation, GetPrivateEndpointServiceOperation, GetRegionalizedPrivateEndpointSettingOperation, ListPrivateEndpointServicesOperation, ToggleRegionalizedPrivateEndpointSettingOperation + +type CreatePrivateEndpointOperation interface { + CreatePrivateEndpoint (*atlasv2.CreatePrivateEndpointApiParams) (*atlasv2.Endpoint, error) +} + +// CreatePrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) CreatePrivateEndpoint(params *atlasv2.CreatePrivateEndpointApiParams) (*atlasv2.Endpoint, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreatePrivateEndpointServiceOperation interface { + CreatePrivateEndpointService (*atlasv2.CreatePrivateEndpointServiceApiParams) (*atlasv2.EndpointService, error) +} + +// CreatePrivateEndpointService encapsulates the logic to manage different cloud providers. +func (s *Store) CreatePrivateEndpointService(params *atlasv2.CreatePrivateEndpointServiceApiParams) (*atlasv2.EndpointService, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeletePrivateEndpointOperation interface { + DeletePrivateEndpoint (*atlasv2.DeletePrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeletePrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) DeletePrivateEndpoint(params *atlasv2.DeletePrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeletePrivateEndpointServiceOperation interface { + DeletePrivateEndpointService (*atlasv2.DeletePrivateEndpointServiceApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeletePrivateEndpointService encapsulates the logic to manage different cloud providers. +func (s *Store) DeletePrivateEndpointService(params *atlasv2.DeletePrivateEndpointServiceApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetPrivateEndpointOperation interface { + GetPrivateEndpoint (*atlasv2.GetPrivateEndpointApiParams) (*atlasv2.Endpoint, error) +} + +// GetPrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) GetPrivateEndpoint(params *atlasv2.GetPrivateEndpointApiParams) (*atlasv2.Endpoint, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetPrivateEndpointServiceOperation interface { + GetPrivateEndpointService (*atlasv2.GetPrivateEndpointServiceApiParams) (*atlasv2.EndpointService, error) +} + +// GetPrivateEndpointService encapsulates the logic to manage different cloud providers. +func (s *Store) GetPrivateEndpointService(params *atlasv2.GetPrivateEndpointServiceApiParams) (*atlasv2.EndpointService, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetRegionalizedPrivateEndpointSettingOperation interface { + GetRegionalizedPrivateEndpointSetting (*atlasv2.GetRegionalizedPrivateEndpointSettingApiParams) (*atlasv2.ProjectSettingItem, error) +} + +// GetRegionalizedPrivateEndpointSetting encapsulates the logic to manage different cloud providers. +func (s *Store) GetRegionalizedPrivateEndpointSetting(params *atlasv2.GetRegionalizedPrivateEndpointSettingApiParams) (*atlasv2.ProjectSettingItem, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSettingWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListPrivateEndpointServicesOperation interface { + ListPrivateEndpointServices (*atlasv2.ListPrivateEndpointServicesApiParams) (*atlasv2.[]EndpointService, error) +} + +// ListPrivateEndpointServices encapsulates the logic to manage different cloud providers. +func (s *Store) ListPrivateEndpointServices(params *atlasv2.ListPrivateEndpointServicesApiParams) (*atlasv2.[]EndpointService, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ToggleRegionalizedPrivateEndpointSettingOperation interface { + ToggleRegionalizedPrivateEndpointSetting (*atlasv2.ToggleRegionalizedPrivateEndpointSettingApiParams) (*atlasv2.ProjectSettingItem, error) +} + +// ToggleRegionalizedPrivateEndpointSetting encapsulates the logic to manage different cloud providers. +func (s *Store) ToggleRegionalizedPrivateEndpointSetting(params *atlasv2.ToggleRegionalizedPrivateEndpointSettingApiParams) (*atlasv2.ProjectSettingItem, error) { + result, _, err := s.clientv2.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go new file mode 100644 index 0000000000..fa9e3a7bc0 --- /dev/null +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -0,0 +1,834 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type AddProjectApiKeyOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.AddProjectApiKeyOperation + groupId string + apiUserId string +} + +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 *AddProjectApiKeyOpts) Run() error { + params := &atlasv2.AddProjectApiKeyApiParams{ + GroupId: opts.groupId, + ApiUserId: opts.apiUserId, + } + resp, _, err := opts.store.AddProjectApiKey(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const AddProjectApiKeyTemplate = "<>" + +func AddProjectApiKeyBuilder() cobra.Command { + opts := AddProjectApiKeyOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), AddProjectApiKeyTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + + return cmd +} +type CreateApiKeyOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateApiKeyOperation + orgId string +} + +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 *CreateApiKeyOpts) Run() error { + params := &atlasv2.CreateApiKeyApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.CreateApiKey(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateApiKeyTemplate = "<>" + +func CreateApiKeyBuilder() cobra.Command { + opts := CreateApiKeyOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateApiKeyTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type CreateApiKeyAccessListOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateApiKeyAccessListOperation + orgId string + apiUserId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *CreateApiKeyAccessListOpts) Run() error { + params := &atlasv2.CreateApiKeyAccessListApiParams{ + OrgId: opts.orgId, + ApiUserId: opts.apiUserId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.CreateApiKeyAccessList(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateApiKeyAccessListTemplate = "<>" + +func CreateApiKeyAccessListBuilder() cobra.Command { + opts := CreateApiKeyAccessListOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateApiKeyAccessListTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type CreateProjectApiKeyOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateProjectApiKeyOperation + groupId string +} + +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 *CreateProjectApiKeyOpts) Run() error { + params := &atlasv2.CreateProjectApiKeyApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateProjectApiKey(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateProjectApiKeyTemplate = "<>" + +func CreateProjectApiKeyBuilder() cobra.Command { + opts := CreateProjectApiKeyOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateProjectApiKeyTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeleteApiKeyOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteApiKeyOperation + orgId string + apiUserId string +} + +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 *DeleteApiKeyOpts) Run() error { + params := &atlasv2.DeleteApiKeyApiParams{ + OrgId: opts.orgId, + ApiUserId: opts.apiUserId, + } + resp, _, err := opts.store.DeleteApiKey(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteApiKeyTemplate = "<>" + +func DeleteApiKeyBuilder() cobra.Command { + opts := DeleteApiKeyOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteApiKeyTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + + return cmd +} +type DeleteApiKeyAccessListEntryOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteApiKeyAccessListEntryOperation + orgId string + apiUserId string + ipAddress string +} + +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 *DeleteApiKeyAccessListEntryOpts) Run() error { + params := &atlasv2.DeleteApiKeyAccessListEntryApiParams{ + OrgId: opts.orgId, + ApiUserId: opts.apiUserId, + IpAddress: opts.ipAddress, + } + resp, _, err := opts.store.DeleteApiKeyAccessListEntry(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteApiKeyAccessListEntryTemplate = "<>" + +func DeleteApiKeyAccessListEntryBuilder() cobra.Command { + opts := DeleteApiKeyAccessListEntryOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteApiKeyAccessListEntryTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") + + return cmd +} +type GetApiKeyOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetApiKeyOperation + orgId string + apiUserId string +} + +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 *GetApiKeyOpts) Run() error { + params := &atlasv2.GetApiKeyApiParams{ + OrgId: opts.orgId, + ApiUserId: opts.apiUserId, + } + resp, _, err := opts.store.GetApiKey(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetApiKeyTemplate = "<>" + +func GetApiKeyBuilder() cobra.Command { + opts := GetApiKeyOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetApiKeyTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + + return cmd +} +type GetApiKeyAccessListOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetApiKeyAccessListOperation + orgId string + ipAddress string + apiUserId string +} + +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 *GetApiKeyAccessListOpts) Run() error { + params := &atlasv2.GetApiKeyAccessListApiParams{ + OrgId: opts.orgId, + IpAddress: opts.ipAddress, + ApiUserId: opts.apiUserId, + } + resp, _, err := opts.store.GetApiKeyAccessList(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetApiKeyAccessListTemplate = "<>" + +func GetApiKeyAccessListBuilder() cobra.Command { + opts := GetApiKeyAccessListOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetApiKeyAccessListTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + + return cmd +} +type ListApiKeyAccessListsEntriesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListApiKeyAccessListsEntriesOperation + orgId string + apiUserId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListApiKeyAccessListsEntriesOpts) Run() error { + params := &atlasv2.ListApiKeyAccessListsEntriesApiParams{ + OrgId: opts.orgId, + ApiUserId: opts.apiUserId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListApiKeyAccessListsEntries(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListApiKeyAccessListsEntriesTemplate = "<>" + +func ListApiKeyAccessListsEntriesBuilder() cobra.Command { + opts := ListApiKeyAccessListsEntriesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListApiKeyAccessListsEntriesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListApiKeysOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListApiKeysOperation + orgId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListApiKeysOpts) Run() error { + params := &atlasv2.ListApiKeysApiParams{ + OrgId: opts.orgId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListApiKeys(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListApiKeysTemplate = "<>" + +func ListApiKeysBuilder() cobra.Command { + opts := ListApiKeysOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListApiKeysTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListProjectApiKeysOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListProjectApiKeysOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListProjectApiKeysOpts) Run() error { + params := &atlasv2.ListProjectApiKeysApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListProjectApiKeys(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListProjectApiKeysTemplate = "<>" + +func ListProjectApiKeysBuilder() cobra.Command { + opts := ListProjectApiKeysOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListProjectApiKeysTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type RemoveProjectApiKeyOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.RemoveProjectApiKeyOperation + groupId string + apiUserId string +} + +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 *RemoveProjectApiKeyOpts) Run() error { + params := &atlasv2.RemoveProjectApiKeyApiParams{ + GroupId: opts.groupId, + ApiUserId: opts.apiUserId, + } + resp, _, err := opts.store.RemoveProjectApiKey(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const RemoveProjectApiKeyTemplate = "<>" + +func RemoveProjectApiKeyBuilder() cobra.Command { + opts := RemoveProjectApiKeyOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), RemoveProjectApiKeyTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + + return cmd +} +type UpdateApiKeyOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateApiKeyOperation + orgId string + apiUserId string +} + +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 *UpdateApiKeyOpts) Run() error { + params := &atlasv2.UpdateApiKeyApiParams{ + OrgId: opts.orgId, + ApiUserId: opts.apiUserId, + } + resp, _, err := opts.store.UpdateApiKey(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateApiKeyTemplate = "<>" + +func UpdateApiKeyBuilder() cobra.Command { + opts := UpdateApiKeyOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateApiKeyTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + + return cmd +} +type UpdateApiKeyRolesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateApiKeyRolesOperation + groupId string + apiUserId string + pageNum int32 + itemsPerPage int32 + includeCount bool +} + +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 *UpdateApiKeyRolesOpts) Run() error { + params := &atlasv2.UpdateApiKeyRolesApiParams{ + GroupId: opts.groupId, + ApiUserId: opts.apiUserId, + PageNum: opts.pageNum, + ItemsPerPage: opts.itemsPerPage, + IncludeCount: opts.includeCount, + } + resp, _, err := opts.store.UpdateApiKeyRoles(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateApiKeyRolesTemplate = "<>" + +func UpdateApiKeyRolesBuilder() cobra.Command { + opts := UpdateApiKeyRolesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateApiKeyRolesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_programmatic_api_keys_store.go b/internal/generated/api_programmatic_api_keys_store.go new file mode 100644 index 0000000000..2a5fec70c1 --- /dev/null +++ b/internal/generated/api_programmatic_api_keys_store.go @@ -0,0 +1,165 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_programmatic_api_keys_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas AddProjectApiKeyOperation, CreateApiKeyOperation, CreateApiKeyAccessListOperation, CreateProjectApiKeyOperation, DeleteApiKeyOperation, DeleteApiKeyAccessListEntryOperation, GetApiKeyOperation, GetApiKeyAccessListOperation, ListApiKeyAccessListsEntriesOperation, ListApiKeysOperation, ListProjectApiKeysOperation, RemoveProjectApiKeyOperation, UpdateApiKeyOperation, UpdateApiKeyRolesOperation + +type AddProjectApiKeyOperation interface { + AddProjectApiKey (*atlasv2.AddProjectApiKeyApiParams) (*atlasv2.ApiUser, error) +} + +// AddProjectApiKey encapsulates the logic to manage different cloud providers. +func (s *Store) AddProjectApiKey(params *atlasv2.AddProjectApiKeyApiParams) (*atlasv2.ApiUser, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateApiKeyOperation interface { + CreateApiKey (*atlasv2.CreateApiKeyApiParams) (*atlasv2.ApiUser, error) +} + +// CreateApiKey encapsulates the logic to manage different cloud providers. +func (s *Store) CreateApiKey(params *atlasv2.CreateApiKeyApiParams) (*atlasv2.ApiUser, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateApiKeyAccessListOperation interface { + CreateApiKeyAccessList (*atlasv2.CreateApiKeyAccessListApiParams) (*atlasv2.UserAccessList, error) +} + +// CreateApiKeyAccessList encapsulates the logic to manage different cloud providers. +func (s *Store) CreateApiKeyAccessList(params *atlasv2.CreateApiKeyAccessListApiParams) (*atlasv2.UserAccessList, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateProjectApiKeyOperation interface { + CreateProjectApiKey (*atlasv2.CreateProjectApiKeyApiParams) (*atlasv2.ApiUser, error) +} + +// CreateProjectApiKey encapsulates the logic to manage different cloud providers. +func (s *Store) CreateProjectApiKey(params *atlasv2.CreateProjectApiKeyApiParams) (*atlasv2.ApiUser, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteApiKeyOperation interface { + DeleteApiKey (*atlasv2.DeleteApiKeyApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteApiKey encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteApiKey(params *atlasv2.DeleteApiKeyApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteApiKeyAccessListEntryOperation interface { + DeleteApiKeyAccessListEntry (*atlasv2.DeleteApiKeyAccessListEntryApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteApiKeyAccessListEntry encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteApiKeyAccessListEntry(params *atlasv2.DeleteApiKeyAccessListEntryApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.DeleteApiKeyAccessListEntryWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetApiKeyOperation interface { + GetApiKey (*atlasv2.GetApiKeyApiParams) (*atlasv2.ApiUser, error) +} + +// GetApiKey encapsulates the logic to manage different cloud providers. +func (s *Store) GetApiKey(params *atlasv2.GetApiKeyApiParams) (*atlasv2.ApiUser, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.GetApiKeyWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetApiKeyAccessListOperation interface { + GetApiKeyAccessList (*atlasv2.GetApiKeyAccessListApiParams) (*atlasv2.UserAccessList, error) +} + +// GetApiKeyAccessList encapsulates the logic to manage different cloud providers. +func (s *Store) GetApiKeyAccessList(params *atlasv2.GetApiKeyAccessListApiParams) (*atlasv2.UserAccessList, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.GetApiKeyAccessListWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListApiKeyAccessListsEntriesOperation interface { + ListApiKeyAccessListsEntries (*atlasv2.ListApiKeyAccessListsEntriesApiParams) (*atlasv2.PaginatedApiUserAccessList, error) +} + +// ListApiKeyAccessListsEntries encapsulates the logic to manage different cloud providers. +func (s *Store) ListApiKeyAccessListsEntries(params *atlasv2.ListApiKeyAccessListsEntriesApiParams) (*atlasv2.PaginatedApiUserAccessList, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListApiKeysOperation interface { + ListApiKeys (*atlasv2.ListApiKeysApiParams) (*atlasv2.PaginatedApiApiUser, error) +} + +// ListApiKeys encapsulates the logic to manage different cloud providers. +func (s *Store) ListApiKeys(params *atlasv2.ListApiKeysApiParams) (*atlasv2.PaginatedApiApiUser, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.ListApiKeysWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListProjectApiKeysOperation interface { + ListProjectApiKeys (*atlasv2.ListProjectApiKeysApiParams) (*atlasv2.PaginatedApiApiUser, error) +} + +// ListProjectApiKeys encapsulates the logic to manage different cloud providers. +func (s *Store) ListProjectApiKeys(params *atlasv2.ListProjectApiKeysApiParams) (*atlasv2.PaginatedApiApiUser, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(s.ctx, params).Execute() + return &result, err +} + +type RemoveProjectApiKeyOperation interface { + RemoveProjectApiKey (*atlasv2.RemoveProjectApiKeyApiParams) (*atlasv2.map[string]interface{}, error) +} + +// RemoveProjectApiKey encapsulates the logic to manage different cloud providers. +func (s *Store) RemoveProjectApiKey(params *atlasv2.RemoveProjectApiKeyApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateApiKeyOperation interface { + UpdateApiKey (*atlasv2.UpdateApiKeyApiParams) (*atlasv2.ApiUser, error) +} + +// UpdateApiKey encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateApiKey(params *atlasv2.UpdateApiKeyApiParams) (*atlasv2.ApiUser, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateApiKeyRolesOperation interface { + UpdateApiKeyRoles (*atlasv2.UpdateApiKeyRolesApiParams) (*atlasv2.ApiUser, error) +} + +// UpdateApiKeyRoles encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateApiKeyRoles(params *atlasv2.UpdateApiKeyRolesApiParams) (*atlasv2.ApiUser, error) { + result, _, err := s.clientv2.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go new file mode 100644 index 0000000000..48b4efd220 --- /dev/null +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -0,0 +1,312 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateProjectIpAccessListOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateProjectIpAccessListOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *CreateProjectIpAccessListOpts) Run() error { + params := &atlasv2.CreateProjectIpAccessListApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.CreateProjectIpAccessList(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateProjectIpAccessListTemplate = "<>" + +func CreateProjectIpAccessListBuilder() cobra.Command { + opts := CreateProjectIpAccessListOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateProjectIpAccessListTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type DeleteProjectIpAccessListOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteProjectIpAccessListOperation + groupId string + entryValue string +} + +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 *DeleteProjectIpAccessListOpts) Run() error { + params := &atlasv2.DeleteProjectIpAccessListApiParams{ + GroupId: opts.groupId, + EntryValue: opts.entryValue, + } + resp, _, err := opts.store.DeleteProjectIpAccessList(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteProjectIpAccessListTemplate = "<>" + +func DeleteProjectIpAccessListBuilder() cobra.Command { + opts := DeleteProjectIpAccessListOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteProjectIpAccessListTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") + + return cmd +} +type GetProjectIpAccessListStatusOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetProjectIpAccessListStatusOperation + groupId string + entryValue string +} + +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 *GetProjectIpAccessListStatusOpts) Run() error { + params := &atlasv2.GetProjectIpAccessListStatusApiParams{ + GroupId: opts.groupId, + EntryValue: opts.entryValue, + } + resp, _, err := opts.store.GetProjectIpAccessListStatus(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetProjectIpAccessListStatusTemplate = "<>" + +func GetProjectIpAccessListStatusBuilder() cobra.Command { + opts := GetProjectIpAccessListStatusOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetProjectIpAccessListStatusTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") + + return cmd +} +type GetProjectIpListOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetProjectIpListOperation + groupId string + entryValue string +} + +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 *GetProjectIpListOpts) Run() error { + params := &atlasv2.GetProjectIpListApiParams{ + GroupId: opts.groupId, + EntryValue: opts.entryValue, + } + resp, _, err := opts.store.GetProjectIpList(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetProjectIpListTemplate = "<>" + +func GetProjectIpListBuilder() cobra.Command { + opts := GetProjectIpListOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetProjectIpListTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") + + return cmd +} +type ListProjectIpAccessListsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListProjectIpAccessListsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListProjectIpAccessListsOpts) Run() error { + params := &atlasv2.ListProjectIpAccessListsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListProjectIpAccessLists(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListProjectIpAccessListsTemplate = "<>" + +func ListProjectIpAccessListsBuilder() cobra.Command { + opts := ListProjectIpAccessListsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListProjectIpAccessListsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_project_ip_access_list_store.go b/internal/generated/api_project_ip_access_list_store.go new file mode 100644 index 0000000000..fb2bba88a3 --- /dev/null +++ b/internal/generated/api_project_ip_access_list_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_project_ip_access_list_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateProjectIpAccessListOperation, DeleteProjectIpAccessListOperation, GetProjectIpAccessListStatusOperation, GetProjectIpListOperation, ListProjectIpAccessListsOperation + +type CreateProjectIpAccessListOperation interface { + CreateProjectIpAccessList (*atlasv2.CreateProjectIpAccessListApiParams) (*atlasv2.PaginatedNetworkAccess, error) +} + +// CreateProjectIpAccessList encapsulates the logic to manage different cloud providers. +func (s *Store) CreateProjectIpAccessList(params *atlasv2.CreateProjectIpAccessListApiParams) (*atlasv2.PaginatedNetworkAccess, error) { + result, _, err := s.clientv2.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteProjectIpAccessListOperation interface { + DeleteProjectIpAccessList (*atlasv2.DeleteProjectIpAccessListApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteProjectIpAccessList encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteProjectIpAccessList(params *atlasv2.DeleteProjectIpAccessListApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetProjectIpAccessListStatusOperation interface { + GetProjectIpAccessListStatus (*atlasv2.GetProjectIpAccessListStatusApiParams) (*atlasv2.NetworkPermissionEntryStatus, error) +} + +// GetProjectIpAccessListStatus encapsulates the logic to manage different cloud providers. +func (s *Store) GetProjectIpAccessListStatus(params *atlasv2.GetProjectIpAccessListStatusApiParams) (*atlasv2.NetworkPermissionEntryStatus, error) { + result, _, err := s.clientv2.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetProjectIpListOperation interface { + GetProjectIpList (*atlasv2.GetProjectIpListApiParams) (*atlasv2.NetworkPermissionEntry, error) +} + +// GetProjectIpList encapsulates the logic to manage different cloud providers. +func (s *Store) GetProjectIpList(params *atlasv2.GetProjectIpListApiParams) (*atlasv2.NetworkPermissionEntry, error) { + result, _, err := s.clientv2.ProjectIPAccessListApi.GetProjectIpListWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListProjectIpAccessListsOperation interface { + ListProjectIpAccessLists (*atlasv2.ListProjectIpAccessListsApiParams) (*atlasv2.PaginatedNetworkAccess, error) +} + +// ListProjectIpAccessLists encapsulates the logic to manage different cloud providers. +func (s *Store) ListProjectIpAccessLists(params *atlasv2.ListProjectIpAccessListsApiParams) (*atlasv2.PaginatedNetworkAccess, error) { + result, _, err := s.clientv2.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go new file mode 100644 index 0000000000..efc5f9932c --- /dev/null +++ b/internal/generated/api_projects_cmd.go @@ -0,0 +1,1110 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateProjectOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateProjectOperation + projectOwnerId string +} + +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 *CreateProjectOpts) Run() error { + params := &atlasv2.CreateProjectApiParams{ + ProjectOwnerId: opts.projectOwnerId, + } + resp, _, err := opts.store.CreateProject(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateProjectTemplate = "<>" + +func CreateProjectBuilder() cobra.Command { + opts := CreateProjectOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateProjectTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", "usage description") + + return cmd +} +type CreateProjectInvitationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateProjectInvitationOperation + groupId string +} + +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 *CreateProjectInvitationOpts) Run() error { + params := &atlasv2.CreateProjectInvitationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateProjectInvitation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateProjectInvitationTemplate = "<>" + +func CreateProjectInvitationBuilder() cobra.Command { + opts := CreateProjectInvitationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateProjectInvitationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeleteProjectOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteProjectOperation + groupId string +} + +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 *DeleteProjectOpts) Run() error { + params := &atlasv2.DeleteProjectApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.DeleteProject(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteProjectTemplate = "<>" + +func DeleteProjectBuilder() cobra.Command { + opts := DeleteProjectOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteProjectTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeleteProjectInvitationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteProjectInvitationOperation + groupId string + invitationId string +} + +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 *DeleteProjectInvitationOpts) Run() error { + params := &atlasv2.DeleteProjectInvitationApiParams{ + GroupId: opts.groupId, + InvitationId: opts.invitationId, + } + resp, _, err := opts.store.DeleteProjectInvitation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteProjectInvitationTemplate = "<>" + +func DeleteProjectInvitationBuilder() cobra.Command { + opts := DeleteProjectInvitationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteProjectInvitationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + + return cmd +} +type DeleteProjectLimitOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteProjectLimitOperation + limitName string + groupId string +} + +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 *DeleteProjectLimitOpts) Run() error { + params := &atlasv2.DeleteProjectLimitApiParams{ + LimitName: opts.limitName, + GroupId: opts.groupId, + } + resp, _, err := opts.store.DeleteProjectLimit(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteProjectLimitTemplate = "<>" + +func DeleteProjectLimitBuilder() cobra.Command { + opts := DeleteProjectLimitOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteProjectLimitTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetProjectOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetProjectOperation + groupId string +} + +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 *GetProjectOpts) Run() error { + params := &atlasv2.GetProjectApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetProject(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetProjectTemplate = "<>" + +func GetProjectBuilder() cobra.Command { + opts := GetProjectOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetProjectTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetProjectByNameOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetProjectByNameOperation + groupName string +} + +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 *GetProjectByNameOpts) Run() error { + params := &atlasv2.GetProjectByNameApiParams{ + GroupName: opts.groupName, + } + resp, _, err := opts.store.GetProjectByName(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetProjectByNameTemplate = "<>" + +func GetProjectByNameBuilder() cobra.Command { + opts := GetProjectByNameOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetProjectByNameTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupName, "groupName", "", "usage description") + + return cmd +} +type GetProjectInvitationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetProjectInvitationOperation + groupId string + invitationId string +} + +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 *GetProjectInvitationOpts) Run() error { + params := &atlasv2.GetProjectInvitationApiParams{ + GroupId: opts.groupId, + InvitationId: opts.invitationId, + } + resp, _, err := opts.store.GetProjectInvitation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetProjectInvitationTemplate = "<>" + +func GetProjectInvitationBuilder() cobra.Command { + opts := GetProjectInvitationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetProjectInvitationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + + return cmd +} +type GetProjectLimitOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetProjectLimitOperation + limitName string + groupId string +} + +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 *GetProjectLimitOpts) Run() error { + params := &atlasv2.GetProjectLimitApiParams{ + LimitName: opts.limitName, + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetProjectLimit(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetProjectLimitTemplate = "<>" + +func GetProjectLimitBuilder() cobra.Command { + opts := GetProjectLimitOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetProjectLimitTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetProjectSettingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetProjectSettingsOperation + groupId string +} + +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 *GetProjectSettingsOpts) Run() error { + params := &atlasv2.GetProjectSettingsApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.GetProjectSettings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetProjectSettingsTemplate = "<>" + +func GetProjectSettingsBuilder() cobra.Command { + opts := GetProjectSettingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetProjectSettingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type ListProjectInvitationsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListProjectInvitationsOperation + groupId string + username string +} + +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 *ListProjectInvitationsOpts) Run() error { + params := &atlasv2.ListProjectInvitationsApiParams{ + GroupId: opts.groupId, + Username: opts.username, + } + resp, _, err := opts.store.ListProjectInvitations(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListProjectInvitationsTemplate = "<>" + +func ListProjectInvitationsBuilder() cobra.Command { + opts := ListProjectInvitationsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListProjectInvitationsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + + return cmd +} +type ListProjectLimitsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListProjectLimitsOperation + groupId string +} + +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 *ListProjectLimitsOpts) Run() error { + params := &atlasv2.ListProjectLimitsApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.ListProjectLimits(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListProjectLimitsTemplate = "<>" + +func ListProjectLimitsBuilder() cobra.Command { + opts := ListProjectLimitsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListProjectLimitsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type ListProjectUsersOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListProjectUsersOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 + flattenTeams bool + includeOrgUsers bool +} + +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 *ListProjectUsersOpts) Run() error { + params := &atlasv2.ListProjectUsersApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + FlattenTeams: opts.flattenTeams, + IncludeOrgUsers: opts.includeOrgUsers, + } + resp, _, err := opts.store.ListProjectUsers(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListProjectUsersTemplate = "<>" + +func ListProjectUsersBuilder() cobra.Command { + opts := ListProjectUsersOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListProjectUsersTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + cmd.Flags().StringVar(&opts.flattenTeams, "flattenTeams", "", "usage description") + cmd.Flags().StringVar(&opts.includeOrgUsers, "includeOrgUsers", "", "usage description") + + return cmd +} +type ListProjectsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListProjectsOperation + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListProjectsOpts) Run() error { + params := &atlasv2.ListProjectsApiParams{ + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListProjects(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListProjectsTemplate = "<>" + +func ListProjectsBuilder() cobra.Command { + opts := ListProjectsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListProjectsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type RemoveProjectUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.RemoveProjectUserOperation + groupId string + userId string +} + +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 *RemoveProjectUserOpts) Run() error { + params := &atlasv2.RemoveProjectUserApiParams{ + GroupId: opts.groupId, + UserId: opts.userId, + } + _, err := opts.store.RemoveProjectUser(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const RemoveProjectUserTemplate = "<>" + +func RemoveProjectUserBuilder() cobra.Command { + opts := RemoveProjectUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), RemoveProjectUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") + + return cmd +} +type SetProjectLimitOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.SetProjectLimitOperation + limitName string + groupId string +} + +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 *SetProjectLimitOpts) Run() error { + params := &atlasv2.SetProjectLimitApiParams{ + LimitName: opts.limitName, + GroupId: opts.groupId, + } + resp, _, err := opts.store.SetProjectLimit(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const SetProjectLimitTemplate = "<>" + +func SetProjectLimitBuilder() cobra.Command { + opts := SetProjectLimitOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), SetProjectLimitTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpdateProjectOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateProjectOperation + groupId string +} + +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 *UpdateProjectOpts) Run() error { + params := &atlasv2.UpdateProjectApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpdateProject(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateProjectTemplate = "<>" + +func UpdateProjectBuilder() cobra.Command { + opts := UpdateProjectOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateProjectTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpdateProjectInvitationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateProjectInvitationOperation + groupId string +} + +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 *UpdateProjectInvitationOpts) Run() error { + params := &atlasv2.UpdateProjectInvitationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpdateProjectInvitation(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateProjectInvitationTemplate = "<>" + +func UpdateProjectInvitationBuilder() cobra.Command { + opts := UpdateProjectInvitationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateProjectInvitationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type UpdateProjectInvitationByIdOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateProjectInvitationByIdOperation + groupId string + invitationId string +} + +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 *UpdateProjectInvitationByIdOpts) Run() error { + params := &atlasv2.UpdateProjectInvitationByIdApiParams{ + GroupId: opts.groupId, + InvitationId: opts.invitationId, + } + resp, _, err := opts.store.UpdateProjectInvitationById(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateProjectInvitationByIdTemplate = "<>" + +func UpdateProjectInvitationByIdBuilder() cobra.Command { + opts := UpdateProjectInvitationByIdOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateProjectInvitationByIdTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + + return cmd +} +type UpdateProjectSettingsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateProjectSettingsOperation + groupId string +} + +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 *UpdateProjectSettingsOpts) Run() error { + params := &atlasv2.UpdateProjectSettingsApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.UpdateProjectSettings(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateProjectSettingsTemplate = "<>" + +func UpdateProjectSettingsBuilder() cobra.Command { + opts := UpdateProjectSettingsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateProjectSettingsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_projects_store.go b/internal/generated/api_projects_store.go new file mode 100644 index 0000000000..3d0735d781 --- /dev/null +++ b/internal/generated/api_projects_store.go @@ -0,0 +1,225 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_projects_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateProjectOperation, CreateProjectInvitationOperation, DeleteProjectOperation, DeleteProjectInvitationOperation, DeleteProjectLimitOperation, GetProjectOperation, GetProjectByNameOperation, GetProjectInvitationOperation, GetProjectLimitOperation, GetProjectSettingsOperation, ListProjectInvitationsOperation, ListProjectLimitsOperation, ListProjectUsersOperation, ListProjectsOperation, RemoveProjectUserOperation, SetProjectLimitOperation, UpdateProjectOperation, UpdateProjectInvitationOperation, UpdateProjectInvitationByIdOperation, UpdateProjectSettingsOperation + +type CreateProjectOperation interface { + CreateProject (*atlasv2.CreateProjectApiParams) (*atlasv2.Group, error) +} + +// CreateProject encapsulates the logic to manage different cloud providers. +func (s *Store) CreateProject(params *atlasv2.CreateProjectApiParams) (*atlasv2.Group, error) { + result, _, err := s.clientv2.ProjectsApi.CreateProjectWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateProjectInvitationOperation interface { + CreateProjectInvitation (*atlasv2.CreateProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) +} + +// CreateProjectInvitation encapsulates the logic to manage different cloud providers. +func (s *Store) CreateProjectInvitation(params *atlasv2.CreateProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) { + result, _, err := s.clientv2.ProjectsApi.CreateProjectInvitationWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteProjectOperation interface { + DeleteProject (*atlasv2.DeleteProjectApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteProject encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteProject(params *atlasv2.DeleteProjectApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ProjectsApi.DeleteProjectWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteProjectInvitationOperation interface { + DeleteProjectInvitation (*atlasv2.DeleteProjectInvitationApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteProjectInvitation encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteProjectInvitation(params *atlasv2.DeleteProjectInvitationApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ProjectsApi.DeleteProjectInvitationWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteProjectLimitOperation interface { + DeleteProjectLimit (*atlasv2.DeleteProjectLimitApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteProjectLimit encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteProjectLimit(params *atlasv2.DeleteProjectLimitApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ProjectsApi.DeleteProjectLimitWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetProjectOperation interface { + GetProject (*atlasv2.GetProjectApiParams) (*atlasv2.Group, error) +} + +// GetProject encapsulates the logic to manage different cloud providers. +func (s *Store) GetProject(params *atlasv2.GetProjectApiParams) (*atlasv2.Group, error) { + result, _, err := s.clientv2.ProjectsApi.GetProjectWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetProjectByNameOperation interface { + GetProjectByName (*atlasv2.GetProjectByNameApiParams) (*atlasv2.Group, error) +} + +// GetProjectByName encapsulates the logic to manage different cloud providers. +func (s *Store) GetProjectByName(params *atlasv2.GetProjectByNameApiParams) (*atlasv2.Group, error) { + result, _, err := s.clientv2.ProjectsApi.GetProjectByNameWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetProjectInvitationOperation interface { + GetProjectInvitation (*atlasv2.GetProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) +} + +// GetProjectInvitation encapsulates the logic to manage different cloud providers. +func (s *Store) GetProjectInvitation(params *atlasv2.GetProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) { + result, _, err := s.clientv2.ProjectsApi.GetProjectInvitationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetProjectLimitOperation interface { + GetProjectLimit (*atlasv2.GetProjectLimitApiParams) (*atlasv2.Limit, error) +} + +// GetProjectLimit encapsulates the logic to manage different cloud providers. +func (s *Store) GetProjectLimit(params *atlasv2.GetProjectLimitApiParams) (*atlasv2.Limit, error) { + result, _, err := s.clientv2.ProjectsApi.GetProjectLimitWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetProjectSettingsOperation interface { + GetProjectSettings (*atlasv2.GetProjectSettingsApiParams) (*atlasv2.GroupSettings, error) +} + +// GetProjectSettings encapsulates the logic to manage different cloud providers. +func (s *Store) GetProjectSettings(params *atlasv2.GetProjectSettingsApiParams) (*atlasv2.GroupSettings, error) { + result, _, err := s.clientv2.ProjectsApi.GetProjectSettingsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListProjectInvitationsOperation interface { + ListProjectInvitations (*atlasv2.ListProjectInvitationsApiParams) (*atlasv2.[]GroupInvitation, error) +} + +// ListProjectInvitations encapsulates the logic to manage different cloud providers. +func (s *Store) ListProjectInvitations(params *atlasv2.ListProjectInvitationsApiParams) (*atlasv2.[]GroupInvitation, error) { + result, _, err := s.clientv2.ProjectsApi.ListProjectInvitationsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListProjectLimitsOperation interface { + ListProjectLimits (*atlasv2.ListProjectLimitsApiParams) (*atlasv2.Limit, error) +} + +// ListProjectLimits encapsulates the logic to manage different cloud providers. +func (s *Store) ListProjectLimits(params *atlasv2.ListProjectLimitsApiParams) (*atlasv2.Limit, error) { + result, _, err := s.clientv2.ProjectsApi.ListProjectLimitsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListProjectUsersOperation interface { + ListProjectUsers (*atlasv2.ListProjectUsersApiParams) (*atlasv2.PaginatedApiAppUser, error) +} + +// ListProjectUsers encapsulates the logic to manage different cloud providers. +func (s *Store) ListProjectUsers(params *atlasv2.ListProjectUsersApiParams) (*atlasv2.PaginatedApiAppUser, error) { + result, _, err := s.clientv2.ProjectsApi.ListProjectUsersWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListProjectsOperation interface { + ListProjects (*atlasv2.ListProjectsApiParams) (*atlasv2.PaginatedAtlasGroup, error) +} + +// ListProjects encapsulates the logic to manage different cloud providers. +func (s *Store) ListProjects(params *atlasv2.ListProjectsApiParams) (*atlasv2.PaginatedAtlasGroup, error) { + result, _, err := s.clientv2.ProjectsApi.ListProjectsWithParams(s.ctx, params).Execute() + return &result, err +} + +type RemoveProjectUserOperation interface { + RemoveProjectUser (*atlasv2.RemoveProjectUserApiParams) (, error) +} + +// RemoveProjectUser encapsulates the logic to manage different cloud providers. +func (s *Store) RemoveProjectUser(params *atlasv2.RemoveProjectUserApiParams) (error) { + _, err := s.clientv2.ProjectsApi.RemoveProjectUserWithParams(s.ctx, params).Execute() + return err +} + +type SetProjectLimitOperation interface { + SetProjectLimit (*atlasv2.SetProjectLimitApiParams) (*atlasv2.Limit, error) +} + +// SetProjectLimit encapsulates the logic to manage different cloud providers. +func (s *Store) SetProjectLimit(params *atlasv2.SetProjectLimitApiParams) (*atlasv2.Limit, error) { + result, _, err := s.clientv2.ProjectsApi.SetProjectLimitWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateProjectOperation interface { + UpdateProject (*atlasv2.UpdateProjectApiParams) (*atlasv2.Group, error) +} + +// UpdateProject encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateProject(params *atlasv2.UpdateProjectApiParams) (*atlasv2.Group, error) { + result, _, err := s.clientv2.ProjectsApi.UpdateProjectWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateProjectInvitationOperation interface { + UpdateProjectInvitation (*atlasv2.UpdateProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) +} + +// UpdateProjectInvitation encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateProjectInvitation(params *atlasv2.UpdateProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) { + result, _, err := s.clientv2.ProjectsApi.UpdateProjectInvitationWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateProjectInvitationByIdOperation interface { + UpdateProjectInvitationById (*atlasv2.UpdateProjectInvitationByIdApiParams) (*atlasv2.GroupInvitation, error) +} + +// UpdateProjectInvitationById encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateProjectInvitationById(params *atlasv2.UpdateProjectInvitationByIdApiParams) (*atlasv2.GroupInvitation, error) { + result, _, err := s.clientv2.ProjectsApi.UpdateProjectInvitationByIdWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateProjectSettingsOperation interface { + UpdateProjectSettings (*atlasv2.UpdateProjectSettingsApiParams) (*atlasv2.GroupSettings, error) +} + +// UpdateProjectSettings encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateProjectSettings(params *atlasv2.UpdateProjectSettingsApiParams) (*atlasv2.GroupSettings, error) { + result, _, err := s.clientv2.ProjectsApi.UpdateProjectSettingsWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go new file mode 100644 index 0000000000..08f7428825 --- /dev/null +++ b/internal/generated/api_rolling_index_cmd.go @@ -0,0 +1,80 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateRollingIndexOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateRollingIndexOperation + groupId string + clusterName string +} + +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 *CreateRollingIndexOpts) Run() error { + params := &atlasv2.CreateRollingIndexApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + _, err := opts.store.CreateRollingIndex(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const CreateRollingIndexTemplate = "<>" + +func CreateRollingIndexBuilder() cobra.Command { + opts := CreateRollingIndexOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateRollingIndexTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_rolling_index_store.go b/internal/generated/api_rolling_index_store.go new file mode 100644 index 0000000000..be18fee4be --- /dev/null +++ b/internal/generated/api_rolling_index_store.go @@ -0,0 +1,35 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_rolling_index_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateRollingIndexOperation + +type CreateRollingIndexOperation interface { + CreateRollingIndex (*atlasv2.CreateRollingIndexApiParams) (, error) +} + +// CreateRollingIndex encapsulates the logic to manage different cloud providers. +func (s *Store) CreateRollingIndex(params *atlasv2.CreateRollingIndexApiParams) (error) { + _, err := s.clientv2.RollingIndexApi.CreateRollingIndexWithParams(s.ctx, params).Execute() + return err +} + diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go new file mode 100644 index 0000000000..807e452e49 --- /dev/null +++ b/internal/generated/api_root_cmd.go @@ -0,0 +1,74 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type GetSystemStatusOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetSystemStatusOperation +} + +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 *GetSystemStatusOpts) Run() error { + params := &atlasv2.GetSystemStatusApiParams{ + } + resp, _, err := opts.store.GetSystemStatus(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetSystemStatusTemplate = "<>" + +func GetSystemStatusBuilder() cobra.Command { + opts := GetSystemStatusOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetSystemStatusTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + + return cmd +} diff --git a/internal/generated/api_root_store.go b/internal/generated/api_root_store.go new file mode 100644 index 0000000000..0b98d53629 --- /dev/null +++ b/internal/generated/api_root_store.go @@ -0,0 +1,35 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_root_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetSystemStatusOperation + +type GetSystemStatusOperation interface { + GetSystemStatus (*atlasv2.GetSystemStatusApiParams) (*atlasv2.SystemStatus, error) +} + +// GetSystemStatus encapsulates the logic to manage different cloud providers. +func (s *Store) GetSystemStatus(params *atlasv2.GetSystemStatusApiParams) (*atlasv2.SystemStatus, error) { + result, _, err := s.clientv2.RootApi.GetSystemStatusWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go new file mode 100644 index 0000000000..d8129a6493 --- /dev/null +++ b/internal/generated/api_serverless_instances_cmd.go @@ -0,0 +1,303 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateServerlessInstanceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateServerlessInstanceOperation + groupId string +} + +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 *CreateServerlessInstanceOpts) Run() error { + params := &atlasv2.CreateServerlessInstanceApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateServerlessInstance(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateServerlessInstanceTemplate = "<>" + +func CreateServerlessInstanceBuilder() cobra.Command { + opts := CreateServerlessInstanceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateServerlessInstanceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type DeleteServerlessInstanceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteServerlessInstanceOperation + groupId string + name string +} + +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 *DeleteServerlessInstanceOpts) Run() error { + params := &atlasv2.DeleteServerlessInstanceApiParams{ + GroupId: opts.groupId, + Name: opts.name, + } + resp, _, err := opts.store.DeleteServerlessInstance(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteServerlessInstanceTemplate = "<>" + +func DeleteServerlessInstanceBuilder() cobra.Command { + opts := DeleteServerlessInstanceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteServerlessInstanceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + + return cmd +} +type GetServerlessInstanceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetServerlessInstanceOperation + groupId string + name string +} + +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 *GetServerlessInstanceOpts) Run() error { + params := &atlasv2.GetServerlessInstanceApiParams{ + GroupId: opts.groupId, + Name: opts.name, + } + resp, _, err := opts.store.GetServerlessInstance(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetServerlessInstanceTemplate = "<>" + +func GetServerlessInstanceBuilder() cobra.Command { + opts := GetServerlessInstanceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetServerlessInstanceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + + return cmd +} +type ListServerlessInstancesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListServerlessInstancesOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListServerlessInstancesOpts) Run() error { + params := &atlasv2.ListServerlessInstancesApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListServerlessInstances(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListServerlessInstancesTemplate = "<>" + +func ListServerlessInstancesBuilder() cobra.Command { + opts := ListServerlessInstancesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListServerlessInstancesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type UpdateServerlessInstanceOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateServerlessInstanceOperation + groupId string + name string +} + +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 *UpdateServerlessInstanceOpts) Run() error { + params := &atlasv2.UpdateServerlessInstanceApiParams{ + GroupId: opts.groupId, + Name: opts.name, + } + resp, _, err := opts.store.UpdateServerlessInstance(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateServerlessInstanceTemplate = "<>" + +func UpdateServerlessInstanceBuilder() cobra.Command { + opts := UpdateServerlessInstanceOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateServerlessInstanceTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_serverless_instances_store.go b/internal/generated/api_serverless_instances_store.go new file mode 100644 index 0000000000..9bdcae116d --- /dev/null +++ b/internal/generated/api_serverless_instances_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_serverless_instances_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateServerlessInstanceOperation, DeleteServerlessInstanceOperation, GetServerlessInstanceOperation, ListServerlessInstancesOperation, UpdateServerlessInstanceOperation + +type CreateServerlessInstanceOperation interface { + CreateServerlessInstance (*atlasv2.CreateServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) +} + +// CreateServerlessInstance encapsulates the logic to manage different cloud providers. +func (s *Store) CreateServerlessInstance(params *atlasv2.CreateServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) { + result, _, err := s.clientv2.ServerlessInstancesApi.CreateServerlessInstanceWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteServerlessInstanceOperation interface { + DeleteServerlessInstance (*atlasv2.DeleteServerlessInstanceApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteServerlessInstance encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteServerlessInstance(params *atlasv2.DeleteServerlessInstanceApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetServerlessInstanceOperation interface { + GetServerlessInstance (*atlasv2.GetServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) +} + +// GetServerlessInstance encapsulates the logic to manage different cloud providers. +func (s *Store) GetServerlessInstance(params *atlasv2.GetServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) { + result, _, err := s.clientv2.ServerlessInstancesApi.GetServerlessInstanceWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListServerlessInstancesOperation interface { + ListServerlessInstances (*atlasv2.ListServerlessInstancesApiParams) (*atlasv2.PaginatedServerlessInstanceDescription, error) +} + +// ListServerlessInstances encapsulates the logic to manage different cloud providers. +func (s *Store) ListServerlessInstances(params *atlasv2.ListServerlessInstancesApiParams) (*atlasv2.PaginatedServerlessInstanceDescription, error) { + result, _, err := s.clientv2.ServerlessInstancesApi.ListServerlessInstancesWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateServerlessInstanceOperation interface { + UpdateServerlessInstance (*atlasv2.UpdateServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) +} + +// UpdateServerlessInstance encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateServerlessInstance(params *atlasv2.UpdateServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) { + result, _, err := s.clientv2.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go new file mode 100644 index 0000000000..ad33ec5b8a --- /dev/null +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -0,0 +1,309 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateServerlessPrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateServerlessPrivateEndpointOperation + groupId string + instanceName string +} + +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 *CreateServerlessPrivateEndpointOpts) Run() error { + params := &atlasv2.CreateServerlessPrivateEndpointApiParams{ + GroupId: opts.groupId, + InstanceName: opts.instanceName, + } + resp, _, err := opts.store.CreateServerlessPrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateServerlessPrivateEndpointTemplate = "<>" + +func CreateServerlessPrivateEndpointBuilder() cobra.Command { + opts := CreateServerlessPrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateServerlessPrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + + return cmd +} +type DeleteServerlessPrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteServerlessPrivateEndpointOperation + groupId string + instanceName string + endpointId string +} + +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 *DeleteServerlessPrivateEndpointOpts) Run() error { + params := &atlasv2.DeleteServerlessPrivateEndpointApiParams{ + GroupId: opts.groupId, + InstanceName: opts.instanceName, + EndpointId: opts.endpointId, + } + resp, _, err := opts.store.DeleteServerlessPrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteServerlessPrivateEndpointTemplate = "<>" + +func DeleteServerlessPrivateEndpointBuilder() cobra.Command { + opts := DeleteServerlessPrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteServerlessPrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + + return cmd +} +type GetServerlessPrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetServerlessPrivateEndpointOperation + groupId string + instanceName string + endpointId string +} + +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 *GetServerlessPrivateEndpointOpts) Run() error { + params := &atlasv2.GetServerlessPrivateEndpointApiParams{ + GroupId: opts.groupId, + InstanceName: opts.instanceName, + EndpointId: opts.endpointId, + } + resp, _, err := opts.store.GetServerlessPrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetServerlessPrivateEndpointTemplate = "<>" + +func GetServerlessPrivateEndpointBuilder() cobra.Command { + opts := GetServerlessPrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetServerlessPrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + + return cmd +} +type ListServerlessPrivateEndpointsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListServerlessPrivateEndpointsOperation + groupId string + instanceName string +} + +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 *ListServerlessPrivateEndpointsOpts) Run() error { + params := &atlasv2.ListServerlessPrivateEndpointsApiParams{ + GroupId: opts.groupId, + InstanceName: opts.instanceName, + } + resp, _, err := opts.store.ListServerlessPrivateEndpoints(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListServerlessPrivateEndpointsTemplate = "<>" + +func ListServerlessPrivateEndpointsBuilder() cobra.Command { + opts := ListServerlessPrivateEndpointsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListServerlessPrivateEndpointsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + + return cmd +} +type UpdateServerlessPrivateEndpointOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateServerlessPrivateEndpointOperation + groupId string + instanceName string + endpointId string +} + +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 *UpdateServerlessPrivateEndpointOpts) Run() error { + params := &atlasv2.UpdateServerlessPrivateEndpointApiParams{ + GroupId: opts.groupId, + InstanceName: opts.instanceName, + EndpointId: opts.endpointId, + } + resp, _, err := opts.store.UpdateServerlessPrivateEndpoint(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateServerlessPrivateEndpointTemplate = "<>" + +func UpdateServerlessPrivateEndpointBuilder() cobra.Command { + opts := UpdateServerlessPrivateEndpointOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateServerlessPrivateEndpointTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_serverless_private_endpoints_store.go b/internal/generated/api_serverless_private_endpoints_store.go new file mode 100644 index 0000000000..180e24dee9 --- /dev/null +++ b/internal/generated/api_serverless_private_endpoints_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_serverless_private_endpoints_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateServerlessPrivateEndpointOperation, DeleteServerlessPrivateEndpointOperation, GetServerlessPrivateEndpointOperation, ListServerlessPrivateEndpointsOperation, UpdateServerlessPrivateEndpointOperation + +type CreateServerlessPrivateEndpointOperation interface { + CreateServerlessPrivateEndpoint (*atlasv2.CreateServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) +} + +// CreateServerlessPrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) CreateServerlessPrivateEndpoint(params *atlasv2.CreateServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) { + result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteServerlessPrivateEndpointOperation interface { + DeleteServerlessPrivateEndpoint (*atlasv2.DeleteServerlessPrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteServerlessPrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteServerlessPrivateEndpoint(params *atlasv2.DeleteServerlessPrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetServerlessPrivateEndpointOperation interface { + GetServerlessPrivateEndpoint (*atlasv2.GetServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) +} + +// GetServerlessPrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) GetServerlessPrivateEndpoint(params *atlasv2.GetServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) { + result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListServerlessPrivateEndpointsOperation interface { + ListServerlessPrivateEndpoints (*atlasv2.ListServerlessPrivateEndpointsApiParams) (*atlasv2.[]ServerlessTenantEndpoint, error) +} + +// ListServerlessPrivateEndpoints encapsulates the logic to manage different cloud providers. +func (s *Store) ListServerlessPrivateEndpoints(params *atlasv2.ListServerlessPrivateEndpointsApiParams) (*atlasv2.[]ServerlessTenantEndpoint, error) { + result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateServerlessPrivateEndpointOperation interface { + UpdateServerlessPrivateEndpoint (*atlasv2.UpdateServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) +} + +// UpdateServerlessPrivateEndpoint encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateServerlessPrivateEndpoint(params *atlasv2.UpdateServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) { + result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go new file mode 100644 index 0000000000..90b3187897 --- /dev/null +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -0,0 +1,193 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateSharedClusterBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateSharedClusterBackupRestoreJobOperation + clusterName string + groupId string +} + +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 *CreateSharedClusterBackupRestoreJobOpts) Run() error { + params := &atlasv2.CreateSharedClusterBackupRestoreJobApiParams{ + ClusterName: opts.clusterName, + GroupId: opts.groupId, + } + resp, _, err := opts.store.CreateSharedClusterBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateSharedClusterBackupRestoreJobTemplate = "<>" + +func CreateSharedClusterBackupRestoreJobBuilder() cobra.Command { + opts := CreateSharedClusterBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateSharedClusterBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetSharedClusterBackupRestoreJobOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetSharedClusterBackupRestoreJobOperation + clusterName string + groupId string + restoreId string +} + +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 *GetSharedClusterBackupRestoreJobOpts) Run() error { + params := &atlasv2.GetSharedClusterBackupRestoreJobApiParams{ + ClusterName: opts.clusterName, + GroupId: opts.groupId, + RestoreId: opts.restoreId, + } + resp, _, err := opts.store.GetSharedClusterBackupRestoreJob(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetSharedClusterBackupRestoreJobTemplate = "<>" + +func GetSharedClusterBackupRestoreJobBuilder() cobra.Command { + opts := GetSharedClusterBackupRestoreJobOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetSharedClusterBackupRestoreJobTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", "usage description") + + return cmd +} +type ListSharedClusterBackupRestoreJobsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListSharedClusterBackupRestoreJobsOperation + clusterName string + groupId string +} + +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 *ListSharedClusterBackupRestoreJobsOpts) Run() error { + params := &atlasv2.ListSharedClusterBackupRestoreJobsApiParams{ + ClusterName: opts.clusterName, + GroupId: opts.groupId, + } + resp, _, err := opts.store.ListSharedClusterBackupRestoreJobs(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListSharedClusterBackupRestoreJobsTemplate = "<>" + +func ListSharedClusterBackupRestoreJobsBuilder() cobra.Command { + opts := ListSharedClusterBackupRestoreJobsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListSharedClusterBackupRestoreJobsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_shared_tier_restore_jobs_store.go b/internal/generated/api_shared_tier_restore_jobs_store.go new file mode 100644 index 0000000000..ee97a4da6a --- /dev/null +++ b/internal/generated/api_shared_tier_restore_jobs_store.go @@ -0,0 +1,55 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_shared_tier_restore_jobs_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateSharedClusterBackupRestoreJobOperation, GetSharedClusterBackupRestoreJobOperation, ListSharedClusterBackupRestoreJobsOperation + +type CreateSharedClusterBackupRestoreJobOperation interface { + CreateSharedClusterBackupRestoreJob (*atlasv2.CreateSharedClusterBackupRestoreJobApiParams) (*atlasv2.TenantRestore, error) +} + +// CreateSharedClusterBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) CreateSharedClusterBackupRestoreJob(params *atlasv2.CreateSharedClusterBackupRestoreJobApiParams) (*atlasv2.TenantRestore, error) { + result, _, err := s.clientv2.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetSharedClusterBackupRestoreJobOperation interface { + GetSharedClusterBackupRestoreJob (*atlasv2.GetSharedClusterBackupRestoreJobApiParams) (*atlasv2.TenantRestore, error) +} + +// GetSharedClusterBackupRestoreJob encapsulates the logic to manage different cloud providers. +func (s *Store) GetSharedClusterBackupRestoreJob(params *atlasv2.GetSharedClusterBackupRestoreJobApiParams) (*atlasv2.TenantRestore, error) { + result, _, err := s.clientv2.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListSharedClusterBackupRestoreJobsOperation interface { + ListSharedClusterBackupRestoreJobs (*atlasv2.ListSharedClusterBackupRestoreJobsApiParams) (*atlasv2.PaginatedTenantRestore, error) +} + +// ListSharedClusterBackupRestoreJobs encapsulates the logic to manage different cloud providers. +func (s *Store) ListSharedClusterBackupRestoreJobs(params *atlasv2.ListSharedClusterBackupRestoreJobsApiParams) (*atlasv2.PaginatedTenantRestore, error) { + result, _, err := s.clientv2.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go new file mode 100644 index 0000000000..d4b7411c3e --- /dev/null +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -0,0 +1,193 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type DownloadSharedClusterBackupOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DownloadSharedClusterBackupOperation + clusterName string + groupId string +} + +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 *DownloadSharedClusterBackupOpts) Run() error { + params := &atlasv2.DownloadSharedClusterBackupApiParams{ + ClusterName: opts.clusterName, + GroupId: opts.groupId, + } + resp, _, err := opts.store.DownloadSharedClusterBackup(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DownloadSharedClusterBackupTemplate = "<>" + +func DownloadSharedClusterBackupBuilder() cobra.Command { + opts := DownloadSharedClusterBackupOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DownloadSharedClusterBackupTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetSharedClusterBackupOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetSharedClusterBackupOperation + groupId string + clusterName string + snapshotId string +} + +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 *GetSharedClusterBackupOpts) Run() error { + params := &atlasv2.GetSharedClusterBackupApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + SnapshotId: opts.snapshotId, + } + resp, _, err := opts.store.GetSharedClusterBackup(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetSharedClusterBackupTemplate = "<>" + +func GetSharedClusterBackupBuilder() cobra.Command { + opts := GetSharedClusterBackupOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetSharedClusterBackupTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + + return cmd +} +type ListSharedClusterBackupsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListSharedClusterBackupsOperation + groupId string + clusterName string +} + +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 *ListSharedClusterBackupsOpts) Run() error { + params := &atlasv2.ListSharedClusterBackupsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.store.ListSharedClusterBackups(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListSharedClusterBackupsTemplate = "<>" + +func ListSharedClusterBackupsBuilder() cobra.Command { + opts := ListSharedClusterBackupsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListSharedClusterBackupsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_shared_tier_snapshots_store.go b/internal/generated/api_shared_tier_snapshots_store.go new file mode 100644 index 0000000000..779912129b --- /dev/null +++ b/internal/generated/api_shared_tier_snapshots_store.go @@ -0,0 +1,55 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_shared_tier_snapshots_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DownloadSharedClusterBackupOperation, GetSharedClusterBackupOperation, ListSharedClusterBackupsOperation + +type DownloadSharedClusterBackupOperation interface { + DownloadSharedClusterBackup (*atlasv2.DownloadSharedClusterBackupApiParams) (*atlasv2.TenantRestore, error) +} + +// DownloadSharedClusterBackup encapsulates the logic to manage different cloud providers. +func (s *Store) DownloadSharedClusterBackup(params *atlasv2.DownloadSharedClusterBackupApiParams) (*atlasv2.TenantRestore, error) { + result, _, err := s.clientv2.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetSharedClusterBackupOperation interface { + GetSharedClusterBackup (*atlasv2.GetSharedClusterBackupApiParams) (*atlasv2.TenantSnapshot, error) +} + +// GetSharedClusterBackup encapsulates the logic to manage different cloud providers. +func (s *Store) GetSharedClusterBackup(params *atlasv2.GetSharedClusterBackupApiParams) (*atlasv2.TenantSnapshot, error) { + result, _, err := s.clientv2.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListSharedClusterBackupsOperation interface { + ListSharedClusterBackups (*atlasv2.ListSharedClusterBackupsApiParams) (*atlasv2.PaginatedTenantSnapshot, error) +} + +// ListSharedClusterBackups encapsulates the logic to manage different cloud providers. +func (s *Store) ListSharedClusterBackups(params *atlasv2.ListSharedClusterBackupsApiParams) (*atlasv2.PaginatedTenantSnapshot, error) { + result, _, err := s.clientv2.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go new file mode 100644 index 0000000000..8e33c8fcc6 --- /dev/null +++ b/internal/generated/api_teams_cmd.go @@ -0,0 +1,755 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type AddAllTeamsToProjectOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.AddAllTeamsToProjectOperation + groupId string +} + +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 *AddAllTeamsToProjectOpts) Run() error { + params := &atlasv2.AddAllTeamsToProjectApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.AddAllTeamsToProject(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const AddAllTeamsToProjectTemplate = "<>" + +func AddAllTeamsToProjectBuilder() cobra.Command { + opts := AddAllTeamsToProjectOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), AddAllTeamsToProjectTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type AddTeamUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.AddTeamUserOperation + orgId string + teamId string +} + +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 *AddTeamUserOpts) Run() error { + params := &atlasv2.AddTeamUserApiParams{ + OrgId: opts.orgId, + TeamId: opts.teamId, + } + resp, _, err := opts.store.AddTeamUser(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const AddTeamUserTemplate = "<>" + +func AddTeamUserBuilder() cobra.Command { + opts := AddTeamUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), AddTeamUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + + return cmd +} +type CreateTeamOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateTeamOperation + orgId string +} + +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 *CreateTeamOpts) Run() error { + params := &atlasv2.CreateTeamApiParams{ + OrgId: opts.orgId, + } + resp, _, err := opts.store.CreateTeam(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateTeamTemplate = "<>" + +func CreateTeamBuilder() cobra.Command { + opts := CreateTeamOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateTeamTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + + return cmd +} +type DeleteTeamOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteTeamOperation + orgId string + teamId string +} + +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 *DeleteTeamOpts) Run() error { + params := &atlasv2.DeleteTeamApiParams{ + OrgId: opts.orgId, + TeamId: opts.teamId, + } + resp, _, err := opts.store.DeleteTeam(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteTeamTemplate = "<>" + +func DeleteTeamBuilder() cobra.Command { + opts := DeleteTeamOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteTeamTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + + return cmd +} +type GetTeamByIdOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetTeamByIdOperation + orgId string + teamId string +} + +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 *GetTeamByIdOpts) Run() error { + params := &atlasv2.GetTeamByIdApiParams{ + OrgId: opts.orgId, + TeamId: opts.teamId, + } + resp, _, err := opts.store.GetTeamById(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetTeamByIdTemplate = "<>" + +func GetTeamByIdBuilder() cobra.Command { + opts := GetTeamByIdOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetTeamByIdTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + + return cmd +} +type GetTeamByNameOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetTeamByNameOperation + orgId string + teamName string +} + +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 *GetTeamByNameOpts) Run() error { + params := &atlasv2.GetTeamByNameApiParams{ + OrgId: opts.orgId, + TeamName: opts.teamName, + } + resp, _, err := opts.store.GetTeamByName(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetTeamByNameTemplate = "<>" + +func GetTeamByNameBuilder() cobra.Command { + opts := GetTeamByNameOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetTeamByNameTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.teamName, "teamName", "", "usage description") + + return cmd +} +type ListOrganizationTeamsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListOrganizationTeamsOperation + orgId string + itemsPerPage int32 + includeCount bool + pageNum int32 +} + +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 *ListOrganizationTeamsOpts) Run() error { + params := &atlasv2.ListOrganizationTeamsApiParams{ + OrgId: opts.orgId, + ItemsPerPage: opts.itemsPerPage, + IncludeCount: opts.includeCount, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListOrganizationTeams(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListOrganizationTeamsTemplate = "<>" + +func ListOrganizationTeamsBuilder() cobra.Command { + opts := ListOrganizationTeamsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListOrganizationTeamsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListProjectTeamsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListProjectTeamsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListProjectTeamsOpts) Run() error { + params := &atlasv2.ListProjectTeamsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListProjectTeams(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListProjectTeamsTemplate = "<>" + +func ListProjectTeamsBuilder() cobra.Command { + opts := ListProjectTeamsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListProjectTeamsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type ListTeamUsersOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListTeamUsersOperation + orgId string + teamId string + itemsPerPage int32 + pageNum int32 +} + +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 *ListTeamUsersOpts) Run() error { + params := &atlasv2.ListTeamUsersApiParams{ + OrgId: opts.orgId, + TeamId: opts.teamId, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListTeamUsers(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListTeamUsersTemplate = "<>" + +func ListTeamUsersBuilder() cobra.Command { + opts := ListTeamUsersOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListTeamUsersTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type RemoveProjectTeamOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.RemoveProjectTeamOperation + groupId string + teamId string +} + +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 *RemoveProjectTeamOpts) Run() error { + params := &atlasv2.RemoveProjectTeamApiParams{ + GroupId: opts.groupId, + TeamId: opts.teamId, + } + resp, _, err := opts.store.RemoveProjectTeam(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const RemoveProjectTeamTemplate = "<>" + +func RemoveProjectTeamBuilder() cobra.Command { + opts := RemoveProjectTeamOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), RemoveProjectTeamTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + + return cmd +} +type RemoveTeamUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.RemoveTeamUserOperation + orgId string + teamId string + userId string +} + +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 *RemoveTeamUserOpts) Run() error { + params := &atlasv2.RemoveTeamUserApiParams{ + OrgId: opts.orgId, + TeamId: opts.teamId, + UserId: opts.userId, + } + _, err := opts.store.RemoveTeamUser(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const RemoveTeamUserTemplate = "<>" + +func RemoveTeamUserBuilder() cobra.Command { + opts := RemoveTeamUserOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), RemoveTeamUserTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") + + return cmd +} +type RenameTeamOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.RenameTeamOperation + orgId string + teamId string +} + +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 *RenameTeamOpts) Run() error { + params := &atlasv2.RenameTeamApiParams{ + OrgId: opts.orgId, + TeamId: opts.teamId, + } + resp, _, err := opts.store.RenameTeam(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const RenameTeamTemplate = "<>" + +func RenameTeamBuilder() cobra.Command { + opts := RenameTeamOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), RenameTeamTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + + return cmd +} +type UpdateTeamRolesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateTeamRolesOperation + groupId string + teamId string +} + +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 *UpdateTeamRolesOpts) Run() error { + params := &atlasv2.UpdateTeamRolesApiParams{ + GroupId: opts.groupId, + TeamId: opts.teamId, + } + resp, _, err := opts.store.UpdateTeamRoles(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateTeamRolesTemplate = "<>" + +func UpdateTeamRolesBuilder() cobra.Command { + opts := UpdateTeamRolesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateTeamRolesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_teams_store.go b/internal/generated/api_teams_store.go new file mode 100644 index 0000000000..3091004613 --- /dev/null +++ b/internal/generated/api_teams_store.go @@ -0,0 +1,155 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_teams_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas AddAllTeamsToProjectOperation, AddTeamUserOperation, CreateTeamOperation, DeleteTeamOperation, GetTeamByIdOperation, GetTeamByNameOperation, ListOrganizationTeamsOperation, ListProjectTeamsOperation, ListTeamUsersOperation, RemoveProjectTeamOperation, RemoveTeamUserOperation, RenameTeamOperation, UpdateTeamRolesOperation + +type AddAllTeamsToProjectOperation interface { + AddAllTeamsToProject (*atlasv2.AddAllTeamsToProjectApiParams) (*atlasv2.PaginatedTeamRole, error) +} + +// AddAllTeamsToProject encapsulates the logic to manage different cloud providers. +func (s *Store) AddAllTeamsToProject(params *atlasv2.AddAllTeamsToProjectApiParams) (*atlasv2.PaginatedTeamRole, error) { + result, _, err := s.clientv2.TeamsApi.AddAllTeamsToProjectWithParams(s.ctx, params).Execute() + return &result, err +} + +type AddTeamUserOperation interface { + AddTeamUser (*atlasv2.AddTeamUserApiParams) (*atlasv2.PaginatedApiAppUser, error) +} + +// AddTeamUser encapsulates the logic to manage different cloud providers. +func (s *Store) AddTeamUser(params *atlasv2.AddTeamUserApiParams) (*atlasv2.PaginatedApiAppUser, error) { + result, _, err := s.clientv2.TeamsApi.AddTeamUserWithParams(s.ctx, params).Execute() + return &result, err +} + +type CreateTeamOperation interface { + CreateTeam (*atlasv2.CreateTeamApiParams) (*atlasv2.Team, error) +} + +// CreateTeam encapsulates the logic to manage different cloud providers. +func (s *Store) CreateTeam(params *atlasv2.CreateTeamApiParams) (*atlasv2.Team, error) { + result, _, err := s.clientv2.TeamsApi.CreateTeamWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteTeamOperation interface { + DeleteTeam (*atlasv2.DeleteTeamApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteTeam encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteTeam(params *atlasv2.DeleteTeamApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.TeamsApi.DeleteTeamWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetTeamByIdOperation interface { + GetTeamById (*atlasv2.GetTeamByIdApiParams) (*atlasv2.TeamResponse, error) +} + +// GetTeamById encapsulates the logic to manage different cloud providers. +func (s *Store) GetTeamById(params *atlasv2.GetTeamByIdApiParams) (*atlasv2.TeamResponse, error) { + result, _, err := s.clientv2.TeamsApi.GetTeamByIdWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetTeamByNameOperation interface { + GetTeamByName (*atlasv2.GetTeamByNameApiParams) (*atlasv2.TeamResponse, error) +} + +// GetTeamByName encapsulates the logic to manage different cloud providers. +func (s *Store) GetTeamByName(params *atlasv2.GetTeamByNameApiParams) (*atlasv2.TeamResponse, error) { + result, _, err := s.clientv2.TeamsApi.GetTeamByNameWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListOrganizationTeamsOperation interface { + ListOrganizationTeams (*atlasv2.ListOrganizationTeamsApiParams) (*atlasv2.PaginatedTeam, error) +} + +// ListOrganizationTeams encapsulates the logic to manage different cloud providers. +func (s *Store) ListOrganizationTeams(params *atlasv2.ListOrganizationTeamsApiParams) (*atlasv2.PaginatedTeam, error) { + result, _, err := s.clientv2.TeamsApi.ListOrganizationTeamsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListProjectTeamsOperation interface { + ListProjectTeams (*atlasv2.ListProjectTeamsApiParams) (*atlasv2.PaginatedTeamRole, error) +} + +// ListProjectTeams encapsulates the logic to manage different cloud providers. +func (s *Store) ListProjectTeams(params *atlasv2.ListProjectTeamsApiParams) (*atlasv2.PaginatedTeamRole, error) { + result, _, err := s.clientv2.TeamsApi.ListProjectTeamsWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListTeamUsersOperation interface { + ListTeamUsers (*atlasv2.ListTeamUsersApiParams) (*atlasv2.PaginatedApiAppUser, error) +} + +// ListTeamUsers encapsulates the logic to manage different cloud providers. +func (s *Store) ListTeamUsers(params *atlasv2.ListTeamUsersApiParams) (*atlasv2.PaginatedApiAppUser, error) { + result, _, err := s.clientv2.TeamsApi.ListTeamUsersWithParams(s.ctx, params).Execute() + return &result, err +} + +type RemoveProjectTeamOperation interface { + RemoveProjectTeam (*atlasv2.RemoveProjectTeamApiParams) (*atlasv2.map[string]interface{}, error) +} + +// RemoveProjectTeam encapsulates the logic to manage different cloud providers. +func (s *Store) RemoveProjectTeam(params *atlasv2.RemoveProjectTeamApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.TeamsApi.RemoveProjectTeamWithParams(s.ctx, params).Execute() + return &result, err +} + +type RemoveTeamUserOperation interface { + RemoveTeamUser (*atlasv2.RemoveTeamUserApiParams) (, error) +} + +// RemoveTeamUser encapsulates the logic to manage different cloud providers. +func (s *Store) RemoveTeamUser(params *atlasv2.RemoveTeamUserApiParams) (error) { + _, err := s.clientv2.TeamsApi.RemoveTeamUserWithParams(s.ctx, params).Execute() + return err +} + +type RenameTeamOperation interface { + RenameTeam (*atlasv2.RenameTeamApiParams) (*atlasv2.TeamResponse, error) +} + +// RenameTeam encapsulates the logic to manage different cloud providers. +func (s *Store) RenameTeam(params *atlasv2.RenameTeamApiParams) (*atlasv2.TeamResponse, error) { + result, _, err := s.clientv2.TeamsApi.RenameTeamWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateTeamRolesOperation interface { + UpdateTeamRoles (*atlasv2.UpdateTeamRolesApiParams) (*atlasv2.PaginatedTeamRole, error) +} + +// UpdateTeamRoles encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateTeamRoles(params *atlasv2.UpdateTeamRolesApiParams) (*atlasv2.PaginatedTeamRole, error) { + result, _, err := s.clientv2.TeamsApi.UpdateTeamRolesWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go new file mode 100644 index 0000000000..ae2d3ae186 --- /dev/null +++ b/internal/generated/api_test__cmd.go @@ -0,0 +1,77 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type VersionedExampleOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.VersionedExampleOperation + additionalInfo bool +} + +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 *VersionedExampleOpts) Run() error { + params := &atlasv2.VersionedExampleApiParams{ + AdditionalInfo: opts.additionalInfo, + } + resp, _, err := opts.store.VersionedExample(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const VersionedExampleTemplate = "<>" + +func VersionedExampleBuilder() cobra.Command { + opts := VersionedExampleOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), VersionedExampleTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.additionalInfo, "additionalInfo", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_test__store.go b/internal/generated/api_test__store.go new file mode 100644 index 0000000000..5bf5542e7a --- /dev/null +++ b/internal/generated/api_test__store.go @@ -0,0 +1,35 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_test__store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas VersionedExampleOperation + +type VersionedExampleOperation interface { + VersionedExample (*atlasv2.VersionedExampleApiParams) (*atlasv2.ExampleResourceResponseView20230201, error) +} + +// VersionedExample encapsulates the logic to manage different cloud providers. +func (s *Store) VersionedExample(params *atlasv2.VersionedExampleApiParams) (*atlasv2.ExampleResourceResponseView20230201, error) { + result, _, err := s.clientv2.TestApi.VersionedExampleWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go new file mode 100644 index 0000000000..721a4663cb --- /dev/null +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -0,0 +1,324 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateThirdPartyIntegrationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateThirdPartyIntegrationOperation + integrationType string + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *CreateThirdPartyIntegrationOpts) Run() error { + params := &atlasv2.CreateThirdPartyIntegrationApiParams{ + IntegrationType: opts.integrationType, + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.CreateThirdPartyIntegration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const CreateThirdPartyIntegrationTemplate = "<>" + +func CreateThirdPartyIntegrationBuilder() cobra.Command { + opts := CreateThirdPartyIntegrationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateThirdPartyIntegrationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type DeleteThirdPartyIntegrationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DeleteThirdPartyIntegrationOperation + integrationType string + groupId string +} + +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 *DeleteThirdPartyIntegrationOpts) Run() error { + params := &atlasv2.DeleteThirdPartyIntegrationApiParams{ + IntegrationType: opts.integrationType, + GroupId: opts.groupId, + } + resp, _, err := opts.store.DeleteThirdPartyIntegration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DeleteThirdPartyIntegrationTemplate = "<>" + +func DeleteThirdPartyIntegrationBuilder() cobra.Command { + opts := DeleteThirdPartyIntegrationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DeleteThirdPartyIntegrationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type GetThirdPartyIntegrationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.GetThirdPartyIntegrationOperation + groupId string + integrationType string +} + +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 *GetThirdPartyIntegrationOpts) Run() error { + params := &atlasv2.GetThirdPartyIntegrationApiParams{ + GroupId: opts.groupId, + IntegrationType: opts.integrationType, + } + resp, _, err := opts.store.GetThirdPartyIntegration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const GetThirdPartyIntegrationTemplate = "<>" + +func GetThirdPartyIntegrationBuilder() cobra.Command { + opts := GetThirdPartyIntegrationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), GetThirdPartyIntegrationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + + return cmd +} +type ListThirdPartyIntegrationsOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListThirdPartyIntegrationsOperation + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListThirdPartyIntegrationsOpts) Run() error { + params := &atlasv2.ListThirdPartyIntegrationsApiParams{ + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListThirdPartyIntegrations(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListThirdPartyIntegrationsTemplate = "<>" + +func ListThirdPartyIntegrationsBuilder() cobra.Command { + opts := ListThirdPartyIntegrationsOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListThirdPartyIntegrationsTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} +type UpdateThirdPartyIntegrationOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.UpdateThirdPartyIntegrationOperation + integrationType string + groupId string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *UpdateThirdPartyIntegrationOpts) Run() error { + params := &atlasv2.UpdateThirdPartyIntegrationApiParams{ + IntegrationType: opts.integrationType, + GroupId: opts.groupId, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.UpdateThirdPartyIntegration(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const UpdateThirdPartyIntegrationTemplate = "<>" + +func UpdateThirdPartyIntegrationBuilder() cobra.Command { + opts := UpdateThirdPartyIntegrationOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), UpdateThirdPartyIntegrationTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_third_party_integrations_store.go b/internal/generated/api_third_party_integrations_store.go new file mode 100644 index 0000000000..3e99f67810 --- /dev/null +++ b/internal/generated/api_third_party_integrations_store.go @@ -0,0 +1,75 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_third_party_integrations_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateThirdPartyIntegrationOperation, DeleteThirdPartyIntegrationOperation, GetThirdPartyIntegrationOperation, ListThirdPartyIntegrationsOperation, UpdateThirdPartyIntegrationOperation + +type CreateThirdPartyIntegrationOperation interface { + CreateThirdPartyIntegration (*atlasv2.CreateThirdPartyIntegrationApiParams) (*atlasv2.PaginatedIntegration, error) +} + +// CreateThirdPartyIntegration encapsulates the logic to manage different cloud providers. +func (s *Store) CreateThirdPartyIntegration(params *atlasv2.CreateThirdPartyIntegrationApiParams) (*atlasv2.PaginatedIntegration, error) { + result, _, err := s.clientv2.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(s.ctx, params).Execute() + return &result, err +} + +type DeleteThirdPartyIntegrationOperation interface { + DeleteThirdPartyIntegration (*atlasv2.DeleteThirdPartyIntegrationApiParams) (*atlasv2.map[string]interface{}, error) +} + +// DeleteThirdPartyIntegration encapsulates the logic to manage different cloud providers. +func (s *Store) DeleteThirdPartyIntegration(params *atlasv2.DeleteThirdPartyIntegrationApiParams) (*atlasv2.map[string]interface{}, error) { + result, _, err := s.clientv2.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(s.ctx, params).Execute() + return &result, err +} + +type GetThirdPartyIntegrationOperation interface { + GetThirdPartyIntegration (*atlasv2.GetThirdPartyIntegrationApiParams) (*atlasv2.Integration, error) +} + +// GetThirdPartyIntegration encapsulates the logic to manage different cloud providers. +func (s *Store) GetThirdPartyIntegration(params *atlasv2.GetThirdPartyIntegrationApiParams) (*atlasv2.Integration, error) { + result, _, err := s.clientv2.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(s.ctx, params).Execute() + return &result, err +} + +type ListThirdPartyIntegrationsOperation interface { + ListThirdPartyIntegrations (*atlasv2.ListThirdPartyIntegrationsApiParams) (*atlasv2.PaginatedIntegration, error) +} + +// ListThirdPartyIntegrations encapsulates the logic to manage different cloud providers. +func (s *Store) ListThirdPartyIntegrations(params *atlasv2.ListThirdPartyIntegrationsApiParams) (*atlasv2.PaginatedIntegration, error) { + result, _, err := s.clientv2.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(s.ctx, params).Execute() + return &result, err +} + +type UpdateThirdPartyIntegrationOperation interface { + UpdateThirdPartyIntegration (*atlasv2.UpdateThirdPartyIntegrationApiParams) (*atlasv2.PaginatedIntegration, error) +} + +// UpdateThirdPartyIntegration encapsulates the logic to manage different cloud providers. +func (s *Store) UpdateThirdPartyIntegration(params *atlasv2.UpdateThirdPartyIntegrationApiParams) (*atlasv2.PaginatedIntegration, error) { + result, _, err := s.clientv2.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go new file mode 100644 index 0000000000..695584d984 --- /dev/null +++ b/internal/generated/api_x509_authentication_cmd.go @@ -0,0 +1,196 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "context" + "github.com/spf13/cobra" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" +) + +type CreateDatabaseUserCertificateOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.CreateDatabaseUserCertificateOperation + groupId string + username string +} + +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 *CreateDatabaseUserCertificateOpts) Run() error { + params := &atlasv2.CreateDatabaseUserCertificateApiParams{ + GroupId: opts.groupId, + Username: opts.username, + } + _, err := opts.store.CreateDatabaseUserCertificate(params) + if err != nil { + return err + } + + return opts.Print(nil) +} + +const CreateDatabaseUserCertificateTemplate = "<>" + +func CreateDatabaseUserCertificateBuilder() cobra.Command { + opts := CreateDatabaseUserCertificateOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), CreateDatabaseUserCertificateTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + + return cmd +} +type DisableCustomerManagedX509Opts struct { + cli.GlobalOpts + cli.OutputOpts + store store.DisableCustomerManagedX509Operation + groupId string +} + +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 *DisableCustomerManagedX509Opts) Run() error { + params := &atlasv2.DisableCustomerManagedX509ApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.store.DisableCustomerManagedX509(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const DisableCustomerManagedX509Template = "<>" + +func DisableCustomerManagedX509Builder() cobra.Command { + opts := DisableCustomerManagedX509Opts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), DisableCustomerManagedX509Template), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + + return cmd +} +type ListDatabaseUserCertificatesOpts struct { + cli.GlobalOpts + cli.OutputOpts + store store.ListDatabaseUserCertificatesOperation + groupId string + username string + includeCount bool + itemsPerPage int32 + pageNum int32 +} + +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 *ListDatabaseUserCertificatesOpts) Run() error { + params := &atlasv2.ListDatabaseUserCertificatesApiParams{ + GroupId: opts.groupId, + Username: opts.username, + IncludeCount: opts.includeCount, + ItemsPerPage: opts.itemsPerPage, + PageNum: opts.pageNum, + } + resp, _, err := opts.store.ListDatabaseUserCertificates(params) + if err != nil { + return err + } + + return opts.Print(resp) +} + +const ListDatabaseUserCertificatesTemplate = "<>" + +func ListDatabaseUserCertificatesBuilder() cobra.Command { + opts := ListDatabaseUserCertificatesOpts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), ListDatabaseUserCertificatesTemplate), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + return cmd +} diff --git a/internal/generated/api_x509_authentication_store.go b/internal/generated/api_x509_authentication_store.go new file mode 100644 index 0000000000..f5787327f3 --- /dev/null +++ b/internal/generated/api_x509_authentication_store.go @@ -0,0 +1,55 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/api_x509_authentication_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateDatabaseUserCertificateOperation, DisableCustomerManagedX509Operation, ListDatabaseUserCertificatesOperation + +type CreateDatabaseUserCertificateOperation interface { + CreateDatabaseUserCertificate (*atlasv2.CreateDatabaseUserCertificateApiParams) (, error) +} + +// CreateDatabaseUserCertificate encapsulates the logic to manage different cloud providers. +func (s *Store) CreateDatabaseUserCertificate(params *atlasv2.CreateDatabaseUserCertificateApiParams) (error) { + _, err := s.clientv2.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(s.ctx, params).Execute() + return err +} + +type DisableCustomerManagedX509Operation interface { + DisableCustomerManagedX509 (*atlasv2.DisableCustomerManagedX509ApiParams) (*atlasv2.UserSecurity, error) +} + +// DisableCustomerManagedX509 encapsulates the logic to manage different cloud providers. +func (s *Store) DisableCustomerManagedX509(params *atlasv2.DisableCustomerManagedX509ApiParams) (*atlasv2.UserSecurity, error) { + result, _, err := s.clientv2.X509AuthenticationApi.DisableCustomerManagedX509WithParams(s.ctx, params).Execute() + return &result, err +} + +type ListDatabaseUserCertificatesOperation interface { + ListDatabaseUserCertificates (*atlasv2.ListDatabaseUserCertificatesApiParams) (*atlasv2.PaginatedUserCert, error) +} + +// ListDatabaseUserCertificates encapsulates the logic to manage different cloud providers. +func (s *Store) ListDatabaseUserCertificates(params *atlasv2.ListDatabaseUserCertificatesApiParams) (*atlasv2.PaginatedUserCert, error) { + result, _, err := s.clientv2.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(s.ctx, params).Execute() + return &result, err +} + diff --git a/tools/openapi-generator/config/.openapi-generator-ignore b/tools/openapi-generator/config/.openapi-generator-ignore new file mode 100644 index 0000000000..925547ae88 --- /dev/null +++ b/tools/openapi-generator/config/.openapi-generator-ignore @@ -0,0 +1,4 @@ +**/* +*.* +!*_cmd.go +!api_*_store.go diff --git a/tools/openapi-generator/config/config.yaml b/tools/openapi-generator/config/config.yaml new file mode 100644 index 0000000000..9bb83ae27d --- /dev/null +++ b/tools/openapi-generator/config/config.yaml @@ -0,0 +1,15 @@ +generatorName: go +gitUserId: mongodb +gitRepoId: mongodb-atlas-cli +gitHost: github.com +templateDir: config/go-templates +isGoSubmodule: true +packageName: generated +inputSpec: https://raw.githubusercontent.com/mongodb/go-client-mongodb-atlas/sdkv2/openapi/atlas-api-transformed.yaml +files: + cmd.mustache: + templateType: API + destinationFilename: _cmd.go + store.mustache: + templateType: API + destinationFilename: _store.go diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache new file mode 100644 index 0000000000..0e51015e74 --- /dev/null +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -0,0 +1,81 @@ +{{>partial_header}} +package {{packageName}} + +import ( + "context" + "github.com/spf13/cobra" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/cli" + store "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/store/atlas" +) + +{{#operations}} +{{#operation}} +type {{operationId}}Opts struct { + cli.GlobalOpts + cli.OutputOpts + store store.{{operationId}}Operation + {{#pathParams}} + {{paramName}} {{{dataType}}} + {{/pathParams}} + {{#queryParams}} + {{paramName}} {{{dataType}}} + {{/queryParams}} +} + +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 *{{operationId}}Opts) Run() error { + params := &atlasv2.{{operationId}}ApiParams{ + {{#pathParams}} + {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}}, + {{/pathParams}} + {{#queryParams}} + {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}}, + {{/queryParams}} + } + {{#returnType}}resp, {{/returnType}}_, err := opts.store.{{operationId}}(params) + if err != nil { + return err + } + + return opts.Print({{#returnType}}resp{{/returnType}}{{^returnType}}nil{{/returnType}}) +} + +const {{operationId}}Template = "<>" + +func {{operationId}}Builder() cobra.Command { + opts := {{operationId}}Opts{} + cmd := &cobra.Command{ + Use: "<>", + Short: "<>", + Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? + // Aliases: []string{"ls"}, + Args: require.NoArgs, + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.ValidateProjectID, + opts.initStore(cmd.Context()), + opts.InitOutput(cmd.OutOrStdout(), {{operationId}}Template), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run() + }, + } + {{#pathParams}} + cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", "", "usage description") + {{/pathParams}} + {{#queryParams}} + cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", "", "usage description") + {{/queryParams}} + + return cmd +} +{{/operation}} +{{/operations}} diff --git a/tools/openapi-generator/config/go-templates/partial_header.mustache b/tools/openapi-generator/config/go-templates/partial_header.mustache new file mode 100644 index 0000000000..87bdd292fd --- /dev/null +++ b/tools/openapi-generator/config/go-templates/partial_header.mustache @@ -0,0 +1,15 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/tools/openapi-generator/config/go-templates/store.mustache b/tools/openapi-generator/config/go-templates/store.mustache new file mode 100644 index 0000000000..b1e324dd99 --- /dev/null +++ b/tools/openapi-generator/config/go-templates/store.mustache @@ -0,0 +1,24 @@ +{{>partial_header}} +package store + +import ( + "context" + atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" +) + +//go:generate mockgen -destination=../../mocks/atlas/{{classFilename}}_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas {{#operations}}{{#operation}}{{operationId}}Operation{{^-last}}, {{/-last}}{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +type {{operationId}}Operation interface { + {{operationId}} (*atlasv2.{{operationId}}ApiParams) ({{#returnType}}*atlasv2.{{{.}}}{{/returnType}}, error) +} + +// {{operationId}} encapsulates the logic to manage different cloud providers. +func (s *Store) {{operationId}}(params *atlasv2.{{operationId}}ApiParams) ({{#returnType}}*atlasv2.{{{.}}}, {{/returnType}}error) { + {{#returnType}}result, {{/returnType}}_, err := s.clientv2.{{classname}}.{{operationId}}WithParams(s.ctx, params).Execute() + return {{#returnType}}&result, {{/returnType}}err +} + +{{/operation}} +{{/operations}} diff --git a/tools/openapi-generator/openapitools.json b/tools/openapi-generator/openapitools.json new file mode 100644 index 0000000000..cd53ff4cad --- /dev/null +++ b/tools/openapi-generator/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "6.6.0" + } +} diff --git a/tools/openapi-generator/package-lock.json b/tools/openapi-generator/package-lock.json new file mode 100644 index 0000000000..c7238e380d --- /dev/null +++ b/tools/openapi-generator/package-lock.json @@ -0,0 +1,2107 @@ +{ + "name": "openapi-generator", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "openapi-generator", + "version": "1.0.0", + "license": "Apache-2.0", + "dependencies": { + "@openapitools/openapi-generator-cli": "^2.6.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.5.tgz", + "integrity": "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==", + "dependencies": { + "regenerator-runtime": "^0.13.11" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@lukeed/csprng": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", + "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@nestjs/axios": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-0.0.8.tgz", + "integrity": "sha512-oJyfR9/h9tVk776il0829xyj3b2e81yTu6HjPraxynwNtMNGqZBHHmAQL24yMB3tVbBM0RvG3eUXH8+pRCGwlg==", + "dependencies": { + "axios": "0.27.2" + }, + "peerDependencies": { + "@nestjs/common": "^7.0.0 || ^8.0.0", + "reflect-metadata": "^0.1.12", + "rxjs": "^6.0.0 || ^7.0.0" + } + }, + "node_modules/@nestjs/common": { + "version": "8.4.7", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-8.4.7.tgz", + "integrity": "sha512-m/YsbcBal+gA5CFrDpqXqsSfylo+DIQrkFY3qhVIltsYRfu8ct8J9pqsTO6OPf3mvqdOpFGrV5sBjoyAzOBvsw==", + "peer": true, + "dependencies": { + "axios": "0.27.2", + "iterare": "1.2.1", + "tslib": "2.4.0", + "uuid": "8.3.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "cache-manager": "*", + "class-transformer": "*", + "class-validator": "*", + "reflect-metadata": "^0.1.12", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "cache-manager": { + "optional": true + }, + "class-transformer": { + "optional": true + }, + "class-validator": { + "optional": true + } + } + }, + "node_modules/@nestjs/common/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "peer": true + }, + "node_modules/@nuxtjs/opencollective": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@nuxtjs/opencollective/-/opencollective-0.3.2.tgz", + "integrity": "sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==", + "dependencies": { + "chalk": "^4.1.0", + "consola": "^2.15.0", + "node-fetch": "^2.6.1" + }, + "bin": { + "opencollective": "bin/opencollective.js" + }, + "engines": { + "node": ">=8.0.0", + "npm": ">=5.0.0" + } + }, + "node_modules/@openapitools/openapi-generator-cli": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.6.0.tgz", + "integrity": "sha512-M/aOpR7G+Y1nMf+ofuar8pGszajgfhs1aSPSijkcr2tHTxKAI3sA3YYcOGbszxaNRKFyvOcDq+KP9pcJvKoCHg==", + "hasInstallScript": true, + "dependencies": { + "@nestjs/axios": "0.0.8", + "@nestjs/common": "9.3.11", + "@nestjs/core": "9.3.11", + "@nuxtjs/opencollective": "0.3.2", + "chalk": "4.1.2", + "commander": "8.3.0", + "compare-versions": "4.1.4", + "concurrently": "6.5.1", + "console.table": "0.10.0", + "fs-extra": "10.1.0", + "glob": "7.1.6", + "inquirer": "8.2.5", + "lodash": "4.17.21", + "reflect-metadata": "0.1.13", + "rxjs": "7.8.0", + "tslib": "2.0.3" + }, + "bin": { + "openapi-generator-cli": "main.js" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/openapi_generator" + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/@nestjs/common": { + "version": "9.3.11", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-9.3.11.tgz", + "integrity": "sha512-IFZ2G/5UKWC2Uo7tJ4SxGed2+aiA+sJyWeWsGTogKVDhq90oxVBToh+uCDeI31HNUpqYGoWmkletfty42zUd8A==", + "dependencies": { + "iterare": "1.2.1", + "tslib": "2.5.0", + "uid": "2.0.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "cache-manager": "<=5", + "class-transformer": "*", + "class-validator": "*", + "reflect-metadata": "^0.1.12", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "cache-manager": { + "optional": true + }, + "class-transformer": { + "optional": true + }, + "class-validator": { + "optional": true + } + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/@nestjs/common/node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/@nestjs/core": { + "version": "9.3.11", + "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-9.3.11.tgz", + "integrity": "sha512-CI27a2JFd5rvvbgkalWqsiwQNhcP4EAG5BUK8usjp29wVp1kx30ghfBT8FLqIgmkRVo65A0IcEnWsxeXMntkxQ==", + "hasInstallScript": true, + "dependencies": { + "@nuxtjs/opencollective": "0.3.2", + "fast-safe-stringify": "2.1.1", + "iterare": "1.2.1", + "path-to-regexp": "3.2.0", + "tslib": "2.5.0", + "uid": "2.0.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "@nestjs/common": "^9.0.0", + "@nestjs/microservices": "^9.0.0", + "@nestjs/platform-express": "^9.0.0", + "@nestjs/websockets": "^9.0.0", + "reflect-metadata": "^0.1.12", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "@nestjs/microservices": { + "optional": true + }, + "@nestjs/platform-express": { + "optional": true + }, + "@nestjs/websockets": { + "optional": true + } + } + }, + "node_modules/@openapitools/openapi-generator-cli/node_modules/@nestjs/core/node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "engines": { + "node": ">= 10" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/compare-versions": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-4.1.4.tgz", + "integrity": "sha512-FemMreK9xNyL8gQevsdRMrvO4lFCkQP7qbuktn1q8ndcNk1+0mz7lgE7b/sNvbhVgY4w6tMN1FDp6aADjqw2rw==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/concurrently": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-6.5.1.tgz", + "integrity": "sha512-FlSwNpGjWQfRwPLXvJ/OgysbBxPkWpiVjy1042b0U7on7S7qwwMIILRj7WTN1mTgqa582bG6NFuScOoh6Zgdag==", + "dependencies": { + "chalk": "^4.1.0", + "date-fns": "^2.16.1", + "lodash": "^4.17.21", + "rxjs": "^6.6.3", + "spawn-command": "^0.0.2-1", + "supports-color": "^8.1.0", + "tree-kill": "^1.2.2", + "yargs": "^16.2.0" + }, + "bin": { + "concurrently": "bin/concurrently.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/concurrently/node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/consola": { + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz", + "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==" + }, + "node_modules/console.table": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/console.table/-/console.table-0.10.0.tgz", + "integrity": "sha512-dPyZofqggxuvSf7WXvNjuRfnsOk1YazkVP8FdxH4tcH2c37wc79/Yl6Bhr7Lsu00KMgy2ql/qCMuNu8xctZM8g==", + "dependencies": { + "easy-table": "1.1.0" + }, + "engines": { + "node": "> 0.10" + } + }, + "node_modules/date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/easy-table": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.1.0.tgz", + "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", + "optionalDependencies": { + "wcwidth": ">=1.0.1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" + }, + "node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/inquirer": { + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.5.tgz", + "integrity": "sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==", + "dependencies": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.5.5", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/iterare": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", + "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, + "node_modules/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-to-regexp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz", + "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/rxjs": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz", + "integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/rxjs/node_modules/tslib": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.2.tgz", + "integrity": "sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/spawn-command": { + "version": "0.0.2-1", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", + "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==" + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/tslib": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", + "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==" + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/uid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.1.tgz", + "integrity": "sha512-PF+1AnZgycpAIEmNtjxGBVmKbZAQguaa4pBUq6KNaGEcpzZ2klCNZLM34tsjp76maN00TttiiUf6zkIBpJQm2A==", + "dependencies": { + "@lukeed/csprng": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "peer": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "engines": { + "node": ">=10" + } + } + }, + "dependencies": { + "@babel/runtime": { + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.5.tgz", + "integrity": "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==", + "requires": { + "regenerator-runtime": "^0.13.11" + } + }, + "@lukeed/csprng": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", + "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==" + }, + "@nestjs/axios": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-0.0.8.tgz", + "integrity": "sha512-oJyfR9/h9tVk776il0829xyj3b2e81yTu6HjPraxynwNtMNGqZBHHmAQL24yMB3tVbBM0RvG3eUXH8+pRCGwlg==", + "requires": { + "axios": "0.27.2" + } + }, + "@nestjs/common": { + "version": "8.4.7", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-8.4.7.tgz", + "integrity": "sha512-m/YsbcBal+gA5CFrDpqXqsSfylo+DIQrkFY3qhVIltsYRfu8ct8J9pqsTO6OPf3mvqdOpFGrV5sBjoyAzOBvsw==", + "peer": true, + "requires": { + "axios": "0.27.2", + "iterare": "1.2.1", + "tslib": "2.4.0", + "uuid": "8.3.2" + }, + "dependencies": { + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "peer": true + } + } + }, + "@nuxtjs/opencollective": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@nuxtjs/opencollective/-/opencollective-0.3.2.tgz", + "integrity": "sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==", + "requires": { + "chalk": "^4.1.0", + "consola": "^2.15.0", + "node-fetch": "^2.6.1" + } + }, + "@openapitools/openapi-generator-cli": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.6.0.tgz", + "integrity": "sha512-M/aOpR7G+Y1nMf+ofuar8pGszajgfhs1aSPSijkcr2tHTxKAI3sA3YYcOGbszxaNRKFyvOcDq+KP9pcJvKoCHg==", + "requires": { + "@nestjs/axios": "0.0.8", + "@nestjs/common": "9.3.11", + "@nestjs/core": "9.3.11", + "@nuxtjs/opencollective": "0.3.2", + "chalk": "4.1.2", + "commander": "8.3.0", + "compare-versions": "4.1.4", + "concurrently": "6.5.1", + "console.table": "0.10.0", + "fs-extra": "10.1.0", + "glob": "7.1.6", + "inquirer": "8.2.5", + "lodash": "4.17.21", + "reflect-metadata": "0.1.13", + "rxjs": "7.8.0", + "tslib": "2.0.3" + }, + "dependencies": { + "@nestjs/common": { + "version": "9.3.11", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-9.3.11.tgz", + "integrity": "sha512-IFZ2G/5UKWC2Uo7tJ4SxGed2+aiA+sJyWeWsGTogKVDhq90oxVBToh+uCDeI31HNUpqYGoWmkletfty42zUd8A==", + "requires": { + "iterare": "1.2.1", + "tslib": "2.5.0", + "uid": "2.0.1" + }, + "dependencies": { + "tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + } + } + }, + "@nestjs/core": { + "version": "9.3.11", + "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-9.3.11.tgz", + "integrity": "sha512-CI27a2JFd5rvvbgkalWqsiwQNhcP4EAG5BUK8usjp29wVp1kx30ghfBT8FLqIgmkRVo65A0IcEnWsxeXMntkxQ==", + "requires": { + "@nuxtjs/opencollective": "0.3.2", + "fast-safe-stringify": "2.1.1", + "iterare": "1.2.1", + "path-to-regexp": "3.2.0", + "tslib": "2.5.0", + "uid": "2.0.1" + }, + "dependencies": { + "tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + } + } + } + } + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "requires": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==" + }, + "cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==" + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + }, + "compare-versions": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-4.1.4.tgz", + "integrity": "sha512-FemMreK9xNyL8gQevsdRMrvO4lFCkQP7qbuktn1q8ndcNk1+0mz7lgE7b/sNvbhVgY4w6tMN1FDp6aADjqw2rw==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "concurrently": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-6.5.1.tgz", + "integrity": "sha512-FlSwNpGjWQfRwPLXvJ/OgysbBxPkWpiVjy1042b0U7on7S7qwwMIILRj7WTN1mTgqa582bG6NFuScOoh6Zgdag==", + "requires": { + "chalk": "^4.1.0", + "date-fns": "^2.16.1", + "lodash": "^4.17.21", + "rxjs": "^6.6.3", + "spawn-command": "^0.0.2-1", + "supports-color": "^8.1.0", + "tree-kill": "^1.2.2", + "yargs": "^16.2.0" + }, + "dependencies": { + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "consola": { + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz", + "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==" + }, + "console.table": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/console.table/-/console.table-0.10.0.tgz", + "integrity": "sha512-dPyZofqggxuvSf7WXvNjuRfnsOk1YazkVP8FdxH4tcH2c37wc79/Yl6Bhr7Lsu00KMgy2ql/qCMuNu8xctZM8g==", + "requires": { + "easy-table": "1.1.0" + } + }, + "date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "requires": { + "@babel/runtime": "^7.21.0" + } + }, + "defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "requires": { + "clone": "^1.0.2" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, + "easy-table": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.1.0.tgz", + "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", + "requires": { + "wcwidth": ">=1.0.1" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" + }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "inquirer": { + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.5.tgz", + "integrity": "sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==", + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.5.5", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6", + "wrap-ansi": "^7.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" + }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==" + }, + "iterare": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", + "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, + "node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "requires": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-to-regexp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz", + "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==" + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + }, + "regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" + }, + "rxjs": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz", + "integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==", + "requires": { + "tslib": "^2.1.0" + }, + "dependencies": { + "tslib": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.2.tgz", + "integrity": "sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==" + } + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "spawn-command": { + "version": "0.0.2-1", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", + "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==" + }, + "tslib": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", + "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==" + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" + }, + "uid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.1.tgz", + "integrity": "sha512-PF+1AnZgycpAIEmNtjxGBVmKbZAQguaa4pBUq6KNaGEcpzZ2klCNZLM34tsjp76maN00TttiiUf6zkIBpJQm2A==", + "requires": { + "@lukeed/csprng": "^1.0.0" + } + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "peer": true + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "requires": { + "defaults": "^1.0.3" + } + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==" + } + } +} diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json new file mode 100644 index 0000000000..196cf2f5f1 --- /dev/null +++ b/tools/openapi-generator/package.json @@ -0,0 +1,24 @@ +{ + "name": "openapi-generator", + "version": "1.0.0", + "description": "OpenAPI Generator for MongoDB Atlas CLI", + "scripts": { + "generate:clear": "rm -rf ../../internal/generated", + "generate:init": "mkdir -p ../../internal/generated && cp ./config/.openapi-generator-ignore ../../internal/generated/.openapi-generator-ignore", + "generate:run": "openapi-generator-cli generate -c './config/config.yaml' -o ../../internal/generated", + "generate": "npm run generate:clear && npm run generate:init && npm run generate:run" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/mongodb/mongodb-atlas-cli.git" + }, + "author": "Filipe C. Menezes ", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/mongodb/mongodb-atlas-cli/issues" + }, + "homepage": "https://github.com/mongodb/mongodb-atlas-cli#readme", + "dependencies": { + "@openapitools/openapi-generator-cli": "^2.6.0" + } +} From 97676e740df83b0653479a879a7f9b0e088cfc6a Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 24 May 2023 15:49:18 +0100 Subject: [PATCH 02/44] fix --- internal/generated/api_alert_configurations_store.go | 2 +- internal/generated/api_cloud_migration_service_store.go | 2 +- internal/generated/api_cloud_provider_access_store.go | 2 +- internal/generated/api_custom_database_roles_store.go | 2 +- internal/generated/api_federated_authentication_store.go | 4 ++-- internal/generated/api_invoices_store.go | 2 +- internal/generated/api_ldap_configuration_store.go | 2 +- internal/generated/api_maintenance_windows__store.go | 4 ++-- internal/generated/api_multi_cloud_clusters_store.go | 4 ++-- internal/generated/api_performance_advisor_store.go | 4 ++-- internal/generated/api_projects_store.go | 2 +- internal/generated/api_rolling_index_store.go | 2 +- internal/generated/api_teams_store.go | 2 +- internal/generated/api_x509_authentication_store.go | 2 +- tools/openapi-generator/config/go-templates/store.mustache | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/generated/api_alert_configurations_store.go b/internal/generated/api_alert_configurations_store.go index 2bcb885b0d..77f24ee1c3 100644 --- a/internal/generated/api_alert_configurations_store.go +++ b/internal/generated/api_alert_configurations_store.go @@ -34,7 +34,7 @@ func (s *Store) CreateAlertConfiguration(params *atlasv2.CreateAlertConfiguratio } type DeleteAlertConfigurationOperation interface { - DeleteAlertConfiguration (*atlasv2.DeleteAlertConfigurationApiParams) (, error) + DeleteAlertConfiguration (*atlasv2.DeleteAlertConfigurationApiParams) error } // DeleteAlertConfiguration encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_cloud_migration_service_store.go b/internal/generated/api_cloud_migration_service_store.go index 69f5e88b64..73dea87626 100644 --- a/internal/generated/api_cloud_migration_service_store.go +++ b/internal/generated/api_cloud_migration_service_store.go @@ -44,7 +44,7 @@ func (s *Store) CreatePushMigration(params *atlasv2.CreatePushMigrationApiParams } type CutoverMigrationOperation interface { - CutoverMigration (*atlasv2.CutoverMigrationApiParams) (, error) + CutoverMigration (*atlasv2.CutoverMigrationApiParams) error } // CutoverMigration encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_cloud_provider_access_store.go b/internal/generated/api_cloud_provider_access_store.go index 5553d5e995..102a063997 100644 --- a/internal/generated/api_cloud_provider_access_store.go +++ b/internal/generated/api_cloud_provider_access_store.go @@ -44,7 +44,7 @@ func (s *Store) CreateCloudProviderAccessRole(params *atlasv2.CreateCloudProvide } type DeauthorizeCloudProviderAccessRoleOperation interface { - DeauthorizeCloudProviderAccessRole (*atlasv2.DeauthorizeCloudProviderAccessRoleApiParams) (, error) + DeauthorizeCloudProviderAccessRole (*atlasv2.DeauthorizeCloudProviderAccessRoleApiParams) error } // DeauthorizeCloudProviderAccessRole encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_custom_database_roles_store.go b/internal/generated/api_custom_database_roles_store.go index b00ebb0e7e..a187743efc 100644 --- a/internal/generated/api_custom_database_roles_store.go +++ b/internal/generated/api_custom_database_roles_store.go @@ -34,7 +34,7 @@ func (s *Store) CreateCustomDatabaseRole(params *atlasv2.CreateCustomDatabaseRol } type DeleteCustomDatabaseRoleOperation interface { - DeleteCustomDatabaseRole (*atlasv2.DeleteCustomDatabaseRoleApiParams) (, error) + DeleteCustomDatabaseRole (*atlasv2.DeleteCustomDatabaseRoleApiParams) error } // DeleteCustomDatabaseRole encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_federated_authentication_store.go b/internal/generated/api_federated_authentication_store.go index b12b17a43f..deeb90f5d9 100644 --- a/internal/generated/api_federated_authentication_store.go +++ b/internal/generated/api_federated_authentication_store.go @@ -34,7 +34,7 @@ func (s *Store) CreateRoleMapping(params *atlasv2.CreateRoleMappingApiParams) (* } type DeleteFederationAppOperation interface { - DeleteFederationApp (*atlasv2.DeleteFederationAppApiParams) (, error) + DeleteFederationApp (*atlasv2.DeleteFederationAppApiParams) error } // DeleteFederationApp encapsulates the logic to manage different cloud providers. @@ -44,7 +44,7 @@ func (s *Store) DeleteFederationApp(params *atlasv2.DeleteFederationAppApiParams } type DeleteRoleMappingOperation interface { - DeleteRoleMapping (*atlasv2.DeleteRoleMappingApiParams) (, error) + DeleteRoleMapping (*atlasv2.DeleteRoleMappingApiParams) error } // DeleteRoleMapping encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_invoices_store.go b/internal/generated/api_invoices_store.go index a48981b9ae..59f4ba65b7 100644 --- a/internal/generated/api_invoices_store.go +++ b/internal/generated/api_invoices_store.go @@ -24,7 +24,7 @@ import ( //go:generate mockgen -destination=../../mocks/atlas/api_invoices_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DownloadInvoiceCSVOperation, GetInvoiceOperation, ListInvoicesOperation, ListPendingInvoicesOperation type DownloadInvoiceCSVOperation interface { - DownloadInvoiceCSV (*atlasv2.DownloadInvoiceCSVApiParams) (, error) + DownloadInvoiceCSV (*atlasv2.DownloadInvoiceCSVApiParams) error } // DownloadInvoiceCSV encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_ldap_configuration_store.go b/internal/generated/api_ldap_configuration_store.go index ead27b8a63..53bb814332 100644 --- a/internal/generated/api_ldap_configuration_store.go +++ b/internal/generated/api_ldap_configuration_store.go @@ -24,7 +24,7 @@ import ( //go:generate mockgen -destination=../../mocks/atlas/api_ldap_configuration_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DeleteLDAPConfigurationOperation, GetLDAPConfigurationOperation, GetLDAPConfigurationStatusOperation, SaveLDAPConfigurationOperation, VerifyLDAPConfigurationOperation type DeleteLDAPConfigurationOperation interface { - DeleteLDAPConfiguration (*atlasv2.DeleteLDAPConfigurationApiParams) (, error) + DeleteLDAPConfiguration (*atlasv2.DeleteLDAPConfigurationApiParams) error } // DeleteLDAPConfiguration encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_maintenance_windows__store.go b/internal/generated/api_maintenance_windows__store.go index 421173054d..8839b87fec 100644 --- a/internal/generated/api_maintenance_windows__store.go +++ b/internal/generated/api_maintenance_windows__store.go @@ -24,7 +24,7 @@ import ( //go:generate mockgen -destination=../../mocks/atlas/api_maintenance_windows__store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DeferMaintenanceWindowOperation, GetMaintenanceWindowOperation, ResetMaintenanceWindowOperation, ToggleMaintenanceAutoDeferOperation, UpdateMaintenanceWindowOperation type DeferMaintenanceWindowOperation interface { - DeferMaintenanceWindow (*atlasv2.DeferMaintenanceWindowApiParams) (, error) + DeferMaintenanceWindow (*atlasv2.DeferMaintenanceWindowApiParams) error } // DeferMaintenanceWindow encapsulates the logic to manage different cloud providers. @@ -54,7 +54,7 @@ func (s *Store) ResetMaintenanceWindow(params *atlasv2.ResetMaintenanceWindowApi } type ToggleMaintenanceAutoDeferOperation interface { - ToggleMaintenanceAutoDefer (*atlasv2.ToggleMaintenanceAutoDeferApiParams) (, error) + ToggleMaintenanceAutoDefer (*atlasv2.ToggleMaintenanceAutoDeferApiParams) error } // ToggleMaintenanceAutoDefer encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_multi_cloud_clusters_store.go b/internal/generated/api_multi_cloud_clusters_store.go index 1f62304653..3bb2183e7a 100644 --- a/internal/generated/api_multi_cloud_clusters_store.go +++ b/internal/generated/api_multi_cloud_clusters_store.go @@ -34,7 +34,7 @@ func (s *Store) CreateCluster(params *atlasv2.CreateClusterApiParams) (*atlasv2. } type DeleteClusterOperation interface { - DeleteCluster (*atlasv2.DeleteClusterApiParams) (, error) + DeleteCluster (*atlasv2.DeleteClusterApiParams) error } // DeleteCluster encapsulates the logic to manage different cloud providers. @@ -64,7 +64,7 @@ func (s *Store) ListClusters(params *atlasv2.ListClustersApiParams) (*atlasv2.Pa } type TestFailoverOperation interface { - TestFailover (*atlasv2.TestFailoverApiParams) (, error) + TestFailover (*atlasv2.TestFailoverApiParams) error } // TestFailover encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_performance_advisor_store.go b/internal/generated/api_performance_advisor_store.go index 5317268789..64a8844891 100644 --- a/internal/generated/api_performance_advisor_store.go +++ b/internal/generated/api_performance_advisor_store.go @@ -24,7 +24,7 @@ import ( //go:generate mockgen -destination=../../mocks/atlas/api_performance_advisor_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DisableSlowOperationThresholdingOperation, EnableSlowOperationThresholdingOperation, ListSlowQueriesOperation, ListSlowQueryNamespacesOperation, ListSuggestedIndexesOperation type DisableSlowOperationThresholdingOperation interface { - DisableSlowOperationThresholding (*atlasv2.DisableSlowOperationThresholdingApiParams) (, error) + DisableSlowOperationThresholding (*atlasv2.DisableSlowOperationThresholdingApiParams) error } // DisableSlowOperationThresholding encapsulates the logic to manage different cloud providers. @@ -34,7 +34,7 @@ func (s *Store) DisableSlowOperationThresholding(params *atlasv2.DisableSlowOper } type EnableSlowOperationThresholdingOperation interface { - EnableSlowOperationThresholding (*atlasv2.EnableSlowOperationThresholdingApiParams) (, error) + EnableSlowOperationThresholding (*atlasv2.EnableSlowOperationThresholdingApiParams) error } // EnableSlowOperationThresholding encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_projects_store.go b/internal/generated/api_projects_store.go index 3d0735d781..31f5ea208d 100644 --- a/internal/generated/api_projects_store.go +++ b/internal/generated/api_projects_store.go @@ -164,7 +164,7 @@ func (s *Store) ListProjects(params *atlasv2.ListProjectsApiParams) (*atlasv2.Pa } type RemoveProjectUserOperation interface { - RemoveProjectUser (*atlasv2.RemoveProjectUserApiParams) (, error) + RemoveProjectUser (*atlasv2.RemoveProjectUserApiParams) error } // RemoveProjectUser encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_rolling_index_store.go b/internal/generated/api_rolling_index_store.go index be18fee4be..ace301a825 100644 --- a/internal/generated/api_rolling_index_store.go +++ b/internal/generated/api_rolling_index_store.go @@ -24,7 +24,7 @@ import ( //go:generate mockgen -destination=../../mocks/atlas/api_rolling_index_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateRollingIndexOperation type CreateRollingIndexOperation interface { - CreateRollingIndex (*atlasv2.CreateRollingIndexApiParams) (, error) + CreateRollingIndex (*atlasv2.CreateRollingIndexApiParams) error } // CreateRollingIndex encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_teams_store.go b/internal/generated/api_teams_store.go index 3091004613..bb8b81af44 100644 --- a/internal/generated/api_teams_store.go +++ b/internal/generated/api_teams_store.go @@ -124,7 +124,7 @@ func (s *Store) RemoveProjectTeam(params *atlasv2.RemoveProjectTeamApiParams) (* } type RemoveTeamUserOperation interface { - RemoveTeamUser (*atlasv2.RemoveTeamUserApiParams) (, error) + RemoveTeamUser (*atlasv2.RemoveTeamUserApiParams) error } // RemoveTeamUser encapsulates the logic to manage different cloud providers. diff --git a/internal/generated/api_x509_authentication_store.go b/internal/generated/api_x509_authentication_store.go index f5787327f3..d0ad587c62 100644 --- a/internal/generated/api_x509_authentication_store.go +++ b/internal/generated/api_x509_authentication_store.go @@ -24,7 +24,7 @@ import ( //go:generate mockgen -destination=../../mocks/atlas/api_x509_authentication_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateDatabaseUserCertificateOperation, DisableCustomerManagedX509Operation, ListDatabaseUserCertificatesOperation type CreateDatabaseUserCertificateOperation interface { - CreateDatabaseUserCertificate (*atlasv2.CreateDatabaseUserCertificateApiParams) (, error) + CreateDatabaseUserCertificate (*atlasv2.CreateDatabaseUserCertificateApiParams) error } // CreateDatabaseUserCertificate encapsulates the logic to manage different cloud providers. diff --git a/tools/openapi-generator/config/go-templates/store.mustache b/tools/openapi-generator/config/go-templates/store.mustache index b1e324dd99..44578edd0a 100644 --- a/tools/openapi-generator/config/go-templates/store.mustache +++ b/tools/openapi-generator/config/go-templates/store.mustache @@ -11,7 +11,7 @@ import ( {{#operations}} {{#operation}} type {{operationId}}Operation interface { - {{operationId}} (*atlasv2.{{operationId}}ApiParams) ({{#returnType}}*atlasv2.{{{.}}}{{/returnType}}, error) + {{operationId}} (*atlasv2.{{operationId}}ApiParams) {{#returnType}}(*atlasv2.{{{.}}}, {{/returnType}}error{{#returnType}}){{/returnType}} } // {{operationId}} encapsulates the logic to manage different cloud providers. From d1fdfec9e38d81892f5e38fd1e7b84452bedba46 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 25 May 2023 11:00:18 +0100 Subject: [PATCH 03/44] add make command --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 34e87db8c6..5b9893261e 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,13 @@ addcopy: @scripts/add-copy.sh .PHONY: generate -generate: gen-docs gen-mocks gen-code ## Generate docs, mocks, code, all auto generated assets +generate: gen-docs gen-mocks gen-code gen-openapi ## Generate docs, mocks, code, all auto generated assets + +.PHONY: gen-openapi +gen-openapi: ## Generate openapi code + @echo "==> Generating openapi code" + cd tools/openapi-generator; \ + npm run generate .PHONY: gen-code gen-code: ## Generate code From 34464d33626899735df551d886d3dc4e53adb998 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 25 May 2023 11:28:54 +0100 Subject: [PATCH 04/44] add npm install --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 5b9893261e..a5a6f7146a 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,7 @@ generate: gen-docs gen-mocks gen-code gen-openapi ## Generate docs, mocks, code, gen-openapi: ## Generate openapi code @echo "==> Generating openapi code" cd tools/openapi-generator; \ + npm install; \ npm run generate .PHONY: gen-code From c4ad6ef7d91a168a016f2961b0f642eff42a60de Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Tue, 30 May 2023 18:27:40 +0100 Subject: [PATCH 05/44] remove store and add generated.go --- internal/generated/.openapi-generator-ignore | 2 +- internal/generated/.openapi-generator/FILES | 46 +- internal/generated/api_access_tracking_cmd.go | 42 +- .../generated/api_access_tracking_store.go | 45 -- .../generated/api_alert_configurations_cmd.go | 158 ++--- .../api_alert_configurations_store.go | 105 ---- internal/generated/api_alerts_cmd.go | 81 +-- internal/generated/api_alerts_store.go | 65 -- internal/generated/api_atlas_search_cmd.go | 107 ++-- internal/generated/api_atlas_search_store.go | 75 --- internal/generated/api_auditing_cmd.go | 40 +- internal/generated/api_auditing_store.go | 45 -- .../generated/api_aws_clusters_dns_cmd.go | 40 +- .../generated/api_aws_clusters_dns_store.go | 45 -- internal/generated/api_cloud_backups_cmd.go | 588 ++++++++++-------- internal/generated/api_cloud_backups_store.go | 315 ---------- .../api_cloud_migration_service_cmd.go | 157 ++--- .../api_cloud_migration_service_store.go | 105 ---- .../api_cloud_provider_access_cmd.go | 101 +-- .../api_cloud_provider_access_store.go | 75 --- .../api_cluster_outage_simulation_cmd.go | 62 +- .../api_cluster_outage_simulation_store.go | 55 -- internal/generated/api_clusters_cmd.go | 177 +++--- internal/generated/api_clusters_store.go | 115 ---- .../api_custom_database_roles_cmd.go | 100 +-- .../api_custom_database_roles_store.go | 75 --- internal/generated/api_data_federation_cmd.go | 281 +++++---- .../generated/api_data_federation_store.go | 165 ----- .../generated/api_data_lake_pipelines_cmd.go | 262 ++++---- .../api_data_lake_pipelines_store.go | 155 ----- internal/generated/api_database_users_cmd.go | 103 +-- .../generated/api_database_users_store.go | 75 --- ..._rest_using_customer_key_management_cmd.go | 40 +- ...est_using_customer_key_management_store.go | 45 -- internal/generated/api_events_cmd.go | 80 +-- internal/generated/api_events_store.go | 65 -- .../api_federated_authentication_cmd.go | 301 +++++---- .../api_federated_authentication_store.go | 175 ------ internal/generated/api_global_clusters_cmd.go | 102 +-- .../generated/api_global_clusters_store.go | 75 --- internal/generated/api_invoices_cmd.go | 80 +-- internal/generated/api_invoices_store.go | 65 -- .../generated/api_ldap_configuration_cmd.go | 98 +-- .../generated/api_ldap_configuration_store.go | 75 --- internal/generated/api_legacy_backup_cmd.go | 207 +++--- .../api_legacy_backup_restore_jobs_cmd.go | 22 +- .../api_legacy_backup_restore_jobs_store.go | 35 -- internal/generated/api_legacy_backup_store.go | 125 ---- .../generated/api_maintenance_windows__cmd.go | 97 +-- .../api_maintenance_windows__store.go | 75 --- .../generated/api_mongo_db_cloud_users_cmd.go | 58 +- .../api_mongo_db_cloud_users_store.go | 55 -- .../generated/api_monitoring_and_logs_cmd.go | 291 +++++---- .../api_monitoring_and_logs_store.go | 165 ----- .../generated/api_multi_cloud_clusters_cmd.go | 120 ++-- .../api_multi_cloud_clusters_store.go | 85 --- internal/generated/api_network_peering_cmd.go | 255 ++++---- .../generated/api_network_peering_store.go | 155 ----- internal/generated/api_online_archive_cmd.go | 125 ++-- .../generated/api_online_archive_store.go | 85 --- internal/generated/api_organizations_cmd.go | 288 +++++---- internal/generated/api_organizations_store.go | 175 ------ .../generated/api_performance_advisor_cmd.go | 100 +-- .../api_performance_advisor_store.go | 75 --- .../api_private_endpoint_services_cmd.go | 186 +++--- .../api_private_endpoint_services_store.go | 115 ---- .../api_programmatic_api_keys_cmd.go | 280 +++++---- .../api_programmatic_api_keys_store.go | 165 ----- .../api_project_ip_access_list_cmd.go | 100 +-- .../api_project_ip_access_list_store.go | 75 --- internal/generated/api_projects_cmd.go | 387 ++++++------ internal/generated/api_projects_store.go | 225 ------- internal/generated/api_rolling_index_cmd.go | 22 +- internal/generated/api_rolling_index_store.go | 35 -- internal/generated/api_root_cmd.go | 20 +- internal/generated/api_root_store.go | 35 -- .../generated/api_serverless_instances_cmd.go | 100 +-- .../api_serverless_instances_store.go | 75 --- .../api_serverless_private_endpoints_cmd.go | 105 ++-- .../api_serverless_private_endpoints_store.go | 75 --- .../api_shared_tier_restore_jobs_cmd.go | 63 +- .../api_shared_tier_restore_jobs_store.go | 55 -- .../api_shared_tier_snapshots_cmd.go | 63 +- .../api_shared_tier_snapshots_store.go | 55 -- internal/generated/api_teams_cmd.go | 259 ++++---- internal/generated/api_teams_store.go | 155 ----- internal/generated/api_test__cmd.go | 20 +- internal/generated/api_test__store.go | 35 -- .../api_third_party_integrations_cmd.go | 101 +-- .../api_third_party_integrations_store.go | 75 --- .../generated/api_x509_authentication_cmd.go | 61 +- .../api_x509_authentication_store.go | 55 -- internal/generated/generated.go | 122 ++++ .../config/.openapi-generator-ignore | 2 +- tools/openapi-generator/config/config.yaml | 6 +- .../config/go-templates/cmd.mustache | 21 +- .../config/go-templates/generated.mustache | 107 ++++ .../config/go-templates/store.mustache | 24 - 98 files changed, 3696 insertions(+), 7239 deletions(-) delete mode 100644 internal/generated/api_access_tracking_store.go delete mode 100644 internal/generated/api_alert_configurations_store.go delete mode 100644 internal/generated/api_alerts_store.go delete mode 100644 internal/generated/api_atlas_search_store.go delete mode 100644 internal/generated/api_auditing_store.go delete mode 100644 internal/generated/api_aws_clusters_dns_store.go delete mode 100644 internal/generated/api_cloud_backups_store.go delete mode 100644 internal/generated/api_cloud_migration_service_store.go delete mode 100644 internal/generated/api_cloud_provider_access_store.go delete mode 100644 internal/generated/api_cluster_outage_simulation_store.go delete mode 100644 internal/generated/api_clusters_store.go delete mode 100644 internal/generated/api_custom_database_roles_store.go delete mode 100644 internal/generated/api_data_federation_store.go delete mode 100644 internal/generated/api_data_lake_pipelines_store.go delete mode 100644 internal/generated/api_database_users_store.go delete mode 100644 internal/generated/api_encryption_at_rest_using_customer_key_management_store.go delete mode 100644 internal/generated/api_events_store.go delete mode 100644 internal/generated/api_federated_authentication_store.go delete mode 100644 internal/generated/api_global_clusters_store.go delete mode 100644 internal/generated/api_invoices_store.go delete mode 100644 internal/generated/api_ldap_configuration_store.go delete mode 100644 internal/generated/api_legacy_backup_restore_jobs_store.go delete mode 100644 internal/generated/api_legacy_backup_store.go delete mode 100644 internal/generated/api_maintenance_windows__store.go delete mode 100644 internal/generated/api_mongo_db_cloud_users_store.go delete mode 100644 internal/generated/api_monitoring_and_logs_store.go delete mode 100644 internal/generated/api_multi_cloud_clusters_store.go delete mode 100644 internal/generated/api_network_peering_store.go delete mode 100644 internal/generated/api_online_archive_store.go delete mode 100644 internal/generated/api_organizations_store.go delete mode 100644 internal/generated/api_performance_advisor_store.go delete mode 100644 internal/generated/api_private_endpoint_services_store.go delete mode 100644 internal/generated/api_programmatic_api_keys_store.go delete mode 100644 internal/generated/api_project_ip_access_list_store.go delete mode 100644 internal/generated/api_projects_store.go delete mode 100644 internal/generated/api_rolling_index_store.go delete mode 100644 internal/generated/api_root_store.go delete mode 100644 internal/generated/api_serverless_instances_store.go delete mode 100644 internal/generated/api_serverless_private_endpoints_store.go delete mode 100644 internal/generated/api_shared_tier_restore_jobs_store.go delete mode 100644 internal/generated/api_shared_tier_snapshots_store.go delete mode 100644 internal/generated/api_teams_store.go delete mode 100644 internal/generated/api_test__store.go delete mode 100644 internal/generated/api_third_party_integrations_store.go delete mode 100644 internal/generated/api_x509_authentication_store.go create mode 100644 internal/generated/generated.go create mode 100644 tools/openapi-generator/config/go-templates/generated.mustache delete mode 100644 tools/openapi-generator/config/go-templates/store.mustache diff --git a/internal/generated/.openapi-generator-ignore b/internal/generated/.openapi-generator-ignore index 925547ae88..dec4d922ad 100644 --- a/internal/generated/.openapi-generator-ignore +++ b/internal/generated/.openapi-generator-ignore @@ -1,4 +1,4 @@ **/* *.* !*_cmd.go -!api_*_store.go +!generated.go diff --git a/internal/generated/.openapi-generator/FILES b/internal/generated/.openapi-generator/FILES index 4251fca3c0..436a91abb9 100644 --- a/internal/generated/.openapi-generator/FILES +++ b/internal/generated/.openapi-generator/FILES @@ -1,90 +1,46 @@ api_access_tracking_cmd.go -api_access_tracking_store.go api_alert_configurations_cmd.go -api_alert_configurations_store.go api_alerts_cmd.go -api_alerts_store.go api_atlas_search_cmd.go -api_atlas_search_store.go api_auditing_cmd.go -api_auditing_store.go api_aws_clusters_dns_cmd.go -api_aws_clusters_dns_store.go api_cloud_backups_cmd.go -api_cloud_backups_store.go api_cloud_migration_service_cmd.go -api_cloud_migration_service_store.go api_cloud_provider_access_cmd.go -api_cloud_provider_access_store.go api_cluster_outage_simulation_cmd.go -api_cluster_outage_simulation_store.go api_clusters_cmd.go -api_clusters_store.go api_custom_database_roles_cmd.go -api_custom_database_roles_store.go api_data_federation_cmd.go -api_data_federation_store.go api_data_lake_pipelines_cmd.go -api_data_lake_pipelines_store.go api_database_users_cmd.go -api_database_users_store.go api_encryption_at_rest_using_customer_key_management_cmd.go -api_encryption_at_rest_using_customer_key_management_store.go api_events_cmd.go -api_events_store.go api_federated_authentication_cmd.go -api_federated_authentication_store.go api_global_clusters_cmd.go -api_global_clusters_store.go api_invoices_cmd.go -api_invoices_store.go api_ldap_configuration_cmd.go -api_ldap_configuration_store.go api_legacy_backup_cmd.go api_legacy_backup_restore_jobs_cmd.go -api_legacy_backup_restore_jobs_store.go -api_legacy_backup_store.go api_maintenance_windows__cmd.go -api_maintenance_windows__store.go api_mongo_db_cloud_users_cmd.go -api_mongo_db_cloud_users_store.go api_monitoring_and_logs_cmd.go -api_monitoring_and_logs_store.go api_multi_cloud_clusters_cmd.go -api_multi_cloud_clusters_store.go api_network_peering_cmd.go -api_network_peering_store.go api_online_archive_cmd.go -api_online_archive_store.go api_organizations_cmd.go -api_organizations_store.go api_performance_advisor_cmd.go -api_performance_advisor_store.go api_private_endpoint_services_cmd.go -api_private_endpoint_services_store.go api_programmatic_api_keys_cmd.go -api_programmatic_api_keys_store.go api_project_ip_access_list_cmd.go -api_project_ip_access_list_store.go api_projects_cmd.go -api_projects_store.go api_rolling_index_cmd.go -api_rolling_index_store.go api_root_cmd.go -api_root_store.go api_serverless_instances_cmd.go -api_serverless_instances_store.go api_serverless_private_endpoints_cmd.go -api_serverless_private_endpoints_store.go api_shared_tier_restore_jobs_cmd.go -api_shared_tier_restore_jobs_store.go api_shared_tier_snapshots_cmd.go -api_shared_tier_snapshots_store.go api_teams_cmd.go -api_teams_store.go api_test__cmd.go -api_test__store.go api_third_party_integrations_cmd.go -api_third_party_integrations_store.go api_x509_authentication_cmd.go -api_x509_authentication_store.go +generated.go diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index e9b52f893b..e189fd5c1d 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -19,14 +19,14 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type ListAccessLogsByClusterNameOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAccessLogsByClusterNameOperation + client admin.APIClient groupId string clusterName string authResult bool @@ -36,16 +36,16 @@ type ListAccessLogsByClusterNameOpts struct { start int64 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAccessLogsByClusterNameOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAccessLogsByClusterNameOpts) Run() error { - params := &atlasv2.ListAccessLogsByClusterNameApiParams{ +func (opts *ListAccessLogsByClusterNameOpts) Run(ctx context.Context) error { + params := &admin.ListAccessLogsByClusterNameApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, AuthResult: opts.authResult, @@ -54,7 +54,7 @@ func (opts *ListAccessLogsByClusterNameOpts) Run() error { NLogs: opts.nLogs, Start: opts.start, } - resp, _, err := opts.store.ListAccessLogsByClusterName(params) + resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(ctx, params) if err != nil { return err } @@ -74,17 +74,19 @@ func ListAccessLogsByClusterNameBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAccessLogsByClusterNameTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.authResult, "authResult", "", "usage description") cmd.Flags().StringVar(&opts.end, "end", "", "usage description") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") @@ -96,7 +98,7 @@ func ListAccessLogsByClusterNameBuilder() cobra.Command { type ListAccessLogsByHostnameOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAccessLogsByHostnameOperation + client admin.APIClient groupId string hostname string authResult bool @@ -106,16 +108,16 @@ type ListAccessLogsByHostnameOpts struct { start int64 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAccessLogsByHostnameOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAccessLogsByHostnameOpts) Run() error { - params := &atlasv2.ListAccessLogsByHostnameApiParams{ +func (opts *ListAccessLogsByHostnameOpts) Run(ctx context.Context) error { + params := &admin.ListAccessLogsByHostnameApiParams{ GroupId: opts.groupId, Hostname: opts.hostname, AuthResult: opts.authResult, @@ -124,7 +126,7 @@ func (opts *ListAccessLogsByHostnameOpts) Run() error { NLogs: opts.nLogs, Start: opts.start, } - resp, _, err := opts.store.ListAccessLogsByHostname(params) + resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByHostnameWithParams(ctx, params) if err != nil { return err } @@ -144,17 +146,19 @@ func ListAccessLogsByHostnameBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAccessLogsByHostnameTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.hostname, "hostname", "", "usage description") + _ = cmd.MarkFlagRequired("hostname") cmd.Flags().StringVar(&opts.authResult, "authResult", "", "usage description") cmd.Flags().StringVar(&opts.end, "end", "", "usage description") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") diff --git a/internal/generated/api_access_tracking_store.go b/internal/generated/api_access_tracking_store.go deleted file mode 100644 index 02a1e60cb9..0000000000 --- a/internal/generated/api_access_tracking_store.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_access_tracking_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas ListAccessLogsByClusterNameOperation, ListAccessLogsByHostnameOperation - -type ListAccessLogsByClusterNameOperation interface { - ListAccessLogsByClusterName (*atlasv2.ListAccessLogsByClusterNameApiParams) (*atlasv2.MongoDBAccessLogsList, error) -} - -// ListAccessLogsByClusterName encapsulates the logic to manage different cloud providers. -func (s *Store) ListAccessLogsByClusterName(params *atlasv2.ListAccessLogsByClusterNameApiParams) (*atlasv2.MongoDBAccessLogsList, error) { - result, _, err := s.clientv2.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListAccessLogsByHostnameOperation interface { - ListAccessLogsByHostname (*atlasv2.ListAccessLogsByHostnameApiParams) (*atlasv2.MongoDBAccessLogsList, error) -} - -// ListAccessLogsByHostname encapsulates the logic to manage different cloud providers. -func (s *Store) ListAccessLogsByHostname(params *atlasv2.ListAccessLogsByHostnameApiParams) (*atlasv2.MongoDBAccessLogsList, error) { - result, _, err := s.clientv2.AccessTrackingApi.ListAccessLogsByHostnameWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 3ee9480df6..297e2b00ec 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateAlertConfigurationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateAlertConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateAlertConfigurationOpts) Run() error { - params := &atlasv2.CreateAlertConfigurationApiParams{ +func (opts *CreateAlertConfigurationOpts) Run(ctx context.Context) error { + params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateAlertConfiguration(params) + resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params) if err != nil { return err } @@ -62,41 +62,42 @@ func CreateAlertConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateAlertConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeleteAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteAlertConfigurationOperation + client admin.APIClient groupId string alertConfigId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteAlertConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteAlertConfigurationOpts) Run() error { - params := &atlasv2.DeleteAlertConfigurationApiParams{ +func (opts *DeleteAlertConfigurationOpts) Run(ctx context.Context) error { + params := &admin.DeleteAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - _, err := opts.store.DeleteAlertConfiguration(params) + _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params) if err != nil { return err } @@ -116,42 +117,44 @@ func DeleteAlertConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteAlertConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + _ = cmd.MarkFlagRequired("alertConfigId") return cmd } type GetAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetAlertConfigurationOperation + client admin.APIClient groupId string alertConfigId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetAlertConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetAlertConfigurationOpts) Run() error { - params := &atlasv2.GetAlertConfigurationApiParams{ +func (opts *GetAlertConfigurationOpts) Run(ctx context.Context) error { + params := &admin.GetAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - resp, _, err := opts.store.GetAlertConfiguration(params) + resp, _, err := opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params) if err != nil { return err } @@ -171,38 +174,40 @@ func GetAlertConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetAlertConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + _ = cmd.MarkFlagRequired("alertConfigId") return cmd } type ListAlertConfigurationMatchersFieldNamesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAlertConfigurationMatchersFieldNamesOperation + client admin.APIClient } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAlertConfigurationMatchersFieldNamesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAlertConfigurationMatchersFieldNamesOpts) Run() error { - params := &atlasv2.ListAlertConfigurationMatchersFieldNamesApiParams{ +func (opts *ListAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Context) error { + params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{ } - resp, _, err := opts.store.ListAlertConfigurationMatchersFieldNames(params) + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params) if err != nil { return err } @@ -222,13 +227,13 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationMatchersFieldNamesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } @@ -237,29 +242,29 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() cobra.Command { type ListAlertConfigurationsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAlertConfigurationsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAlertConfigurationsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAlertConfigurationsOpts) Run() error { - params := &atlasv2.ListAlertConfigurationsApiParams{ +func (opts *ListAlertConfigurationsOpts) Run(ctx context.Context) error { + params := &admin.ListAlertConfigurationsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListAlertConfigurations(params) + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params) if err != nil { return err } @@ -279,16 +284,17 @@ func ListAlertConfigurationsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -298,7 +304,7 @@ func ListAlertConfigurationsBuilder() cobra.Command { type ListAlertConfigurationsByAlertIdOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAlertConfigurationsByAlertIdOperation + client admin.APIClient groupId string alertId string includeCount bool @@ -306,23 +312,23 @@ type ListAlertConfigurationsByAlertIdOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAlertConfigurationsByAlertIdOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAlertConfigurationsByAlertIdOpts) Run() error { - params := &atlasv2.ListAlertConfigurationsByAlertIdApiParams{ +func (opts *ListAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error { + params := &admin.ListAlertConfigurationsByAlertIdApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListAlertConfigurationsByAlertId(params) + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params) if err != nil { return err } @@ -342,17 +348,19 @@ func ListAlertConfigurationsByAlertIdBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationsByAlertIdTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") + _ = cmd.MarkFlagRequired("alertId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -362,25 +370,25 @@ func ListAlertConfigurationsByAlertIdBuilder() cobra.Command { type ToggleAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ToggleAlertConfigurationOperation + client admin.APIClient groupId string alertConfigId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ToggleAlertConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ToggleAlertConfigurationOpts) Run() error { - params := &atlasv2.ToggleAlertConfigurationApiParams{ +func (opts *ToggleAlertConfigurationOpts) Run(ctx context.Context) error { + params := &admin.ToggleAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - resp, _, err := opts.store.ToggleAlertConfiguration(params) + resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params) if err != nil { return err } @@ -400,42 +408,44 @@ func ToggleAlertConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ToggleAlertConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + _ = cmd.MarkFlagRequired("alertConfigId") return cmd } type UpdateAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateAlertConfigurationOperation + client admin.APIClient groupId string alertConfigId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateAlertConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateAlertConfigurationOpts) Run() error { - params := &atlasv2.UpdateAlertConfigurationApiParams{ +func (opts *UpdateAlertConfigurationOpts) Run(ctx context.Context) error { + params := &admin.UpdateAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - resp, _, err := opts.store.UpdateAlertConfiguration(params) + resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params) if err != nil { return err } @@ -455,17 +465,19 @@ func UpdateAlertConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateAlertConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + _ = cmd.MarkFlagRequired("alertConfigId") return cmd } diff --git a/internal/generated/api_alert_configurations_store.go b/internal/generated/api_alert_configurations_store.go deleted file mode 100644 index 77f24ee1c3..0000000000 --- a/internal/generated/api_alert_configurations_store.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_alert_configurations_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateAlertConfigurationOperation, DeleteAlertConfigurationOperation, GetAlertConfigurationOperation, ListAlertConfigurationMatchersFieldNamesOperation, ListAlertConfigurationsOperation, ListAlertConfigurationsByAlertIdOperation, ToggleAlertConfigurationOperation, UpdateAlertConfigurationOperation - -type CreateAlertConfigurationOperation interface { - CreateAlertConfiguration (*atlasv2.CreateAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) -} - -// CreateAlertConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) CreateAlertConfiguration(params *atlasv2.CreateAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) { - result, _, err := s.clientv2.AlertConfigurationsApi.CreateAlertConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteAlertConfigurationOperation interface { - DeleteAlertConfiguration (*atlasv2.DeleteAlertConfigurationApiParams) error -} - -// DeleteAlertConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteAlertConfiguration(params *atlasv2.DeleteAlertConfigurationApiParams) (error) { - _, err := s.clientv2.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(s.ctx, params).Execute() - return err -} - -type GetAlertConfigurationOperation interface { - GetAlertConfiguration (*atlasv2.GetAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) -} - -// GetAlertConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) GetAlertConfiguration(params *atlasv2.GetAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) { - result, _, err := s.clientv2.AlertConfigurationsApi.GetAlertConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListAlertConfigurationMatchersFieldNamesOperation interface { - ListAlertConfigurationMatchersFieldNames (*atlasv2.ListAlertConfigurationMatchersFieldNamesApiParams) (*atlasv2.[]MatcherField, error) -} - -// ListAlertConfigurationMatchersFieldNames encapsulates the logic to manage different cloud providers. -func (s *Store) ListAlertConfigurationMatchersFieldNames(params *atlasv2.ListAlertConfigurationMatchersFieldNamesApiParams) (*atlasv2.[]MatcherField, error) { - result, _, err := s.clientv2.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListAlertConfigurationsOperation interface { - ListAlertConfigurations (*atlasv2.ListAlertConfigurationsApiParams) (*atlasv2.PaginatedAlertConfig, error) -} - -// ListAlertConfigurations encapsulates the logic to manage different cloud providers. -func (s *Store) ListAlertConfigurations(params *atlasv2.ListAlertConfigurationsApiParams) (*atlasv2.PaginatedAlertConfig, error) { - result, _, err := s.clientv2.AlertConfigurationsApi.ListAlertConfigurationsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListAlertConfigurationsByAlertIdOperation interface { - ListAlertConfigurationsByAlertId (*atlasv2.ListAlertConfigurationsByAlertIdApiParams) (*atlasv2.PaginatedAlertConfig, error) -} - -// ListAlertConfigurationsByAlertId encapsulates the logic to manage different cloud providers. -func (s *Store) ListAlertConfigurationsByAlertId(params *atlasv2.ListAlertConfigurationsByAlertIdApiParams) (*atlasv2.PaginatedAlertConfig, error) { - result, _, err := s.clientv2.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(s.ctx, params).Execute() - return &result, err -} - -type ToggleAlertConfigurationOperation interface { - ToggleAlertConfiguration (*atlasv2.ToggleAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) -} - -// ToggleAlertConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) ToggleAlertConfiguration(params *atlasv2.ToggleAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) { - result, _, err := s.clientv2.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateAlertConfigurationOperation interface { - UpdateAlertConfiguration (*atlasv2.UpdateAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) -} - -// UpdateAlertConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateAlertConfiguration(params *atlasv2.UpdateAlertConfigurationApiParams) (*atlasv2.AlertConfigViewForNdsGroup, error) { - result, _, err := s.clientv2.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index e2d43fc776..9f5b532ceb 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type AcknowledgeAlertOpts struct { cli.GlobalOpts cli.OutputOpts - store store.AcknowledgeAlertOperation + client admin.APIClient groupId string alertId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *AcknowledgeAlertOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *AcknowledgeAlertOpts) Run() error { - params := &atlasv2.AcknowledgeAlertApiParams{ +func (opts *AcknowledgeAlertOpts) Run(ctx context.Context) error { + params := &admin.AcknowledgeAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, } - resp, _, err := opts.store.AcknowledgeAlert(params) + resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params) if err != nil { return err } @@ -64,42 +64,44 @@ func AcknowledgeAlertBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), AcknowledgeAlertTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") + _ = cmd.MarkFlagRequired("alertId") return cmd } type GetAlertOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetAlertOperation + client admin.APIClient groupId string alertId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetAlertOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetAlertOpts) Run() error { - params := &atlasv2.GetAlertApiParams{ +func (opts *GetAlertOpts) Run(ctx context.Context) error { + params := &admin.GetAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, } - resp, _, err := opts.store.GetAlert(params) + resp, _, err := opts.client.AlertsApi.GetAlertWithParams(ctx, params) if err != nil { return err } @@ -119,24 +121,26 @@ func GetAlertBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetAlertTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") + _ = cmd.MarkFlagRequired("alertId") return cmd } type ListAlertsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAlertsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -144,23 +148,23 @@ type ListAlertsOpts struct { status string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAlertsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAlertsOpts) Run() error { - params := &atlasv2.ListAlertsApiParams{ +func (opts *ListAlertsOpts) Run(ctx context.Context) error { + params := &admin.ListAlertsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, Status: opts.status, } - resp, _, err := opts.store.ListAlerts(params) + resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params) if err != nil { return err } @@ -180,16 +184,17 @@ func ListAlertsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAlertsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -200,7 +205,7 @@ func ListAlertsBuilder() cobra.Command { type ListAlertsByAlertConfigurationIdOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAlertsByAlertConfigurationIdOperation + client admin.APIClient groupId string alertConfigId string includeCount bool @@ -208,23 +213,23 @@ type ListAlertsByAlertConfigurationIdOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAlertsByAlertConfigurationIdOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAlertsByAlertConfigurationIdOpts) Run() error { - params := &atlasv2.ListAlertsByAlertConfigurationIdApiParams{ +func (opts *ListAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error { + params := &admin.ListAlertsByAlertConfigurationIdApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListAlertsByAlertConfigurationId(params) + resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params) if err != nil { return err } @@ -244,17 +249,19 @@ func ListAlertsByAlertConfigurationIdBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAlertsByAlertConfigurationIdTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") + _ = cmd.MarkFlagRequired("alertConfigId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") diff --git a/internal/generated/api_alerts_store.go b/internal/generated/api_alerts_store.go deleted file mode 100644 index 0f5a7f95d2..0000000000 --- a/internal/generated/api_alerts_store.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_alerts_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas AcknowledgeAlertOperation, GetAlertOperation, ListAlertsOperation, ListAlertsByAlertConfigurationIdOperation - -type AcknowledgeAlertOperation interface { - AcknowledgeAlert (*atlasv2.AcknowledgeAlertApiParams) (*atlasv2.AlertViewForNdsGroup, error) -} - -// AcknowledgeAlert encapsulates the logic to manage different cloud providers. -func (s *Store) AcknowledgeAlert(params *atlasv2.AcknowledgeAlertApiParams) (*atlasv2.AlertViewForNdsGroup, error) { - result, _, err := s.clientv2.AlertsApi.AcknowledgeAlertWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetAlertOperation interface { - GetAlert (*atlasv2.GetAlertApiParams) (*atlasv2.AlertViewForNdsGroup, error) -} - -// GetAlert encapsulates the logic to manage different cloud providers. -func (s *Store) GetAlert(params *atlasv2.GetAlertApiParams) (*atlasv2.AlertViewForNdsGroup, error) { - result, _, err := s.clientv2.AlertsApi.GetAlertWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListAlertsOperation interface { - ListAlerts (*atlasv2.ListAlertsApiParams) (*atlasv2.PaginatedAlert, error) -} - -// ListAlerts encapsulates the logic to manage different cloud providers. -func (s *Store) ListAlerts(params *atlasv2.ListAlertsApiParams) (*atlasv2.PaginatedAlert, error) { - result, _, err := s.clientv2.AlertsApi.ListAlertsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListAlertsByAlertConfigurationIdOperation interface { - ListAlertsByAlertConfigurationId (*atlasv2.ListAlertsByAlertConfigurationIdApiParams) (*atlasv2.PaginatedAlert, error) -} - -// ListAlertsByAlertConfigurationId encapsulates the logic to manage different cloud providers. -func (s *Store) ListAlertsByAlertConfigurationId(params *atlasv2.ListAlertsByAlertConfigurationIdApiParams) (*atlasv2.PaginatedAlert, error) { - result, _, err := s.clientv2.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index b5f056597b..6276530510 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateAtlasSearchIndexOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateAtlasSearchIndexOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateAtlasSearchIndexOpts) Run() error { - params := &atlasv2.CreateAtlasSearchIndexApiParams{ +func (opts *CreateAtlasSearchIndexOpts) Run(ctx context.Context) error { + params := &admin.CreateAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.CreateAtlasSearchIndex(params) + resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params) if err != nil { return err } @@ -64,44 +64,46 @@ func CreateAtlasSearchIndexBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateAtlasSearchIndexTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type DeleteAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteAtlasSearchIndexOperation + client admin.APIClient groupId string clusterName string indexId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteAtlasSearchIndexOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteAtlasSearchIndexOpts) Run() error { - params := &atlasv2.DeleteAtlasSearchIndexApiParams{ +func (opts *DeleteAtlasSearchIndexOpts) Run(ctx context.Context) error { + params := &admin.DeleteAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IndexId: opts.indexId, } - resp, _, err := opts.store.DeleteAtlasSearchIndex(params) + resp, _, err := opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params) if err != nil { return err } @@ -121,45 +123,48 @@ func DeleteAtlasSearchIndexBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteAtlasSearchIndexTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") + _ = cmd.MarkFlagRequired("indexId") return cmd } type GetAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetAtlasSearchIndexOperation + client admin.APIClient groupId string clusterName string indexId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetAtlasSearchIndexOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetAtlasSearchIndexOpts) Run() error { - params := &atlasv2.GetAtlasSearchIndexApiParams{ +func (opts *GetAtlasSearchIndexOpts) Run(ctx context.Context) error { + params := &admin.GetAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IndexId: opts.indexId, } - resp, _, err := opts.store.GetAtlasSearchIndex(params) + resp, _, err := opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params) if err != nil { return err } @@ -179,47 +184,50 @@ func GetAtlasSearchIndexBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetAtlasSearchIndexTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") + _ = cmd.MarkFlagRequired("indexId") return cmd } type ListAtlasSearchIndexesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAtlasSearchIndexesOperation + client admin.APIClient groupId string clusterName string collectionName string databaseName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAtlasSearchIndexesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAtlasSearchIndexesOpts) Run() error { - params := &atlasv2.ListAtlasSearchIndexesApiParams{ +func (opts *ListAtlasSearchIndexesOpts) Run(ctx context.Context) error { + params := &admin.ListAtlasSearchIndexesApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, CollectionName: opts.collectionName, DatabaseName: opts.databaseName, } - resp, _, err := opts.store.ListAtlasSearchIndexes(params) + resp, _, err := opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params) if err != nil { return err } @@ -239,46 +247,50 @@ func ListAtlasSearchIndexesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAtlasSearchIndexesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") + _ = cmd.MarkFlagRequired("collectionName") cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + _ = cmd.MarkFlagRequired("databaseName") return cmd } type UpdateAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateAtlasSearchIndexOperation + client admin.APIClient groupId string clusterName string indexId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateAtlasSearchIndexOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateAtlasSearchIndexOpts) Run() error { - params := &atlasv2.UpdateAtlasSearchIndexApiParams{ +func (opts *UpdateAtlasSearchIndexOpts) Run(ctx context.Context) error { + params := &admin.UpdateAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IndexId: opts.indexId, } - resp, _, err := opts.store.UpdateAtlasSearchIndex(params) + resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params) if err != nil { return err } @@ -298,18 +310,21 @@ func UpdateAtlasSearchIndexBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateAtlasSearchIndexTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") + _ = cmd.MarkFlagRequired("indexId") return cmd } diff --git a/internal/generated/api_atlas_search_store.go b/internal/generated/api_atlas_search_store.go deleted file mode 100644 index 6181d5f1cc..0000000000 --- a/internal/generated/api_atlas_search_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_atlas_search_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateAtlasSearchIndexOperation, DeleteAtlasSearchIndexOperation, GetAtlasSearchIndexOperation, ListAtlasSearchIndexesOperation, UpdateAtlasSearchIndexOperation - -type CreateAtlasSearchIndexOperation interface { - CreateAtlasSearchIndex (*atlasv2.CreateAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) -} - -// CreateAtlasSearchIndex encapsulates the logic to manage different cloud providers. -func (s *Store) CreateAtlasSearchIndex(params *atlasv2.CreateAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) { - result, _, err := s.clientv2.AtlasSearchApi.CreateAtlasSearchIndexWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteAtlasSearchIndexOperation interface { - DeleteAtlasSearchIndex (*atlasv2.DeleteAtlasSearchIndexApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteAtlasSearchIndex encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteAtlasSearchIndex(params *atlasv2.DeleteAtlasSearchIndexApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetAtlasSearchIndexOperation interface { - GetAtlasSearchIndex (*atlasv2.GetAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) -} - -// GetAtlasSearchIndex encapsulates the logic to manage different cloud providers. -func (s *Store) GetAtlasSearchIndex(params *atlasv2.GetAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) { - result, _, err := s.clientv2.AtlasSearchApi.GetAtlasSearchIndexWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListAtlasSearchIndexesOperation interface { - ListAtlasSearchIndexes (*atlasv2.ListAtlasSearchIndexesApiParams) (*atlasv2.[]FTSIndex, error) -} - -// ListAtlasSearchIndexes encapsulates the logic to manage different cloud providers. -func (s *Store) ListAtlasSearchIndexes(params *atlasv2.ListAtlasSearchIndexesApiParams) (*atlasv2.[]FTSIndex, error) { - result, _, err := s.clientv2.AtlasSearchApi.ListAtlasSearchIndexesWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateAtlasSearchIndexOperation interface { - UpdateAtlasSearchIndex (*atlasv2.UpdateAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) -} - -// UpdateAtlasSearchIndex encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateAtlasSearchIndex(params *atlasv2.UpdateAtlasSearchIndexApiParams) (*atlasv2.FTSIndex, error) { - result, _, err := s.clientv2.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index aa1d01b76e..59fd9ded2e 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type GetAuditingConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetAuditingConfigurationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetAuditingConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetAuditingConfigurationOpts) Run() error { - params := &atlasv2.GetAuditingConfigurationApiParams{ +func (opts *GetAuditingConfigurationOpts) Run(ctx context.Context) error { + params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetAuditingConfiguration(params) + resp, _, err := opts.client.AuditingApi.GetAuditingConfigurationWithParams(ctx, params) if err != nil { return err } @@ -62,39 +62,40 @@ func GetAuditingConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetAuditingConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpdateAuditingConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateAuditingConfigurationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateAuditingConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateAuditingConfigurationOpts) Run() error { - params := &atlasv2.UpdateAuditingConfigurationApiParams{ +func (opts *UpdateAuditingConfigurationOpts) Run(ctx context.Context) error { + params := &admin.UpdateAuditingConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpdateAuditingConfiguration(params) + resp, _, err := opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params) if err != nil { return err } @@ -114,16 +115,17 @@ func UpdateAuditingConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateAuditingConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_auditing_store.go b/internal/generated/api_auditing_store.go deleted file mode 100644 index 287f30bd4b..0000000000 --- a/internal/generated/api_auditing_store.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_auditing_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetAuditingConfigurationOperation, UpdateAuditingConfigurationOperation - -type GetAuditingConfigurationOperation interface { - GetAuditingConfiguration (*atlasv2.GetAuditingConfigurationApiParams) (*atlasv2.AuditLog, error) -} - -// GetAuditingConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) GetAuditingConfiguration(params *atlasv2.GetAuditingConfigurationApiParams) (*atlasv2.AuditLog, error) { - result, _, err := s.clientv2.AuditingApi.GetAuditingConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateAuditingConfigurationOperation interface { - UpdateAuditingConfiguration (*atlasv2.UpdateAuditingConfigurationApiParams) (*atlasv2.AuditLog, error) -} - -// UpdateAuditingConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateAuditingConfiguration(params *atlasv2.UpdateAuditingConfigurationApiParams) (*atlasv2.AuditLog, error) { - result, _, err := s.clientv2.AuditingApi.UpdateAuditingConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 5aeb264b7d..3b32092f36 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type GetAWSCustomDNSOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetAWSCustomDNSOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetAWSCustomDNSOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetAWSCustomDNSOpts) Run() error { - params := &atlasv2.GetAWSCustomDNSApiParams{ +func (opts *GetAWSCustomDNSOpts) Run(ctx context.Context) error { + params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetAWSCustomDNS(params) + resp, _, err := opts.client.AWSClustersDNSApi.GetAWSCustomDNSWithParams(ctx, params) if err != nil { return err } @@ -62,39 +62,40 @@ func GetAWSCustomDNSBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetAWSCustomDNSTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type ToggleAWSCustomDNSOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ToggleAWSCustomDNSOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ToggleAWSCustomDNSOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ToggleAWSCustomDNSOpts) Run() error { - params := &atlasv2.ToggleAWSCustomDNSApiParams{ +func (opts *ToggleAWSCustomDNSOpts) Run(ctx context.Context) error { + params := &admin.ToggleAWSCustomDNSApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.ToggleAWSCustomDNS(params) + resp, _, err := opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params) if err != nil { return err } @@ -114,16 +115,17 @@ func ToggleAWSCustomDNSBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ToggleAWSCustomDNSTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_aws_clusters_dns_store.go b/internal/generated/api_aws_clusters_dns_store.go deleted file mode 100644 index b82cd96e25..0000000000 --- a/internal/generated/api_aws_clusters_dns_store.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_aws_clusters_dns_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetAWSCustomDNSOperation, ToggleAWSCustomDNSOperation - -type GetAWSCustomDNSOperation interface { - GetAWSCustomDNS (*atlasv2.GetAWSCustomDNSApiParams) (*atlasv2.AWSCustomDNSEnabled, error) -} - -// GetAWSCustomDNS encapsulates the logic to manage different cloud providers. -func (s *Store) GetAWSCustomDNS(params *atlasv2.GetAWSCustomDNSApiParams) (*atlasv2.AWSCustomDNSEnabled, error) { - result, _, err := s.clientv2.AWSClustersDNSApi.GetAWSCustomDNSWithParams(s.ctx, params).Execute() - return &result, err -} - -type ToggleAWSCustomDNSOperation interface { - ToggleAWSCustomDNS (*atlasv2.ToggleAWSCustomDNSApiParams) (*atlasv2.AWSCustomDNSEnabled, error) -} - -// ToggleAWSCustomDNS encapsulates the logic to manage different cloud providers. -func (s *Store) ToggleAWSCustomDNS(params *atlasv2.ToggleAWSCustomDNSApiParams) (*atlasv2.AWSCustomDNSEnabled, error) { - result, _, err := s.clientv2.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index a716b18e37..af1ffc68b0 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -19,34 +19,34 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CancelBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CancelBackupRestoreJobOperation + client admin.APIClient groupId string clusterName string restoreJobId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CancelBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CancelBackupRestoreJobOpts) Run() error { - params := &atlasv2.CancelBackupRestoreJobApiParams{ +func (opts *CancelBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.CancelBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.store.CancelBackupRestoreJob(params) + resp, _, err := opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -66,43 +66,46 @@ func CancelBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CancelBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") + _ = cmd.MarkFlagRequired("restoreJobId") return cmd } type CreateBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateBackupExportJobOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateBackupExportJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateBackupExportJobOpts) Run() error { - params := &atlasv2.CreateBackupExportJobApiParams{ +func (opts *CreateBackupExportJobOpts) Run(ctx context.Context) error { + params := &admin.CreateBackupExportJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.CreateBackupExportJob(params) + resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params) if err != nil { return err } @@ -122,42 +125,44 @@ func CreateBackupExportJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateBackupExportJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type CreateBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateBackupRestoreJobOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateBackupRestoreJobOpts) Run() error { - params := &atlasv2.CreateBackupRestoreJobApiParams{ +func (opts *CreateBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.CreateBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.CreateBackupRestoreJob(params) + resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -177,40 +182,42 @@ func CreateBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type CreateExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateExportBucketOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateExportBucketOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateExportBucketOpts) Run() error { - params := &atlasv2.CreateExportBucketApiParams{ +func (opts *CreateExportBucketOpts) Run(ctx context.Context) error { + params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateExportBucket(params) + resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params) if err != nil { return err } @@ -230,41 +237,42 @@ func CreateExportBucketBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateExportBucketTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type CreateServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateServerlessBackupRestoreJobOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateServerlessBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateServerlessBackupRestoreJobOpts) Run() error { - params := &atlasv2.CreateServerlessBackupRestoreJobApiParams{ +func (opts *CreateServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.CreateServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.CreateServerlessBackupRestoreJob(params) + resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -284,42 +292,44 @@ func CreateServerlessBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateServerlessBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type DeleteAllBackupSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteAllBackupSchedulesOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteAllBackupSchedulesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteAllBackupSchedulesOpts) Run() error { - params := &atlasv2.DeleteAllBackupSchedulesApiParams{ +func (opts *DeleteAllBackupSchedulesOpts) Run(ctx context.Context) error { + params := &admin.DeleteAllBackupSchedulesApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.DeleteAllBackupSchedules(params) + resp, _, err := opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params) if err != nil { return err } @@ -339,42 +349,44 @@ func DeleteAllBackupSchedulesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteAllBackupSchedulesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type DeleteExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteExportBucketOperation + client admin.APIClient groupId string exportBucketId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteExportBucketOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteExportBucketOpts) Run() error { - params := &atlasv2.DeleteExportBucketApiParams{ +func (opts *DeleteExportBucketOpts) Run(ctx context.Context) error { + params := &admin.DeleteExportBucketApiParams{ GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } - resp, _, err := opts.store.DeleteExportBucket(params) + resp, _, err := opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params) if err != nil { return err } @@ -394,44 +406,46 @@ func DeleteExportBucketBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteExportBucketTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "usage description") + _ = cmd.MarkFlagRequired("exportBucketId") return cmd } type DeleteReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteReplicaSetBackupOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteReplicaSetBackupOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteReplicaSetBackupOpts) Run() error { - params := &atlasv2.DeleteReplicaSetBackupApiParams{ +func (opts *DeleteReplicaSetBackupOpts) Run(ctx context.Context) error { + params := &admin.DeleteReplicaSetBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.DeleteReplicaSetBackup(params) + resp, _, err := opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params) if err != nil { return err } @@ -451,45 +465,48 @@ func DeleteReplicaSetBackupBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteReplicaSetBackupTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type DeleteShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteShardedClusterBackupOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteShardedClusterBackupOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteShardedClusterBackupOpts) Run() error { - params := &atlasv2.DeleteShardedClusterBackupApiParams{ +func (opts *DeleteShardedClusterBackupOpts) Run(ctx context.Context) error { + params := &admin.DeleteShardedClusterBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.DeleteShardedClusterBackup(params) + resp, _, err := opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params) if err != nil { return err } @@ -509,45 +526,48 @@ func DeleteShardedClusterBackupBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteShardedClusterBackupTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type GetBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetBackupExportJobOperation + client admin.APIClient groupId string clusterName string exportId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetBackupExportJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetBackupExportJobOpts) Run() error { - params := &atlasv2.GetBackupExportJobApiParams{ +func (opts *GetBackupExportJobOpts) Run(ctx context.Context) error { + params := &admin.GetBackupExportJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, ExportId: opts.exportId, } - resp, _, err := opts.store.GetBackupExportJob(params) + resp, _, err := opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params) if err != nil { return err } @@ -567,45 +587,48 @@ func GetBackupExportJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetBackupExportJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.exportId, "exportId", "", "usage description") + _ = cmd.MarkFlagRequired("exportId") return cmd } type GetBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetBackupRestoreJobOperation + client admin.APIClient groupId string clusterName string restoreJobId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetBackupRestoreJobOpts) Run() error { - params := &atlasv2.GetBackupRestoreJobApiParams{ +func (opts *GetBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.GetBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.store.GetBackupRestoreJob(params) + resp, _, err := opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -625,43 +648,46 @@ func GetBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") + _ = cmd.MarkFlagRequired("restoreJobId") return cmd } type GetBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetBackupScheduleOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetBackupScheduleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetBackupScheduleOpts) Run() error { - params := &atlasv2.GetBackupScheduleApiParams{ +func (opts *GetBackupScheduleOpts) Run(ctx context.Context) error { + params := &admin.GetBackupScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetBackupSchedule(params) + resp, _, err := opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params) if err != nil { return err } @@ -681,40 +707,42 @@ func GetBackupScheduleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetBackupScheduleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type GetDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetDataProtectionSettingsOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetDataProtectionSettingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetDataProtectionSettingsOpts) Run() error { - params := &atlasv2.GetDataProtectionSettingsApiParams{ +func (opts *GetDataProtectionSettingsOpts) Run(ctx context.Context) error { + params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetDataProtectionSettings(params) + resp, _, err := opts.client.CloudBackupsApi.GetDataProtectionSettingsWithParams(ctx, params) if err != nil { return err } @@ -734,41 +762,42 @@ func GetDataProtectionSettingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetDataProtectionSettingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetExportBucketOperation + client admin.APIClient groupId string exportBucketId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetExportBucketOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetExportBucketOpts) Run() error { - params := &atlasv2.GetExportBucketApiParams{ +func (opts *GetExportBucketOpts) Run(ctx context.Context) error { + params := &admin.GetExportBucketApiParams{ GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } - resp, _, err := opts.store.GetExportBucket(params) + resp, _, err := opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params) if err != nil { return err } @@ -788,44 +817,46 @@ func GetExportBucketBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetExportBucketTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "usage description") + _ = cmd.MarkFlagRequired("exportBucketId") return cmd } type GetReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetReplicaSetBackupOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetReplicaSetBackupOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetReplicaSetBackupOpts) Run() error { - params := &atlasv2.GetReplicaSetBackupApiParams{ +func (opts *GetReplicaSetBackupOpts) Run(ctx context.Context) error { + params := &admin.GetReplicaSetBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.GetReplicaSetBackup(params) + resp, _, err := opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params) if err != nil { return err } @@ -845,45 +876,48 @@ func GetReplicaSetBackupBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetReplicaSetBackupTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type GetServerlessBackupOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetServerlessBackupOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetServerlessBackupOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetServerlessBackupOpts) Run() error { - params := &atlasv2.GetServerlessBackupApiParams{ +func (opts *GetServerlessBackupOpts) Run(ctx context.Context) error { + params := &admin.GetServerlessBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.GetServerlessBackup(params) + resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params) if err != nil { return err } @@ -903,45 +937,48 @@ func GetServerlessBackupBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetServerlessBackupTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type GetServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetServerlessBackupRestoreJobOperation + client admin.APIClient groupId string clusterName string restoreJobId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetServerlessBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetServerlessBackupRestoreJobOpts) Run() error { - params := &atlasv2.GetServerlessBackupRestoreJobApiParams{ +func (opts *GetServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.GetServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.store.GetServerlessBackupRestoreJob(params) + resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -961,45 +998,48 @@ func GetServerlessBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetServerlessBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") + _ = cmd.MarkFlagRequired("restoreJobId") return cmd } type GetShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetShardedClusterBackupOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetShardedClusterBackupOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetShardedClusterBackupOpts) Run() error { - params := &atlasv2.GetShardedClusterBackupApiParams{ +func (opts *GetShardedClusterBackupOpts) Run(ctx context.Context) error { + params := &admin.GetShardedClusterBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.GetShardedClusterBackup(params) + resp, _, err := opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params) if err != nil { return err } @@ -1019,25 +1059,28 @@ func GetShardedClusterBackupBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetShardedClusterBackupTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type ListBackupExportJobsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListBackupExportJobsOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -1045,23 +1088,23 @@ type ListBackupExportJobsOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListBackupExportJobsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListBackupExportJobsOpts) Run() error { - params := &atlasv2.ListBackupExportJobsApiParams{ +func (opts *ListBackupExportJobsOpts) Run(ctx context.Context) error { + params := &admin.ListBackupExportJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListBackupExportJobs(params) + resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params) if err != nil { return err } @@ -1081,17 +1124,19 @@ func ListBackupExportJobsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListBackupExportJobsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -1101,7 +1146,7 @@ func ListBackupExportJobsBuilder() cobra.Command { type ListBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListBackupRestoreJobsOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -1109,23 +1154,23 @@ type ListBackupRestoreJobsOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListBackupRestoreJobsOpts) Run() error { - params := &atlasv2.ListBackupRestoreJobsApiParams{ +func (opts *ListBackupRestoreJobsOpts) Run(ctx context.Context) error { + params := &admin.ListBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListBackupRestoreJobs(params) + resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params) if err != nil { return err } @@ -1145,17 +1190,19 @@ func ListBackupRestoreJobsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListBackupRestoreJobsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -1165,29 +1212,29 @@ func ListBackupRestoreJobsBuilder() cobra.Command { type ListExportBucketsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListExportBucketsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListExportBucketsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListExportBucketsOpts) Run() error { - params := &atlasv2.ListExportBucketsApiParams{ +func (opts *ListExportBucketsOpts) Run(ctx context.Context) error { + params := &admin.ListExportBucketsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListExportBuckets(params) + resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params) if err != nil { return err } @@ -1207,16 +1254,17 @@ func ListExportBucketsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListExportBucketsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -1226,7 +1274,7 @@ func ListExportBucketsBuilder() cobra.Command { type ListReplicaSetBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListReplicaSetBackupsOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -1234,23 +1282,23 @@ type ListReplicaSetBackupsOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListReplicaSetBackupsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListReplicaSetBackupsOpts) Run() error { - params := &atlasv2.ListReplicaSetBackupsApiParams{ +func (opts *ListReplicaSetBackupsOpts) Run(ctx context.Context) error { + params := &admin.ListReplicaSetBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListReplicaSetBackups(params) + resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params) if err != nil { return err } @@ -1270,17 +1318,19 @@ func ListReplicaSetBackupsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListReplicaSetBackupsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -1290,7 +1340,7 @@ func ListReplicaSetBackupsBuilder() cobra.Command { type ListServerlessBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListServerlessBackupRestoreJobsOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -1298,23 +1348,23 @@ type ListServerlessBackupRestoreJobsOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListServerlessBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListServerlessBackupRestoreJobsOpts) Run() error { - params := &atlasv2.ListServerlessBackupRestoreJobsApiParams{ +func (opts *ListServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error { + params := &admin.ListServerlessBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListServerlessBackupRestoreJobs(params) + resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params) if err != nil { return err } @@ -1334,17 +1384,19 @@ func ListServerlessBackupRestoreJobsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListServerlessBackupRestoreJobsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -1354,7 +1406,7 @@ func ListServerlessBackupRestoreJobsBuilder() cobra.Command { type ListServerlessBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListServerlessBackupsOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -1362,23 +1414,23 @@ type ListServerlessBackupsOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListServerlessBackupsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListServerlessBackupsOpts) Run() error { - params := &atlasv2.ListServerlessBackupsApiParams{ +func (opts *ListServerlessBackupsOpts) Run(ctx context.Context) error { + params := &admin.ListServerlessBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListServerlessBackups(params) + resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params) if err != nil { return err } @@ -1398,17 +1450,19 @@ func ListServerlessBackupsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListServerlessBackupsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -1418,25 +1472,25 @@ func ListServerlessBackupsBuilder() cobra.Command { type ListShardedClusterBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListShardedClusterBackupsOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListShardedClusterBackupsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListShardedClusterBackupsOpts) Run() error { - params := &atlasv2.ListShardedClusterBackupsApiParams{ +func (opts *ListShardedClusterBackupsOpts) Run(ctx context.Context) error { + params := &admin.ListShardedClusterBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.ListShardedClusterBackups(params) + resp, _, err := opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params) if err != nil { return err } @@ -1456,42 +1510,44 @@ func ListShardedClusterBackupsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListShardedClusterBackupsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type TakeSnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - store store.TakeSnapshotOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *TakeSnapshotOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *TakeSnapshotOpts) Run() error { - params := &atlasv2.TakeSnapshotApiParams{ +func (opts *TakeSnapshotOpts) Run(ctx context.Context) error { + params := &admin.TakeSnapshotApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.TakeSnapshot(params) + resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params) if err != nil { return err } @@ -1511,42 +1567,44 @@ func TakeSnapshotBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), TakeSnapshotTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type UpdateBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateBackupScheduleOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateBackupScheduleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateBackupScheduleOpts) Run() error { - params := &atlasv2.UpdateBackupScheduleApiParams{ +func (opts *UpdateBackupScheduleOpts) Run(ctx context.Context) error { + params := &admin.UpdateBackupScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.UpdateBackupSchedule(params) + resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params) if err != nil { return err } @@ -1566,40 +1624,42 @@ func UpdateBackupScheduleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateBackupScheduleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type UpdateDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateDataProtectionSettingsOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateDataProtectionSettingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateDataProtectionSettingsOpts) Run() error { - params := &atlasv2.UpdateDataProtectionSettingsApiParams{ +func (opts *UpdateDataProtectionSettingsOpts) Run(ctx context.Context) error { + params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpdateDataProtectionSettings(params) + resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params) if err != nil { return err } @@ -1619,43 +1679,44 @@ func UpdateDataProtectionSettingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateDataProtectionSettingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpdateSnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateSnapshotRetentionOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateSnapshotRetentionOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateSnapshotRetentionOpts) Run() error { - params := &atlasv2.UpdateSnapshotRetentionApiParams{ +func (opts *UpdateSnapshotRetentionOpts) Run(ctx context.Context) error { + params := &admin.UpdateSnapshotRetentionApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.UpdateSnapshotRetention(params) + resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params) if err != nil { return err } @@ -1675,18 +1736,21 @@ func UpdateSnapshotRetentionBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateSnapshotRetentionTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } diff --git a/internal/generated/api_cloud_backups_store.go b/internal/generated/api_cloud_backups_store.go deleted file mode 100644 index 63f198382f..0000000000 --- a/internal/generated/api_cloud_backups_store.go +++ /dev/null @@ -1,315 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_cloud_backups_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CancelBackupRestoreJobOperation, CreateBackupExportJobOperation, CreateBackupRestoreJobOperation, CreateExportBucketOperation, CreateServerlessBackupRestoreJobOperation, DeleteAllBackupSchedulesOperation, DeleteExportBucketOperation, DeleteReplicaSetBackupOperation, DeleteShardedClusterBackupOperation, GetBackupExportJobOperation, GetBackupRestoreJobOperation, GetBackupScheduleOperation, GetDataProtectionSettingsOperation, GetExportBucketOperation, GetReplicaSetBackupOperation, GetServerlessBackupOperation, GetServerlessBackupRestoreJobOperation, GetShardedClusterBackupOperation, ListBackupExportJobsOperation, ListBackupRestoreJobsOperation, ListExportBucketsOperation, ListReplicaSetBackupsOperation, ListServerlessBackupRestoreJobsOperation, ListServerlessBackupsOperation, ListShardedClusterBackupsOperation, TakeSnapshotOperation, UpdateBackupScheduleOperation, UpdateDataProtectionSettingsOperation, UpdateSnapshotRetentionOperation - -type CancelBackupRestoreJobOperation interface { - CancelBackupRestoreJob (*atlasv2.CancelBackupRestoreJobApiParams) (*atlasv2.map[string]interface{}, error) -} - -// CancelBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) CancelBackupRestoreJob(params *atlasv2.CancelBackupRestoreJobApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.CloudBackupsApi.CancelBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateBackupExportJobOperation interface { - CreateBackupExportJob (*atlasv2.CreateBackupExportJobApiParams) (*atlasv2.DiskBackupExportJob, error) -} - -// CreateBackupExportJob encapsulates the logic to manage different cloud providers. -func (s *Store) CreateBackupExportJob(params *atlasv2.CreateBackupExportJobApiParams) (*atlasv2.DiskBackupExportJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.CreateBackupExportJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateBackupRestoreJobOperation interface { - CreateBackupRestoreJob (*atlasv2.CreateBackupRestoreJobApiParams) (*atlasv2.DiskBackupRestoreJob, error) -} - -// CreateBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) CreateBackupRestoreJob(params *atlasv2.CreateBackupRestoreJobApiParams) (*atlasv2.DiskBackupRestoreJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.CreateBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateExportBucketOperation interface { - CreateExportBucket (*atlasv2.CreateExportBucketApiParams) (*atlasv2.DiskBackupSnapshotAWSExportBucket, error) -} - -// CreateExportBucket encapsulates the logic to manage different cloud providers. -func (s *Store) CreateExportBucket(params *atlasv2.CreateExportBucketApiParams) (*atlasv2.DiskBackupSnapshotAWSExportBucket, error) { - result, _, err := s.clientv2.CloudBackupsApi.CreateExportBucketWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateServerlessBackupRestoreJobOperation interface { - CreateServerlessBackupRestoreJob (*atlasv2.CreateServerlessBackupRestoreJobApiParams) (*atlasv2.ServerlessBackupRestoreJob, error) -} - -// CreateServerlessBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) CreateServerlessBackupRestoreJob(params *atlasv2.CreateServerlessBackupRestoreJobApiParams) (*atlasv2.ServerlessBackupRestoreJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteAllBackupSchedulesOperation interface { - DeleteAllBackupSchedules (*atlasv2.DeleteAllBackupSchedulesApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) -} - -// DeleteAllBackupSchedules encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteAllBackupSchedules(params *atlasv2.DeleteAllBackupSchedulesApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) { - result, _, err := s.clientv2.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteExportBucketOperation interface { - DeleteExportBucket (*atlasv2.DeleteExportBucketApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteExportBucket encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteExportBucket(params *atlasv2.DeleteExportBucketApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.CloudBackupsApi.DeleteExportBucketWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteReplicaSetBackupOperation interface { - DeleteReplicaSetBackup (*atlasv2.DeleteReplicaSetBackupApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteReplicaSetBackup encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteReplicaSetBackup(params *atlasv2.DeleteReplicaSetBackupApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.CloudBackupsApi.DeleteReplicaSetBackupWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteShardedClusterBackupOperation interface { - DeleteShardedClusterBackup (*atlasv2.DeleteShardedClusterBackupApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteShardedClusterBackup encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteShardedClusterBackup(params *atlasv2.DeleteShardedClusterBackupApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.CloudBackupsApi.DeleteShardedClusterBackupWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetBackupExportJobOperation interface { - GetBackupExportJob (*atlasv2.GetBackupExportJobApiParams) (*atlasv2.DiskBackupExportJob, error) -} - -// GetBackupExportJob encapsulates the logic to manage different cloud providers. -func (s *Store) GetBackupExportJob(params *atlasv2.GetBackupExportJobApiParams) (*atlasv2.DiskBackupExportJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetBackupExportJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetBackupRestoreJobOperation interface { - GetBackupRestoreJob (*atlasv2.GetBackupRestoreJobApiParams) (*atlasv2.DiskBackupRestoreJob, error) -} - -// GetBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) GetBackupRestoreJob(params *atlasv2.GetBackupRestoreJobApiParams) (*atlasv2.DiskBackupRestoreJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetBackupScheduleOperation interface { - GetBackupSchedule (*atlasv2.GetBackupScheduleApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) -} - -// GetBackupSchedule encapsulates the logic to manage different cloud providers. -func (s *Store) GetBackupSchedule(params *atlasv2.GetBackupScheduleApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetBackupScheduleWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetDataProtectionSettingsOperation interface { - GetDataProtectionSettings (*atlasv2.GetDataProtectionSettingsApiParams) (*atlasv2.DataProtectionSettings, error) -} - -// GetDataProtectionSettings encapsulates the logic to manage different cloud providers. -func (s *Store) GetDataProtectionSettings(params *atlasv2.GetDataProtectionSettingsApiParams) (*atlasv2.DataProtectionSettings, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetDataProtectionSettingsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetExportBucketOperation interface { - GetExportBucket (*atlasv2.GetExportBucketApiParams) (*atlasv2.DiskBackupSnapshotAWSExportBucket, error) -} - -// GetExportBucket encapsulates the logic to manage different cloud providers. -func (s *Store) GetExportBucket(params *atlasv2.GetExportBucketApiParams) (*atlasv2.DiskBackupSnapshotAWSExportBucket, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetExportBucketWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetReplicaSetBackupOperation interface { - GetReplicaSetBackup (*atlasv2.GetReplicaSetBackupApiParams) (*atlasv2.DiskBackupReplicaSet, error) -} - -// GetReplicaSetBackup encapsulates the logic to manage different cloud providers. -func (s *Store) GetReplicaSetBackup(params *atlasv2.GetReplicaSetBackupApiParams) (*atlasv2.DiskBackupReplicaSet, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetReplicaSetBackupWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetServerlessBackupOperation interface { - GetServerlessBackup (*atlasv2.GetServerlessBackupApiParams) (*atlasv2.ServerlessBackupSnapshot, error) -} - -// GetServerlessBackup encapsulates the logic to manage different cloud providers. -func (s *Store) GetServerlessBackup(params *atlasv2.GetServerlessBackupApiParams) (*atlasv2.ServerlessBackupSnapshot, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetServerlessBackupWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetServerlessBackupRestoreJobOperation interface { - GetServerlessBackupRestoreJob (*atlasv2.GetServerlessBackupRestoreJobApiParams) (*atlasv2.ServerlessBackupRestoreJob, error) -} - -// GetServerlessBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) GetServerlessBackupRestoreJob(params *atlasv2.GetServerlessBackupRestoreJobApiParams) (*atlasv2.ServerlessBackupRestoreJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetShardedClusterBackupOperation interface { - GetShardedClusterBackup (*atlasv2.GetShardedClusterBackupApiParams) (*atlasv2.DiskBackupShardedClusterSnapshot, error) -} - -// GetShardedClusterBackup encapsulates the logic to manage different cloud providers. -func (s *Store) GetShardedClusterBackup(params *atlasv2.GetShardedClusterBackupApiParams) (*atlasv2.DiskBackupShardedClusterSnapshot, error) { - result, _, err := s.clientv2.CloudBackupsApi.GetShardedClusterBackupWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListBackupExportJobsOperation interface { - ListBackupExportJobs (*atlasv2.ListBackupExportJobsApiParams) (*atlasv2.PaginatedApiAtlasDiskBackupExportJob, error) -} - -// ListBackupExportJobs encapsulates the logic to manage different cloud providers. -func (s *Store) ListBackupExportJobs(params *atlasv2.ListBackupExportJobsApiParams) (*atlasv2.PaginatedApiAtlasDiskBackupExportJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.ListBackupExportJobsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListBackupRestoreJobsOperation interface { - ListBackupRestoreJobs (*atlasv2.ListBackupRestoreJobsApiParams) (*atlasv2.PaginatedCloudBackupRestoreJob, error) -} - -// ListBackupRestoreJobs encapsulates the logic to manage different cloud providers. -func (s *Store) ListBackupRestoreJobs(params *atlasv2.ListBackupRestoreJobsApiParams) (*atlasv2.PaginatedCloudBackupRestoreJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.ListBackupRestoreJobsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListExportBucketsOperation interface { - ListExportBuckets (*atlasv2.ListExportBucketsApiParams) (*atlasv2.PaginatedBackupSnapshotExportBucket, error) -} - -// ListExportBuckets encapsulates the logic to manage different cloud providers. -func (s *Store) ListExportBuckets(params *atlasv2.ListExportBucketsApiParams) (*atlasv2.PaginatedBackupSnapshotExportBucket, error) { - result, _, err := s.clientv2.CloudBackupsApi.ListExportBucketsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListReplicaSetBackupsOperation interface { - ListReplicaSetBackups (*atlasv2.ListReplicaSetBackupsApiParams) (*atlasv2.PaginatedCloudBackupReplicaSet, error) -} - -// ListReplicaSetBackups encapsulates the logic to manage different cloud providers. -func (s *Store) ListReplicaSetBackups(params *atlasv2.ListReplicaSetBackupsApiParams) (*atlasv2.PaginatedCloudBackupReplicaSet, error) { - result, _, err := s.clientv2.CloudBackupsApi.ListReplicaSetBackupsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListServerlessBackupRestoreJobsOperation interface { - ListServerlessBackupRestoreJobs (*atlasv2.ListServerlessBackupRestoreJobsApiParams) (*atlasv2.PaginatedApiAtlasServerlessBackupRestoreJob, error) -} - -// ListServerlessBackupRestoreJobs encapsulates the logic to manage different cloud providers. -func (s *Store) ListServerlessBackupRestoreJobs(params *atlasv2.ListServerlessBackupRestoreJobsApiParams) (*atlasv2.PaginatedApiAtlasServerlessBackupRestoreJob, error) { - result, _, err := s.clientv2.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListServerlessBackupsOperation interface { - ListServerlessBackups (*atlasv2.ListServerlessBackupsApiParams) (*atlasv2.PaginatedApiAtlasServerlessBackupSnapshot, error) -} - -// ListServerlessBackups encapsulates the logic to manage different cloud providers. -func (s *Store) ListServerlessBackups(params *atlasv2.ListServerlessBackupsApiParams) (*atlasv2.PaginatedApiAtlasServerlessBackupSnapshot, error) { - result, _, err := s.clientv2.CloudBackupsApi.ListServerlessBackupsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListShardedClusterBackupsOperation interface { - ListShardedClusterBackups (*atlasv2.ListShardedClusterBackupsApiParams) (*atlasv2.PaginatedCloudBackupShardedClusterSnapshot, error) -} - -// ListShardedClusterBackups encapsulates the logic to manage different cloud providers. -func (s *Store) ListShardedClusterBackups(params *atlasv2.ListShardedClusterBackupsApiParams) (*atlasv2.PaginatedCloudBackupShardedClusterSnapshot, error) { - result, _, err := s.clientv2.CloudBackupsApi.ListShardedClusterBackupsWithParams(s.ctx, params).Execute() - return &result, err -} - -type TakeSnapshotOperation interface { - TakeSnapshot (*atlasv2.TakeSnapshotApiParams) (*atlasv2.DiskBackupSnapshot, error) -} - -// TakeSnapshot encapsulates the logic to manage different cloud providers. -func (s *Store) TakeSnapshot(params *atlasv2.TakeSnapshotApiParams) (*atlasv2.DiskBackupSnapshot, error) { - result, _, err := s.clientv2.CloudBackupsApi.TakeSnapshotWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateBackupScheduleOperation interface { - UpdateBackupSchedule (*atlasv2.UpdateBackupScheduleApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) -} - -// UpdateBackupSchedule encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateBackupSchedule(params *atlasv2.UpdateBackupScheduleApiParams) (*atlasv2.DiskBackupSnapshotSchedule, error) { - result, _, err := s.clientv2.CloudBackupsApi.UpdateBackupScheduleWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateDataProtectionSettingsOperation interface { - UpdateDataProtectionSettings (*atlasv2.UpdateDataProtectionSettingsApiParams) (*atlasv2.DataProtectionSettings, error) -} - -// UpdateDataProtectionSettings encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateDataProtectionSettings(params *atlasv2.UpdateDataProtectionSettingsApiParams) (*atlasv2.DataProtectionSettings, error) { - result, _, err := s.clientv2.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateSnapshotRetentionOperation interface { - UpdateSnapshotRetention (*atlasv2.UpdateSnapshotRetentionApiParams) (*atlasv2.DiskBackupReplicaSet, error) -} - -// UpdateSnapshotRetention encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateSnapshotRetention(params *atlasv2.UpdateSnapshotRetentionApiParams) (*atlasv2.DiskBackupReplicaSet, error) { - result, _, err := s.clientv2.CloudBackupsApi.UpdateSnapshotRetentionWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index f968c15b77..7240dd1a4b 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateLinkTokenOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateLinkTokenOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateLinkTokenOpts) Run() error { - params := &atlasv2.CreateLinkTokenApiParams{ +func (opts *CreateLinkTokenOpts) Run(ctx context.Context) error { + params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.CreateLinkToken(params) + resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params) if err != nil { return err } @@ -62,39 +62,40 @@ func CreateLinkTokenBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateLinkTokenTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type CreatePushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreatePushMigrationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreatePushMigrationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreatePushMigrationOpts) Run() error { - params := &atlasv2.CreatePushMigrationApiParams{ +func (opts *CreatePushMigrationOpts) Run(ctx context.Context) error { + params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreatePushMigration(params) + resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params) if err != nil { return err } @@ -114,41 +115,42 @@ func CreatePushMigrationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreatePushMigrationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type CutoverMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CutoverMigrationOperation + client admin.APIClient groupId string liveMigrationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CutoverMigrationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CutoverMigrationOpts) Run() error { - params := &atlasv2.CutoverMigrationApiParams{ +func (opts *CutoverMigrationOpts) Run(ctx context.Context) error { + params := &admin.CutoverMigrationApiParams{ GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } - _, err := opts.store.CutoverMigration(params) + _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params) if err != nil { return err } @@ -168,40 +170,42 @@ func CutoverMigrationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CutoverMigrationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "usage description") + _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } type DeleteLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteLinkTokenOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteLinkTokenOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteLinkTokenOpts) Run() error { - params := &atlasv2.DeleteLinkTokenApiParams{ +func (opts *DeleteLinkTokenOpts) Run(ctx context.Context) error { + params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.DeleteLinkToken(params) + resp, _, err := opts.client.CloudMigrationServiceApi.DeleteLinkTokenWithParams(ctx, params) if err != nil { return err } @@ -221,41 +225,42 @@ func DeleteLinkTokenBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteLinkTokenTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type GetPushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetPushMigrationOperation + client admin.APIClient groupId string liveMigrationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetPushMigrationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetPushMigrationOpts) Run() error { - params := &atlasv2.GetPushMigrationApiParams{ +func (opts *GetPushMigrationOpts) Run(ctx context.Context) error { + params := &admin.GetPushMigrationApiParams{ GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } - resp, _, err := opts.store.GetPushMigration(params) + resp, _, err := opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params) if err != nil { return err } @@ -275,42 +280,44 @@ func GetPushMigrationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetPushMigrationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "usage description") + _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } type GetValidationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetValidationStatusOperation + client admin.APIClient groupId string validationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetValidationStatusOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetValidationStatusOpts) Run() error { - params := &atlasv2.GetValidationStatusApiParams{ +func (opts *GetValidationStatusOpts) Run(ctx context.Context) error { + params := &admin.GetValidationStatusApiParams{ GroupId: opts.groupId, ValidationId: opts.validationId, } - resp, _, err := opts.store.GetValidationStatus(params) + resp, _, err := opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params) if err != nil { return err } @@ -330,40 +337,42 @@ func GetValidationStatusBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetValidationStatusTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.validationId, "validationId", "", "usage description") + _ = cmd.MarkFlagRequired("validationId") return cmd } type ListSourceProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListSourceProjectsOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListSourceProjectsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListSourceProjectsOpts) Run() error { - params := &atlasv2.ListSourceProjectsApiParams{ +func (opts *ListSourceProjectsOpts) Run(ctx context.Context) error { + params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.ListSourceProjects(params) + resp, _, err := opts.client.CloudMigrationServiceApi.ListSourceProjectsWithParams(ctx, params) if err != nil { return err } @@ -383,39 +392,40 @@ func ListSourceProjectsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListSourceProjectsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type ValidateMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ValidateMigrationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ValidateMigrationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ValidateMigrationOpts) Run() error { - params := &atlasv2.ValidateMigrationApiParams{ +func (opts *ValidateMigrationOpts) Run(ctx context.Context) error { + params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.ValidateMigration(params) + resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params) if err != nil { return err } @@ -435,16 +445,17 @@ func ValidateMigrationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ValidateMigrationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_cloud_migration_service_store.go b/internal/generated/api_cloud_migration_service_store.go deleted file mode 100644 index 73dea87626..0000000000 --- a/internal/generated/api_cloud_migration_service_store.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_cloud_migration_service_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateLinkTokenOperation, CreatePushMigrationOperation, CutoverMigrationOperation, DeleteLinkTokenOperation, GetPushMigrationOperation, GetValidationStatusOperation, ListSourceProjectsOperation, ValidateMigrationOperation - -type CreateLinkTokenOperation interface { - CreateLinkToken (*atlasv2.CreateLinkTokenApiParams) (*atlasv2.TargetOrg, error) -} - -// CreateLinkToken encapsulates the logic to manage different cloud providers. -func (s *Store) CreateLinkToken(params *atlasv2.CreateLinkTokenApiParams) (*atlasv2.TargetOrg, error) { - result, _, err := s.clientv2.CloudMigrationServiceApi.CreateLinkTokenWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreatePushMigrationOperation interface { - CreatePushMigration (*atlasv2.CreatePushMigrationApiParams) (*atlasv2.LiveMigrationResponse, error) -} - -// CreatePushMigration encapsulates the logic to manage different cloud providers. -func (s *Store) CreatePushMigration(params *atlasv2.CreatePushMigrationApiParams) (*atlasv2.LiveMigrationResponse, error) { - result, _, err := s.clientv2.CloudMigrationServiceApi.CreatePushMigrationWithParams(s.ctx, params).Execute() - return &result, err -} - -type CutoverMigrationOperation interface { - CutoverMigration (*atlasv2.CutoverMigrationApiParams) error -} - -// CutoverMigration encapsulates the logic to manage different cloud providers. -func (s *Store) CutoverMigration(params *atlasv2.CutoverMigrationApiParams) (error) { - _, err := s.clientv2.CloudMigrationServiceApi.CutoverMigrationWithParams(s.ctx, params).Execute() - return err -} - -type DeleteLinkTokenOperation interface { - DeleteLinkToken (*atlasv2.DeleteLinkTokenApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteLinkToken encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteLinkToken(params *atlasv2.DeleteLinkTokenApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.CloudMigrationServiceApi.DeleteLinkTokenWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetPushMigrationOperation interface { - GetPushMigration (*atlasv2.GetPushMigrationApiParams) (*atlasv2.LiveMigrationResponse, error) -} - -// GetPushMigration encapsulates the logic to manage different cloud providers. -func (s *Store) GetPushMigration(params *atlasv2.GetPushMigrationApiParams) (*atlasv2.LiveMigrationResponse, error) { - result, _, err := s.clientv2.CloudMigrationServiceApi.GetPushMigrationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetValidationStatusOperation interface { - GetValidationStatus (*atlasv2.GetValidationStatusApiParams) (*atlasv2.Validation, error) -} - -// GetValidationStatus encapsulates the logic to manage different cloud providers. -func (s *Store) GetValidationStatus(params *atlasv2.GetValidationStatusApiParams) (*atlasv2.Validation, error) { - result, _, err := s.clientv2.CloudMigrationServiceApi.GetValidationStatusWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListSourceProjectsOperation interface { - ListSourceProjects (*atlasv2.ListSourceProjectsApiParams) (*atlasv2.[]AvailableProject, error) -} - -// ListSourceProjects encapsulates the logic to manage different cloud providers. -func (s *Store) ListSourceProjects(params *atlasv2.ListSourceProjectsApiParams) (*atlasv2.[]AvailableProject, error) { - result, _, err := s.clientv2.CloudMigrationServiceApi.ListSourceProjectsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ValidateMigrationOperation interface { - ValidateMigration (*atlasv2.ValidateMigrationApiParams) (*atlasv2.Validation, error) -} - -// ValidateMigration encapsulates the logic to manage different cloud providers. -func (s *Store) ValidateMigration(params *atlasv2.ValidateMigrationApiParams) (*atlasv2.Validation, error) { - result, _, err := s.clientv2.CloudMigrationServiceApi.ValidateMigrationWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index 33e1074601..f0c1180ef4 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type AuthorizeCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.AuthorizeCloudProviderAccessRoleOperation + client admin.APIClient groupId string roleId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *AuthorizeCloudProviderAccessRoleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *AuthorizeCloudProviderAccessRoleOpts) Run() error { - params := &atlasv2.AuthorizeCloudProviderAccessRoleApiParams{ +func (opts *AuthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error { + params := &admin.AuthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, RoleId: opts.roleId, } - resp, _, err := opts.store.AuthorizeCloudProviderAccessRole(params) + resp, _, err := opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params) if err != nil { return err } @@ -64,40 +64,42 @@ func AuthorizeCloudProviderAccessRoleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), AuthorizeCloudProviderAccessRoleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") + _ = cmd.MarkFlagRequired("roleId") return cmd } type CreateCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateCloudProviderAccessRoleOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateCloudProviderAccessRoleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateCloudProviderAccessRoleOpts) Run() error { - params := &atlasv2.CreateCloudProviderAccessRoleApiParams{ +func (opts *CreateCloudProviderAccessRoleOpts) Run(ctx context.Context) error { + params := &admin.CreateCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateCloudProviderAccessRole(params) + resp, _, err := opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params) if err != nil { return err } @@ -117,43 +119,44 @@ func CreateCloudProviderAccessRoleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateCloudProviderAccessRoleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeauthorizeCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeauthorizeCloudProviderAccessRoleOperation + client admin.APIClient groupId string cloudProvider string roleId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeauthorizeCloudProviderAccessRoleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeauthorizeCloudProviderAccessRoleOpts) Run() error { - params := &atlasv2.DeauthorizeCloudProviderAccessRoleApiParams{ +func (opts *DeauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error { + params := &admin.DeauthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, RoleId: opts.roleId, } - _, err := opts.store.DeauthorizeCloudProviderAccessRole(params) + _, err := opts.client.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(ctx, params) if err != nil { return err } @@ -173,43 +176,46 @@ func DeauthorizeCloudProviderAccessRoleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeauthorizeCloudProviderAccessRoleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + _ = cmd.MarkFlagRequired("cloudProvider") cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") + _ = cmd.MarkFlagRequired("roleId") return cmd } type GetCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetCloudProviderAccessRoleOperation + client admin.APIClient groupId string roleId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetCloudProviderAccessRoleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetCloudProviderAccessRoleOpts) Run() error { - params := &atlasv2.GetCloudProviderAccessRoleApiParams{ +func (opts *GetCloudProviderAccessRoleOpts) Run(ctx context.Context) error { + params := &admin.GetCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, RoleId: opts.roleId, } - resp, _, err := opts.store.GetCloudProviderAccessRole(params) + resp, _, err := opts.client.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(ctx, params) if err != nil { return err } @@ -229,40 +235,42 @@ func GetCloudProviderAccessRoleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetCloudProviderAccessRoleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") + _ = cmd.MarkFlagRequired("roleId") return cmd } type ListCloudProviderAccessRolesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListCloudProviderAccessRolesOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListCloudProviderAccessRolesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListCloudProviderAccessRolesOpts) Run() error { - params := &atlasv2.ListCloudProviderAccessRolesApiParams{ +func (opts *ListCloudProviderAccessRolesOpts) Run(ctx context.Context) error { + params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.ListCloudProviderAccessRoles(params) + resp, _, err := opts.client.CloudProviderAccessApi.ListCloudProviderAccessRolesWithParams(ctx, params) if err != nil { return err } @@ -282,16 +290,17 @@ func ListCloudProviderAccessRolesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListCloudProviderAccessRolesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_cloud_provider_access_store.go b/internal/generated/api_cloud_provider_access_store.go deleted file mode 100644 index 102a063997..0000000000 --- a/internal/generated/api_cloud_provider_access_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_cloud_provider_access_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas AuthorizeCloudProviderAccessRoleOperation, CreateCloudProviderAccessRoleOperation, DeauthorizeCloudProviderAccessRoleOperation, GetCloudProviderAccessRoleOperation, ListCloudProviderAccessRolesOperation - -type AuthorizeCloudProviderAccessRoleOperation interface { - AuthorizeCloudProviderAccessRole (*atlasv2.AuthorizeCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccessRole, error) -} - -// AuthorizeCloudProviderAccessRole encapsulates the logic to manage different cloud providers. -func (s *Store) AuthorizeCloudProviderAccessRole(params *atlasv2.AuthorizeCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccessRole, error) { - result, _, err := s.clientv2.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateCloudProviderAccessRoleOperation interface { - CreateCloudProviderAccessRole (*atlasv2.CreateCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccessRole, error) -} - -// CreateCloudProviderAccessRole encapsulates the logic to manage different cloud providers. -func (s *Store) CreateCloudProviderAccessRole(params *atlasv2.CreateCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccessRole, error) { - result, _, err := s.clientv2.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeauthorizeCloudProviderAccessRoleOperation interface { - DeauthorizeCloudProviderAccessRole (*atlasv2.DeauthorizeCloudProviderAccessRoleApiParams) error -} - -// DeauthorizeCloudProviderAccessRole encapsulates the logic to manage different cloud providers. -func (s *Store) DeauthorizeCloudProviderAccessRole(params *atlasv2.DeauthorizeCloudProviderAccessRoleApiParams) (error) { - _, err := s.clientv2.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(s.ctx, params).Execute() - return err -} - -type GetCloudProviderAccessRoleOperation interface { - GetCloudProviderAccessRole (*atlasv2.GetCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccess, error) -} - -// GetCloudProviderAccessRole encapsulates the logic to manage different cloud providers. -func (s *Store) GetCloudProviderAccessRole(params *atlasv2.GetCloudProviderAccessRoleApiParams) (*atlasv2.CloudProviderAccess, error) { - result, _, err := s.clientv2.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListCloudProviderAccessRolesOperation interface { - ListCloudProviderAccessRoles (*atlasv2.ListCloudProviderAccessRolesApiParams) (*atlasv2.CloudProviderAccess, error) -} - -// ListCloudProviderAccessRoles encapsulates the logic to manage different cloud providers. -func (s *Store) ListCloudProviderAccessRoles(params *atlasv2.ListCloudProviderAccessRolesApiParams) (*atlasv2.CloudProviderAccess, error) { - result, _, err := s.clientv2.CloudProviderAccessApi.ListCloudProviderAccessRolesWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 4e2333f1b6..364070e1be 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type EndOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.EndOutageSimulationOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *EndOutageSimulationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *EndOutageSimulationOpts) Run() error { - params := &atlasv2.EndOutageSimulationApiParams{ +func (opts *EndOutageSimulationOpts) Run(ctx context.Context) error { + params := &admin.EndOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.EndOutageSimulation(params) + resp, _, err := opts.client.ClusterOutageSimulationApi.EndOutageSimulationWithParams(ctx, params) if err != nil { return err } @@ -64,42 +64,44 @@ func EndOutageSimulationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), EndOutageSimulationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type GetOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetOutageSimulationOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetOutageSimulationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetOutageSimulationOpts) Run() error { - params := &atlasv2.GetOutageSimulationApiParams{ +func (opts *GetOutageSimulationOpts) Run(ctx context.Context) error { + params := &admin.GetOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetOutageSimulation(params) + resp, _, err := opts.client.ClusterOutageSimulationApi.GetOutageSimulationWithParams(ctx, params) if err != nil { return err } @@ -119,42 +121,44 @@ func GetOutageSimulationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetOutageSimulationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type StartOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.StartOutageSimulationOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *StartOutageSimulationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *StartOutageSimulationOpts) Run() error { - params := &atlasv2.StartOutageSimulationApiParams{ +func (opts *StartOutageSimulationOpts) Run(ctx context.Context) error { + params := &admin.StartOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.StartOutageSimulation(params) + resp, _, err := opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params) if err != nil { return err } @@ -174,17 +178,19 @@ func StartOutageSimulationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), StartOutageSimulationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/generated/api_cluster_outage_simulation_store.go b/internal/generated/api_cluster_outage_simulation_store.go deleted file mode 100644 index 74b0be7b8c..0000000000 --- a/internal/generated/api_cluster_outage_simulation_store.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_cluster_outage_simulation_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas EndOutageSimulationOperation, GetOutageSimulationOperation, StartOutageSimulationOperation - -type EndOutageSimulationOperation interface { - EndOutageSimulation (*atlasv2.EndOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) -} - -// EndOutageSimulation encapsulates the logic to manage different cloud providers. -func (s *Store) EndOutageSimulation(params *atlasv2.EndOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) { - result, _, err := s.clientv2.ClusterOutageSimulationApi.EndOutageSimulationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetOutageSimulationOperation interface { - GetOutageSimulation (*atlasv2.GetOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) -} - -// GetOutageSimulation encapsulates the logic to manage different cloud providers. -func (s *Store) GetOutageSimulation(params *atlasv2.GetOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) { - result, _, err := s.clientv2.ClusterOutageSimulationApi.GetOutageSimulationWithParams(s.ctx, params).Execute() - return &result, err -} - -type StartOutageSimulationOperation interface { - StartOutageSimulation (*atlasv2.StartOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) -} - -// StartOutageSimulation encapsulates the logic to manage different cloud providers. -func (s *Store) StartOutageSimulation(params *atlasv2.StartOutageSimulationApiParams) (*atlasv2.ClusterOutageSimulation, error) { - result, _, err := s.clientv2.ClusterOutageSimulationApi.StartOutageSimulationWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 1ebabedc0d..602f96adbc 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type GetClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetClusterAdvancedConfigurationOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetClusterAdvancedConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetClusterAdvancedConfigurationOpts) Run() error { - params := &atlasv2.GetClusterAdvancedConfigurationApiParams{ +func (opts *GetClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { + params := &admin.GetClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetClusterAdvancedConfiguration(params) + resp, _, err := opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params) if err != nil { return err } @@ -64,42 +64,44 @@ func GetClusterAdvancedConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetClusterAdvancedConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type GetClusterStatusOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetClusterStatusOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetClusterStatusOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetClusterStatusOpts) Run() error { - params := &atlasv2.GetClusterStatusApiParams{ +func (opts *GetClusterStatusOpts) Run(ctx context.Context) error { + params := &admin.GetClusterStatusApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetClusterStatus(params) + resp, _, err := opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params) if err != nil { return err } @@ -119,42 +121,44 @@ func GetClusterStatusBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetClusterStatusTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type GetSampleDatasetLoadStatusOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetSampleDatasetLoadStatusOperation + client admin.APIClient groupId string sampleDatasetId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetSampleDatasetLoadStatusOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetSampleDatasetLoadStatusOpts) Run() error { - params := &atlasv2.GetSampleDatasetLoadStatusApiParams{ +func (opts *GetSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { + params := &admin.GetSampleDatasetLoadStatusApiParams{ GroupId: opts.groupId, SampleDatasetId: opts.sampleDatasetId, } - resp, _, err := opts.store.GetSampleDatasetLoadStatus(params) + resp, _, err := opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params) if err != nil { return err } @@ -174,24 +178,26 @@ func GetSampleDatasetLoadStatusBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetSampleDatasetLoadStatusTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", "usage description") + _ = cmd.MarkFlagRequired("sampleDatasetId") return cmd } type ListCloudProviderRegionsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListCloudProviderRegionsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -200,16 +206,16 @@ type ListCloudProviderRegionsOpts struct { tier string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListCloudProviderRegionsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListCloudProviderRegionsOpts) Run() error { - params := &atlasv2.ListCloudProviderRegionsApiParams{ +func (opts *ListCloudProviderRegionsOpts) Run(ctx context.Context) error { + params := &admin.ListCloudProviderRegionsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, @@ -217,7 +223,7 @@ func (opts *ListCloudProviderRegionsOpts) Run() error { Providers: opts.providers, Tier: opts.tier, } - resp, _, err := opts.store.ListCloudProviderRegions(params) + resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params) if err != nil { return err } @@ -237,16 +243,17 @@ func ListCloudProviderRegionsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListCloudProviderRegionsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -258,27 +265,27 @@ func ListCloudProviderRegionsBuilder() cobra.Command { type ListClustersForAllProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListClustersForAllProjectsOperation + client admin.APIClient includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListClustersForAllProjectsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListClustersForAllProjectsOpts) Run() error { - params := &atlasv2.ListClustersForAllProjectsApiParams{ +func (opts *ListClustersForAllProjectsOpts) Run(ctx context.Context) error { + params := &admin.ListClustersForAllProjectsApiParams{ IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListClustersForAllProjects(params) + resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params) if err != nil { return err } @@ -298,13 +305,13 @@ func ListClustersForAllProjectsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListClustersForAllProjectsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") @@ -316,25 +323,25 @@ func ListClustersForAllProjectsBuilder() cobra.Command { type LoadSampleDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - store store.LoadSampleDatasetOperation + client admin.APIClient groupId string name string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *LoadSampleDatasetOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *LoadSampleDatasetOpts) Run() error { - params := &atlasv2.LoadSampleDatasetApiParams{ +func (opts *LoadSampleDatasetOpts) Run(ctx context.Context) error { + params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.store.LoadSampleDataset(params) + resp, _, err := opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params) if err != nil { return err } @@ -354,42 +361,44 @@ func LoadSampleDatasetBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), LoadSampleDatasetTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + _ = cmd.MarkFlagRequired("name") return cmd } type UpdateClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateClusterAdvancedConfigurationOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateClusterAdvancedConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateClusterAdvancedConfigurationOpts) Run() error { - params := &atlasv2.UpdateClusterAdvancedConfigurationApiParams{ +func (opts *UpdateClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { + params := &admin.UpdateClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.UpdateClusterAdvancedConfiguration(params) + resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params) if err != nil { return err } @@ -409,40 +418,42 @@ func UpdateClusterAdvancedConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateClusterAdvancedConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type UpgradeSharedClusterOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpgradeSharedClusterOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpgradeSharedClusterOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpgradeSharedClusterOpts) Run() error { - params := &atlasv2.UpgradeSharedClusterApiParams{ +func (opts *UpgradeSharedClusterOpts) Run(ctx context.Context) error { + params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpgradeSharedCluster(params) + resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params) if err != nil { return err } @@ -462,39 +473,40 @@ func UpgradeSharedClusterBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpgradeSharedClusterTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpgradeSharedClusterToServerlessOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpgradeSharedClusterToServerlessOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpgradeSharedClusterToServerlessOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpgradeSharedClusterToServerlessOpts) Run() error { - params := &atlasv2.UpgradeSharedClusterToServerlessApiParams{ +func (opts *UpgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error { + params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpgradeSharedClusterToServerless(params) + resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params) if err != nil { return err } @@ -514,16 +526,17 @@ func UpgradeSharedClusterToServerlessBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpgradeSharedClusterToServerlessTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_clusters_store.go b/internal/generated/api_clusters_store.go deleted file mode 100644 index 0b981a278d..0000000000 --- a/internal/generated/api_clusters_store.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_clusters_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetClusterAdvancedConfigurationOperation, GetClusterStatusOperation, GetSampleDatasetLoadStatusOperation, ListCloudProviderRegionsOperation, ListClustersForAllProjectsOperation, LoadSampleDatasetOperation, UpdateClusterAdvancedConfigurationOperation, UpgradeSharedClusterOperation, UpgradeSharedClusterToServerlessOperation - -type GetClusterAdvancedConfigurationOperation interface { - GetClusterAdvancedConfiguration (*atlasv2.GetClusterAdvancedConfigurationApiParams) (*atlasv2.ClusterDescriptionProcessArgs, error) -} - -// GetClusterAdvancedConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) GetClusterAdvancedConfiguration(params *atlasv2.GetClusterAdvancedConfigurationApiParams) (*atlasv2.ClusterDescriptionProcessArgs, error) { - result, _, err := s.clientv2.ClustersApi.GetClusterAdvancedConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetClusterStatusOperation interface { - GetClusterStatus (*atlasv2.GetClusterStatusApiParams) (*atlasv2.ClusterStatus, error) -} - -// GetClusterStatus encapsulates the logic to manage different cloud providers. -func (s *Store) GetClusterStatus(params *atlasv2.GetClusterStatusApiParams) (*atlasv2.ClusterStatus, error) { - result, _, err := s.clientv2.ClustersApi.GetClusterStatusWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetSampleDatasetLoadStatusOperation interface { - GetSampleDatasetLoadStatus (*atlasv2.GetSampleDatasetLoadStatusApiParams) (*atlasv2.SampleDatasetStatus, error) -} - -// GetSampleDatasetLoadStatus encapsulates the logic to manage different cloud providers. -func (s *Store) GetSampleDatasetLoadStatus(params *atlasv2.GetSampleDatasetLoadStatusApiParams) (*atlasv2.SampleDatasetStatus, error) { - result, _, err := s.clientv2.ClustersApi.GetSampleDatasetLoadStatusWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListCloudProviderRegionsOperation interface { - ListCloudProviderRegions (*atlasv2.ListCloudProviderRegionsApiParams) (*atlasv2.PaginatedApiAtlasProviderRegions, error) -} - -// ListCloudProviderRegions encapsulates the logic to manage different cloud providers. -func (s *Store) ListCloudProviderRegions(params *atlasv2.ListCloudProviderRegionsApiParams) (*atlasv2.PaginatedApiAtlasProviderRegions, error) { - result, _, err := s.clientv2.ClustersApi.ListCloudProviderRegionsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListClustersForAllProjectsOperation interface { - ListClustersForAllProjects (*atlasv2.ListClustersForAllProjectsApiParams) (*atlasv2.PaginatedOrgGroup, error) -} - -// ListClustersForAllProjects encapsulates the logic to manage different cloud providers. -func (s *Store) ListClustersForAllProjects(params *atlasv2.ListClustersForAllProjectsApiParams) (*atlasv2.PaginatedOrgGroup, error) { - result, _, err := s.clientv2.ClustersApi.ListClustersForAllProjectsWithParams(s.ctx, params).Execute() - return &result, err -} - -type LoadSampleDatasetOperation interface { - LoadSampleDataset (*atlasv2.LoadSampleDatasetApiParams) (*atlasv2.SampleDatasetStatus, error) -} - -// LoadSampleDataset encapsulates the logic to manage different cloud providers. -func (s *Store) LoadSampleDataset(params *atlasv2.LoadSampleDatasetApiParams) (*atlasv2.SampleDatasetStatus, error) { - result, _, err := s.clientv2.ClustersApi.LoadSampleDatasetWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateClusterAdvancedConfigurationOperation interface { - UpdateClusterAdvancedConfiguration (*atlasv2.UpdateClusterAdvancedConfigurationApiParams) (*atlasv2.ClusterDescriptionProcessArgs, error) -} - -// UpdateClusterAdvancedConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateClusterAdvancedConfiguration(params *atlasv2.UpdateClusterAdvancedConfigurationApiParams) (*atlasv2.ClusterDescriptionProcessArgs, error) { - result, _, err := s.clientv2.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpgradeSharedClusterOperation interface { - UpgradeSharedCluster (*atlasv2.UpgradeSharedClusterApiParams) (*atlasv2.LegacyClusterDescription, error) -} - -// UpgradeSharedCluster encapsulates the logic to manage different cloud providers. -func (s *Store) UpgradeSharedCluster(params *atlasv2.UpgradeSharedClusterApiParams) (*atlasv2.LegacyClusterDescription, error) { - result, _, err := s.clientv2.ClustersApi.UpgradeSharedClusterWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpgradeSharedClusterToServerlessOperation interface { - UpgradeSharedClusterToServerless (*atlasv2.UpgradeSharedClusterToServerlessApiParams) (*atlasv2.ServerlessInstanceDescription, error) -} - -// UpgradeSharedClusterToServerless encapsulates the logic to manage different cloud providers. -func (s *Store) UpgradeSharedClusterToServerless(params *atlasv2.UpgradeSharedClusterToServerlessApiParams) (*atlasv2.ServerlessInstanceDescription, error) { - result, _, err := s.clientv2.ClustersApi.UpgradeSharedClusterToServerlessWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index b4d8ca3037..300eb888c9 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateCustomDatabaseRoleOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateCustomDatabaseRoleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateCustomDatabaseRoleOpts) Run() error { - params := &atlasv2.CreateCustomDatabaseRoleApiParams{ +func (opts *CreateCustomDatabaseRoleOpts) Run(ctx context.Context) error { + params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateCustomDatabaseRole(params) + resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params) if err != nil { return err } @@ -62,41 +62,42 @@ func CreateCustomDatabaseRoleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateCustomDatabaseRoleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeleteCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteCustomDatabaseRoleOperation + client admin.APIClient groupId string roleName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteCustomDatabaseRoleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteCustomDatabaseRoleOpts) Run() error { - params := &atlasv2.DeleteCustomDatabaseRoleApiParams{ +func (opts *DeleteCustomDatabaseRoleOpts) Run(ctx context.Context) error { + params := &admin.DeleteCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, } - _, err := opts.store.DeleteCustomDatabaseRole(params) + _, err := opts.client.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(ctx, params) if err != nil { return err } @@ -116,42 +117,44 @@ func DeleteCustomDatabaseRoleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteCustomDatabaseRoleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") + _ = cmd.MarkFlagRequired("roleName") return cmd } type GetCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetCustomDatabaseRoleOperation + client admin.APIClient groupId string roleName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetCustomDatabaseRoleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetCustomDatabaseRoleOpts) Run() error { - params := &atlasv2.GetCustomDatabaseRoleApiParams{ +func (opts *GetCustomDatabaseRoleOpts) Run(ctx context.Context) error { + params := &admin.GetCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, } - resp, _, err := opts.store.GetCustomDatabaseRole(params) + resp, _, err := opts.client.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(ctx, params) if err != nil { return err } @@ -171,40 +174,42 @@ func GetCustomDatabaseRoleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetCustomDatabaseRoleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") + _ = cmd.MarkFlagRequired("roleName") return cmd } type ListCustomDatabaseRolesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListCustomDatabaseRolesOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListCustomDatabaseRolesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListCustomDatabaseRolesOpts) Run() error { - params := &atlasv2.ListCustomDatabaseRolesApiParams{ +func (opts *ListCustomDatabaseRolesOpts) Run(ctx context.Context) error { + params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.ListCustomDatabaseRoles(params) + resp, _, err := opts.client.CustomDatabaseRolesApi.ListCustomDatabaseRolesWithParams(ctx, params) if err != nil { return err } @@ -224,41 +229,42 @@ func ListCustomDatabaseRolesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListCustomDatabaseRolesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpdateCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateCustomDatabaseRoleOperation + client admin.APIClient groupId string roleName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateCustomDatabaseRoleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateCustomDatabaseRoleOpts) Run() error { - params := &atlasv2.UpdateCustomDatabaseRoleApiParams{ +func (opts *UpdateCustomDatabaseRoleOpts) Run(ctx context.Context) error { + params := &admin.UpdateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, } - resp, _, err := opts.store.UpdateCustomDatabaseRole(params) + resp, _, err := opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params) if err != nil { return err } @@ -278,17 +284,19 @@ func UpdateCustomDatabaseRoleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateCustomDatabaseRoleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") + _ = cmd.MarkFlagRequired("roleName") return cmd } diff --git a/internal/generated/api_custom_database_roles_store.go b/internal/generated/api_custom_database_roles_store.go deleted file mode 100644 index a187743efc..0000000000 --- a/internal/generated/api_custom_database_roles_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_custom_database_roles_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateCustomDatabaseRoleOperation, DeleteCustomDatabaseRoleOperation, GetCustomDatabaseRoleOperation, ListCustomDatabaseRolesOperation, UpdateCustomDatabaseRoleOperation - -type CreateCustomDatabaseRoleOperation interface { - CreateCustomDatabaseRole (*atlasv2.CreateCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) -} - -// CreateCustomDatabaseRole encapsulates the logic to manage different cloud providers. -func (s *Store) CreateCustomDatabaseRole(params *atlasv2.CreateCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) { - result, _, err := s.clientv2.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteCustomDatabaseRoleOperation interface { - DeleteCustomDatabaseRole (*atlasv2.DeleteCustomDatabaseRoleApiParams) error -} - -// DeleteCustomDatabaseRole encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteCustomDatabaseRole(params *atlasv2.DeleteCustomDatabaseRoleApiParams) (error) { - _, err := s.clientv2.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(s.ctx, params).Execute() - return err -} - -type GetCustomDatabaseRoleOperation interface { - GetCustomDatabaseRole (*atlasv2.GetCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) -} - -// GetCustomDatabaseRole encapsulates the logic to manage different cloud providers. -func (s *Store) GetCustomDatabaseRole(params *atlasv2.GetCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) { - result, _, err := s.clientv2.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListCustomDatabaseRolesOperation interface { - ListCustomDatabaseRoles (*atlasv2.ListCustomDatabaseRolesApiParams) (*atlasv2.[]CustomDBRole, error) -} - -// ListCustomDatabaseRoles encapsulates the logic to manage different cloud providers. -func (s *Store) ListCustomDatabaseRoles(params *atlasv2.ListCustomDatabaseRolesApiParams) (*atlasv2.[]CustomDBRole, error) { - result, _, err := s.clientv2.CustomDatabaseRolesApi.ListCustomDatabaseRolesWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateCustomDatabaseRoleOperation interface { - UpdateCustomDatabaseRole (*atlasv2.UpdateCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) -} - -// UpdateCustomDatabaseRole encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateCustomDatabaseRole(params *atlasv2.UpdateCustomDatabaseRoleApiParams) (*atlasv2.CustomDBRole, error) { - result, _, err := s.clientv2.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index be9a391b26..dce2d32804 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateDataFederationPrivateEndpointOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateDataFederationPrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateDataFederationPrivateEndpointOpts) Run() error { - params := &atlasv2.CreateDataFederationPrivateEndpointApiParams{ +func (opts *CreateDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateDataFederationPrivateEndpoint(params) + resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -62,41 +62,42 @@ func CreateDataFederationPrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateDataFederationPrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type CreateFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateFederatedDatabaseOperation + client admin.APIClient groupId string skipRoleValidation bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateFederatedDatabaseOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateFederatedDatabaseOpts) Run() error { - params := &atlasv2.CreateFederatedDatabaseApiParams{ +func (opts *CreateFederatedDatabaseOpts) Run(ctx context.Context) error { + params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, SkipRoleValidation: opts.skipRoleValidation, } - resp, _, err := opts.store.CreateFederatedDatabase(params) + resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params) if err != nil { return err } @@ -116,16 +117,17 @@ func CreateFederatedDatabaseBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateFederatedDatabaseTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", "", "usage description") return cmd @@ -133,27 +135,27 @@ func CreateFederatedDatabaseBuilder() cobra.Command { type CreateOneDataFederationQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateOneDataFederationQueryLimitOperation + client admin.APIClient groupId string tenantName string limitName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateOneDataFederationQueryLimitOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateOneDataFederationQueryLimitOpts) Run() error { - params := &atlasv2.CreateOneDataFederationQueryLimitApiParams{ +func (opts *CreateOneDataFederationQueryLimitOpts) Run(ctx context.Context) error { + params := &admin.CreateOneDataFederationQueryLimitApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, LimitName: opts.limitName, } - resp, _, err := opts.store.CreateOneDataFederationQueryLimit(params) + resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params) if err != nil { return err } @@ -173,43 +175,46 @@ func CreateOneDataFederationQueryLimitBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateOneDataFederationQueryLimitTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + _ = cmd.MarkFlagRequired("tenantName") cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + _ = cmd.MarkFlagRequired("limitName") return cmd } type DeleteDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteDataFederationPrivateEndpointOperation + client admin.APIClient groupId string endpointId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteDataFederationPrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteDataFederationPrivateEndpointOpts) Run() error { - params := &atlasv2.DeleteDataFederationPrivateEndpointApiParams{ +func (opts *DeleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.DeleteDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, EndpointId: opts.endpointId, } - resp, _, err := opts.store.DeleteDataFederationPrivateEndpoint(params) + resp, _, err := opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -229,42 +234,44 @@ func DeleteDataFederationPrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteDataFederationPrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointId") return cmd } type DeleteFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteFederatedDatabaseOperation + client admin.APIClient groupId string tenantName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteFederatedDatabaseOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteFederatedDatabaseOpts) Run() error { - params := &atlasv2.DeleteFederatedDatabaseApiParams{ +func (opts *DeleteFederatedDatabaseOpts) Run(ctx context.Context) error { + params := &admin.DeleteFederatedDatabaseApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.store.DeleteFederatedDatabase(params) + resp, _, err := opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params) if err != nil { return err } @@ -284,44 +291,46 @@ func DeleteFederatedDatabaseBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteFederatedDatabaseTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + _ = cmd.MarkFlagRequired("tenantName") return cmd } type DeleteOneDataFederationInstanceQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteOneDataFederationInstanceQueryLimitOperation + client admin.APIClient groupId string tenantName string limitName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) Run() error { - params := &atlasv2.DeleteOneDataFederationInstanceQueryLimitApiParams{ +func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Context) error { + params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, LimitName: opts.limitName, } - resp, _, err := opts.store.DeleteOneDataFederationInstanceQueryLimit(params) + resp, _, err := opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params) if err != nil { return err } @@ -341,47 +350,50 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteOneDataFederationInstanceQueryLimitTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + _ = cmd.MarkFlagRequired("tenantName") cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + _ = cmd.MarkFlagRequired("limitName") return cmd } type DownloadFederatedDatabaseQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DownloadFederatedDatabaseQueryLogsOperation + client admin.APIClient groupId string tenantName string endDate int64 startDate int64 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DownloadFederatedDatabaseQueryLogsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DownloadFederatedDatabaseQueryLogsOpts) Run() error { - params := &atlasv2.DownloadFederatedDatabaseQueryLogsApiParams{ +func (opts *DownloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) error { + params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, EndDate: opts.endDate, StartDate: opts.startDate, } - resp, _, err := opts.store.DownloadFederatedDatabaseQueryLogs(params) + resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params) if err != nil { return err } @@ -401,17 +413,19 @@ func DownloadFederatedDatabaseQueryLogsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DownloadFederatedDatabaseQueryLogsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + _ = cmd.MarkFlagRequired("tenantName") cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") @@ -420,25 +434,25 @@ func DownloadFederatedDatabaseQueryLogsBuilder() cobra.Command { type GetDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetDataFederationPrivateEndpointOperation + client admin.APIClient groupId string endpointId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetDataFederationPrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetDataFederationPrivateEndpointOpts) Run() error { - params := &atlasv2.GetDataFederationPrivateEndpointApiParams{ +func (opts *GetDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.GetDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, EndpointId: opts.endpointId, } - resp, _, err := opts.store.GetDataFederationPrivateEndpoint(params) + resp, _, err := opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -458,42 +472,44 @@ func GetDataFederationPrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetDataFederationPrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointId") return cmd } type GetFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetFederatedDatabaseOperation + client admin.APIClient groupId string tenantName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetFederatedDatabaseOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetFederatedDatabaseOpts) Run() error { - params := &atlasv2.GetFederatedDatabaseApiParams{ +func (opts *GetFederatedDatabaseOpts) Run(ctx context.Context) error { + params := &admin.GetFederatedDatabaseApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.store.GetFederatedDatabase(params) + resp, _, err := opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params) if err != nil { return err } @@ -513,46 +529,48 @@ func GetFederatedDatabaseBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetFederatedDatabaseTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + _ = cmd.MarkFlagRequired("tenantName") return cmd } type ListDataFederationPrivateEndpointsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListDataFederationPrivateEndpointsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListDataFederationPrivateEndpointsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListDataFederationPrivateEndpointsOpts) Run() error { - params := &atlasv2.ListDataFederationPrivateEndpointsApiParams{ +func (opts *ListDataFederationPrivateEndpointsOpts) Run(ctx context.Context) error { + params := &admin.ListDataFederationPrivateEndpointsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListDataFederationPrivateEndpoints(params) + resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params) if err != nil { return err } @@ -572,16 +590,17 @@ func ListDataFederationPrivateEndpointsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListDataFederationPrivateEndpointsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -591,25 +610,25 @@ func ListDataFederationPrivateEndpointsBuilder() cobra.Command { type ListFederatedDatabasesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListFederatedDatabasesOperation + client admin.APIClient groupId string type_ string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListFederatedDatabasesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListFederatedDatabasesOpts) Run() error { - params := &atlasv2.ListFederatedDatabasesApiParams{ +func (opts *ListFederatedDatabasesOpts) Run(ctx context.Context) error { + params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, Type_: opts.type_, } - resp, _, err := opts.store.ListFederatedDatabases(params) + resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params) if err != nil { return err } @@ -629,16 +648,17 @@ func ListFederatedDatabasesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListFederatedDatabasesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.type_, "type_", "", "usage description") return cmd @@ -646,27 +666,27 @@ func ListFederatedDatabasesBuilder() cobra.Command { type ReturnFederatedDatabaseQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ReturnFederatedDatabaseQueryLimitOperation + client admin.APIClient groupId string tenantName string limitName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ReturnFederatedDatabaseQueryLimitOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ReturnFederatedDatabaseQueryLimitOpts) Run() error { - params := &atlasv2.ReturnFederatedDatabaseQueryLimitApiParams{ +func (opts *ReturnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context) error { + params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, LimitName: opts.limitName, } - resp, _, err := opts.store.ReturnFederatedDatabaseQueryLimit(params) + resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params) if err != nil { return err } @@ -686,43 +706,46 @@ func ReturnFederatedDatabaseQueryLimitBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ReturnFederatedDatabaseQueryLimitTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + _ = cmd.MarkFlagRequired("tenantName") cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + _ = cmd.MarkFlagRequired("limitName") return cmd } type ReturnFederatedDatabaseQueryLimitsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ReturnFederatedDatabaseQueryLimitsOperation + client admin.APIClient groupId string tenantName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ReturnFederatedDatabaseQueryLimitsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ReturnFederatedDatabaseQueryLimitsOpts) Run() error { - params := &atlasv2.ReturnFederatedDatabaseQueryLimitsApiParams{ +func (opts *ReturnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) error { + params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.store.ReturnFederatedDatabaseQueryLimits(params) + resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params) if err != nil { return err } @@ -742,44 +765,46 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ReturnFederatedDatabaseQueryLimitsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + _ = cmd.MarkFlagRequired("tenantName") return cmd } type UpdateFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateFederatedDatabaseOperation + client admin.APIClient groupId string tenantName string skipRoleValidation bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateFederatedDatabaseOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateFederatedDatabaseOpts) Run() error { - params := &atlasv2.UpdateFederatedDatabaseApiParams{ +func (opts *UpdateFederatedDatabaseOpts) Run(ctx context.Context) error { + params := &admin.UpdateFederatedDatabaseApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, SkipRoleValidation: opts.skipRoleValidation, } - resp, _, err := opts.store.UpdateFederatedDatabase(params) + resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params) if err != nil { return err } @@ -799,17 +824,19 @@ func UpdateFederatedDatabaseBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateFederatedDatabaseTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") + _ = cmd.MarkFlagRequired("tenantName") cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", "", "usage description") return cmd diff --git a/internal/generated/api_data_federation_store.go b/internal/generated/api_data_federation_store.go deleted file mode 100644 index 287c5d974b..0000000000 --- a/internal/generated/api_data_federation_store.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_data_federation_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateDataFederationPrivateEndpointOperation, CreateFederatedDatabaseOperation, CreateOneDataFederationQueryLimitOperation, DeleteDataFederationPrivateEndpointOperation, DeleteFederatedDatabaseOperation, DeleteOneDataFederationInstanceQueryLimitOperation, DownloadFederatedDatabaseQueryLogsOperation, GetDataFederationPrivateEndpointOperation, GetFederatedDatabaseOperation, ListDataFederationPrivateEndpointsOperation, ListFederatedDatabasesOperation, ReturnFederatedDatabaseQueryLimitOperation, ReturnFederatedDatabaseQueryLimitsOperation, UpdateFederatedDatabaseOperation - -type CreateDataFederationPrivateEndpointOperation interface { - CreateDataFederationPrivateEndpoint (*atlasv2.CreateDataFederationPrivateEndpointApiParams) (*atlasv2.PaginatedPrivateNetworkEndpointIdEntry, error) -} - -// CreateDataFederationPrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) CreateDataFederationPrivateEndpoint(params *atlasv2.CreateDataFederationPrivateEndpointApiParams) (*atlasv2.PaginatedPrivateNetworkEndpointIdEntry, error) { - result, _, err := s.clientv2.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateFederatedDatabaseOperation interface { - CreateFederatedDatabase (*atlasv2.CreateFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) -} - -// CreateFederatedDatabase encapsulates the logic to manage different cloud providers. -func (s *Store) CreateFederatedDatabase(params *atlasv2.CreateFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) { - result, _, err := s.clientv2.DataFederationApi.CreateFederatedDatabaseWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateOneDataFederationQueryLimitOperation interface { - CreateOneDataFederationQueryLimit (*atlasv2.CreateOneDataFederationQueryLimitApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) -} - -// CreateOneDataFederationQueryLimit encapsulates the logic to manage different cloud providers. -func (s *Store) CreateOneDataFederationQueryLimit(params *atlasv2.CreateOneDataFederationQueryLimitApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) { - result, _, err := s.clientv2.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteDataFederationPrivateEndpointOperation interface { - DeleteDataFederationPrivateEndpoint (*atlasv2.DeleteDataFederationPrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteDataFederationPrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteDataFederationPrivateEndpoint(params *atlasv2.DeleteDataFederationPrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteFederatedDatabaseOperation interface { - DeleteFederatedDatabase (*atlasv2.DeleteFederatedDatabaseApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteFederatedDatabase encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteFederatedDatabase(params *atlasv2.DeleteFederatedDatabaseApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.DataFederationApi.DeleteFederatedDatabaseWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteOneDataFederationInstanceQueryLimitOperation interface { - DeleteOneDataFederationInstanceQueryLimit (*atlasv2.DeleteOneDataFederationInstanceQueryLimitApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteOneDataFederationInstanceQueryLimit encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteOneDataFederationInstanceQueryLimit(params *atlasv2.DeleteOneDataFederationInstanceQueryLimitApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(s.ctx, params).Execute() - return &result, err -} - -type DownloadFederatedDatabaseQueryLogsOperation interface { - DownloadFederatedDatabaseQueryLogs (*atlasv2.DownloadFederatedDatabaseQueryLogsApiParams) (*atlasv2.*os.File, error) -} - -// DownloadFederatedDatabaseQueryLogs encapsulates the logic to manage different cloud providers. -func (s *Store) DownloadFederatedDatabaseQueryLogs(params *atlasv2.DownloadFederatedDatabaseQueryLogsApiParams) (*atlasv2.*os.File, error) { - result, _, err := s.clientv2.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetDataFederationPrivateEndpointOperation interface { - GetDataFederationPrivateEndpoint (*atlasv2.GetDataFederationPrivateEndpointApiParams) (*atlasv2.PrivateNetworkEndpointIdEntry, error) -} - -// GetDataFederationPrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) GetDataFederationPrivateEndpoint(params *atlasv2.GetDataFederationPrivateEndpointApiParams) (*atlasv2.PrivateNetworkEndpointIdEntry, error) { - result, _, err := s.clientv2.DataFederationApi.GetDataFederationPrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetFederatedDatabaseOperation interface { - GetFederatedDatabase (*atlasv2.GetFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) -} - -// GetFederatedDatabase encapsulates the logic to manage different cloud providers. -func (s *Store) GetFederatedDatabase(params *atlasv2.GetFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) { - result, _, err := s.clientv2.DataFederationApi.GetFederatedDatabaseWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListDataFederationPrivateEndpointsOperation interface { - ListDataFederationPrivateEndpoints (*atlasv2.ListDataFederationPrivateEndpointsApiParams) (*atlasv2.PaginatedPrivateNetworkEndpointIdEntry, error) -} - -// ListDataFederationPrivateEndpoints encapsulates the logic to manage different cloud providers. -func (s *Store) ListDataFederationPrivateEndpoints(params *atlasv2.ListDataFederationPrivateEndpointsApiParams) (*atlasv2.PaginatedPrivateNetworkEndpointIdEntry, error) { - result, _, err := s.clientv2.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListFederatedDatabasesOperation interface { - ListFederatedDatabases (*atlasv2.ListFederatedDatabasesApiParams) (*atlasv2.[]DataLakeTenant, error) -} - -// ListFederatedDatabases encapsulates the logic to manage different cloud providers. -func (s *Store) ListFederatedDatabases(params *atlasv2.ListFederatedDatabasesApiParams) (*atlasv2.[]DataLakeTenant, error) { - result, _, err := s.clientv2.DataFederationApi.ListFederatedDatabasesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ReturnFederatedDatabaseQueryLimitOperation interface { - ReturnFederatedDatabaseQueryLimit (*atlasv2.ReturnFederatedDatabaseQueryLimitApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) -} - -// ReturnFederatedDatabaseQueryLimit encapsulates the logic to manage different cloud providers. -func (s *Store) ReturnFederatedDatabaseQueryLimit(params *atlasv2.ReturnFederatedDatabaseQueryLimitApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) { - result, _, err := s.clientv2.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(s.ctx, params).Execute() - return &result, err -} - -type ReturnFederatedDatabaseQueryLimitsOperation interface { - ReturnFederatedDatabaseQueryLimits (*atlasv2.ReturnFederatedDatabaseQueryLimitsApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) -} - -// ReturnFederatedDatabaseQueryLimits encapsulates the logic to manage different cloud providers. -func (s *Store) ReturnFederatedDatabaseQueryLimits(params *atlasv2.ReturnFederatedDatabaseQueryLimitsApiParams) (*atlasv2.[]DataFederationTenantQueryLimit, error) { - result, _, err := s.clientv2.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateFederatedDatabaseOperation interface { - UpdateFederatedDatabase (*atlasv2.UpdateFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) -} - -// UpdateFederatedDatabase encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateFederatedDatabase(params *atlasv2.UpdateFederatedDatabaseApiParams) (*atlasv2.DataLakeTenant, error) { - result, _, err := s.clientv2.DataFederationApi.UpdateFederatedDatabaseWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 25e72782fe..7a64532b58 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreatePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreatePipelineOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreatePipelineOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreatePipelineOpts) Run() error { - params := &atlasv2.CreatePipelineApiParams{ +func (opts *CreatePipelineOpts) Run(ctx context.Context) error { + params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreatePipeline(params) + resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params) if err != nil { return err } @@ -62,41 +62,42 @@ func CreatePipelineBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreatePipelineTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeletePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeletePipelineOperation + client admin.APIClient groupId string pipelineName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeletePipelineOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeletePipelineOpts) Run() error { - params := &atlasv2.DeletePipelineApiParams{ +func (opts *DeletePipelineOpts) Run(ctx context.Context) error { + params := &admin.DeletePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.store.DeletePipeline(params) + resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params) if err != nil { return err } @@ -116,44 +117,46 @@ func DeletePipelineBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeletePipelineTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") return cmd } type DeletePipelineRunDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeletePipelineRunDatasetOperation + client admin.APIClient groupId string pipelineName string pipelineRunId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeletePipelineRunDatasetOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeletePipelineRunDatasetOpts) Run() error { - params := &atlasv2.DeletePipelineRunDatasetApiParams{ +func (opts *DeletePipelineRunDatasetOpts) Run(ctx context.Context) error { + params := &admin.DeletePipelineRunDatasetApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } - resp, _, err := opts.store.DeletePipelineRunDataset(params) + resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params) if err != nil { return err } @@ -173,43 +176,46 @@ func DeletePipelineRunDatasetBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeletePipelineRunDatasetTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineRunId") return cmd } type GetPipelineOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetPipelineOperation + client admin.APIClient groupId string pipelineName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetPipelineOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetPipelineOpts) Run() error { - params := &atlasv2.GetPipelineApiParams{ +func (opts *GetPipelineOpts) Run(ctx context.Context) error { + params := &admin.GetPipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.store.GetPipeline(params) + resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params) if err != nil { return err } @@ -229,44 +235,46 @@ func GetPipelineBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetPipelineTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") return cmd } type GetPipelineRunOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetPipelineRunOperation + client admin.APIClient groupId string pipelineName string pipelineRunId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetPipelineRunOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetPipelineRunOpts) Run() error { - params := &atlasv2.GetPipelineRunApiParams{ +func (opts *GetPipelineRunOpts) Run(ctx context.Context) error { + params := &admin.GetPipelineRunApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } - resp, _, err := opts.store.GetPipelineRun(params) + resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params) if err != nil { return err } @@ -286,25 +294,28 @@ func GetPipelineRunBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetPipelineRunTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineRunId") return cmd } type ListPipelineRunsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPipelineRunsOperation + client admin.APIClient groupId string pipelineName string includeCount bool @@ -313,16 +324,16 @@ type ListPipelineRunsOpts struct { createdBefore time.Time } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPipelineRunsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPipelineRunsOpts) Run() error { - params := &atlasv2.ListPipelineRunsApiParams{ +func (opts *ListPipelineRunsOpts) Run(ctx context.Context) error { + params := &admin.ListPipelineRunsApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, IncludeCount: opts.includeCount, @@ -330,7 +341,7 @@ func (opts *ListPipelineRunsOpts) Run() error { PageNum: opts.pageNum, CreatedBefore: opts.createdBefore, } - resp, _, err := opts.store.ListPipelineRuns(params) + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params) if err != nil { return err } @@ -350,17 +361,19 @@ func ListPipelineRunsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPipelineRunsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -371,25 +384,25 @@ func ListPipelineRunsBuilder() cobra.Command { type ListPipelineSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPipelineSchedulesOperation + client admin.APIClient groupId string pipelineName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPipelineSchedulesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPipelineSchedulesOpts) Run() error { - params := &atlasv2.ListPipelineSchedulesApiParams{ +func (opts *ListPipelineSchedulesOpts) Run(ctx context.Context) error { + params := &admin.ListPipelineSchedulesApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.store.ListPipelineSchedules(params) + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params) if err != nil { return err } @@ -409,24 +422,26 @@ func ListPipelineSchedulesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPipelineSchedulesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") return cmd } type ListPipelineSnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPipelineSnapshotsOperation + client admin.APIClient groupId string pipelineName string includeCount bool @@ -435,16 +450,16 @@ type ListPipelineSnapshotsOpts struct { completedAfter time.Time } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPipelineSnapshotsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPipelineSnapshotsOpts) Run() error { - params := &atlasv2.ListPipelineSnapshotsApiParams{ +func (opts *ListPipelineSnapshotsOpts) Run(ctx context.Context) error { + params := &admin.ListPipelineSnapshotsApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, IncludeCount: opts.includeCount, @@ -452,7 +467,7 @@ func (opts *ListPipelineSnapshotsOpts) Run() error { PageNum: opts.pageNum, CompletedAfter: opts.completedAfter, } - resp, _, err := opts.store.ListPipelineSnapshots(params) + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params) if err != nil { return err } @@ -472,17 +487,19 @@ func ListPipelineSnapshotsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPipelineSnapshotsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -493,23 +510,23 @@ func ListPipelineSnapshotsBuilder() cobra.Command { type ListPipelinesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPipelinesOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPipelinesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPipelinesOpts) Run() error { - params := &atlasv2.ListPipelinesApiParams{ +func (opts *ListPipelinesOpts) Run(ctx context.Context) error { + params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.ListPipelines(params) + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelinesWithParams(ctx, params) if err != nil { return err } @@ -529,41 +546,42 @@ func ListPipelinesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPipelinesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type PausePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - store store.PausePipelineOperation + client admin.APIClient groupId string pipelineName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *PausePipelineOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *PausePipelineOpts) Run() error { - params := &atlasv2.PausePipelineApiParams{ +func (opts *PausePipelineOpts) Run(ctx context.Context) error { + params := &admin.PausePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.store.PausePipeline(params) + resp, _, err := opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params) if err != nil { return err } @@ -583,42 +601,44 @@ func PausePipelineBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), PausePipelineTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") return cmd } type ResumePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ResumePipelineOperation + client admin.APIClient groupId string pipelineName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ResumePipelineOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ResumePipelineOpts) Run() error { - params := &atlasv2.ResumePipelineApiParams{ +func (opts *ResumePipelineOpts) Run(ctx context.Context) error { + params := &admin.ResumePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.store.ResumePipeline(params) + resp, _, err := opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params) if err != nil { return err } @@ -638,42 +658,44 @@ func ResumePipelineBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ResumePipelineTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") return cmd } type TriggerSnapshotIngestionOpts struct { cli.GlobalOpts cli.OutputOpts - store store.TriggerSnapshotIngestionOperation + client admin.APIClient groupId string pipelineName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *TriggerSnapshotIngestionOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *TriggerSnapshotIngestionOpts) Run() error { - params := &atlasv2.TriggerSnapshotIngestionApiParams{ +func (opts *TriggerSnapshotIngestionOpts) Run(ctx context.Context) error { + params := &admin.TriggerSnapshotIngestionApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.store.TriggerSnapshotIngestion(params) + resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params) if err != nil { return err } @@ -693,42 +715,44 @@ func TriggerSnapshotIngestionBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), TriggerSnapshotIngestionTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") return cmd } type UpdatePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdatePipelineOperation + client admin.APIClient groupId string pipelineName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdatePipelineOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdatePipelineOpts) Run() error { - params := &atlasv2.UpdatePipelineApiParams{ +func (opts *UpdatePipelineOpts) Run(ctx context.Context) error { + params := &admin.UpdatePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.store.UpdatePipeline(params) + resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params) if err != nil { return err } @@ -748,17 +772,19 @@ func UpdatePipelineBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdatePipelineTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") + _ = cmd.MarkFlagRequired("pipelineName") return cmd } diff --git a/internal/generated/api_data_lake_pipelines_store.go b/internal/generated/api_data_lake_pipelines_store.go deleted file mode 100644 index 7e698928f4..0000000000 --- a/internal/generated/api_data_lake_pipelines_store.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_data_lake_pipelines_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreatePipelineOperation, DeletePipelineOperation, DeletePipelineRunDatasetOperation, GetPipelineOperation, GetPipelineRunOperation, ListPipelineRunsOperation, ListPipelineSchedulesOperation, ListPipelineSnapshotsOperation, ListPipelinesOperation, PausePipelineOperation, ResumePipelineOperation, TriggerSnapshotIngestionOperation, UpdatePipelineOperation - -type CreatePipelineOperation interface { - CreatePipeline (*atlasv2.CreatePipelineApiParams) (*atlasv2.IngestionPipeline, error) -} - -// CreatePipeline encapsulates the logic to manage different cloud providers. -func (s *Store) CreatePipeline(params *atlasv2.CreatePipelineApiParams) (*atlasv2.IngestionPipeline, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.CreatePipelineWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeletePipelineOperation interface { - DeletePipeline (*atlasv2.DeletePipelineApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeletePipeline encapsulates the logic to manage different cloud providers. -func (s *Store) DeletePipeline(params *atlasv2.DeletePipelineApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.DeletePipelineWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeletePipelineRunDatasetOperation interface { - DeletePipelineRunDataset (*atlasv2.DeletePipelineRunDatasetApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeletePipelineRunDataset encapsulates the logic to manage different cloud providers. -func (s *Store) DeletePipelineRunDataset(params *atlasv2.DeletePipelineRunDatasetApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetPipelineOperation interface { - GetPipeline (*atlasv2.GetPipelineApiParams) (*atlasv2.IngestionPipeline, error) -} - -// GetPipeline encapsulates the logic to manage different cloud providers. -func (s *Store) GetPipeline(params *atlasv2.GetPipelineApiParams) (*atlasv2.IngestionPipeline, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.GetPipelineWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetPipelineRunOperation interface { - GetPipelineRun (*atlasv2.GetPipelineRunApiParams) (*atlasv2.IngestionPipelineRun, error) -} - -// GetPipelineRun encapsulates the logic to manage different cloud providers. -func (s *Store) GetPipelineRun(params *atlasv2.GetPipelineRunApiParams) (*atlasv2.IngestionPipelineRun, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.GetPipelineRunWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPipelineRunsOperation interface { - ListPipelineRuns (*atlasv2.ListPipelineRunsApiParams) (*atlasv2.PaginatedPipelineRun, error) -} - -// ListPipelineRuns encapsulates the logic to manage different cloud providers. -func (s *Store) ListPipelineRuns(params *atlasv2.ListPipelineRunsApiParams) (*atlasv2.PaginatedPipelineRun, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.ListPipelineRunsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPipelineSchedulesOperation interface { - ListPipelineSchedules (*atlasv2.ListPipelineSchedulesApiParams) (*atlasv2.[]PolicyItem, error) -} - -// ListPipelineSchedules encapsulates the logic to manage different cloud providers. -func (s *Store) ListPipelineSchedules(params *atlasv2.ListPipelineSchedulesApiParams) (*atlasv2.[]PolicyItem, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.ListPipelineSchedulesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPipelineSnapshotsOperation interface { - ListPipelineSnapshots (*atlasv2.ListPipelineSnapshotsApiParams) (*atlasv2.PaginatedBackupSnapshot, error) -} - -// ListPipelineSnapshots encapsulates the logic to manage different cloud providers. -func (s *Store) ListPipelineSnapshots(params *atlasv2.ListPipelineSnapshotsApiParams) (*atlasv2.PaginatedBackupSnapshot, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPipelinesOperation interface { - ListPipelines (*atlasv2.ListPipelinesApiParams) (*atlasv2.[]IngestionPipeline, error) -} - -// ListPipelines encapsulates the logic to manage different cloud providers. -func (s *Store) ListPipelines(params *atlasv2.ListPipelinesApiParams) (*atlasv2.[]IngestionPipeline, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.ListPipelinesWithParams(s.ctx, params).Execute() - return &result, err -} - -type PausePipelineOperation interface { - PausePipeline (*atlasv2.PausePipelineApiParams) (*atlasv2.IngestionPipeline, error) -} - -// PausePipeline encapsulates the logic to manage different cloud providers. -func (s *Store) PausePipeline(params *atlasv2.PausePipelineApiParams) (*atlasv2.IngestionPipeline, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.PausePipelineWithParams(s.ctx, params).Execute() - return &result, err -} - -type ResumePipelineOperation interface { - ResumePipeline (*atlasv2.ResumePipelineApiParams) (*atlasv2.IngestionPipeline, error) -} - -// ResumePipeline encapsulates the logic to manage different cloud providers. -func (s *Store) ResumePipeline(params *atlasv2.ResumePipelineApiParams) (*atlasv2.IngestionPipeline, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.ResumePipelineWithParams(s.ctx, params).Execute() - return &result, err -} - -type TriggerSnapshotIngestionOperation interface { - TriggerSnapshotIngestion (*atlasv2.TriggerSnapshotIngestionApiParams) (*atlasv2.IngestionPipelineRun, error) -} - -// TriggerSnapshotIngestion encapsulates the logic to manage different cloud providers. -func (s *Store) TriggerSnapshotIngestion(params *atlasv2.TriggerSnapshotIngestionApiParams) (*atlasv2.IngestionPipelineRun, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdatePipelineOperation interface { - UpdatePipeline (*atlasv2.UpdatePipelineApiParams) (*atlasv2.IngestionPipeline, error) -} - -// UpdatePipeline encapsulates the logic to manage different cloud providers. -func (s *Store) UpdatePipeline(params *atlasv2.UpdatePipelineApiParams) (*atlasv2.IngestionPipeline, error) { - result, _, err := s.clientv2.DataLakePipelinesApi.UpdatePipelineWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 8918b7509b..58b4bfc884 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateDatabaseUserOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateDatabaseUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateDatabaseUserOpts) Run() error { - params := &atlasv2.CreateDatabaseUserApiParams{ +func (opts *CreateDatabaseUserOpts) Run(ctx context.Context) error { + params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateDatabaseUser(params) + resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params) if err != nil { return err } @@ -62,43 +62,44 @@ func CreateDatabaseUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateDatabaseUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeleteDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteDatabaseUserOperation + client admin.APIClient groupId string databaseName string username string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteDatabaseUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteDatabaseUserOpts) Run() error { - params := &atlasv2.DeleteDatabaseUserApiParams{ +func (opts *DeleteDatabaseUserOpts) Run(ctx context.Context) error { + params := &admin.DeleteDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, Username: opts.username, } - resp, _, err := opts.store.DeleteDatabaseUser(params) + resp, _, err := opts.client.DatabaseUsersApi.DeleteDatabaseUserWithParams(ctx, params) if err != nil { return err } @@ -118,45 +119,48 @@ func DeleteDatabaseUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteDatabaseUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + _ = cmd.MarkFlagRequired("databaseName") cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + _ = cmd.MarkFlagRequired("username") return cmd } type GetDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetDatabaseUserOperation + client admin.APIClient groupId string databaseName string username string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetDatabaseUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetDatabaseUserOpts) Run() error { - params := &atlasv2.GetDatabaseUserApiParams{ +func (opts *GetDatabaseUserOpts) Run(ctx context.Context) error { + params := &admin.GetDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, Username: opts.username, } - resp, _, err := opts.store.GetDatabaseUser(params) + resp, _, err := opts.client.DatabaseUsersApi.GetDatabaseUserWithParams(ctx, params) if err != nil { return err } @@ -176,47 +180,50 @@ func GetDatabaseUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetDatabaseUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + _ = cmd.MarkFlagRequired("databaseName") cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + _ = cmd.MarkFlagRequired("username") return cmd } type ListDatabaseUsersOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListDatabaseUsersOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListDatabaseUsersOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListDatabaseUsersOpts) Run() error { - params := &atlasv2.ListDatabaseUsersApiParams{ +func (opts *ListDatabaseUsersOpts) Run(ctx context.Context) error { + params := &admin.ListDatabaseUsersApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListDatabaseUsers(params) + resp, _, err := opts.client.DatabaseUsersApi.ListDatabaseUsersWithParams(ctx, params) if err != nil { return err } @@ -236,16 +243,17 @@ func ListDatabaseUsersBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListDatabaseUsersTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -255,27 +263,27 @@ func ListDatabaseUsersBuilder() cobra.Command { type UpdateDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateDatabaseUserOperation + client admin.APIClient groupId string databaseName string username string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateDatabaseUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateDatabaseUserOpts) Run() error { - params := &atlasv2.UpdateDatabaseUserApiParams{ +func (opts *UpdateDatabaseUserOpts) Run(ctx context.Context) error { + params := &admin.UpdateDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, Username: opts.username, } - resp, _, err := opts.store.UpdateDatabaseUser(params) + resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params) if err != nil { return err } @@ -295,18 +303,21 @@ func UpdateDatabaseUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateDatabaseUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + _ = cmd.MarkFlagRequired("databaseName") cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + _ = cmd.MarkFlagRequired("username") return cmd } diff --git a/internal/generated/api_database_users_store.go b/internal/generated/api_database_users_store.go deleted file mode 100644 index 66b73ca822..0000000000 --- a/internal/generated/api_database_users_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_database_users_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateDatabaseUserOperation, DeleteDatabaseUserOperation, GetDatabaseUserOperation, ListDatabaseUsersOperation, UpdateDatabaseUserOperation - -type CreateDatabaseUserOperation interface { - CreateDatabaseUser (*atlasv2.CreateDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) -} - -// CreateDatabaseUser encapsulates the logic to manage different cloud providers. -func (s *Store) CreateDatabaseUser(params *atlasv2.CreateDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) { - result, _, err := s.clientv2.DatabaseUsersApi.CreateDatabaseUserWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteDatabaseUserOperation interface { - DeleteDatabaseUser (*atlasv2.DeleteDatabaseUserApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteDatabaseUser encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteDatabaseUser(params *atlasv2.DeleteDatabaseUserApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.DatabaseUsersApi.DeleteDatabaseUserWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetDatabaseUserOperation interface { - GetDatabaseUser (*atlasv2.GetDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) -} - -// GetDatabaseUser encapsulates the logic to manage different cloud providers. -func (s *Store) GetDatabaseUser(params *atlasv2.GetDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) { - result, _, err := s.clientv2.DatabaseUsersApi.GetDatabaseUserWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListDatabaseUsersOperation interface { - ListDatabaseUsers (*atlasv2.ListDatabaseUsersApiParams) (*atlasv2.PaginatedApiAtlasDatabaseUser, error) -} - -// ListDatabaseUsers encapsulates the logic to manage different cloud providers. -func (s *Store) ListDatabaseUsers(params *atlasv2.ListDatabaseUsersApiParams) (*atlasv2.PaginatedApiAtlasDatabaseUser, error) { - result, _, err := s.clientv2.DatabaseUsersApi.ListDatabaseUsersWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateDatabaseUserOperation interface { - UpdateDatabaseUser (*atlasv2.UpdateDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) -} - -// UpdateDatabaseUser encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateDatabaseUser(params *atlasv2.UpdateDatabaseUserApiParams) (*atlasv2.DatabaseUser, error) { - result, _, err := s.clientv2.DatabaseUsersApi.UpdateDatabaseUserWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index 8d376c7a7a..2c0a138172 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type GetEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetEncryptionAtRestOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetEncryptionAtRestOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetEncryptionAtRestOpts) Run() error { - params := &atlasv2.GetEncryptionAtRestApiParams{ +func (opts *GetEncryptionAtRestOpts) Run(ctx context.Context) error { + params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetEncryptionAtRest(params) + resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRestWithParams(ctx, params) if err != nil { return err } @@ -62,39 +62,40 @@ func GetEncryptionAtRestBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetEncryptionAtRestTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpdateEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateEncryptionAtRestOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateEncryptionAtRestOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateEncryptionAtRestOpts) Run() error { - params := &atlasv2.UpdateEncryptionAtRestApiParams{ +func (opts *UpdateEncryptionAtRestOpts) Run(ctx context.Context) error { + params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpdateEncryptionAtRest(params) + resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params) if err != nil { return err } @@ -114,16 +115,17 @@ func UpdateEncryptionAtRestBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateEncryptionAtRestTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_store.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_store.go deleted file mode 100644 index 74969d0789..0000000000 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_store.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_encryption_at_rest_using_customer_key_management_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetEncryptionAtRestOperation, UpdateEncryptionAtRestOperation - -type GetEncryptionAtRestOperation interface { - GetEncryptionAtRest (*atlasv2.GetEncryptionAtRestApiParams) (*atlasv2.EncryptionAtRest, error) -} - -// GetEncryptionAtRest encapsulates the logic to manage different cloud providers. -func (s *Store) GetEncryptionAtRest(params *atlasv2.GetEncryptionAtRestApiParams) (*atlasv2.EncryptionAtRest, error) { - result, _, err := s.clientv2.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRestWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateEncryptionAtRestOperation interface { - UpdateEncryptionAtRest (*atlasv2.UpdateEncryptionAtRestApiParams) (*atlasv2.EncryptionAtRest, error) -} - -// UpdateEncryptionAtRest encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateEncryptionAtRest(params *atlasv2.UpdateEncryptionAtRestApiParams) (*atlasv2.EncryptionAtRest, error) { - result, _, err := s.clientv2.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index a6ed367121..d777b05d3d 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -19,34 +19,34 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type GetOrganizationEventOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetOrganizationEventOperation + client admin.APIClient orgId string eventId string includeRaw bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetOrganizationEventOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetOrganizationEventOpts) Run() error { - params := &atlasv2.GetOrganizationEventApiParams{ +func (opts *GetOrganizationEventOpts) Run(ctx context.Context) error { + params := &admin.GetOrganizationEventApiParams{ OrgId: opts.orgId, EventId: opts.eventId, IncludeRaw: opts.includeRaw, } - resp, _, err := opts.store.GetOrganizationEvent(params) + resp, _, err := opts.client.EventsApi.GetOrganizationEventWithParams(ctx, params) if err != nil { return err } @@ -66,17 +66,19 @@ func GetOrganizationEventBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetOrganizationEventTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.eventId, "eventId", "", "usage description") + _ = cmd.MarkFlagRequired("eventId") cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") return cmd @@ -84,27 +86,27 @@ func GetOrganizationEventBuilder() cobra.Command { type GetProjectEventOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetProjectEventOperation + client admin.APIClient groupId string eventId string includeRaw bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetProjectEventOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetProjectEventOpts) Run() error { - params := &atlasv2.GetProjectEventApiParams{ +func (opts *GetProjectEventOpts) Run(ctx context.Context) error { + params := &admin.GetProjectEventApiParams{ GroupId: opts.groupId, EventId: opts.eventId, IncludeRaw: opts.includeRaw, } - resp, _, err := opts.store.GetProjectEvent(params) + resp, _, err := opts.client.EventsApi.GetProjectEventWithParams(ctx, params) if err != nil { return err } @@ -124,17 +126,19 @@ func GetProjectEventBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetProjectEventTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.eventId, "eventId", "", "usage description") + _ = cmd.MarkFlagRequired("eventId") cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") return cmd @@ -142,7 +146,7 @@ func GetProjectEventBuilder() cobra.Command { type ListOrganizationEventsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListOrganizationEventsOperation + client admin.APIClient orgId string includeCount bool itemsPerPage int32 @@ -153,16 +157,16 @@ type ListOrganizationEventsOpts struct { minDate time.Time } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListOrganizationEventsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListOrganizationEventsOpts) Run() error { - params := &atlasv2.ListOrganizationEventsApiParams{ +func (opts *ListOrganizationEventsOpts) Run(ctx context.Context) error { + params := &admin.ListOrganizationEventsApiParams{ OrgId: opts.orgId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, @@ -172,7 +176,7 @@ func (opts *ListOrganizationEventsOpts) Run() error { MaxDate: opts.maxDate, MinDate: opts.minDate, } - resp, _, err := opts.store.ListOrganizationEvents(params) + resp, _, err := opts.client.EventsApi.ListOrganizationEventsWithParams(ctx, params) if err != nil { return err } @@ -192,16 +196,17 @@ func ListOrganizationEventsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListOrganizationEventsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -215,7 +220,7 @@ func ListOrganizationEventsBuilder() cobra.Command { type ListProjectEventsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListProjectEventsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -227,16 +232,16 @@ type ListProjectEventsOpts struct { minDate time.Time } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListProjectEventsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListProjectEventsOpts) Run() error { - params := &atlasv2.ListProjectEventsApiParams{ +func (opts *ListProjectEventsOpts) Run(ctx context.Context) error { + params := &admin.ListProjectEventsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, @@ -247,7 +252,7 @@ func (opts *ListProjectEventsOpts) Run() error { MaxDate: opts.maxDate, MinDate: opts.minDate, } - resp, _, err := opts.store.ListProjectEvents(params) + resp, _, err := opts.client.EventsApi.ListProjectEventsWithParams(ctx, params) if err != nil { return err } @@ -267,16 +272,17 @@ func ListProjectEventsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListProjectEventsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") diff --git a/internal/generated/api_events_store.go b/internal/generated/api_events_store.go deleted file mode 100644 index fe97519329..0000000000 --- a/internal/generated/api_events_store.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_events_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetOrganizationEventOperation, GetProjectEventOperation, ListOrganizationEventsOperation, ListProjectEventsOperation - -type GetOrganizationEventOperation interface { - GetOrganizationEvent (*atlasv2.GetOrganizationEventApiParams) (*atlasv2.EventViewForOrg, error) -} - -// GetOrganizationEvent encapsulates the logic to manage different cloud providers. -func (s *Store) GetOrganizationEvent(params *atlasv2.GetOrganizationEventApiParams) (*atlasv2.EventViewForOrg, error) { - result, _, err := s.clientv2.EventsApi.GetOrganizationEventWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetProjectEventOperation interface { - GetProjectEvent (*atlasv2.GetProjectEventApiParams) (*atlasv2.EventViewForNdsGroup, error) -} - -// GetProjectEvent encapsulates the logic to manage different cloud providers. -func (s *Store) GetProjectEvent(params *atlasv2.GetProjectEventApiParams) (*atlasv2.EventViewForNdsGroup, error) { - result, _, err := s.clientv2.EventsApi.GetProjectEventWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListOrganizationEventsOperation interface { - ListOrganizationEvents (*atlasv2.ListOrganizationEventsApiParams) (*atlasv2.OrgPaginatedEvent, error) -} - -// ListOrganizationEvents encapsulates the logic to manage different cloud providers. -func (s *Store) ListOrganizationEvents(params *atlasv2.ListOrganizationEventsApiParams) (*atlasv2.OrgPaginatedEvent, error) { - result, _, err := s.clientv2.EventsApi.ListOrganizationEventsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListProjectEventsOperation interface { - ListProjectEvents (*atlasv2.ListProjectEventsApiParams) (*atlasv2.GroupPaginatedEvent, error) -} - -// ListProjectEvents encapsulates the logic to manage different cloud providers. -func (s *Store) ListProjectEvents(params *atlasv2.ListProjectEventsApiParams) (*atlasv2.GroupPaginatedEvent, error) { - result, _, err := s.clientv2.EventsApi.ListProjectEventsWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index 67edba0b59..d26167848b 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateRoleMappingOperation + client admin.APIClient federationSettingsId string orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateRoleMappingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateRoleMappingOpts) Run() error { - params := &atlasv2.CreateRoleMappingApiParams{ +func (opts *CreateRoleMappingOpts) Run(ctx context.Context) error { + params := &admin.CreateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.store.CreateRoleMapping(params) + resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params) if err != nil { return err } @@ -64,40 +64,42 @@ func CreateRoleMappingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateRoleMappingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type DeleteFederationAppOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteFederationAppOperation + client admin.APIClient federationSettingsId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteFederationAppOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteFederationAppOpts) Run() error { - params := &atlasv2.DeleteFederationAppApiParams{ +func (opts *DeleteFederationAppOpts) Run(ctx context.Context) error { + params := &admin.DeleteFederationAppApiParams{ FederationSettingsId: opts.federationSettingsId, } - _, err := opts.store.DeleteFederationApp(params) + _, err := opts.client.FederatedAuthenticationApi.DeleteFederationAppWithParams(ctx, params) if err != nil { return err } @@ -117,43 +119,44 @@ func DeleteFederationAppBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteFederationAppTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } type DeleteRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteRoleMappingOperation + client admin.APIClient federationSettingsId string id string orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteRoleMappingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteRoleMappingOpts) Run() error { - params := &atlasv2.DeleteRoleMappingApiParams{ +func (opts *DeleteRoleMappingOpts) Run(ctx context.Context) error { + params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, Id: opts.id, OrgId: opts.orgId, } - _, err := opts.store.DeleteRoleMapping(params) + _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params) if err != nil { return err } @@ -173,43 +176,46 @@ func DeleteRoleMappingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteRoleMappingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.id, "id", "", "usage description") + _ = cmd.MarkFlagRequired("id") cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type GetConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetConnectedOrgConfigOperation + client admin.APIClient federationSettingsId string orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetConnectedOrgConfigOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetConnectedOrgConfigOpts) Run() error { - params := &atlasv2.GetConnectedOrgConfigApiParams{ +func (opts *GetConnectedOrgConfigOpts) Run(ctx context.Context) error { + params := &admin.GetConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.store.GetConnectedOrgConfig(params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params) if err != nil { return err } @@ -229,40 +235,42 @@ func GetConnectedOrgConfigBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetConnectedOrgConfigTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type GetFederationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetFederationSettingsOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetFederationSettingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetFederationSettingsOpts) Run() error { - params := &atlasv2.GetFederationSettingsApiParams{ +func (opts *GetFederationSettingsOpts) Run(ctx context.Context) error { + params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.GetFederationSettings(params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetFederationSettingsWithParams(ctx, params) if err != nil { return err } @@ -282,41 +290,42 @@ func GetFederationSettingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetFederationSettingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type GetIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetIdentityProviderOperation + client admin.APIClient federationSettingsId string identityProviderId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetIdentityProviderOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetIdentityProviderOpts) Run() error { - params := &atlasv2.GetIdentityProviderApiParams{ +func (opts *GetIdentityProviderOpts) Run(ctx context.Context) error { + params := &admin.GetIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } - resp, _, err := opts.store.GetIdentityProvider(params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params) if err != nil { return err } @@ -336,42 +345,44 @@ func GetIdentityProviderBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetIdentityProviderTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") + _ = cmd.MarkFlagRequired("identityProviderId") return cmd } type GetIdentityProviderMetadataOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetIdentityProviderMetadataOperation + client admin.APIClient federationSettingsId string identityProviderId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetIdentityProviderMetadataOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetIdentityProviderMetadataOpts) Run() error { - params := &atlasv2.GetIdentityProviderMetadataApiParams{ +func (opts *GetIdentityProviderMetadataOpts) Run(ctx context.Context) error { + params := &admin.GetIdentityProviderMetadataApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } - resp, _, err := opts.store.GetIdentityProviderMetadata(params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params) if err != nil { return err } @@ -391,44 +402,46 @@ func GetIdentityProviderMetadataBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetIdentityProviderMetadataTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") + _ = cmd.MarkFlagRequired("identityProviderId") return cmd } type GetRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetRoleMappingOperation + client admin.APIClient federationSettingsId string id string orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetRoleMappingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetRoleMappingOpts) Run() error { - params := &atlasv2.GetRoleMappingApiParams{ +func (opts *GetRoleMappingOpts) Run(ctx context.Context) error { + params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, Id: opts.id, OrgId: opts.orgId, } - resp, _, err := opts.store.GetRoleMapping(params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params) if err != nil { return err } @@ -448,41 +461,44 @@ func GetRoleMappingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetRoleMappingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.id, "id", "", "usage description") + _ = cmd.MarkFlagRequired("id") cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type ListConnectedOrgConfigsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListConnectedOrgConfigsOperation + client admin.APIClient federationSettingsId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListConnectedOrgConfigsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListConnectedOrgConfigsOpts) Run() error { - params := &atlasv2.ListConnectedOrgConfigsApiParams{ +func (opts *ListConnectedOrgConfigsOpts) Run(ctx context.Context) error { + params := &admin.ListConnectedOrgConfigsApiParams{ FederationSettingsId: opts.federationSettingsId, } - resp, _, err := opts.store.ListConnectedOrgConfigs(params) + resp, _, err := opts.client.FederatedAuthenticationApi.ListConnectedOrgConfigsWithParams(ctx, params) if err != nil { return err } @@ -502,39 +518,40 @@ func ListConnectedOrgConfigsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListConnectedOrgConfigsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } type ListIdentityProvidersOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListIdentityProvidersOperation + client admin.APIClient federationSettingsId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListIdentityProvidersOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListIdentityProvidersOpts) Run() error { - params := &atlasv2.ListIdentityProvidersApiParams{ +func (opts *ListIdentityProvidersOpts) Run(ctx context.Context) error { + params := &admin.ListIdentityProvidersApiParams{ FederationSettingsId: opts.federationSettingsId, } - resp, _, err := opts.store.ListIdentityProviders(params) + resp, _, err := opts.client.FederatedAuthenticationApi.ListIdentityProvidersWithParams(ctx, params) if err != nil { return err } @@ -554,41 +571,42 @@ func ListIdentityProvidersBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListIdentityProvidersTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } type ListRoleMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListRoleMappingsOperation + client admin.APIClient federationSettingsId string orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListRoleMappingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListRoleMappingsOpts) Run() error { - params := &atlasv2.ListRoleMappingsApiParams{ +func (opts *ListRoleMappingsOpts) Run(ctx context.Context) error { + params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.store.ListRoleMappings(params) + resp, _, err := opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params) if err != nil { return err } @@ -608,42 +626,44 @@ func ListRoleMappingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListRoleMappingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type RemoveConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - store store.RemoveConnectedOrgConfigOperation + client admin.APIClient federationSettingsId string orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *RemoveConnectedOrgConfigOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *RemoveConnectedOrgConfigOpts) Run() error { - params := &atlasv2.RemoveConnectedOrgConfigApiParams{ +func (opts *RemoveConnectedOrgConfigOpts) Run(ctx context.Context) error { + params := &admin.RemoveConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.store.RemoveConnectedOrgConfig(params) + resp, _, err := opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params) if err != nil { return err } @@ -663,42 +683,44 @@ func RemoveConnectedOrgConfigBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), RemoveConnectedOrgConfigTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type UpdateConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateConnectedOrgConfigOperation + client admin.APIClient federationSettingsId string orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateConnectedOrgConfigOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateConnectedOrgConfigOpts) Run() error { - params := &atlasv2.UpdateConnectedOrgConfigApiParams{ +func (opts *UpdateConnectedOrgConfigOpts) Run(ctx context.Context) error { + params := &admin.UpdateConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.store.UpdateConnectedOrgConfig(params) + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params) if err != nil { return err } @@ -718,42 +740,44 @@ func UpdateConnectedOrgConfigBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateConnectedOrgConfigTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type UpdateIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateIdentityProviderOperation + client admin.APIClient federationSettingsId string identityProviderId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateIdentityProviderOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateIdentityProviderOpts) Run() error { - params := &atlasv2.UpdateIdentityProviderApiParams{ +func (opts *UpdateIdentityProviderOpts) Run(ctx context.Context) error { + params := &admin.UpdateIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } - resp, _, err := opts.store.UpdateIdentityProvider(params) + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params) if err != nil { return err } @@ -773,44 +797,46 @@ func UpdateIdentityProviderBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateIdentityProviderTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") + _ = cmd.MarkFlagRequired("identityProviderId") return cmd } type UpdateRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateRoleMappingOperation + client admin.APIClient federationSettingsId string id string orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateRoleMappingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateRoleMappingOpts) Run() error { - params := &atlasv2.UpdateRoleMappingApiParams{ +func (opts *UpdateRoleMappingOpts) Run(ctx context.Context) error { + params := &admin.UpdateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, Id: opts.id, OrgId: opts.orgId, } - resp, _, err := opts.store.UpdateRoleMapping(params) + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params) if err != nil { return err } @@ -830,18 +856,21 @@ func UpdateRoleMappingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateRoleMappingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.id, "id", "", "usage description") + _ = cmd.MarkFlagRequired("id") cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } diff --git a/internal/generated/api_federated_authentication_store.go b/internal/generated/api_federated_authentication_store.go deleted file mode 100644 index deeb90f5d9..0000000000 --- a/internal/generated/api_federated_authentication_store.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_federated_authentication_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateRoleMappingOperation, DeleteFederationAppOperation, DeleteRoleMappingOperation, GetConnectedOrgConfigOperation, GetFederationSettingsOperation, GetIdentityProviderOperation, GetIdentityProviderMetadataOperation, GetRoleMappingOperation, ListConnectedOrgConfigsOperation, ListIdentityProvidersOperation, ListRoleMappingsOperation, RemoveConnectedOrgConfigOperation, UpdateConnectedOrgConfigOperation, UpdateIdentityProviderOperation, UpdateRoleMappingOperation - -type CreateRoleMappingOperation interface { - CreateRoleMapping (*atlasv2.CreateRoleMappingApiParams) (*atlasv2.RoleMapping, error) -} - -// CreateRoleMapping encapsulates the logic to manage different cloud providers. -func (s *Store) CreateRoleMapping(params *atlasv2.CreateRoleMappingApiParams) (*atlasv2.RoleMapping, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.CreateRoleMappingWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteFederationAppOperation interface { - DeleteFederationApp (*atlasv2.DeleteFederationAppApiParams) error -} - -// DeleteFederationApp encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteFederationApp(params *atlasv2.DeleteFederationAppApiParams) (error) { - _, err := s.clientv2.FederatedAuthenticationApi.DeleteFederationAppWithParams(s.ctx, params).Execute() - return err -} - -type DeleteRoleMappingOperation interface { - DeleteRoleMapping (*atlasv2.DeleteRoleMappingApiParams) error -} - -// DeleteRoleMapping encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteRoleMapping(params *atlasv2.DeleteRoleMappingApiParams) (error) { - _, err := s.clientv2.FederatedAuthenticationApi.DeleteRoleMappingWithParams(s.ctx, params).Execute() - return err -} - -type GetConnectedOrgConfigOperation interface { - GetConnectedOrgConfig (*atlasv2.GetConnectedOrgConfigApiParams) (*atlasv2.ConnectedOrgConfig, error) -} - -// GetConnectedOrgConfig encapsulates the logic to manage different cloud providers. -func (s *Store) GetConnectedOrgConfig(params *atlasv2.GetConnectedOrgConfigApiParams) (*atlasv2.ConnectedOrgConfig, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetFederationSettingsOperation interface { - GetFederationSettings (*atlasv2.GetFederationSettingsApiParams) (*atlasv2.OrgFederationSettings, error) -} - -// GetFederationSettings encapsulates the logic to manage different cloud providers. -func (s *Store) GetFederationSettings(params *atlasv2.GetFederationSettingsApiParams) (*atlasv2.OrgFederationSettings, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.GetFederationSettingsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetIdentityProviderOperation interface { - GetIdentityProvider (*atlasv2.GetIdentityProviderApiParams) (*atlasv2.IdentityProvider, error) -} - -// GetIdentityProvider encapsulates the logic to manage different cloud providers. -func (s *Store) GetIdentityProvider(params *atlasv2.GetIdentityProviderApiParams) (*atlasv2.IdentityProvider, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.GetIdentityProviderWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetIdentityProviderMetadataOperation interface { - GetIdentityProviderMetadata (*atlasv2.GetIdentityProviderMetadataApiParams) (*atlasv2.string, error) -} - -// GetIdentityProviderMetadata encapsulates the logic to manage different cloud providers. -func (s *Store) GetIdentityProviderMetadata(params *atlasv2.GetIdentityProviderMetadataApiParams) (*atlasv2.string, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetRoleMappingOperation interface { - GetRoleMapping (*atlasv2.GetRoleMappingApiParams) (*atlasv2.RoleMapping, error) -} - -// GetRoleMapping encapsulates the logic to manage different cloud providers. -func (s *Store) GetRoleMapping(params *atlasv2.GetRoleMappingApiParams) (*atlasv2.RoleMapping, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.GetRoleMappingWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListConnectedOrgConfigsOperation interface { - ListConnectedOrgConfigs (*atlasv2.ListConnectedOrgConfigsApiParams) (*atlasv2.[]ConnectedOrgConfig, error) -} - -// ListConnectedOrgConfigs encapsulates the logic to manage different cloud providers. -func (s *Store) ListConnectedOrgConfigs(params *atlasv2.ListConnectedOrgConfigsApiParams) (*atlasv2.[]ConnectedOrgConfig, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.ListConnectedOrgConfigsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListIdentityProvidersOperation interface { - ListIdentityProviders (*atlasv2.ListIdentityProvidersApiParams) (*atlasv2.[]IdentityProvider, error) -} - -// ListIdentityProviders encapsulates the logic to manage different cloud providers. -func (s *Store) ListIdentityProviders(params *atlasv2.ListIdentityProvidersApiParams) (*atlasv2.[]IdentityProvider, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.ListIdentityProvidersWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListRoleMappingsOperation interface { - ListRoleMappings (*atlasv2.ListRoleMappingsApiParams) (*atlasv2.[]RoleMapping, error) -} - -// ListRoleMappings encapsulates the logic to manage different cloud providers. -func (s *Store) ListRoleMappings(params *atlasv2.ListRoleMappingsApiParams) (*atlasv2.[]RoleMapping, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.ListRoleMappingsWithParams(s.ctx, params).Execute() - return &result, err -} - -type RemoveConnectedOrgConfigOperation interface { - RemoveConnectedOrgConfig (*atlasv2.RemoveConnectedOrgConfigApiParams) (*atlasv2.map[string]interface{}, error) -} - -// RemoveConnectedOrgConfig encapsulates the logic to manage different cloud providers. -func (s *Store) RemoveConnectedOrgConfig(params *atlasv2.RemoveConnectedOrgConfigApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateConnectedOrgConfigOperation interface { - UpdateConnectedOrgConfig (*atlasv2.UpdateConnectedOrgConfigApiParams) (*atlasv2.ConnectedOrgConfig, error) -} - -// UpdateConnectedOrgConfig encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateConnectedOrgConfig(params *atlasv2.UpdateConnectedOrgConfigApiParams) (*atlasv2.ConnectedOrgConfig, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateIdentityProviderOperation interface { - UpdateIdentityProvider (*atlasv2.UpdateIdentityProviderApiParams) (*atlasv2.IdentityProvider, error) -} - -// UpdateIdentityProvider encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateIdentityProvider(params *atlasv2.UpdateIdentityProviderApiParams) (*atlasv2.IdentityProvider, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateRoleMappingOperation interface { - UpdateRoleMapping (*atlasv2.UpdateRoleMappingApiParams) (*atlasv2.RoleMapping, error) -} - -// UpdateRoleMapping encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateRoleMapping(params *atlasv2.UpdateRoleMappingApiParams) (*atlasv2.RoleMapping, error) { - result, _, err := s.clientv2.FederatedAuthenticationApi.UpdateRoleMappingWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index ba15f5914b..deec56d0e1 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateCustomZoneMappingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateCustomZoneMappingOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateCustomZoneMappingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateCustomZoneMappingOpts) Run() error { - params := &atlasv2.CreateCustomZoneMappingApiParams{ +func (opts *CreateCustomZoneMappingOpts) Run(ctx context.Context) error { + params := &admin.CreateCustomZoneMappingApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.CreateCustomZoneMapping(params) + resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params) if err != nil { return err } @@ -64,42 +64,44 @@ func CreateCustomZoneMappingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateCustomZoneMappingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type CreateManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateManagedNamespaceOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateManagedNamespaceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateManagedNamespaceOpts) Run() error { - params := &atlasv2.CreateManagedNamespaceApiParams{ +func (opts *CreateManagedNamespaceOpts) Run(ctx context.Context) error { + params := &admin.CreateManagedNamespaceApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.CreateManagedNamespace(params) + resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params) if err != nil { return err } @@ -119,42 +121,44 @@ func CreateManagedNamespaceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateManagedNamespaceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type DeleteAllCustomZoneMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteAllCustomZoneMappingsOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteAllCustomZoneMappingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteAllCustomZoneMappingsOpts) Run() error { - params := &atlasv2.DeleteAllCustomZoneMappingsApiParams{ +func (opts *DeleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { + params := &admin.DeleteAllCustomZoneMappingsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.DeleteAllCustomZoneMappings(params) + resp, _, err := opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params) if err != nil { return err } @@ -174,46 +178,48 @@ func DeleteAllCustomZoneMappingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteAllCustomZoneMappingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type DeleteManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteManagedNamespaceOperation + client admin.APIClient clusterName string groupId string db string collection string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteManagedNamespaceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteManagedNamespaceOpts) Run() error { - params := &atlasv2.DeleteManagedNamespaceApiParams{ +func (opts *DeleteManagedNamespaceOpts) Run(ctx context.Context) error { + params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, Db: opts.db, Collection: opts.collection, } - resp, _, err := opts.store.DeleteManagedNamespace(params) + resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params) if err != nil { return err } @@ -233,17 +239,19 @@ func DeleteManagedNamespaceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteManagedNamespaceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.db, "db", "", "usage description") cmd.Flags().StringVar(&opts.collection, "collection", "", "usage description") @@ -252,25 +260,25 @@ func DeleteManagedNamespaceBuilder() cobra.Command { type GetManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetManagedNamespaceOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetManagedNamespaceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetManagedNamespaceOpts) Run() error { - params := &atlasv2.GetManagedNamespaceApiParams{ +func (opts *GetManagedNamespaceOpts) Run(ctx context.Context) error { + params := &admin.GetManagedNamespaceApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetManagedNamespace(params) + resp, _, err := opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params) if err != nil { return err } @@ -290,17 +298,19 @@ func GetManagedNamespaceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetManagedNamespaceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/generated/api_global_clusters_store.go b/internal/generated/api_global_clusters_store.go deleted file mode 100644 index a4bcbd9b01..0000000000 --- a/internal/generated/api_global_clusters_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_global_clusters_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateCustomZoneMappingOperation, CreateManagedNamespaceOperation, DeleteAllCustomZoneMappingsOperation, DeleteManagedNamespaceOperation, GetManagedNamespaceOperation - -type CreateCustomZoneMappingOperation interface { - CreateCustomZoneMapping (*atlasv2.CreateCustomZoneMappingApiParams) (*atlasv2.GeoSharding, error) -} - -// CreateCustomZoneMapping encapsulates the logic to manage different cloud providers. -func (s *Store) CreateCustomZoneMapping(params *atlasv2.CreateCustomZoneMappingApiParams) (*atlasv2.GeoSharding, error) { - result, _, err := s.clientv2.GlobalClustersApi.CreateCustomZoneMappingWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateManagedNamespaceOperation interface { - CreateManagedNamespace (*atlasv2.CreateManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) -} - -// CreateManagedNamespace encapsulates the logic to manage different cloud providers. -func (s *Store) CreateManagedNamespace(params *atlasv2.CreateManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) { - result, _, err := s.clientv2.GlobalClustersApi.CreateManagedNamespaceWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteAllCustomZoneMappingsOperation interface { - DeleteAllCustomZoneMappings (*atlasv2.DeleteAllCustomZoneMappingsApiParams) (*atlasv2.GeoSharding, error) -} - -// DeleteAllCustomZoneMappings encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteAllCustomZoneMappings(params *atlasv2.DeleteAllCustomZoneMappingsApiParams) (*atlasv2.GeoSharding, error) { - result, _, err := s.clientv2.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteManagedNamespaceOperation interface { - DeleteManagedNamespace (*atlasv2.DeleteManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) -} - -// DeleteManagedNamespace encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteManagedNamespace(params *atlasv2.DeleteManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) { - result, _, err := s.clientv2.GlobalClustersApi.DeleteManagedNamespaceWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetManagedNamespaceOperation interface { - GetManagedNamespace (*atlasv2.GetManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) -} - -// GetManagedNamespace encapsulates the logic to manage different cloud providers. -func (s *Store) GetManagedNamespace(params *atlasv2.GetManagedNamespaceApiParams) (*atlasv2.GeoSharding, error) { - result, _, err := s.clientv2.GlobalClustersApi.GetManagedNamespaceWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index 359f2b9b49..ce9bf043f8 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type DownloadInvoiceCSVOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DownloadInvoiceCSVOperation + client admin.APIClient orgId string invoiceId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DownloadInvoiceCSVOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DownloadInvoiceCSVOpts) Run() error { - params := &atlasv2.DownloadInvoiceCSVApiParams{ +func (opts *DownloadInvoiceCSVOpts) Run(ctx context.Context) error { + params := &admin.DownloadInvoiceCSVApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, } - _, err := opts.store.DownloadInvoiceCSV(params) + _, err := opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params) if err != nil { return err } @@ -64,42 +64,44 @@ func DownloadInvoiceCSVBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DownloadInvoiceCSVTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "usage description") + _ = cmd.MarkFlagRequired("invoiceId") return cmd } type GetInvoiceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetInvoiceOperation + client admin.APIClient orgId string invoiceId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetInvoiceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetInvoiceOpts) Run() error { - params := &atlasv2.GetInvoiceApiParams{ +func (opts *GetInvoiceOpts) Run(ctx context.Context) error { + params := &admin.GetInvoiceApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, } - resp, _, err := opts.store.GetInvoice(params) + resp, _, err := opts.client.InvoicesApi.GetInvoiceWithParams(ctx, params) if err != nil { return err } @@ -119,46 +121,48 @@ func GetInvoiceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetInvoiceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "usage description") + _ = cmd.MarkFlagRequired("invoiceId") return cmd } type ListInvoicesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListInvoicesOperation + client admin.APIClient orgId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListInvoicesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListInvoicesOpts) Run() error { - params := &atlasv2.ListInvoicesApiParams{ +func (opts *ListInvoicesOpts) Run(ctx context.Context) error { + params := &admin.ListInvoicesApiParams{ OrgId: opts.orgId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListInvoices(params) + resp, _, err := opts.client.InvoicesApi.ListInvoicesWithParams(ctx, params) if err != nil { return err } @@ -178,16 +182,17 @@ func ListInvoicesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListInvoicesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -197,23 +202,23 @@ func ListInvoicesBuilder() cobra.Command { type ListPendingInvoicesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPendingInvoicesOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPendingInvoicesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPendingInvoicesOpts) Run() error { - params := &atlasv2.ListPendingInvoicesApiParams{ +func (opts *ListPendingInvoicesOpts) Run(ctx context.Context) error { + params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.ListPendingInvoices(params) + resp, _, err := opts.client.InvoicesApi.ListPendingInvoicesWithParams(ctx, params) if err != nil { return err } @@ -233,16 +238,17 @@ func ListPendingInvoicesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPendingInvoicesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } diff --git a/internal/generated/api_invoices_store.go b/internal/generated/api_invoices_store.go deleted file mode 100644 index 59f4ba65b7..0000000000 --- a/internal/generated/api_invoices_store.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_invoices_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DownloadInvoiceCSVOperation, GetInvoiceOperation, ListInvoicesOperation, ListPendingInvoicesOperation - -type DownloadInvoiceCSVOperation interface { - DownloadInvoiceCSV (*atlasv2.DownloadInvoiceCSVApiParams) error -} - -// DownloadInvoiceCSV encapsulates the logic to manage different cloud providers. -func (s *Store) DownloadInvoiceCSV(params *atlasv2.DownloadInvoiceCSVApiParams) (error) { - _, err := s.clientv2.InvoicesApi.DownloadInvoiceCSVWithParams(s.ctx, params).Execute() - return err -} - -type GetInvoiceOperation interface { - GetInvoice (*atlasv2.GetInvoiceApiParams) (*atlasv2.Invoice, error) -} - -// GetInvoice encapsulates the logic to manage different cloud providers. -func (s *Store) GetInvoice(params *atlasv2.GetInvoiceApiParams) (*atlasv2.Invoice, error) { - result, _, err := s.clientv2.InvoicesApi.GetInvoiceWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListInvoicesOperation interface { - ListInvoices (*atlasv2.ListInvoicesApiParams) (*atlasv2.PaginatedApiInvoice, error) -} - -// ListInvoices encapsulates the logic to manage different cloud providers. -func (s *Store) ListInvoices(params *atlasv2.ListInvoicesApiParams) (*atlasv2.PaginatedApiInvoice, error) { - result, _, err := s.clientv2.InvoicesApi.ListInvoicesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPendingInvoicesOperation interface { - ListPendingInvoices (*atlasv2.ListPendingInvoicesApiParams) (*atlasv2.PaginatedApiInvoice, error) -} - -// ListPendingInvoices encapsulates the logic to manage different cloud providers. -func (s *Store) ListPendingInvoices(params *atlasv2.ListPendingInvoicesApiParams) (*atlasv2.PaginatedApiInvoice, error) { - result, _, err := s.clientv2.InvoicesApi.ListPendingInvoicesWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index c9b6a59707..36a6e38e72 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type DeleteLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteLDAPConfigurationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteLDAPConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteLDAPConfigurationOpts) Run() error { - params := &atlasv2.DeleteLDAPConfigurationApiParams{ +func (opts *DeleteLDAPConfigurationOpts) Run(ctx context.Context) error { + params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, } - _, err := opts.store.DeleteLDAPConfiguration(params) + _, err := opts.client.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(ctx, params) if err != nil { return err } @@ -62,39 +62,40 @@ func DeleteLDAPConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteLDAPConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetLDAPConfigurationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetLDAPConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetLDAPConfigurationOpts) Run() error { - params := &atlasv2.GetLDAPConfigurationApiParams{ +func (opts *GetLDAPConfigurationOpts) Run(ctx context.Context) error { + params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetLDAPConfiguration(params) + resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationWithParams(ctx, params) if err != nil { return err } @@ -114,41 +115,42 @@ func GetLDAPConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetLDAPConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetLDAPConfigurationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetLDAPConfigurationStatusOperation + client admin.APIClient groupId string requestId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetLDAPConfigurationStatusOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetLDAPConfigurationStatusOpts) Run() error { - params := &atlasv2.GetLDAPConfigurationStatusApiParams{ +func (opts *GetLDAPConfigurationStatusOpts) Run(ctx context.Context) error { + params := &admin.GetLDAPConfigurationStatusApiParams{ GroupId: opts.groupId, RequestId: opts.requestId, } - resp, _, err := opts.store.GetLDAPConfigurationStatus(params) + resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params) if err != nil { return err } @@ -168,40 +170,42 @@ func GetLDAPConfigurationStatusBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetLDAPConfigurationStatusTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.requestId, "requestId", "", "usage description") + _ = cmd.MarkFlagRequired("requestId") return cmd } type SaveLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.SaveLDAPConfigurationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *SaveLDAPConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *SaveLDAPConfigurationOpts) Run() error { - params := &atlasv2.SaveLDAPConfigurationApiParams{ +func (opts *SaveLDAPConfigurationOpts) Run(ctx context.Context) error { + params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.SaveLDAPConfiguration(params) + resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params) if err != nil { return err } @@ -221,39 +225,40 @@ func SaveLDAPConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), SaveLDAPConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type VerifyLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.VerifyLDAPConfigurationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *VerifyLDAPConfigurationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *VerifyLDAPConfigurationOpts) Run() error { - params := &atlasv2.VerifyLDAPConfigurationApiParams{ +func (opts *VerifyLDAPConfigurationOpts) Run(ctx context.Context) error { + params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.VerifyLDAPConfiguration(params) + resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params) if err != nil { return err } @@ -273,16 +278,17 @@ func VerifyLDAPConfigurationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), VerifyLDAPConfigurationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_ldap_configuration_store.go b/internal/generated/api_ldap_configuration_store.go deleted file mode 100644 index 53bb814332..0000000000 --- a/internal/generated/api_ldap_configuration_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_ldap_configuration_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DeleteLDAPConfigurationOperation, GetLDAPConfigurationOperation, GetLDAPConfigurationStatusOperation, SaveLDAPConfigurationOperation, VerifyLDAPConfigurationOperation - -type DeleteLDAPConfigurationOperation interface { - DeleteLDAPConfiguration (*atlasv2.DeleteLDAPConfigurationApiParams) error -} - -// DeleteLDAPConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteLDAPConfiguration(params *atlasv2.DeleteLDAPConfigurationApiParams) (error) { - _, err := s.clientv2.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(s.ctx, params).Execute() - return err -} - -type GetLDAPConfigurationOperation interface { - GetLDAPConfiguration (*atlasv2.GetLDAPConfigurationApiParams) (*atlasv2.UserSecurity, error) -} - -// GetLDAPConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) GetLDAPConfiguration(params *atlasv2.GetLDAPConfigurationApiParams) (*atlasv2.UserSecurity, error) { - result, _, err := s.clientv2.LDAPConfigurationApi.GetLDAPConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetLDAPConfigurationStatusOperation interface { - GetLDAPConfigurationStatus (*atlasv2.GetLDAPConfigurationStatusApiParams) (*atlasv2.NDSLDAPVerifyConnectivityJobRequest, error) -} - -// GetLDAPConfigurationStatus encapsulates the logic to manage different cloud providers. -func (s *Store) GetLDAPConfigurationStatus(params *atlasv2.GetLDAPConfigurationStatusApiParams) (*atlasv2.NDSLDAPVerifyConnectivityJobRequest, error) { - result, _, err := s.clientv2.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(s.ctx, params).Execute() - return &result, err -} - -type SaveLDAPConfigurationOperation interface { - SaveLDAPConfiguration (*atlasv2.SaveLDAPConfigurationApiParams) (*atlasv2.UserSecurity, error) -} - -// SaveLDAPConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) SaveLDAPConfiguration(params *atlasv2.SaveLDAPConfigurationApiParams) (*atlasv2.UserSecurity, error) { - result, _, err := s.clientv2.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - -type VerifyLDAPConfigurationOperation interface { - VerifyLDAPConfiguration (*atlasv2.VerifyLDAPConfigurationApiParams) (*atlasv2.NDSLDAPVerifyConnectivityJobRequest, error) -} - -// VerifyLDAPConfiguration encapsulates the logic to manage different cloud providers. -func (s *Store) VerifyLDAPConfiguration(params *atlasv2.VerifyLDAPConfigurationApiParams) (*atlasv2.NDSLDAPVerifyConnectivityJobRequest, error) { - result, _, err := s.clientv2.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index 00d78c9616..0c50526ae6 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -19,34 +19,34 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type DeleteLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteLegacySnapshotOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteLegacySnapshotOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteLegacySnapshotOpts) Run() error { - params := &atlasv2.DeleteLegacySnapshotApiParams{ +func (opts *DeleteLegacySnapshotOpts) Run(ctx context.Context) error { + params := &admin.DeleteLegacySnapshotApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.DeleteLegacySnapshot(params) + resp, _, err := opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params) if err != nil { return err } @@ -66,45 +66,48 @@ func DeleteLegacySnapshotBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteLegacySnapshotTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type GetLegacyBackupCheckpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetLegacyBackupCheckpointOperation + client admin.APIClient groupId string checkpointId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetLegacyBackupCheckpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetLegacyBackupCheckpointOpts) Run() error { - params := &atlasv2.GetLegacyBackupCheckpointApiParams{ +func (opts *GetLegacyBackupCheckpointOpts) Run(ctx context.Context) error { + params := &admin.GetLegacyBackupCheckpointApiParams{ GroupId: opts.groupId, CheckpointId: opts.checkpointId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetLegacyBackupCheckpoint(params) + resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params) if err != nil { return err } @@ -124,45 +127,48 @@ func GetLegacyBackupCheckpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetLegacyBackupCheckpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", "usage description") + _ = cmd.MarkFlagRequired("checkpointId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type GetLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetLegacyBackupRestoreJobOperation + client admin.APIClient groupId string clusterName string jobId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetLegacyBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetLegacyBackupRestoreJobOpts) Run() error { - params := &atlasv2.GetLegacyBackupRestoreJobApiParams{ +func (opts *GetLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.GetLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, JobId: opts.jobId, } - resp, _, err := opts.store.GetLegacyBackupRestoreJob(params) + resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -182,45 +188,48 @@ func GetLegacyBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetLegacyBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.jobId, "jobId", "", "usage description") + _ = cmd.MarkFlagRequired("jobId") return cmd } type GetLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetLegacySnapshotOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetLegacySnapshotOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetLegacySnapshotOpts) Run() error { - params := &atlasv2.GetLegacySnapshotApiParams{ +func (opts *GetLegacySnapshotOpts) Run(ctx context.Context) error { + params := &admin.GetLegacySnapshotApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.GetLegacySnapshot(params) + resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params) if err != nil { return err } @@ -240,43 +249,46 @@ func GetLegacySnapshotBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetLegacySnapshotTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type GetLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetLegacySnapshotScheduleOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetLegacySnapshotScheduleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetLegacySnapshotScheduleOpts) Run() error { - params := &atlasv2.GetLegacySnapshotScheduleApiParams{ +func (opts *GetLegacySnapshotScheduleOpts) Run(ctx context.Context) error { + params := &admin.GetLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetLegacySnapshotSchedule(params) + resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params) if err != nil { return err } @@ -296,24 +308,26 @@ func GetLegacySnapshotScheduleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetLegacySnapshotScheduleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type ListLegacyBackupCheckpointsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListLegacyBackupCheckpointsOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -321,23 +335,23 @@ type ListLegacyBackupCheckpointsOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListLegacyBackupCheckpointsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListLegacyBackupCheckpointsOpts) Run() error { - params := &atlasv2.ListLegacyBackupCheckpointsApiParams{ +func (opts *ListLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { + params := &admin.ListLegacyBackupCheckpointsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListLegacyBackupCheckpoints(params) + resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params) if err != nil { return err } @@ -357,17 +371,19 @@ func ListLegacyBackupCheckpointsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListLegacyBackupCheckpointsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -377,7 +393,7 @@ func ListLegacyBackupCheckpointsBuilder() cobra.Command { type ListLegacyBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListLegacyBackupRestoreJobsOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -386,16 +402,16 @@ type ListLegacyBackupRestoreJobsOpts struct { batchId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListLegacyBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListLegacyBackupRestoreJobsOpts) Run() error { - params := &atlasv2.ListLegacyBackupRestoreJobsApiParams{ +func (opts *ListLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { + params := &admin.ListLegacyBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, @@ -403,7 +419,7 @@ func (opts *ListLegacyBackupRestoreJobsOpts) Run() error { PageNum: opts.pageNum, BatchId: opts.batchId, } - resp, _, err := opts.store.ListLegacyBackupRestoreJobs(params) + resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params) if err != nil { return err } @@ -423,17 +439,19 @@ func ListLegacyBackupRestoreJobsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListLegacyBackupRestoreJobsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -444,7 +462,7 @@ func ListLegacyBackupRestoreJobsBuilder() cobra.Command { type ListLegacySnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListLegacySnapshotsOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -453,16 +471,16 @@ type ListLegacySnapshotsOpts struct { completed string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListLegacySnapshotsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListLegacySnapshotsOpts) Run() error { - params := &atlasv2.ListLegacySnapshotsApiParams{ +func (opts *ListLegacySnapshotsOpts) Run(ctx context.Context) error { + params := &admin.ListLegacySnapshotsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, @@ -470,7 +488,7 @@ func (opts *ListLegacySnapshotsOpts) Run() error { PageNum: opts.pageNum, Completed: opts.completed, } - resp, _, err := opts.store.ListLegacySnapshots(params) + resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params) if err != nil { return err } @@ -490,17 +508,19 @@ func ListLegacySnapshotsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListLegacySnapshotsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -511,27 +531,27 @@ func ListLegacySnapshotsBuilder() cobra.Command { type UpdateLegacySnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateLegacySnapshotRetentionOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateLegacySnapshotRetentionOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateLegacySnapshotRetentionOpts) Run() error { - params := &atlasv2.UpdateLegacySnapshotRetentionApiParams{ +func (opts *UpdateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { + params := &admin.UpdateLegacySnapshotRetentionApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.UpdateLegacySnapshotRetention(params) + resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params) if err != nil { return err } @@ -551,43 +571,46 @@ func UpdateLegacySnapshotRetentionBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateLegacySnapshotRetentionTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type UpdateLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateLegacySnapshotScheduleOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateLegacySnapshotScheduleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateLegacySnapshotScheduleOpts) Run() error { - params := &atlasv2.UpdateLegacySnapshotScheduleApiParams{ +func (opts *UpdateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { + params := &admin.UpdateLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.UpdateLegacySnapshotSchedule(params) + resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params) if err != nil { return err } @@ -607,17 +630,19 @@ func UpdateLegacySnapshotScheduleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateLegacySnapshotScheduleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 7233992723..7ffa1eafba 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateLegacyBackupRestoreJobOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateLegacyBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateLegacyBackupRestoreJobOpts) Run() error { - params := &atlasv2.CreateLegacyBackupRestoreJobApiParams{ +func (opts *CreateLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.CreateLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.CreateLegacyBackupRestoreJob(params) + resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -64,17 +64,19 @@ func CreateLegacyBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateLegacyBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/generated/api_legacy_backup_restore_jobs_store.go b/internal/generated/api_legacy_backup_restore_jobs_store.go deleted file mode 100644 index 99deb643a3..0000000000 --- a/internal/generated/api_legacy_backup_restore_jobs_store.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_legacy_backup_restore_jobs_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateLegacyBackupRestoreJobOperation - -type CreateLegacyBackupRestoreJobOperation interface { - CreateLegacyBackupRestoreJob (*atlasv2.CreateLegacyBackupRestoreJobApiParams) (*atlasv2.PaginatedRestoreJob, error) -} - -// CreateLegacyBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) CreateLegacyBackupRestoreJob(params *atlasv2.CreateLegacyBackupRestoreJobApiParams) (*atlasv2.PaginatedRestoreJob, error) { - result, _, err := s.clientv2.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_legacy_backup_store.go b/internal/generated/api_legacy_backup_store.go deleted file mode 100644 index 1002feda45..0000000000 --- a/internal/generated/api_legacy_backup_store.go +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_legacy_backup_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DeleteLegacySnapshotOperation, GetLegacyBackupCheckpointOperation, GetLegacyBackupRestoreJobOperation, GetLegacySnapshotOperation, GetLegacySnapshotScheduleOperation, ListLegacyBackupCheckpointsOperation, ListLegacyBackupRestoreJobsOperation, ListLegacySnapshotsOperation, UpdateLegacySnapshotRetentionOperation, UpdateLegacySnapshotScheduleOperation - -type DeleteLegacySnapshotOperation interface { - DeleteLegacySnapshot (*atlasv2.DeleteLegacySnapshotApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteLegacySnapshot encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteLegacySnapshot(params *atlasv2.DeleteLegacySnapshotApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.LegacyBackupApi.DeleteLegacySnapshotWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetLegacyBackupCheckpointOperation interface { - GetLegacyBackupCheckpoint (*atlasv2.GetLegacyBackupCheckpointApiParams) (*atlasv2.Checkpoint, error) -} - -// GetLegacyBackupCheckpoint encapsulates the logic to manage different cloud providers. -func (s *Store) GetLegacyBackupCheckpoint(params *atlasv2.GetLegacyBackupCheckpointApiParams) (*atlasv2.Checkpoint, error) { - result, _, err := s.clientv2.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetLegacyBackupRestoreJobOperation interface { - GetLegacyBackupRestoreJob (*atlasv2.GetLegacyBackupRestoreJobApiParams) (*atlasv2.RestoreJob, error) -} - -// GetLegacyBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) GetLegacyBackupRestoreJob(params *atlasv2.GetLegacyBackupRestoreJobApiParams) (*atlasv2.RestoreJob, error) { - result, _, err := s.clientv2.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetLegacySnapshotOperation interface { - GetLegacySnapshot (*atlasv2.GetLegacySnapshotApiParams) (*atlasv2.Snapshot, error) -} - -// GetLegacySnapshot encapsulates the logic to manage different cloud providers. -func (s *Store) GetLegacySnapshot(params *atlasv2.GetLegacySnapshotApiParams) (*atlasv2.Snapshot, error) { - result, _, err := s.clientv2.LegacyBackupApi.GetLegacySnapshotWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetLegacySnapshotScheduleOperation interface { - GetLegacySnapshotSchedule (*atlasv2.GetLegacySnapshotScheduleApiParams) (*atlasv2.SnapshotSchedule, error) -} - -// GetLegacySnapshotSchedule encapsulates the logic to manage different cloud providers. -func (s *Store) GetLegacySnapshotSchedule(params *atlasv2.GetLegacySnapshotScheduleApiParams) (*atlasv2.SnapshotSchedule, error) { - result, _, err := s.clientv2.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListLegacyBackupCheckpointsOperation interface { - ListLegacyBackupCheckpoints (*atlasv2.ListLegacyBackupCheckpointsApiParams) (*atlasv2.PaginatedApiAtlasCheckpoint, error) -} - -// ListLegacyBackupCheckpoints encapsulates the logic to manage different cloud providers. -func (s *Store) ListLegacyBackupCheckpoints(params *atlasv2.ListLegacyBackupCheckpointsApiParams) (*atlasv2.PaginatedApiAtlasCheckpoint, error) { - result, _, err := s.clientv2.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListLegacyBackupRestoreJobsOperation interface { - ListLegacyBackupRestoreJobs (*atlasv2.ListLegacyBackupRestoreJobsApiParams) (*atlasv2.PaginatedRestoreJob, error) -} - -// ListLegacyBackupRestoreJobs encapsulates the logic to manage different cloud providers. -func (s *Store) ListLegacyBackupRestoreJobs(params *atlasv2.ListLegacyBackupRestoreJobsApiParams) (*atlasv2.PaginatedRestoreJob, error) { - result, _, err := s.clientv2.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListLegacySnapshotsOperation interface { - ListLegacySnapshots (*atlasv2.ListLegacySnapshotsApiParams) (*atlasv2.PaginatedSnapshot, error) -} - -// ListLegacySnapshots encapsulates the logic to manage different cloud providers. -func (s *Store) ListLegacySnapshots(params *atlasv2.ListLegacySnapshotsApiParams) (*atlasv2.PaginatedSnapshot, error) { - result, _, err := s.clientv2.LegacyBackupApi.ListLegacySnapshotsWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateLegacySnapshotRetentionOperation interface { - UpdateLegacySnapshotRetention (*atlasv2.UpdateLegacySnapshotRetentionApiParams) (*atlasv2.Snapshot, error) -} - -// UpdateLegacySnapshotRetention encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateLegacySnapshotRetention(params *atlasv2.UpdateLegacySnapshotRetentionApiParams) (*atlasv2.Snapshot, error) { - result, _, err := s.clientv2.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateLegacySnapshotScheduleOperation interface { - UpdateLegacySnapshotSchedule (*atlasv2.UpdateLegacySnapshotScheduleApiParams) (*atlasv2.SnapshotSchedule, error) -} - -// UpdateLegacySnapshotSchedule encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateLegacySnapshotSchedule(params *atlasv2.UpdateLegacySnapshotScheduleApiParams) (*atlasv2.SnapshotSchedule, error) { - result, _, err := s.clientv2.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index 7e115a3e8c..1b32c6aa24 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type DeferMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeferMaintenanceWindowOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeferMaintenanceWindowOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeferMaintenanceWindowOpts) Run() error { - params := &atlasv2.DeferMaintenanceWindowApiParams{ +func (opts *DeferMaintenanceWindowOpts) Run(ctx context.Context) error { + params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, } - _, err := opts.store.DeferMaintenanceWindow(params) + _, err := opts.client.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(ctx, params) if err != nil { return err } @@ -62,39 +62,40 @@ func DeferMaintenanceWindowBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeferMaintenanceWindowTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetMaintenanceWindowOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetMaintenanceWindowOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetMaintenanceWindowOpts) Run() error { - params := &atlasv2.GetMaintenanceWindowApiParams{ +func (opts *GetMaintenanceWindowOpts) Run(ctx context.Context) error { + params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetMaintenanceWindow(params) + resp, _, err := opts.client.MaintenanceWindowsApi.GetMaintenanceWindowWithParams(ctx, params) if err != nil { return err } @@ -114,39 +115,40 @@ func GetMaintenanceWindowBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetMaintenanceWindowTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type ResetMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ResetMaintenanceWindowOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ResetMaintenanceWindowOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ResetMaintenanceWindowOpts) Run() error { - params := &atlasv2.ResetMaintenanceWindowApiParams{ +func (opts *ResetMaintenanceWindowOpts) Run(ctx context.Context) error { + params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.ResetMaintenanceWindow(params) + resp, _, err := opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params) if err != nil { return err } @@ -166,39 +168,40 @@ func ResetMaintenanceWindowBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ResetMaintenanceWindowTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type ToggleMaintenanceAutoDeferOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ToggleMaintenanceAutoDeferOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ToggleMaintenanceAutoDeferOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ToggleMaintenanceAutoDeferOpts) Run() error { - params := &atlasv2.ToggleMaintenanceAutoDeferApiParams{ +func (opts *ToggleMaintenanceAutoDeferOpts) Run(ctx context.Context) error { + params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, } - _, err := opts.store.ToggleMaintenanceAutoDefer(params) + _, err := opts.client.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(ctx, params) if err != nil { return err } @@ -218,39 +221,40 @@ func ToggleMaintenanceAutoDeferBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ToggleMaintenanceAutoDeferTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpdateMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateMaintenanceWindowOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateMaintenanceWindowOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateMaintenanceWindowOpts) Run() error { - params := &atlasv2.UpdateMaintenanceWindowApiParams{ +func (opts *UpdateMaintenanceWindowOpts) Run(ctx context.Context) error { + params := &admin.UpdateMaintenanceWindowApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpdateMaintenanceWindow(params) + resp, _, err := opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params) if err != nil { return err } @@ -270,16 +274,17 @@ func UpdateMaintenanceWindowBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateMaintenanceWindowTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_maintenance_windows__store.go b/internal/generated/api_maintenance_windows__store.go deleted file mode 100644 index 8839b87fec..0000000000 --- a/internal/generated/api_maintenance_windows__store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_maintenance_windows__store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DeferMaintenanceWindowOperation, GetMaintenanceWindowOperation, ResetMaintenanceWindowOperation, ToggleMaintenanceAutoDeferOperation, UpdateMaintenanceWindowOperation - -type DeferMaintenanceWindowOperation interface { - DeferMaintenanceWindow (*atlasv2.DeferMaintenanceWindowApiParams) error -} - -// DeferMaintenanceWindow encapsulates the logic to manage different cloud providers. -func (s *Store) DeferMaintenanceWindow(params *atlasv2.DeferMaintenanceWindowApiParams) (error) { - _, err := s.clientv2.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(s.ctx, params).Execute() - return err -} - -type GetMaintenanceWindowOperation interface { - GetMaintenanceWindow (*atlasv2.GetMaintenanceWindowApiParams) (*atlasv2.GroupMaintenanceWindow, error) -} - -// GetMaintenanceWindow encapsulates the logic to manage different cloud providers. -func (s *Store) GetMaintenanceWindow(params *atlasv2.GetMaintenanceWindowApiParams) (*atlasv2.GroupMaintenanceWindow, error) { - result, _, err := s.clientv2.MaintenanceWindowsApi.GetMaintenanceWindowWithParams(s.ctx, params).Execute() - return &result, err -} - -type ResetMaintenanceWindowOperation interface { - ResetMaintenanceWindow (*atlasv2.ResetMaintenanceWindowApiParams) (*atlasv2.map[string]interface{}, error) -} - -// ResetMaintenanceWindow encapsulates the logic to manage different cloud providers. -func (s *Store) ResetMaintenanceWindow(params *atlasv2.ResetMaintenanceWindowApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(s.ctx, params).Execute() - return &result, err -} - -type ToggleMaintenanceAutoDeferOperation interface { - ToggleMaintenanceAutoDefer (*atlasv2.ToggleMaintenanceAutoDeferApiParams) error -} - -// ToggleMaintenanceAutoDefer encapsulates the logic to manage different cloud providers. -func (s *Store) ToggleMaintenanceAutoDefer(params *atlasv2.ToggleMaintenanceAutoDeferApiParams) (error) { - _, err := s.clientv2.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(s.ctx, params).Execute() - return err -} - -type UpdateMaintenanceWindowOperation interface { - UpdateMaintenanceWindow (*atlasv2.UpdateMaintenanceWindowApiParams) (*atlasv2.map[string]interface{}, error) -} - -// UpdateMaintenanceWindow encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateMaintenanceWindow(params *atlasv2.UpdateMaintenanceWindowApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index 0532c7d67e..5acb122ade 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -19,28 +19,28 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateUserOperation + client admin.APIClient } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateUserOpts) Run() error { - params := &atlasv2.CreateUserApiParams{ +func (opts *CreateUserOpts) Run(ctx context.Context) error { + params := &admin.CreateUserApiParams{ } - resp, _, err := opts.store.CreateUser(params) + resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params) if err != nil { return err } @@ -60,13 +60,13 @@ func CreateUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } @@ -75,23 +75,23 @@ func CreateUserBuilder() cobra.Command { type GetUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetUserOperation + client admin.APIClient userId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetUserOpts) Run() error { - params := &atlasv2.GetUserApiParams{ +func (opts *GetUserOpts) Run(ctx context.Context) error { + params := &admin.GetUserApiParams{ UserId: opts.userId, } - resp, _, err := opts.store.GetUser(params) + resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserWithParams(ctx, params) if err != nil { return err } @@ -111,39 +111,40 @@ func GetUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") + _ = cmd.MarkFlagRequired("userId") return cmd } type GetUserByUsernameOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetUserByUsernameOperation + client admin.APIClient userName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetUserByUsernameOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetUserByUsernameOpts) Run() error { - params := &atlasv2.GetUserByUsernameApiParams{ +func (opts *GetUserByUsernameOpts) Run(ctx context.Context) error { + params := &admin.GetUserByUsernameApiParams{ UserName: opts.userName, } - resp, _, err := opts.store.GetUserByUsername(params) + resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserByUsernameWithParams(ctx, params) if err != nil { return err } @@ -163,16 +164,17 @@ func GetUserByUsernameBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetUserByUsernameTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.userName, "userName", "", "usage description") + _ = cmd.MarkFlagRequired("userName") return cmd } diff --git a/internal/generated/api_mongo_db_cloud_users_store.go b/internal/generated/api_mongo_db_cloud_users_store.go deleted file mode 100644 index 4879eaaf46..0000000000 --- a/internal/generated/api_mongo_db_cloud_users_store.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_mongo_db_cloud_users_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateUserOperation, GetUserOperation, GetUserByUsernameOperation - -type CreateUserOperation interface { - CreateUser (*atlasv2.CreateUserApiParams) (*atlasv2.AppUser, error) -} - -// CreateUser encapsulates the logic to manage different cloud providers. -func (s *Store) CreateUser(params *atlasv2.CreateUserApiParams) (*atlasv2.AppUser, error) { - result, _, err := s.clientv2.MongoDBCloudUsersApi.CreateUserWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetUserOperation interface { - GetUser (*atlasv2.GetUserApiParams) (*atlasv2.AppUser, error) -} - -// GetUser encapsulates the logic to manage different cloud providers. -func (s *Store) GetUser(params *atlasv2.GetUserApiParams) (*atlasv2.AppUser, error) { - result, _, err := s.clientv2.MongoDBCloudUsersApi.GetUserWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetUserByUsernameOperation interface { - GetUserByUsername (*atlasv2.GetUserByUsernameApiParams) (*atlasv2.AppUser, error) -} - -// GetUserByUsername encapsulates the logic to manage different cloud providers. -func (s *Store) GetUserByUsername(params *atlasv2.GetUserByUsernameApiParams) (*atlasv2.AppUser, error) { - result, _, err := s.clientv2.MongoDBCloudUsersApi.GetUserByUsernameWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index 44eae421be..5749fc290a 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type GetAtlasProcessOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetAtlasProcessOperation + client admin.APIClient groupId string processId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetAtlasProcessOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetAtlasProcessOpts) Run() error { - params := &atlasv2.GetAtlasProcessApiParams{ +func (opts *GetAtlasProcessOpts) Run(ctx context.Context) error { + params := &admin.GetAtlasProcessApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, } - resp, _, err := opts.store.GetAtlasProcess(params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetAtlasProcessWithParams(ctx, params) if err != nil { return err } @@ -64,44 +64,46 @@ func GetAtlasProcessBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetAtlasProcessTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") return cmd } type GetDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetDatabaseOperation + client admin.APIClient groupId string databaseName string processId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetDatabaseOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetDatabaseOpts) Run() error { - params := &atlasv2.GetDatabaseApiParams{ +func (opts *GetDatabaseOpts) Run(ctx context.Context) error { + params := &admin.GetDatabaseApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, ProcessId: opts.processId, } - resp, _, err := opts.store.GetDatabase(params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseWithParams(ctx, params) if err != nil { return err } @@ -121,25 +123,28 @@ func GetDatabaseBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetDatabaseTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + _ = cmd.MarkFlagRequired("databaseName") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") return cmd } type GetDatabaseMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetDatabaseMeasurementsOperation + client admin.APIClient groupId string databaseName string processId string @@ -150,16 +155,16 @@ type GetDatabaseMeasurementsOpts struct { end time.Time } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetDatabaseMeasurementsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetDatabaseMeasurementsOpts) Run() error { - params := &atlasv2.GetDatabaseMeasurementsApiParams{ +func (opts *GetDatabaseMeasurementsOpts) Run(ctx context.Context) error { + params := &admin.GetDatabaseMeasurementsApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, ProcessId: opts.processId, @@ -169,7 +174,7 @@ func (opts *GetDatabaseMeasurementsOpts) Run() error { Start: opts.start, End: opts.end, } - resp, _, err := opts.store.GetDatabaseMeasurements(params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(ctx, params) if err != nil { return err } @@ -189,18 +194,21 @@ func GetDatabaseMeasurementsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetDatabaseMeasurementsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + _ = cmd.MarkFlagRequired("databaseName") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.m, "m", "", "usage description") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") cmd.Flags().StringVar(&opts.period, "period", "", "usage description") @@ -212,7 +220,7 @@ func GetDatabaseMeasurementsBuilder() cobra.Command { type GetDiskMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetDiskMeasurementsOperation + client admin.APIClient groupId string partitionName string processId string @@ -223,16 +231,16 @@ type GetDiskMeasurementsOpts struct { end time.Time } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetDiskMeasurementsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetDiskMeasurementsOpts) Run() error { - params := &atlasv2.GetDiskMeasurementsApiParams{ +func (opts *GetDiskMeasurementsOpts) Run(ctx context.Context) error { + params := &admin.GetDiskMeasurementsApiParams{ GroupId: opts.groupId, PartitionName: opts.partitionName, ProcessId: opts.processId, @@ -242,7 +250,7 @@ func (opts *GetDiskMeasurementsOpts) Run() error { Start: opts.start, End: opts.end, } - resp, _, err := opts.store.GetDiskMeasurements(params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(ctx, params) if err != nil { return err } @@ -262,18 +270,21 @@ func GetDiskMeasurementsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetDiskMeasurementsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "usage description") + _ = cmd.MarkFlagRequired("partitionName") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.m, "m", "", "usage description") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") cmd.Flags().StringVar(&opts.period, "period", "", "usage description") @@ -285,7 +296,7 @@ func GetDiskMeasurementsBuilder() cobra.Command { type GetHostLogsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetHostLogsOperation + client admin.APIClient groupId string hostName string logName string @@ -293,23 +304,23 @@ type GetHostLogsOpts struct { startDate int64 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetHostLogsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetHostLogsOpts) Run() error { - params := &atlasv2.GetHostLogsApiParams{ +func (opts *GetHostLogsOpts) Run(ctx context.Context) error { + params := &admin.GetHostLogsApiParams{ GroupId: opts.groupId, HostName: opts.hostName, LogName: opts.logName, EndDate: opts.endDate, StartDate: opts.startDate, } - resp, _, err := opts.store.GetHostLogs(params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetHostLogsWithParams(ctx, params) if err != nil { return err } @@ -329,18 +340,21 @@ func GetHostLogsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetHostLogsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.hostName, "hostName", "", "usage description") + _ = cmd.MarkFlagRequired("hostName") cmd.Flags().StringVar(&opts.logName, "logName", "", "usage description") + _ = cmd.MarkFlagRequired("logName") cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") @@ -349,7 +363,7 @@ func GetHostLogsBuilder() cobra.Command { type GetHostMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetHostMeasurementsOperation + client admin.APIClient groupId string processId string m []string @@ -359,16 +373,16 @@ type GetHostMeasurementsOpts struct { end time.Time } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetHostMeasurementsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetHostMeasurementsOpts) Run() error { - params := &atlasv2.GetHostMeasurementsApiParams{ +func (opts *GetHostMeasurementsOpts) Run(ctx context.Context) error { + params := &admin.GetHostMeasurementsApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, M: opts.m, @@ -377,7 +391,7 @@ func (opts *GetHostMeasurementsOpts) Run() error { Start: opts.start, End: opts.end, } - resp, _, err := opts.store.GetHostMeasurements(params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetHostMeasurementsWithParams(ctx, params) if err != nil { return err } @@ -397,17 +411,19 @@ func GetHostMeasurementsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetHostMeasurementsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.m, "m", "", "usage description") cmd.Flags().StringVar(&opts.period, "period", "", "usage description") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") @@ -419,7 +435,7 @@ func GetHostMeasurementsBuilder() cobra.Command { type GetIndexMetricsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetIndexMetricsOperation + client admin.APIClient processId string indexName string databaseName string @@ -432,16 +448,16 @@ type GetIndexMetricsOpts struct { metrics []string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetIndexMetricsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetIndexMetricsOpts) Run() error { - params := &atlasv2.GetIndexMetricsApiParams{ +func (opts *GetIndexMetricsOpts) Run(ctx context.Context) error { + params := &admin.GetIndexMetricsApiParams{ ProcessId: opts.processId, IndexName: opts.indexName, DatabaseName: opts.databaseName, @@ -453,7 +469,7 @@ func (opts *GetIndexMetricsOpts) Run() error { End: opts.end, Metrics: opts.metrics, } - resp, _, err := opts.store.GetIndexMetrics(params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params) if err != nil { return err } @@ -473,20 +489,25 @@ func GetIndexMetricsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetIndexMetricsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.indexName, "indexName", "", "usage description") + _ = cmd.MarkFlagRequired("indexName") cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + _ = cmd.MarkFlagRequired("databaseName") cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") + _ = cmd.MarkFlagRequired("collectionName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") cmd.Flags().StringVar(&opts.period, "period", "", "usage description") cmd.Flags().StringVar(&opts.start, "start", "", "usage description") @@ -498,7 +519,7 @@ func GetIndexMetricsBuilder() cobra.Command { type GetMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetMeasurementsOperation + client admin.APIClient processId string groupId string granularity string @@ -508,16 +529,16 @@ type GetMeasurementsOpts struct { metrics []string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetMeasurementsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetMeasurementsOpts) Run() error { - params := &atlasv2.GetMeasurementsApiParams{ +func (opts *GetMeasurementsOpts) Run(ctx context.Context) error { + params := &admin.GetMeasurementsApiParams{ ProcessId: opts.processId, GroupId: opts.groupId, Granularity: opts.granularity, @@ -526,7 +547,7 @@ func (opts *GetMeasurementsOpts) Run() error { End: opts.end, Metrics: opts.metrics, } - resp, _, err := opts.store.GetMeasurements(params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params) if err != nil { return err } @@ -546,17 +567,19 @@ func GetMeasurementsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetMeasurementsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") cmd.Flags().StringVar(&opts.period, "period", "", "usage description") cmd.Flags().StringVar(&opts.start, "start", "", "usage description") @@ -568,29 +591,29 @@ func GetMeasurementsBuilder() cobra.Command { type ListAtlasProcessesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListAtlasProcessesOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListAtlasProcessesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListAtlasProcessesOpts) Run() error { - params := &atlasv2.ListAtlasProcessesApiParams{ +func (opts *ListAtlasProcessesOpts) Run(ctx context.Context) error { + params := &admin.ListAtlasProcessesApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListAtlasProcesses(params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListAtlasProcessesWithParams(ctx, params) if err != nil { return err } @@ -610,16 +633,17 @@ func ListAtlasProcessesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListAtlasProcessesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -629,7 +653,7 @@ func ListAtlasProcessesBuilder() cobra.Command { type ListDatabasesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListDatabasesOperation + client admin.APIClient groupId string processId string includeCount bool @@ -637,23 +661,23 @@ type ListDatabasesOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListDatabasesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListDatabasesOpts) Run() error { - params := &atlasv2.ListDatabasesApiParams{ +func (opts *ListDatabasesOpts) Run(ctx context.Context) error { + params := &admin.ListDatabasesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListDatabases(params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListDatabasesWithParams(ctx, params) if err != nil { return err } @@ -673,17 +697,19 @@ func ListDatabasesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListDatabasesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -693,27 +719,27 @@ func ListDatabasesBuilder() cobra.Command { type ListDiskMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListDiskMeasurementsOperation + client admin.APIClient partitionName string groupId string processId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListDiskMeasurementsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListDiskMeasurementsOpts) Run() error { - params := &atlasv2.ListDiskMeasurementsApiParams{ +func (opts *ListDiskMeasurementsOpts) Run(ctx context.Context) error { + params := &admin.ListDiskMeasurementsApiParams{ PartitionName: opts.partitionName, GroupId: opts.groupId, ProcessId: opts.processId, } - resp, _, err := opts.store.ListDiskMeasurements(params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(ctx, params) if err != nil { return err } @@ -733,25 +759,28 @@ func ListDiskMeasurementsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListDiskMeasurementsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "usage description") + _ = cmd.MarkFlagRequired("partitionName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") return cmd } type ListDiskPartitionsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListDiskPartitionsOperation + client admin.APIClient groupId string processId string includeCount bool @@ -759,23 +788,23 @@ type ListDiskPartitionsOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListDiskPartitionsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListDiskPartitionsOpts) Run() error { - params := &atlasv2.ListDiskPartitionsApiParams{ +func (opts *ListDiskPartitionsOpts) Run(ctx context.Context) error { + params := &admin.ListDiskPartitionsApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListDiskPartitions(params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskPartitionsWithParams(ctx, params) if err != nil { return err } @@ -795,17 +824,19 @@ func ListDiskPartitionsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListDiskPartitionsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -815,7 +846,7 @@ func ListDiskPartitionsBuilder() cobra.Command { type ListIndexMetricsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListIndexMetricsOperation + client admin.APIClient processId string databaseName string collectionName string @@ -827,16 +858,16 @@ type ListIndexMetricsOpts struct { metrics []string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListIndexMetricsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListIndexMetricsOpts) Run() error { - params := &atlasv2.ListIndexMetricsApiParams{ +func (opts *ListIndexMetricsOpts) Run(ctx context.Context) error { + params := &admin.ListIndexMetricsApiParams{ ProcessId: opts.processId, DatabaseName: opts.databaseName, CollectionName: opts.collectionName, @@ -847,7 +878,7 @@ func (opts *ListIndexMetricsOpts) Run() error { End: opts.end, Metrics: opts.metrics, } - resp, _, err := opts.store.ListIndexMetrics(params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params) if err != nil { return err } @@ -867,19 +898,23 @@ func ListIndexMetricsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListIndexMetricsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") + _ = cmd.MarkFlagRequired("databaseName") cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") + _ = cmd.MarkFlagRequired("collectionName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") cmd.Flags().StringVar(&opts.period, "period", "", "usage description") cmd.Flags().StringVar(&opts.start, "start", "", "usage description") @@ -891,25 +926,25 @@ func ListIndexMetricsBuilder() cobra.Command { type ListMetricTypesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListMetricTypesOperation + client admin.APIClient processId string groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListMetricTypesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListMetricTypesOpts) Run() error { - params := &atlasv2.ListMetricTypesApiParams{ +func (opts *ListMetricTypesOpts) Run(ctx context.Context) error { + params := &admin.ListMetricTypesApiParams{ ProcessId: opts.processId, GroupId: opts.groupId, } - resp, _, err := opts.store.ListMetricTypes(params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListMetricTypesWithParams(ctx, params) if err != nil { return err } @@ -929,17 +964,19 @@ func ListMetricTypesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListMetricTypesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_monitoring_and_logs_store.go b/internal/generated/api_monitoring_and_logs_store.go deleted file mode 100644 index df99d50cdb..0000000000 --- a/internal/generated/api_monitoring_and_logs_store.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_monitoring_and_logs_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetAtlasProcessOperation, GetDatabaseOperation, GetDatabaseMeasurementsOperation, GetDiskMeasurementsOperation, GetHostLogsOperation, GetHostMeasurementsOperation, GetIndexMetricsOperation, GetMeasurementsOperation, ListAtlasProcessesOperation, ListDatabasesOperation, ListDiskMeasurementsOperation, ListDiskPartitionsOperation, ListIndexMetricsOperation, ListMetricTypesOperation - -type GetAtlasProcessOperation interface { - GetAtlasProcess (*atlasv2.GetAtlasProcessApiParams) (*atlasv2.HostViewAtlas, error) -} - -// GetAtlasProcess encapsulates the logic to manage different cloud providers. -func (s *Store) GetAtlasProcess(params *atlasv2.GetAtlasProcessApiParams) (*atlasv2.HostViewAtlas, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.GetAtlasProcessWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetDatabaseOperation interface { - GetDatabase (*atlasv2.GetDatabaseApiParams) (*atlasv2.Database, error) -} - -// GetDatabase encapsulates the logic to manage different cloud providers. -func (s *Store) GetDatabase(params *atlasv2.GetDatabaseApiParams) (*atlasv2.Database, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.GetDatabaseWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetDatabaseMeasurementsOperation interface { - GetDatabaseMeasurements (*atlasv2.GetDatabaseMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) -} - -// GetDatabaseMeasurements encapsulates the logic to manage different cloud providers. -func (s *Store) GetDatabaseMeasurements(params *atlasv2.GetDatabaseMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetDiskMeasurementsOperation interface { - GetDiskMeasurements (*atlasv2.GetDiskMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) -} - -// GetDiskMeasurements encapsulates the logic to manage different cloud providers. -func (s *Store) GetDiskMeasurements(params *atlasv2.GetDiskMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetHostLogsOperation interface { - GetHostLogs (*atlasv2.GetHostLogsApiParams) (*atlasv2.*os.File, error) -} - -// GetHostLogs encapsulates the logic to manage different cloud providers. -func (s *Store) GetHostLogs(params *atlasv2.GetHostLogsApiParams) (*atlasv2.*os.File, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.GetHostLogsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetHostMeasurementsOperation interface { - GetHostMeasurements (*atlasv2.GetHostMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) -} - -// GetHostMeasurements encapsulates the logic to manage different cloud providers. -func (s *Store) GetHostMeasurements(params *atlasv2.GetHostMeasurementsApiParams) (*atlasv2.MeasurementsGeneralViewAtlas, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.GetHostMeasurementsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetIndexMetricsOperation interface { - GetIndexMetrics (*atlasv2.GetIndexMetricsApiParams) (*atlasv2.MeasurementsIndexes, error) -} - -// GetIndexMetrics encapsulates the logic to manage different cloud providers. -func (s *Store) GetIndexMetrics(params *atlasv2.GetIndexMetricsApiParams) (*atlasv2.MeasurementsIndexes, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.GetIndexMetricsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetMeasurementsOperation interface { - GetMeasurements (*atlasv2.GetMeasurementsApiParams) (*atlasv2.MeasurementsNonIndex, error) -} - -// GetMeasurements encapsulates the logic to manage different cloud providers. -func (s *Store) GetMeasurements(params *atlasv2.GetMeasurementsApiParams) (*atlasv2.MeasurementsNonIndex, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.GetMeasurementsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListAtlasProcessesOperation interface { - ListAtlasProcesses (*atlasv2.ListAtlasProcessesApiParams) (*atlasv2.PaginatedHostViewAtlas, error) -} - -// ListAtlasProcesses encapsulates the logic to manage different cloud providers. -func (s *Store) ListAtlasProcesses(params *atlasv2.ListAtlasProcessesApiParams) (*atlasv2.PaginatedHostViewAtlas, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.ListAtlasProcessesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListDatabasesOperation interface { - ListDatabases (*atlasv2.ListDatabasesApiParams) (*atlasv2.PaginatedDatabase, error) -} - -// ListDatabases encapsulates the logic to manage different cloud providers. -func (s *Store) ListDatabases(params *atlasv2.ListDatabasesApiParams) (*atlasv2.PaginatedDatabase, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.ListDatabasesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListDiskMeasurementsOperation interface { - ListDiskMeasurements (*atlasv2.ListDiskMeasurementsApiParams) (*atlasv2.DiskPartition, error) -} - -// ListDiskMeasurements encapsulates the logic to manage different cloud providers. -func (s *Store) ListDiskMeasurements(params *atlasv2.ListDiskMeasurementsApiParams) (*atlasv2.DiskPartition, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListDiskPartitionsOperation interface { - ListDiskPartitions (*atlasv2.ListDiskPartitionsApiParams) (*atlasv2.PaginatedDiskPartition, error) -} - -// ListDiskPartitions encapsulates the logic to manage different cloud providers. -func (s *Store) ListDiskPartitions(params *atlasv2.ListDiskPartitionsApiParams) (*atlasv2.PaginatedDiskPartition, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.ListDiskPartitionsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListIndexMetricsOperation interface { - ListIndexMetrics (*atlasv2.ListIndexMetricsApiParams) (*atlasv2.MeasurementsIndexes, error) -} - -// ListIndexMetrics encapsulates the logic to manage different cloud providers. -func (s *Store) ListIndexMetrics(params *atlasv2.ListIndexMetricsApiParams) (*atlasv2.MeasurementsIndexes, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.ListIndexMetricsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListMetricTypesOperation interface { - ListMetricTypes (*atlasv2.ListMetricTypesApiParams) (*atlasv2.FTSMetrics, error) -} - -// ListMetricTypes encapsulates the logic to manage different cloud providers. -func (s *Store) ListMetricTypes(params *atlasv2.ListMetricTypesApiParams) (*atlasv2.FTSMetrics, error) { - result, _, err := s.clientv2.MonitoringAndLogsApi.ListMetricTypesWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 7a7ede0916..6166db063c 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateClusterOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateClusterOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateClusterOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateClusterOpts) Run() error { - params := &atlasv2.CreateClusterApiParams{ +func (opts *CreateClusterOpts) Run(ctx context.Context) error { + params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateCluster(params) + resp, _, err := opts.client.MultiCloudClustersApi.CreateClusterWithParams(ctx, params) if err != nil { return err } @@ -62,43 +62,44 @@ func CreateClusterBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateClusterTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeleteClusterOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteClusterOperation + client admin.APIClient groupId string clusterName string retainBackups bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteClusterOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteClusterOpts) Run() error { - params := &atlasv2.DeleteClusterApiParams{ +func (opts *DeleteClusterOpts) Run(ctx context.Context) error { + params := &admin.DeleteClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, RetainBackups: opts.retainBackups, } - _, err := opts.store.DeleteCluster(params) + _, err := opts.client.MultiCloudClustersApi.DeleteClusterWithParams(ctx, params) if err != nil { return err } @@ -118,17 +119,19 @@ func DeleteClusterBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteClusterTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.retainBackups, "retainBackups", "", "usage description") return cmd @@ -136,25 +139,25 @@ func DeleteClusterBuilder() cobra.Command { type GetClusterOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetClusterOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetClusterOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetClusterOpts) Run() error { - params := &atlasv2.GetClusterApiParams{ +func (opts *GetClusterOpts) Run(ctx context.Context) error { + params := &admin.GetClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetCluster(params) + resp, _, err := opts.client.MultiCloudClustersApi.GetClusterWithParams(ctx, params) if err != nil { return err } @@ -174,46 +177,48 @@ func GetClusterBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetClusterTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type ListClustersOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListClustersOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListClustersOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListClustersOpts) Run() error { - params := &atlasv2.ListClustersApiParams{ +func (opts *ListClustersOpts) Run(ctx context.Context) error { + params := &admin.ListClustersApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListClusters(params) + resp, _, err := opts.client.MultiCloudClustersApi.ListClustersWithParams(ctx, params) if err != nil { return err } @@ -233,16 +238,17 @@ func ListClustersBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListClustersTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -252,25 +258,25 @@ func ListClustersBuilder() cobra.Command { type TestFailoverOpts struct { cli.GlobalOpts cli.OutputOpts - store store.TestFailoverOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *TestFailoverOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *TestFailoverOpts) Run() error { - params := &atlasv2.TestFailoverApiParams{ +func (opts *TestFailoverOpts) Run(ctx context.Context) error { + params := &admin.TestFailoverApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - _, err := opts.store.TestFailover(params) + _, err := opts.client.MultiCloudClustersApi.TestFailoverWithParams(ctx, params) if err != nil { return err } @@ -290,42 +296,44 @@ func TestFailoverBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), TestFailoverTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type UpdateClusterOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateClusterOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateClusterOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateClusterOpts) Run() error { - params := &atlasv2.UpdateClusterApiParams{ +func (opts *UpdateClusterOpts) Run(ctx context.Context) error { + params := &admin.UpdateClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.UpdateCluster(params) + resp, _, err := opts.client.MultiCloudClustersApi.UpdateClusterWithParams(ctx, params) if err != nil { return err } @@ -345,17 +353,19 @@ func UpdateClusterBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateClusterTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/generated/api_multi_cloud_clusters_store.go b/internal/generated/api_multi_cloud_clusters_store.go deleted file mode 100644 index 3bb2183e7a..0000000000 --- a/internal/generated/api_multi_cloud_clusters_store.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_multi_cloud_clusters_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateClusterOperation, DeleteClusterOperation, GetClusterOperation, ListClustersOperation, TestFailoverOperation, UpdateClusterOperation - -type CreateClusterOperation interface { - CreateCluster (*atlasv2.CreateClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) -} - -// CreateCluster encapsulates the logic to manage different cloud providers. -func (s *Store) CreateCluster(params *atlasv2.CreateClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) { - result, _, err := s.clientv2.MultiCloudClustersApi.CreateClusterWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteClusterOperation interface { - DeleteCluster (*atlasv2.DeleteClusterApiParams) error -} - -// DeleteCluster encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteCluster(params *atlasv2.DeleteClusterApiParams) (error) { - _, err := s.clientv2.MultiCloudClustersApi.DeleteClusterWithParams(s.ctx, params).Execute() - return err -} - -type GetClusterOperation interface { - GetCluster (*atlasv2.GetClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) -} - -// GetCluster encapsulates the logic to manage different cloud providers. -func (s *Store) GetCluster(params *atlasv2.GetClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) { - result, _, err := s.clientv2.MultiCloudClustersApi.GetClusterWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListClustersOperation interface { - ListClusters (*atlasv2.ListClustersApiParams) (*atlasv2.PaginatedClusterDescriptionV15, error) -} - -// ListClusters encapsulates the logic to manage different cloud providers. -func (s *Store) ListClusters(params *atlasv2.ListClustersApiParams) (*atlasv2.PaginatedClusterDescriptionV15, error) { - result, _, err := s.clientv2.MultiCloudClustersApi.ListClustersWithParams(s.ctx, params).Execute() - return &result, err -} - -type TestFailoverOperation interface { - TestFailover (*atlasv2.TestFailoverApiParams) error -} - -// TestFailover encapsulates the logic to manage different cloud providers. -func (s *Store) TestFailover(params *atlasv2.TestFailoverApiParams) (error) { - _, err := s.clientv2.MultiCloudClustersApi.TestFailoverWithParams(s.ctx, params).Execute() - return err -} - -type UpdateClusterOperation interface { - UpdateCluster (*atlasv2.UpdateClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) -} - -// UpdateCluster encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateCluster(params *atlasv2.UpdateClusterApiParams) (*atlasv2.ClusterDescriptionV15, error) { - result, _, err := s.clientv2.MultiCloudClustersApi.UpdateClusterWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 93ab605d1b..dbdb07590f 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreatePeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreatePeeringConnectionOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreatePeeringConnectionOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreatePeeringConnectionOpts) Run() error { - params := &atlasv2.CreatePeeringConnectionApiParams{ +func (opts *CreatePeeringConnectionOpts) Run(ctx context.Context) error { + params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreatePeeringConnection(params) + resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params) if err != nil { return err } @@ -62,39 +62,40 @@ func CreatePeeringConnectionBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreatePeeringConnectionTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type CreatePeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreatePeeringContainerOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreatePeeringContainerOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreatePeeringContainerOpts) Run() error { - params := &atlasv2.CreatePeeringContainerApiParams{ +func (opts *CreatePeeringContainerOpts) Run(ctx context.Context) error { + params := &admin.CreatePeeringContainerApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreatePeeringContainer(params) + resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params) if err != nil { return err } @@ -114,41 +115,42 @@ func CreatePeeringContainerBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreatePeeringContainerTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeletePeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeletePeeringConnectionOperation + client admin.APIClient groupId string peerId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeletePeeringConnectionOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeletePeeringConnectionOpts) Run() error { - params := &atlasv2.DeletePeeringConnectionApiParams{ +func (opts *DeletePeeringConnectionOpts) Run(ctx context.Context) error { + params := &admin.DeletePeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, } - resp, _, err := opts.store.DeletePeeringConnection(params) + resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringConnectionWithParams(ctx, params) if err != nil { return err } @@ -168,42 +170,44 @@ func DeletePeeringConnectionBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeletePeeringConnectionTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") + _ = cmd.MarkFlagRequired("peerId") return cmd } type DeletePeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeletePeeringContainerOperation + client admin.APIClient groupId string containerId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeletePeeringContainerOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeletePeeringContainerOpts) Run() error { - params := &atlasv2.DeletePeeringContainerApiParams{ +func (opts *DeletePeeringContainerOpts) Run(ctx context.Context) error { + params := &admin.DeletePeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, } - resp, _, err := opts.store.DeletePeeringContainer(params) + resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringContainerWithParams(ctx, params) if err != nil { return err } @@ -223,40 +227,42 @@ func DeletePeeringContainerBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeletePeeringContainerTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") + _ = cmd.MarkFlagRequired("containerId") return cmd } type DisablePeeringOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DisablePeeringOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DisablePeeringOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DisablePeeringOpts) Run() error { - params := &atlasv2.DisablePeeringApiParams{ +func (opts *DisablePeeringOpts) Run(ctx context.Context) error { + params := &admin.DisablePeeringApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.DisablePeering(params) + resp, _, err := opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params) if err != nil { return err } @@ -276,41 +282,42 @@ func DisablePeeringBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DisablePeeringTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetPeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetPeeringConnectionOperation + client admin.APIClient groupId string peerId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetPeeringConnectionOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetPeeringConnectionOpts) Run() error { - params := &atlasv2.GetPeeringConnectionApiParams{ +func (opts *GetPeeringConnectionOpts) Run(ctx context.Context) error { + params := &admin.GetPeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, } - resp, _, err := opts.store.GetPeeringConnection(params) + resp, _, err := opts.client.NetworkPeeringApi.GetPeeringConnectionWithParams(ctx, params) if err != nil { return err } @@ -330,42 +337,44 @@ func GetPeeringConnectionBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetPeeringConnectionTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") + _ = cmd.MarkFlagRequired("peerId") return cmd } type GetPeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetPeeringContainerOperation + client admin.APIClient groupId string containerId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetPeeringContainerOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetPeeringContainerOpts) Run() error { - params := &atlasv2.GetPeeringContainerApiParams{ +func (opts *GetPeeringContainerOpts) Run(ctx context.Context) error { + params := &admin.GetPeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, } - resp, _, err := opts.store.GetPeeringContainer(params) + resp, _, err := opts.client.NetworkPeeringApi.GetPeeringContainerWithParams(ctx, params) if err != nil { return err } @@ -385,24 +394,26 @@ func GetPeeringContainerBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetPeeringContainerTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") + _ = cmd.MarkFlagRequired("containerId") return cmd } type ListPeeringConnectionsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPeeringConnectionsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -410,23 +421,23 @@ type ListPeeringConnectionsOpts struct { providerName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPeeringConnectionsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPeeringConnectionsOpts) Run() error { - params := &atlasv2.ListPeeringConnectionsApiParams{ +func (opts *ListPeeringConnectionsOpts) Run(ctx context.Context) error { + params := &admin.ListPeeringConnectionsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, ProviderName: opts.providerName, } - resp, _, err := opts.store.ListPeeringConnections(params) + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringConnectionsWithParams(ctx, params) if err != nil { return err } @@ -446,16 +457,17 @@ func ListPeeringConnectionsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPeeringConnectionsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -466,7 +478,7 @@ func ListPeeringConnectionsBuilder() cobra.Command { type ListPeeringContainerByCloudProviderOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPeeringContainerByCloudProviderOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -474,23 +486,23 @@ type ListPeeringContainerByCloudProviderOpts struct { providerName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPeeringContainerByCloudProviderOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPeeringContainerByCloudProviderOpts) Run() error { - params := &atlasv2.ListPeeringContainerByCloudProviderApiParams{ +func (opts *ListPeeringContainerByCloudProviderOpts) Run(ctx context.Context) error { + params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, ProviderName: opts.providerName, } - resp, _, err := opts.store.ListPeeringContainerByCloudProvider(params) + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params) if err != nil { return err } @@ -510,16 +522,17 @@ func ListPeeringContainerByCloudProviderBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPeeringContainerByCloudProviderTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -530,29 +543,29 @@ func ListPeeringContainerByCloudProviderBuilder() cobra.Command { type ListPeeringContainersOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPeeringContainersOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPeeringContainersOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPeeringContainersOpts) Run() error { - params := &atlasv2.ListPeeringContainersApiParams{ +func (opts *ListPeeringContainersOpts) Run(ctx context.Context) error { + params := &admin.ListPeeringContainersApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListPeeringContainers(params) + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainersWithParams(ctx, params) if err != nil { return err } @@ -572,16 +585,17 @@ func ListPeeringContainersBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPeeringContainersTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -591,25 +605,25 @@ func ListPeeringContainersBuilder() cobra.Command { type UpdatePeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdatePeeringConnectionOperation + client admin.APIClient groupId string peerId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdatePeeringConnectionOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdatePeeringConnectionOpts) Run() error { - params := &atlasv2.UpdatePeeringConnectionApiParams{ +func (opts *UpdatePeeringConnectionOpts) Run(ctx context.Context) error { + params := &admin.UpdatePeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, } - resp, _, err := opts.store.UpdatePeeringConnection(params) + resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params) if err != nil { return err } @@ -629,42 +643,44 @@ func UpdatePeeringConnectionBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdatePeeringConnectionTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") + _ = cmd.MarkFlagRequired("peerId") return cmd } type UpdatePeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdatePeeringContainerOperation + client admin.APIClient groupId string containerId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdatePeeringContainerOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdatePeeringContainerOpts) Run() error { - params := &atlasv2.UpdatePeeringContainerApiParams{ +func (opts *UpdatePeeringContainerOpts) Run(ctx context.Context) error { + params := &admin.UpdatePeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, } - resp, _, err := opts.store.UpdatePeeringContainer(params) + resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params) if err != nil { return err } @@ -684,40 +700,42 @@ func UpdatePeeringContainerBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdatePeeringContainerTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") + _ = cmd.MarkFlagRequired("containerId") return cmd } type VerifyConnectViaPeeringOnlyModeForOneProjectOpts struct { cli.GlobalOpts cli.OutputOpts - store store.VerifyConnectViaPeeringOnlyModeForOneProjectOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) Run() error { - params := &atlasv2.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ +func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Context) error { + params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.VerifyConnectViaPeeringOnlyModeForOneProject(params) + resp, _, err := opts.client.NetworkPeeringApi.VerifyConnectViaPeeringOnlyModeForOneProjectWithParams(ctx, params) if err != nil { return err } @@ -737,16 +755,17 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), VerifyConnectViaPeeringOnlyModeForOneProjectTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_network_peering_store.go b/internal/generated/api_network_peering_store.go deleted file mode 100644 index 667f024e74..0000000000 --- a/internal/generated/api_network_peering_store.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_network_peering_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreatePeeringConnectionOperation, CreatePeeringContainerOperation, DeletePeeringConnectionOperation, DeletePeeringContainerOperation, DisablePeeringOperation, GetPeeringConnectionOperation, GetPeeringContainerOperation, ListPeeringConnectionsOperation, ListPeeringContainerByCloudProviderOperation, ListPeeringContainersOperation, UpdatePeeringConnectionOperation, UpdatePeeringContainerOperation, VerifyConnectViaPeeringOnlyModeForOneProjectOperation - -type CreatePeeringConnectionOperation interface { - CreatePeeringConnection (*atlasv2.CreatePeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) -} - -// CreatePeeringConnection encapsulates the logic to manage different cloud providers. -func (s *Store) CreatePeeringConnection(params *atlasv2.CreatePeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.CreatePeeringConnectionWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreatePeeringContainerOperation interface { - CreatePeeringContainer (*atlasv2.CreatePeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) -} - -// CreatePeeringContainer encapsulates the logic to manage different cloud providers. -func (s *Store) CreatePeeringContainer(params *atlasv2.CreatePeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.CreatePeeringContainerWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeletePeeringConnectionOperation interface { - DeletePeeringConnection (*atlasv2.DeletePeeringConnectionApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeletePeeringConnection encapsulates the logic to manage different cloud providers. -func (s *Store) DeletePeeringConnection(params *atlasv2.DeletePeeringConnectionApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.NetworkPeeringApi.DeletePeeringConnectionWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeletePeeringContainerOperation interface { - DeletePeeringContainer (*atlasv2.DeletePeeringContainerApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeletePeeringContainer encapsulates the logic to manage different cloud providers. -func (s *Store) DeletePeeringContainer(params *atlasv2.DeletePeeringContainerApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.NetworkPeeringApi.DeletePeeringContainerWithParams(s.ctx, params).Execute() - return &result, err -} - -type DisablePeeringOperation interface { - DisablePeering (*atlasv2.DisablePeeringApiParams) (*atlasv2.PrivateIPMode, error) -} - -// DisablePeering encapsulates the logic to manage different cloud providers. -func (s *Store) DisablePeering(params *atlasv2.DisablePeeringApiParams) (*atlasv2.PrivateIPMode, error) { - result, _, err := s.clientv2.NetworkPeeringApi.DisablePeeringWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetPeeringConnectionOperation interface { - GetPeeringConnection (*atlasv2.GetPeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) -} - -// GetPeeringConnection encapsulates the logic to manage different cloud providers. -func (s *Store) GetPeeringConnection(params *atlasv2.GetPeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.GetPeeringConnectionWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetPeeringContainerOperation interface { - GetPeeringContainer (*atlasv2.GetPeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) -} - -// GetPeeringContainer encapsulates the logic to manage different cloud providers. -func (s *Store) GetPeeringContainer(params *atlasv2.GetPeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.GetPeeringContainerWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPeeringConnectionsOperation interface { - ListPeeringConnections (*atlasv2.ListPeeringConnectionsApiParams) (*atlasv2.PaginatedContainerPeer, error) -} - -// ListPeeringConnections encapsulates the logic to manage different cloud providers. -func (s *Store) ListPeeringConnections(params *atlasv2.ListPeeringConnectionsApiParams) (*atlasv2.PaginatedContainerPeer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.ListPeeringConnectionsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPeeringContainerByCloudProviderOperation interface { - ListPeeringContainerByCloudProvider (*atlasv2.ListPeeringContainerByCloudProviderApiParams) (*atlasv2.PaginatedCloudProviderContainer, error) -} - -// ListPeeringContainerByCloudProvider encapsulates the logic to manage different cloud providers. -func (s *Store) ListPeeringContainerByCloudProvider(params *atlasv2.ListPeeringContainerByCloudProviderApiParams) (*atlasv2.PaginatedCloudProviderContainer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPeeringContainersOperation interface { - ListPeeringContainers (*atlasv2.ListPeeringContainersApiParams) (*atlasv2.PaginatedCloudProviderContainer, error) -} - -// ListPeeringContainers encapsulates the logic to manage different cloud providers. -func (s *Store) ListPeeringContainers(params *atlasv2.ListPeeringContainersApiParams) (*atlasv2.PaginatedCloudProviderContainer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.ListPeeringContainersWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdatePeeringConnectionOperation interface { - UpdatePeeringConnection (*atlasv2.UpdatePeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) -} - -// UpdatePeeringConnection encapsulates the logic to manage different cloud providers. -func (s *Store) UpdatePeeringConnection(params *atlasv2.UpdatePeeringConnectionApiParams) (*atlasv2.ContainerPeer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.UpdatePeeringConnectionWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdatePeeringContainerOperation interface { - UpdatePeeringContainer (*atlasv2.UpdatePeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) -} - -// UpdatePeeringContainer encapsulates the logic to manage different cloud providers. -func (s *Store) UpdatePeeringContainer(params *atlasv2.UpdatePeeringContainerApiParams) (*atlasv2.CloudProviderContainer, error) { - result, _, err := s.clientv2.NetworkPeeringApi.UpdatePeeringContainerWithParams(s.ctx, params).Execute() - return &result, err -} - -type VerifyConnectViaPeeringOnlyModeForOneProjectOperation interface { - VerifyConnectViaPeeringOnlyModeForOneProject (*atlasv2.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams) (*atlasv2.PrivateIPMode, error) -} - -// VerifyConnectViaPeeringOnlyModeForOneProject encapsulates the logic to manage different cloud providers. -func (s *Store) VerifyConnectViaPeeringOnlyModeForOneProject(params *atlasv2.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams) (*atlasv2.PrivateIPMode, error) { - result, _, err := s.clientv2.NetworkPeeringApi.VerifyConnectViaPeeringOnlyModeForOneProjectWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index a8a8f5659e..cab40f26ca 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateOnlineArchiveOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateOnlineArchiveOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateOnlineArchiveOpts) Run() error { - params := &atlasv2.CreateOnlineArchiveApiParams{ +func (opts *CreateOnlineArchiveOpts) Run(ctx context.Context) error { + params := &admin.CreateOnlineArchiveApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.CreateOnlineArchive(params) + resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params) if err != nil { return err } @@ -64,44 +64,46 @@ func CreateOnlineArchiveBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateOnlineArchiveTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type DeleteOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteOnlineArchiveOperation + client admin.APIClient groupId string archiveId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteOnlineArchiveOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteOnlineArchiveOpts) Run() error { - params := &atlasv2.DeleteOnlineArchiveApiParams{ +func (opts *DeleteOnlineArchiveOpts) Run(ctx context.Context) error { + params := &admin.DeleteOnlineArchiveApiParams{ GroupId: opts.groupId, ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.DeleteOnlineArchive(params) + resp, _, err := opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params) if err != nil { return err } @@ -121,25 +123,28 @@ func DeleteOnlineArchiveBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteOnlineArchiveTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") + _ = cmd.MarkFlagRequired("archiveId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type DownloadOnlineArchiveQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DownloadOnlineArchiveQueryLogsOperation + client admin.APIClient groupId string clusterName string startDate int64 @@ -147,23 +152,23 @@ type DownloadOnlineArchiveQueryLogsOpts struct { archiveOnly bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DownloadOnlineArchiveQueryLogsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DownloadOnlineArchiveQueryLogsOpts) Run() error { - params := &atlasv2.DownloadOnlineArchiveQueryLogsApiParams{ +func (opts *DownloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { + params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, StartDate: opts.startDate, EndDate: opts.endDate, ArchiveOnly: opts.archiveOnly, } - resp, _, err := opts.store.DownloadOnlineArchiveQueryLogs(params) + resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params) if err != nil { return err } @@ -183,17 +188,19 @@ func DownloadOnlineArchiveQueryLogsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DownloadOnlineArchiveQueryLogsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") cmd.Flags().StringVar(&opts.archiveOnly, "archiveOnly", "", "usage description") @@ -203,27 +210,27 @@ func DownloadOnlineArchiveQueryLogsBuilder() cobra.Command { type GetOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetOnlineArchiveOperation + client admin.APIClient groupId string archiveId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetOnlineArchiveOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetOnlineArchiveOpts) Run() error { - params := &atlasv2.GetOnlineArchiveApiParams{ +func (opts *GetOnlineArchiveOpts) Run(ctx context.Context) error { + params := &admin.GetOnlineArchiveApiParams{ GroupId: opts.groupId, ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.GetOnlineArchive(params) + resp, _, err := opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params) if err != nil { return err } @@ -243,25 +250,28 @@ func GetOnlineArchiveBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetOnlineArchiveTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") + _ = cmd.MarkFlagRequired("archiveId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } type ListOnlineArchivesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListOnlineArchivesOperation + client admin.APIClient groupId string clusterName string includeCount bool @@ -269,23 +279,23 @@ type ListOnlineArchivesOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListOnlineArchivesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListOnlineArchivesOpts) Run() error { - params := &atlasv2.ListOnlineArchivesApiParams{ +func (opts *ListOnlineArchivesOpts) Run(ctx context.Context) error { + params := &admin.ListOnlineArchivesApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListOnlineArchives(params) + resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params) if err != nil { return err } @@ -305,17 +315,19 @@ func ListOnlineArchivesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListOnlineArchivesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -325,27 +337,27 @@ func ListOnlineArchivesBuilder() cobra.Command { type UpdateOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateOnlineArchiveOperation + client admin.APIClient groupId string archiveId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateOnlineArchiveOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateOnlineArchiveOpts) Run() error { - params := &atlasv2.UpdateOnlineArchiveApiParams{ +func (opts *UpdateOnlineArchiveOpts) Run(ctx context.Context) error { + params := &admin.UpdateOnlineArchiveApiParams{ GroupId: opts.groupId, ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.UpdateOnlineArchive(params) + resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params) if err != nil { return err } @@ -365,18 +377,21 @@ func UpdateOnlineArchiveBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateOnlineArchiveTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") + _ = cmd.MarkFlagRequired("archiveId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/generated/api_online_archive_store.go b/internal/generated/api_online_archive_store.go deleted file mode 100644 index 73eeadaee7..0000000000 --- a/internal/generated/api_online_archive_store.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_online_archive_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateOnlineArchiveOperation, DeleteOnlineArchiveOperation, DownloadOnlineArchiveQueryLogsOperation, GetOnlineArchiveOperation, ListOnlineArchivesOperation, UpdateOnlineArchiveOperation - -type CreateOnlineArchiveOperation interface { - CreateOnlineArchive (*atlasv2.CreateOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) -} - -// CreateOnlineArchive encapsulates the logic to manage different cloud providers. -func (s *Store) CreateOnlineArchive(params *atlasv2.CreateOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) { - result, _, err := s.clientv2.OnlineArchiveApi.CreateOnlineArchiveWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteOnlineArchiveOperation interface { - DeleteOnlineArchive (*atlasv2.DeleteOnlineArchiveApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteOnlineArchive encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteOnlineArchive(params *atlasv2.DeleteOnlineArchiveApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.OnlineArchiveApi.DeleteOnlineArchiveWithParams(s.ctx, params).Execute() - return &result, err -} - -type DownloadOnlineArchiveQueryLogsOperation interface { - DownloadOnlineArchiveQueryLogs (*atlasv2.DownloadOnlineArchiveQueryLogsApiParams) (*atlasv2.*os.File, error) -} - -// DownloadOnlineArchiveQueryLogs encapsulates the logic to manage different cloud providers. -func (s *Store) DownloadOnlineArchiveQueryLogs(params *atlasv2.DownloadOnlineArchiveQueryLogsApiParams) (*atlasv2.*os.File, error) { - result, _, err := s.clientv2.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetOnlineArchiveOperation interface { - GetOnlineArchive (*atlasv2.GetOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) -} - -// GetOnlineArchive encapsulates the logic to manage different cloud providers. -func (s *Store) GetOnlineArchive(params *atlasv2.GetOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) { - result, _, err := s.clientv2.OnlineArchiveApi.GetOnlineArchiveWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListOnlineArchivesOperation interface { - ListOnlineArchives (*atlasv2.ListOnlineArchivesApiParams) (*atlasv2.PaginatedOnlineArchive, error) -} - -// ListOnlineArchives encapsulates the logic to manage different cloud providers. -func (s *Store) ListOnlineArchives(params *atlasv2.ListOnlineArchivesApiParams) (*atlasv2.PaginatedOnlineArchive, error) { - result, _, err := s.clientv2.OnlineArchiveApi.ListOnlineArchivesWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateOnlineArchiveOperation interface { - UpdateOnlineArchive (*atlasv2.UpdateOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) -} - -// UpdateOnlineArchive encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateOnlineArchive(params *atlasv2.UpdateOnlineArchiveApiParams) (*atlasv2.OnlineArchive, error) { - result, _, err := s.clientv2.OnlineArchiveApi.UpdateOnlineArchiveWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 55d3a60b54..50b9ac2bc6 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -19,28 +19,28 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateOrganizationOperation + client admin.APIClient } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateOrganizationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateOrganizationOpts) Run() error { - params := &atlasv2.CreateOrganizationApiParams{ +func (opts *CreateOrganizationOpts) Run(ctx context.Context) error { + params := &admin.CreateOrganizationApiParams{ } - resp, _, err := opts.store.CreateOrganization(params) + resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params) if err != nil { return err } @@ -60,13 +60,13 @@ func CreateOrganizationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateOrganizationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } @@ -75,23 +75,23 @@ func CreateOrganizationBuilder() cobra.Command { type CreateOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateOrganizationInvitationOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateOrganizationInvitationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateOrganizationInvitationOpts) Run() error { - params := &atlasv2.CreateOrganizationInvitationApiParams{ +func (opts *CreateOrganizationInvitationOpts) Run(ctx context.Context) error { + params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.CreateOrganizationInvitation(params) + resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params) if err != nil { return err } @@ -111,39 +111,40 @@ func CreateOrganizationInvitationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateOrganizationInvitationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type DeleteOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteOrganizationOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteOrganizationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteOrganizationOpts) Run() error { - params := &atlasv2.DeleteOrganizationApiParams{ +func (opts *DeleteOrganizationOpts) Run(ctx context.Context) error { + params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.DeleteOrganization(params) + resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationWithParams(ctx, params) if err != nil { return err } @@ -163,41 +164,42 @@ func DeleteOrganizationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteOrganizationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type DeleteOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteOrganizationInvitationOperation + client admin.APIClient orgId string invitationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteOrganizationInvitationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteOrganizationInvitationOpts) Run() error { - params := &atlasv2.DeleteOrganizationInvitationApiParams{ +func (opts *DeleteOrganizationInvitationOpts) Run(ctx context.Context) error { + params := &admin.DeleteOrganizationInvitationApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, } - resp, _, err := opts.store.DeleteOrganizationInvitation(params) + resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params) if err != nil { return err } @@ -217,40 +219,42 @@ func DeleteOrganizationInvitationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteOrganizationInvitationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + _ = cmd.MarkFlagRequired("invitationId") return cmd } type GetOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetOrganizationOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetOrganizationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetOrganizationOpts) Run() error { - params := &atlasv2.GetOrganizationApiParams{ +func (opts *GetOrganizationOpts) Run(ctx context.Context) error { + params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.GetOrganization(params) + resp, _, err := opts.client.OrganizationsApi.GetOrganizationWithParams(ctx, params) if err != nil { return err } @@ -270,41 +274,42 @@ func GetOrganizationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetOrganizationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type GetOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetOrganizationInvitationOperation + client admin.APIClient orgId string invitationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetOrganizationInvitationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetOrganizationInvitationOpts) Run() error { - params := &atlasv2.GetOrganizationInvitationApiParams{ +func (opts *GetOrganizationInvitationOpts) Run(ctx context.Context) error { + params := &admin.GetOrganizationInvitationApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, } - resp, _, err := opts.store.GetOrganizationInvitation(params) + resp, _, err := opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params) if err != nil { return err } @@ -324,40 +329,42 @@ func GetOrganizationInvitationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetOrganizationInvitationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + _ = cmd.MarkFlagRequired("invitationId") return cmd } type GetOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetOrganizationSettingsOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetOrganizationSettingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetOrganizationSettingsOpts) Run() error { - params := &atlasv2.GetOrganizationSettingsApiParams{ +func (opts *GetOrganizationSettingsOpts) Run(ctx context.Context) error { + params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.GetOrganizationSettings(params) + resp, _, err := opts.client.OrganizationsApi.GetOrganizationSettingsWithParams(ctx, params) if err != nil { return err } @@ -377,41 +384,42 @@ func GetOrganizationSettingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetOrganizationSettingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type ListOrganizationInvitationsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListOrganizationInvitationsOperation + client admin.APIClient orgId string username string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListOrganizationInvitationsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListOrganizationInvitationsOpts) Run() error { - params := &atlasv2.ListOrganizationInvitationsApiParams{ +func (opts *ListOrganizationInvitationsOpts) Run(ctx context.Context) error { + params := &admin.ListOrganizationInvitationsApiParams{ OrgId: opts.orgId, Username: opts.username, } - resp, _, err := opts.store.ListOrganizationInvitations(params) + resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params) if err != nil { return err } @@ -431,16 +439,17 @@ func ListOrganizationInvitationsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListOrganizationInvitationsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.username, "username", "", "usage description") return cmd @@ -448,7 +457,7 @@ func ListOrganizationInvitationsBuilder() cobra.Command { type ListOrganizationProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListOrganizationProjectsOperation + client admin.APIClient orgId string includeCount bool itemsPerPage int32 @@ -456,23 +465,23 @@ type ListOrganizationProjectsOpts struct { name string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListOrganizationProjectsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListOrganizationProjectsOpts) Run() error { - params := &atlasv2.ListOrganizationProjectsApiParams{ +func (opts *ListOrganizationProjectsOpts) Run(ctx context.Context) error { + params := &admin.ListOrganizationProjectsApiParams{ OrgId: opts.orgId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, Name: opts.name, } - resp, _, err := opts.store.ListOrganizationProjects(params) + resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params) if err != nil { return err } @@ -492,16 +501,17 @@ func ListOrganizationProjectsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListOrganizationProjectsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -512,29 +522,29 @@ func ListOrganizationProjectsBuilder() cobra.Command { type ListOrganizationUsersOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListOrganizationUsersOperation + client admin.APIClient orgId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListOrganizationUsersOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListOrganizationUsersOpts) Run() error { - params := &atlasv2.ListOrganizationUsersApiParams{ +func (opts *ListOrganizationUsersOpts) Run(ctx context.Context) error { + params := &admin.ListOrganizationUsersApiParams{ OrgId: opts.orgId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListOrganizationUsers(params) + resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params) if err != nil { return err } @@ -554,16 +564,17 @@ func ListOrganizationUsersBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListOrganizationUsersTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -573,29 +584,29 @@ func ListOrganizationUsersBuilder() cobra.Command { type ListOrganizationsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListOrganizationsOperation + client admin.APIClient includeCount bool itemsPerPage int32 pageNum int32 name string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListOrganizationsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListOrganizationsOpts) Run() error { - params := &atlasv2.ListOrganizationsApiParams{ +func (opts *ListOrganizationsOpts) Run(ctx context.Context) error { + params := &admin.ListOrganizationsApiParams{ IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, Name: opts.name, } - resp, _, err := opts.store.ListOrganizations(params) + resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params) if err != nil { return err } @@ -615,13 +626,13 @@ func ListOrganizationsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListOrganizationsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") @@ -634,23 +645,23 @@ func ListOrganizationsBuilder() cobra.Command { type RenameOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.RenameOrganizationOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *RenameOrganizationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *RenameOrganizationOpts) Run() error { - params := &atlasv2.RenameOrganizationApiParams{ +func (opts *RenameOrganizationOpts) Run(ctx context.Context) error { + params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.RenameOrganization(params) + resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params) if err != nil { return err } @@ -670,39 +681,40 @@ func RenameOrganizationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), RenameOrganizationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type UpdateOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateOrganizationInvitationOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateOrganizationInvitationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateOrganizationInvitationOpts) Run() error { - params := &atlasv2.UpdateOrganizationInvitationApiParams{ +func (opts *UpdateOrganizationInvitationOpts) Run(ctx context.Context) error { + params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.UpdateOrganizationInvitation(params) + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params) if err != nil { return err } @@ -722,41 +734,42 @@ func UpdateOrganizationInvitationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationInvitationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type UpdateOrganizationInvitationByIdOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateOrganizationInvitationByIdOperation + client admin.APIClient orgId string invitationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateOrganizationInvitationByIdOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateOrganizationInvitationByIdOpts) Run() error { - params := &atlasv2.UpdateOrganizationInvitationByIdApiParams{ +func (opts *UpdateOrganizationInvitationByIdOpts) Run(ctx context.Context) error { + params := &admin.UpdateOrganizationInvitationByIdApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, } - resp, _, err := opts.store.UpdateOrganizationInvitationById(params) + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params) if err != nil { return err } @@ -776,40 +789,42 @@ func UpdateOrganizationInvitationByIdBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationInvitationByIdTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + _ = cmd.MarkFlagRequired("invitationId") return cmd } type UpdateOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateOrganizationSettingsOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateOrganizationSettingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateOrganizationSettingsOpts) Run() error { - params := &atlasv2.UpdateOrganizationSettingsApiParams{ +func (opts *UpdateOrganizationSettingsOpts) Run(ctx context.Context) error { + params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.UpdateOrganizationSettings(params) + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params) if err != nil { return err } @@ -829,16 +844,17 @@ func UpdateOrganizationSettingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationSettingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } diff --git a/internal/generated/api_organizations_store.go b/internal/generated/api_organizations_store.go deleted file mode 100644 index bfaaf8654d..0000000000 --- a/internal/generated/api_organizations_store.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_organizations_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateOrganizationOperation, CreateOrganizationInvitationOperation, DeleteOrganizationOperation, DeleteOrganizationInvitationOperation, GetOrganizationOperation, GetOrganizationInvitationOperation, GetOrganizationSettingsOperation, ListOrganizationInvitationsOperation, ListOrganizationProjectsOperation, ListOrganizationUsersOperation, ListOrganizationsOperation, RenameOrganizationOperation, UpdateOrganizationInvitationOperation, UpdateOrganizationInvitationByIdOperation, UpdateOrganizationSettingsOperation - -type CreateOrganizationOperation interface { - CreateOrganization (*atlasv2.CreateOrganizationApiParams) (*atlasv2.CreateOrganizationResponse, error) -} - -// CreateOrganization encapsulates the logic to manage different cloud providers. -func (s *Store) CreateOrganization(params *atlasv2.CreateOrganizationApiParams) (*atlasv2.CreateOrganizationResponse, error) { - result, _, err := s.clientv2.OrganizationsApi.CreateOrganizationWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateOrganizationInvitationOperation interface { - CreateOrganizationInvitation (*atlasv2.CreateOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) -} - -// CreateOrganizationInvitation encapsulates the logic to manage different cloud providers. -func (s *Store) CreateOrganizationInvitation(params *atlasv2.CreateOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) { - result, _, err := s.clientv2.OrganizationsApi.CreateOrganizationInvitationWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteOrganizationOperation interface { - DeleteOrganization (*atlasv2.DeleteOrganizationApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteOrganization encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteOrganization(params *atlasv2.DeleteOrganizationApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.OrganizationsApi.DeleteOrganizationWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteOrganizationInvitationOperation interface { - DeleteOrganizationInvitation (*atlasv2.DeleteOrganizationInvitationApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteOrganizationInvitation encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteOrganizationInvitation(params *atlasv2.DeleteOrganizationInvitationApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.OrganizationsApi.DeleteOrganizationInvitationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetOrganizationOperation interface { - GetOrganization (*atlasv2.GetOrganizationApiParams) (*atlasv2.Organization, error) -} - -// GetOrganization encapsulates the logic to manage different cloud providers. -func (s *Store) GetOrganization(params *atlasv2.GetOrganizationApiParams) (*atlasv2.Organization, error) { - result, _, err := s.clientv2.OrganizationsApi.GetOrganizationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetOrganizationInvitationOperation interface { - GetOrganizationInvitation (*atlasv2.GetOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) -} - -// GetOrganizationInvitation encapsulates the logic to manage different cloud providers. -func (s *Store) GetOrganizationInvitation(params *atlasv2.GetOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) { - result, _, err := s.clientv2.OrganizationsApi.GetOrganizationInvitationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetOrganizationSettingsOperation interface { - GetOrganizationSettings (*atlasv2.GetOrganizationSettingsApiParams) (*atlasv2.OrganizationSettings, error) -} - -// GetOrganizationSettings encapsulates the logic to manage different cloud providers. -func (s *Store) GetOrganizationSettings(params *atlasv2.GetOrganizationSettingsApiParams) (*atlasv2.OrganizationSettings, error) { - result, _, err := s.clientv2.OrganizationsApi.GetOrganizationSettingsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListOrganizationInvitationsOperation interface { - ListOrganizationInvitations (*atlasv2.ListOrganizationInvitationsApiParams) (*atlasv2.[]OrganizationInvitation, error) -} - -// ListOrganizationInvitations encapsulates the logic to manage different cloud providers. -func (s *Store) ListOrganizationInvitations(params *atlasv2.ListOrganizationInvitationsApiParams) (*atlasv2.[]OrganizationInvitation, error) { - result, _, err := s.clientv2.OrganizationsApi.ListOrganizationInvitationsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListOrganizationProjectsOperation interface { - ListOrganizationProjects (*atlasv2.ListOrganizationProjectsApiParams) (*atlasv2.PaginatedAtlasGroup, error) -} - -// ListOrganizationProjects encapsulates the logic to manage different cloud providers. -func (s *Store) ListOrganizationProjects(params *atlasv2.ListOrganizationProjectsApiParams) (*atlasv2.PaginatedAtlasGroup, error) { - result, _, err := s.clientv2.OrganizationsApi.ListOrganizationProjectsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListOrganizationUsersOperation interface { - ListOrganizationUsers (*atlasv2.ListOrganizationUsersApiParams) (*atlasv2.PaginatedAppUser, error) -} - -// ListOrganizationUsers encapsulates the logic to manage different cloud providers. -func (s *Store) ListOrganizationUsers(params *atlasv2.ListOrganizationUsersApiParams) (*atlasv2.PaginatedAppUser, error) { - result, _, err := s.clientv2.OrganizationsApi.ListOrganizationUsersWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListOrganizationsOperation interface { - ListOrganizations (*atlasv2.ListOrganizationsApiParams) (*atlasv2.PaginatedOrganization, error) -} - -// ListOrganizations encapsulates the logic to manage different cloud providers. -func (s *Store) ListOrganizations(params *atlasv2.ListOrganizationsApiParams) (*atlasv2.PaginatedOrganization, error) { - result, _, err := s.clientv2.OrganizationsApi.ListOrganizationsWithParams(s.ctx, params).Execute() - return &result, err -} - -type RenameOrganizationOperation interface { - RenameOrganization (*atlasv2.RenameOrganizationApiParams) (*atlasv2.Organization, error) -} - -// RenameOrganization encapsulates the logic to manage different cloud providers. -func (s *Store) RenameOrganization(params *atlasv2.RenameOrganizationApiParams) (*atlasv2.Organization, error) { - result, _, err := s.clientv2.OrganizationsApi.RenameOrganizationWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateOrganizationInvitationOperation interface { - UpdateOrganizationInvitation (*atlasv2.UpdateOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) -} - -// UpdateOrganizationInvitation encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateOrganizationInvitation(params *atlasv2.UpdateOrganizationInvitationApiParams) (*atlasv2.OrganizationInvitation, error) { - result, _, err := s.clientv2.OrganizationsApi.UpdateOrganizationInvitationWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateOrganizationInvitationByIdOperation interface { - UpdateOrganizationInvitationById (*atlasv2.UpdateOrganizationInvitationByIdApiParams) (*atlasv2.OrganizationInvitation, error) -} - -// UpdateOrganizationInvitationById encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateOrganizationInvitationById(params *atlasv2.UpdateOrganizationInvitationByIdApiParams) (*atlasv2.OrganizationInvitation, error) { - result, _, err := s.clientv2.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateOrganizationSettingsOperation interface { - UpdateOrganizationSettings (*atlasv2.UpdateOrganizationSettingsApiParams) (*atlasv2.OrganizationSettings, error) -} - -// UpdateOrganizationSettings encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateOrganizationSettings(params *atlasv2.UpdateOrganizationSettingsApiParams) (*atlasv2.OrganizationSettings, error) { - result, _, err := s.clientv2.OrganizationsApi.UpdateOrganizationSettingsWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index 194dfa95c0..ad9e774624 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type DisableSlowOperationThresholdingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DisableSlowOperationThresholdingOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DisableSlowOperationThresholdingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DisableSlowOperationThresholdingOpts) Run() error { - params := &atlasv2.DisableSlowOperationThresholdingApiParams{ +func (opts *DisableSlowOperationThresholdingOpts) Run(ctx context.Context) error { + params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } - _, err := opts.store.DisableSlowOperationThresholding(params) + _, err := opts.client.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(ctx, params) if err != nil { return err } @@ -62,39 +62,40 @@ func DisableSlowOperationThresholdingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DisableSlowOperationThresholdingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type EnableSlowOperationThresholdingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.EnableSlowOperationThresholdingOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *EnableSlowOperationThresholdingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *EnableSlowOperationThresholdingOpts) Run() error { - params := &atlasv2.EnableSlowOperationThresholdingApiParams{ +func (opts *EnableSlowOperationThresholdingOpts) Run(ctx context.Context) error { + params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } - _, err := opts.store.EnableSlowOperationThresholding(params) + _, err := opts.client.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(ctx, params) if err != nil { return err } @@ -114,23 +115,24 @@ func EnableSlowOperationThresholdingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), EnableSlowOperationThresholdingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type ListSlowQueriesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListSlowQueriesOperation + client admin.APIClient groupId string processId string duration int64 @@ -139,16 +141,16 @@ type ListSlowQueriesOpts struct { since int64 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListSlowQueriesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListSlowQueriesOpts) Run() error { - params := &atlasv2.ListSlowQueriesApiParams{ +func (opts *ListSlowQueriesOpts) Run(ctx context.Context) error { + params := &admin.ListSlowQueriesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, Duration: opts.duration, @@ -156,7 +158,7 @@ func (opts *ListSlowQueriesOpts) Run() error { NLogs: opts.nLogs, Since: opts.since, } - resp, _, err := opts.store.ListSlowQueries(params) + resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueriesWithParams(ctx, params) if err != nil { return err } @@ -176,17 +178,19 @@ func ListSlowQueriesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListSlowQueriesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.duration, "duration", "", "usage description") cmd.Flags().StringVar(&opts.namespaces, "namespaces", "", "usage description") cmd.Flags().StringVar(&opts.nLogs, "nLogs", "", "usage description") @@ -197,29 +201,29 @@ func ListSlowQueriesBuilder() cobra.Command { type ListSlowQueryNamespacesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListSlowQueryNamespacesOperation + client admin.APIClient groupId string processId string duration int64 since int64 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListSlowQueryNamespacesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListSlowQueryNamespacesOpts) Run() error { - params := &atlasv2.ListSlowQueryNamespacesApiParams{ +func (opts *ListSlowQueryNamespacesOpts) Run(ctx context.Context) error { + params := &admin.ListSlowQueryNamespacesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, Duration: opts.duration, Since: opts.since, } - resp, _, err := opts.store.ListSlowQueryNamespaces(params) + resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(ctx, params) if err != nil { return err } @@ -239,17 +243,19 @@ func ListSlowQueryNamespacesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListSlowQueryNamespacesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.duration, "duration", "", "usage description") cmd.Flags().StringVar(&opts.since, "since", "", "usage description") @@ -258,7 +264,7 @@ func ListSlowQueryNamespacesBuilder() cobra.Command { type ListSuggestedIndexesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListSuggestedIndexesOperation + client admin.APIClient groupId string processId string includeCount bool @@ -271,16 +277,16 @@ type ListSuggestedIndexesOpts struct { since int64 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListSuggestedIndexesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListSuggestedIndexesOpts) Run() error { - params := &atlasv2.ListSuggestedIndexesApiParams{ +func (opts *ListSuggestedIndexesOpts) Run(ctx context.Context) error { + params := &admin.ListSuggestedIndexesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, IncludeCount: opts.includeCount, @@ -292,7 +298,7 @@ func (opts *ListSuggestedIndexesOpts) Run() error { NIndexes: opts.nIndexes, Since: opts.since, } - resp, _, err := opts.store.ListSuggestedIndexes(params) + resp, _, err := opts.client.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(ctx, params) if err != nil { return err } @@ -312,17 +318,19 @@ func ListSuggestedIndexesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListSuggestedIndexesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + _ = cmd.MarkFlagRequired("processId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") diff --git a/internal/generated/api_performance_advisor_store.go b/internal/generated/api_performance_advisor_store.go deleted file mode 100644 index 64a8844891..0000000000 --- a/internal/generated/api_performance_advisor_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_performance_advisor_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DisableSlowOperationThresholdingOperation, EnableSlowOperationThresholdingOperation, ListSlowQueriesOperation, ListSlowQueryNamespacesOperation, ListSuggestedIndexesOperation - -type DisableSlowOperationThresholdingOperation interface { - DisableSlowOperationThresholding (*atlasv2.DisableSlowOperationThresholdingApiParams) error -} - -// DisableSlowOperationThresholding encapsulates the logic to manage different cloud providers. -func (s *Store) DisableSlowOperationThresholding(params *atlasv2.DisableSlowOperationThresholdingApiParams) (error) { - _, err := s.clientv2.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(s.ctx, params).Execute() - return err -} - -type EnableSlowOperationThresholdingOperation interface { - EnableSlowOperationThresholding (*atlasv2.EnableSlowOperationThresholdingApiParams) error -} - -// EnableSlowOperationThresholding encapsulates the logic to manage different cloud providers. -func (s *Store) EnableSlowOperationThresholding(params *atlasv2.EnableSlowOperationThresholdingApiParams) (error) { - _, err := s.clientv2.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(s.ctx, params).Execute() - return err -} - -type ListSlowQueriesOperation interface { - ListSlowQueries (*atlasv2.ListSlowQueriesApiParams) (*atlasv2.PerformanceAdvisorSlowQueryList, error) -} - -// ListSlowQueries encapsulates the logic to manage different cloud providers. -func (s *Store) ListSlowQueries(params *atlasv2.ListSlowQueriesApiParams) (*atlasv2.PerformanceAdvisorSlowQueryList, error) { - result, _, err := s.clientv2.PerformanceAdvisorApi.ListSlowQueriesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListSlowQueryNamespacesOperation interface { - ListSlowQueryNamespaces (*atlasv2.ListSlowQueryNamespacesApiParams) (*atlasv2.Namespaces, error) -} - -// ListSlowQueryNamespaces encapsulates the logic to manage different cloud providers. -func (s *Store) ListSlowQueryNamespaces(params *atlasv2.ListSlowQueryNamespacesApiParams) (*atlasv2.Namespaces, error) { - result, _, err := s.clientv2.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListSuggestedIndexesOperation interface { - ListSuggestedIndexes (*atlasv2.ListSuggestedIndexesApiParams) (*atlasv2.PerformanceAdvisorResponse, error) -} - -// ListSuggestedIndexes encapsulates the logic to manage different cloud providers. -func (s *Store) ListSuggestedIndexes(params *atlasv2.ListSuggestedIndexesApiParams) (*atlasv2.PerformanceAdvisorResponse, error) { - result, _, err := s.clientv2.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index e1970312da..8f092b4b9b 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -19,34 +19,34 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreatePrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreatePrivateEndpointOperation + client admin.APIClient groupId string cloudProvider string endpointServiceId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreatePrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreatePrivateEndpointOpts) Run() error { - params := &atlasv2.CreatePrivateEndpointApiParams{ +func (opts *CreatePrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.CreatePrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.store.CreatePrivateEndpoint(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -66,41 +66,44 @@ func CreatePrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreatePrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + _ = cmd.MarkFlagRequired("cloudProvider") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } type CreatePrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreatePrivateEndpointServiceOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreatePrivateEndpointServiceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreatePrivateEndpointServiceOpts) Run() error { - params := &atlasv2.CreatePrivateEndpointServiceApiParams{ +func (opts *CreatePrivateEndpointServiceOpts) Run(ctx context.Context) error { + params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreatePrivateEndpointService(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params) if err != nil { return err } @@ -120,45 +123,46 @@ func CreatePrivateEndpointServiceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreatePrivateEndpointServiceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeletePrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeletePrivateEndpointOperation + client admin.APIClient groupId string cloudProvider string endpointId string endpointServiceId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeletePrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeletePrivateEndpointOpts) Run() error { - params := &atlasv2.DeletePrivateEndpointApiParams{ +func (opts *DeletePrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.DeletePrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointId: opts.endpointId, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.store.DeletePrivateEndpoint(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -178,46 +182,50 @@ func DeletePrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeletePrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + _ = cmd.MarkFlagRequired("cloudProvider") cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointId") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } type DeletePrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeletePrivateEndpointServiceOperation + client admin.APIClient groupId string cloudProvider string endpointServiceId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeletePrivateEndpointServiceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeletePrivateEndpointServiceOpts) Run() error { - params := &atlasv2.DeletePrivateEndpointServiceApiParams{ +func (opts *DeletePrivateEndpointServiceOpts) Run(ctx context.Context) error { + params := &admin.DeletePrivateEndpointServiceApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.store.DeletePrivateEndpointService(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(ctx, params) if err != nil { return err } @@ -237,47 +245,50 @@ func DeletePrivateEndpointServiceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeletePrivateEndpointServiceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + _ = cmd.MarkFlagRequired("cloudProvider") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } type GetPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetPrivateEndpointOperation + client admin.APIClient groupId string cloudProvider string endpointId string endpointServiceId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetPrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetPrivateEndpointOpts) Run() error { - params := &atlasv2.GetPrivateEndpointApiParams{ +func (opts *GetPrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.GetPrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointId: opts.endpointId, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.store.GetPrivateEndpoint(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -297,46 +308,50 @@ func GetPrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetPrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + _ = cmd.MarkFlagRequired("cloudProvider") cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointId") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } type GetPrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetPrivateEndpointServiceOperation + client admin.APIClient groupId string cloudProvider string endpointServiceId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetPrivateEndpointServiceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetPrivateEndpointServiceOpts) Run() error { - params := &atlasv2.GetPrivateEndpointServiceApiParams{ +func (opts *GetPrivateEndpointServiceOpts) Run(ctx context.Context) error { + params := &admin.GetPrivateEndpointServiceApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.store.GetPrivateEndpointService(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(ctx, params) if err != nil { return err } @@ -356,41 +371,44 @@ func GetPrivateEndpointServiceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetPrivateEndpointServiceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + _ = cmd.MarkFlagRequired("cloudProvider") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } type GetRegionalizedPrivateEndpointSettingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetRegionalizedPrivateEndpointSettingOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetRegionalizedPrivateEndpointSettingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetRegionalizedPrivateEndpointSettingOpts) Run() error { - params := &atlasv2.GetRegionalizedPrivateEndpointSettingApiParams{ +func (opts *GetRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { + params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetRegionalizedPrivateEndpointSetting(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSettingWithParams(ctx, params) if err != nil { return err } @@ -410,41 +428,42 @@ func GetRegionalizedPrivateEndpointSettingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetRegionalizedPrivateEndpointSettingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type ListPrivateEndpointServicesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListPrivateEndpointServicesOperation + client admin.APIClient groupId string cloudProvider string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListPrivateEndpointServicesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListPrivateEndpointServicesOpts) Run() error { - params := &atlasv2.ListPrivateEndpointServicesApiParams{ +func (opts *ListPrivateEndpointServicesOpts) Run(ctx context.Context) error { + params := &admin.ListPrivateEndpointServicesApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, } - resp, _, err := opts.store.ListPrivateEndpointServices(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(ctx, params) if err != nil { return err } @@ -464,40 +483,42 @@ func ListPrivateEndpointServicesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListPrivateEndpointServicesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") + _ = cmd.MarkFlagRequired("cloudProvider") return cmd } type ToggleRegionalizedPrivateEndpointSettingOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ToggleRegionalizedPrivateEndpointSettingOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) Run() error { - params := &atlasv2.ToggleRegionalizedPrivateEndpointSettingApiParams{ +func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { + params := &admin.ToggleRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.ToggleRegionalizedPrivateEndpointSetting(params) + resp, _, err := opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params) if err != nil { return err } @@ -517,16 +538,17 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ToggleRegionalizedPrivateEndpointSettingTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_private_endpoint_services_store.go b/internal/generated/api_private_endpoint_services_store.go deleted file mode 100644 index 6f5327e11f..0000000000 --- a/internal/generated/api_private_endpoint_services_store.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_private_endpoint_services_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreatePrivateEndpointOperation, CreatePrivateEndpointServiceOperation, DeletePrivateEndpointOperation, DeletePrivateEndpointServiceOperation, GetPrivateEndpointOperation, GetPrivateEndpointServiceOperation, GetRegionalizedPrivateEndpointSettingOperation, ListPrivateEndpointServicesOperation, ToggleRegionalizedPrivateEndpointSettingOperation - -type CreatePrivateEndpointOperation interface { - CreatePrivateEndpoint (*atlasv2.CreatePrivateEndpointApiParams) (*atlasv2.Endpoint, error) -} - -// CreatePrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) CreatePrivateEndpoint(params *atlasv2.CreatePrivateEndpointApiParams) (*atlasv2.Endpoint, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreatePrivateEndpointServiceOperation interface { - CreatePrivateEndpointService (*atlasv2.CreatePrivateEndpointServiceApiParams) (*atlasv2.EndpointService, error) -} - -// CreatePrivateEndpointService encapsulates the logic to manage different cloud providers. -func (s *Store) CreatePrivateEndpointService(params *atlasv2.CreatePrivateEndpointServiceApiParams) (*atlasv2.EndpointService, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeletePrivateEndpointOperation interface { - DeletePrivateEndpoint (*atlasv2.DeletePrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeletePrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) DeletePrivateEndpoint(params *atlasv2.DeletePrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeletePrivateEndpointServiceOperation interface { - DeletePrivateEndpointService (*atlasv2.DeletePrivateEndpointServiceApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeletePrivateEndpointService encapsulates the logic to manage different cloud providers. -func (s *Store) DeletePrivateEndpointService(params *atlasv2.DeletePrivateEndpointServiceApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetPrivateEndpointOperation interface { - GetPrivateEndpoint (*atlasv2.GetPrivateEndpointApiParams) (*atlasv2.Endpoint, error) -} - -// GetPrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) GetPrivateEndpoint(params *atlasv2.GetPrivateEndpointApiParams) (*atlasv2.Endpoint, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetPrivateEndpointServiceOperation interface { - GetPrivateEndpointService (*atlasv2.GetPrivateEndpointServiceApiParams) (*atlasv2.EndpointService, error) -} - -// GetPrivateEndpointService encapsulates the logic to manage different cloud providers. -func (s *Store) GetPrivateEndpointService(params *atlasv2.GetPrivateEndpointServiceApiParams) (*atlasv2.EndpointService, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetRegionalizedPrivateEndpointSettingOperation interface { - GetRegionalizedPrivateEndpointSetting (*atlasv2.GetRegionalizedPrivateEndpointSettingApiParams) (*atlasv2.ProjectSettingItem, error) -} - -// GetRegionalizedPrivateEndpointSetting encapsulates the logic to manage different cloud providers. -func (s *Store) GetRegionalizedPrivateEndpointSetting(params *atlasv2.GetRegionalizedPrivateEndpointSettingApiParams) (*atlasv2.ProjectSettingItem, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSettingWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListPrivateEndpointServicesOperation interface { - ListPrivateEndpointServices (*atlasv2.ListPrivateEndpointServicesApiParams) (*atlasv2.[]EndpointService, error) -} - -// ListPrivateEndpointServices encapsulates the logic to manage different cloud providers. -func (s *Store) ListPrivateEndpointServices(params *atlasv2.ListPrivateEndpointServicesApiParams) (*atlasv2.[]EndpointService, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ToggleRegionalizedPrivateEndpointSettingOperation interface { - ToggleRegionalizedPrivateEndpointSetting (*atlasv2.ToggleRegionalizedPrivateEndpointSettingApiParams) (*atlasv2.ProjectSettingItem, error) -} - -// ToggleRegionalizedPrivateEndpointSetting encapsulates the logic to manage different cloud providers. -func (s *Store) ToggleRegionalizedPrivateEndpointSetting(params *atlasv2.ToggleRegionalizedPrivateEndpointSettingApiParams) (*atlasv2.ProjectSettingItem, error) { - result, _, err := s.clientv2.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index fa9e3a7bc0..416da623c7 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type AddProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - store store.AddProjectApiKeyOperation + client admin.APIClient groupId string apiUserId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *AddProjectApiKeyOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *AddProjectApiKeyOpts) Run() error { - params := &atlasv2.AddProjectApiKeyApiParams{ +func (opts *AddProjectApiKeyOpts) Run(ctx context.Context) error { + params := &admin.AddProjectApiKeyApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.store.AddProjectApiKey(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params) if err != nil { return err } @@ -64,40 +64,42 @@ func AddProjectApiKeyBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), AddProjectApiKeyTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") return cmd } type CreateApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateApiKeyOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateApiKeyOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateApiKeyOpts) Run() error { - params := &atlasv2.CreateApiKeyApiParams{ +func (opts *CreateApiKeyOpts) Run(ctx context.Context) error { + params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.CreateApiKey(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params) if err != nil { return err } @@ -117,23 +119,24 @@ func CreateApiKeyBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateApiKeyTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type CreateApiKeyAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateApiKeyAccessListOperation + client admin.APIClient orgId string apiUserId string includeCount bool @@ -141,23 +144,23 @@ type CreateApiKeyAccessListOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateApiKeyAccessListOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateApiKeyAccessListOpts) Run() error { - params := &atlasv2.CreateApiKeyAccessListApiParams{ +func (opts *CreateApiKeyAccessListOpts) Run(ctx context.Context) error { + params := &admin.CreateApiKeyAccessListApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.CreateApiKeyAccessList(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params) if err != nil { return err } @@ -177,17 +180,19 @@ func CreateApiKeyAccessListBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateApiKeyAccessListTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -197,23 +202,23 @@ func CreateApiKeyAccessListBuilder() cobra.Command { type CreateProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateProjectApiKeyOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateProjectApiKeyOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateProjectApiKeyOpts) Run() error { - params := &atlasv2.CreateProjectApiKeyApiParams{ +func (opts *CreateProjectApiKeyOpts) Run(ctx context.Context) error { + params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateProjectApiKey(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params) if err != nil { return err } @@ -233,41 +238,42 @@ func CreateProjectApiKeyBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateProjectApiKeyTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeleteApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteApiKeyOperation + client admin.APIClient orgId string apiUserId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteApiKeyOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteApiKeyOpts) Run() error { - params := &atlasv2.DeleteApiKeyApiParams{ +func (opts *DeleteApiKeyOpts) Run(ctx context.Context) error { + params := &admin.DeleteApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.store.DeleteApiKey(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(ctx, params) if err != nil { return err } @@ -287,44 +293,46 @@ func DeleteApiKeyBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteApiKeyTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") return cmd } type DeleteApiKeyAccessListEntryOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteApiKeyAccessListEntryOperation + client admin.APIClient orgId string apiUserId string ipAddress string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteApiKeyAccessListEntryOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteApiKeyAccessListEntryOpts) Run() error { - params := &atlasv2.DeleteApiKeyAccessListEntryApiParams{ +func (opts *DeleteApiKeyAccessListEntryOpts) Run(ctx context.Context) error { + params := &admin.DeleteApiKeyAccessListEntryApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, IpAddress: opts.ipAddress, } - resp, _, err := opts.store.DeleteApiKeyAccessListEntry(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyAccessListEntryWithParams(ctx, params) if err != nil { return err } @@ -344,43 +352,46 @@ func DeleteApiKeyAccessListEntryBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteApiKeyAccessListEntryTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") + _ = cmd.MarkFlagRequired("ipAddress") return cmd } type GetApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetApiKeyOperation + client admin.APIClient orgId string apiUserId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetApiKeyOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetApiKeyOpts) Run() error { - params := &atlasv2.GetApiKeyApiParams{ +func (opts *GetApiKeyOpts) Run(ctx context.Context) error { + params := &admin.GetApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.store.GetApiKey(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyWithParams(ctx, params) if err != nil { return err } @@ -400,44 +411,46 @@ func GetApiKeyBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetApiKeyTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") return cmd } type GetApiKeyAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetApiKeyAccessListOperation + client admin.APIClient orgId string ipAddress string apiUserId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetApiKeyAccessListOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetApiKeyAccessListOpts) Run() error { - params := &atlasv2.GetApiKeyAccessListApiParams{ +func (opts *GetApiKeyAccessListOpts) Run(ctx context.Context) error { + params := &admin.GetApiKeyAccessListApiParams{ OrgId: opts.orgId, IpAddress: opts.ipAddress, ApiUserId: opts.apiUserId, } - resp, _, err := opts.store.GetApiKeyAccessList(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyAccessListWithParams(ctx, params) if err != nil { return err } @@ -457,25 +470,28 @@ func GetApiKeyAccessListBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetApiKeyAccessListTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") + _ = cmd.MarkFlagRequired("ipAddress") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") return cmd } type ListApiKeyAccessListsEntriesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListApiKeyAccessListsEntriesOperation + client admin.APIClient orgId string apiUserId string includeCount bool @@ -483,23 +499,23 @@ type ListApiKeyAccessListsEntriesOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListApiKeyAccessListsEntriesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListApiKeyAccessListsEntriesOpts) Run() error { - params := &atlasv2.ListApiKeyAccessListsEntriesApiParams{ +func (opts *ListApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { + params := &admin.ListApiKeyAccessListsEntriesApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListApiKeyAccessListsEntries(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(ctx, params) if err != nil { return err } @@ -519,17 +535,19 @@ func ListApiKeyAccessListsEntriesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListApiKeyAccessListsEntriesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -539,29 +557,29 @@ func ListApiKeyAccessListsEntriesBuilder() cobra.Command { type ListApiKeysOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListApiKeysOperation + client admin.APIClient orgId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListApiKeysOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListApiKeysOpts) Run() error { - params := &atlasv2.ListApiKeysApiParams{ +func (opts *ListApiKeysOpts) Run(ctx context.Context) error { + params := &admin.ListApiKeysApiParams{ OrgId: opts.orgId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListApiKeys(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeysWithParams(ctx, params) if err != nil { return err } @@ -581,16 +599,17 @@ func ListApiKeysBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListApiKeysTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -600,29 +619,29 @@ func ListApiKeysBuilder() cobra.Command { type ListProjectApiKeysOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListProjectApiKeysOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListProjectApiKeysOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListProjectApiKeysOpts) Run() error { - params := &atlasv2.ListProjectApiKeysApiParams{ +func (opts *ListProjectApiKeysOpts) Run(ctx context.Context) error { + params := &admin.ListProjectApiKeysApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListProjectApiKeys(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(ctx, params) if err != nil { return err } @@ -642,16 +661,17 @@ func ListProjectApiKeysBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListProjectApiKeysTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -661,25 +681,25 @@ func ListProjectApiKeysBuilder() cobra.Command { type RemoveProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - store store.RemoveProjectApiKeyOperation + client admin.APIClient groupId string apiUserId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *RemoveProjectApiKeyOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *RemoveProjectApiKeyOpts) Run() error { - params := &atlasv2.RemoveProjectApiKeyApiParams{ +func (opts *RemoveProjectApiKeyOpts) Run(ctx context.Context) error { + params := &admin.RemoveProjectApiKeyApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.store.RemoveProjectApiKey(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(ctx, params) if err != nil { return err } @@ -699,42 +719,44 @@ func RemoveProjectApiKeyBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), RemoveProjectApiKeyTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") return cmd } type UpdateApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateApiKeyOperation + client admin.APIClient orgId string apiUserId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateApiKeyOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateApiKeyOpts) Run() error { - params := &atlasv2.UpdateApiKeyApiParams{ +func (opts *UpdateApiKeyOpts) Run(ctx context.Context) error { + params := &admin.UpdateApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.store.UpdateApiKey(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params) if err != nil { return err } @@ -754,24 +776,26 @@ func UpdateApiKeyBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateApiKeyTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") return cmd } type UpdateApiKeyRolesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateApiKeyRolesOperation + client admin.APIClient groupId string apiUserId string pageNum int32 @@ -779,23 +803,23 @@ type UpdateApiKeyRolesOpts struct { includeCount bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateApiKeyRolesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateApiKeyRolesOpts) Run() error { - params := &atlasv2.UpdateApiKeyRolesApiParams{ +func (opts *UpdateApiKeyRolesOpts) Run(ctx context.Context) error { + params := &admin.UpdateApiKeyRolesApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, PageNum: opts.pageNum, ItemsPerPage: opts.itemsPerPage, IncludeCount: opts.includeCount, } - resp, _, err := opts.store.UpdateApiKeyRoles(params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params) if err != nil { return err } @@ -815,17 +839,19 @@ func UpdateApiKeyRolesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateApiKeyRolesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") + _ = cmd.MarkFlagRequired("apiUserId") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") diff --git a/internal/generated/api_programmatic_api_keys_store.go b/internal/generated/api_programmatic_api_keys_store.go deleted file mode 100644 index 2a5fec70c1..0000000000 --- a/internal/generated/api_programmatic_api_keys_store.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_programmatic_api_keys_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas AddProjectApiKeyOperation, CreateApiKeyOperation, CreateApiKeyAccessListOperation, CreateProjectApiKeyOperation, DeleteApiKeyOperation, DeleteApiKeyAccessListEntryOperation, GetApiKeyOperation, GetApiKeyAccessListOperation, ListApiKeyAccessListsEntriesOperation, ListApiKeysOperation, ListProjectApiKeysOperation, RemoveProjectApiKeyOperation, UpdateApiKeyOperation, UpdateApiKeyRolesOperation - -type AddProjectApiKeyOperation interface { - AddProjectApiKey (*atlasv2.AddProjectApiKeyApiParams) (*atlasv2.ApiUser, error) -} - -// AddProjectApiKey encapsulates the logic to manage different cloud providers. -func (s *Store) AddProjectApiKey(params *atlasv2.AddProjectApiKeyApiParams) (*atlasv2.ApiUser, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateApiKeyOperation interface { - CreateApiKey (*atlasv2.CreateApiKeyApiParams) (*atlasv2.ApiUser, error) -} - -// CreateApiKey encapsulates the logic to manage different cloud providers. -func (s *Store) CreateApiKey(params *atlasv2.CreateApiKeyApiParams) (*atlasv2.ApiUser, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateApiKeyAccessListOperation interface { - CreateApiKeyAccessList (*atlasv2.CreateApiKeyAccessListApiParams) (*atlasv2.UserAccessList, error) -} - -// CreateApiKeyAccessList encapsulates the logic to manage different cloud providers. -func (s *Store) CreateApiKeyAccessList(params *atlasv2.CreateApiKeyAccessListApiParams) (*atlasv2.UserAccessList, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateProjectApiKeyOperation interface { - CreateProjectApiKey (*atlasv2.CreateProjectApiKeyApiParams) (*atlasv2.ApiUser, error) -} - -// CreateProjectApiKey encapsulates the logic to manage different cloud providers. -func (s *Store) CreateProjectApiKey(params *atlasv2.CreateProjectApiKeyApiParams) (*atlasv2.ApiUser, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteApiKeyOperation interface { - DeleteApiKey (*atlasv2.DeleteApiKeyApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteApiKey encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteApiKey(params *atlasv2.DeleteApiKeyApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteApiKeyAccessListEntryOperation interface { - DeleteApiKeyAccessListEntry (*atlasv2.DeleteApiKeyAccessListEntryApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteApiKeyAccessListEntry encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteApiKeyAccessListEntry(params *atlasv2.DeleteApiKeyAccessListEntryApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.DeleteApiKeyAccessListEntryWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetApiKeyOperation interface { - GetApiKey (*atlasv2.GetApiKeyApiParams) (*atlasv2.ApiUser, error) -} - -// GetApiKey encapsulates the logic to manage different cloud providers. -func (s *Store) GetApiKey(params *atlasv2.GetApiKeyApiParams) (*atlasv2.ApiUser, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.GetApiKeyWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetApiKeyAccessListOperation interface { - GetApiKeyAccessList (*atlasv2.GetApiKeyAccessListApiParams) (*atlasv2.UserAccessList, error) -} - -// GetApiKeyAccessList encapsulates the logic to manage different cloud providers. -func (s *Store) GetApiKeyAccessList(params *atlasv2.GetApiKeyAccessListApiParams) (*atlasv2.UserAccessList, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.GetApiKeyAccessListWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListApiKeyAccessListsEntriesOperation interface { - ListApiKeyAccessListsEntries (*atlasv2.ListApiKeyAccessListsEntriesApiParams) (*atlasv2.PaginatedApiUserAccessList, error) -} - -// ListApiKeyAccessListsEntries encapsulates the logic to manage different cloud providers. -func (s *Store) ListApiKeyAccessListsEntries(params *atlasv2.ListApiKeyAccessListsEntriesApiParams) (*atlasv2.PaginatedApiUserAccessList, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListApiKeysOperation interface { - ListApiKeys (*atlasv2.ListApiKeysApiParams) (*atlasv2.PaginatedApiApiUser, error) -} - -// ListApiKeys encapsulates the logic to manage different cloud providers. -func (s *Store) ListApiKeys(params *atlasv2.ListApiKeysApiParams) (*atlasv2.PaginatedApiApiUser, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.ListApiKeysWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListProjectApiKeysOperation interface { - ListProjectApiKeys (*atlasv2.ListProjectApiKeysApiParams) (*atlasv2.PaginatedApiApiUser, error) -} - -// ListProjectApiKeys encapsulates the logic to manage different cloud providers. -func (s *Store) ListProjectApiKeys(params *atlasv2.ListProjectApiKeysApiParams) (*atlasv2.PaginatedApiApiUser, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(s.ctx, params).Execute() - return &result, err -} - -type RemoveProjectApiKeyOperation interface { - RemoveProjectApiKey (*atlasv2.RemoveProjectApiKeyApiParams) (*atlasv2.map[string]interface{}, error) -} - -// RemoveProjectApiKey encapsulates the logic to manage different cloud providers. -func (s *Store) RemoveProjectApiKey(params *atlasv2.RemoveProjectApiKeyApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateApiKeyOperation interface { - UpdateApiKey (*atlasv2.UpdateApiKeyApiParams) (*atlasv2.ApiUser, error) -} - -// UpdateApiKey encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateApiKey(params *atlasv2.UpdateApiKeyApiParams) (*atlasv2.ApiUser, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateApiKeyRolesOperation interface { - UpdateApiKeyRoles (*atlasv2.UpdateApiKeyRolesApiParams) (*atlasv2.ApiUser, error) -} - -// UpdateApiKeyRoles encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateApiKeyRoles(params *atlasv2.UpdateApiKeyRolesApiParams) (*atlasv2.ApiUser, error) { - result, _, err := s.clientv2.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 48b4efd220..220ed2ab8e 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -19,36 +19,36 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateProjectIpAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateProjectIpAccessListOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateProjectIpAccessListOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateProjectIpAccessListOpts) Run() error { - params := &atlasv2.CreateProjectIpAccessListApiParams{ +func (opts *CreateProjectIpAccessListOpts) Run(ctx context.Context) error { + params := &admin.CreateProjectIpAccessListApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.CreateProjectIpAccessList(params) + resp, _, err := opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params) if err != nil { return err } @@ -68,16 +68,17 @@ func CreateProjectIpAccessListBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateProjectIpAccessListTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -87,25 +88,25 @@ func CreateProjectIpAccessListBuilder() cobra.Command { type DeleteProjectIpAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteProjectIpAccessListOperation + client admin.APIClient groupId string entryValue string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteProjectIpAccessListOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteProjectIpAccessListOpts) Run() error { - params := &atlasv2.DeleteProjectIpAccessListApiParams{ +func (opts *DeleteProjectIpAccessListOpts) Run(ctx context.Context) error { + params := &admin.DeleteProjectIpAccessListApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.store.DeleteProjectIpAccessList(params) + resp, _, err := opts.client.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(ctx, params) if err != nil { return err } @@ -125,42 +126,44 @@ func DeleteProjectIpAccessListBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteProjectIpAccessListTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") + _ = cmd.MarkFlagRequired("entryValue") return cmd } type GetProjectIpAccessListStatusOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetProjectIpAccessListStatusOperation + client admin.APIClient groupId string entryValue string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetProjectIpAccessListStatusOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetProjectIpAccessListStatusOpts) Run() error { - params := &atlasv2.GetProjectIpAccessListStatusApiParams{ +func (opts *GetProjectIpAccessListStatusOpts) Run(ctx context.Context) error { + params := &admin.GetProjectIpAccessListStatusApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.store.GetProjectIpAccessListStatus(params) + resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(ctx, params) if err != nil { return err } @@ -180,42 +183,44 @@ func GetProjectIpAccessListStatusBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetProjectIpAccessListStatusTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") + _ = cmd.MarkFlagRequired("entryValue") return cmd } type GetProjectIpListOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetProjectIpListOperation + client admin.APIClient groupId string entryValue string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetProjectIpListOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetProjectIpListOpts) Run() error { - params := &atlasv2.GetProjectIpListApiParams{ +func (opts *GetProjectIpListOpts) Run(ctx context.Context) error { + params := &admin.GetProjectIpListApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.store.GetProjectIpList(params) + resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpListWithParams(ctx, params) if err != nil { return err } @@ -235,46 +240,48 @@ func GetProjectIpListBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetProjectIpListTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") + _ = cmd.MarkFlagRequired("entryValue") return cmd } type ListProjectIpAccessListsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListProjectIpAccessListsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListProjectIpAccessListsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListProjectIpAccessListsOpts) Run() error { - params := &atlasv2.ListProjectIpAccessListsApiParams{ +func (opts *ListProjectIpAccessListsOpts) Run(ctx context.Context) error { + params := &admin.ListProjectIpAccessListsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListProjectIpAccessLists(params) + resp, _, err := opts.client.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(ctx, params) if err != nil { return err } @@ -294,16 +301,17 @@ func ListProjectIpAccessListsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListProjectIpAccessListsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") diff --git a/internal/generated/api_project_ip_access_list_store.go b/internal/generated/api_project_ip_access_list_store.go deleted file mode 100644 index fb2bba88a3..0000000000 --- a/internal/generated/api_project_ip_access_list_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_project_ip_access_list_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateProjectIpAccessListOperation, DeleteProjectIpAccessListOperation, GetProjectIpAccessListStatusOperation, GetProjectIpListOperation, ListProjectIpAccessListsOperation - -type CreateProjectIpAccessListOperation interface { - CreateProjectIpAccessList (*atlasv2.CreateProjectIpAccessListApiParams) (*atlasv2.PaginatedNetworkAccess, error) -} - -// CreateProjectIpAccessList encapsulates the logic to manage different cloud providers. -func (s *Store) CreateProjectIpAccessList(params *atlasv2.CreateProjectIpAccessListApiParams) (*atlasv2.PaginatedNetworkAccess, error) { - result, _, err := s.clientv2.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteProjectIpAccessListOperation interface { - DeleteProjectIpAccessList (*atlasv2.DeleteProjectIpAccessListApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteProjectIpAccessList encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteProjectIpAccessList(params *atlasv2.DeleteProjectIpAccessListApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetProjectIpAccessListStatusOperation interface { - GetProjectIpAccessListStatus (*atlasv2.GetProjectIpAccessListStatusApiParams) (*atlasv2.NetworkPermissionEntryStatus, error) -} - -// GetProjectIpAccessListStatus encapsulates the logic to manage different cloud providers. -func (s *Store) GetProjectIpAccessListStatus(params *atlasv2.GetProjectIpAccessListStatusApiParams) (*atlasv2.NetworkPermissionEntryStatus, error) { - result, _, err := s.clientv2.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetProjectIpListOperation interface { - GetProjectIpList (*atlasv2.GetProjectIpListApiParams) (*atlasv2.NetworkPermissionEntry, error) -} - -// GetProjectIpList encapsulates the logic to manage different cloud providers. -func (s *Store) GetProjectIpList(params *atlasv2.GetProjectIpListApiParams) (*atlasv2.NetworkPermissionEntry, error) { - result, _, err := s.clientv2.ProjectIPAccessListApi.GetProjectIpListWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListProjectIpAccessListsOperation interface { - ListProjectIpAccessLists (*atlasv2.ListProjectIpAccessListsApiParams) (*atlasv2.PaginatedNetworkAccess, error) -} - -// ListProjectIpAccessLists encapsulates the logic to manage different cloud providers. -func (s *Store) ListProjectIpAccessLists(params *atlasv2.ListProjectIpAccessListsApiParams) (*atlasv2.PaginatedNetworkAccess, error) { - result, _, err := s.clientv2.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index efc5f9932c..9da520f9bd 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateProjectOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateProjectOperation + client admin.APIClient projectOwnerId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateProjectOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateProjectOpts) Run() error { - params := &atlasv2.CreateProjectApiParams{ +func (opts *CreateProjectOpts) Run(ctx context.Context) error { + params := &admin.CreateProjectApiParams{ ProjectOwnerId: opts.projectOwnerId, } - resp, _, err := opts.store.CreateProject(params) + resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params) if err != nil { return err } @@ -62,13 +62,13 @@ func CreateProjectBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateProjectTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", "usage description") @@ -78,23 +78,23 @@ func CreateProjectBuilder() cobra.Command { type CreateProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateProjectInvitationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateProjectInvitationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateProjectInvitationOpts) Run() error { - params := &atlasv2.CreateProjectInvitationApiParams{ +func (opts *CreateProjectInvitationOpts) Run(ctx context.Context) error { + params := &admin.CreateProjectInvitationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateProjectInvitation(params) + resp, _, err := opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params) if err != nil { return err } @@ -114,39 +114,40 @@ func CreateProjectInvitationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateProjectInvitationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeleteProjectOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteProjectOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteProjectOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteProjectOpts) Run() error { - params := &atlasv2.DeleteProjectApiParams{ +func (opts *DeleteProjectOpts) Run(ctx context.Context) error { + params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.DeleteProject(params) + resp, _, err := opts.client.ProjectsApi.DeleteProjectWithParams(ctx, params) if err != nil { return err } @@ -166,41 +167,42 @@ func DeleteProjectBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteProjectTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeleteProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteProjectInvitationOperation + client admin.APIClient groupId string invitationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteProjectInvitationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteProjectInvitationOpts) Run() error { - params := &atlasv2.DeleteProjectInvitationApiParams{ +func (opts *DeleteProjectInvitationOpts) Run(ctx context.Context) error { + params := &admin.DeleteProjectInvitationApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, } - resp, _, err := opts.store.DeleteProjectInvitation(params) + resp, _, err := opts.client.ProjectsApi.DeleteProjectInvitationWithParams(ctx, params) if err != nil { return err } @@ -220,42 +222,44 @@ func DeleteProjectInvitationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteProjectInvitationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + _ = cmd.MarkFlagRequired("invitationId") return cmd } type DeleteProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteProjectLimitOperation + client admin.APIClient limitName string groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteProjectLimitOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteProjectLimitOpts) Run() error { - params := &atlasv2.DeleteProjectLimitApiParams{ +func (opts *DeleteProjectLimitOpts) Run(ctx context.Context) error { + params := &admin.DeleteProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, } - resp, _, err := opts.store.DeleteProjectLimit(params) + resp, _, err := opts.client.ProjectsApi.DeleteProjectLimitWithParams(ctx, params) if err != nil { return err } @@ -275,40 +279,42 @@ func DeleteProjectLimitBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteProjectLimitTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + _ = cmd.MarkFlagRequired("limitName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetProjectOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetProjectOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetProjectOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetProjectOpts) Run() error { - params := &atlasv2.GetProjectApiParams{ +func (opts *GetProjectOpts) Run(ctx context.Context) error { + params := &admin.GetProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetProject(params) + resp, _, err := opts.client.ProjectsApi.GetProjectWithParams(ctx, params) if err != nil { return err } @@ -328,39 +334,40 @@ func GetProjectBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetProjectTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetProjectByNameOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetProjectByNameOperation + client admin.APIClient groupName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetProjectByNameOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetProjectByNameOpts) Run() error { - params := &atlasv2.GetProjectByNameApiParams{ +func (opts *GetProjectByNameOpts) Run(ctx context.Context) error { + params := &admin.GetProjectByNameApiParams{ GroupName: opts.groupName, } - resp, _, err := opts.store.GetProjectByName(params) + resp, _, err := opts.client.ProjectsApi.GetProjectByNameWithParams(ctx, params) if err != nil { return err } @@ -380,41 +387,42 @@ func GetProjectByNameBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetProjectByNameTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupName, "groupName", "", "usage description") + _ = cmd.MarkFlagRequired("groupName") return cmd } type GetProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetProjectInvitationOperation + client admin.APIClient groupId string invitationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetProjectInvitationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetProjectInvitationOpts) Run() error { - params := &atlasv2.GetProjectInvitationApiParams{ +func (opts *GetProjectInvitationOpts) Run(ctx context.Context) error { + params := &admin.GetProjectInvitationApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, } - resp, _, err := opts.store.GetProjectInvitation(params) + resp, _, err := opts.client.ProjectsApi.GetProjectInvitationWithParams(ctx, params) if err != nil { return err } @@ -434,42 +442,44 @@ func GetProjectInvitationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetProjectInvitationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + _ = cmd.MarkFlagRequired("invitationId") return cmd } type GetProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetProjectLimitOperation + client admin.APIClient limitName string groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetProjectLimitOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetProjectLimitOpts) Run() error { - params := &atlasv2.GetProjectLimitApiParams{ +func (opts *GetProjectLimitOpts) Run(ctx context.Context) error { + params := &admin.GetProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, } - resp, _, err := opts.store.GetProjectLimit(params) + resp, _, err := opts.client.ProjectsApi.GetProjectLimitWithParams(ctx, params) if err != nil { return err } @@ -489,40 +499,42 @@ func GetProjectLimitBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetProjectLimitTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + _ = cmd.MarkFlagRequired("limitName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetProjectSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetProjectSettingsOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetProjectSettingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetProjectSettingsOpts) Run() error { - params := &atlasv2.GetProjectSettingsApiParams{ +func (opts *GetProjectSettingsOpts) Run(ctx context.Context) error { + params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.GetProjectSettings(params) + resp, _, err := opts.client.ProjectsApi.GetProjectSettingsWithParams(ctx, params) if err != nil { return err } @@ -542,41 +554,42 @@ func GetProjectSettingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetProjectSettingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type ListProjectInvitationsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListProjectInvitationsOperation + client admin.APIClient groupId string username string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListProjectInvitationsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListProjectInvitationsOpts) Run() error { - params := &atlasv2.ListProjectInvitationsApiParams{ +func (opts *ListProjectInvitationsOpts) Run(ctx context.Context) error { + params := &admin.ListProjectInvitationsApiParams{ GroupId: opts.groupId, Username: opts.username, } - resp, _, err := opts.store.ListProjectInvitations(params) + resp, _, err := opts.client.ProjectsApi.ListProjectInvitationsWithParams(ctx, params) if err != nil { return err } @@ -596,16 +609,17 @@ func ListProjectInvitationsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListProjectInvitationsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.username, "username", "", "usage description") return cmd @@ -613,23 +627,23 @@ func ListProjectInvitationsBuilder() cobra.Command { type ListProjectLimitsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListProjectLimitsOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListProjectLimitsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListProjectLimitsOpts) Run() error { - params := &atlasv2.ListProjectLimitsApiParams{ +func (opts *ListProjectLimitsOpts) Run(ctx context.Context) error { + params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.ListProjectLimits(params) + resp, _, err := opts.client.ProjectsApi.ListProjectLimitsWithParams(ctx, params) if err != nil { return err } @@ -649,23 +663,24 @@ func ListProjectLimitsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListProjectLimitsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type ListProjectUsersOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListProjectUsersOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -674,16 +689,16 @@ type ListProjectUsersOpts struct { includeOrgUsers bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListProjectUsersOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListProjectUsersOpts) Run() error { - params := &atlasv2.ListProjectUsersApiParams{ +func (opts *ListProjectUsersOpts) Run(ctx context.Context) error { + params := &admin.ListProjectUsersApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, @@ -691,7 +706,7 @@ func (opts *ListProjectUsersOpts) Run() error { FlattenTeams: opts.flattenTeams, IncludeOrgUsers: opts.includeOrgUsers, } - resp, _, err := opts.store.ListProjectUsers(params) + resp, _, err := opts.client.ProjectsApi.ListProjectUsersWithParams(ctx, params) if err != nil { return err } @@ -711,16 +726,17 @@ func ListProjectUsersBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListProjectUsersTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -732,27 +748,27 @@ func ListProjectUsersBuilder() cobra.Command { type ListProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListProjectsOperation + client admin.APIClient includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListProjectsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListProjectsOpts) Run() error { - params := &atlasv2.ListProjectsApiParams{ +func (opts *ListProjectsOpts) Run(ctx context.Context) error { + params := &admin.ListProjectsApiParams{ IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListProjects(params) + resp, _, err := opts.client.ProjectsApi.ListProjectsWithParams(ctx, params) if err != nil { return err } @@ -772,13 +788,13 @@ func ListProjectsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListProjectsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") @@ -790,25 +806,25 @@ func ListProjectsBuilder() cobra.Command { type RemoveProjectUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.RemoveProjectUserOperation + client admin.APIClient groupId string userId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *RemoveProjectUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *RemoveProjectUserOpts) Run() error { - params := &atlasv2.RemoveProjectUserApiParams{ +func (opts *RemoveProjectUserOpts) Run(ctx context.Context) error { + params := &admin.RemoveProjectUserApiParams{ GroupId: opts.groupId, UserId: opts.userId, } - _, err := opts.store.RemoveProjectUser(params) + _, err := opts.client.ProjectsApi.RemoveProjectUserWithParams(ctx, params) if err != nil { return err } @@ -828,42 +844,44 @@ func RemoveProjectUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), RemoveProjectUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") + _ = cmd.MarkFlagRequired("userId") return cmd } type SetProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - store store.SetProjectLimitOperation + client admin.APIClient limitName string groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *SetProjectLimitOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *SetProjectLimitOpts) Run() error { - params := &atlasv2.SetProjectLimitApiParams{ +func (opts *SetProjectLimitOpts) Run(ctx context.Context) error { + params := &admin.SetProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, } - resp, _, err := opts.store.SetProjectLimit(params) + resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params) if err != nil { return err } @@ -883,40 +901,42 @@ func SetProjectLimitBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), SetProjectLimitTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + _ = cmd.MarkFlagRequired("limitName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpdateProjectOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateProjectOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateProjectOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateProjectOpts) Run() error { - params := &atlasv2.UpdateProjectApiParams{ +func (opts *UpdateProjectOpts) Run(ctx context.Context) error { + params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpdateProject(params) + resp, _, err := opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params) if err != nil { return err } @@ -936,39 +956,40 @@ func UpdateProjectBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateProjectTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpdateProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateProjectInvitationOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateProjectInvitationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateProjectInvitationOpts) Run() error { - params := &atlasv2.UpdateProjectInvitationApiParams{ +func (opts *UpdateProjectInvitationOpts) Run(ctx context.Context) error { + params := &admin.UpdateProjectInvitationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpdateProjectInvitation(params) + resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params) if err != nil { return err } @@ -988,41 +1009,42 @@ func UpdateProjectInvitationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateProjectInvitationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type UpdateProjectInvitationByIdOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateProjectInvitationByIdOperation + client admin.APIClient groupId string invitationId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateProjectInvitationByIdOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateProjectInvitationByIdOpts) Run() error { - params := &atlasv2.UpdateProjectInvitationByIdApiParams{ +func (opts *UpdateProjectInvitationByIdOpts) Run(ctx context.Context) error { + params := &admin.UpdateProjectInvitationByIdApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, } - resp, _, err := opts.store.UpdateProjectInvitationById(params) + resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params) if err != nil { return err } @@ -1042,40 +1064,42 @@ func UpdateProjectInvitationByIdBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateProjectInvitationByIdTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") + _ = cmd.MarkFlagRequired("invitationId") return cmd } type UpdateProjectSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateProjectSettingsOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateProjectSettingsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateProjectSettingsOpts) Run() error { - params := &atlasv2.UpdateProjectSettingsApiParams{ +func (opts *UpdateProjectSettingsOpts) Run(ctx context.Context) error { + params := &admin.UpdateProjectSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.UpdateProjectSettings(params) + resp, _, err := opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params) if err != nil { return err } @@ -1095,16 +1119,17 @@ func UpdateProjectSettingsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateProjectSettingsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_projects_store.go b/internal/generated/api_projects_store.go deleted file mode 100644 index 31f5ea208d..0000000000 --- a/internal/generated/api_projects_store.go +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_projects_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateProjectOperation, CreateProjectInvitationOperation, DeleteProjectOperation, DeleteProjectInvitationOperation, DeleteProjectLimitOperation, GetProjectOperation, GetProjectByNameOperation, GetProjectInvitationOperation, GetProjectLimitOperation, GetProjectSettingsOperation, ListProjectInvitationsOperation, ListProjectLimitsOperation, ListProjectUsersOperation, ListProjectsOperation, RemoveProjectUserOperation, SetProjectLimitOperation, UpdateProjectOperation, UpdateProjectInvitationOperation, UpdateProjectInvitationByIdOperation, UpdateProjectSettingsOperation - -type CreateProjectOperation interface { - CreateProject (*atlasv2.CreateProjectApiParams) (*atlasv2.Group, error) -} - -// CreateProject encapsulates the logic to manage different cloud providers. -func (s *Store) CreateProject(params *atlasv2.CreateProjectApiParams) (*atlasv2.Group, error) { - result, _, err := s.clientv2.ProjectsApi.CreateProjectWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateProjectInvitationOperation interface { - CreateProjectInvitation (*atlasv2.CreateProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) -} - -// CreateProjectInvitation encapsulates the logic to manage different cloud providers. -func (s *Store) CreateProjectInvitation(params *atlasv2.CreateProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) { - result, _, err := s.clientv2.ProjectsApi.CreateProjectInvitationWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteProjectOperation interface { - DeleteProject (*atlasv2.DeleteProjectApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteProject encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteProject(params *atlasv2.DeleteProjectApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ProjectsApi.DeleteProjectWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteProjectInvitationOperation interface { - DeleteProjectInvitation (*atlasv2.DeleteProjectInvitationApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteProjectInvitation encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteProjectInvitation(params *atlasv2.DeleteProjectInvitationApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ProjectsApi.DeleteProjectInvitationWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteProjectLimitOperation interface { - DeleteProjectLimit (*atlasv2.DeleteProjectLimitApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteProjectLimit encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteProjectLimit(params *atlasv2.DeleteProjectLimitApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ProjectsApi.DeleteProjectLimitWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetProjectOperation interface { - GetProject (*atlasv2.GetProjectApiParams) (*atlasv2.Group, error) -} - -// GetProject encapsulates the logic to manage different cloud providers. -func (s *Store) GetProject(params *atlasv2.GetProjectApiParams) (*atlasv2.Group, error) { - result, _, err := s.clientv2.ProjectsApi.GetProjectWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetProjectByNameOperation interface { - GetProjectByName (*atlasv2.GetProjectByNameApiParams) (*atlasv2.Group, error) -} - -// GetProjectByName encapsulates the logic to manage different cloud providers. -func (s *Store) GetProjectByName(params *atlasv2.GetProjectByNameApiParams) (*atlasv2.Group, error) { - result, _, err := s.clientv2.ProjectsApi.GetProjectByNameWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetProjectInvitationOperation interface { - GetProjectInvitation (*atlasv2.GetProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) -} - -// GetProjectInvitation encapsulates the logic to manage different cloud providers. -func (s *Store) GetProjectInvitation(params *atlasv2.GetProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) { - result, _, err := s.clientv2.ProjectsApi.GetProjectInvitationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetProjectLimitOperation interface { - GetProjectLimit (*atlasv2.GetProjectLimitApiParams) (*atlasv2.Limit, error) -} - -// GetProjectLimit encapsulates the logic to manage different cloud providers. -func (s *Store) GetProjectLimit(params *atlasv2.GetProjectLimitApiParams) (*atlasv2.Limit, error) { - result, _, err := s.clientv2.ProjectsApi.GetProjectLimitWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetProjectSettingsOperation interface { - GetProjectSettings (*atlasv2.GetProjectSettingsApiParams) (*atlasv2.GroupSettings, error) -} - -// GetProjectSettings encapsulates the logic to manage different cloud providers. -func (s *Store) GetProjectSettings(params *atlasv2.GetProjectSettingsApiParams) (*atlasv2.GroupSettings, error) { - result, _, err := s.clientv2.ProjectsApi.GetProjectSettingsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListProjectInvitationsOperation interface { - ListProjectInvitations (*atlasv2.ListProjectInvitationsApiParams) (*atlasv2.[]GroupInvitation, error) -} - -// ListProjectInvitations encapsulates the logic to manage different cloud providers. -func (s *Store) ListProjectInvitations(params *atlasv2.ListProjectInvitationsApiParams) (*atlasv2.[]GroupInvitation, error) { - result, _, err := s.clientv2.ProjectsApi.ListProjectInvitationsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListProjectLimitsOperation interface { - ListProjectLimits (*atlasv2.ListProjectLimitsApiParams) (*atlasv2.Limit, error) -} - -// ListProjectLimits encapsulates the logic to manage different cloud providers. -func (s *Store) ListProjectLimits(params *atlasv2.ListProjectLimitsApiParams) (*atlasv2.Limit, error) { - result, _, err := s.clientv2.ProjectsApi.ListProjectLimitsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListProjectUsersOperation interface { - ListProjectUsers (*atlasv2.ListProjectUsersApiParams) (*atlasv2.PaginatedApiAppUser, error) -} - -// ListProjectUsers encapsulates the logic to manage different cloud providers. -func (s *Store) ListProjectUsers(params *atlasv2.ListProjectUsersApiParams) (*atlasv2.PaginatedApiAppUser, error) { - result, _, err := s.clientv2.ProjectsApi.ListProjectUsersWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListProjectsOperation interface { - ListProjects (*atlasv2.ListProjectsApiParams) (*atlasv2.PaginatedAtlasGroup, error) -} - -// ListProjects encapsulates the logic to manage different cloud providers. -func (s *Store) ListProjects(params *atlasv2.ListProjectsApiParams) (*atlasv2.PaginatedAtlasGroup, error) { - result, _, err := s.clientv2.ProjectsApi.ListProjectsWithParams(s.ctx, params).Execute() - return &result, err -} - -type RemoveProjectUserOperation interface { - RemoveProjectUser (*atlasv2.RemoveProjectUserApiParams) error -} - -// RemoveProjectUser encapsulates the logic to manage different cloud providers. -func (s *Store) RemoveProjectUser(params *atlasv2.RemoveProjectUserApiParams) (error) { - _, err := s.clientv2.ProjectsApi.RemoveProjectUserWithParams(s.ctx, params).Execute() - return err -} - -type SetProjectLimitOperation interface { - SetProjectLimit (*atlasv2.SetProjectLimitApiParams) (*atlasv2.Limit, error) -} - -// SetProjectLimit encapsulates the logic to manage different cloud providers. -func (s *Store) SetProjectLimit(params *atlasv2.SetProjectLimitApiParams) (*atlasv2.Limit, error) { - result, _, err := s.clientv2.ProjectsApi.SetProjectLimitWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateProjectOperation interface { - UpdateProject (*atlasv2.UpdateProjectApiParams) (*atlasv2.Group, error) -} - -// UpdateProject encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateProject(params *atlasv2.UpdateProjectApiParams) (*atlasv2.Group, error) { - result, _, err := s.clientv2.ProjectsApi.UpdateProjectWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateProjectInvitationOperation interface { - UpdateProjectInvitation (*atlasv2.UpdateProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) -} - -// UpdateProjectInvitation encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateProjectInvitation(params *atlasv2.UpdateProjectInvitationApiParams) (*atlasv2.GroupInvitation, error) { - result, _, err := s.clientv2.ProjectsApi.UpdateProjectInvitationWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateProjectInvitationByIdOperation interface { - UpdateProjectInvitationById (*atlasv2.UpdateProjectInvitationByIdApiParams) (*atlasv2.GroupInvitation, error) -} - -// UpdateProjectInvitationById encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateProjectInvitationById(params *atlasv2.UpdateProjectInvitationByIdApiParams) (*atlasv2.GroupInvitation, error) { - result, _, err := s.clientv2.ProjectsApi.UpdateProjectInvitationByIdWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateProjectSettingsOperation interface { - UpdateProjectSettings (*atlasv2.UpdateProjectSettingsApiParams) (*atlasv2.GroupSettings, error) -} - -// UpdateProjectSettings encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateProjectSettings(params *atlasv2.UpdateProjectSettingsApiParams) (*atlasv2.GroupSettings, error) { - result, _, err := s.clientv2.ProjectsApi.UpdateProjectSettingsWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index 08f7428825..385fca5416 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateRollingIndexOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateRollingIndexOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateRollingIndexOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateRollingIndexOpts) Run() error { - params := &atlasv2.CreateRollingIndexApiParams{ +func (opts *CreateRollingIndexOpts) Run(ctx context.Context) error { + params := &admin.CreateRollingIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - _, err := opts.store.CreateRollingIndex(params) + _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params) if err != nil { return err } @@ -64,17 +64,19 @@ func CreateRollingIndexBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateRollingIndexTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/generated/api_rolling_index_store.go b/internal/generated/api_rolling_index_store.go deleted file mode 100644 index ace301a825..0000000000 --- a/internal/generated/api_rolling_index_store.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_rolling_index_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateRollingIndexOperation - -type CreateRollingIndexOperation interface { - CreateRollingIndex (*atlasv2.CreateRollingIndexApiParams) error -} - -// CreateRollingIndex encapsulates the logic to manage different cloud providers. -func (s *Store) CreateRollingIndex(params *atlasv2.CreateRollingIndexApiParams) (error) { - _, err := s.clientv2.RollingIndexApi.CreateRollingIndexWithParams(s.ctx, params).Execute() - return err -} - diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index 807e452e49..b18b614473 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -19,28 +19,28 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type GetSystemStatusOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetSystemStatusOperation + client admin.APIClient } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetSystemStatusOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetSystemStatusOpts) Run() error { - params := &atlasv2.GetSystemStatusApiParams{ +func (opts *GetSystemStatusOpts) Run(ctx context.Context) error { + params := &admin.GetSystemStatusApiParams{ } - resp, _, err := opts.store.GetSystemStatus(params) + resp, _, err := opts.client.RootApi.GetSystemStatusWithParams(ctx, params) if err != nil { return err } @@ -60,13 +60,13 @@ func GetSystemStatusBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetSystemStatusTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } diff --git a/internal/generated/api_root_store.go b/internal/generated/api_root_store.go deleted file mode 100644 index 0b98d53629..0000000000 --- a/internal/generated/api_root_store.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_root_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas GetSystemStatusOperation - -type GetSystemStatusOperation interface { - GetSystemStatus (*atlasv2.GetSystemStatusApiParams) (*atlasv2.SystemStatus, error) -} - -// GetSystemStatus encapsulates the logic to manage different cloud providers. -func (s *Store) GetSystemStatus(params *atlasv2.GetSystemStatusApiParams) (*atlasv2.SystemStatus, error) { - result, _, err := s.clientv2.RootApi.GetSystemStatusWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index d8129a6493..0cbb134761 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateServerlessInstanceOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateServerlessInstanceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateServerlessInstanceOpts) Run() error { - params := &atlasv2.CreateServerlessInstanceApiParams{ +func (opts *CreateServerlessInstanceOpts) Run(ctx context.Context) error { + params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.CreateServerlessInstance(params) + resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params) if err != nil { return err } @@ -62,41 +62,42 @@ func CreateServerlessInstanceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateServerlessInstanceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type DeleteServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteServerlessInstanceOperation + client admin.APIClient groupId string name string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteServerlessInstanceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteServerlessInstanceOpts) Run() error { - params := &atlasv2.DeleteServerlessInstanceApiParams{ +func (opts *DeleteServerlessInstanceOpts) Run(ctx context.Context) error { + params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.store.DeleteServerlessInstance(params) + resp, _, err := opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params) if err != nil { return err } @@ -116,42 +117,44 @@ func DeleteServerlessInstanceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteServerlessInstanceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + _ = cmd.MarkFlagRequired("name") return cmd } type GetServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetServerlessInstanceOperation + client admin.APIClient groupId string name string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetServerlessInstanceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetServerlessInstanceOpts) Run() error { - params := &atlasv2.GetServerlessInstanceApiParams{ +func (opts *GetServerlessInstanceOpts) Run(ctx context.Context) error { + params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.store.GetServerlessInstance(params) + resp, _, err := opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params) if err != nil { return err } @@ -171,46 +174,48 @@ func GetServerlessInstanceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetServerlessInstanceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + _ = cmd.MarkFlagRequired("name") return cmd } type ListServerlessInstancesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListServerlessInstancesOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListServerlessInstancesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListServerlessInstancesOpts) Run() error { - params := &atlasv2.ListServerlessInstancesApiParams{ +func (opts *ListServerlessInstancesOpts) Run(ctx context.Context) error { + params := &admin.ListServerlessInstancesApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListServerlessInstances(params) + resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params) if err != nil { return err } @@ -230,16 +235,17 @@ func ListServerlessInstancesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListServerlessInstancesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -249,25 +255,25 @@ func ListServerlessInstancesBuilder() cobra.Command { type UpdateServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateServerlessInstanceOperation + client admin.APIClient groupId string name string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateServerlessInstanceOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateServerlessInstanceOpts) Run() error { - params := &atlasv2.UpdateServerlessInstanceApiParams{ +func (opts *UpdateServerlessInstanceOpts) Run(ctx context.Context) error { + params := &admin.UpdateServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.store.UpdateServerlessInstance(params) + resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params) if err != nil { return err } @@ -287,17 +293,19 @@ func UpdateServerlessInstanceBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateServerlessInstanceTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + _ = cmd.MarkFlagRequired("name") return cmd } diff --git a/internal/generated/api_serverless_instances_store.go b/internal/generated/api_serverless_instances_store.go deleted file mode 100644 index 9bdcae116d..0000000000 --- a/internal/generated/api_serverless_instances_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_serverless_instances_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateServerlessInstanceOperation, DeleteServerlessInstanceOperation, GetServerlessInstanceOperation, ListServerlessInstancesOperation, UpdateServerlessInstanceOperation - -type CreateServerlessInstanceOperation interface { - CreateServerlessInstance (*atlasv2.CreateServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) -} - -// CreateServerlessInstance encapsulates the logic to manage different cloud providers. -func (s *Store) CreateServerlessInstance(params *atlasv2.CreateServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) { - result, _, err := s.clientv2.ServerlessInstancesApi.CreateServerlessInstanceWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteServerlessInstanceOperation interface { - DeleteServerlessInstance (*atlasv2.DeleteServerlessInstanceApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteServerlessInstance encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteServerlessInstance(params *atlasv2.DeleteServerlessInstanceApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetServerlessInstanceOperation interface { - GetServerlessInstance (*atlasv2.GetServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) -} - -// GetServerlessInstance encapsulates the logic to manage different cloud providers. -func (s *Store) GetServerlessInstance(params *atlasv2.GetServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) { - result, _, err := s.clientv2.ServerlessInstancesApi.GetServerlessInstanceWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListServerlessInstancesOperation interface { - ListServerlessInstances (*atlasv2.ListServerlessInstancesApiParams) (*atlasv2.PaginatedServerlessInstanceDescription, error) -} - -// ListServerlessInstances encapsulates the logic to manage different cloud providers. -func (s *Store) ListServerlessInstances(params *atlasv2.ListServerlessInstancesApiParams) (*atlasv2.PaginatedServerlessInstanceDescription, error) { - result, _, err := s.clientv2.ServerlessInstancesApi.ListServerlessInstancesWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateServerlessInstanceOperation interface { - UpdateServerlessInstance (*atlasv2.UpdateServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) -} - -// UpdateServerlessInstance encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateServerlessInstance(params *atlasv2.UpdateServerlessInstanceApiParams) (*atlasv2.ServerlessInstanceDescription, error) { - result, _, err := s.clientv2.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index ad33ec5b8a..eea43ac17a 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateServerlessPrivateEndpointOperation + client admin.APIClient groupId string instanceName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateServerlessPrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateServerlessPrivateEndpointOpts) Run() error { - params := &atlasv2.CreateServerlessPrivateEndpointApiParams{ +func (opts *CreateServerlessPrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.CreateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, } - resp, _, err := opts.store.CreateServerlessPrivateEndpoint(params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -64,44 +64,46 @@ func CreateServerlessPrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateServerlessPrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + _ = cmd.MarkFlagRequired("instanceName") return cmd } type DeleteServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteServerlessPrivateEndpointOperation + client admin.APIClient groupId string instanceName string endpointId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteServerlessPrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteServerlessPrivateEndpointOpts) Run() error { - params := &atlasv2.DeleteServerlessPrivateEndpointApiParams{ +func (opts *DeleteServerlessPrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.DeleteServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, EndpointId: opts.endpointId, } - resp, _, err := opts.store.DeleteServerlessPrivateEndpoint(params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -121,45 +123,48 @@ func DeleteServerlessPrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteServerlessPrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + _ = cmd.MarkFlagRequired("instanceName") cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointId") return cmd } type GetServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetServerlessPrivateEndpointOperation + client admin.APIClient groupId string instanceName string endpointId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetServerlessPrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetServerlessPrivateEndpointOpts) Run() error { - params := &atlasv2.GetServerlessPrivateEndpointApiParams{ +func (opts *GetServerlessPrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.GetServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, EndpointId: opts.endpointId, } - resp, _, err := opts.store.GetServerlessPrivateEndpoint(params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -179,43 +184,46 @@ func GetServerlessPrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetServerlessPrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + _ = cmd.MarkFlagRequired("instanceName") cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointId") return cmd } type ListServerlessPrivateEndpointsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListServerlessPrivateEndpointsOperation + client admin.APIClient groupId string instanceName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListServerlessPrivateEndpointsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListServerlessPrivateEndpointsOpts) Run() error { - params := &atlasv2.ListServerlessPrivateEndpointsApiParams{ +func (opts *ListServerlessPrivateEndpointsOpts) Run(ctx context.Context) error { + params := &admin.ListServerlessPrivateEndpointsApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, } - resp, _, err := opts.store.ListServerlessPrivateEndpoints(params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(ctx, params) if err != nil { return err } @@ -235,44 +243,46 @@ func ListServerlessPrivateEndpointsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListServerlessPrivateEndpointsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + _ = cmd.MarkFlagRequired("instanceName") return cmd } type UpdateServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateServerlessPrivateEndpointOperation + client admin.APIClient groupId string instanceName string endpointId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateServerlessPrivateEndpointOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateServerlessPrivateEndpointOpts) Run() error { - params := &atlasv2.UpdateServerlessPrivateEndpointApiParams{ +func (opts *UpdateServerlessPrivateEndpointOpts) Run(ctx context.Context) error { + params := &admin.UpdateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, EndpointId: opts.endpointId, } - resp, _, err := opts.store.UpdateServerlessPrivateEndpoint(params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params) if err != nil { return err } @@ -292,18 +302,21 @@ func UpdateServerlessPrivateEndpointBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateServerlessPrivateEndpointTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") + _ = cmd.MarkFlagRequired("instanceName") cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") + _ = cmd.MarkFlagRequired("endpointId") return cmd } diff --git a/internal/generated/api_serverless_private_endpoints_store.go b/internal/generated/api_serverless_private_endpoints_store.go deleted file mode 100644 index 180e24dee9..0000000000 --- a/internal/generated/api_serverless_private_endpoints_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_serverless_private_endpoints_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateServerlessPrivateEndpointOperation, DeleteServerlessPrivateEndpointOperation, GetServerlessPrivateEndpointOperation, ListServerlessPrivateEndpointsOperation, UpdateServerlessPrivateEndpointOperation - -type CreateServerlessPrivateEndpointOperation interface { - CreateServerlessPrivateEndpoint (*atlasv2.CreateServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) -} - -// CreateServerlessPrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) CreateServerlessPrivateEndpoint(params *atlasv2.CreateServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) { - result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteServerlessPrivateEndpointOperation interface { - DeleteServerlessPrivateEndpoint (*atlasv2.DeleteServerlessPrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteServerlessPrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteServerlessPrivateEndpoint(params *atlasv2.DeleteServerlessPrivateEndpointApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetServerlessPrivateEndpointOperation interface { - GetServerlessPrivateEndpoint (*atlasv2.GetServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) -} - -// GetServerlessPrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) GetServerlessPrivateEndpoint(params *atlasv2.GetServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) { - result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListServerlessPrivateEndpointsOperation interface { - ListServerlessPrivateEndpoints (*atlasv2.ListServerlessPrivateEndpointsApiParams) (*atlasv2.[]ServerlessTenantEndpoint, error) -} - -// ListServerlessPrivateEndpoints encapsulates the logic to manage different cloud providers. -func (s *Store) ListServerlessPrivateEndpoints(params *atlasv2.ListServerlessPrivateEndpointsApiParams) (*atlasv2.[]ServerlessTenantEndpoint, error) { - result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateServerlessPrivateEndpointOperation interface { - UpdateServerlessPrivateEndpoint (*atlasv2.UpdateServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) -} - -// UpdateServerlessPrivateEndpoint encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateServerlessPrivateEndpoint(params *atlasv2.UpdateServerlessPrivateEndpointApiParams) (*atlasv2.ServerlessTenantEndpoint, error) { - result, _, err := s.clientv2.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index 90b3187897..abb0faae6b 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateSharedClusterBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateSharedClusterBackupRestoreJobOperation + client admin.APIClient clusterName string groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateSharedClusterBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateSharedClusterBackupRestoreJobOpts) Run() error { - params := &atlasv2.CreateSharedClusterBackupRestoreJobApiParams{ +func (opts *CreateSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.CreateSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, } - resp, _, err := opts.store.CreateSharedClusterBackupRestoreJob(params) + resp, _, err := opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -64,44 +64,46 @@ func CreateSharedClusterBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateSharedClusterBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetSharedClusterBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetSharedClusterBackupRestoreJobOperation + client admin.APIClient clusterName string groupId string restoreId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetSharedClusterBackupRestoreJobOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetSharedClusterBackupRestoreJobOpts) Run() error { - params := &atlasv2.GetSharedClusterBackupRestoreJobApiParams{ +func (opts *GetSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error { + params := &admin.GetSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, RestoreId: opts.restoreId, } - resp, _, err := opts.store.GetSharedClusterBackupRestoreJob(params) + resp, _, err := opts.client.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(ctx, params) if err != nil { return err } @@ -121,43 +123,46 @@ func GetSharedClusterBackupRestoreJobBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetSharedClusterBackupRestoreJobTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", "usage description") + _ = cmd.MarkFlagRequired("restoreId") return cmd } type ListSharedClusterBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListSharedClusterBackupRestoreJobsOperation + client admin.APIClient clusterName string groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListSharedClusterBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListSharedClusterBackupRestoreJobsOpts) Run() error { - params := &atlasv2.ListSharedClusterBackupRestoreJobsApiParams{ +func (opts *ListSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context) error { + params := &admin.ListSharedClusterBackupRestoreJobsApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, } - resp, _, err := opts.store.ListSharedClusterBackupRestoreJobs(params) + resp, _, err := opts.client.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(ctx, params) if err != nil { return err } @@ -177,17 +182,19 @@ func ListSharedClusterBackupRestoreJobsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListSharedClusterBackupRestoreJobsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_shared_tier_restore_jobs_store.go b/internal/generated/api_shared_tier_restore_jobs_store.go deleted file mode 100644 index ee97a4da6a..0000000000 --- a/internal/generated/api_shared_tier_restore_jobs_store.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_shared_tier_restore_jobs_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateSharedClusterBackupRestoreJobOperation, GetSharedClusterBackupRestoreJobOperation, ListSharedClusterBackupRestoreJobsOperation - -type CreateSharedClusterBackupRestoreJobOperation interface { - CreateSharedClusterBackupRestoreJob (*atlasv2.CreateSharedClusterBackupRestoreJobApiParams) (*atlasv2.TenantRestore, error) -} - -// CreateSharedClusterBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) CreateSharedClusterBackupRestoreJob(params *atlasv2.CreateSharedClusterBackupRestoreJobApiParams) (*atlasv2.TenantRestore, error) { - result, _, err := s.clientv2.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetSharedClusterBackupRestoreJobOperation interface { - GetSharedClusterBackupRestoreJob (*atlasv2.GetSharedClusterBackupRestoreJobApiParams) (*atlasv2.TenantRestore, error) -} - -// GetSharedClusterBackupRestoreJob encapsulates the logic to manage different cloud providers. -func (s *Store) GetSharedClusterBackupRestoreJob(params *atlasv2.GetSharedClusterBackupRestoreJobApiParams) (*atlasv2.TenantRestore, error) { - result, _, err := s.clientv2.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListSharedClusterBackupRestoreJobsOperation interface { - ListSharedClusterBackupRestoreJobs (*atlasv2.ListSharedClusterBackupRestoreJobsApiParams) (*atlasv2.PaginatedTenantRestore, error) -} - -// ListSharedClusterBackupRestoreJobs encapsulates the logic to manage different cloud providers. -func (s *Store) ListSharedClusterBackupRestoreJobs(params *atlasv2.ListSharedClusterBackupRestoreJobsApiParams) (*atlasv2.PaginatedTenantRestore, error) { - result, _, err := s.clientv2.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index d4b7411c3e..4bb4375e15 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type DownloadSharedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DownloadSharedClusterBackupOperation + client admin.APIClient clusterName string groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DownloadSharedClusterBackupOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DownloadSharedClusterBackupOpts) Run() error { - params := &atlasv2.DownloadSharedClusterBackupApiParams{ +func (opts *DownloadSharedClusterBackupOpts) Run(ctx context.Context) error { + params := &admin.DownloadSharedClusterBackupApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, } - resp, _, err := opts.store.DownloadSharedClusterBackup(params) + resp, _, err := opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params) if err != nil { return err } @@ -64,44 +64,46 @@ func DownloadSharedClusterBackupBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DownloadSharedClusterBackupTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetSharedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetSharedClusterBackupOperation + client admin.APIClient groupId string clusterName string snapshotId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetSharedClusterBackupOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetSharedClusterBackupOpts) Run() error { - params := &atlasv2.GetSharedClusterBackupApiParams{ +func (opts *GetSharedClusterBackupOpts) Run(ctx context.Context) error { + params := &admin.GetSharedClusterBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.store.GetSharedClusterBackup(params) + resp, _, err := opts.client.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(ctx, params) if err != nil { return err } @@ -121,43 +123,46 @@ func GetSharedClusterBackupBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetSharedClusterBackupTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") + _ = cmd.MarkFlagRequired("snapshotId") return cmd } type ListSharedClusterBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListSharedClusterBackupsOperation + client admin.APIClient groupId string clusterName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListSharedClusterBackupsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListSharedClusterBackupsOpts) Run() error { - params := &atlasv2.ListSharedClusterBackupsApiParams{ +func (opts *ListSharedClusterBackupsOpts) Run(ctx context.Context) error { + params := &admin.ListSharedClusterBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.store.ListSharedClusterBackups(params) + resp, _, err := opts.client.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(ctx, params) if err != nil { return err } @@ -177,17 +182,19 @@ func ListSharedClusterBackupsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListSharedClusterBackupsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/generated/api_shared_tier_snapshots_store.go b/internal/generated/api_shared_tier_snapshots_store.go deleted file mode 100644 index 779912129b..0000000000 --- a/internal/generated/api_shared_tier_snapshots_store.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_shared_tier_snapshots_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas DownloadSharedClusterBackupOperation, GetSharedClusterBackupOperation, ListSharedClusterBackupsOperation - -type DownloadSharedClusterBackupOperation interface { - DownloadSharedClusterBackup (*atlasv2.DownloadSharedClusterBackupApiParams) (*atlasv2.TenantRestore, error) -} - -// DownloadSharedClusterBackup encapsulates the logic to manage different cloud providers. -func (s *Store) DownloadSharedClusterBackup(params *atlasv2.DownloadSharedClusterBackupApiParams) (*atlasv2.TenantRestore, error) { - result, _, err := s.clientv2.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetSharedClusterBackupOperation interface { - GetSharedClusterBackup (*atlasv2.GetSharedClusterBackupApiParams) (*atlasv2.TenantSnapshot, error) -} - -// GetSharedClusterBackup encapsulates the logic to manage different cloud providers. -func (s *Store) GetSharedClusterBackup(params *atlasv2.GetSharedClusterBackupApiParams) (*atlasv2.TenantSnapshot, error) { - result, _, err := s.clientv2.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListSharedClusterBackupsOperation interface { - ListSharedClusterBackups (*atlasv2.ListSharedClusterBackupsApiParams) (*atlasv2.PaginatedTenantSnapshot, error) -} - -// ListSharedClusterBackups encapsulates the logic to manage different cloud providers. -func (s *Store) ListSharedClusterBackups(params *atlasv2.ListSharedClusterBackupsApiParams) (*atlasv2.PaginatedTenantSnapshot, error) { - result, _, err := s.clientv2.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 8e33c8fcc6..79234bfc5d 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type AddAllTeamsToProjectOpts struct { cli.GlobalOpts cli.OutputOpts - store store.AddAllTeamsToProjectOperation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *AddAllTeamsToProjectOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *AddAllTeamsToProjectOpts) Run() error { - params := &atlasv2.AddAllTeamsToProjectApiParams{ +func (opts *AddAllTeamsToProjectOpts) Run(ctx context.Context) error { + params := &admin.AddAllTeamsToProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.AddAllTeamsToProject(params) + resp, _, err := opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params) if err != nil { return err } @@ -62,41 +62,42 @@ func AddAllTeamsToProjectBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), AddAllTeamsToProjectTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type AddTeamUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.AddTeamUserOperation + client admin.APIClient orgId string teamId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *AddTeamUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *AddTeamUserOpts) Run() error { - params := &atlasv2.AddTeamUserApiParams{ +func (opts *AddTeamUserOpts) Run(ctx context.Context) error { + params := &admin.AddTeamUserApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.store.AddTeamUser(params) + resp, _, err := opts.client.TeamsApi.AddTeamUserWithParams(ctx, params) if err != nil { return err } @@ -116,40 +117,42 @@ func AddTeamUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), AddTeamUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + _ = cmd.MarkFlagRequired("teamId") return cmd } type CreateTeamOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateTeamOperation + client admin.APIClient orgId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateTeamOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateTeamOpts) Run() error { - params := &atlasv2.CreateTeamApiParams{ +func (opts *CreateTeamOpts) Run(ctx context.Context) error { + params := &admin.CreateTeamApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.store.CreateTeam(params) + resp, _, err := opts.client.TeamsApi.CreateTeamWithParams(ctx, params) if err != nil { return err } @@ -169,41 +172,42 @@ func CreateTeamBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateTeamTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") return cmd } type DeleteTeamOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteTeamOperation + client admin.APIClient orgId string teamId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteTeamOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteTeamOpts) Run() error { - params := &atlasv2.DeleteTeamApiParams{ +func (opts *DeleteTeamOpts) Run(ctx context.Context) error { + params := &admin.DeleteTeamApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.store.DeleteTeam(params) + resp, _, err := opts.client.TeamsApi.DeleteTeamWithParams(ctx, params) if err != nil { return err } @@ -223,42 +227,44 @@ func DeleteTeamBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteTeamTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + _ = cmd.MarkFlagRequired("teamId") return cmd } type GetTeamByIdOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetTeamByIdOperation + client admin.APIClient orgId string teamId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetTeamByIdOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetTeamByIdOpts) Run() error { - params := &atlasv2.GetTeamByIdApiParams{ +func (opts *GetTeamByIdOpts) Run(ctx context.Context) error { + params := &admin.GetTeamByIdApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.store.GetTeamById(params) + resp, _, err := opts.client.TeamsApi.GetTeamByIdWithParams(ctx, params) if err != nil { return err } @@ -278,42 +284,44 @@ func GetTeamByIdBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetTeamByIdTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + _ = cmd.MarkFlagRequired("teamId") return cmd } type GetTeamByNameOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetTeamByNameOperation + client admin.APIClient orgId string teamName string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetTeamByNameOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetTeamByNameOpts) Run() error { - params := &atlasv2.GetTeamByNameApiParams{ +func (opts *GetTeamByNameOpts) Run(ctx context.Context) error { + params := &admin.GetTeamByNameApiParams{ OrgId: opts.orgId, TeamName: opts.teamName, } - resp, _, err := opts.store.GetTeamByName(params) + resp, _, err := opts.client.TeamsApi.GetTeamByNameWithParams(ctx, params) if err != nil { return err } @@ -333,46 +341,48 @@ func GetTeamByNameBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetTeamByNameTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.teamName, "teamName", "", "usage description") + _ = cmd.MarkFlagRequired("teamName") return cmd } type ListOrganizationTeamsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListOrganizationTeamsOperation + client admin.APIClient orgId string itemsPerPage int32 includeCount bool pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListOrganizationTeamsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListOrganizationTeamsOpts) Run() error { - params := &atlasv2.ListOrganizationTeamsApiParams{ +func (opts *ListOrganizationTeamsOpts) Run(ctx context.Context) error { + params := &admin.ListOrganizationTeamsApiParams{ OrgId: opts.orgId, ItemsPerPage: opts.itemsPerPage, IncludeCount: opts.includeCount, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListOrganizationTeams(params) + resp, _, err := opts.client.TeamsApi.ListOrganizationTeamsWithParams(ctx, params) if err != nil { return err } @@ -392,16 +402,17 @@ func ListOrganizationTeamsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListOrganizationTeamsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -411,29 +422,29 @@ func ListOrganizationTeamsBuilder() cobra.Command { type ListProjectTeamsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListProjectTeamsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListProjectTeamsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListProjectTeamsOpts) Run() error { - params := &atlasv2.ListProjectTeamsApiParams{ +func (opts *ListProjectTeamsOpts) Run(ctx context.Context) error { + params := &admin.ListProjectTeamsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListProjectTeams(params) + resp, _, err := opts.client.TeamsApi.ListProjectTeamsWithParams(ctx, params) if err != nil { return err } @@ -453,16 +464,17 @@ func ListProjectTeamsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListProjectTeamsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -472,29 +484,29 @@ func ListProjectTeamsBuilder() cobra.Command { type ListTeamUsersOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListTeamUsersOperation + client admin.APIClient orgId string teamId string itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListTeamUsersOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListTeamUsersOpts) Run() error { - params := &atlasv2.ListTeamUsersApiParams{ +func (opts *ListTeamUsersOpts) Run(ctx context.Context) error { + params := &admin.ListTeamUsersApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListTeamUsers(params) + resp, _, err := opts.client.TeamsApi.ListTeamUsersWithParams(ctx, params) if err != nil { return err } @@ -514,17 +526,19 @@ func ListTeamUsersBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListTeamUsersTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + _ = cmd.MarkFlagRequired("teamId") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -533,25 +547,25 @@ func ListTeamUsersBuilder() cobra.Command { type RemoveProjectTeamOpts struct { cli.GlobalOpts cli.OutputOpts - store store.RemoveProjectTeamOperation + client admin.APIClient groupId string teamId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *RemoveProjectTeamOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *RemoveProjectTeamOpts) Run() error { - params := &atlasv2.RemoveProjectTeamApiParams{ +func (opts *RemoveProjectTeamOpts) Run(ctx context.Context) error { + params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, } - resp, _, err := opts.store.RemoveProjectTeam(params) + resp, _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params) if err != nil { return err } @@ -571,44 +585,46 @@ func RemoveProjectTeamBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), RemoveProjectTeamTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + _ = cmd.MarkFlagRequired("teamId") return cmd } type RemoveTeamUserOpts struct { cli.GlobalOpts cli.OutputOpts - store store.RemoveTeamUserOperation + client admin.APIClient orgId string teamId string userId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *RemoveTeamUserOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *RemoveTeamUserOpts) Run() error { - params := &atlasv2.RemoveTeamUserApiParams{ +func (opts *RemoveTeamUserOpts) Run(ctx context.Context) error { + params := &admin.RemoveTeamUserApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, UserId: opts.userId, } - _, err := opts.store.RemoveTeamUser(params) + _, err := opts.client.TeamsApi.RemoveTeamUserWithParams(ctx, params) if err != nil { return err } @@ -628,43 +644,46 @@ func RemoveTeamUserBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), RemoveTeamUserTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + _ = cmd.MarkFlagRequired("teamId") cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") + _ = cmd.MarkFlagRequired("userId") return cmd } type RenameTeamOpts struct { cli.GlobalOpts cli.OutputOpts - store store.RenameTeamOperation + client admin.APIClient orgId string teamId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *RenameTeamOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *RenameTeamOpts) Run() error { - params := &atlasv2.RenameTeamApiParams{ +func (opts *RenameTeamOpts) Run(ctx context.Context) error { + params := &admin.RenameTeamApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.store.RenameTeam(params) + resp, _, err := opts.client.TeamsApi.RenameTeamWithParams(ctx, params) if err != nil { return err } @@ -684,42 +703,44 @@ func RenameTeamBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), RenameTeamTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + _ = cmd.MarkFlagRequired("orgId") cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + _ = cmd.MarkFlagRequired("teamId") return cmd } type UpdateTeamRolesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateTeamRolesOperation + client admin.APIClient groupId string teamId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateTeamRolesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateTeamRolesOpts) Run() error { - params := &atlasv2.UpdateTeamRolesApiParams{ +func (opts *UpdateTeamRolesOpts) Run(ctx context.Context) error { + params := &admin.UpdateTeamRolesApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, } - resp, _, err := opts.store.UpdateTeamRoles(params) + resp, _, err := opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params) if err != nil { return err } @@ -739,17 +760,19 @@ func UpdateTeamRolesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateTeamRolesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") + _ = cmd.MarkFlagRequired("teamId") return cmd } diff --git a/internal/generated/api_teams_store.go b/internal/generated/api_teams_store.go deleted file mode 100644 index bb8b81af44..0000000000 --- a/internal/generated/api_teams_store.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_teams_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas AddAllTeamsToProjectOperation, AddTeamUserOperation, CreateTeamOperation, DeleteTeamOperation, GetTeamByIdOperation, GetTeamByNameOperation, ListOrganizationTeamsOperation, ListProjectTeamsOperation, ListTeamUsersOperation, RemoveProjectTeamOperation, RemoveTeamUserOperation, RenameTeamOperation, UpdateTeamRolesOperation - -type AddAllTeamsToProjectOperation interface { - AddAllTeamsToProject (*atlasv2.AddAllTeamsToProjectApiParams) (*atlasv2.PaginatedTeamRole, error) -} - -// AddAllTeamsToProject encapsulates the logic to manage different cloud providers. -func (s *Store) AddAllTeamsToProject(params *atlasv2.AddAllTeamsToProjectApiParams) (*atlasv2.PaginatedTeamRole, error) { - result, _, err := s.clientv2.TeamsApi.AddAllTeamsToProjectWithParams(s.ctx, params).Execute() - return &result, err -} - -type AddTeamUserOperation interface { - AddTeamUser (*atlasv2.AddTeamUserApiParams) (*atlasv2.PaginatedApiAppUser, error) -} - -// AddTeamUser encapsulates the logic to manage different cloud providers. -func (s *Store) AddTeamUser(params *atlasv2.AddTeamUserApiParams) (*atlasv2.PaginatedApiAppUser, error) { - result, _, err := s.clientv2.TeamsApi.AddTeamUserWithParams(s.ctx, params).Execute() - return &result, err -} - -type CreateTeamOperation interface { - CreateTeam (*atlasv2.CreateTeamApiParams) (*atlasv2.Team, error) -} - -// CreateTeam encapsulates the logic to manage different cloud providers. -func (s *Store) CreateTeam(params *atlasv2.CreateTeamApiParams) (*atlasv2.Team, error) { - result, _, err := s.clientv2.TeamsApi.CreateTeamWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteTeamOperation interface { - DeleteTeam (*atlasv2.DeleteTeamApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteTeam encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteTeam(params *atlasv2.DeleteTeamApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.TeamsApi.DeleteTeamWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetTeamByIdOperation interface { - GetTeamById (*atlasv2.GetTeamByIdApiParams) (*atlasv2.TeamResponse, error) -} - -// GetTeamById encapsulates the logic to manage different cloud providers. -func (s *Store) GetTeamById(params *atlasv2.GetTeamByIdApiParams) (*atlasv2.TeamResponse, error) { - result, _, err := s.clientv2.TeamsApi.GetTeamByIdWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetTeamByNameOperation interface { - GetTeamByName (*atlasv2.GetTeamByNameApiParams) (*atlasv2.TeamResponse, error) -} - -// GetTeamByName encapsulates the logic to manage different cloud providers. -func (s *Store) GetTeamByName(params *atlasv2.GetTeamByNameApiParams) (*atlasv2.TeamResponse, error) { - result, _, err := s.clientv2.TeamsApi.GetTeamByNameWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListOrganizationTeamsOperation interface { - ListOrganizationTeams (*atlasv2.ListOrganizationTeamsApiParams) (*atlasv2.PaginatedTeam, error) -} - -// ListOrganizationTeams encapsulates the logic to manage different cloud providers. -func (s *Store) ListOrganizationTeams(params *atlasv2.ListOrganizationTeamsApiParams) (*atlasv2.PaginatedTeam, error) { - result, _, err := s.clientv2.TeamsApi.ListOrganizationTeamsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListProjectTeamsOperation interface { - ListProjectTeams (*atlasv2.ListProjectTeamsApiParams) (*atlasv2.PaginatedTeamRole, error) -} - -// ListProjectTeams encapsulates the logic to manage different cloud providers. -func (s *Store) ListProjectTeams(params *atlasv2.ListProjectTeamsApiParams) (*atlasv2.PaginatedTeamRole, error) { - result, _, err := s.clientv2.TeamsApi.ListProjectTeamsWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListTeamUsersOperation interface { - ListTeamUsers (*atlasv2.ListTeamUsersApiParams) (*atlasv2.PaginatedApiAppUser, error) -} - -// ListTeamUsers encapsulates the logic to manage different cloud providers. -func (s *Store) ListTeamUsers(params *atlasv2.ListTeamUsersApiParams) (*atlasv2.PaginatedApiAppUser, error) { - result, _, err := s.clientv2.TeamsApi.ListTeamUsersWithParams(s.ctx, params).Execute() - return &result, err -} - -type RemoveProjectTeamOperation interface { - RemoveProjectTeam (*atlasv2.RemoveProjectTeamApiParams) (*atlasv2.map[string]interface{}, error) -} - -// RemoveProjectTeam encapsulates the logic to manage different cloud providers. -func (s *Store) RemoveProjectTeam(params *atlasv2.RemoveProjectTeamApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.TeamsApi.RemoveProjectTeamWithParams(s.ctx, params).Execute() - return &result, err -} - -type RemoveTeamUserOperation interface { - RemoveTeamUser (*atlasv2.RemoveTeamUserApiParams) error -} - -// RemoveTeamUser encapsulates the logic to manage different cloud providers. -func (s *Store) RemoveTeamUser(params *atlasv2.RemoveTeamUserApiParams) (error) { - _, err := s.clientv2.TeamsApi.RemoveTeamUserWithParams(s.ctx, params).Execute() - return err -} - -type RenameTeamOperation interface { - RenameTeam (*atlasv2.RenameTeamApiParams) (*atlasv2.TeamResponse, error) -} - -// RenameTeam encapsulates the logic to manage different cloud providers. -func (s *Store) RenameTeam(params *atlasv2.RenameTeamApiParams) (*atlasv2.TeamResponse, error) { - result, _, err := s.clientv2.TeamsApi.RenameTeamWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateTeamRolesOperation interface { - UpdateTeamRoles (*atlasv2.UpdateTeamRolesApiParams) (*atlasv2.PaginatedTeamRole, error) -} - -// UpdateTeamRoles encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateTeamRoles(params *atlasv2.UpdateTeamRolesApiParams) (*atlasv2.PaginatedTeamRole, error) { - result, _, err := s.clientv2.TeamsApi.UpdateTeamRolesWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index ae2d3ae186..d69f0b83ab 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -19,30 +19,30 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type VersionedExampleOpts struct { cli.GlobalOpts cli.OutputOpts - store store.VersionedExampleOperation + client admin.APIClient additionalInfo bool } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *VersionedExampleOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *VersionedExampleOpts) Run() error { - params := &atlasv2.VersionedExampleApiParams{ +func (opts *VersionedExampleOpts) Run(ctx context.Context) error { + params := &admin.VersionedExampleApiParams{ AdditionalInfo: opts.additionalInfo, } - resp, _, err := opts.store.VersionedExample(params) + resp, _, err := opts.client.TestApi.VersionedExampleWithParams(ctx, params) if err != nil { return err } @@ -62,13 +62,13 @@ func VersionedExampleBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), VersionedExampleTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.additionalInfo, "additionalInfo", "", "usage description") diff --git a/internal/generated/api_test__store.go b/internal/generated/api_test__store.go deleted file mode 100644 index 5bf5542e7a..0000000000 --- a/internal/generated/api_test__store.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_test__store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas VersionedExampleOperation - -type VersionedExampleOperation interface { - VersionedExample (*atlasv2.VersionedExampleApiParams) (*atlasv2.ExampleResourceResponseView20230201, error) -} - -// VersionedExample encapsulates the logic to manage different cloud providers. -func (s *Store) VersionedExample(params *atlasv2.VersionedExampleApiParams) (*atlasv2.ExampleResourceResponseView20230201, error) { - result, _, err := s.clientv2.TestApi.VersionedExampleWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index 721a4663cb..eb07439543 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -19,14 +19,14 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateThirdPartyIntegrationOperation + client admin.APIClient integrationType string groupId string includeCount bool @@ -34,23 +34,23 @@ type CreateThirdPartyIntegrationOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateThirdPartyIntegrationOpts) Run() error { - params := &atlasv2.CreateThirdPartyIntegrationApiParams{ +func (opts *CreateThirdPartyIntegrationOpts) Run(ctx context.Context) error { + params := &admin.CreateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.CreateThirdPartyIntegration(params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params) if err != nil { return err } @@ -70,17 +70,19 @@ func CreateThirdPartyIntegrationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateThirdPartyIntegrationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + _ = cmd.MarkFlagRequired("integrationType") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -90,25 +92,25 @@ func CreateThirdPartyIntegrationBuilder() cobra.Command { type DeleteThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.DeleteThirdPartyIntegrationOperation + client admin.APIClient integrationType string groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DeleteThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DeleteThirdPartyIntegrationOpts) Run() error { - params := &atlasv2.DeleteThirdPartyIntegrationApiParams{ +func (opts *DeleteThirdPartyIntegrationOpts) Run(ctx context.Context) error { + params := &admin.DeleteThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, } - resp, _, err := opts.store.DeleteThirdPartyIntegration(params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(ctx, params) if err != nil { return err } @@ -128,42 +130,44 @@ func DeleteThirdPartyIntegrationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DeleteThirdPartyIntegrationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + _ = cmd.MarkFlagRequired("integrationType") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type GetThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.GetThirdPartyIntegrationOperation + client admin.APIClient groupId string integrationType string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *GetThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *GetThirdPartyIntegrationOpts) Run() error { - params := &atlasv2.GetThirdPartyIntegrationApiParams{ +func (opts *GetThirdPartyIntegrationOpts) Run(ctx context.Context) error { + params := &admin.GetThirdPartyIntegrationApiParams{ GroupId: opts.groupId, IntegrationType: opts.integrationType, } - resp, _, err := opts.store.GetThirdPartyIntegration(params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(ctx, params) if err != nil { return err } @@ -183,46 +187,48 @@ func GetThirdPartyIntegrationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), GetThirdPartyIntegrationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + _ = cmd.MarkFlagRequired("integrationType") return cmd } type ListThirdPartyIntegrationsOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListThirdPartyIntegrationsOperation + client admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListThirdPartyIntegrationsOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListThirdPartyIntegrationsOpts) Run() error { - params := &atlasv2.ListThirdPartyIntegrationsApiParams{ +func (opts *ListThirdPartyIntegrationsOpts) Run(ctx context.Context) error { + params := &admin.ListThirdPartyIntegrationsApiParams{ GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListThirdPartyIntegrations(params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(ctx, params) if err != nil { return err } @@ -242,16 +248,17 @@ func ListThirdPartyIntegrationsBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListThirdPartyIntegrationsTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") @@ -261,7 +268,7 @@ func ListThirdPartyIntegrationsBuilder() cobra.Command { type UpdateThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - store store.UpdateThirdPartyIntegrationOperation + client admin.APIClient integrationType string groupId string includeCount bool @@ -269,23 +276,23 @@ type UpdateThirdPartyIntegrationOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *UpdateThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *UpdateThirdPartyIntegrationOpts) Run() error { - params := &atlasv2.UpdateThirdPartyIntegrationApiParams{ +func (opts *UpdateThirdPartyIntegrationOpts) Run(ctx context.Context) error { + params := &admin.UpdateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.UpdateThirdPartyIntegration(params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params) if err != nil { return err } @@ -305,17 +312,19 @@ func UpdateThirdPartyIntegrationBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), UpdateThirdPartyIntegrationTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + _ = cmd.MarkFlagRequired("integrationType") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") diff --git a/internal/generated/api_third_party_integrations_store.go b/internal/generated/api_third_party_integrations_store.go deleted file mode 100644 index 3e99f67810..0000000000 --- a/internal/generated/api_third_party_integrations_store.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_third_party_integrations_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateThirdPartyIntegrationOperation, DeleteThirdPartyIntegrationOperation, GetThirdPartyIntegrationOperation, ListThirdPartyIntegrationsOperation, UpdateThirdPartyIntegrationOperation - -type CreateThirdPartyIntegrationOperation interface { - CreateThirdPartyIntegration (*atlasv2.CreateThirdPartyIntegrationApiParams) (*atlasv2.PaginatedIntegration, error) -} - -// CreateThirdPartyIntegration encapsulates the logic to manage different cloud providers. -func (s *Store) CreateThirdPartyIntegration(params *atlasv2.CreateThirdPartyIntegrationApiParams) (*atlasv2.PaginatedIntegration, error) { - result, _, err := s.clientv2.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(s.ctx, params).Execute() - return &result, err -} - -type DeleteThirdPartyIntegrationOperation interface { - DeleteThirdPartyIntegration (*atlasv2.DeleteThirdPartyIntegrationApiParams) (*atlasv2.map[string]interface{}, error) -} - -// DeleteThirdPartyIntegration encapsulates the logic to manage different cloud providers. -func (s *Store) DeleteThirdPartyIntegration(params *atlasv2.DeleteThirdPartyIntegrationApiParams) (*atlasv2.map[string]interface{}, error) { - result, _, err := s.clientv2.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(s.ctx, params).Execute() - return &result, err -} - -type GetThirdPartyIntegrationOperation interface { - GetThirdPartyIntegration (*atlasv2.GetThirdPartyIntegrationApiParams) (*atlasv2.Integration, error) -} - -// GetThirdPartyIntegration encapsulates the logic to manage different cloud providers. -func (s *Store) GetThirdPartyIntegration(params *atlasv2.GetThirdPartyIntegrationApiParams) (*atlasv2.Integration, error) { - result, _, err := s.clientv2.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(s.ctx, params).Execute() - return &result, err -} - -type ListThirdPartyIntegrationsOperation interface { - ListThirdPartyIntegrations (*atlasv2.ListThirdPartyIntegrationsApiParams) (*atlasv2.PaginatedIntegration, error) -} - -// ListThirdPartyIntegrations encapsulates the logic to manage different cloud providers. -func (s *Store) ListThirdPartyIntegrations(params *atlasv2.ListThirdPartyIntegrationsApiParams) (*atlasv2.PaginatedIntegration, error) { - result, _, err := s.clientv2.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(s.ctx, params).Execute() - return &result, err -} - -type UpdateThirdPartyIntegrationOperation interface { - UpdateThirdPartyIntegration (*atlasv2.UpdateThirdPartyIntegrationApiParams) (*atlasv2.PaginatedIntegration, error) -} - -// UpdateThirdPartyIntegration encapsulates the logic to manage different cloud providers. -func (s *Store) UpdateThirdPartyIntegration(params *atlasv2.UpdateThirdPartyIntegrationApiParams) (*atlasv2.PaginatedIntegration, error) { - result, _, err := s.clientv2.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 695584d984..d128117860 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -19,32 +19,32 @@ package generated import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - store "github.com/mongodb/mongodb-atlas-cli/internal/store/atlas" ) type CreateDatabaseUserCertificateOpts struct { cli.GlobalOpts cli.OutputOpts - store store.CreateDatabaseUserCertificateOperation + client admin.APIClient groupId string username string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *CreateDatabaseUserCertificateOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *CreateDatabaseUserCertificateOpts) Run() error { - params := &atlasv2.CreateDatabaseUserCertificateApiParams{ +func (opts *CreateDatabaseUserCertificateOpts) Run(ctx context.Context) error { + params := &admin.CreateDatabaseUserCertificateApiParams{ GroupId: opts.groupId, Username: opts.username, } - _, err := opts.store.CreateDatabaseUserCertificate(params) + _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params) if err != nil { return err } @@ -64,40 +64,42 @@ func CreateDatabaseUserCertificateBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), CreateDatabaseUserCertificateTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + _ = cmd.MarkFlagRequired("username") return cmd } type DisableCustomerManagedX509Opts struct { cli.GlobalOpts cli.OutputOpts - store store.DisableCustomerManagedX509Operation + client admin.APIClient groupId string } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *DisableCustomerManagedX509Opts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *DisableCustomerManagedX509Opts) Run() error { - params := &atlasv2.DisableCustomerManagedX509ApiParams{ +func (opts *DisableCustomerManagedX509Opts) Run(ctx context.Context) error { + params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.store.DisableCustomerManagedX509(params) + resp, _, err := opts.client.X509AuthenticationApi.DisableCustomerManagedX509WithParams(ctx, params) if err != nil { return err } @@ -117,23 +119,24 @@ func DisableCustomerManagedX509Builder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), DisableCustomerManagedX509Template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") return cmd } type ListDatabaseUserCertificatesOpts struct { cli.GlobalOpts cli.OutputOpts - store store.ListDatabaseUserCertificatesOperation + client admin.APIClient groupId string username string includeCount bool @@ -141,23 +144,23 @@ type ListDatabaseUserCertificatesOpts struct { pageNum int32 } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *ListDatabaseUserCertificatesOpts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *ListDatabaseUserCertificatesOpts) Run() error { - params := &atlasv2.ListDatabaseUserCertificatesApiParams{ +func (opts *ListDatabaseUserCertificatesOpts) Run(ctx context.Context) error { + params := &admin.ListDatabaseUserCertificatesApiParams{ GroupId: opts.groupId, Username: opts.username, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.store.ListDatabaseUserCertificates(params) + resp, _, err := opts.client.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(ctx, params) if err != nil { return err } @@ -177,17 +180,19 @@ func ListDatabaseUserCertificatesBuilder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), ListDatabaseUserCertificatesTemplate), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + _ = cmd.MarkFlagRequired("groupId") cmd.Flags().StringVar(&opts.username, "username", "", "usage description") + _ = cmd.MarkFlagRequired("username") cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") diff --git a/internal/generated/api_x509_authentication_store.go b/internal/generated/api_x509_authentication_store.go deleted file mode 100644 index d0ad587c62..0000000000 --- a/internal/generated/api_x509_authentication_store.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/api_x509_authentication_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas CreateDatabaseUserCertificateOperation, DisableCustomerManagedX509Operation, ListDatabaseUserCertificatesOperation - -type CreateDatabaseUserCertificateOperation interface { - CreateDatabaseUserCertificate (*atlasv2.CreateDatabaseUserCertificateApiParams) error -} - -// CreateDatabaseUserCertificate encapsulates the logic to manage different cloud providers. -func (s *Store) CreateDatabaseUserCertificate(params *atlasv2.CreateDatabaseUserCertificateApiParams) (error) { - _, err := s.clientv2.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(s.ctx, params).Execute() - return err -} - -type DisableCustomerManagedX509Operation interface { - DisableCustomerManagedX509 (*atlasv2.DisableCustomerManagedX509ApiParams) (*atlasv2.UserSecurity, error) -} - -// DisableCustomerManagedX509 encapsulates the logic to manage different cloud providers. -func (s *Store) DisableCustomerManagedX509(params *atlasv2.DisableCustomerManagedX509ApiParams) (*atlasv2.UserSecurity, error) { - result, _, err := s.clientv2.X509AuthenticationApi.DisableCustomerManagedX509WithParams(s.ctx, params).Execute() - return &result, err -} - -type ListDatabaseUserCertificatesOperation interface { - ListDatabaseUserCertificates (*atlasv2.ListDatabaseUserCertificatesApiParams) (*atlasv2.PaginatedUserCert, error) -} - -// ListDatabaseUserCertificates encapsulates the logic to manage different cloud providers. -func (s *Store) ListDatabaseUserCertificates(params *atlasv2.ListDatabaseUserCertificatesApiParams) (*atlasv2.PaginatedUserCert, error) { - result, _, err := s.clientv2.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(s.ctx, params).Execute() - return &result, err -} - diff --git a/internal/generated/generated.go b/internal/generated/generated.go new file mode 100644 index 0000000000..b717ef3f86 --- /dev/null +++ b/internal/generated/generated.go @@ -0,0 +1,122 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package generated + +import ( + "time" + "net" + "net/http" + + "github.com/mongodb-forks/digest" + "go.mongodb.org/atlas-sdk/admin" + "go.mongodb.org/atlas/auth" + "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/internal/log" +) + +const ( + cloudGovServiceURL = "https://cloud.mongodbgov.com/" + timeout = 5 * time.Second + keepAlive = 30 * time.Second + maxIdleConns = 5 + maxIdleConnsPerHost = 4 + idleConnTimeout = 30 * time.Second + expectContinueTimeout = 1 * time.Second +) + +func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { + httpTransport := &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: timeout, + KeepAlive: keepAlive, + }).DialContext, + MaxIdleConns: maxIdleConns, + MaxIdleConnsPerHost: maxIdleConnsPerHost, + Proxy: http.ProxyFromEnvironment, + IdleConnTimeout: idleConnTimeout, + ExpectContinueTimeout: expectContinueTimeout, + } + + if username == "" && password == "" && accessToken == nil { + return &http.Client{Transport: httpTransport}, nil + } + if username != "" && password != "" { + t := &digest.Transport{ + Username: username, + Password: password, + } + t.Transport = httpTransport + return t.Client() + } + tr := &Transport{ + token: accessToken, + base: httpTransport, + } + + return &http.Client{Transport: tr}, nil +} + +func NewClientWithAuth() (*admin.APIClient, error) { + profile := config.Default() + + var authToken *auth.Token + + username := profile.PublicAPIKey() + password := profile.PrivateAPIKey() + + if username == "" && password == "" { + var err error + authToken, err = profile.Token() + if err != nil { + return nil, err + } + } + + baseURL := profile.OpsManagerURL() + if baseURL == "" && profile.Service() == config.CloudGovService { + baseURL = cloudGovServiceURL + } + + client, err := httpClient(username, password, authToken) + if err != nil { + return nil, err + } + + opts := []admin.ClientModifier{ + admin.UseHTTPClient(client), + admin.UseUserAgent(config.UserAgent), + admin.UseDebug(log.IsDebugLevel())} + + if baseURL != "" { + opts = append(opts, admin.UseBaseURL(baseURL)) + } + c, err := admin.NewClient(opts...) + if err != nil { + return nil, err + } + return c, nil +} + +type Transport struct { + token *auth.Token + base http.RoundTripper +} + +func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { + tr.token.SetAuthHeader(req) + return tr.base.RoundTrip(req) +} diff --git a/tools/openapi-generator/config/.openapi-generator-ignore b/tools/openapi-generator/config/.openapi-generator-ignore index 925547ae88..dec4d922ad 100644 --- a/tools/openapi-generator/config/.openapi-generator-ignore +++ b/tools/openapi-generator/config/.openapi-generator-ignore @@ -1,4 +1,4 @@ **/* *.* !*_cmd.go -!api_*_store.go +!generated.go diff --git a/tools/openapi-generator/config/config.yaml b/tools/openapi-generator/config/config.yaml index 9bb83ae27d..6547aaf10f 100644 --- a/tools/openapi-generator/config/config.yaml +++ b/tools/openapi-generator/config/config.yaml @@ -10,6 +10,6 @@ files: cmd.mustache: templateType: API destinationFilename: _cmd.go - store.mustache: - templateType: API - destinationFilename: _store.go + generated.mustache: + destinationFilename: generated.go + templateType: SupportingFiles diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 0e51015e74..560f8a4e35 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -4,8 +4,8 @@ package {{packageName}} import ( "context" "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/admin" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/cli" - store "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/store/atlas" ) {{#operations}} @@ -13,7 +13,7 @@ import ( type {{operationId}}Opts struct { cli.GlobalOpts cli.OutputOpts - store store.{{operationId}}Operation + client admin.APIClient {{#pathParams}} {{paramName}} {{{dataType}}} {{/pathParams}} @@ -22,16 +22,16 @@ type {{operationId}}Opts struct { {{/queryParams}} } -func (opts *ListOpts) initStore(ctx context.Context) func() error { +func (opts *{{operationId}}Opts) initClient(ctx context.Context) func() error { return func() error { var err error - opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) + opts.client, err = NewClientWithAuth() return err } } -func (opts *{{operationId}}Opts) Run() error { - params := &atlasv2.{{operationId}}ApiParams{ +func (opts *{{operationId}}Opts) Run(ctx context.Context) error { + params := &admin.{{operationId}}ApiParams{ {{#pathParams}} {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}}, {{/pathParams}} @@ -39,7 +39,7 @@ func (opts *{{operationId}}Opts) Run() error { {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}}, {{/queryParams}} } - {{#returnType}}resp, {{/returnType}}_, err := opts.store.{{operationId}}(params) + {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params) if err != nil { return err } @@ -59,17 +59,18 @@ func {{operationId}}Builder() cobra.Command { Args: require.NoArgs, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - opts.ValidateProjectID, - opts.initStore(cmd.Context()), + //opts.ValidateProjectID, + opts.initClient(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), {{operationId}}Template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run() + return opts.Run(cmd.Context()) }, } {{#pathParams}} cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", "", "usage description") + _ = cmd.MarkFlagRequired("{{paramName}}") {{/pathParams}} {{#queryParams}} cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", "", "usage description") diff --git a/tools/openapi-generator/config/go-templates/generated.mustache b/tools/openapi-generator/config/go-templates/generated.mustache new file mode 100644 index 0000000000..574962ea77 --- /dev/null +++ b/tools/openapi-generator/config/go-templates/generated.mustache @@ -0,0 +1,107 @@ +{{>partial_header}} +package {{packageName}} + +import ( + "time" + "net" + "net/http" + + "github.com/mongodb-forks/digest" + "go.mongodb.org/atlas-sdk/admin" + "go.mongodb.org/atlas/auth" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/config" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/log" +) + +const ( + cloudGovServiceURL = "https://cloud.mongodbgov.com/" + timeout = 5 * time.Second + keepAlive = 30 * time.Second + maxIdleConns = 5 + maxIdleConnsPerHost = 4 + idleConnTimeout = 30 * time.Second + expectContinueTimeout = 1 * time.Second +) + +func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { + httpTransport := &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: timeout, + KeepAlive: keepAlive, + }).DialContext, + MaxIdleConns: maxIdleConns, + MaxIdleConnsPerHost: maxIdleConnsPerHost, + Proxy: http.ProxyFromEnvironment, + IdleConnTimeout: idleConnTimeout, + ExpectContinueTimeout: expectContinueTimeout, + } + + if username == "" && password == "" && accessToken == nil { + return &http.Client{Transport: httpTransport}, nil + } + if username != "" && password != "" { + t := &digest.Transport{ + Username: username, + Password: password, + } + t.Transport = httpTransport + return t.Client() + } + tr := &Transport{ + token: accessToken, + base: httpTransport, + } + + return &http.Client{Transport: tr}, nil +} + +func NewClientWithAuth() (*admin.APIClient, error) { + profile := config.Default() + + var authToken *auth.Token + + username := profile.PublicAPIKey() + password := profile.PrivateAPIKey() + + if username == "" && password == "" { + var err error + authToken, err = profile.Token() + if err != nil { + return nil, err + } + } + + baseURL := profile.OpsManagerURL() + if baseURL == "" && profile.Service() == config.CloudGovService { + baseURL = cloudGovServiceURL + } + + client, err := httpClient(username, password, authToken) + if err != nil { + return nil, err + } + + opts := []admin.ClientModifier{ + admin.UseHTTPClient(client), + admin.UseUserAgent(config.UserAgent), + admin.UseDebug(log.IsDebugLevel())} + + if baseURL != "" { + opts = append(opts, admin.UseBaseURL(baseURL)) + } + c, err := admin.NewClient(opts...) + if err != nil { + return nil, err + } + return c, nil +} + +type Transport struct { + token *auth.Token + base http.RoundTripper +} + +func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { + tr.token.SetAuthHeader(req) + return tr.base.RoundTrip(req) +} diff --git a/tools/openapi-generator/config/go-templates/store.mustache b/tools/openapi-generator/config/go-templates/store.mustache deleted file mode 100644 index 44578edd0a..0000000000 --- a/tools/openapi-generator/config/go-templates/store.mustache +++ /dev/null @@ -1,24 +0,0 @@ -{{>partial_header}} -package store - -import ( - "context" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" -) - -//go:generate mockgen -destination=../../mocks/atlas/{{classFilename}}_store_mock.go -package=atlas github.com/mongodb/mongodb-atlas-cli/internal/store/atlas {{#operations}}{{#operation}}{{operationId}}Operation{{^-last}}, {{/-last}}{{/operation}}{{/operations}} - -{{#operations}} -{{#operation}} -type {{operationId}}Operation interface { - {{operationId}} (*atlasv2.{{operationId}}ApiParams) {{#returnType}}(*atlasv2.{{{.}}}, {{/returnType}}error{{#returnType}}){{/returnType}} -} - -// {{operationId}} encapsulates the logic to manage different cloud providers. -func (s *Store) {{operationId}}(params *atlasv2.{{operationId}}ApiParams) ({{#returnType}}*atlasv2.{{{.}}}, {{/returnType}}error) { - {{#returnType}}result, {{/returnType}}_, err := s.clientv2.{{classname}}.{{operationId}}WithParams(s.ctx, params).Execute() - return {{#returnType}}&result, {{/returnType}}err -} - -{{/operation}} -{{/operations}} From 6bf81ecefcfced7397806e66bbba2a8d420f6dd8 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 31 May 2023 15:09:29 +0100 Subject: [PATCH 06/44] add changes to cmd --- internal/generated/api_access_tracking_cmd.go | 54 +- .../generated/api_alert_configurations_cmd.go | 178 +++-- internal/generated/api_alerts_cmd.go | 94 +-- internal/generated/api_atlas_search_cmd.go | 115 +-- internal/generated/api_auditing_cmd.go | 42 +- .../generated/api_aws_clusters_dns_cmd.go | 42 +- internal/generated/api_cloud_backups_cmd.go | 662 ++++++++++-------- .../api_cloud_migration_service_cmd.go | 171 +++-- .../api_cloud_provider_access_cmd.go | 109 +-- .../api_cluster_outage_simulation_cmd.go | 66 +- internal/generated/api_clusters_cmd.go | 201 +++--- .../api_custom_database_roles_cmd.go | 108 +-- internal/generated/api_data_federation_cmd.go | 316 +++++---- .../generated/api_data_lake_pipelines_cmd.go | 294 ++++---- internal/generated/api_database_users_cmd.go | 114 +-- ..._rest_using_customer_key_management_cmd.go | 42 +- internal/generated/api_events_cmd.go | 107 +-- .../api_federated_authentication_cmd.go | 329 +++++---- internal/generated/api_global_clusters_cmd.go | 112 +-- internal/generated/api_invoices_cmd.go | 89 ++- .../generated/api_ldap_configuration_cmd.go | 106 +-- internal/generated/api_legacy_backup_cmd.go | 236 ++++--- .../api_legacy_backup_restore_jobs_cmd.go | 22 +- .../generated/api_maintenance_windows__cmd.go | 105 +-- .../generated/api_mongo_db_cloud_users_cmd.go | 62 +- .../generated/api_monitoring_and_logs_cmd.go | 367 +++++----- .../generated/api_multi_cloud_clusters_cmd.go | 134 ++-- internal/generated/api_network_peering_cmd.go | 291 ++++---- internal/generated/api_online_archive_cmd.go | 141 ++-- internal/generated/api_organizations_cmd.go | 328 +++++---- .../generated/api_performance_advisor_cmd.go | 122 ++-- .../api_private_endpoint_services_cmd.go | 202 +++--- .../api_programmatic_api_keys_cmd.go | 321 +++++---- .../api_project_ip_access_list_cmd.go | 114 +-- internal/generated/api_projects_cmd.go | 435 +++++++----- internal/generated/api_rolling_index_cmd.go | 22 +- internal/generated/api_root_cmd.go | 20 +- .../generated/api_serverless_instances_cmd.go | 111 +-- .../api_serverless_private_endpoints_cmd.go | 113 +-- .../api_shared_tier_restore_jobs_cmd.go | 67 +- .../api_shared_tier_snapshots_cmd.go | 67 +- internal/generated/api_teams_cmd.go | 291 ++++---- internal/generated/api_test__cmd.go | 21 +- .../api_third_party_integrations_cmd.go | 118 ++-- .../generated/api_x509_authentication_cmd.go | 68 +- tools/openapi-generator/config/config.yaml | 2 +- .../config/go-templates/cmd.mustache | 27 +- 47 files changed, 4124 insertions(+), 3034 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index e189fd5c1d..cc493f7f90 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -26,7 +26,7 @@ import ( type ListAccessLogsByClusterNameOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string authResult bool @@ -54,7 +54,7 @@ func (opts *ListAccessLogsByClusterNameOpts) Run(ctx context.Context) error { NLogs: opts.nLogs, Start: opts.start, } - resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(ctx, params) + resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(ctx, params).Execute() if err != nil { return err } @@ -62,43 +62,42 @@ func (opts *ListAccessLogsByClusterNameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListAccessLogsByClusterNameTemplate = "<>" +func ListAccessLogsByClusterNameBuilder() *cobra.Command { + const template = "<>" -func ListAccessLogsByClusterNameBuilder() cobra.Command { opts := ListAccessLogsByClusterNameOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Database Access History for One Cluster using Its Cluster Name", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAccessLogsByClusterNameTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.authResult, "authResult", "", "usage description") - cmd.Flags().StringVar(&opts.end, "end", "", "usage description") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") - cmd.Flags().StringVar(&opts.nLogs, "nLogs", "", "usage description") - cmd.Flags().StringVar(&opts.start, "start", "", "usage description") return cmd } type ListAccessLogsByHostnameOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string hostname string authResult bool @@ -126,7 +125,7 @@ func (opts *ListAccessLogsByHostnameOpts) Run(ctx context.Context) error { NLogs: opts.nLogs, Start: opts.start, } - resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByHostnameWithParams(ctx, params) + resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByHostnameWithParams(ctx, params).Execute() if err != nil { return err } @@ -134,36 +133,35 @@ func (opts *ListAccessLogsByHostnameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListAccessLogsByHostnameTemplate = "<>" +func ListAccessLogsByHostnameBuilder() *cobra.Command { + const template = "<>" -func ListAccessLogsByHostnameBuilder() cobra.Command { opts := ListAccessLogsByHostnameOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Database Access History for One Cluster using Its Hostname", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAccessLogsByHostnameTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.hostname, "hostname", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") + cmd.Flags().StringVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.hostname, "hostname", "", "usage description") _ = cmd.MarkFlagRequired("hostname") - cmd.Flags().StringVar(&opts.authResult, "authResult", "", "usage description") - cmd.Flags().StringVar(&opts.end, "end", "", "usage description") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") - cmd.Flags().StringVar(&opts.nLogs, "nLogs", "", "usage description") - cmd.Flags().StringVar(&opts.start, "start", "", "usage description") return cmd } diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 297e2b00ec..80be8e835a 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -26,7 +26,7 @@ import ( type CreateAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *CreateAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params) + resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreateAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateAlertConfigurationTemplate = "<>" +func CreateAlertConfigurationBuilder() *cobra.Command { + const template = "<>" -func CreateAlertConfigurationBuilder() cobra.Command { opts := CreateAlertConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Alert Configuration in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateAlertConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func CreateAlertConfigurationBuilder() cobra.Command { type DeleteAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string alertConfigId string } @@ -97,7 +102,7 @@ func (opts *DeleteAlertConfigurationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params) + _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -105,30 +110,34 @@ func (opts *DeleteAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const DeleteAlertConfigurationTemplate = "<>" +func DeleteAlertConfigurationBuilder() *cobra.Command { + const template = "<>" -func DeleteAlertConfigurationBuilder() cobra.Command { opts := DeleteAlertConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Alert Configuration from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteAlertConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") _ = cmd.MarkFlagRequired("alertConfigId") return cmd @@ -136,7 +145,7 @@ func DeleteAlertConfigurationBuilder() cobra.Command { type GetAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string alertConfigId string } @@ -154,7 +163,7 @@ func (opts *GetAlertConfigurationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - resp, _, err := opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params) + resp, _, err := opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -162,30 +171,34 @@ func (opts *GetAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetAlertConfigurationTemplate = "<>" +func GetAlertConfigurationBuilder() *cobra.Command { + const template = "<>" -func GetAlertConfigurationBuilder() cobra.Command { opts := GetAlertConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Alert Configuration from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetAlertConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") _ = cmd.MarkFlagRequired("alertConfigId") return cmd @@ -193,7 +206,7 @@ func GetAlertConfigurationBuilder() cobra.Command { type ListAlertConfigurationMatchersFieldNamesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient } func (opts *ListAlertConfigurationMatchersFieldNamesOpts) initClient(ctx context.Context) func() error { @@ -207,7 +220,7 @@ func (opts *ListAlertConfigurationMatchersFieldNamesOpts) initClient(ctx context func (opts *ListAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Context) error { params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{ } - resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params) + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params).Execute() if err != nil { return err } @@ -215,21 +228,24 @@ func (opts *ListAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Contex return opts.Print(resp) } -const ListAlertConfigurationMatchersFieldNamesTemplate = "<>" +func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { + const template = "<>" -func ListAlertConfigurationMatchersFieldNamesBuilder() cobra.Command { opts := ListAlertConfigurationMatchersFieldNamesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Get All Alert Configuration Matchers Field Names", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationMatchersFieldNamesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { @@ -237,12 +253,15 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() cobra.Command { }, } + + + return cmd } type ListAlertConfigurationsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -264,7 +283,7 @@ func (opts *ListAlertConfigurationsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params) + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params).Execute() if err != nil { return err } @@ -272,39 +291,41 @@ func (opts *ListAlertConfigurationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListAlertConfigurationsTemplate = "<>" +func ListAlertConfigurationsBuilder() *cobra.Command { + const template = "<>" -func ListAlertConfigurationsBuilder() cobra.Command { opts := ListAlertConfigurationsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Alert Configurations for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListAlertConfigurationsByAlertIdOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string alertId string includeCount bool @@ -328,7 +349,7 @@ func (opts *ListAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params) + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params).Execute() if err != nil { return err } @@ -336,41 +357,42 @@ func (opts *ListAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error return opts.Print(resp) } -const ListAlertConfigurationsByAlertIdTemplate = "<>" +func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { + const template = "<>" -func ListAlertConfigurationsByAlertIdBuilder() cobra.Command { opts := ListAlertConfigurationsByAlertIdOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Alert Configurations Set for One Alert", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAlertConfigurationsByAlertIdTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") _ = cmd.MarkFlagRequired("alertId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ToggleAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string alertConfigId string } @@ -388,7 +410,7 @@ func (opts *ToggleAlertConfigurationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params) + resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -396,30 +418,34 @@ func (opts *ToggleAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ToggleAlertConfigurationTemplate = "<>" +func ToggleAlertConfigurationBuilder() *cobra.Command { + const template = "<>" -func ToggleAlertConfigurationBuilder() cobra.Command { opts := ToggleAlertConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Toggle One State of One Alert Configuration in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ToggleAlertConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") _ = cmd.MarkFlagRequired("alertConfigId") return cmd @@ -427,7 +453,7 @@ func ToggleAlertConfigurationBuilder() cobra.Command { type UpdateAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string alertConfigId string } @@ -445,7 +471,7 @@ func (opts *UpdateAlertConfigurationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params) + resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -453,30 +479,34 @@ func (opts *UpdateAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateAlertConfigurationTemplate = "<>" +func UpdateAlertConfigurationBuilder() *cobra.Command { + const template = "<>" -func UpdateAlertConfigurationBuilder() cobra.Command { opts := UpdateAlertConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Alert Configuration for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateAlertConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") _ = cmd.MarkFlagRequired("alertConfigId") return cmd diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 9f5b532ceb..7c53382b01 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -26,7 +26,7 @@ import ( type AcknowledgeAlertOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string alertId string } @@ -44,7 +44,7 @@ func (opts *AcknowledgeAlertOpts) Run(ctx context.Context) error { GroupId: opts.groupId, AlertId: opts.alertId, } - resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params) + resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *AcknowledgeAlertOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const AcknowledgeAlertTemplate = "<>" +func AcknowledgeAlertBuilder() *cobra.Command { + const template = "<>" -func AcknowledgeAlertBuilder() cobra.Command { opts := AcknowledgeAlertOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Acknowledge One Alert from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), AcknowledgeAlertTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") _ = cmd.MarkFlagRequired("alertId") return cmd @@ -83,7 +87,7 @@ func AcknowledgeAlertBuilder() cobra.Command { type GetAlertOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string alertId string } @@ -101,7 +105,7 @@ func (opts *GetAlertOpts) Run(ctx context.Context) error { GroupId: opts.groupId, AlertId: opts.alertId, } - resp, _, err := opts.client.AlertsApi.GetAlertWithParams(ctx, params) + resp, _, err := opts.client.AlertsApi.GetAlertWithParams(ctx, params).Execute() if err != nil { return err } @@ -109,30 +113,34 @@ func (opts *GetAlertOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetAlertTemplate = "<>" +func GetAlertBuilder() *cobra.Command { + const template = "<>" -func GetAlertBuilder() cobra.Command { opts := GetAlertOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Alert from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetAlertTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.alertId, "alertId", "", "usage description") _ = cmd.MarkFlagRequired("alertId") return cmd @@ -140,7 +148,7 @@ func GetAlertBuilder() cobra.Command { type ListAlertsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -164,7 +172,7 @@ func (opts *ListAlertsOpts) Run(ctx context.Context) error { PageNum: opts.pageNum, Status: opts.status, } - resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params) + resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params).Execute() if err != nil { return err } @@ -172,40 +180,41 @@ func (opts *ListAlertsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListAlertsTemplate = "<>" +func ListAlertsBuilder() *cobra.Command { + const template = "<>" -func ListAlertsBuilder() cobra.Command { opts := ListAlertsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Alerts from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAlertsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.status, "status", , "Status of the alerts to return. Omit to return all alerts in all statuses.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.status, "status", "", "usage description") return cmd } type ListAlertsByAlertConfigurationIdOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string alertConfigId string includeCount bool @@ -229,7 +238,7 @@ func (opts *ListAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params) + resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params).Execute() if err != nil { return err } @@ -237,34 +246,35 @@ func (opts *ListAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error return opts.Print(resp) } -const ListAlertsByAlertConfigurationIdTemplate = "<>" +func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { + const template = "<>" -func ListAlertsByAlertConfigurationIdBuilder() cobra.Command { opts := ListAlertsByAlertConfigurationIdOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Open Alerts for Alert Configuration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAlertsByAlertConfigurationIdTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "usage description") _ = cmd.MarkFlagRequired("alertConfigId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index 6276530510..24bd94ebf3 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -26,7 +26,7 @@ import ( type CreateAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -44,7 +44,7 @@ func (opts *CreateAtlasSearchIndexOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params) + resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateAtlasSearchIndexOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateAtlasSearchIndexTemplate = "<>" +func CreateAtlasSearchIndexBuilder() *cobra.Command { + const template = "<>" -func CreateAtlasSearchIndexBuilder() cobra.Command { opts := CreateAtlasSearchIndexOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Atlas Search Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateAtlasSearchIndexTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection on which to create an Atlas Search index.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -83,7 +87,7 @@ func CreateAtlasSearchIndexBuilder() cobra.Command { type DeleteAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string indexId string @@ -103,7 +107,7 @@ func (opts *DeleteAtlasSearchIndexOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, IndexId: opts.indexId, } - resp, _, err := opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params) + resp, _, err := opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } @@ -111,32 +115,35 @@ func (opts *DeleteAtlasSearchIndexOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteAtlasSearchIndexTemplate = "<>" +func DeleteAtlasSearchIndexBuilder() *cobra.Command { + const template = "<>" -func DeleteAtlasSearchIndexBuilder() cobra.Command { opts := DeleteAtlasSearchIndexOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Atlas Search Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteAtlasSearchIndexTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the database and collection with one or more Application Search indexes.") cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") _ = cmd.MarkFlagRequired("indexId") return cmd @@ -144,7 +151,7 @@ func DeleteAtlasSearchIndexBuilder() cobra.Command { type GetAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string indexId string @@ -164,7 +171,7 @@ func (opts *GetAtlasSearchIndexOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, IndexId: opts.indexId, } - resp, _, err := opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params) + resp, _, err := opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } @@ -172,32 +179,35 @@ func (opts *GetAtlasSearchIndexOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetAtlasSearchIndexTemplate = "<>" +func GetAtlasSearchIndexBuilder() *cobra.Command { + const template = "<>" -func GetAtlasSearchIndexBuilder() cobra.Command { opts := GetAtlasSearchIndexOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Atlas Search Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetAtlasSearchIndexTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection with one or more Atlas Search indexes.") cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") _ = cmd.MarkFlagRequired("indexId") return cmd @@ -205,7 +215,7 @@ func GetAtlasSearchIndexBuilder() cobra.Command { type ListAtlasSearchIndexesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string collectionName string @@ -227,7 +237,7 @@ func (opts *ListAtlasSearchIndexesOpts) Run(ctx context.Context) error { CollectionName: opts.collectionName, DatabaseName: opts.databaseName, } - resp, _, err := opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params) + resp, _, err := opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params).Execute() if err != nil { return err } @@ -235,34 +245,36 @@ func (opts *ListAtlasSearchIndexesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListAtlasSearchIndexesTemplate = "<>" +func ListAtlasSearchIndexesBuilder() *cobra.Command { + const template = "<>" -func ListAtlasSearchIndexesBuilder() cobra.Command { opts := ListAtlasSearchIndexesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Atlas Search Indexes for One Collection", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAtlasSearchIndexesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection with one or more Atlas Search indexes.") cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Name of the collection that contains one or more Atlas Search indexes.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") _ = cmd.MarkFlagRequired("collectionName") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") _ = cmd.MarkFlagRequired("databaseName") return cmd @@ -270,7 +282,7 @@ func ListAtlasSearchIndexesBuilder() cobra.Command { type UpdateAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string indexId string @@ -290,7 +302,7 @@ func (opts *UpdateAtlasSearchIndexOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, IndexId: opts.indexId, } - resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params) + resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } @@ -298,32 +310,35 @@ func (opts *UpdateAtlasSearchIndexOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateAtlasSearchIndexTemplate = "<>" +func UpdateAtlasSearchIndexBuilder() *cobra.Command { + const template = "<>" -func UpdateAtlasSearchIndexBuilder() cobra.Command { opts := UpdateAtlasSearchIndexOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Atlas Search Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateAtlasSearchIndexTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection whose Atlas Search index to update.") cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.indexId, "indexId", "", "usage description") _ = cmd.MarkFlagRequired("indexId") return cmd diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index 59fd9ded2e..6c2b1afd81 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -26,7 +26,7 @@ import ( type GetAuditingConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *GetAuditingConfigurationOpts) Run(ctx context.Context) error { params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.AuditingApi.GetAuditingConfigurationWithParams(ctx, params) + resp, _, err := opts.client.AuditingApi.GetAuditingConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *GetAuditingConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetAuditingConfigurationTemplate = "<>" +func GetAuditingConfigurationBuilder() *cobra.Command { + const template = "<>" -func GetAuditingConfigurationBuilder() cobra.Command { opts := GetAuditingConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return the Auditing Configuration for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetAuditingConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func GetAuditingConfigurationBuilder() cobra.Command { type UpdateAuditingConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -95,7 +100,7 @@ func (opts *UpdateAuditingConfigurationOpts) Run(ctx context.Context) error { params := &admin.UpdateAuditingConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params) + resp, _, err := opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -103,28 +108,33 @@ func (opts *UpdateAuditingConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateAuditingConfigurationTemplate = "<>" +func UpdateAuditingConfigurationBuilder() *cobra.Command { + const template = "<>" -func UpdateAuditingConfigurationBuilder() cobra.Command { opts := UpdateAuditingConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Auditing Configuration for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateAuditingConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 3b32092f36..67cdfb3514 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -26,7 +26,7 @@ import ( type GetAWSCustomDNSOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *GetAWSCustomDNSOpts) Run(ctx context.Context) error { params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.AWSClustersDNSApi.GetAWSCustomDNSWithParams(ctx, params) + resp, _, err := opts.client.AWSClustersDNSApi.GetAWSCustomDNSWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *GetAWSCustomDNSOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetAWSCustomDNSTemplate = "<>" +func GetAWSCustomDNSBuilder() *cobra.Command { + const template = "<>" -func GetAWSCustomDNSBuilder() cobra.Command { opts := GetAWSCustomDNSOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetAWSCustomDNSTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func GetAWSCustomDNSBuilder() cobra.Command { type ToggleAWSCustomDNSOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -95,7 +100,7 @@ func (opts *ToggleAWSCustomDNSOpts) Run(ctx context.Context) error { params := &admin.ToggleAWSCustomDNSApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params) + resp, _, err := opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params).Execute() if err != nil { return err } @@ -103,28 +108,33 @@ func (opts *ToggleAWSCustomDNSOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ToggleAWSCustomDNSTemplate = "<>" +func ToggleAWSCustomDNSBuilder() *cobra.Command { + const template = "<>" -func ToggleAWSCustomDNSBuilder() cobra.Command { opts := ToggleAWSCustomDNSOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ToggleAWSCustomDNSTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index af1ffc68b0..b5b8cb0d23 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -26,7 +26,7 @@ import ( type CancelBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string restoreJobId string @@ -46,7 +46,7 @@ func (opts *CancelBackupRestoreJobOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -54,32 +54,35 @@ func (opts *CancelBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CancelBackupRestoreJobTemplate = "<>" +func CancelBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func CancelBackupRestoreJobBuilder() cobra.Command { opts := CancelBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Cancel One Restore Job of One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CancelBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to remove.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") _ = cmd.MarkFlagRequired("restoreJobId") return cmd @@ -87,7 +90,7 @@ func CancelBackupRestoreJobBuilder() cobra.Command { type CreateBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -105,7 +108,7 @@ func (opts *CreateBackupExportJobOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -113,30 +116,34 @@ func (opts *CreateBackupExportJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateBackupExportJobTemplate = "<>" +func CreateBackupExportJobBuilder() *cobra.Command { + const template = "<>" -func CreateBackupExportJobBuilder() cobra.Command { opts := CreateBackupExportJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Cloud Backup Snapshot Export Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateBackupExportJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -144,7 +151,7 @@ func CreateBackupExportJobBuilder() cobra.Command { type CreateBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -162,7 +169,7 @@ func (opts *CreateBackupRestoreJobOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -170,30 +177,34 @@ func (opts *CreateBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateBackupRestoreJobTemplate = "<>" +func CreateBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func CreateBackupRestoreJobBuilder() cobra.Command { opts := CreateBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Restore One Snapshot of One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -201,7 +212,7 @@ func CreateBackupRestoreJobBuilder() cobra.Command { type CreateExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -217,7 +228,7 @@ func (opts *CreateExportBucketOpts) Run(ctx context.Context) error { params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params).Execute() if err != nil { return err } @@ -225,28 +236,33 @@ func (opts *CreateExportBucketOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateExportBucketTemplate = "<>" +func CreateExportBucketBuilder() *cobra.Command { + const template = "<>" -func CreateExportBucketBuilder() cobra.Command { opts := CreateExportBucketOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateExportBucketTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -254,7 +270,7 @@ func CreateExportBucketBuilder() cobra.Command { type CreateServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -272,7 +288,7 @@ func (opts *CreateServerlessBackupRestoreJobOpts) Run(ctx context.Context) error GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -280,30 +296,34 @@ func (opts *CreateServerlessBackupRestoreJobOpts) Run(ctx context.Context) error return opts.Print(resp) } -const CreateServerlessBackupRestoreJobTemplate = "<>" +func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func CreateServerlessBackupRestoreJobBuilder() cobra.Command { opts := CreateServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Restore One Snapshot of One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateServerlessBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance whose snapshot you want to restore.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -311,7 +331,7 @@ func CreateServerlessBackupRestoreJobBuilder() cobra.Command { type DeleteAllBackupSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -329,7 +349,7 @@ func (opts *DeleteAllBackupSchedulesOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params).Execute() if err != nil { return err } @@ -337,30 +357,34 @@ func (opts *DeleteAllBackupSchedulesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteAllBackupSchedulesTemplate = "<>" +func DeleteAllBackupSchedulesBuilder() *cobra.Command { + const template = "<>" -func DeleteAllBackupSchedulesBuilder() cobra.Command { opts := DeleteAllBackupSchedulesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove All Cloud Backup Schedules", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteAllBackupSchedulesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -368,7 +392,7 @@ func DeleteAllBackupSchedulesBuilder() cobra.Command { type DeleteExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string exportBucketId string } @@ -386,7 +410,7 @@ func (opts *DeleteExportBucketOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } - resp, _, err := opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params).Execute() if err != nil { return err } @@ -394,30 +418,34 @@ func (opts *DeleteExportBucketOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteExportBucketTemplate = "<>" +func DeleteExportBucketBuilder() *cobra.Command { + const template = "<>" -func DeleteExportBucketBuilder() cobra.Command { opts := DeleteExportBucketOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteExportBucketTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "usage description") _ = cmd.MarkFlagRequired("exportBucketId") return cmd @@ -425,7 +453,7 @@ func DeleteExportBucketBuilder() cobra.Command { type DeleteReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -445,7 +473,7 @@ func (opts *DeleteReplicaSetBackupOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { return err } @@ -453,32 +481,35 @@ func (opts *DeleteReplicaSetBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteReplicaSetBackupTemplate = "<>" +func DeleteReplicaSetBackupBuilder() *cobra.Command { + const template = "<>" -func DeleteReplicaSetBackupBuilder() cobra.Command { opts := DeleteReplicaSetBackupOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Replica Set Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteReplicaSetBackupTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -486,7 +517,7 @@ func DeleteReplicaSetBackupBuilder() cobra.Command { type DeleteShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -506,7 +537,7 @@ func (opts *DeleteShardedClusterBackupOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } @@ -514,32 +545,35 @@ func (opts *DeleteShardedClusterBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteShardedClusterBackupTemplate = "<>" +func DeleteShardedClusterBackupBuilder() *cobra.Command { + const template = "<>" -func DeleteShardedClusterBackupBuilder() cobra.Command { opts := DeleteShardedClusterBackupOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Sharded Cluster Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteShardedClusterBackupTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -547,7 +581,7 @@ func DeleteShardedClusterBackupBuilder() cobra.Command { type GetBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string exportId string @@ -567,7 +601,7 @@ func (opts *GetBackupExportJobOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, ExportId: opts.exportId, } - resp, _, err := opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -575,32 +609,35 @@ func (opts *GetBackupExportJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetBackupExportJobTemplate = "<>" +func GetBackupExportJobBuilder() *cobra.Command { + const template = "<>" -func GetBackupExportJobBuilder() cobra.Command { opts := GetBackupExportJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Cloud Backup Snapshot Export Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetBackupExportJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.exportId, "exportId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.exportId, "exportId", "", "usage description") _ = cmd.MarkFlagRequired("exportId") return cmd @@ -608,7 +645,7 @@ func GetBackupExportJobBuilder() cobra.Command { type GetBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string restoreJobId string @@ -628,7 +665,7 @@ func (opts *GetBackupRestoreJobOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -636,32 +673,35 @@ func (opts *GetBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetBackupRestoreJobTemplate = "<>" +func GetBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func GetBackupRestoreJobBuilder() cobra.Command { opts := GetBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Restore Job of One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") _ = cmd.MarkFlagRequired("restoreJobId") return cmd @@ -669,7 +709,7 @@ func GetBackupRestoreJobBuilder() cobra.Command { type GetBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -687,7 +727,7 @@ func (opts *GetBackupScheduleOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params).Execute() if err != nil { return err } @@ -695,30 +735,34 @@ func (opts *GetBackupScheduleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetBackupScheduleTemplate = "<>" +func GetBackupScheduleBuilder() *cobra.Command { + const template = "<>" -func GetBackupScheduleBuilder() cobra.Command { opts := GetBackupScheduleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Cloud Backup Schedule", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetBackupScheduleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -726,7 +770,7 @@ func GetBackupScheduleBuilder() cobra.Command { type GetDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -742,7 +786,7 @@ func (opts *GetDataProtectionSettingsOpts) Run(ctx context.Context) error { params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudBackupsApi.GetDataProtectionSettingsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetDataProtectionSettingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -750,28 +794,33 @@ func (opts *GetDataProtectionSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetDataProtectionSettingsTemplate = "<>" +func GetDataProtectionSettingsBuilder() *cobra.Command { + const template = "<>" -func GetDataProtectionSettingsBuilder() cobra.Command { opts := GetDataProtectionSettingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return the Backup Compliance Policy settings", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetDataProtectionSettingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -779,7 +828,7 @@ func GetDataProtectionSettingsBuilder() cobra.Command { type GetExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string exportBucketId string } @@ -797,7 +846,7 @@ func (opts *GetExportBucketOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } - resp, _, err := opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params).Execute() if err != nil { return err } @@ -805,30 +854,34 @@ func (opts *GetExportBucketOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetExportBucketTemplate = "<>" +func GetExportBucketBuilder() *cobra.Command { + const template = "<>" -func GetExportBucketBuilder() cobra.Command { opts := GetExportBucketOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetExportBucketTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "usage description") _ = cmd.MarkFlagRequired("exportBucketId") return cmd @@ -836,7 +889,7 @@ func GetExportBucketBuilder() cobra.Command { type GetReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -856,7 +909,7 @@ func (opts *GetReplicaSetBackupOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { return err } @@ -864,32 +917,35 @@ func (opts *GetReplicaSetBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetReplicaSetBackupTemplate = "<>" +func GetReplicaSetBackupBuilder() *cobra.Command { + const template = "<>" -func GetReplicaSetBackupBuilder() cobra.Command { opts := GetReplicaSetBackupOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Replica Set Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetReplicaSetBackupTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -897,7 +953,7 @@ func GetReplicaSetBackupBuilder() cobra.Command { type GetServerlessBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -917,7 +973,7 @@ func (opts *GetServerlessBackupOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params).Execute() if err != nil { return err } @@ -925,32 +981,35 @@ func (opts *GetServerlessBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetServerlessBackupTemplate = "<>" +func GetServerlessBackupBuilder() *cobra.Command { + const template = "<>" -func GetServerlessBackupBuilder() cobra.Command { opts := GetServerlessBackupOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Snapshot of One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetServerlessBackupTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -958,7 +1017,7 @@ func GetServerlessBackupBuilder() cobra.Command { type GetServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string restoreJobId string @@ -978,7 +1037,7 @@ func (opts *GetServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -986,32 +1045,35 @@ func (opts *GetServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetServerlessBackupRestoreJobTemplate = "<>" +func GetServerlessBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func GetServerlessBackupRestoreJobBuilder() cobra.Command { opts := GetServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Restore Job for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetServerlessBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "usage description") _ = cmd.MarkFlagRequired("restoreJobId") return cmd @@ -1019,7 +1081,7 @@ func GetServerlessBackupRestoreJobBuilder() cobra.Command { type GetShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -1039,7 +1101,7 @@ func (opts *GetShardedClusterBackupOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } @@ -1047,32 +1109,35 @@ func (opts *GetShardedClusterBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetShardedClusterBackupTemplate = "<>" +func GetShardedClusterBackupBuilder() *cobra.Command { + const template = "<>" -func GetShardedClusterBackupBuilder() cobra.Command { opts := GetShardedClusterBackupOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Sharded Cluster Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetShardedClusterBackupTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -1080,7 +1145,7 @@ func GetShardedClusterBackupBuilder() cobra.Command { type ListBackupExportJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -1104,7 +1169,7 @@ func (opts *ListBackupExportJobsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1112,41 +1177,42 @@ func (opts *ListBackupExportJobsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListBackupExportJobsTemplate = "<>" +func ListBackupExportJobsBuilder() *cobra.Command { + const template = "<>" -func ListBackupExportJobsBuilder() cobra.Command { opts := ListBackupExportJobsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Cloud Backup Snapshot Export Jobs", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListBackupExportJobsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -1170,7 +1236,7 @@ func (opts *ListBackupRestoreJobsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1178,41 +1244,42 @@ func (opts *ListBackupRestoreJobsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListBackupRestoreJobsTemplate = "<>" +func ListBackupRestoreJobsBuilder() *cobra.Command { + const template = "<>" -func ListBackupRestoreJobsBuilder() cobra.Command { opts := ListBackupRestoreJobsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Restore Jobs for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListBackupRestoreJobsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListExportBucketsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -1234,7 +1301,7 @@ func (opts *ListExportBucketsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1242,39 +1309,41 @@ func (opts *ListExportBucketsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListExportBucketsTemplate = "<>" +func ListExportBucketsBuilder() *cobra.Command { + const template = "<>" -func ListExportBucketsBuilder() cobra.Command { opts := ListExportBucketsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListExportBucketsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListReplicaSetBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -1298,7 +1367,7 @@ func (opts *ListReplicaSetBackupsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1306,41 +1375,42 @@ func (opts *ListReplicaSetBackupsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListReplicaSetBackupsTemplate = "<>" +func ListReplicaSetBackupsBuilder() *cobra.Command { + const template = "<>" -func ListReplicaSetBackupsBuilder() cobra.Command { opts := ListReplicaSetBackupsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Replica Set Cloud Backups", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListReplicaSetBackupsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListServerlessBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -1364,7 +1434,7 @@ func (opts *ListServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1372,41 +1442,42 @@ func (opts *ListServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error return opts.Print(resp) } -const ListServerlessBackupRestoreJobsTemplate = "<>" +func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { + const template = "<>" -func ListServerlessBackupRestoreJobsBuilder() cobra.Command { opts := ListServerlessBackupRestoreJobsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Restore Jobs for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListServerlessBackupRestoreJobsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListServerlessBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -1430,7 +1501,7 @@ func (opts *ListServerlessBackupsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1438,41 +1509,42 @@ func (opts *ListServerlessBackupsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListServerlessBackupsTemplate = "<>" +func ListServerlessBackupsBuilder() *cobra.Command { + const template = "<>" -func ListServerlessBackupsBuilder() cobra.Command { opts := ListServerlessBackupsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Snapshots of One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListServerlessBackupsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListShardedClusterBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -1490,7 +1562,7 @@ func (opts *ListShardedClusterBackupsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1498,30 +1570,34 @@ func (opts *ListShardedClusterBackupsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListShardedClusterBackupsTemplate = "<>" +func ListShardedClusterBackupsBuilder() *cobra.Command { + const template = "<>" -func ListShardedClusterBackupsBuilder() cobra.Command { opts := ListShardedClusterBackupsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Sharded Cluster Cloud Backups", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListShardedClusterBackupsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -1529,7 +1605,7 @@ func ListShardedClusterBackupsBuilder() cobra.Command { type TakeSnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -1547,7 +1623,7 @@ func (opts *TakeSnapshotOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params).Execute() if err != nil { return err } @@ -1555,30 +1631,34 @@ func (opts *TakeSnapshotOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const TakeSnapshotTemplate = "<>" +func TakeSnapshotBuilder() *cobra.Command { + const template = "<>" -func TakeSnapshotBuilder() cobra.Command { opts := TakeSnapshotOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Take One On-Demand Snapshot", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), TakeSnapshotTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -1586,7 +1666,7 @@ func TakeSnapshotBuilder() cobra.Command { type UpdateBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -1604,7 +1684,7 @@ func (opts *UpdateBackupScheduleOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params).Execute() if err != nil { return err } @@ -1612,30 +1692,34 @@ func (opts *UpdateBackupScheduleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateBackupScheduleTemplate = "<>" +func UpdateBackupScheduleBuilder() *cobra.Command { + const template = "<>" -func UpdateBackupScheduleBuilder() cobra.Command { opts := UpdateBackupScheduleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Cloud Backup Schedule for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateBackupScheduleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -1643,7 +1727,7 @@ func UpdateBackupScheduleBuilder() cobra.Command { type UpdateDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -1659,7 +1743,7 @@ func (opts *UpdateDataProtectionSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1667,28 +1751,33 @@ func (opts *UpdateDataProtectionSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateDataProtectionSettingsTemplate = "<>" +func UpdateDataProtectionSettingsBuilder() *cobra.Command { + const template = "<>" -func UpdateDataProtectionSettingsBuilder() cobra.Command { opts := UpdateDataProtectionSettingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update or enable the Backup Compliance Policy settings", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateDataProtectionSettingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1696,7 +1785,7 @@ func UpdateDataProtectionSettingsBuilder() cobra.Command { type UpdateSnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -1716,7 +1805,7 @@ func (opts *UpdateSnapshotRetentionOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params) + resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() if err != nil { return err } @@ -1724,32 +1813,35 @@ func (opts *UpdateSnapshotRetentionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateSnapshotRetentionTemplate = "<>" +func UpdateSnapshotRetentionBuilder() *cobra.Command { + const template = "<>" -func UpdateSnapshotRetentionBuilder() cobra.Command { opts := UpdateSnapshotRetentionOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Change Expiration Date for One Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateSnapshotRetentionTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index 7240dd1a4b..f8876c82d5 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -26,7 +26,7 @@ import ( type CreateLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -42,7 +42,7 @@ func (opts *CreateLinkTokenOpts) Run(ctx context.Context) error { params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params) + resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreateLinkTokenOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateLinkTokenTemplate = "<>" +func CreateLinkTokenBuilder() *cobra.Command { + const template = "<>" -func CreateLinkTokenBuilder() cobra.Command { opts := CreateLinkTokenOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Link-Token", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateLinkTokenTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -79,7 +84,7 @@ func CreateLinkTokenBuilder() cobra.Command { type CreatePushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -95,7 +100,7 @@ func (opts *CreatePushMigrationOpts) Run(ctx context.Context) error { params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params) + resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params).Execute() if err != nil { return err } @@ -103,28 +108,33 @@ func (opts *CreatePushMigrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreatePushMigrationTemplate = "<>" +func CreatePushMigrationBuilder() *cobra.Command { + const template = "<>" -func CreatePushMigrationBuilder() cobra.Command { opts := CreatePushMigrationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Migrate One Local Managed Cluster to MongoDB Atlas", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreatePushMigrationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -132,7 +142,7 @@ func CreatePushMigrationBuilder() cobra.Command { type CutoverMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string liveMigrationId string } @@ -150,7 +160,7 @@ func (opts *CutoverMigrationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } - _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params) + _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params).Execute() if err != nil { return err } @@ -158,30 +168,34 @@ func (opts *CutoverMigrationOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const CutoverMigrationTemplate = "<>" +func CutoverMigrationBuilder() *cobra.Command { + const template = "<>" -func CutoverMigrationBuilder() cobra.Command { opts := CutoverMigrationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Cut Over the Migrated Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CutoverMigrationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", , "Unique 24-hexadecimal digit string that identifies the migration.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "usage description") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd @@ -189,7 +203,7 @@ func CutoverMigrationBuilder() cobra.Command { type DeleteLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -205,7 +219,7 @@ func (opts *DeleteLinkTokenOpts) Run(ctx context.Context) error { params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.CloudMigrationServiceApi.DeleteLinkTokenWithParams(ctx, params) + resp, _, err := opts.client.CloudMigrationServiceApi.DeleteLinkTokenWithParams(ctx, params).Execute() if err != nil { return err } @@ -213,28 +227,33 @@ func (opts *DeleteLinkTokenOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteLinkTokenTemplate = "<>" +func DeleteLinkTokenBuilder() *cobra.Command { + const template = "<>" -func DeleteLinkTokenBuilder() cobra.Command { opts := DeleteLinkTokenOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Link-Token", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteLinkTokenTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -242,7 +261,7 @@ func DeleteLinkTokenBuilder() cobra.Command { type GetPushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string liveMigrationId string } @@ -260,7 +279,7 @@ func (opts *GetPushMigrationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } - resp, _, err := opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params) + resp, _, err := opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params).Execute() if err != nil { return err } @@ -268,30 +287,34 @@ func (opts *GetPushMigrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetPushMigrationTemplate = "<>" +func GetPushMigrationBuilder() *cobra.Command { + const template = "<>" -func GetPushMigrationBuilder() cobra.Command { opts := GetPushMigrationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Migration Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetPushMigrationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", , "Unique 24-hexadecimal digit string that identifies the migration.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "usage description") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd @@ -299,7 +322,7 @@ func GetPushMigrationBuilder() cobra.Command { type GetValidationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string validationId string } @@ -317,7 +340,7 @@ func (opts *GetValidationStatusOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ValidationId: opts.validationId, } - resp, _, err := opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params) + resp, _, err := opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params).Execute() if err != nil { return err } @@ -325,30 +348,34 @@ func (opts *GetValidationStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetValidationStatusTemplate = "<>" +func GetValidationStatusBuilder() *cobra.Command { + const template = "<>" -func GetValidationStatusBuilder() cobra.Command { opts := GetValidationStatusOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Migration Validation Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetValidationStatusTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.validationId, "validationId", , "Unique 24-hexadecimal digit string that identifies the validation job.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.validationId, "validationId", "", "usage description") _ = cmd.MarkFlagRequired("validationId") return cmd @@ -356,7 +383,7 @@ func GetValidationStatusBuilder() cobra.Command { type ListSourceProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -372,7 +399,7 @@ func (opts *ListSourceProjectsOpts) Run(ctx context.Context) error { params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.CloudMigrationServiceApi.ListSourceProjectsWithParams(ctx, params) + resp, _, err := opts.client.CloudMigrationServiceApi.ListSourceProjectsWithParams(ctx, params).Execute() if err != nil { return err } @@ -380,28 +407,33 @@ func (opts *ListSourceProjectsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListSourceProjectsTemplate = "<>" +func ListSourceProjectsBuilder() *cobra.Command { + const template = "<>" -func ListSourceProjectsBuilder() cobra.Command { opts := ListSourceProjectsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Projects Available for Migration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListSourceProjectsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -409,7 +441,7 @@ func ListSourceProjectsBuilder() cobra.Command { type ValidateMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -425,7 +457,7 @@ func (opts *ValidateMigrationOpts) Run(ctx context.Context) error { params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params) + resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params).Execute() if err != nil { return err } @@ -433,28 +465,33 @@ func (opts *ValidateMigrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ValidateMigrationTemplate = "<>" +func ValidateMigrationBuilder() *cobra.Command { + const template = "<>" -func ValidateMigrationBuilder() cobra.Command { opts := ValidateMigrationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Validate One Migration Request", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ValidateMigrationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index f0c1180ef4..c77b1cecd8 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -26,7 +26,7 @@ import ( type AuthorizeCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string roleId string } @@ -44,7 +44,7 @@ func (opts *AuthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error GroupId: opts.groupId, RoleId: opts.roleId, } - resp, _, err := opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params) + resp, _, err := opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *AuthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error return opts.Print(resp) } -const AuthorizeCloudProviderAccessRoleTemplate = "<>" +func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { + const template = "<>" -func AuthorizeCloudProviderAccessRoleBuilder() cobra.Command { opts := AuthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Authorize One Cloud Provider Access Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), AuthorizeCloudProviderAccessRoleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") _ = cmd.MarkFlagRequired("roleId") return cmd @@ -83,7 +87,7 @@ func AuthorizeCloudProviderAccessRoleBuilder() cobra.Command { type CreateCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -99,7 +103,7 @@ func (opts *CreateCloudProviderAccessRoleOpts) Run(ctx context.Context) error { params := &admin.CreateCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params) + resp, _, err := opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } @@ -107,28 +111,33 @@ func (opts *CreateCloudProviderAccessRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateCloudProviderAccessRoleTemplate = "<>" +func CreateCloudProviderAccessRoleBuilder() *cobra.Command { + const template = "<>" -func CreateCloudProviderAccessRoleBuilder() cobra.Command { opts := CreateCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Cloud Provider Access Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateCloudProviderAccessRoleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,7 +145,7 @@ func CreateCloudProviderAccessRoleBuilder() cobra.Command { type DeauthorizeCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string cloudProvider string roleId string @@ -156,7 +165,7 @@ func (opts *DeauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) err CloudProvider: opts.cloudProvider, RoleId: opts.roleId, } - _, err := opts.client.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(ctx, params) + _, err := opts.client.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } @@ -164,32 +173,35 @@ func (opts *DeauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) err return opts.Print(nil) } -const DeauthorizeCloudProviderAccessRoleTemplate = "<>" +func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { + const template = "<>" -func DeauthorizeCloudProviderAccessRoleBuilder() cobra.Command { opts := DeauthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Deauthorize One Cloud Provider Access Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeauthorizeCloudProviderAccessRoleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", , "Human-readable label that identifies the cloud provider of the role to deauthorize.") cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") _ = cmd.MarkFlagRequired("cloudProvider") - cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") _ = cmd.MarkFlagRequired("roleId") return cmd @@ -197,7 +209,7 @@ func DeauthorizeCloudProviderAccessRoleBuilder() cobra.Command { type GetCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string roleId string } @@ -215,7 +227,7 @@ func (opts *GetCloudProviderAccessRoleOpts) Run(ctx context.Context) error { GroupId: opts.groupId, RoleId: opts.roleId, } - resp, _, err := opts.client.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(ctx, params) + resp, _, err := opts.client.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } @@ -223,30 +235,34 @@ func (opts *GetCloudProviderAccessRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetCloudProviderAccessRoleTemplate = "<>" +func GetCloudProviderAccessRoleBuilder() *cobra.Command { + const template = "<>" -func GetCloudProviderAccessRoleBuilder() cobra.Command { opts := GetCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return specified Cloud Provider Access Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetCloudProviderAccessRoleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.roleId, "roleId", "", "usage description") _ = cmd.MarkFlagRequired("roleId") return cmd @@ -254,7 +270,7 @@ func GetCloudProviderAccessRoleBuilder() cobra.Command { type ListCloudProviderAccessRolesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -270,7 +286,7 @@ func (opts *ListCloudProviderAccessRolesOpts) Run(ctx context.Context) error { params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudProviderAccessApi.ListCloudProviderAccessRolesWithParams(ctx, params) + resp, _, err := opts.client.CloudProviderAccessApi.ListCloudProviderAccessRolesWithParams(ctx, params).Execute() if err != nil { return err } @@ -278,28 +294,33 @@ func (opts *ListCloudProviderAccessRolesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListCloudProviderAccessRolesTemplate = "<>" +func ListCloudProviderAccessRolesBuilder() *cobra.Command { + const template = "<>" -func ListCloudProviderAccessRolesBuilder() cobra.Command { opts := ListCloudProviderAccessRolesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Cloud Provider Access Roles", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListCloudProviderAccessRolesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 364070e1be..7132d0e2da 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -26,7 +26,7 @@ import ( type EndOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -44,7 +44,7 @@ func (opts *EndOutageSimulationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClusterOutageSimulationApi.EndOutageSimulationWithParams(ctx, params) + resp, _, err := opts.client.ClusterOutageSimulationApi.EndOutageSimulationWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *EndOutageSimulationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const EndOutageSimulationTemplate = "<>" +func EndOutageSimulationBuilder() *cobra.Command { + const template = "<>" -func EndOutageSimulationBuilder() cobra.Command { opts := EndOutageSimulationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "End an Outage Simulation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), EndOutageSimulationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that is undergoing outage simulation.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -83,7 +87,7 @@ func EndOutageSimulationBuilder() cobra.Command { type GetOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -101,7 +105,7 @@ func (opts *GetOutageSimulationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClusterOutageSimulationApi.GetOutageSimulationWithParams(ctx, params) + resp, _, err := opts.client.ClusterOutageSimulationApi.GetOutageSimulationWithParams(ctx, params).Execute() if err != nil { return err } @@ -109,30 +113,34 @@ func (opts *GetOutageSimulationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetOutageSimulationTemplate = "<>" +func GetOutageSimulationBuilder() *cobra.Command { + const template = "<>" -func GetOutageSimulationBuilder() cobra.Command { opts := GetOutageSimulationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Outage Simulation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetOutageSimulationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that is undergoing outage simulation.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -140,7 +148,7 @@ func GetOutageSimulationBuilder() cobra.Command { type StartOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -158,7 +166,7 @@ func (opts *StartOutageSimulationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params) + resp, _, err := opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params).Execute() if err != nil { return err } @@ -166,30 +174,34 @@ func (opts *StartOutageSimulationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const StartOutageSimulationTemplate = "<>" +func StartOutageSimulationBuilder() *cobra.Command { + const template = "<>" -func StartOutageSimulationBuilder() cobra.Command { opts := StartOutageSimulationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Start an Outage Simulation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), StartOutageSimulationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster to undergo an outage simulation.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 602f96adbc..97fa24211d 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -26,7 +26,7 @@ import ( type GetClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -44,7 +44,7 @@ func (opts *GetClusterAdvancedConfigurationOpts) Run(ctx context.Context) error GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *GetClusterAdvancedConfigurationOpts) Run(ctx context.Context) error return opts.Print(resp) } -const GetClusterAdvancedConfigurationTemplate = "<>" +func GetClusterAdvancedConfigurationBuilder() *cobra.Command { + const template = "<>" -func GetClusterAdvancedConfigurationBuilder() cobra.Command { opts := GetClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Advanced Configuration Options for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetClusterAdvancedConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -83,7 +87,7 @@ func GetClusterAdvancedConfigurationBuilder() cobra.Command { type GetClusterStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -101,7 +105,7 @@ func (opts *GetClusterStatusOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params).Execute() if err != nil { return err } @@ -109,30 +113,34 @@ func (opts *GetClusterStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetClusterStatusTemplate = "<>" +func GetClusterStatusBuilder() *cobra.Command { + const template = "<>" -func GetClusterStatusBuilder() cobra.Command { opts := GetClusterStatusOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Status of All Cluster Operations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetClusterStatusTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -140,7 +148,7 @@ func GetClusterStatusBuilder() cobra.Command { type GetSampleDatasetLoadStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string sampleDatasetId string } @@ -158,7 +166,7 @@ func (opts *GetSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { GroupId: opts.groupId, SampleDatasetId: opts.sampleDatasetId, } - resp, _, err := opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params).Execute() if err != nil { return err } @@ -166,30 +174,34 @@ func (opts *GetSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetSampleDatasetLoadStatusTemplate = "<>" +func GetSampleDatasetLoadStatusBuilder() *cobra.Command { + const template = "<>" -func GetSampleDatasetLoadStatusBuilder() cobra.Command { opts := GetSampleDatasetLoadStatusOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Check Status of Cluster Sample Dataset Request", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetSampleDatasetLoadStatusTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", , "Unique 24-hexadecimal digit string that identifies the loaded sample dataset.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", "usage description") _ = cmd.MarkFlagRequired("sampleDatasetId") return cmd @@ -197,7 +209,7 @@ func GetSampleDatasetLoadStatusBuilder() cobra.Command { type ListCloudProviderRegionsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -223,7 +235,7 @@ func (opts *ListCloudProviderRegionsOpts) Run(ctx context.Context) error { Providers: opts.providers, Tier: opts.tier, } - resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params).Execute() if err != nil { return err } @@ -231,41 +243,41 @@ func (opts *ListCloudProviderRegionsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListCloudProviderRegionsTemplate = "<>" +func ListCloudProviderRegionsBuilder() *cobra.Command { + const template = "<>" -func ListCloudProviderRegionsBuilder() cobra.Command { opts := ListCloudProviderRegionsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Cloud Provider Regions", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListCloudProviderRegionsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.providers, "providers", , "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") cmd.Flags().StringVar(&opts.tier, "tier", , "Cluster tier for which to retrieve the regions.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.providers, "providers", "", "usage description") - cmd.Flags().StringVar(&opts.tier, "tier", "", "usage description") return cmd } type ListClustersForAllProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int32 pageNum int32 @@ -285,7 +297,7 @@ func (opts *ListClustersForAllProjectsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params).Execute() if err != nil { return err } @@ -293,37 +305,40 @@ func (opts *ListClustersForAllProjectsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListClustersForAllProjectsTemplate = "<>" +func ListClustersForAllProjectsBuilder() *cobra.Command { + const template = "<>" -func ListClustersForAllProjectsBuilder() cobra.Command { opts := ListClustersForAllProjectsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Authorized Clusters in All Projects", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListClustersForAllProjectsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + return cmd } type LoadSampleDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string name string } @@ -341,7 +356,7 @@ func (opts *LoadSampleDatasetOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params).Execute() if err != nil { return err } @@ -349,30 +364,34 @@ func (opts *LoadSampleDatasetOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const LoadSampleDatasetTemplate = "<>" +func LoadSampleDatasetBuilder() *cobra.Command { + const template = "<>" -func LoadSampleDatasetBuilder() cobra.Command { opts := LoadSampleDatasetOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Load Sample Dataset Request into Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), LoadSampleDatasetTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the cluster into which you load the sample dataset.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.name, "name", "", "usage description") _ = cmd.MarkFlagRequired("name") return cmd @@ -380,7 +399,7 @@ func LoadSampleDatasetBuilder() cobra.Command { type UpdateClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -398,7 +417,7 @@ func (opts *UpdateClusterAdvancedConfigurationOpts) Run(ctx context.Context) err GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -406,30 +425,34 @@ func (opts *UpdateClusterAdvancedConfigurationOpts) Run(ctx context.Context) err return opts.Print(resp) } -const UpdateClusterAdvancedConfigurationTemplate = "<>" +func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { + const template = "<>" -func UpdateClusterAdvancedConfigurationBuilder() cobra.Command { opts := UpdateClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Advanced Configuration Options for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateClusterAdvancedConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -437,7 +460,7 @@ func UpdateClusterAdvancedConfigurationBuilder() cobra.Command { type UpgradeSharedClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -453,7 +476,7 @@ func (opts *UpgradeSharedClusterOpts) Run(ctx context.Context) error { params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() if err != nil { return err } @@ -461,28 +484,33 @@ func (opts *UpgradeSharedClusterOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpgradeSharedClusterTemplate = "<>" +func UpgradeSharedClusterBuilder() *cobra.Command { + const template = "<>" -func UpgradeSharedClusterBuilder() cobra.Command { opts := UpgradeSharedClusterOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Upgrade One Shared-tier Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpgradeSharedClusterTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -490,7 +518,7 @@ func UpgradeSharedClusterBuilder() cobra.Command { type UpgradeSharedClusterToServerlessOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -506,7 +534,7 @@ func (opts *UpgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params) + resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params).Execute() if err != nil { return err } @@ -514,28 +542,33 @@ func (opts *UpgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error return opts.Print(resp) } -const UpgradeSharedClusterToServerlessTemplate = "<>" +func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { + const template = "<>" -func UpgradeSharedClusterToServerlessBuilder() cobra.Command { opts := UpgradeSharedClusterToServerlessOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpgradeSharedClusterToServerlessTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index 300eb888c9..e9b008773b 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -26,7 +26,7 @@ import ( type CreateCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *CreateCustomDatabaseRoleOpts) Run(ctx context.Context) error { params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params) + resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreateCustomDatabaseRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateCustomDatabaseRoleTemplate = "<>" +func CreateCustomDatabaseRoleBuilder() *cobra.Command { + const template = "<>" -func CreateCustomDatabaseRoleBuilder() cobra.Command { opts := CreateCustomDatabaseRoleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Custom Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateCustomDatabaseRoleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func CreateCustomDatabaseRoleBuilder() cobra.Command { type DeleteCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string roleName string } @@ -97,7 +102,7 @@ func (opts *DeleteCustomDatabaseRoleOpts) Run(ctx context.Context) error { GroupId: opts.groupId, RoleName: opts.roleName, } - _, err := opts.client.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(ctx, params) + _, err := opts.client.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } @@ -105,30 +110,34 @@ func (opts *DeleteCustomDatabaseRoleOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const DeleteCustomDatabaseRoleTemplate = "<>" +func DeleteCustomDatabaseRoleBuilder() *cobra.Command { + const template = "<>" -func DeleteCustomDatabaseRoleBuilder() cobra.Command { opts := DeleteCustomDatabaseRoleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Custom Role from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteCustomDatabaseRoleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") _ = cmd.MarkFlagRequired("roleName") return cmd @@ -136,7 +145,7 @@ func DeleteCustomDatabaseRoleBuilder() cobra.Command { type GetCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string roleName string } @@ -154,7 +163,7 @@ func (opts *GetCustomDatabaseRoleOpts) Run(ctx context.Context) error { GroupId: opts.groupId, RoleName: opts.roleName, } - resp, _, err := opts.client.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(ctx, params) + resp, _, err := opts.client.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } @@ -162,30 +171,34 @@ func (opts *GetCustomDatabaseRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetCustomDatabaseRoleTemplate = "<>" +func GetCustomDatabaseRoleBuilder() *cobra.Command { + const template = "<>" -func GetCustomDatabaseRoleBuilder() cobra.Command { opts := GetCustomDatabaseRoleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Custom Role in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetCustomDatabaseRoleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") _ = cmd.MarkFlagRequired("roleName") return cmd @@ -193,7 +206,7 @@ func GetCustomDatabaseRoleBuilder() cobra.Command { type ListCustomDatabaseRolesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -209,7 +222,7 @@ func (opts *ListCustomDatabaseRolesOpts) Run(ctx context.Context) error { params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CustomDatabaseRolesApi.ListCustomDatabaseRolesWithParams(ctx, params) + resp, _, err := opts.client.CustomDatabaseRolesApi.ListCustomDatabaseRolesWithParams(ctx, params).Execute() if err != nil { return err } @@ -217,28 +230,33 @@ func (opts *ListCustomDatabaseRolesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListCustomDatabaseRolesTemplate = "<>" +func ListCustomDatabaseRolesBuilder() *cobra.Command { + const template = "<>" -func ListCustomDatabaseRolesBuilder() cobra.Command { opts := ListCustomDatabaseRolesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Custom Roles in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListCustomDatabaseRolesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -246,7 +264,7 @@ func ListCustomDatabaseRolesBuilder() cobra.Command { type UpdateCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string roleName string } @@ -264,7 +282,7 @@ func (opts *UpdateCustomDatabaseRoleOpts) Run(ctx context.Context) error { GroupId: opts.groupId, RoleName: opts.roleName, } - resp, _, err := opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params) + resp, _, err := opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } @@ -272,30 +290,34 @@ func (opts *UpdateCustomDatabaseRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateCustomDatabaseRoleTemplate = "<>" +func UpdateCustomDatabaseRoleBuilder() *cobra.Command { + const template = "<>" -func UpdateCustomDatabaseRoleBuilder() cobra.Command { opts := UpdateCustomDatabaseRoleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Custom Role in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateCustomDatabaseRoleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.roleName, "roleName", "", "usage description") _ = cmd.MarkFlagRequired("roleName") return cmd diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index dce2d32804..061c7ed6a5 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -26,7 +26,7 @@ import ( type CreateDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *CreateDataFederationPrivateEndpointOpts) Run(ctx context.Context) er params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreateDataFederationPrivateEndpointOpts) Run(ctx context.Context) er return opts.Print(resp) } -const CreateDataFederationPrivateEndpointTemplate = "<>" +func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func CreateDataFederationPrivateEndpointBuilder() cobra.Command { opts := CreateDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateDataFederationPrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func CreateDataFederationPrivateEndpointBuilder() cobra.Command { type CreateFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string skipRoleValidation bool } @@ -97,7 +102,7 @@ func (opts *CreateFederatedDatabaseOpts) Run(ctx context.Context) error { GroupId: opts.groupId, SkipRoleValidation: opts.skipRoleValidation, } - resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } @@ -105,37 +110,41 @@ func (opts *CreateFederatedDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateFederatedDatabaseTemplate = "<>" +func CreateFederatedDatabaseBuilder() *cobra.Command { + const template = "<>" -func CreateFederatedDatabaseBuilder() cobra.Command { opts := CreateFederatedDatabaseOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Federated Database Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateFederatedDatabaseTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", false, "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", "", "usage description") return cmd } type CreateOneDataFederationQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string tenantName string limitName string @@ -155,7 +164,7 @@ func (opts *CreateOneDataFederationQueryLimitOpts) Run(ctx context.Context) erro TenantName: opts.tenantName, LimitName: opts.limitName, } - resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } @@ -163,32 +172,35 @@ func (opts *CreateOneDataFederationQueryLimitOpts) Run(ctx context.Context) erro return opts.Print(resp) } -const CreateOneDataFederationQueryLimitTemplate = "<>" +func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { + const template = "<>" -func CreateOneDataFederationQueryLimitBuilder() cobra.Command { opts := CreateOneDataFederationQueryLimitOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Configure One Query Limit for One Federated Database Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateOneDataFederationQueryLimitTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") _ = cmd.MarkFlagRequired("tenantName") - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") _ = cmd.MarkFlagRequired("limitName") return cmd @@ -196,7 +208,7 @@ func CreateOneDataFederationQueryLimitBuilder() cobra.Command { type DeleteDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string endpointId string } @@ -214,7 +226,7 @@ func (opts *DeleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) er GroupId: opts.groupId, EndpointId: opts.endpointId, } - resp, _, err := opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -222,30 +234,34 @@ func (opts *DeleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) er return opts.Print(resp) } -const DeleteDataFederationPrivateEndpointTemplate = "<>" +func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func DeleteDataFederationPrivateEndpointBuilder() cobra.Command { opts := DeleteDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteDataFederationPrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") _ = cmd.MarkFlagRequired("endpointId") return cmd @@ -253,7 +269,7 @@ func DeleteDataFederationPrivateEndpointBuilder() cobra.Command { type DeleteFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string tenantName string } @@ -271,7 +287,7 @@ func (opts *DeleteFederatedDatabaseOpts) Run(ctx context.Context) error { GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } @@ -279,30 +295,34 @@ func (opts *DeleteFederatedDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteFederatedDatabaseTemplate = "<>" +func DeleteFederatedDatabaseBuilder() *cobra.Command { + const template = "<>" -func DeleteFederatedDatabaseBuilder() cobra.Command { opts := DeleteFederatedDatabaseOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Federated Database Instance from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteFederatedDatabaseTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to remove.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") _ = cmd.MarkFlagRequired("tenantName") return cmd @@ -310,7 +330,7 @@ func DeleteFederatedDatabaseBuilder() cobra.Command { type DeleteOneDataFederationInstanceQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string tenantName string limitName string @@ -330,7 +350,7 @@ func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Conte TenantName: opts.tenantName, LimitName: opts.limitName, } - resp, _, err := opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } @@ -338,32 +358,35 @@ func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Conte return opts.Print(resp) } -const DeleteOneDataFederationInstanceQueryLimitTemplate = "<>" +func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { + const template = "<>" -func DeleteOneDataFederationInstanceQueryLimitBuilder() cobra.Command { opts := DeleteOneDataFederationInstanceQueryLimitOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Delete One Query Limit For One Federated Database Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteOneDataFederationInstanceQueryLimitTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") _ = cmd.MarkFlagRequired("tenantName") - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") _ = cmd.MarkFlagRequired("limitName") return cmd @@ -371,7 +394,7 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() cobra.Command { type DownloadFederatedDatabaseQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string tenantName string endDate int64 @@ -393,7 +416,7 @@ func (opts *DownloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) err EndDate: opts.endDate, StartDate: opts.startDate, } - resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params).Execute() if err != nil { return err } @@ -401,40 +424,42 @@ func (opts *DownloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) err return opts.Print(resp) } -const DownloadFederatedDatabaseQueryLogsTemplate = "<>" +func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { + const template = "<>" -func DownloadFederatedDatabaseQueryLogsBuilder() cobra.Command { opts := DownloadFederatedDatabaseQueryLogsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Download Query Logs for One Federated Database Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DownloadFederatedDatabaseQueryLogsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to download query logs.") + cmd.Flags().StringVar(&opts.endDate, "endDate", , "Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") cmd.Flags().StringVar(&opts.startDate, "startDate", , "Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") _ = cmd.MarkFlagRequired("tenantName") - cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") - cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") return cmd } type GetDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string endpointId string } @@ -452,7 +477,7 @@ func (opts *GetDataFederationPrivateEndpointOpts) Run(ctx context.Context) error GroupId: opts.groupId, EndpointId: opts.endpointId, } - resp, _, err := opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -460,30 +485,34 @@ func (opts *GetDataFederationPrivateEndpointOpts) Run(ctx context.Context) error return opts.Print(resp) } -const GetDataFederationPrivateEndpointTemplate = "<>" +func GetDataFederationPrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func GetDataFederationPrivateEndpointBuilder() cobra.Command { opts := GetDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetDataFederationPrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") _ = cmd.MarkFlagRequired("endpointId") return cmd @@ -491,7 +520,7 @@ func GetDataFederationPrivateEndpointBuilder() cobra.Command { type GetFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string tenantName string } @@ -509,7 +538,7 @@ func (opts *GetFederatedDatabaseOpts) Run(ctx context.Context) error { GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } @@ -517,30 +546,34 @@ func (opts *GetFederatedDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetFederatedDatabaseTemplate = "<>" +func GetFederatedDatabaseBuilder() *cobra.Command { + const template = "<>" -func GetFederatedDatabaseBuilder() cobra.Command { opts := GetFederatedDatabaseOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Federated Database Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetFederatedDatabaseTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the Federated Database to return.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") _ = cmd.MarkFlagRequired("tenantName") return cmd @@ -548,7 +581,7 @@ func GetFederatedDatabaseBuilder() cobra.Command { type ListDataFederationPrivateEndpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -570,7 +603,7 @@ func (opts *ListDataFederationPrivateEndpointsOpts) Run(ctx context.Context) err ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params).Execute() if err != nil { return err } @@ -578,39 +611,41 @@ func (opts *ListDataFederationPrivateEndpointsOpts) Run(ctx context.Context) err return opts.Print(resp) } -const ListDataFederationPrivateEndpointsTemplate = "<>" +func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { + const template = "<>" -func ListDataFederationPrivateEndpointsBuilder() cobra.Command { opts := ListDataFederationPrivateEndpointsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListDataFederationPrivateEndpointsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListFederatedDatabasesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string type_ string } @@ -628,7 +663,7 @@ func (opts *ListFederatedDatabasesOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Type_: opts.type_, } - resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params).Execute() if err != nil { return err } @@ -636,37 +671,41 @@ func (opts *ListFederatedDatabasesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListFederatedDatabasesTemplate = "<>" +func ListFederatedDatabasesBuilder() *cobra.Command { + const template = "<>" -func ListFederatedDatabasesBuilder() cobra.Command { opts := ListFederatedDatabasesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Federated Database Instances in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListFederatedDatabasesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.type_, "type_", "USER", "Type of Federated Database Instances to return.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.type_, "type_", "", "usage description") return cmd } type ReturnFederatedDatabaseQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string tenantName string limitName string @@ -686,7 +725,7 @@ func (opts *ReturnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context) erro TenantName: opts.tenantName, LimitName: opts.limitName, } - resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } @@ -694,32 +733,35 @@ func (opts *ReturnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context) erro return opts.Print(resp) } -const ReturnFederatedDatabaseQueryLimitTemplate = "<>" +func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { + const template = "<>" -func ReturnFederatedDatabaseQueryLimitBuilder() cobra.Command { opts := ReturnFederatedDatabaseQueryLimitOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Federated Database Instance Query Limit for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ReturnFederatedDatabaseQueryLimitTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") _ = cmd.MarkFlagRequired("tenantName") - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") _ = cmd.MarkFlagRequired("limitName") return cmd @@ -727,7 +769,7 @@ func ReturnFederatedDatabaseQueryLimitBuilder() cobra.Command { type ReturnFederatedDatabaseQueryLimitsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string tenantName string } @@ -745,7 +787,7 @@ func (opts *ReturnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) err GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params).Execute() if err != nil { return err } @@ -753,30 +795,34 @@ func (opts *ReturnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) err return opts.Print(resp) } -const ReturnFederatedDatabaseQueryLimitsTemplate = "<>" +func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { + const template = "<>" -func ReturnFederatedDatabaseQueryLimitsBuilder() cobra.Command { opts := ReturnFederatedDatabaseQueryLimitsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Query Limits for One Federated Database Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ReturnFederatedDatabaseQueryLimitsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to retrieve query limits.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") _ = cmd.MarkFlagRequired("tenantName") return cmd @@ -784,7 +830,7 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() cobra.Command { type UpdateFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string tenantName string skipRoleValidation bool @@ -804,7 +850,7 @@ func (opts *UpdateFederatedDatabaseOpts) Run(ctx context.Context) error { TenantName: opts.tenantName, SkipRoleValidation: opts.skipRoleValidation, } - resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params) + resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } @@ -812,32 +858,36 @@ func (opts *UpdateFederatedDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateFederatedDatabaseTemplate = "<>" +func UpdateFederatedDatabaseBuilder() *cobra.Command { + const template = "<>" -func UpdateFederatedDatabaseBuilder() cobra.Command { opts := UpdateFederatedDatabaseOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Federated Database Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateFederatedDatabaseTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to update.") + cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", , "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "usage description") _ = cmd.MarkFlagRequired("tenantName") - cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", "", "usage description") + _ = cmd.MarkFlagRequired("skipRoleValidation") return cmd } diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 7a64532b58..15e0d932fe 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -26,7 +26,7 @@ import ( type CreatePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *CreatePipelineOpts) Run(ctx context.Context) error { params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreatePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreatePipelineTemplate = "<>" +func CreatePipelineBuilder() *cobra.Command { + const template = "<>" -func CreatePipelineBuilder() cobra.Command { opts := CreatePipelineOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreatePipelineTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func CreatePipelineBuilder() cobra.Command { type DeletePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string } @@ -97,7 +102,7 @@ func (opts *DeletePipelineOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params).Execute() if err != nil { return err } @@ -105,30 +110,34 @@ func (opts *DeletePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeletePipelineTemplate = "<>" +func DeletePipelineBuilder() *cobra.Command { + const template = "<>" -func DeletePipelineBuilder() cobra.Command { opts := DeletePipelineOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeletePipelineTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") return cmd @@ -136,7 +145,7 @@ func DeletePipelineBuilder() cobra.Command { type DeletePipelineRunDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string pipelineRunId string @@ -156,7 +165,7 @@ func (opts *DeletePipelineRunDatasetOpts) Run(ctx context.Context) error { PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } - resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params).Execute() if err != nil { return err } @@ -164,32 +173,35 @@ func (opts *DeletePipelineRunDatasetOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeletePipelineRunDatasetTemplate = "<>" +func DeletePipelineRunDatasetBuilder() *cobra.Command { + const template = "<>" -func DeletePipelineRunDatasetBuilder() cobra.Command { opts := DeletePipelineRunDatasetOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Delete Pipeline Run Dataset", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeletePipelineRunDatasetTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", , "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") - cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "usage description") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd @@ -197,7 +209,7 @@ func DeletePipelineRunDatasetBuilder() cobra.Command { type GetPipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string } @@ -215,7 +227,7 @@ func (opts *GetPipelineOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params).Execute() if err != nil { return err } @@ -223,30 +235,34 @@ func (opts *GetPipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetPipelineTemplate = "<>" +func GetPipelineBuilder() *cobra.Command { + const template = "<>" -func GetPipelineBuilder() cobra.Command { opts := GetPipelineOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetPipelineTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") return cmd @@ -254,7 +270,7 @@ func GetPipelineBuilder() cobra.Command { type GetPipelineRunOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string pipelineRunId string @@ -274,7 +290,7 @@ func (opts *GetPipelineRunOpts) Run(ctx context.Context) error { PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } - resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params).Execute() if err != nil { return err } @@ -282,32 +298,35 @@ func (opts *GetPipelineRunOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetPipelineRunTemplate = "<>" +func GetPipelineRunBuilder() *cobra.Command { + const template = "<>" -func GetPipelineRunBuilder() cobra.Command { opts := GetPipelineRunOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Data Lake Pipeline Run", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetPipelineRunTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", , "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") - cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "usage description") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd @@ -315,7 +334,7 @@ func GetPipelineRunBuilder() cobra.Command { type ListPipelineRunsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string includeCount bool @@ -341,7 +360,7 @@ func (opts *ListPipelineRunsOpts) Run(ctx context.Context) error { PageNum: opts.pageNum, CreatedBefore: opts.createdBefore, } - resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params).Execute() if err != nil { return err } @@ -349,42 +368,42 @@ func (opts *ListPipelineRunsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListPipelineRunsTemplate = "<>" +func ListPipelineRunsBuilder() *cobra.Command { + const template = "<>" -func ListPipelineRunsBuilder() cobra.Command { opts := ListPipelineRunsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Data Lake Pipeline Runs from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPipelineRunsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", , "If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", "usage description") return cmd } type ListPipelineSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string } @@ -402,7 +421,7 @@ func (opts *ListPipelineSchedulesOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params).Execute() if err != nil { return err } @@ -410,30 +429,34 @@ func (opts *ListPipelineSchedulesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListPipelineSchedulesTemplate = "<>" +func ListPipelineSchedulesBuilder() *cobra.Command { + const template = "<>" -func ListPipelineSchedulesBuilder() cobra.Command { opts := ListPipelineSchedulesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPipelineSchedulesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") return cmd @@ -441,7 +464,7 @@ func ListPipelineSchedulesBuilder() cobra.Command { type ListPipelineSnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string includeCount bool @@ -467,7 +490,7 @@ func (opts *ListPipelineSnapshotsOpts) Run(ctx context.Context) error { PageNum: opts.pageNum, CompletedAfter: opts.completedAfter, } - resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params).Execute() if err != nil { return err } @@ -475,42 +498,42 @@ func (opts *ListPipelineSnapshotsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListPipelineSnapshotsTemplate = "<>" +func ListPipelineSnapshotsBuilder() *cobra.Command { + const template = "<>" -func ListPipelineSnapshotsBuilder() cobra.Command { opts := ListPipelineSnapshotsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Available Backup Snapshots for One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPipelineSnapshotsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", , "Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", "usage description") return cmd } type ListPipelinesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -526,7 +549,7 @@ func (opts *ListPipelinesOpts) Run(ctx context.Context) error { params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.DataLakePipelinesApi.ListPipelinesWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelinesWithParams(ctx, params).Execute() if err != nil { return err } @@ -534,28 +557,33 @@ func (opts *ListPipelinesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListPipelinesTemplate = "<>" +func ListPipelinesBuilder() *cobra.Command { + const template = "<>" -func ListPipelinesBuilder() cobra.Command { opts := ListPipelinesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Data Lake Pipelines from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPipelinesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -563,7 +591,7 @@ func ListPipelinesBuilder() cobra.Command { type PausePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string } @@ -581,7 +609,7 @@ func (opts *PausePipelineOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params).Execute() if err != nil { return err } @@ -589,30 +617,34 @@ func (opts *PausePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const PausePipelineTemplate = "<>" +func PausePipelineBuilder() *cobra.Command { + const template = "<>" -func PausePipelineBuilder() cobra.Command { opts := PausePipelineOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Pause One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), PausePipelineTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") return cmd @@ -620,7 +652,7 @@ func PausePipelineBuilder() cobra.Command { type ResumePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string } @@ -638,7 +670,7 @@ func (opts *ResumePipelineOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params).Execute() if err != nil { return err } @@ -646,30 +678,34 @@ func (opts *ResumePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ResumePipelineTemplate = "<>" +func ResumePipelineBuilder() *cobra.Command { + const template = "<>" -func ResumePipelineBuilder() cobra.Command { opts := ResumePipelineOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Resume One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ResumePipelineTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") return cmd @@ -677,7 +713,7 @@ func ResumePipelineBuilder() cobra.Command { type TriggerSnapshotIngestionOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string } @@ -695,7 +731,7 @@ func (opts *TriggerSnapshotIngestionOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() if err != nil { return err } @@ -703,30 +739,34 @@ func (opts *TriggerSnapshotIngestionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const TriggerSnapshotIngestionTemplate = "<>" +func TriggerSnapshotIngestionBuilder() *cobra.Command { + const template = "<>" -func TriggerSnapshotIngestionBuilder() cobra.Command { opts := TriggerSnapshotIngestionOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Trigger on demand snapshot ingestion", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), TriggerSnapshotIngestionTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") return cmd @@ -734,7 +774,7 @@ func TriggerSnapshotIngestionBuilder() cobra.Command { type UpdatePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string pipelineName string } @@ -752,7 +792,7 @@ func (opts *UpdatePipelineOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params) + resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() if err != nil { return err } @@ -760,30 +800,34 @@ func (opts *UpdatePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdatePipelineTemplate = "<>" +func UpdatePipelineBuilder() *cobra.Command { + const template = "<>" -func UpdatePipelineBuilder() cobra.Command { opts := UpdatePipelineOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdatePipelineTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "usage description") _ = cmd.MarkFlagRequired("pipelineName") return cmd diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 58b4bfc884..a172aa5727 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -26,7 +26,7 @@ import ( type CreateDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *CreateDatabaseUserOpts) Run(ctx context.Context) error { params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params) + resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreateDatabaseUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateDatabaseUserTemplate = "<>" +func CreateDatabaseUserBuilder() *cobra.Command { + const template = "<>" -func CreateDatabaseUserBuilder() cobra.Command { opts := CreateDatabaseUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Database User in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateDatabaseUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func CreateDatabaseUserBuilder() cobra.Command { type DeleteDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string databaseName string username string @@ -99,7 +104,7 @@ func (opts *DeleteDatabaseUserOpts) Run(ctx context.Context) error { DatabaseName: opts.databaseName, Username: opts.username, } - resp, _, err := opts.client.DatabaseUsersApi.DeleteDatabaseUserWithParams(ctx, params) + resp, _, err := opts.client.DatabaseUsersApi.DeleteDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -107,32 +112,35 @@ func (opts *DeleteDatabaseUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteDatabaseUserTemplate = "<>" +func DeleteDatabaseUserBuilder() *cobra.Command { + const template = "<>" -func DeleteDatabaseUserBuilder() cobra.Command { opts := DeleteDatabaseUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Database User from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteDatabaseUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") _ = cmd.MarkFlagRequired("databaseName") - cmd.Flags().StringVar(&opts.username, "username", "", "usage description") _ = cmd.MarkFlagRequired("username") return cmd @@ -140,7 +148,7 @@ func DeleteDatabaseUserBuilder() cobra.Command { type GetDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string databaseName string username string @@ -160,7 +168,7 @@ func (opts *GetDatabaseUserOpts) Run(ctx context.Context) error { DatabaseName: opts.databaseName, Username: opts.username, } - resp, _, err := opts.client.DatabaseUsersApi.GetDatabaseUserWithParams(ctx, params) + resp, _, err := opts.client.DatabaseUsersApi.GetDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -168,32 +176,35 @@ func (opts *GetDatabaseUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetDatabaseUserTemplate = "<>" +func GetDatabaseUserBuilder() *cobra.Command { + const template = "<>" -func GetDatabaseUserBuilder() cobra.Command { opts := GetDatabaseUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Database User from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetDatabaseUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") _ = cmd.MarkFlagRequired("databaseName") - cmd.Flags().StringVar(&opts.username, "username", "", "usage description") _ = cmd.MarkFlagRequired("username") return cmd @@ -201,7 +212,7 @@ func GetDatabaseUserBuilder() cobra.Command { type ListDatabaseUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -223,7 +234,7 @@ func (opts *ListDatabaseUsersOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.DatabaseUsersApi.ListDatabaseUsersWithParams(ctx, params) + resp, _, err := opts.client.DatabaseUsersApi.ListDatabaseUsersWithParams(ctx, params).Execute() if err != nil { return err } @@ -231,39 +242,41 @@ func (opts *ListDatabaseUsersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListDatabaseUsersTemplate = "<>" +func ListDatabaseUsersBuilder() *cobra.Command { + const template = "<>" -func ListDatabaseUsersBuilder() cobra.Command { opts := ListDatabaseUsersOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Database Users from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListDatabaseUsersTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type UpdateDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string databaseName string username string @@ -283,7 +296,7 @@ func (opts *UpdateDatabaseUserOpts) Run(ctx context.Context) error { DatabaseName: opts.databaseName, Username: opts.username, } - resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params) + resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -291,32 +304,35 @@ func (opts *UpdateDatabaseUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateDatabaseUserTemplate = "<>" +func UpdateDatabaseUserBuilder() *cobra.Command { + const template = "<>" -func UpdateDatabaseUserBuilder() cobra.Command { opts := UpdateDatabaseUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Database User in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateDatabaseUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") _ = cmd.MarkFlagRequired("databaseName") - cmd.Flags().StringVar(&opts.username, "username", "", "usage description") _ = cmd.MarkFlagRequired("username") return cmd diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index 2c0a138172..9a977d893d 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -26,7 +26,7 @@ import ( type GetEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *GetEncryptionAtRestOpts) Run(ctx context.Context) error { params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRestWithParams(ctx, params) + resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRestWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *GetEncryptionAtRestOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetEncryptionAtRestTemplate = "<>" +func GetEncryptionAtRestBuilder() *cobra.Command { + const template = "<>" -func GetEncryptionAtRestBuilder() cobra.Command { opts := GetEncryptionAtRestOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetEncryptionAtRestTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func GetEncryptionAtRestBuilder() cobra.Command { type UpdateEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -95,7 +100,7 @@ func (opts *UpdateEncryptionAtRestOpts) Run(ctx context.Context) error { params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params) + resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params).Execute() if err != nil { return err } @@ -103,28 +108,33 @@ func (opts *UpdateEncryptionAtRestOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateEncryptionAtRestTemplate = "<>" +func UpdateEncryptionAtRestBuilder() *cobra.Command { + const template = "<>" -func UpdateEncryptionAtRestBuilder() cobra.Command { opts := UpdateEncryptionAtRestOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateEncryptionAtRestTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index d777b05d3d..cc307a0dc5 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -26,7 +26,7 @@ import ( type GetOrganizationEventOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string eventId string includeRaw bool @@ -46,7 +46,7 @@ func (opts *GetOrganizationEventOpts) Run(ctx context.Context) error { EventId: opts.eventId, IncludeRaw: opts.includeRaw, } - resp, _, err := opts.client.EventsApi.GetOrganizationEventWithParams(ctx, params) + resp, _, err := opts.client.EventsApi.GetOrganizationEventWithParams(ctx, params).Execute() if err != nil { return err } @@ -54,39 +54,42 @@ func (opts *GetOrganizationEventOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetOrganizationEventTemplate = "<>" +func GetOrganizationEventBuilder() *cobra.Command { + const template = "<>" -func GetOrganizationEventBuilder() cobra.Command { opts := GetOrganizationEventOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Event from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetOrganizationEventTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.eventId, "eventId", "", "usage description") _ = cmd.MarkFlagRequired("eventId") - cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") return cmd } type GetProjectEventOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string eventId string includeRaw bool @@ -106,7 +109,7 @@ func (opts *GetProjectEventOpts) Run(ctx context.Context) error { EventId: opts.eventId, IncludeRaw: opts.includeRaw, } - resp, _, err := opts.client.EventsApi.GetProjectEventWithParams(ctx, params) + resp, _, err := opts.client.EventsApi.GetProjectEventWithParams(ctx, params).Execute() if err != nil { return err } @@ -114,44 +117,47 @@ func (opts *GetProjectEventOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetProjectEventTemplate = "<>" +func GetProjectEventBuilder() *cobra.Command { + const template = "<>" -func GetProjectEventBuilder() cobra.Command { opts := GetProjectEventOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Event from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetProjectEventTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.eventId, "eventId", "", "usage description") _ = cmd.MarkFlagRequired("eventId") - cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") return cmd } type ListOrganizationEventsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string includeCount bool itemsPerPage int32 pageNum int32 - eventType []map[string]interface{} + eventType []string includeRaw bool maxDate time.Time minDate time.Time @@ -176,7 +182,7 @@ func (opts *ListOrganizationEventsOpts) Run(ctx context.Context) error { MaxDate: opts.maxDate, MinDate: opts.minDate, } - resp, _, err := opts.client.EventsApi.ListOrganizationEventsWithParams(ctx, params) + resp, _, err := opts.client.EventsApi.ListOrganizationEventsWithParams(ctx, params).Execute() if err != nil { return err } @@ -184,49 +190,47 @@ func (opts *ListOrganizationEventsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListOrganizationEventsTemplate = "<>" +func ListOrganizationEventsBuilder() *cobra.Command { + const template = "<>" -func ListOrganizationEventsBuilder() cobra.Command { opts := ListOrganizationEventsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Events from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListOrganizationEventsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") cmd.Flags().StringVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") cmd.Flags().StringVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.eventType, "eventType", "", "usage description") - cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") - cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", "usage description") - cmd.Flags().StringVar(&opts.minDate, "minDate", "", "usage description") return cmd } type ListProjectEventsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 pageNum int32 clusterNames []string - eventType EventTypeForNdsGroup + eventType []string includeRaw bool maxDate time.Time minDate time.Time @@ -252,7 +256,7 @@ func (opts *ListProjectEventsOpts) Run(ctx context.Context) error { MaxDate: opts.maxDate, MinDate: opts.minDate, } - resp, _, err := opts.client.EventsApi.ListProjectEventsWithParams(ctx, params) + resp, _, err := opts.client.EventsApi.ListProjectEventsWithParams(ctx, params).Execute() if err != nil { return err } @@ -260,37 +264,34 @@ func (opts *ListProjectEventsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListProjectEventsTemplate = "<>" +func ListProjectEventsBuilder() *cobra.Command { + const template = "<>" -func ListProjectEventsBuilder() cobra.Command { opts := ListProjectEventsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Events from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListProjectEventsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.clusterNames, "clusterNames", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") cmd.Flags().StringVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") cmd.Flags().StringVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.clusterNames, "clusterNames", "", "usage description") - cmd.Flags().StringVar(&opts.eventType, "eventType", "", "usage description") - cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", "", "usage description") - cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", "usage description") - cmd.Flags().StringVar(&opts.minDate, "minDate", "", "usage description") return cmd } diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index d26167848b..e4c1f82b9f 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -26,7 +26,7 @@ import ( type CreateRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string orgId string } @@ -44,7 +44,7 @@ func (opts *CreateRoleMappingOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateRoleMappingOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateRoleMappingTemplate = "<>" +func CreateRoleMappingBuilder() *cobra.Command { + const template = "<>" -func CreateRoleMappingBuilder() cobra.Command { opts := CreateRoleMappingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Add One Role Mapping to One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateRoleMappingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") _ = cmd.MarkFlagRequired("orgId") return cmd @@ -83,7 +87,7 @@ func CreateRoleMappingBuilder() cobra.Command { type DeleteFederationAppOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -99,7 +103,7 @@ func (opts *DeleteFederationAppOpts) Run(ctx context.Context) error { params := &admin.DeleteFederationAppApiParams{ FederationSettingsId: opts.federationSettingsId, } - _, err := opts.client.FederatedAuthenticationApi.DeleteFederationAppWithParams(ctx, params) + _, err := opts.client.FederatedAuthenticationApi.DeleteFederationAppWithParams(ctx, params).Execute() if err != nil { return err } @@ -107,28 +111,33 @@ func (opts *DeleteFederationAppOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const DeleteFederationAppTemplate = "<>" +func DeleteFederationAppBuilder() *cobra.Command { + const template = "<>" -func DeleteFederationAppBuilder() cobra.Command { opts := DeleteFederationAppOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Delete the federation settings instance.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteFederationAppTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -136,7 +145,7 @@ func DeleteFederationAppBuilder() cobra.Command { type DeleteRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string id string orgId string @@ -156,7 +165,7 @@ func (opts *DeleteRoleMappingOpts) Run(ctx context.Context) error { Id: opts.id, OrgId: opts.orgId, } - _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params) + _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } @@ -164,32 +173,35 @@ func (opts *DeleteRoleMappingOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const DeleteRoleMappingTemplate = "<>" +func DeleteRoleMappingBuilder() *cobra.Command { + const template = "<>" -func DeleteRoleMappingBuilder() cobra.Command { opts := DeleteRoleMappingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Role Mapping from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteRoleMappingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.id, "id", "", "usage description") _ = cmd.MarkFlagRequired("id") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") _ = cmd.MarkFlagRequired("orgId") return cmd @@ -197,7 +209,7 @@ func DeleteRoleMappingBuilder() cobra.Command { type GetConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string orgId string } @@ -215,7 +227,7 @@ func (opts *GetConnectedOrgConfigOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } @@ -223,30 +235,34 @@ func (opts *GetConnectedOrgConfigOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetConnectedOrgConfigTemplate = "<>" +func GetConnectedOrgConfigBuilder() *cobra.Command { + const template = "<>" -func GetConnectedOrgConfigBuilder() cobra.Command { opts := GetConnectedOrgConfigOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Org Config Connected to One Federation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetConnectedOrgConfigTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") _ = cmd.MarkFlagRequired("orgId") return cmd @@ -254,7 +270,7 @@ func GetConnectedOrgConfigBuilder() cobra.Command { type GetFederationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -270,7 +286,7 @@ func (opts *GetFederationSettingsOpts) Run(ctx context.Context) error { params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetFederationSettingsWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetFederationSettingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -278,28 +294,33 @@ func (opts *GetFederationSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetFederationSettingsTemplate = "<>" +func GetFederationSettingsBuilder() *cobra.Command { + const template = "<>" -func GetFederationSettingsBuilder() cobra.Command { opts := GetFederationSettingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Federation Settings for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetFederationSettingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -307,7 +328,7 @@ func GetFederationSettingsBuilder() cobra.Command { type GetIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string identityProviderId string } @@ -325,7 +346,7 @@ func (opts *GetIdentityProviderOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params).Execute() if err != nil { return err } @@ -333,30 +354,34 @@ func (opts *GetIdentityProviderOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetIdentityProviderTemplate = "<>" +func GetIdentityProviderBuilder() *cobra.Command { + const template = "<>" -func GetIdentityProviderBuilder() cobra.Command { opts := GetIdentityProviderOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return one identity provider from the specified federation.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetIdentityProviderTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") _ = cmd.MarkFlagRequired("identityProviderId") return cmd @@ -364,7 +389,7 @@ func GetIdentityProviderBuilder() cobra.Command { type GetIdentityProviderMetadataOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string identityProviderId string } @@ -382,7 +407,7 @@ func (opts *GetIdentityProviderMetadataOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params).Execute() if err != nil { return err } @@ -390,30 +415,34 @@ func (opts *GetIdentityProviderMetadataOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetIdentityProviderMetadataTemplate = "<>" +func GetIdentityProviderMetadataBuilder() *cobra.Command { + const template = "<>" -func GetIdentityProviderMetadataBuilder() cobra.Command { opts := GetIdentityProviderMetadataOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return the metadata of one identity provider in the specified federation.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetIdentityProviderMetadataTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") _ = cmd.MarkFlagRequired("identityProviderId") return cmd @@ -421,7 +450,7 @@ func GetIdentityProviderMetadataBuilder() cobra.Command { type GetRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string id string orgId string @@ -441,7 +470,7 @@ func (opts *GetRoleMappingOpts) Run(ctx context.Context) error { Id: opts.id, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } @@ -449,32 +478,35 @@ func (opts *GetRoleMappingOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetRoleMappingTemplate = "<>" +func GetRoleMappingBuilder() *cobra.Command { + const template = "<>" -func GetRoleMappingBuilder() cobra.Command { opts := GetRoleMappingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Role Mapping from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetRoleMappingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.id, "id", "", "usage description") _ = cmd.MarkFlagRequired("id") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") _ = cmd.MarkFlagRequired("orgId") return cmd @@ -482,7 +514,7 @@ func GetRoleMappingBuilder() cobra.Command { type ListConnectedOrgConfigsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -498,7 +530,7 @@ func (opts *ListConnectedOrgConfigsOpts) Run(ctx context.Context) error { params := &admin.ListConnectedOrgConfigsApiParams{ FederationSettingsId: opts.federationSettingsId, } - resp, _, err := opts.client.FederatedAuthenticationApi.ListConnectedOrgConfigsWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.ListConnectedOrgConfigsWithParams(ctx, params).Execute() if err != nil { return err } @@ -506,28 +538,33 @@ func (opts *ListConnectedOrgConfigsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListConnectedOrgConfigsTemplate = "<>" +func ListConnectedOrgConfigsBuilder() *cobra.Command { + const template = "<>" -func ListConnectedOrgConfigsBuilder() cobra.Command { opts := ListConnectedOrgConfigsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Connected Org Configs from the Federation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListConnectedOrgConfigsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -535,7 +572,7 @@ func ListConnectedOrgConfigsBuilder() cobra.Command { type ListIdentityProvidersOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -551,7 +588,7 @@ func (opts *ListIdentityProvidersOpts) Run(ctx context.Context) error { params := &admin.ListIdentityProvidersApiParams{ FederationSettingsId: opts.federationSettingsId, } - resp, _, err := opts.client.FederatedAuthenticationApi.ListIdentityProvidersWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.ListIdentityProvidersWithParams(ctx, params).Execute() if err != nil { return err } @@ -559,28 +596,33 @@ func (opts *ListIdentityProvidersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListIdentityProvidersTemplate = "<>" +func ListIdentityProvidersBuilder() *cobra.Command { + const template = "<>" -func ListIdentityProvidersBuilder() cobra.Command { opts := ListIdentityProvidersOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return all identity providers from the specified federation.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListIdentityProvidersTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -588,7 +630,7 @@ func ListIdentityProvidersBuilder() cobra.Command { type ListRoleMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string orgId string } @@ -606,7 +648,7 @@ func (opts *ListRoleMappingsOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -614,30 +656,34 @@ func (opts *ListRoleMappingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListRoleMappingsTemplate = "<>" +func ListRoleMappingsBuilder() *cobra.Command { + const template = "<>" -func ListRoleMappingsBuilder() cobra.Command { opts := ListRoleMappingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Role Mappings from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListRoleMappingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") _ = cmd.MarkFlagRequired("orgId") return cmd @@ -645,7 +691,7 @@ func ListRoleMappingsBuilder() cobra.Command { type RemoveConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string orgId string } @@ -663,7 +709,7 @@ func (opts *RemoveConnectedOrgConfigOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } @@ -671,30 +717,34 @@ func (opts *RemoveConnectedOrgConfigOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const RemoveConnectedOrgConfigTemplate = "<>" +func RemoveConnectedOrgConfigBuilder() *cobra.Command { + const template = "<>" -func RemoveConnectedOrgConfigBuilder() cobra.Command { opts := RemoveConnectedOrgConfigOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Org Config Connected to One Federation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), RemoveConnectedOrgConfigTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") _ = cmd.MarkFlagRequired("orgId") return cmd @@ -702,7 +752,7 @@ func RemoveConnectedOrgConfigBuilder() cobra.Command { type UpdateConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string orgId string } @@ -720,7 +770,7 @@ func (opts *UpdateConnectedOrgConfigOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } @@ -728,30 +778,34 @@ func (opts *UpdateConnectedOrgConfigOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateConnectedOrgConfigTemplate = "<>" +func UpdateConnectedOrgConfigBuilder() *cobra.Command { + const template = "<>" -func UpdateConnectedOrgConfigBuilder() cobra.Command { opts := UpdateConnectedOrgConfigOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Org Config Connected to One Federation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateConnectedOrgConfigTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") _ = cmd.MarkFlagRequired("orgId") return cmd @@ -759,7 +813,7 @@ func UpdateConnectedOrgConfigBuilder() cobra.Command { type UpdateIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string identityProviderId string } @@ -777,7 +831,7 @@ func (opts *UpdateIdentityProviderOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } - resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params).Execute() if err != nil { return err } @@ -785,30 +839,34 @@ func (opts *UpdateIdentityProviderOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateIdentityProviderTemplate = "<>" +func UpdateIdentityProviderBuilder() *cobra.Command { + const template = "<>" -func UpdateIdentityProviderBuilder() cobra.Command { opts := UpdateIdentityProviderOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update the identity provider.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateIdentityProviderTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "usage description") _ = cmd.MarkFlagRequired("identityProviderId") return cmd @@ -816,7 +874,7 @@ func UpdateIdentityProviderBuilder() cobra.Command { type UpdateRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient federationSettingsId string id string orgId string @@ -836,7 +894,7 @@ func (opts *UpdateRoleMappingOpts) Run(ctx context.Context) error { Id: opts.id, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params) + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } @@ -844,32 +902,35 @@ func (opts *UpdateRoleMappingOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateRoleMappingTemplate = "<>" +func UpdateRoleMappingBuilder() *cobra.Command { + const template = "<>" -func UpdateRoleMappingBuilder() cobra.Command { opts := UpdateRoleMappingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Role Mapping in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateRoleMappingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "usage description") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("federationSettingsId") - cmd.Flags().StringVar(&opts.id, "id", "", "usage description") _ = cmd.MarkFlagRequired("id") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") _ = cmd.MarkFlagRequired("orgId") return cmd diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index deec56d0e1..07e871f515 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -26,7 +26,7 @@ import ( type CreateCustomZoneMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -44,7 +44,7 @@ func (opts *CreateCustomZoneMappingOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params) + resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateCustomZoneMappingOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateCustomZoneMappingTemplate = "<>" +func CreateCustomZoneMappingBuilder() *cobra.Command { + const template = "<>" -func CreateCustomZoneMappingBuilder() cobra.Command { opts := CreateCustomZoneMappingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Add One Entry to One Custom Zone Mapping", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateCustomZoneMappingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -83,7 +87,7 @@ func CreateCustomZoneMappingBuilder() cobra.Command { type CreateManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -101,7 +105,7 @@ func (opts *CreateManagedNamespaceOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params) + resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params).Execute() if err != nil { return err } @@ -109,30 +113,34 @@ func (opts *CreateManagedNamespaceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateManagedNamespaceTemplate = "<>" +func CreateManagedNamespaceBuilder() *cobra.Command { + const template = "<>" -func CreateManagedNamespaceBuilder() cobra.Command { opts := CreateManagedNamespaceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateManagedNamespaceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -140,7 +148,7 @@ func CreateManagedNamespaceBuilder() cobra.Command { type DeleteAllCustomZoneMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -158,7 +166,7 @@ func (opts *DeleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params) + resp, _, err := opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -166,30 +174,34 @@ func (opts *DeleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteAllCustomZoneMappingsTemplate = "<>" +func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { + const template = "<>" -func DeleteAllCustomZoneMappingsBuilder() cobra.Command { opts := DeleteAllCustomZoneMappingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteAllCustomZoneMappingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -197,7 +209,7 @@ func DeleteAllCustomZoneMappingsBuilder() cobra.Command { type DeleteManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient clusterName string groupId string db string @@ -219,7 +231,7 @@ func (opts *DeleteManagedNamespaceOpts) Run(ctx context.Context) error { Db: opts.db, Collection: opts.collection, } - resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params) + resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params).Execute() if err != nil { return err } @@ -227,40 +239,42 @@ func (opts *DeleteManagedNamespaceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteManagedNamespaceTemplate = "<>" +func DeleteManagedNamespaceBuilder() *cobra.Command { + const template = "<>" -func DeleteManagedNamespaceBuilder() cobra.Command { opts := DeleteManagedNamespaceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteManagedNamespaceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.db, "db", , "Human-readable label that identifies the database that contains the collection.") cmd.Flags().StringVar(&opts.collection, "collection", , "Human-readable label that identifies the collection associated with the managed namespace.") + _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.db, "db", "", "usage description") - cmd.Flags().StringVar(&opts.collection, "collection", "", "usage description") return cmd } type GetManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -278,7 +292,7 @@ func (opts *GetManagedNamespaceOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params) + resp, _, err := opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params).Execute() if err != nil { return err } @@ -286,30 +300,34 @@ func (opts *GetManagedNamespaceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetManagedNamespaceTemplate = "<>" +func GetManagedNamespaceBuilder() *cobra.Command { + const template = "<>" -func GetManagedNamespaceBuilder() cobra.Command { opts := GetManagedNamespaceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetManagedNamespaceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index ce9bf043f8..2ade0e5263 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -26,7 +26,7 @@ import ( type DownloadInvoiceCSVOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string invoiceId string } @@ -44,7 +44,7 @@ func (opts *DownloadInvoiceCSVOpts) Run(ctx context.Context) error { OrgId: opts.orgId, InvoiceId: opts.invoiceId, } - _, err := opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params) + _, err := opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *DownloadInvoiceCSVOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const DownloadInvoiceCSVTemplate = "<>" +func DownloadInvoiceCSVBuilder() *cobra.Command { + const template = "<>" -func DownloadInvoiceCSVBuilder() cobra.Command { opts := DownloadInvoiceCSVOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Organization Invoice as CSV", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DownloadInvoiceCSVTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", , "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "usage description") _ = cmd.MarkFlagRequired("invoiceId") return cmd @@ -83,7 +87,7 @@ func DownloadInvoiceCSVBuilder() cobra.Command { type GetInvoiceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string invoiceId string } @@ -101,7 +105,7 @@ func (opts *GetInvoiceOpts) Run(ctx context.Context) error { OrgId: opts.orgId, InvoiceId: opts.invoiceId, } - resp, _, err := opts.client.InvoicesApi.GetInvoiceWithParams(ctx, params) + resp, _, err := opts.client.InvoicesApi.GetInvoiceWithParams(ctx, params).Execute() if err != nil { return err } @@ -109,30 +113,34 @@ func (opts *GetInvoiceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetInvoiceTemplate = "<>" +func GetInvoiceBuilder() *cobra.Command { + const template = "<>" -func GetInvoiceBuilder() cobra.Command { opts := GetInvoiceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Organization Invoice", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetInvoiceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", , "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "usage description") _ = cmd.MarkFlagRequired("invoiceId") return cmd @@ -140,7 +148,7 @@ func GetInvoiceBuilder() cobra.Command { type ListInvoicesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string includeCount bool itemsPerPage int32 @@ -162,7 +170,7 @@ func (opts *ListInvoicesOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.InvoicesApi.ListInvoicesWithParams(ctx, params) + resp, _, err := opts.client.InvoicesApi.ListInvoicesWithParams(ctx, params).Execute() if err != nil { return err } @@ -170,39 +178,41 @@ func (opts *ListInvoicesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListInvoicesTemplate = "<>" +func ListInvoicesBuilder() *cobra.Command { + const template = "<>" -func ListInvoicesBuilder() cobra.Command { opts := ListInvoicesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Invoices for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListInvoicesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListPendingInvoicesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -218,7 +228,7 @@ func (opts *ListPendingInvoicesOpts) Run(ctx context.Context) error { params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.InvoicesApi.ListPendingInvoicesWithParams(ctx, params) + resp, _, err := opts.client.InvoicesApi.ListPendingInvoicesWithParams(ctx, params).Execute() if err != nil { return err } @@ -226,28 +236,33 @@ func (opts *ListPendingInvoicesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListPendingInvoicesTemplate = "<>" +func ListPendingInvoicesBuilder() *cobra.Command { + const template = "<>" -func ListPendingInvoicesBuilder() cobra.Command { opts := ListPendingInvoicesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Pending Invoices for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPendingInvoicesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 36a6e38e72..0ba890202a 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -26,7 +26,7 @@ import ( type DeleteLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *DeleteLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, } - _, err := opts.client.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(ctx, params) + _, err := opts.client.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *DeleteLDAPConfigurationOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const DeleteLDAPConfigurationTemplate = "<>" +func DeleteLDAPConfigurationBuilder() *cobra.Command { + const template = "<>" -func DeleteLDAPConfigurationBuilder() cobra.Command { opts := DeleteLDAPConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove the Current LDAP User to DN Mapping", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteLDAPConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func DeleteLDAPConfigurationBuilder() cobra.Command { type GetLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -95,7 +100,7 @@ func (opts *GetLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationWithParams(ctx, params) + resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -103,28 +108,33 @@ func (opts *GetLDAPConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetLDAPConfigurationTemplate = "<>" +func GetLDAPConfigurationBuilder() *cobra.Command { + const template = "<>" -func GetLDAPConfigurationBuilder() cobra.Command { opts := GetLDAPConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return the Current LDAP or X.509 Configuration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetLDAPConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -132,7 +142,7 @@ func GetLDAPConfigurationBuilder() cobra.Command { type GetLDAPConfigurationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string requestId string } @@ -150,7 +160,7 @@ func (opts *GetLDAPConfigurationStatusOpts) Run(ctx context.Context) error { GroupId: opts.groupId, RequestId: opts.requestId, } - resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params) + resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params).Execute() if err != nil { return err } @@ -158,30 +168,34 @@ func (opts *GetLDAPConfigurationStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetLDAPConfigurationStatusTemplate = "<>" +func GetLDAPConfigurationStatusBuilder() *cobra.Command { + const template = "<>" -func GetLDAPConfigurationStatusBuilder() cobra.Command { opts := GetLDAPConfigurationStatusOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return the Status of One Verify LDAP Configuration Request", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetLDAPConfigurationStatusTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.requestId, "requestId", , "Unique string that identifies the request to verify an <abbr title=\"Lightweight Directory Access Protocol\">LDAP</abbr> configuration.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.requestId, "requestId", "", "usage description") _ = cmd.MarkFlagRequired("requestId") return cmd @@ -189,7 +203,7 @@ func GetLDAPConfigurationStatusBuilder() cobra.Command { type SaveLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -205,7 +219,7 @@ func (opts *SaveLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params) + resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -213,28 +227,33 @@ func (opts *SaveLDAPConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const SaveLDAPConfigurationTemplate = "<>" +func SaveLDAPConfigurationBuilder() *cobra.Command { + const template = "<>" -func SaveLDAPConfigurationBuilder() cobra.Command { opts := SaveLDAPConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Edit the LDAP or X.509 Configuration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), SaveLDAPConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -242,7 +261,7 @@ func SaveLDAPConfigurationBuilder() cobra.Command { type VerifyLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -258,7 +277,7 @@ func (opts *VerifyLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params) + resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } @@ -266,28 +285,33 @@ func (opts *VerifyLDAPConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const VerifyLDAPConfigurationTemplate = "<>" +func VerifyLDAPConfigurationBuilder() *cobra.Command { + const template = "<>" -func VerifyLDAPConfigurationBuilder() cobra.Command { opts := VerifyLDAPConfigurationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Verify the LDAP Configuration in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), VerifyLDAPConfigurationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index 0c50526ae6..de4b192e24 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -26,7 +26,7 @@ import ( type DeleteLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -46,7 +46,7 @@ func (opts *DeleteLegacySnapshotOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params).Execute() if err != nil { return err } @@ -54,32 +54,35 @@ func (opts *DeleteLegacySnapshotOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteLegacySnapshotTemplate = "<>" +func DeleteLegacySnapshotBuilder() *cobra.Command { + const template = "<>" -func DeleteLegacySnapshotBuilder() cobra.Command { opts := DeleteLegacySnapshotOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Legacy Backup Snapshot", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteLegacySnapshotTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -87,7 +90,7 @@ func DeleteLegacySnapshotBuilder() cobra.Command { type GetLegacyBackupCheckpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string checkpointId string clusterName string @@ -107,7 +110,7 @@ func (opts *GetLegacyBackupCheckpointOpts) Run(ctx context.Context) error { CheckpointId: opts.checkpointId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -115,32 +118,35 @@ func (opts *GetLegacyBackupCheckpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetLegacyBackupCheckpointTemplate = "<>" +func GetLegacyBackupCheckpointBuilder() *cobra.Command { + const template = "<>" -func GetLegacyBackupCheckpointBuilder() cobra.Command { opts := GetLegacyBackupCheckpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Legacy Backup Checkpoint", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetLegacyBackupCheckpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", , "Unique 24-hexadecimal digit string that identifies the checkpoint.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", "usage description") _ = cmd.MarkFlagRequired("checkpointId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -148,7 +154,7 @@ func GetLegacyBackupCheckpointBuilder() cobra.Command { type GetLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string jobId string @@ -168,7 +174,7 @@ func (opts *GetLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, JobId: opts.jobId, } - resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -176,32 +182,35 @@ func (opts *GetLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetLegacyBackupRestoreJobTemplate = "<>" +func GetLegacyBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func GetLegacyBackupRestoreJobBuilder() cobra.Command { opts := GetLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Legacy Backup Restore Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetLegacyBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") cmd.Flags().StringVar(&opts.jobId, "jobId", , "Unique 24-hexadecimal digit string that identifies the restore job.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.jobId, "jobId", "", "usage description") _ = cmd.MarkFlagRequired("jobId") return cmd @@ -209,7 +218,7 @@ func GetLegacyBackupRestoreJobBuilder() cobra.Command { type GetLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -229,7 +238,7 @@ func (opts *GetLegacySnapshotOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params).Execute() if err != nil { return err } @@ -237,32 +246,35 @@ func (opts *GetLegacySnapshotOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetLegacySnapshotTemplate = "<>" +func GetLegacySnapshotBuilder() *cobra.Command { + const template = "<>" -func GetLegacySnapshotBuilder() cobra.Command { opts := GetLegacySnapshotOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Legacy Backup Snapshot", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetLegacySnapshotTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -270,7 +282,7 @@ func GetLegacySnapshotBuilder() cobra.Command { type GetLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -288,7 +300,7 @@ func (opts *GetLegacySnapshotScheduleOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { return err } @@ -296,30 +308,34 @@ func (opts *GetLegacySnapshotScheduleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetLegacySnapshotScheduleTemplate = "<>" +func GetLegacySnapshotScheduleBuilder() *cobra.Command { + const template = "<>" -func GetLegacySnapshotScheduleBuilder() cobra.Command { opts := GetLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Snapshot Schedule", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetLegacySnapshotScheduleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -327,7 +343,7 @@ func GetLegacySnapshotScheduleBuilder() cobra.Command { type ListLegacyBackupCheckpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -351,7 +367,7 @@ func (opts *ListLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params).Execute() if err != nil { return err } @@ -359,41 +375,42 @@ func (opts *ListLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListLegacyBackupCheckpointsTemplate = "<>" +func ListLegacyBackupCheckpointsBuilder() *cobra.Command { + const template = "<>" -func ListLegacyBackupCheckpointsBuilder() cobra.Command { opts := ListLegacyBackupCheckpointsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Legacy Backup Checkpoints", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListLegacyBackupCheckpointsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListLegacyBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -419,7 +436,7 @@ func (opts *ListLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { PageNum: opts.pageNum, BatchId: opts.batchId, } - resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } @@ -427,42 +444,42 @@ func (opts *ListLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListLegacyBackupRestoreJobsTemplate = "<>" +func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { + const template = "<>" -func ListLegacyBackupRestoreJobsBuilder() cobra.Command { opts := ListLegacyBackupRestoreJobsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Legacy Backup Restore Jobs", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListLegacyBackupRestoreJobsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.batchId, "batchId", , "Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.batchId, "batchId", "", "usage description") return cmd } type ListLegacySnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -488,7 +505,7 @@ func (opts *ListLegacySnapshotsOpts) Run(ctx context.Context) error { PageNum: opts.pageNum, Completed: opts.completed, } - resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params).Execute() if err != nil { return err } @@ -496,42 +513,42 @@ func (opts *ListLegacySnapshotsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListLegacySnapshotsTemplate = "<>" +func ListLegacySnapshotsBuilder() *cobra.Command { + const template = "<>" -func ListLegacySnapshotsBuilder() cobra.Command { opts := ListLegacySnapshotsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Legacy Backup Snapshots", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListLegacySnapshotsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.completed, "completed", "true", "Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.completed, "completed", "", "usage description") return cmd } type UpdateLegacySnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -551,7 +568,7 @@ func (opts *UpdateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() if err != nil { return err } @@ -559,32 +576,35 @@ func (opts *UpdateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateLegacySnapshotRetentionTemplate = "<>" +func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { + const template = "<>" -func UpdateLegacySnapshotRetentionBuilder() cobra.Command { opts := UpdateLegacySnapshotRetentionOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Change One Legacy Backup Snapshot Expiration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateLegacySnapshotRetentionTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -592,7 +612,7 @@ func UpdateLegacySnapshotRetentionBuilder() cobra.Command { type UpdateLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -610,7 +630,7 @@ func (opts *UpdateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { return err } @@ -618,30 +638,34 @@ func (opts *UpdateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateLegacySnapshotScheduleTemplate = "<>" +func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { + const template = "<>" -func UpdateLegacySnapshotScheduleBuilder() cobra.Command { opts := UpdateLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Snapshot Schedule for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateLegacySnapshotScheduleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 7ffa1eafba..0a0056954e 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -26,7 +26,7 @@ import ( type CreateLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -44,7 +44,7 @@ func (opts *CreateLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateLegacyBackupRestoreJobTemplate = "<>" +func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func CreateLegacyBackupRestoreJobBuilder() cobra.Command { opts := CreateLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Legacy Backup Restore Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateLegacyBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index 1b32c6aa24..c11bcd314b 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -26,7 +26,7 @@ import ( type DeferMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *DeferMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, } - _, err := opts.client.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(ctx, params) + _, err := opts.client.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *DeferMaintenanceWindowOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const DeferMaintenanceWindowTemplate = "<>" +func DeferMaintenanceWindowBuilder() *cobra.Command { + const template = "<>" -func DeferMaintenanceWindowBuilder() cobra.Command { opts := DeferMaintenanceWindowOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Defer One Maintenance Window for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeferMaintenanceWindowTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func DeferMaintenanceWindowBuilder() cobra.Command { type GetMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -95,7 +100,7 @@ func (opts *GetMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.MaintenanceWindowsApi.GetMaintenanceWindowWithParams(ctx, params) + resp, _, err := opts.client.MaintenanceWindowsApi.GetMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { return err } @@ -103,28 +108,33 @@ func (opts *GetMaintenanceWindowOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetMaintenanceWindowTemplate = "<>" +func GetMaintenanceWindowBuilder() *cobra.Command { + const template = "<>" -func GetMaintenanceWindowBuilder() cobra.Command { opts := GetMaintenanceWindowOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Maintenance Window for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetMaintenanceWindowTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -132,7 +142,7 @@ func GetMaintenanceWindowBuilder() cobra.Command { type ResetMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -148,7 +158,7 @@ func (opts *ResetMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params) + resp, _, err := opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { return err } @@ -156,28 +166,33 @@ func (opts *ResetMaintenanceWindowOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ResetMaintenanceWindowTemplate = "<>" +func ResetMaintenanceWindowBuilder() *cobra.Command { + const template = "<>" -func ResetMaintenanceWindowBuilder() cobra.Command { opts := ResetMaintenanceWindowOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Reset One Maintenance Window for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ResetMaintenanceWindowTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -185,7 +200,7 @@ func ResetMaintenanceWindowBuilder() cobra.Command { type ToggleMaintenanceAutoDeferOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -201,7 +216,7 @@ func (opts *ToggleMaintenanceAutoDeferOpts) Run(ctx context.Context) error { params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, } - _, err := opts.client.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(ctx, params) + _, err := opts.client.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(ctx, params).Execute() if err != nil { return err } @@ -209,28 +224,33 @@ func (opts *ToggleMaintenanceAutoDeferOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const ToggleMaintenanceAutoDeferTemplate = "<>" +func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { + const template = "<>" -func ToggleMaintenanceAutoDeferBuilder() cobra.Command { opts := ToggleMaintenanceAutoDeferOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Toggle Automatic Deferral of Maintenance for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ToggleMaintenanceAutoDeferTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -238,7 +258,7 @@ func ToggleMaintenanceAutoDeferBuilder() cobra.Command { type UpdateMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -254,7 +274,7 @@ func (opts *UpdateMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.UpdateMaintenanceWindowApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params) + resp, _, err := opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { return err } @@ -262,28 +282,33 @@ func (opts *UpdateMaintenanceWindowOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateMaintenanceWindowTemplate = "<>" +func UpdateMaintenanceWindowBuilder() *cobra.Command { + const template = "<>" -func UpdateMaintenanceWindowBuilder() cobra.Command { opts := UpdateMaintenanceWindowOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Maintenance Window for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateMaintenanceWindowTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index 5acb122ade..9f080e8f32 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -26,7 +26,7 @@ import ( type CreateUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient } func (opts *CreateUserOpts) initClient(ctx context.Context) func() error { @@ -40,7 +40,7 @@ func (opts *CreateUserOpts) initClient(ctx context.Context) func() error { func (opts *CreateUserOpts) Run(ctx context.Context) error { params := &admin.CreateUserApiParams{ } - resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params) + resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -48,21 +48,24 @@ func (opts *CreateUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateUserTemplate = "<>" +func CreateUserBuilder() *cobra.Command { + const template = "<>" -func CreateUserBuilder() cobra.Command { opts := CreateUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One MongoDB Cloud User", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { @@ -70,12 +73,15 @@ func CreateUserBuilder() cobra.Command { }, } + + + return cmd } type GetUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient userId string } @@ -91,7 +97,7 @@ func (opts *GetUserOpts) Run(ctx context.Context) error { params := &admin.GetUserApiParams{ UserId: opts.userId, } - resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserWithParams(ctx, params) + resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -99,28 +105,33 @@ func (opts *GetUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetUserTemplate = "<>" +func GetUserBuilder() *cobra.Command { + const template = "<>" -func GetUserBuilder() cobra.Command { opts := GetUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One MongoDB Cloud User using Its ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") + cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal digit string that identifies this user.") + + _ = cmd.MarkFlagRequired("userId") return cmd @@ -128,7 +139,7 @@ func GetUserBuilder() cobra.Command { type GetUserByUsernameOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient userName string } @@ -144,7 +155,7 @@ func (opts *GetUserByUsernameOpts) Run(ctx context.Context) error { params := &admin.GetUserByUsernameApiParams{ UserName: opts.userName, } - resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserByUsernameWithParams(ctx, params) + resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserByUsernameWithParams(ctx, params).Execute() if err != nil { return err } @@ -152,28 +163,33 @@ func (opts *GetUserByUsernameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetUserByUsernameTemplate = "<>" +func GetUserByUsernameBuilder() *cobra.Command { + const template = "<>" -func GetUserByUsernameBuilder() cobra.Command { opts := GetUserByUsernameOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One MongoDB Cloud User using Their Username", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetUserByUsernameTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.userName, "userName", "", "usage description") + cmd.Flags().StringVar(&opts.userName, "userName", , "Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.") + + _ = cmd.MarkFlagRequired("userName") return cmd diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index 5749fc290a..9c0028c99d 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -26,7 +26,7 @@ import ( type GetAtlasProcessOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string processId string } @@ -44,7 +44,7 @@ func (opts *GetAtlasProcessOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ProcessId: opts.processId, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetAtlasProcessWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetAtlasProcessWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *GetAtlasProcessOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetAtlasProcessTemplate = "<>" +func GetAtlasProcessBuilder() *cobra.Command { + const template = "<>" -func GetAtlasProcessBuilder() cobra.Command { opts := GetAtlasProcessOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One MongoDB Process by ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetAtlasProcessTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") return cmd @@ -83,7 +87,7 @@ func GetAtlasProcessBuilder() cobra.Command { type GetDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string databaseName string processId string @@ -103,7 +107,7 @@ func (opts *GetDatabaseOpts) Run(ctx context.Context) error { DatabaseName: opts.databaseName, ProcessId: opts.processId, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseWithParams(ctx, params).Execute() if err != nil { return err } @@ -111,32 +115,35 @@ func (opts *GetDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetDatabaseTemplate = "<>" +func GetDatabaseBuilder() *cobra.Command { + const template = "<>" -func GetDatabaseBuilder() cobra.Command { opts := GetDatabaseOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Database for a MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetDatabaseTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") _ = cmd.MarkFlagRequired("databaseName") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") return cmd @@ -144,7 +151,7 @@ func GetDatabaseBuilder() cobra.Command { type GetDatabaseMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string databaseName string processId string @@ -174,7 +181,7 @@ func (opts *GetDatabaseMeasurementsOpts) Run(ctx context.Context) error { Start: opts.start, End: opts.end, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } @@ -182,45 +189,44 @@ func (opts *GetDatabaseMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetDatabaseMeasurementsTemplate = "<>" +func GetDatabaseMeasurementsBuilder() *cobra.Command { + const template = "<>" -func GetDatabaseMeasurementsBuilder() cobra.Command { opts := GetDatabaseMeasurementsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Measurements of One Database for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetDatabaseMeasurementsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") _ = cmd.MarkFlagRequired("databaseName") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.m, "m", "", "usage description") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") - cmd.Flags().StringVar(&opts.period, "period", "", "usage description") - cmd.Flags().StringVar(&opts.start, "start", "", "usage description") - cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + _ = cmd.MarkFlagRequired("granularity") return cmd } type GetDiskMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string partitionName string processId string @@ -250,7 +256,7 @@ func (opts *GetDiskMeasurementsOpts) Run(ctx context.Context) error { Start: opts.start, End: opts.end, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } @@ -258,45 +264,44 @@ func (opts *GetDiskMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetDiskMeasurementsTemplate = "<>" +func GetDiskMeasurementsBuilder() *cobra.Command { + const template = "<>" -func GetDiskMeasurementsBuilder() cobra.Command { opts := GetDiskMeasurementsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Measurements of One Disk for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetDiskMeasurementsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "usage description") _ = cmd.MarkFlagRequired("partitionName") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.m, "m", "", "usage description") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") - cmd.Flags().StringVar(&opts.period, "period", "", "usage description") - cmd.Flags().StringVar(&opts.start, "start", "", "usage description") - cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + _ = cmd.MarkFlagRequired("granularity") return cmd } type GetHostLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string hostName string logName string @@ -320,7 +325,7 @@ func (opts *GetHostLogsOpts) Run(ctx context.Context) error { EndDate: opts.endDate, StartDate: opts.startDate, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetHostLogsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetHostLogsWithParams(ctx, params).Execute() if err != nil { return err } @@ -328,42 +333,43 @@ func (opts *GetHostLogsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetHostLogsTemplate = "<>" +func GetHostLogsBuilder() *cobra.Command { + const template = "<>" -func GetHostLogsBuilder() cobra.Command { opts := GetHostLogsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Download Logs for One Multi-Cloud Cluster Host in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetHostLogsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.hostName, "hostName", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") cmd.Flags().StringVar(&opts.logName, "logName", , "Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.") + cmd.Flags().StringVar(&opts.endDate, "endDate", , "Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") cmd.Flags().StringVar(&opts.startDate, "startDate", , "Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.hostName, "hostName", "", "usage description") _ = cmd.MarkFlagRequired("hostName") - cmd.Flags().StringVar(&opts.logName, "logName", "", "usage description") _ = cmd.MarkFlagRequired("logName") - cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") - cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") return cmd } type GetHostMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string processId string m []string @@ -391,7 +397,7 @@ func (opts *GetHostMeasurementsOpts) Run(ctx context.Context) error { Start: opts.start, End: opts.end, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetHostMeasurementsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetHostMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } @@ -399,43 +405,43 @@ func (opts *GetHostMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetHostMeasurementsTemplate = "<>" +func GetHostMeasurementsBuilder() *cobra.Command { + const template = "<>" -func GetHostMeasurementsBuilder() cobra.Command { opts := GetHostMeasurementsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Measurements for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetHostMeasurementsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.m, "m", "", "usage description") - cmd.Flags().StringVar(&opts.period, "period", "", "usage description") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") - cmd.Flags().StringVar(&opts.start, "start", "", "usage description") - cmd.Flags().StringVar(&opts.end, "end", "", "usage description") + _ = cmd.MarkFlagRequired("granularity") return cmd } type GetIndexMetricsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient processId string indexName string databaseName string @@ -469,7 +475,7 @@ func (opts *GetIndexMetricsOpts) Run(ctx context.Context) error { End: opts.end, Metrics: opts.metrics, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params).Execute() if err != nil { return err } @@ -477,49 +483,47 @@ func (opts *GetIndexMetricsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetIndexMetricsTemplate = "<>" +func GetIndexMetricsBuilder() *cobra.Command { + const template = "<>" -func GetIndexMetricsBuilder() cobra.Command { opts := GetIndexMetricsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetIndexMetricsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.indexName, "indexName", , "Human-readable label that identifies the index.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database.") cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Human-readable label that identifies the collection.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.indexName, "indexName", "", "usage description") _ = cmd.MarkFlagRequired("indexName") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") _ = cmd.MarkFlagRequired("databaseName") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") _ = cmd.MarkFlagRequired("collectionName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") - cmd.Flags().StringVar(&opts.period, "period", "", "usage description") - cmd.Flags().StringVar(&opts.start, "start", "", "usage description") - cmd.Flags().StringVar(&opts.end, "end", "", "usage description") - cmd.Flags().StringVar(&opts.metrics, "metrics", "", "usage description") + _ = cmd.MarkFlagRequired("granularity") + _ = cmd.MarkFlagRequired("metrics") return cmd } type GetMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient processId string groupId string granularity string @@ -547,7 +551,7 @@ func (opts *GetMeasurementsOpts) Run(ctx context.Context) error { End: opts.end, Metrics: opts.metrics, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } @@ -555,43 +559,44 @@ func (opts *GetMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetMeasurementsTemplate = "<>" +func GetMeasurementsBuilder() *cobra.Command { + const template = "<>" -func GetMeasurementsBuilder() cobra.Command { opts := GetMeasurementsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Atlas Search Hardware and Status Metrics", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetMeasurementsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") + _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") - cmd.Flags().StringVar(&opts.period, "period", "", "usage description") - cmd.Flags().StringVar(&opts.start, "start", "", "usage description") - cmd.Flags().StringVar(&opts.end, "end", "", "usage description") - cmd.Flags().StringVar(&opts.metrics, "metrics", "", "usage description") + _ = cmd.MarkFlagRequired("granularity") + _ = cmd.MarkFlagRequired("metrics") return cmd } type ListAtlasProcessesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -613,7 +618,7 @@ func (opts *ListAtlasProcessesOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListAtlasProcessesWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListAtlasProcessesWithParams(ctx, params).Execute() if err != nil { return err } @@ -621,39 +626,41 @@ func (opts *ListAtlasProcessesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListAtlasProcessesTemplate = "<>" +func ListAtlasProcessesBuilder() *cobra.Command { + const template = "<>" -func ListAtlasProcessesBuilder() cobra.Command { opts := ListAtlasProcessesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All MongoDB Processes in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListAtlasProcessesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListDatabasesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string processId string includeCount bool @@ -677,7 +684,7 @@ func (opts *ListDatabasesOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListDatabasesWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListDatabasesWithParams(ctx, params).Execute() if err != nil { return err } @@ -685,41 +692,42 @@ func (opts *ListDatabasesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListDatabasesTemplate = "<>" +func ListDatabasesBuilder() *cobra.Command { + const template = "<>" -func ListDatabasesBuilder() cobra.Command { opts := ListDatabasesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Available Databases for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListDatabasesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListDiskMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient partitionName string groupId string processId string @@ -739,7 +747,7 @@ func (opts *ListDiskMeasurementsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ProcessId: opts.processId, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } @@ -747,32 +755,35 @@ func (opts *ListDiskMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListDiskMeasurementsTemplate = "<>" +func ListDiskMeasurementsBuilder() *cobra.Command { + const template = "<>" -func ListDiskMeasurementsBuilder() cobra.Command { opts := ListDiskMeasurementsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Measurements of One Disk", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListDiskMeasurementsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "usage description") + cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + + _ = cmd.MarkFlagRequired("partitionName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") return cmd @@ -780,7 +791,7 @@ func ListDiskMeasurementsBuilder() cobra.Command { type ListDiskPartitionsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string processId string includeCount bool @@ -804,7 +815,7 @@ func (opts *ListDiskPartitionsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskPartitionsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskPartitionsWithParams(ctx, params).Execute() if err != nil { return err } @@ -812,41 +823,42 @@ func (opts *ListDiskPartitionsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListDiskPartitionsTemplate = "<>" +func ListDiskPartitionsBuilder() *cobra.Command { + const template = "<>" -func ListDiskPartitionsBuilder() cobra.Command { opts := ListDiskPartitionsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Available Disks for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListDiskPartitionsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListIndexMetricsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient processId string databaseName string collectionName string @@ -878,7 +890,7 @@ func (opts *ListIndexMetricsOpts) Run(ctx context.Context) error { End: opts.end, Metrics: opts.metrics, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params).Execute() if err != nil { return err } @@ -886,47 +898,46 @@ func (opts *ListIndexMetricsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListIndexMetricsTemplate = "<>" +func ListIndexMetricsBuilder() *cobra.Command { + const template = "<>" -func ListIndexMetricsBuilder() cobra.Command { opts := ListIndexMetricsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Atlas Search Index Metrics for One Namespace", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListIndexMetricsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database.") cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Human-readable label that identifies the collection.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "usage description") _ = cmd.MarkFlagRequired("databaseName") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "usage description") _ = cmd.MarkFlagRequired("collectionName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "usage description") - cmd.Flags().StringVar(&opts.period, "period", "", "usage description") - cmd.Flags().StringVar(&opts.start, "start", "", "usage description") - cmd.Flags().StringVar(&opts.end, "end", "", "usage description") - cmd.Flags().StringVar(&opts.metrics, "metrics", "", "usage description") + _ = cmd.MarkFlagRequired("granularity") + _ = cmd.MarkFlagRequired("metrics") return cmd } type ListMetricTypesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient processId string groupId string } @@ -944,7 +955,7 @@ func (opts *ListMetricTypesOpts) Run(ctx context.Context) error { ProcessId: opts.processId, GroupId: opts.groupId, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListMetricTypesWithParams(ctx, params) + resp, _, err := opts.client.MonitoringAndLogsApi.ListMetricTypesWithParams(ctx, params).Execute() if err != nil { return err } @@ -952,30 +963,34 @@ func (opts *ListMetricTypesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListMetricTypesTemplate = "<>" +func ListMetricTypesBuilder() *cobra.Command { + const template = "<>" -func ListMetricTypesBuilder() cobra.Command { opts := ListMetricTypesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Atlas Search Metric Types for One Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListMetricTypesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 6166db063c..53b5495e68 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -26,7 +26,7 @@ import ( type CreateClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *CreateClusterOpts) Run(ctx context.Context) error { params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.MultiCloudClustersApi.CreateClusterWithParams(ctx, params) + resp, _, err := opts.client.MultiCloudClustersApi.CreateClusterWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreateClusterOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateClusterTemplate = "<>" +func CreateClusterBuilder() *cobra.Command { + const template = "<>" -func CreateClusterBuilder() cobra.Command { opts := CreateClusterOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Multi-Cloud Cluster from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateClusterTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func CreateClusterBuilder() cobra.Command { type DeleteClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string retainBackups bool @@ -99,7 +104,7 @@ func (opts *DeleteClusterOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, RetainBackups: opts.retainBackups, } - _, err := opts.client.MultiCloudClustersApi.DeleteClusterWithParams(ctx, params) + _, err := opts.client.MultiCloudClustersApi.DeleteClusterWithParams(ctx, params).Execute() if err != nil { return err } @@ -107,39 +112,42 @@ func (opts *DeleteClusterOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const DeleteClusterTemplate = "<>" +func DeleteClusterBuilder() *cobra.Command { + const template = "<>" -func DeleteClusterBuilder() cobra.Command { opts := DeleteClusterOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Multi-Cloud Cluster from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteClusterTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.retainBackups, "retainBackups", , "Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.retainBackups, "retainBackups", "", "usage description") return cmd } type GetClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -157,7 +165,7 @@ func (opts *GetClusterOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.MultiCloudClustersApi.GetClusterWithParams(ctx, params) + resp, _, err := opts.client.MultiCloudClustersApi.GetClusterWithParams(ctx, params).Execute() if err != nil { return err } @@ -165,30 +173,34 @@ func (opts *GetClusterOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetClusterTemplate = "<>" +func GetClusterBuilder() *cobra.Command { + const template = "<>" -func GetClusterBuilder() cobra.Command { opts := GetClusterOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Multi-Cloud Cluster from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetClusterTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -196,7 +208,7 @@ func GetClusterBuilder() cobra.Command { type ListClustersOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -218,7 +230,7 @@ func (opts *ListClustersOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.MultiCloudClustersApi.ListClustersWithParams(ctx, params) + resp, _, err := opts.client.MultiCloudClustersApi.ListClustersWithParams(ctx, params).Execute() if err != nil { return err } @@ -226,39 +238,41 @@ func (opts *ListClustersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListClustersTemplate = "<>" +func ListClustersBuilder() *cobra.Command { + const template = "<>" -func ListClustersBuilder() cobra.Command { opts := ListClustersOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Multi-Cloud Clusters from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListClustersTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type TestFailoverOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -276,7 +290,7 @@ func (opts *TestFailoverOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - _, err := opts.client.MultiCloudClustersApi.TestFailoverWithParams(ctx, params) + _, err := opts.client.MultiCloudClustersApi.TestFailoverWithParams(ctx, params).Execute() if err != nil { return err } @@ -284,30 +298,34 @@ func (opts *TestFailoverOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const TestFailoverTemplate = "<>" +func TestFailoverBuilder() *cobra.Command { + const template = "<>" -func TestFailoverBuilder() cobra.Command { opts := TestFailoverOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Test Failover for One Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), TestFailoverTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -315,7 +333,7 @@ func TestFailoverBuilder() cobra.Command { type UpdateClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -333,7 +351,7 @@ func (opts *UpdateClusterOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.MultiCloudClustersApi.UpdateClusterWithParams(ctx, params) + resp, _, err := opts.client.MultiCloudClustersApi.UpdateClusterWithParams(ctx, params).Execute() if err != nil { return err } @@ -341,30 +359,34 @@ func (opts *UpdateClusterOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateClusterTemplate = "<>" +func UpdateClusterBuilder() *cobra.Command { + const template = "<>" -func UpdateClusterBuilder() cobra.Command { opts := UpdateClusterOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Modify One Multi-Cloud Cluster from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateClusterTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the advanced cluster to modify.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index dbdb07590f..7dd3c62580 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -26,7 +26,7 @@ import ( type CreatePeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *CreatePeeringConnectionOpts) Run(ctx context.Context) error { params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreatePeeringConnectionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreatePeeringConnectionTemplate = "<>" +func CreatePeeringConnectionBuilder() *cobra.Command { + const template = "<>" -func CreatePeeringConnectionBuilder() cobra.Command { opts := CreatePeeringConnectionOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One New Network Peering Connection", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreatePeeringConnectionTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func CreatePeeringConnectionBuilder() cobra.Command { type CreatePeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -95,7 +100,7 @@ func (opts *CreatePeeringContainerOpts) Run(ctx context.Context) error { params := &admin.CreatePeeringContainerApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } @@ -103,28 +108,33 @@ func (opts *CreatePeeringContainerOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreatePeeringContainerTemplate = "<>" +func CreatePeeringContainerBuilder() *cobra.Command { + const template = "<>" -func CreatePeeringContainerBuilder() cobra.Command { opts := CreatePeeringContainerOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One New Network Peering Container", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreatePeeringContainerTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -132,7 +142,7 @@ func CreatePeeringContainerBuilder() cobra.Command { type DeletePeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string peerId string } @@ -150,7 +160,7 @@ func (opts *DeletePeeringConnectionOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PeerId: opts.peerId, } - resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringConnectionWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } @@ -158,30 +168,34 @@ func (opts *DeletePeeringConnectionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeletePeeringConnectionTemplate = "<>" +func DeletePeeringConnectionBuilder() *cobra.Command { + const template = "<>" -func DeletePeeringConnectionBuilder() cobra.Command { opts := DeletePeeringConnectionOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Existing Network Peering Connection", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeletePeeringConnectionTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") _ = cmd.MarkFlagRequired("peerId") return cmd @@ -189,7 +203,7 @@ func DeletePeeringConnectionBuilder() cobra.Command { type DeletePeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string containerId string } @@ -207,7 +221,7 @@ func (opts *DeletePeeringContainerOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ContainerId: opts.containerId, } - resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringContainerWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } @@ -215,30 +229,34 @@ func (opts *DeletePeeringContainerOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeletePeeringContainerTemplate = "<>" +func DeletePeeringContainerBuilder() *cobra.Command { + const template = "<>" -func DeletePeeringContainerBuilder() cobra.Command { opts := DeletePeeringContainerOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Network Peering Container", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeletePeeringContainerTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") _ = cmd.MarkFlagRequired("containerId") return cmd @@ -246,7 +264,7 @@ func DeletePeeringContainerBuilder() cobra.Command { type DisablePeeringOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -262,7 +280,7 @@ func (opts *DisablePeeringOpts) Run(ctx context.Context) error { params := &admin.DisablePeeringApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params).Execute() if err != nil { return err } @@ -270,28 +288,33 @@ func (opts *DisablePeeringOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DisablePeeringTemplate = "<>" +func DisablePeeringBuilder() *cobra.Command { + const template = "<>" -func DisablePeeringBuilder() cobra.Command { opts := DisablePeeringOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Disable Connect via Peering Only Mode for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DisablePeeringTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -299,7 +322,7 @@ func DisablePeeringBuilder() cobra.Command { type GetPeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string peerId string } @@ -317,7 +340,7 @@ func (opts *GetPeeringConnectionOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PeerId: opts.peerId, } - resp, _, err := opts.client.NetworkPeeringApi.GetPeeringConnectionWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.GetPeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } @@ -325,30 +348,34 @@ func (opts *GetPeeringConnectionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetPeeringConnectionTemplate = "<>" +func GetPeeringConnectionBuilder() *cobra.Command { + const template = "<>" -func GetPeeringConnectionBuilder() cobra.Command { opts := GetPeeringConnectionOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Network Peering Connection in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetPeeringConnectionTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") _ = cmd.MarkFlagRequired("peerId") return cmd @@ -356,7 +383,7 @@ func GetPeeringConnectionBuilder() cobra.Command { type GetPeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string containerId string } @@ -374,7 +401,7 @@ func (opts *GetPeeringContainerOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ContainerId: opts.containerId, } - resp, _, err := opts.client.NetworkPeeringApi.GetPeeringContainerWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.GetPeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } @@ -382,30 +409,34 @@ func (opts *GetPeeringContainerOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetPeeringContainerTemplate = "<>" +func GetPeeringContainerBuilder() *cobra.Command { + const template = "<>" -func GetPeeringContainerBuilder() cobra.Command { opts := GetPeeringContainerOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Network Peering Container", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetPeeringContainerTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") _ = cmd.MarkFlagRequired("containerId") return cmd @@ -413,7 +444,7 @@ func GetPeeringContainerBuilder() cobra.Command { type ListPeeringConnectionsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -437,7 +468,7 @@ func (opts *ListPeeringConnectionsOpts) Run(ctx context.Context) error { PageNum: opts.pageNum, ProviderName: opts.providerName, } - resp, _, err := opts.client.NetworkPeeringApi.ListPeeringConnectionsWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringConnectionsWithParams(ctx, params).Execute() if err != nil { return err } @@ -445,40 +476,41 @@ func (opts *ListPeeringConnectionsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListPeeringConnectionsTemplate = "<>" +func ListPeeringConnectionsBuilder() *cobra.Command { + const template = "<>" -func ListPeeringConnectionsBuilder() cobra.Command { opts := ListPeeringConnectionsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Network Peering Connections in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPeeringConnectionsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider to use for this VPC peering connection.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.providerName, "providerName", "", "usage description") return cmd } type ListPeeringContainerByCloudProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -502,7 +534,7 @@ func (opts *ListPeeringContainerByCloudProviderOpts) Run(ctx context.Context) er PageNum: opts.pageNum, ProviderName: opts.providerName, } - resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params).Execute() if err != nil { return err } @@ -510,40 +542,42 @@ func (opts *ListPeeringContainerByCloudProviderOpts) Run(ctx context.Context) er return opts.Print(resp) } -const ListPeeringContainerByCloudProviderTemplate = "<>" +func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { + const template = "<>" -func ListPeeringContainerByCloudProviderBuilder() cobra.Command { opts := ListPeeringContainerByCloudProviderOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Network Peering Containers in One Project for One Cloud Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPeeringContainerByCloudProviderTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider that serves the desired network peering containers.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.providerName, "providerName", "", "usage description") + _ = cmd.MarkFlagRequired("providerName") return cmd } type ListPeeringContainersOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -565,7 +599,7 @@ func (opts *ListPeeringContainersOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainersWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainersWithParams(ctx, params).Execute() if err != nil { return err } @@ -573,39 +607,41 @@ func (opts *ListPeeringContainersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListPeeringContainersTemplate = "<>" +func ListPeeringContainersBuilder() *cobra.Command { + const template = "<>" -func ListPeeringContainersBuilder() cobra.Command { opts := ListPeeringContainersOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Network Peering Containers in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPeeringContainersTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type UpdatePeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string peerId string } @@ -623,7 +659,7 @@ func (opts *UpdatePeeringConnectionOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PeerId: opts.peerId, } - resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } @@ -631,30 +667,34 @@ func (opts *UpdatePeeringConnectionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdatePeeringConnectionTemplate = "<>" +func UpdatePeeringConnectionBuilder() *cobra.Command { + const template = "<>" -func UpdatePeeringConnectionBuilder() cobra.Command { opts := UpdatePeeringConnectionOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One New Network Peering Connection", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdatePeeringConnectionTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.peerId, "peerId", "", "usage description") _ = cmd.MarkFlagRequired("peerId") return cmd @@ -662,7 +702,7 @@ func UpdatePeeringConnectionBuilder() cobra.Command { type UpdatePeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string containerId string } @@ -680,7 +720,7 @@ func (opts *UpdatePeeringContainerOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ContainerId: opts.containerId, } - resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } @@ -688,30 +728,34 @@ func (opts *UpdatePeeringContainerOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdatePeeringContainerTemplate = "<>" +func UpdatePeeringContainerBuilder() *cobra.Command { + const template = "<>" -func UpdatePeeringContainerBuilder() cobra.Command { opts := UpdatePeeringContainerOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Network Peering Container", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdatePeeringContainerTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.containerId, "containerId", "", "usage description") _ = cmd.MarkFlagRequired("containerId") return cmd @@ -719,7 +763,7 @@ func UpdatePeeringContainerBuilder() cobra.Command { type VerifyConnectViaPeeringOnlyModeForOneProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -735,7 +779,7 @@ func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Co params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.NetworkPeeringApi.VerifyConnectViaPeeringOnlyModeForOneProjectWithParams(ctx, params) + resp, _, err := opts.client.NetworkPeeringApi.VerifyConnectViaPeeringOnlyModeForOneProjectWithParams(ctx, params).Execute() if err != nil { return err } @@ -743,28 +787,33 @@ func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Co return opts.Print(resp) } -const VerifyConnectViaPeeringOnlyModeForOneProjectTemplate = "<>" +func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { + const template = "<>" -func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() cobra.Command { opts := VerifyConnectViaPeeringOnlyModeForOneProjectOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Verify Connect via Peering Only Mode for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), VerifyConnectViaPeeringOnlyModeForOneProjectTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index cab40f26ca..6d2bc34aec 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -26,7 +26,7 @@ import ( type CreateOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -44,7 +44,7 @@ func (opts *CreateOnlineArchiveOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params) + resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateOnlineArchiveOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateOnlineArchiveTemplate = "<>" +func CreateOnlineArchiveBuilder() *cobra.Command { + const template = "<>" -func CreateOnlineArchiveBuilder() cobra.Command { opts := CreateOnlineArchiveOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Online Archive", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateOnlineArchiveTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -83,7 +87,7 @@ func CreateOnlineArchiveBuilder() cobra.Command { type DeleteOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string archiveId string clusterName string @@ -103,7 +107,7 @@ func (opts *DeleteOnlineArchiveOpts) Run(ctx context.Context) error { ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params) + resp, _, err := opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } @@ -111,32 +115,35 @@ func (opts *DeleteOnlineArchiveOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteOnlineArchiveTemplate = "<>" +func DeleteOnlineArchiveBuilder() *cobra.Command { + const template = "<>" -func DeleteOnlineArchiveBuilder() cobra.Command { opts := DeleteOnlineArchiveOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Online Archive", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteOnlineArchiveTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to delete.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") _ = cmd.MarkFlagRequired("archiveId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -144,7 +151,7 @@ func DeleteOnlineArchiveBuilder() cobra.Command { type DownloadOnlineArchiveQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string startDate int64 @@ -168,7 +175,7 @@ func (opts *DownloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { EndDate: opts.endDate, ArchiveOnly: opts.archiveOnly, } - resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params) + resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params).Execute() if err != nil { return err } @@ -176,41 +183,42 @@ func (opts *DownloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DownloadOnlineArchiveQueryLogsTemplate = "<>" +func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { + const template = "<>" -func DownloadOnlineArchiveQueryLogsBuilder() cobra.Command { opts := DownloadOnlineArchiveQueryLogsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Download Online Archive Query Logs", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DownloadOnlineArchiveQueryLogsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.") + cmd.Flags().StringVar(&opts.startDate, "startDate", , "Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") cmd.Flags().StringVar(&opts.endDate, "endDate", , "Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") cmd.Flags().StringVar(&opts.archiveOnly, "archiveOnly", false, "Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.startDate, "startDate", "", "usage description") - cmd.Flags().StringVar(&opts.endDate, "endDate", "", "usage description") - cmd.Flags().StringVar(&opts.archiveOnly, "archiveOnly", "", "usage description") return cmd } type GetOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string archiveId string clusterName string @@ -230,7 +238,7 @@ func (opts *GetOnlineArchiveOpts) Run(ctx context.Context) error { ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params) + resp, _, err := opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } @@ -238,32 +246,35 @@ func (opts *GetOnlineArchiveOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetOnlineArchiveTemplate = "<>" +func GetOnlineArchiveBuilder() *cobra.Command { + const template = "<>" -func GetOnlineArchiveBuilder() cobra.Command { opts := GetOnlineArchiveOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Online Archive", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetOnlineArchiveTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to return.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") _ = cmd.MarkFlagRequired("archiveId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -271,7 +282,7 @@ func GetOnlineArchiveBuilder() cobra.Command { type ListOnlineArchivesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string includeCount bool @@ -295,7 +306,7 @@ func (opts *ListOnlineArchivesOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params) + resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params).Execute() if err != nil { return err } @@ -303,41 +314,42 @@ func (opts *ListOnlineArchivesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListOnlineArchivesTemplate = "<>" +func ListOnlineArchivesBuilder() *cobra.Command { + const template = "<>" -func ListOnlineArchivesBuilder() cobra.Command { opts := ListOnlineArchivesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Online Archives for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListOnlineArchivesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type UpdateOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string archiveId string clusterName string @@ -357,7 +369,7 @@ func (opts *UpdateOnlineArchiveOpts) Run(ctx context.Context) error { ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params) + resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } @@ -365,32 +377,35 @@ func (opts *UpdateOnlineArchiveOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateOnlineArchiveTemplate = "<>" +func UpdateOnlineArchiveBuilder() *cobra.Command { + const template = "<>" -func UpdateOnlineArchiveBuilder() cobra.Command { opts := UpdateOnlineArchiveOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Online Archive", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateOnlineArchiveTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to update.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "usage description") _ = cmd.MarkFlagRequired("archiveId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 50b9ac2bc6..3841c2fc3e 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -26,7 +26,7 @@ import ( type CreateOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient } func (opts *CreateOrganizationOpts) initClient(ctx context.Context) func() error { @@ -40,7 +40,7 @@ func (opts *CreateOrganizationOpts) initClient(ctx context.Context) func() error func (opts *CreateOrganizationOpts) Run(ctx context.Context) error { params := &admin.CreateOrganizationApiParams{ } - resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params).Execute() if err != nil { return err } @@ -48,21 +48,24 @@ func (opts *CreateOrganizationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateOrganizationTemplate = "<>" +func CreateOrganizationBuilder() *cobra.Command { + const template = "<>" -func CreateOrganizationBuilder() cobra.Command { opts := CreateOrganizationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateOrganizationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { @@ -70,12 +73,15 @@ func CreateOrganizationBuilder() cobra.Command { }, } + + + return cmd } type CreateOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -91,7 +97,7 @@ func (opts *CreateOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } @@ -99,28 +105,33 @@ func (opts *CreateOrganizationInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateOrganizationInvitationTemplate = "<>" +func CreateOrganizationInvitationBuilder() *cobra.Command { + const template = "<>" -func CreateOrganizationInvitationBuilder() cobra.Command { opts := CreateOrganizationInvitationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateOrganizationInvitationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -128,7 +139,7 @@ func CreateOrganizationInvitationBuilder() cobra.Command { type DeleteOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -144,7 +155,7 @@ func (opts *DeleteOrganizationOpts) Run(ctx context.Context) error { params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationWithParams(ctx, params).Execute() if err != nil { return err } @@ -152,28 +163,33 @@ func (opts *DeleteOrganizationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteOrganizationTemplate = "<>" +func DeleteOrganizationBuilder() *cobra.Command { + const template = "<>" -func DeleteOrganizationBuilder() cobra.Command { opts := DeleteOrganizationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteOrganizationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -181,7 +197,7 @@ func DeleteOrganizationBuilder() cobra.Command { type DeleteOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string invitationId string } @@ -199,7 +215,7 @@ func (opts *DeleteOrganizationInvitationOpts) Run(ctx context.Context) error { OrgId: opts.orgId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } @@ -207,30 +223,34 @@ func (opts *DeleteOrganizationInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteOrganizationInvitationTemplate = "<>" +func DeleteOrganizationInvitationBuilder() *cobra.Command { + const template = "<>" -func DeleteOrganizationInvitationBuilder() cobra.Command { opts := DeleteOrganizationInvitationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Cancel One Organization Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteOrganizationInvitationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -238,7 +258,7 @@ func DeleteOrganizationInvitationBuilder() cobra.Command { type GetOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -254,7 +274,7 @@ func (opts *GetOrganizationOpts) Run(ctx context.Context) error { params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.GetOrganizationWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.GetOrganizationWithParams(ctx, params).Execute() if err != nil { return err } @@ -262,28 +282,33 @@ func (opts *GetOrganizationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetOrganizationTemplate = "<>" +func GetOrganizationBuilder() *cobra.Command { + const template = "<>" -func GetOrganizationBuilder() cobra.Command { opts := GetOrganizationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetOrganizationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -291,7 +316,7 @@ func GetOrganizationBuilder() cobra.Command { type GetOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string invitationId string } @@ -309,7 +334,7 @@ func (opts *GetOrganizationInvitationOpts) Run(ctx context.Context) error { OrgId: opts.orgId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } @@ -317,30 +342,34 @@ func (opts *GetOrganizationInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetOrganizationInvitationTemplate = "<>" +func GetOrganizationInvitationBuilder() *cobra.Command { + const template = "<>" -func GetOrganizationInvitationBuilder() cobra.Command { opts := GetOrganizationInvitationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Organization Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetOrganizationInvitationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -348,7 +377,7 @@ func GetOrganizationInvitationBuilder() cobra.Command { type GetOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -364,7 +393,7 @@ func (opts *GetOrganizationSettingsOpts) Run(ctx context.Context) error { params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.GetOrganizationSettingsWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.GetOrganizationSettingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -372,28 +401,33 @@ func (opts *GetOrganizationSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetOrganizationSettingsTemplate = "<>" +func GetOrganizationSettingsBuilder() *cobra.Command { + const template = "<>" -func GetOrganizationSettingsBuilder() cobra.Command { opts := GetOrganizationSettingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Settings for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetOrganizationSettingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -401,7 +435,7 @@ func GetOrganizationSettingsBuilder() cobra.Command { type ListOrganizationInvitationsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string username string } @@ -419,7 +453,7 @@ func (opts *ListOrganizationInvitationsOpts) Run(ctx context.Context) error { OrgId: opts.orgId, Username: opts.username, } - resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params).Execute() if err != nil { return err } @@ -427,37 +461,41 @@ func (opts *ListOrganizationInvitationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListOrganizationInvitationsTemplate = "<>" +func ListOrganizationInvitationsBuilder() *cobra.Command { + const template = "<>" -func ListOrganizationInvitationsBuilder() cobra.Command { opts := ListOrganizationInvitationsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Organization Invitations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListOrganizationInvitationsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.username, "username", , "Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.username, "username", "", "usage description") return cmd } type ListOrganizationProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string includeCount bool itemsPerPage int32 @@ -481,7 +519,7 @@ func (opts *ListOrganizationProjectsOpts) Run(ctx context.Context) error { PageNum: opts.pageNum, Name: opts.name, } - resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params).Execute() if err != nil { return err } @@ -489,40 +527,41 @@ func (opts *ListOrganizationProjectsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListOrganizationProjectsTemplate = "<>" +func ListOrganizationProjectsBuilder() *cobra.Command { + const template = "<>" -func ListOrganizationProjectsBuilder() cobra.Command { opts := ListOrganizationProjectsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One or More Projects in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListOrganizationProjectsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.name, "name", "", "usage description") return cmd } type ListOrganizationUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string includeCount bool itemsPerPage int32 @@ -544,7 +583,7 @@ func (opts *ListOrganizationUsersOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params).Execute() if err != nil { return err } @@ -552,39 +591,41 @@ func (opts *ListOrganizationUsersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListOrganizationUsersTemplate = "<>" +func ListOrganizationUsersBuilder() *cobra.Command { + const template = "<>" -func ListOrganizationUsersBuilder() cobra.Command { opts := ListOrganizationUsersOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All MongoDB Cloud Users in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListOrganizationUsersTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListOrganizationsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int32 pageNum int32 @@ -606,7 +647,7 @@ func (opts *ListOrganizationsOpts) Run(ctx context.Context) error { PageNum: opts.pageNum, Name: opts.name, } - resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params).Execute() if err != nil { return err } @@ -614,38 +655,40 @@ func (opts *ListOrganizationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListOrganizationsTemplate = "<>" +func ListOrganizationsBuilder() *cobra.Command { + const template = "<>" -func ListOrganizationsBuilder() cobra.Command { opts := ListOrganizationsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Organizations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListOrganizationsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.name, "name", "", "usage description") + + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.") + return cmd } type RenameOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -661,7 +704,7 @@ func (opts *RenameOrganizationOpts) Run(ctx context.Context) error { params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() if err != nil { return err } @@ -669,28 +712,33 @@ func (opts *RenameOrganizationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const RenameOrganizationTemplate = "<>" +func RenameOrganizationBuilder() *cobra.Command { + const template = "<>" -func RenameOrganizationBuilder() cobra.Command { opts := RenameOrganizationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Rename One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), RenameOrganizationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -698,7 +746,7 @@ func RenameOrganizationBuilder() cobra.Command { type UpdateOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -714,7 +762,7 @@ func (opts *UpdateOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } @@ -722,28 +770,33 @@ func (opts *UpdateOrganizationInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateOrganizationInvitationTemplate = "<>" +func UpdateOrganizationInvitationBuilder() *cobra.Command { + const template = "<>" -func UpdateOrganizationInvitationBuilder() cobra.Command { opts := UpdateOrganizationInvitationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Organization Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationInvitationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -751,7 +804,7 @@ func UpdateOrganizationInvitationBuilder() cobra.Command { type UpdateOrganizationInvitationByIdOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string invitationId string } @@ -769,7 +822,7 @@ func (opts *UpdateOrganizationInvitationByIdOpts) Run(ctx context.Context) error OrgId: opts.orgId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params).Execute() if err != nil { return err } @@ -777,30 +830,34 @@ func (opts *UpdateOrganizationInvitationByIdOpts) Run(ctx context.Context) error return opts.Print(resp) } -const UpdateOrganizationInvitationByIdTemplate = "<>" +func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { + const template = "<>" -func UpdateOrganizationInvitationByIdBuilder() cobra.Command { opts := UpdateOrganizationInvitationByIdOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Organization Invitation by Invitation ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationInvitationByIdTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -808,7 +865,7 @@ func UpdateOrganizationInvitationByIdBuilder() cobra.Command { type UpdateOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -824,7 +881,7 @@ func (opts *UpdateOrganizationSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params) + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -832,28 +889,33 @@ func (opts *UpdateOrganizationSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateOrganizationSettingsTemplate = "<>" +func UpdateOrganizationSettingsBuilder() *cobra.Command { + const template = "<>" -func UpdateOrganizationSettingsBuilder() cobra.Command { opts := UpdateOrganizationSettingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Settings for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateOrganizationSettingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index ad9e774624..4aa000cb13 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -26,7 +26,7 @@ import ( type DisableSlowOperationThresholdingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *DisableSlowOperationThresholdingOpts) Run(ctx context.Context) error params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } - _, err := opts.client.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(ctx, params) + _, err := opts.client.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *DisableSlowOperationThresholdingOpts) Run(ctx context.Context) error return opts.Print(nil) } -const DisableSlowOperationThresholdingTemplate = "<>" +func DisableSlowOperationThresholdingBuilder() *cobra.Command { + const template = "<>" -func DisableSlowOperationThresholdingBuilder() cobra.Command { opts := DisableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Disable Managed Slow Operation Threshold", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DisableSlowOperationThresholdingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func DisableSlowOperationThresholdingBuilder() cobra.Command { type EnableSlowOperationThresholdingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -95,7 +100,7 @@ func (opts *EnableSlowOperationThresholdingOpts) Run(ctx context.Context) error params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } - _, err := opts.client.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(ctx, params) + _, err := opts.client.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(ctx, params).Execute() if err != nil { return err } @@ -103,28 +108,33 @@ func (opts *EnableSlowOperationThresholdingOpts) Run(ctx context.Context) error return opts.Print(nil) } -const EnableSlowOperationThresholdingTemplate = "<>" +func EnableSlowOperationThresholdingBuilder() *cobra.Command { + const template = "<>" -func EnableSlowOperationThresholdingBuilder() cobra.Command { opts := EnableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Enable Managed Slow Operation Threshold", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), EnableSlowOperationThresholdingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -132,7 +142,7 @@ func EnableSlowOperationThresholdingBuilder() cobra.Command { type ListSlowQueriesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string processId string duration int64 @@ -158,7 +168,7 @@ func (opts *ListSlowQueriesOpts) Run(ctx context.Context) error { NLogs: opts.nLogs, Since: opts.since, } - resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueriesWithParams(ctx, params) + resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueriesWithParams(ctx, params).Execute() if err != nil { return err } @@ -166,42 +176,42 @@ func (opts *ListSlowQueriesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListSlowQueriesTemplate = "<>" +func ListSlowQueriesBuilder() *cobra.Command { + const template = "<>" -func ListSlowQueriesBuilder() cobra.Command { opts := ListSlowQueriesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Slow Queries", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListSlowQueriesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") cmd.Flags().StringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.duration, "duration", "", "usage description") - cmd.Flags().StringVar(&opts.namespaces, "namespaces", "", "usage description") - cmd.Flags().StringVar(&opts.nLogs, "nLogs", "", "usage description") - cmd.Flags().StringVar(&opts.since, "since", "", "usage description") return cmd } type ListSlowQueryNamespacesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string processId string duration int64 @@ -223,7 +233,7 @@ func (opts *ListSlowQueryNamespacesOpts) Run(ctx context.Context) error { Duration: opts.duration, Since: opts.since, } - resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(ctx, params) + resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(ctx, params).Execute() if err != nil { return err } @@ -231,40 +241,42 @@ func (opts *ListSlowQueryNamespacesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListSlowQueryNamespacesTemplate = "<>" +func ListSlowQueryNamespacesBuilder() *cobra.Command { + const template = "<>" -func ListSlowQueryNamespacesBuilder() cobra.Command { opts := ListSlowQueryNamespacesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Namespaces for One Host", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListSlowQueryNamespacesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.duration, "duration", "", "usage description") - cmd.Flags().StringVar(&opts.since, "since", "", "usage description") return cmd } type ListSuggestedIndexesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string processId string includeCount bool @@ -298,7 +310,7 @@ func (opts *ListSuggestedIndexesOpts) Run(ctx context.Context) error { NIndexes: opts.nIndexes, Since: opts.since, } - resp, _, err := opts.client.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(ctx, params) + resp, _, err := opts.client.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(ctx, params).Execute() if err != nil { return err } @@ -306,39 +318,35 @@ func (opts *ListSuggestedIndexesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListSuggestedIndexesTemplate = "<>" +func ListSuggestedIndexesBuilder() *cobra.Command { + const template = "<>" -func ListSuggestedIndexesBuilder() cobra.Command { opts := ListSuggestedIndexesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Suggested Indexes", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListSuggestedIndexesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") cmd.Flags().StringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") cmd.Flags().StringVar(&opts.nExamples, "nExamples", 5, "Maximum number of example queries that benefit from the suggested index.") cmd.Flags().StringVar(&opts.nIndexes, "nIndexes", , "Number that indicates the maximum indexes to suggest.") cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.processId, "processId", "", "usage description") _ = cmd.MarkFlagRequired("processId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.duration, "duration", "", "usage description") - cmd.Flags().StringVar(&opts.namespaces, "namespaces", "", "usage description") - cmd.Flags().StringVar(&opts.nExamples, "nExamples", "", "usage description") - cmd.Flags().StringVar(&opts.nIndexes, "nIndexes", "", "usage description") - cmd.Flags().StringVar(&opts.since, "since", "", "usage description") return cmd } diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index 8f092b4b9b..b29188b4f8 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -26,7 +26,7 @@ import ( type CreatePrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string cloudProvider string endpointServiceId string @@ -46,7 +46,7 @@ func (opts *CreatePrivateEndpointOpts) Run(ctx context.Context) error { CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -54,32 +54,35 @@ func (opts *CreatePrivateEndpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreatePrivateEndpointTemplate = "<>" +func CreatePrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func CreatePrivateEndpointBuilder() cobra.Command { opts := CreatePrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Private Endpoint for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreatePrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") _ = cmd.MarkFlagRequired("cloudProvider") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd @@ -87,7 +90,7 @@ func CreatePrivateEndpointBuilder() cobra.Command { type CreatePrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -103,7 +106,7 @@ func (opts *CreatePrivateEndpointServiceOpts) Run(ctx context.Context) error { params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { return err } @@ -111,28 +114,33 @@ func (opts *CreatePrivateEndpointServiceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreatePrivateEndpointServiceTemplate = "<>" +func CreatePrivateEndpointServiceBuilder() *cobra.Command { + const template = "<>" -func CreatePrivateEndpointServiceBuilder() cobra.Command { opts := CreatePrivateEndpointServiceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Private Endpoint Service for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreatePrivateEndpointServiceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -140,7 +148,7 @@ func CreatePrivateEndpointServiceBuilder() cobra.Command { type DeletePrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string cloudProvider string endpointId string @@ -162,7 +170,7 @@ func (opts *DeletePrivateEndpointOpts) Run(ctx context.Context) error { EndpointId: opts.endpointId, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -170,34 +178,36 @@ func (opts *DeletePrivateEndpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeletePrivateEndpointTemplate = "<>" +func DeletePrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func DeletePrivateEndpointBuilder() cobra.Command { opts := DeletePrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Private Endpoint for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeletePrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") _ = cmd.MarkFlagRequired("cloudProvider") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") _ = cmd.MarkFlagRequired("endpointId") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd @@ -205,7 +215,7 @@ func DeletePrivateEndpointBuilder() cobra.Command { type DeletePrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string cloudProvider string endpointServiceId string @@ -225,7 +235,7 @@ func (opts *DeletePrivateEndpointServiceOpts) Run(ctx context.Context) error { CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { return err } @@ -233,32 +243,35 @@ func (opts *DeletePrivateEndpointServiceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeletePrivateEndpointServiceTemplate = "<>" +func DeletePrivateEndpointServiceBuilder() *cobra.Command { + const template = "<>" -func DeletePrivateEndpointServiceBuilder() cobra.Command { opts := DeletePrivateEndpointServiceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Private Endpoint Service for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeletePrivateEndpointServiceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") _ = cmd.MarkFlagRequired("cloudProvider") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd @@ -266,7 +279,7 @@ func DeletePrivateEndpointServiceBuilder() cobra.Command { type GetPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string cloudProvider string endpointId string @@ -288,7 +301,7 @@ func (opts *GetPrivateEndpointOpts) Run(ctx context.Context) error { EndpointId: opts.endpointId, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -296,34 +309,36 @@ func (opts *GetPrivateEndpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetPrivateEndpointTemplate = "<>" +func GetPrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func GetPrivateEndpointBuilder() cobra.Command { opts := GetPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Private Endpoint for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetPrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") _ = cmd.MarkFlagRequired("cloudProvider") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") _ = cmd.MarkFlagRequired("endpointId") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd @@ -331,7 +346,7 @@ func GetPrivateEndpointBuilder() cobra.Command { type GetPrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string cloudProvider string endpointServiceId string @@ -351,7 +366,7 @@ func (opts *GetPrivateEndpointServiceOpts) Run(ctx context.Context) error { CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { return err } @@ -359,32 +374,35 @@ func (opts *GetPrivateEndpointServiceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetPrivateEndpointServiceTemplate = "<>" +func GetPrivateEndpointServiceBuilder() *cobra.Command { + const template = "<>" -func GetPrivateEndpointServiceBuilder() cobra.Command { opts := GetPrivateEndpointServiceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Private Endpoint Service for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetPrivateEndpointServiceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") _ = cmd.MarkFlagRequired("cloudProvider") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "usage description") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd @@ -392,7 +410,7 @@ func GetPrivateEndpointServiceBuilder() cobra.Command { type GetRegionalizedPrivateEndpointSettingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -408,7 +426,7 @@ func (opts *GetRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSettingWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() if err != nil { return err } @@ -416,28 +434,33 @@ func (opts *GetRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) return opts.Print(resp) } -const GetRegionalizedPrivateEndpointSettingTemplate = "<>" +func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { + const template = "<>" -func GetRegionalizedPrivateEndpointSettingBuilder() cobra.Command { opts := GetRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Regionalized Private Endpoint Status", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetRegionalizedPrivateEndpointSettingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -445,7 +468,7 @@ func GetRegionalizedPrivateEndpointSettingBuilder() cobra.Command { type ListPrivateEndpointServicesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string cloudProvider string } @@ -463,7 +486,7 @@ func (opts *ListPrivateEndpointServicesOpts) Run(ctx context.Context) error { GroupId: opts.groupId, CloudProvider: opts.cloudProvider, } - resp, _, err := opts.client.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(ctx, params).Execute() if err != nil { return err } @@ -471,30 +494,34 @@ func (opts *ListPrivateEndpointServicesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListPrivateEndpointServicesTemplate = "<>" +func ListPrivateEndpointServicesBuilder() *cobra.Command { + const template = "<>" -func ListPrivateEndpointServicesBuilder() cobra.Command { opts := ListPrivateEndpointServicesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Private Endpoint Services for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListPrivateEndpointServicesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "usage description") _ = cmd.MarkFlagRequired("cloudProvider") return cmd @@ -502,7 +529,7 @@ func ListPrivateEndpointServicesBuilder() cobra.Command { type ToggleRegionalizedPrivateEndpointSettingOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -518,7 +545,7 @@ func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Contex params := &admin.ToggleRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params) + resp, _, err := opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() if err != nil { return err } @@ -526,28 +553,33 @@ func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Contex return opts.Print(resp) } -const ToggleRegionalizedPrivateEndpointSettingTemplate = "<>" +func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { + const template = "<>" -func ToggleRegionalizedPrivateEndpointSettingBuilder() cobra.Command { opts := ToggleRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Toggle Regionalized Private Endpoint Status", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ToggleRegionalizedPrivateEndpointSettingTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 416da623c7..e9d60fafaf 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -26,7 +26,7 @@ import ( type AddProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string apiUserId string } @@ -44,7 +44,7 @@ func (opts *AddProjectApiKeyOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *AddProjectApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const AddProjectApiKeyTemplate = "<>" +func AddProjectApiKeyBuilder() *cobra.Command { + const template = "<>" -func AddProjectApiKeyBuilder() cobra.Command { opts := AddProjectApiKeyOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Assign One Organization API Key to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), AddProjectApiKeyTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -83,7 +87,7 @@ func AddProjectApiKeyBuilder() cobra.Command { type CreateApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -99,7 +103,7 @@ func (opts *CreateApiKeyOpts) Run(ctx context.Context) error { params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params).Execute() if err != nil { return err } @@ -107,28 +111,33 @@ func (opts *CreateApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateApiKeyTemplate = "<>" +func CreateApiKeyBuilder() *cobra.Command { + const template = "<>" -func CreateApiKeyBuilder() cobra.Command { opts := CreateApiKeyOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateApiKeyTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -136,7 +145,7 @@ func CreateApiKeyBuilder() cobra.Command { type CreateApiKeyAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string apiUserId string includeCount bool @@ -160,7 +169,7 @@ func (opts *CreateApiKeyAccessListOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params).Execute() if err != nil { return err } @@ -168,41 +177,42 @@ func (opts *CreateApiKeyAccessListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateApiKeyAccessListTemplate = "<>" +func CreateApiKeyAccessListBuilder() *cobra.Command { + const template = "<>" -func CreateApiKeyAccessListBuilder() cobra.Command { opts := CreateApiKeyAccessListOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create Access List Entries for One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateApiKeyAccessListTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type CreateProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -218,7 +228,7 @@ func (opts *CreateProjectApiKeyOpts) Run(ctx context.Context) error { params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params).Execute() if err != nil { return err } @@ -226,28 +236,33 @@ func (opts *CreateProjectApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateProjectApiKeyTemplate = "<>" +func CreateProjectApiKeyBuilder() *cobra.Command { + const template = "<>" -func CreateProjectApiKeyBuilder() cobra.Command { opts := CreateProjectApiKeyOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create and Assign One Organization API Key to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateProjectApiKeyTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -255,7 +270,7 @@ func CreateProjectApiKeyBuilder() cobra.Command { type DeleteApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string apiUserId string } @@ -273,7 +288,7 @@ func (opts *DeleteApiKeyOpts) Run(ctx context.Context) error { OrgId: opts.orgId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(ctx, params).Execute() if err != nil { return err } @@ -281,30 +296,34 @@ func (opts *DeleteApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteApiKeyTemplate = "<>" +func DeleteApiKeyBuilder() *cobra.Command { + const template = "<>" -func DeleteApiKeyBuilder() cobra.Command { opts := DeleteApiKeyOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteApiKeyTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -312,7 +331,7 @@ func DeleteApiKeyBuilder() cobra.Command { type DeleteApiKeyAccessListEntryOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string apiUserId string ipAddress string @@ -332,7 +351,7 @@ func (opts *DeleteApiKeyAccessListEntryOpts) Run(ctx context.Context) error { ApiUserId: opts.apiUserId, IpAddress: opts.ipAddress, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyAccessListEntryWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyAccessListEntryWithParams(ctx, params).Execute() if err != nil { return err } @@ -340,32 +359,35 @@ func (opts *DeleteApiKeyAccessListEntryOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteApiKeyAccessListEntryTemplate = "<>" +func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { + const template = "<>" -func DeleteApiKeyAccessListEntryBuilder() cobra.Command { opts := DeleteApiKeyAccessListEntryOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Access List Entry for One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteApiKeyAccessListEntryTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") _ = cmd.MarkFlagRequired("ipAddress") return cmd @@ -373,7 +395,7 @@ func DeleteApiKeyAccessListEntryBuilder() cobra.Command { type GetApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string apiUserId string } @@ -391,7 +413,7 @@ func (opts *GetApiKeyOpts) Run(ctx context.Context) error { OrgId: opts.orgId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyWithParams(ctx, params).Execute() if err != nil { return err } @@ -399,30 +421,34 @@ func (opts *GetApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetApiKeyTemplate = "<>" +func GetApiKeyBuilder() *cobra.Command { + const template = "<>" -func GetApiKeyBuilder() cobra.Command { opts := GetApiKeyOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetApiKeyTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -430,7 +456,7 @@ func GetApiKeyBuilder() cobra.Command { type GetApiKeyAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string ipAddress string apiUserId string @@ -450,7 +476,7 @@ func (opts *GetApiKeyAccessListOpts) Run(ctx context.Context) error { IpAddress: opts.ipAddress, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyAccessListWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyAccessListWithParams(ctx, params).Execute() if err != nil { return err } @@ -458,32 +484,35 @@ func (opts *GetApiKeyAccessListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetApiKeyAccessListTemplate = "<>" +func GetApiKeyAccessListBuilder() *cobra.Command { + const template = "<>" -func GetApiKeyAccessListBuilder() cobra.Command { opts := GetApiKeyAccessListOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Access List Entry for One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetApiKeyAccessListTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "usage description") _ = cmd.MarkFlagRequired("ipAddress") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -491,7 +520,7 @@ func GetApiKeyAccessListBuilder() cobra.Command { type ListApiKeyAccessListsEntriesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string apiUserId string includeCount bool @@ -515,7 +544,7 @@ func (opts *ListApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(ctx, params).Execute() if err != nil { return err } @@ -523,41 +552,42 @@ func (opts *ListApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListApiKeyAccessListsEntriesTemplate = "<>" +func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { + const template = "<>" -func ListApiKeyAccessListsEntriesBuilder() cobra.Command { opts := ListApiKeyAccessListsEntriesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Access List Entries for One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListApiKeyAccessListsEntriesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListApiKeysOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string includeCount bool itemsPerPage int32 @@ -579,7 +609,7 @@ func (opts *ListApiKeysOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeysWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeysWithParams(ctx, params).Execute() if err != nil { return err } @@ -587,39 +617,41 @@ func (opts *ListApiKeysOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListApiKeysTemplate = "<>" +func ListApiKeysBuilder() *cobra.Command { + const template = "<>" -func ListApiKeysBuilder() cobra.Command { opts := ListApiKeysOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Organization API Keys", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListApiKeysTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListProjectApiKeysOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -641,7 +673,7 @@ func (opts *ListProjectApiKeysOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(ctx, params).Execute() if err != nil { return err } @@ -649,39 +681,41 @@ func (opts *ListProjectApiKeysOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListProjectApiKeysTemplate = "<>" +func ListProjectApiKeysBuilder() *cobra.Command { + const template = "<>" -func ListProjectApiKeysBuilder() cobra.Command { opts := ListProjectApiKeysOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Organization API Keys Assigned to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListProjectApiKeysTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type RemoveProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string apiUserId string } @@ -699,7 +733,7 @@ func (opts *RemoveProjectApiKeyOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(ctx, params).Execute() if err != nil { return err } @@ -707,30 +741,34 @@ func (opts *RemoveProjectApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const RemoveProjectApiKeyTemplate = "<>" +func RemoveProjectApiKeyBuilder() *cobra.Command { + const template = "<>" -func RemoveProjectApiKeyBuilder() cobra.Command { opts := RemoveProjectApiKeyOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Unassign One Organization API Key from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), RemoveProjectApiKeyTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -738,7 +776,7 @@ func RemoveProjectApiKeyBuilder() cobra.Command { type UpdateApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string apiUserId string } @@ -756,7 +794,7 @@ func (opts *UpdateApiKeyOpts) Run(ctx context.Context) error { OrgId: opts.orgId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params).Execute() if err != nil { return err } @@ -764,30 +802,34 @@ func (opts *UpdateApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateApiKeyTemplate = "<>" +func UpdateApiKeyBuilder() *cobra.Command { + const template = "<>" -func UpdateApiKeyBuilder() cobra.Command { opts := UpdateApiKeyOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateApiKeyTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key you want to update.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -795,7 +837,7 @@ func UpdateApiKeyBuilder() cobra.Command { type UpdateApiKeyRolesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string apiUserId string pageNum int32 @@ -819,7 +861,7 @@ func (opts *UpdateApiKeyRolesOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, IncludeCount: opts.includeCount, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params) + resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params).Execute() if err != nil { return err } @@ -827,34 +869,35 @@ func (opts *UpdateApiKeyRolesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateApiKeyRolesTemplate = "<>" +func UpdateApiKeyRolesBuilder() *cobra.Command { + const template = "<>" -func UpdateApiKeyRolesBuilder() cobra.Command { opts := UpdateApiKeyRolesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Roles of One Organization API Key to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateApiKeyRolesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "usage description") _ = cmd.MarkFlagRequired("apiUserId") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") return cmd } diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 220ed2ab8e..a0bba2a83a 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -26,7 +26,7 @@ import ( type CreateProjectIpAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -48,7 +48,7 @@ func (opts *CreateProjectIpAccessListOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params) + resp, _, err := opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params).Execute() if err != nil { return err } @@ -56,39 +56,41 @@ func (opts *CreateProjectIpAccessListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateProjectIpAccessListTemplate = "<>" +func CreateProjectIpAccessListBuilder() *cobra.Command { + const template = "<>" -func CreateProjectIpAccessListBuilder() cobra.Command { opts := CreateProjectIpAccessListOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Add Entries to Project IP Access List", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateProjectIpAccessListTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type DeleteProjectIpAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string entryValue string } @@ -106,7 +108,7 @@ func (opts *DeleteProjectIpAccessListOpts) Run(ctx context.Context) error { GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.client.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(ctx, params) + resp, _, err := opts.client.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(ctx, params).Execute() if err != nil { return err } @@ -114,30 +116,34 @@ func (opts *DeleteProjectIpAccessListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteProjectIpAccessListTemplate = "<>" +func DeleteProjectIpAccessListBuilder() *cobra.Command { + const template = "<>" -func DeleteProjectIpAccessListBuilder() cobra.Command { opts := DeleteProjectIpAccessListOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Entry from One Project IP Access List", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteProjectIpAccessListTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: - how your application established the connection, - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") _ = cmd.MarkFlagRequired("entryValue") return cmd @@ -145,7 +151,7 @@ func DeleteProjectIpAccessListBuilder() cobra.Command { type GetProjectIpAccessListStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string entryValue string } @@ -163,7 +169,7 @@ func (opts *GetProjectIpAccessListStatusOpts) Run(ctx context.Context) error { GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(ctx, params) + resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(ctx, params).Execute() if err != nil { return err } @@ -171,30 +177,34 @@ func (opts *GetProjectIpAccessListStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetProjectIpAccessListStatusTemplate = "<>" +func GetProjectIpAccessListStatusBuilder() *cobra.Command { + const template = "<>" -func GetProjectIpAccessListStatusBuilder() cobra.Command { opts := GetProjectIpAccessListStatusOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Status of One Project IP Access List Entry", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetProjectIpAccessListStatusTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Network address or cloud provider security construct that identifies which project access list entry to be verified.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") _ = cmd.MarkFlagRequired("entryValue") return cmd @@ -202,7 +212,7 @@ func GetProjectIpAccessListStatusBuilder() cobra.Command { type GetProjectIpListOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string entryValue string } @@ -220,7 +230,7 @@ func (opts *GetProjectIpListOpts) Run(ctx context.Context) error { GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpListWithParams(ctx, params) + resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpListWithParams(ctx, params).Execute() if err != nil { return err } @@ -228,30 +238,34 @@ func (opts *GetProjectIpListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetProjectIpListTemplate = "<>" +func GetProjectIpListBuilder() *cobra.Command { + const template = "<>" -func GetProjectIpListBuilder() cobra.Command { opts := GetProjectIpListOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Project IP Access List Entry", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetProjectIpListTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "usage description") _ = cmd.MarkFlagRequired("entryValue") return cmd @@ -259,7 +273,7 @@ func GetProjectIpListBuilder() cobra.Command { type ListProjectIpAccessListsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -281,7 +295,7 @@ func (opts *ListProjectIpAccessListsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(ctx, params) + resp, _, err := opts.client.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(ctx, params).Execute() if err != nil { return err } @@ -289,32 +303,34 @@ func (opts *ListProjectIpAccessListsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListProjectIpAccessListsTemplate = "<>" +func ListProjectIpAccessListsBuilder() *cobra.Command { + const template = "<>" -func ListProjectIpAccessListsBuilder() cobra.Command { opts := ListProjectIpAccessListsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return Project IP Access List", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListProjectIpAccessListsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 9da520f9bd..fda25319f7 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -26,7 +26,7 @@ import ( type CreateProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient projectOwnerId string } @@ -42,7 +42,7 @@ func (opts *CreateProjectOpts) Run(ctx context.Context) error { params := &admin.CreateProjectApiParams{ ProjectOwnerId: opts.projectOwnerId, } - resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,35 +50,40 @@ func (opts *CreateProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateProjectTemplate = "<>" +func CreateProjectBuilder() *cobra.Command { + const template = "<>" -func CreateProjectBuilder() cobra.Command { opts := CreateProjectOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateProjectTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", "usage description") + + cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. ") + return cmd } type CreateProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -94,7 +99,7 @@ func (opts *CreateProjectInvitationOpts) Run(ctx context.Context) error { params := &admin.CreateProjectInvitationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } @@ -102,28 +107,33 @@ func (opts *CreateProjectInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateProjectInvitationTemplate = "<>" +func CreateProjectInvitationBuilder() *cobra.Command { + const template = "<>" -func CreateProjectInvitationBuilder() cobra.Command { opts := CreateProjectInvitationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Invite One MongoDB Cloud User to Join One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateProjectInvitationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -131,7 +141,7 @@ func CreateProjectInvitationBuilder() cobra.Command { type DeleteProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -147,7 +157,7 @@ func (opts *DeleteProjectOpts) Run(ctx context.Context) error { params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.DeleteProjectWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.DeleteProjectWithParams(ctx, params).Execute() if err != nil { return err } @@ -155,28 +165,33 @@ func (opts *DeleteProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteProjectTemplate = "<>" +func DeleteProjectBuilder() *cobra.Command { + const template = "<>" -func DeleteProjectBuilder() cobra.Command { opts := DeleteProjectOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteProjectTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -184,7 +199,7 @@ func DeleteProjectBuilder() cobra.Command { type DeleteProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string invitationId string } @@ -202,7 +217,7 @@ func (opts *DeleteProjectInvitationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.ProjectsApi.DeleteProjectInvitationWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.DeleteProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } @@ -210,30 +225,34 @@ func (opts *DeleteProjectInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteProjectInvitationTemplate = "<>" +func DeleteProjectInvitationBuilder() *cobra.Command { + const template = "<>" -func DeleteProjectInvitationBuilder() cobra.Command { opts := DeleteProjectInvitationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Cancel One Project Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteProjectInvitationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -241,7 +260,7 @@ func DeleteProjectInvitationBuilder() cobra.Command { type DeleteProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient limitName string groupId string } @@ -259,7 +278,7 @@ func (opts *DeleteProjectLimitOpts) Run(ctx context.Context) error { LimitName: opts.limitName, GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.DeleteProjectLimitWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.DeleteProjectLimitWithParams(ctx, params).Execute() if err != nil { return err } @@ -267,30 +286,34 @@ func (opts *DeleteProjectLimitOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteProjectLimitTemplate = "<>" +func DeleteProjectLimitBuilder() *cobra.Command { + const template = "<>" -func DeleteProjectLimitBuilder() cobra.Command { opts := DeleteProjectLimitOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Project Limit", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteProjectLimitTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("limitName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -298,7 +321,7 @@ func DeleteProjectLimitBuilder() cobra.Command { type GetProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -314,7 +337,7 @@ func (opts *GetProjectOpts) Run(ctx context.Context) error { params := &admin.GetProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.GetProjectWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.GetProjectWithParams(ctx, params).Execute() if err != nil { return err } @@ -322,28 +345,33 @@ func (opts *GetProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetProjectTemplate = "<>" +func GetProjectBuilder() *cobra.Command { + const template = "<>" -func GetProjectBuilder() cobra.Command { opts := GetProjectOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetProjectTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -351,7 +379,7 @@ func GetProjectBuilder() cobra.Command { type GetProjectByNameOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupName string } @@ -367,7 +395,7 @@ func (opts *GetProjectByNameOpts) Run(ctx context.Context) error { params := &admin.GetProjectByNameApiParams{ GroupName: opts.groupName, } - resp, _, err := opts.client.ProjectsApi.GetProjectByNameWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.GetProjectByNameWithParams(ctx, params).Execute() if err != nil { return err } @@ -375,28 +403,33 @@ func (opts *GetProjectByNameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetProjectByNameTemplate = "<>" +func GetProjectByNameBuilder() *cobra.Command { + const template = "<>" -func GetProjectByNameBuilder() cobra.Command { opts := GetProjectByNameOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Project using Its Name", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetProjectByNameTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupName, "groupName", "", "usage description") + cmd.Flags().StringVar(&opts.groupName, "groupName", , "Human-readable label that identifies this project.") + + _ = cmd.MarkFlagRequired("groupName") return cmd @@ -404,7 +437,7 @@ func GetProjectByNameBuilder() cobra.Command { type GetProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string invitationId string } @@ -422,7 +455,7 @@ func (opts *GetProjectInvitationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.ProjectsApi.GetProjectInvitationWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.GetProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } @@ -430,30 +463,34 @@ func (opts *GetProjectInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetProjectInvitationTemplate = "<>" +func GetProjectInvitationBuilder() *cobra.Command { + const template = "<>" -func GetProjectInvitationBuilder() cobra.Command { opts := GetProjectInvitationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Project Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetProjectInvitationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -461,7 +498,7 @@ func GetProjectInvitationBuilder() cobra.Command { type GetProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient limitName string groupId string } @@ -479,7 +516,7 @@ func (opts *GetProjectLimitOpts) Run(ctx context.Context) error { LimitName: opts.limitName, GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.GetProjectLimitWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.GetProjectLimitWithParams(ctx, params).Execute() if err != nil { return err } @@ -487,30 +524,34 @@ func (opts *GetProjectLimitOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetProjectLimitTemplate = "<>" +func GetProjectLimitBuilder() *cobra.Command { + const template = "<>" -func GetProjectLimitBuilder() cobra.Command { opts := GetProjectLimitOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Limit for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetProjectLimitTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("limitName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -518,7 +559,7 @@ func GetProjectLimitBuilder() cobra.Command { type GetProjectSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -534,7 +575,7 @@ func (opts *GetProjectSettingsOpts) Run(ctx context.Context) error { params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.GetProjectSettingsWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.GetProjectSettingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -542,28 +583,33 @@ func (opts *GetProjectSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetProjectSettingsTemplate = "<>" +func GetProjectSettingsBuilder() *cobra.Command { + const template = "<>" -func GetProjectSettingsBuilder() cobra.Command { opts := GetProjectSettingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Project Settings", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetProjectSettingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -571,7 +617,7 @@ func GetProjectSettingsBuilder() cobra.Command { type ListProjectInvitationsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string username string } @@ -589,7 +635,7 @@ func (opts *ListProjectInvitationsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Username: opts.username, } - resp, _, err := opts.client.ProjectsApi.ListProjectInvitationsWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.ListProjectInvitationsWithParams(ctx, params).Execute() if err != nil { return err } @@ -597,37 +643,41 @@ func (opts *ListProjectInvitationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListProjectInvitationsTemplate = "<>" +func ListProjectInvitationsBuilder() *cobra.Command { + const template = "<>" -func ListProjectInvitationsBuilder() cobra.Command { opts := ListProjectInvitationsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Project Invitations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListProjectInvitationsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.username, "username", , "Email address of the user account invited to this project.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.username, "username", "", "usage description") return cmd } type ListProjectLimitsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -643,7 +693,7 @@ func (opts *ListProjectLimitsOpts) Run(ctx context.Context) error { params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.ListProjectLimitsWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.ListProjectLimitsWithParams(ctx, params).Execute() if err != nil { return err } @@ -651,28 +701,33 @@ func (opts *ListProjectLimitsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListProjectLimitsTemplate = "<>" +func ListProjectLimitsBuilder() *cobra.Command { + const template = "<>" -func ListProjectLimitsBuilder() cobra.Command { opts := ListProjectLimitsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Limits for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListProjectLimitsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -680,7 +735,7 @@ func ListProjectLimitsBuilder() cobra.Command { type ListProjectUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -706,7 +761,7 @@ func (opts *ListProjectUsersOpts) Run(ctx context.Context) error { FlattenTeams: opts.flattenTeams, IncludeOrgUsers: opts.includeOrgUsers, } - resp, _, err := opts.client.ProjectsApi.ListProjectUsersWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.ListProjectUsersWithParams(ctx, params).Execute() if err != nil { return err } @@ -714,41 +769,41 @@ func (opts *ListProjectUsersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListProjectUsersTemplate = "<>" +func ListProjectUsersBuilder() *cobra.Command { + const template = "<>" -func ListProjectUsersBuilder() cobra.Command { opts := ListProjectUsersOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Users in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListProjectUsersTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.flattenTeams, "flattenTeams", false, "Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `\"flattenTeams\" : false`, this resource returns only users with a role in the project. If `\"flattenTeams\" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.") cmd.Flags().StringVar(&opts.includeOrgUsers, "includeOrgUsers", false, "Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `\"includeOrgUsers\": false`, this resource returns only users with a role in the project. If `\"includeOrgUsers\": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") - cmd.Flags().StringVar(&opts.flattenTeams, "flattenTeams", "", "usage description") - cmd.Flags().StringVar(&opts.includeOrgUsers, "includeOrgUsers", "", "usage description") return cmd } type ListProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int32 pageNum int32 @@ -768,7 +823,7 @@ func (opts *ListProjectsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ProjectsApi.ListProjectsWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.ListProjectsWithParams(ctx, params).Execute() if err != nil { return err } @@ -776,37 +831,40 @@ func (opts *ListProjectsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListProjectsTemplate = "<>" +func ListProjectsBuilder() *cobra.Command { + const template = "<>" -func ListProjectsBuilder() cobra.Command { opts := ListProjectsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Projects", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListProjectsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") + + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + return cmd } type RemoveProjectUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string userId string } @@ -824,7 +882,7 @@ func (opts *RemoveProjectUserOpts) Run(ctx context.Context) error { GroupId: opts.groupId, UserId: opts.userId, } - _, err := opts.client.ProjectsApi.RemoveProjectUserWithParams(ctx, params) + _, err := opts.client.ProjectsApi.RemoveProjectUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -832,30 +890,34 @@ func (opts *RemoveProjectUserOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const RemoveProjectUserTemplate = "<>" +func RemoveProjectUserBuilder() *cobra.Command { + const template = "<>" -func RemoveProjectUserBuilder() cobra.Command { opts := RemoveProjectUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One User from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), RemoveProjectUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") _ = cmd.MarkFlagRequired("userId") return cmd @@ -863,7 +925,7 @@ func RemoveProjectUserBuilder() cobra.Command { type SetProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient limitName string groupId string } @@ -881,7 +943,7 @@ func (opts *SetProjectLimitOpts) Run(ctx context.Context) error { LimitName: opts.limitName, GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params).Execute() if err != nil { return err } @@ -889,30 +951,34 @@ func (opts *SetProjectLimitOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const SetProjectLimitTemplate = "<>" +func SetProjectLimitBuilder() *cobra.Command { + const template = "<>" -func SetProjectLimitBuilder() cobra.Command { opts := SetProjectLimitOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Set One Project Limit", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), SetProjectLimitTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "usage description") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("limitName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -920,7 +986,7 @@ func SetProjectLimitBuilder() cobra.Command { type UpdateProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -936,7 +1002,7 @@ func (opts *UpdateProjectOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params).Execute() if err != nil { return err } @@ -944,28 +1010,33 @@ func (opts *UpdateProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateProjectTemplate = "<>" +func UpdateProjectBuilder() *cobra.Command { + const template = "<>" -func UpdateProjectBuilder() cobra.Command { opts := UpdateProjectOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Project Name", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateProjectTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -973,7 +1044,7 @@ func UpdateProjectBuilder() cobra.Command { type UpdateProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -989,7 +1060,7 @@ func (opts *UpdateProjectInvitationOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectInvitationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } @@ -997,28 +1068,33 @@ func (opts *UpdateProjectInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateProjectInvitationTemplate = "<>" +func UpdateProjectInvitationBuilder() *cobra.Command { + const template = "<>" -func UpdateProjectInvitationBuilder() cobra.Command { opts := UpdateProjectInvitationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Project Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateProjectInvitationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1026,7 +1102,7 @@ func UpdateProjectInvitationBuilder() cobra.Command { type UpdateProjectInvitationByIdOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string invitationId string } @@ -1044,7 +1120,7 @@ func (opts *UpdateProjectInvitationByIdOpts) Run(ctx context.Context) error { GroupId: opts.groupId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params).Execute() if err != nil { return err } @@ -1052,30 +1128,34 @@ func (opts *UpdateProjectInvitationByIdOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateProjectInvitationByIdTemplate = "<>" +func UpdateProjectInvitationByIdBuilder() *cobra.Command { + const template = "<>" -func UpdateProjectInvitationByIdBuilder() cobra.Command { opts := UpdateProjectInvitationByIdOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Project Invitation by Invitation ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateProjectInvitationByIdTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "usage description") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -1083,7 +1163,7 @@ func UpdateProjectInvitationByIdBuilder() cobra.Command { type UpdateProjectSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -1099,7 +1179,7 @@ func (opts *UpdateProjectSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params) + resp, _, err := opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params).Execute() if err != nil { return err } @@ -1107,28 +1187,33 @@ func (opts *UpdateProjectSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateProjectSettingsTemplate = "<>" +func UpdateProjectSettingsBuilder() *cobra.Command { + const template = "<>" -func UpdateProjectSettingsBuilder() cobra.Command { opts := UpdateProjectSettingsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Project Settings", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateProjectSettingsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index 385fca5416..a973012407 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -26,7 +26,7 @@ import ( type CreateRollingIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -44,7 +44,7 @@ func (opts *CreateRollingIndexOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params) + _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateRollingIndexOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const CreateRollingIndexTemplate = "<>" +func CreateRollingIndexBuilder() *cobra.Command { + const template = "<>" -func CreateRollingIndexBuilder() cobra.Command { opts := CreateRollingIndexOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Rolling Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateRollingIndexTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index b18b614473..03e5a3d299 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -26,7 +26,7 @@ import ( type GetSystemStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient } func (opts *GetSystemStatusOpts) initClient(ctx context.Context) func() error { @@ -40,7 +40,7 @@ func (opts *GetSystemStatusOpts) initClient(ctx context.Context) func() error { func (opts *GetSystemStatusOpts) Run(ctx context.Context) error { params := &admin.GetSystemStatusApiParams{ } - resp, _, err := opts.client.RootApi.GetSystemStatusWithParams(ctx, params) + resp, _, err := opts.client.RootApi.GetSystemStatusWithParams(ctx, params).Execute() if err != nil { return err } @@ -48,21 +48,24 @@ func (opts *GetSystemStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetSystemStatusTemplate = "<>" +func GetSystemStatusBuilder() *cobra.Command { + const template = "<>" -func GetSystemStatusBuilder() cobra.Command { opts := GetSystemStatusOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return the status of this MongoDB application", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetSystemStatusTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { @@ -70,5 +73,8 @@ func GetSystemStatusBuilder() cobra.Command { }, } + + + return cmd } diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index 0cbb134761..c231c210c3 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -26,7 +26,7 @@ import ( type CreateServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *CreateServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params) + resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *CreateServerlessInstanceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateServerlessInstanceTemplate = "<>" +func CreateServerlessInstanceBuilder() *cobra.Command { + const template = "<>" -func CreateServerlessInstanceBuilder() cobra.Command { opts := CreateServerlessInstanceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Serverless Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateServerlessInstanceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func CreateServerlessInstanceBuilder() cobra.Command { type DeleteServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string name string } @@ -97,7 +102,7 @@ func (opts *DeleteServerlessInstanceOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params) + resp, _, err := opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } @@ -105,30 +110,34 @@ func (opts *DeleteServerlessInstanceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteServerlessInstanceTemplate = "<>" +func DeleteServerlessInstanceBuilder() *cobra.Command { + const template = "<>" -func DeleteServerlessInstanceBuilder() cobra.Command { opts := DeleteServerlessInstanceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Serverless Instance from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteServerlessInstanceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.name, "name", "", "usage description") _ = cmd.MarkFlagRequired("name") return cmd @@ -136,7 +145,7 @@ func DeleteServerlessInstanceBuilder() cobra.Command { type GetServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string name string } @@ -154,7 +163,7 @@ func (opts *GetServerlessInstanceOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params) + resp, _, err := opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } @@ -162,30 +171,34 @@ func (opts *GetServerlessInstanceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetServerlessInstanceTemplate = "<>" +func GetServerlessInstanceBuilder() *cobra.Command { + const template = "<>" -func GetServerlessInstanceBuilder() cobra.Command { opts := GetServerlessInstanceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Serverless Instance from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetServerlessInstanceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.name, "name", "", "usage description") _ = cmd.MarkFlagRequired("name") return cmd @@ -193,7 +206,7 @@ func GetServerlessInstanceBuilder() cobra.Command { type ListServerlessInstancesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -215,7 +228,7 @@ func (opts *ListServerlessInstancesOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params) + resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params).Execute() if err != nil { return err } @@ -223,39 +236,41 @@ func (opts *ListServerlessInstancesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListServerlessInstancesTemplate = "<>" +func ListServerlessInstancesBuilder() *cobra.Command { + const template = "<>" -func ListServerlessInstancesBuilder() cobra.Command { opts := ListServerlessInstancesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Serverless Instances from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListServerlessInstancesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type UpdateServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string name string } @@ -273,7 +288,7 @@ func (opts *UpdateServerlessInstanceOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params) + resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } @@ -281,30 +296,34 @@ func (opts *UpdateServerlessInstanceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateServerlessInstanceTemplate = "<>" +func UpdateServerlessInstanceBuilder() *cobra.Command { + const template = "<>" -func UpdateServerlessInstanceBuilder() cobra.Command { opts := UpdateServerlessInstanceOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Serverless Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateServerlessInstanceTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.name, "name", "", "usage description") _ = cmd.MarkFlagRequired("name") return cmd diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index eea43ac17a..e72562c163 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -26,7 +26,7 @@ import ( type CreateServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string instanceName string } @@ -44,7 +44,7 @@ func (opts *CreateServerlessPrivateEndpointOpts) Run(ctx context.Context) error GroupId: opts.groupId, InstanceName: opts.instanceName, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateServerlessPrivateEndpointOpts) Run(ctx context.Context) error return opts.Print(resp) } -const CreateServerlessPrivateEndpointTemplate = "<>" +func CreateServerlessPrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func CreateServerlessPrivateEndpointBuilder() cobra.Command { opts := CreateServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Private Endpoint for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateServerlessPrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") _ = cmd.MarkFlagRequired("instanceName") return cmd @@ -83,7 +87,7 @@ func CreateServerlessPrivateEndpointBuilder() cobra.Command { type DeleteServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string instanceName string endpointId string @@ -103,7 +107,7 @@ func (opts *DeleteServerlessPrivateEndpointOpts) Run(ctx context.Context) error InstanceName: opts.instanceName, EndpointId: opts.endpointId, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -111,32 +115,35 @@ func (opts *DeleteServerlessPrivateEndpointOpts) Run(ctx context.Context) error return opts.Print(resp) } -const DeleteServerlessPrivateEndpointTemplate = "<>" +func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func DeleteServerlessPrivateEndpointBuilder() cobra.Command { opts := DeleteServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Private Endpoint for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteServerlessPrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") _ = cmd.MarkFlagRequired("instanceName") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") _ = cmd.MarkFlagRequired("endpointId") return cmd @@ -144,7 +151,7 @@ func DeleteServerlessPrivateEndpointBuilder() cobra.Command { type GetServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string instanceName string endpointId string @@ -164,7 +171,7 @@ func (opts *GetServerlessPrivateEndpointOpts) Run(ctx context.Context) error { InstanceName: opts.instanceName, EndpointId: opts.endpointId, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -172,32 +179,35 @@ func (opts *GetServerlessPrivateEndpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetServerlessPrivateEndpointTemplate = "<>" +func GetServerlessPrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func GetServerlessPrivateEndpointBuilder() cobra.Command { opts := GetServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Private Endpoint for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetServerlessPrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") _ = cmd.MarkFlagRequired("instanceName") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") _ = cmd.MarkFlagRequired("endpointId") return cmd @@ -205,7 +215,7 @@ func GetServerlessPrivateEndpointBuilder() cobra.Command { type ListServerlessPrivateEndpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string instanceName string } @@ -223,7 +233,7 @@ func (opts *ListServerlessPrivateEndpointsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, InstanceName: opts.instanceName, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(ctx, params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(ctx, params).Execute() if err != nil { return err } @@ -231,30 +241,34 @@ func (opts *ListServerlessPrivateEndpointsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListServerlessPrivateEndpointsTemplate = "<>" +func ListServerlessPrivateEndpointsBuilder() *cobra.Command { + const template = "<>" -func ListServerlessPrivateEndpointsBuilder() cobra.Command { opts := ListServerlessPrivateEndpointsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Private Endpoints for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListServerlessPrivateEndpointsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") _ = cmd.MarkFlagRequired("instanceName") return cmd @@ -262,7 +276,7 @@ func ListServerlessPrivateEndpointsBuilder() cobra.Command { type UpdateServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string instanceName string endpointId string @@ -282,7 +296,7 @@ func (opts *UpdateServerlessPrivateEndpointOpts) Run(ctx context.Context) error InstanceName: opts.instanceName, EndpointId: opts.endpointId, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params) + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } @@ -290,32 +304,35 @@ func (opts *UpdateServerlessPrivateEndpointOpts) Run(ctx context.Context) error return opts.Print(resp) } -const UpdateServerlessPrivateEndpointTemplate = "<>" +func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { + const template = "<>" -func UpdateServerlessPrivateEndpointBuilder() cobra.Command { opts := UpdateServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Private Endpoint for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateServerlessPrivateEndpointTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "usage description") _ = cmd.MarkFlagRequired("instanceName") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "usage description") _ = cmd.MarkFlagRequired("endpointId") return cmd diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index abb0faae6b..577b4b9622 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -26,7 +26,7 @@ import ( type CreateSharedClusterBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient clusterName string groupId string } @@ -44,7 +44,7 @@ func (opts *CreateSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) er ClusterName: opts.clusterName, GroupId: opts.groupId, } - resp, _, err := opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) er return opts.Print(resp) } -const CreateSharedClusterBackupRestoreJobTemplate = "<>" +func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func CreateSharedClusterBackupRestoreJobBuilder() cobra.Command { opts := CreateSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Restore Job from One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateSharedClusterBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -83,7 +87,7 @@ func CreateSharedClusterBackupRestoreJobBuilder() cobra.Command { type GetSharedClusterBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient clusterName string groupId string restoreId string @@ -103,7 +107,7 @@ func (opts *GetSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error GroupId: opts.groupId, RestoreId: opts.restoreId, } - resp, _, err := opts.client.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(ctx, params) + resp, _, err := opts.client.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } @@ -111,32 +115,35 @@ func (opts *GetSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error return opts.Print(resp) } -const GetSharedClusterBackupRestoreJobTemplate = "<>" +func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { + const template = "<>" -func GetSharedClusterBackupRestoreJobBuilder() cobra.Command { opts := GetSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Restore Job for One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetSharedClusterBackupRestoreJobTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.restoreId, "restoreId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + + _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", "usage description") _ = cmd.MarkFlagRequired("restoreId") return cmd @@ -144,7 +151,7 @@ func GetSharedClusterBackupRestoreJobBuilder() cobra.Command { type ListSharedClusterBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient clusterName string groupId string } @@ -162,7 +169,7 @@ func (opts *ListSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context) err ClusterName: opts.clusterName, GroupId: opts.groupId, } - resp, _, err := opts.client.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(ctx, params) + resp, _, err := opts.client.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } @@ -170,30 +177,34 @@ func (opts *ListSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context) err return opts.Print(resp) } -const ListSharedClusterBackupRestoreJobsTemplate = "<>" +func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { + const template = "<>" -func ListSharedClusterBackupRestoreJobsBuilder() cobra.Command { opts := ListSharedClusterBackupRestoreJobsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Restore Jobs for One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListSharedClusterBackupRestoreJobsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index 4bb4375e15..9000280327 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -26,7 +26,7 @@ import ( type DownloadSharedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient clusterName string groupId string } @@ -44,7 +44,7 @@ func (opts *DownloadSharedClusterBackupOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, GroupId: opts.groupId, } - resp, _, err := opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params) + resp, _, err := opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *DownloadSharedClusterBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DownloadSharedClusterBackupTemplate = "<>" +func DownloadSharedClusterBackupBuilder() *cobra.Command { + const template = "<>" -func DownloadSharedClusterBackupBuilder() cobra.Command { opts := DownloadSharedClusterBackupOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Download One M2 or M5 Cluster Snapshot", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DownloadSharedClusterBackupTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -83,7 +87,7 @@ func DownloadSharedClusterBackupBuilder() cobra.Command { type GetSharedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string snapshotId string @@ -103,7 +107,7 @@ func (opts *GetSharedClusterBackupOpts) Run(ctx context.Context) error { ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(ctx, params) + resp, _, err := opts.client.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } @@ -111,32 +115,35 @@ func (opts *GetSharedClusterBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetSharedClusterBackupTemplate = "<>" +func GetSharedClusterBackupBuilder() *cobra.Command { + const template = "<>" -func GetSharedClusterBackupBuilder() cobra.Command { opts := GetSharedClusterBackupOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Snapshot for One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetSharedClusterBackupTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "usage description") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -144,7 +151,7 @@ func GetSharedClusterBackupBuilder() cobra.Command { type ListSharedClusterBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string clusterName string } @@ -162,7 +169,7 @@ func (opts *ListSharedClusterBackupsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(ctx, params) + resp, _, err := opts.client.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(ctx, params).Execute() if err != nil { return err } @@ -170,30 +177,34 @@ func (opts *ListSharedClusterBackupsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListSharedClusterBackupsTemplate = "<>" +func ListSharedClusterBackupsBuilder() *cobra.Command { + const template = "<>" -func ListSharedClusterBackupsBuilder() cobra.Command { opts := ListSharedClusterBackupsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Snapshots for One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListSharedClusterBackupsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "usage description") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 79234bfc5d..685a1f345d 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -26,7 +26,7 @@ import ( type AddAllTeamsToProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -42,7 +42,7 @@ func (opts *AddAllTeamsToProjectOpts) Run(ctx context.Context) error { params := &admin.AddAllTeamsToProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *AddAllTeamsToProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const AddAllTeamsToProjectTemplate = "<>" +func AddAllTeamsToProjectBuilder() *cobra.Command { + const template = "<>" -func AddAllTeamsToProjectBuilder() cobra.Command { opts := AddAllTeamsToProjectOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Add One or More Teams to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), AddAllTeamsToProjectTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,7 +84,7 @@ func AddAllTeamsToProjectBuilder() cobra.Command { type AddTeamUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string teamId string } @@ -97,7 +102,7 @@ func (opts *AddTeamUserOpts) Run(ctx context.Context) error { OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.AddTeamUserWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.AddTeamUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -105,30 +110,34 @@ func (opts *AddTeamUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const AddTeamUserTemplate = "<>" +func AddTeamUserBuilder() *cobra.Command { + const template = "<>" -func AddTeamUserBuilder() cobra.Command { opts := AddTeamUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Assign MongoDB Cloud Users from One Organization to One Team", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), AddTeamUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -136,7 +145,7 @@ func AddTeamUserBuilder() cobra.Command { type CreateTeamOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string } @@ -152,7 +161,7 @@ func (opts *CreateTeamOpts) Run(ctx context.Context) error { params := &admin.CreateTeamApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.TeamsApi.CreateTeamWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.CreateTeamWithParams(ctx, params).Execute() if err != nil { return err } @@ -160,28 +169,33 @@ func (opts *CreateTeamOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateTeamTemplate = "<>" +func CreateTeamBuilder() *cobra.Command { + const template = "<>" -func CreateTeamBuilder() cobra.Command { opts := CreateTeamOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One Team in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateTeamTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -189,7 +203,7 @@ func CreateTeamBuilder() cobra.Command { type DeleteTeamOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string teamId string } @@ -207,7 +221,7 @@ func (opts *DeleteTeamOpts) Run(ctx context.Context) error { OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.DeleteTeamWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.DeleteTeamWithParams(ctx, params).Execute() if err != nil { return err } @@ -215,30 +229,34 @@ func (opts *DeleteTeamOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteTeamTemplate = "<>" +func DeleteTeamBuilder() *cobra.Command { + const template = "<>" -func DeleteTeamBuilder() cobra.Command { opts := DeleteTeamOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Team from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteTeamTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to delete.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -246,7 +264,7 @@ func DeleteTeamBuilder() cobra.Command { type GetTeamByIdOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string teamId string } @@ -264,7 +282,7 @@ func (opts *GetTeamByIdOpts) Run(ctx context.Context) error { OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.GetTeamByIdWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.GetTeamByIdWithParams(ctx, params).Execute() if err != nil { return err } @@ -272,30 +290,34 @@ func (opts *GetTeamByIdOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetTeamByIdTemplate = "<>" +func GetTeamByIdBuilder() *cobra.Command { + const template = "<>" -func GetTeamByIdBuilder() cobra.Command { opts := GetTeamByIdOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Team using its ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetTeamByIdTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose information you want to return.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -303,7 +325,7 @@ func GetTeamByIdBuilder() cobra.Command { type GetTeamByNameOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string teamName string } @@ -321,7 +343,7 @@ func (opts *GetTeamByNameOpts) Run(ctx context.Context) error { OrgId: opts.orgId, TeamName: opts.teamName, } - resp, _, err := opts.client.TeamsApi.GetTeamByNameWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.GetTeamByNameWithParams(ctx, params).Execute() if err != nil { return err } @@ -329,30 +351,34 @@ func (opts *GetTeamByNameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetTeamByNameTemplate = "<>" +func GetTeamByNameBuilder() *cobra.Command { + const template = "<>" -func GetTeamByNameBuilder() cobra.Command { opts := GetTeamByNameOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Team using its Name", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetTeamByNameTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamName, "teamName", , "Name of the team whose information you want to return.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.teamName, "teamName", "", "usage description") _ = cmd.MarkFlagRequired("teamName") return cmd @@ -360,7 +386,7 @@ func GetTeamByNameBuilder() cobra.Command { type ListOrganizationTeamsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string itemsPerPage int32 includeCount bool @@ -382,7 +408,7 @@ func (opts *ListOrganizationTeamsOpts) Run(ctx context.Context) error { IncludeCount: opts.includeCount, PageNum: opts.pageNum, } - resp, _, err := opts.client.TeamsApi.ListOrganizationTeamsWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.ListOrganizationTeamsWithParams(ctx, params).Execute() if err != nil { return err } @@ -390,39 +416,41 @@ func (opts *ListOrganizationTeamsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListOrganizationTeamsTemplate = "<>" +func ListOrganizationTeamsBuilder() *cobra.Command { + const template = "<>" -func ListOrganizationTeamsBuilder() cobra.Command { opts := ListOrganizationTeamsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Teams in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListOrganizationTeamsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListProjectTeamsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -444,7 +472,7 @@ func (opts *ListProjectTeamsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.TeamsApi.ListProjectTeamsWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.ListProjectTeamsWithParams(ctx, params).Execute() if err != nil { return err } @@ -452,39 +480,41 @@ func (opts *ListProjectTeamsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListProjectTeamsTemplate = "<>" +func ListProjectTeamsBuilder() *cobra.Command { + const template = "<>" -func ListProjectTeamsBuilder() cobra.Command { opts := ListProjectTeamsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Teams in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListProjectTeamsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type ListTeamUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string teamId string itemsPerPage int32 @@ -506,7 +536,7 @@ func (opts *ListTeamUsersOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.TeamsApi.ListTeamUsersWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.ListTeamUsersWithParams(ctx, params).Execute() if err != nil { return err } @@ -514,40 +544,42 @@ func (opts *ListTeamUsersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListTeamUsersTemplate = "<>" +func ListTeamUsersBuilder() *cobra.Command { + const template = "<>" -func ListTeamUsersBuilder() cobra.Command { opts := ListTeamUsersOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All MongoDB Cloud Users Assigned to One Team", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListTeamUsersTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") _ = cmd.MarkFlagRequired("teamId") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type RemoveProjectTeamOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string teamId string } @@ -565,7 +597,7 @@ func (opts *RemoveProjectTeamOpts) Run(ctx context.Context) error { GroupId: opts.groupId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params).Execute() if err != nil { return err } @@ -573,30 +605,34 @@ func (opts *RemoveProjectTeamOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const RemoveProjectTeamTemplate = "<>" +func RemoveProjectTeamBuilder() *cobra.Command { + const template = "<>" -func RemoveProjectTeamBuilder() cobra.Command { opts := RemoveProjectTeamOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Team from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), RemoveProjectTeamTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -604,7 +640,7 @@ func RemoveProjectTeamBuilder() cobra.Command { type RemoveTeamUserOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string teamId string userId string @@ -624,7 +660,7 @@ func (opts *RemoveTeamUserOpts) Run(ctx context.Context) error { TeamId: opts.teamId, UserId: opts.userId, } - _, err := opts.client.TeamsApi.RemoveTeamUserWithParams(ctx, params) + _, err := opts.client.TeamsApi.RemoveTeamUserWithParams(ctx, params).Execute() if err != nil { return err } @@ -632,32 +668,35 @@ func (opts *RemoveTeamUserOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const RemoveTeamUserTemplate = "<>" +func RemoveTeamUserBuilder() *cobra.Command { + const template = "<>" -func RemoveTeamUserBuilder() cobra.Command { opts := RemoveTeamUserOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One MongoDB Cloud User from One Team", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), RemoveTeamUserTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.") cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") _ = cmd.MarkFlagRequired("teamId") - cmd.Flags().StringVar(&opts.userId, "userId", "", "usage description") _ = cmd.MarkFlagRequired("userId") return cmd @@ -665,7 +704,7 @@ func RemoveTeamUserBuilder() cobra.Command { type RenameTeamOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient orgId string teamId string } @@ -683,7 +722,7 @@ func (opts *RenameTeamOpts) Run(ctx context.Context) error { OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.RenameTeamWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.RenameTeamWithParams(ctx, params).Execute() if err != nil { return err } @@ -691,30 +730,34 @@ func (opts *RenameTeamOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const RenameTeamTemplate = "<>" +func RenameTeamBuilder() *cobra.Command { + const template = "<>" -func RenameTeamBuilder() cobra.Command { opts := RenameTeamOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Rename One Team", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), RenameTeamTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "usage description") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to rename.") + + _ = cmd.MarkFlagRequired("orgId") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -722,7 +765,7 @@ func RenameTeamBuilder() cobra.Command { type UpdateTeamRolesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string teamId string } @@ -740,7 +783,7 @@ func (opts *UpdateTeamRolesOpts) Run(ctx context.Context) error { GroupId: opts.groupId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params) + resp, _, err := opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params).Execute() if err != nil { return err } @@ -748,30 +791,34 @@ func (opts *UpdateTeamRolesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateTeamRolesTemplate = "<>" +func UpdateTeamRolesBuilder() *cobra.Command { + const template = "<>" -func UpdateTeamRolesBuilder() cobra.Command { opts := UpdateTeamRolesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update Team Roles in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateTeamRolesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "usage description") _ = cmd.MarkFlagRequired("teamId") return cmd diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index d69f0b83ab..e97defb86d 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -26,7 +26,7 @@ import ( type VersionedExampleOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient additionalInfo bool } @@ -42,7 +42,7 @@ func (opts *VersionedExampleOpts) Run(ctx context.Context) error { params := &admin.VersionedExampleApiParams{ AdditionalInfo: opts.additionalInfo, } - resp, _, err := opts.client.TestApi.VersionedExampleWithParams(ctx, params) + resp, _, err := opts.client.TestApi.VersionedExampleWithParams(ctx, params).Execute() if err != nil { return err } @@ -50,28 +50,33 @@ func (opts *VersionedExampleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const VersionedExampleTemplate = "<>" +func VersionedExampleBuilder() *cobra.Command { + const template = "<>" -func VersionedExampleBuilder() cobra.Command { opts := VersionedExampleOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Example resource info for versioning of the Atlas API", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), VersionedExampleTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.additionalInfo, "additionalInfo", "", "usage description") + + cmd.Flags().StringVar(&opts.additionalInfo, "additionalInfo", false, "") + return cmd } diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index eb07439543..fd30cf897b 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -26,7 +26,7 @@ import ( type CreateThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient integrationType string groupId string includeCount bool @@ -50,7 +50,7 @@ func (opts *CreateThirdPartyIntegrationOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } @@ -58,41 +58,42 @@ func (opts *CreateThirdPartyIntegrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const CreateThirdPartyIntegrationTemplate = "<>" +func CreateThirdPartyIntegrationBuilder() *cobra.Command { + const template = "<>" -func CreateThirdPartyIntegrationBuilder() cobra.Command { opts := CreateThirdPartyIntegrationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Configure One Third-Party Service Integration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateThirdPartyIntegrationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("integrationType") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type DeleteThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient integrationType string groupId string } @@ -110,7 +111,7 @@ func (opts *DeleteThirdPartyIntegrationOpts) Run(ctx context.Context) error { IntegrationType: opts.integrationType, GroupId: opts.groupId, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(ctx, params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } @@ -118,30 +119,34 @@ func (opts *DeleteThirdPartyIntegrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const DeleteThirdPartyIntegrationTemplate = "<>" +func DeleteThirdPartyIntegrationBuilder() *cobra.Command { + const template = "<>" -func DeleteThirdPartyIntegrationBuilder() cobra.Command { opts := DeleteThirdPartyIntegrationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Remove One Third-Party Service Integration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DeleteThirdPartyIntegrationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("integrationType") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -149,7 +154,7 @@ func DeleteThirdPartyIntegrationBuilder() cobra.Command { type GetThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string integrationType string } @@ -167,7 +172,7 @@ func (opts *GetThirdPartyIntegrationOpts) Run(ctx context.Context) error { GroupId: opts.groupId, IntegrationType: opts.integrationType, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(ctx, params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } @@ -175,30 +180,34 @@ func (opts *GetThirdPartyIntegrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const GetThirdPartyIntegrationTemplate = "<>" +func GetThirdPartyIntegrationBuilder() *cobra.Command { + const template = "<>" -func GetThirdPartyIntegrationBuilder() cobra.Command { opts := GetThirdPartyIntegrationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return One Third-Party Service Integration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), GetThirdPartyIntegrationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") _ = cmd.MarkFlagRequired("integrationType") return cmd @@ -206,7 +215,7 @@ func GetThirdPartyIntegrationBuilder() cobra.Command { type ListThirdPartyIntegrationsOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string includeCount bool itemsPerPage int32 @@ -228,7 +237,7 @@ func (opts *ListThirdPartyIntegrationsOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(ctx, params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(ctx, params).Execute() if err != nil { return err } @@ -236,39 +245,41 @@ func (opts *ListThirdPartyIntegrationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListThirdPartyIntegrationsTemplate = "<>" +func ListThirdPartyIntegrationsBuilder() *cobra.Command { + const template = "<>" -func ListThirdPartyIntegrationsBuilder() cobra.Command { opts := ListThirdPartyIntegrationsOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All Active Third-Party Service Integrations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListThirdPartyIntegrationsTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } type UpdateThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient integrationType string groupId string includeCount bool @@ -292,7 +303,7 @@ func (opts *UpdateThirdPartyIntegrationOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params) + resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } @@ -300,34 +311,35 @@ func (opts *UpdateThirdPartyIntegrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const UpdateThirdPartyIntegrationTemplate = "<>" +func UpdateThirdPartyIntegrationBuilder() *cobra.Command { + const template = "<>" -func UpdateThirdPartyIntegrationBuilder() cobra.Command { opts := UpdateThirdPartyIntegrationOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Update One Third-Party Service Integration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), UpdateThirdPartyIntegrationTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "usage description") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("integrationType") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index d128117860..6fd59b28c8 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -26,7 +26,7 @@ import ( type CreateDatabaseUserCertificateOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string username string } @@ -44,7 +44,7 @@ func (opts *CreateDatabaseUserCertificateOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Username: opts.username, } - _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params) + _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() if err != nil { return err } @@ -52,30 +52,34 @@ func (opts *CreateDatabaseUserCertificateOpts) Run(ctx context.Context) error { return opts.Print(nil) } -const CreateDatabaseUserCertificateTemplate = "<>" +func CreateDatabaseUserCertificateBuilder() *cobra.Command { + const template = "<>" -func CreateDatabaseUserCertificateBuilder() cobra.Command { opts := CreateDatabaseUserCertificateOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Create One X.509 Certificate for One MongoDB User", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), CreateDatabaseUserCertificateTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account for whom to create a certificate.") + + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.username, "username", "", "usage description") _ = cmd.MarkFlagRequired("username") return cmd @@ -83,7 +87,7 @@ func CreateDatabaseUserCertificateBuilder() cobra.Command { type DisableCustomerManagedX509Opts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string } @@ -99,7 +103,7 @@ func (opts *DisableCustomerManagedX509Opts) Run(ctx context.Context) error { params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.X509AuthenticationApi.DisableCustomerManagedX509WithParams(ctx, params) + resp, _, err := opts.client.X509AuthenticationApi.DisableCustomerManagedX509WithParams(ctx, params).Execute() if err != nil { return err } @@ -107,28 +111,33 @@ func (opts *DisableCustomerManagedX509Opts) Run(ctx context.Context) error { return opts.Print(resp) } -const DisableCustomerManagedX509Template = "<>" +func DisableCustomerManagedX509Builder() *cobra.Command { + const template = "<>" -func DisableCustomerManagedX509Builder() cobra.Command { opts := DisableCustomerManagedX509Opts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Disable Customer-Managed X.509", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), DisableCustomerManagedX509Template), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,7 +145,7 @@ func DisableCustomerManagedX509Builder() cobra.Command { type ListDatabaseUserCertificatesOpts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient groupId string username string includeCount bool @@ -160,7 +169,7 @@ func (opts *ListDatabaseUserCertificatesOpts) Run(ctx context.Context) error { ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, } - resp, _, err := opts.client.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(ctx, params) + resp, _, err := opts.client.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(ctx, params).Execute() if err != nil { return err } @@ -168,34 +177,35 @@ func (opts *ListDatabaseUserCertificatesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -const ListDatabaseUserCertificatesTemplate = "<>" +func ListDatabaseUserCertificatesBuilder() *cobra.Command { + const template = "<>" -func ListDatabaseUserCertificatesBuilder() cobra.Command { opts := ListDatabaseUserCertificatesOpts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "Return All X.509 Certificates Assigned to One MongoDB User", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), ListDatabaseUserCertificatesTemplate), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "usage description") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account whose certificates you want to return.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") - cmd.Flags().StringVar(&opts.username, "username", "", "usage description") _ = cmd.MarkFlagRequired("username") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", "", "usage description") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", "", "usage description") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", "", "usage description") return cmd } diff --git a/tools/openapi-generator/config/config.yaml b/tools/openapi-generator/config/config.yaml index 6547aaf10f..5088df4b30 100644 --- a/tools/openapi-generator/config/config.yaml +++ b/tools/openapi-generator/config/config.yaml @@ -5,7 +5,7 @@ gitHost: github.com templateDir: config/go-templates isGoSubmodule: true packageName: generated -inputSpec: https://raw.githubusercontent.com/mongodb/go-client-mongodb-atlas/sdkv2/openapi/atlas-api-transformed.yaml +inputSpec: https://github.com/mongodb/atlas-sdk-go/raw/main/openapi/atlas-api-transformed.yaml files: cmd.mustache: templateType: API diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 560f8a4e35..2ec0e7537e 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -13,7 +13,7 @@ import ( type {{operationId}}Opts struct { cli.GlobalOpts cli.OutputOpts - client admin.APIClient + client *admin.APIClient {{#pathParams}} {{paramName}} {{{dataType}}} {{/pathParams}} @@ -39,7 +39,7 @@ func (opts *{{operationId}}Opts) Run(ctx context.Context) error { {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}}, {{/queryParams}} } - {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params) + {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params).Execute() if err != nil { return err } @@ -47,21 +47,24 @@ func (opts *{{operationId}}Opts) Run(ctx context.Context) error { return opts.Print({{#returnType}}resp{{/returnType}}{{^returnType}}nil{{/returnType}}) } -const {{operationId}}Template = "<>" +func {{operationId}}Builder() *cobra.Command { + const template = "<>" -func {{operationId}}Builder() cobra.Command { opts := {{operationId}}Opts{} cmd := &cobra.Command{ Use: "<>", - Short: "<>", + // Aliases: []string{"?"}, + Short: "{{ summary }}", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - // Aliases: []string{"ls"}, Args: require.NoArgs, + Annotations: map[string]string{ + "output": template, + }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, opts.initClient(cmd.Context()), - opts.InitOutput(cmd.OutOrStdout(), {{operationId}}Template), + opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { @@ -69,12 +72,12 @@ func {{operationId}}Builder() cobra.Command { }, } {{#pathParams}} - cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", "", "usage description") - _ = cmd.MarkFlagRequired("{{paramName}}") - {{/pathParams}} + cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}"){{/pathParams}} {{#queryParams}} - cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", "", "usage description") - {{/queryParams}} + cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}"){{/queryParams}} + {{#pathParams}}{{#required}} + _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/pathParams}}{{#queryParams}}{{#required}} + _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/queryParams}} return cmd } From 6729dffa398d60d518a21d729cb0948bb059ab52 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 31 May 2023 15:35:14 +0100 Subject: [PATCH 07/44] WIP --- internal/generated/api_access_tracking_cmd.go | 22 ++- .../generated/api_alert_configurations_cmd.go | 34 +++-- internal/generated/api_alerts_cmd.go | 24 +-- internal/generated/api_atlas_search_cmd.go | 25 +-- internal/generated/api_auditing_cmd.go | 2 - .../generated/api_aws_clusters_dns_cmd.go | 2 - internal/generated/api_cloud_backups_cmd.go | 144 ++++++++++-------- .../api_cloud_migration_service_cmd.go | 17 +-- .../api_cloud_provider_access_cmd.go | 15 +- .../api_cluster_outage_simulation_cmd.go | 12 +- internal/generated/api_clusters_cmd.go | 35 +++-- .../api_custom_database_roles_cmd.go | 14 +- internal/generated/api_data_federation_cmd.go | 61 ++++---- .../generated/api_data_lake_pipelines_cmd.go | 60 ++++---- internal/generated/api_database_users_cmd.go | 22 +-- ..._rest_using_customer_key_management_cmd.go | 2 - internal/generated/api_events_cmd.go | 31 +++- .../api_federated_authentication_cmd.go | 51 +++---- internal/generated/api_global_clusters_cmd.go | 24 +-- internal/generated/api_invoices_cmd.go | 15 +- .../generated/api_ldap_configuration_cmd.go | 8 +- internal/generated/api_legacy_backup_cmd.go | 62 +++++--- .../api_legacy_backup_restore_jobs_cmd.go | 4 +- .../generated/api_maintenance_windows__cmd.go | 5 - .../generated/api_mongo_db_cloud_users_cmd.go | 4 - .../generated/api_monitoring_and_logs_cmd.go | 136 +++++++++++------ .../generated/api_multi_cloud_clusters_cmd.go | 24 +-- internal/generated/api_network_peering_cmd.go | 50 +++--- internal/generated/api_online_archive_cmd.go | 37 +++-- internal/generated/api_organizations_cmd.go | 42 +++-- .../generated/api_performance_advisor_cmd.go | 34 +++-- .../api_private_endpoint_services_cmd.go | 34 +++-- .../api_programmatic_api_keys_cmd.go | 71 +++++---- .../api_project_ip_access_list_cmd.go | 24 +-- internal/generated/api_projects_cmd.go | 55 +++---- internal/generated/api_rolling_index_cmd.go | 4 +- internal/generated/api_root_cmd.go | 2 - .../generated/api_serverless_instances_cmd.go | 19 +-- .../api_serverless_private_endpoints_cmd.go | 23 +-- .../api_shared_tier_restore_jobs_cmd.go | 13 +- .../api_shared_tier_snapshots_cmd.go | 13 +- internal/generated/api_teams_cmd.go | 55 ++++--- internal/generated/api_test__cmd.go | 3 +- .../api_third_party_integrations_cmd.go | 32 ++-- .../generated/api_x509_authentication_cmd.go | 14 +- .../config/go-templates/cmd.mustache | 16 +- 46 files changed, 791 insertions(+), 605 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index cc493f7f90..3b53f9f825 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -86,9 +86,14 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") + cmd.Flags().StringVar(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") + cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") + cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -157,9 +162,14 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.hostname, "hostname", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") - cmd.Flags().StringVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.hostname, "hostname", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") + cmd.Flags().StringVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") + cmd.Flags().StringVar(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") + cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") + cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostname") diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 80be8e835a..eead521033 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -76,7 +76,6 @@ func CreateAlertConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,9 +133,9 @@ func DeleteAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -195,9 +194,9 @@ func GetAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -254,8 +253,6 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { } - - return cmd } type ListAlertConfigurationsOpts struct { @@ -316,8 +313,10 @@ func ListAlertConfigurationsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -381,9 +380,12 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") @@ -442,9 +444,9 @@ func ToggleAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -503,9 +505,9 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 7c53382b01..791ff86261 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -76,9 +76,9 @@ func AcknowledgeAlertBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") @@ -137,9 +137,9 @@ func GetAlertBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") @@ -205,8 +205,11 @@ func ListAlertsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.status, "status", , "Status of the alerts to return. Omit to return all alerts in all statuses.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.status, "status", , "Status of the alerts to return. Omit to return all alerts in all statuses.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -270,9 +273,12 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index 24bd94ebf3..4f8fe4e06a 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -76,9 +76,9 @@ func CreateAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection on which to create an Atlas Search index.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection on which to create an Atlas Search index.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -139,9 +139,10 @@ func DeleteAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the database and collection with one or more Application Search indexes.") cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the database and collection with one or more Application Search indexes.") + cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") @@ -203,9 +204,10 @@ func GetAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection with one or more Atlas Search indexes.") cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection with one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") @@ -269,9 +271,11 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection with one or more Atlas Search indexes.") cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Name of the collection that contains one or more Atlas Search indexes.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection with one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Name of the collection that contains one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("collectionName") @@ -334,9 +338,10 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection whose Atlas Search index to update.") cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection whose Atlas Search index to update.") + cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index 6c2b1afd81..e31bbd8694 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -76,7 +76,6 @@ func GetAuditingConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,7 +133,6 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 67cdfb3514..c1d8bee3c3 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -76,7 +76,6 @@ func GetAWSCustomDNSBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,7 +133,6 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index b5b8cb0d23..33ba3f5d33 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -78,9 +78,10 @@ func CancelBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to remove.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") @@ -140,9 +141,9 @@ func CreateBackupExportJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -201,9 +202,9 @@ func CreateBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -262,7 +263,6 @@ func CreateExportBucketBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -320,9 +320,9 @@ func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance whose snapshot you want to restore.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance whose snapshot you want to restore.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -381,9 +381,9 @@ func DeleteAllBackupSchedulesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -442,9 +442,9 @@ func DeleteExportBucketBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") @@ -505,9 +505,10 @@ func DeleteReplicaSetBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -569,9 +570,10 @@ func DeleteShardedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -633,9 +635,10 @@ func GetBackupExportJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.exportId, "exportId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.exportId, "exportId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("exportId") @@ -697,9 +700,10 @@ func GetBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") @@ -759,9 +763,9 @@ func GetBackupScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -820,7 +824,6 @@ func GetDataProtectionSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -878,9 +881,9 @@ func GetExportBucketBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") @@ -941,9 +944,10 @@ func GetReplicaSetBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -1005,9 +1009,10 @@ func GetServerlessBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -1069,9 +1074,10 @@ func GetServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") @@ -1133,9 +1139,10 @@ func GetShardedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -1201,9 +1208,12 @@ func ListBackupExportJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1268,9 +1278,12 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1334,8 +1347,10 @@ func ListExportBucketsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1399,9 +1414,12 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1466,9 +1484,12 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1533,9 +1554,12 @@ func ListServerlessBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1594,9 +1618,9 @@ func ListShardedClusterBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1655,9 +1679,9 @@ func TakeSnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1716,9 +1740,9 @@ func UpdateBackupScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1777,7 +1801,6 @@ func UpdateDataProtectionSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1837,9 +1860,10 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index f8876c82d5..6500d2567f 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -76,7 +76,6 @@ func CreateLinkTokenBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -134,7 +133,6 @@ func CreatePushMigrationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -192,9 +190,9 @@ func CutoverMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", , "Unique 24-hexadecimal digit string that identifies the migration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", , "Unique 24-hexadecimal digit string that identifies the migration.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") @@ -253,7 +251,6 @@ func DeleteLinkTokenBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -311,9 +308,9 @@ func GetPushMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", , "Unique 24-hexadecimal digit string that identifies the migration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", , "Unique 24-hexadecimal digit string that identifies the migration.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") @@ -372,9 +369,9 @@ func GetValidationStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.validationId, "validationId", , "Unique 24-hexadecimal digit string that identifies the validation job.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.validationId, "validationId", , "Unique 24-hexadecimal digit string that identifies the validation job.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("validationId") @@ -433,7 +430,6 @@ func ListSourceProjectsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -491,7 +487,6 @@ func ValidateMigrationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index c77b1cecd8..975735b468 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -76,9 +76,9 @@ func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") @@ -137,7 +137,6 @@ func CreateCloudProviderAccessRoleBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -197,9 +196,10 @@ func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", , "Human-readable label that identifies the cloud provider of the role to deauthorize.") cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", , "Human-readable label that identifies the cloud provider of the role to deauthorize.") + cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("roleId") @@ -259,9 +259,9 @@ func GetCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") @@ -320,7 +320,6 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 7132d0e2da..f89ae07a7b 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -76,9 +76,9 @@ func EndOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that is undergoing outage simulation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that is undergoing outage simulation.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -137,9 +137,9 @@ func GetOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that is undergoing outage simulation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that is undergoing outage simulation.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -198,9 +198,9 @@ func StartOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster to undergo an outage simulation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster to undergo an outage simulation.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 97fa24211d..386e87e517 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -76,9 +76,9 @@ func GetClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -137,9 +137,9 @@ func GetClusterStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -198,9 +198,9 @@ func GetSampleDatasetLoadStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", , "Unique 24-hexadecimal digit string that identifies the loaded sample dataset.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", , "Unique 24-hexadecimal digit string that identifies the loaded sample dataset.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("sampleDatasetId") @@ -268,8 +268,12 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.providers, "providers", , "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") cmd.Flags().StringVar(&opts.tier, "tier", , "Cluster tier for which to retrieve the regions.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.providers, "providers", , "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") + cmd.Flags().StringVar(&opts.tier, "tier", , "Cluster tier for which to retrieve the regions.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -329,9 +333,10 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - return cmd } @@ -388,9 +393,9 @@ func LoadSampleDatasetBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the cluster into which you load the sample dataset.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the cluster into which you load the sample dataset.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") @@ -449,9 +454,9 @@ func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -510,7 +515,6 @@ func UpgradeSharedClusterBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -568,7 +572,6 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index e9b008773b..541a6c12aa 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -76,7 +76,6 @@ func CreateCustomDatabaseRoleBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,9 +133,9 @@ func DeleteCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") @@ -195,9 +194,9 @@ func GetCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") @@ -256,7 +255,6 @@ func ListCustomDatabaseRolesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -314,9 +312,9 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index 061c7ed6a5..856fc04ce1 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -76,7 +76,6 @@ func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,7 +135,7 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", false, "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") - + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -196,9 +195,10 @@ func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") @@ -258,9 +258,9 @@ func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") @@ -319,9 +319,9 @@ func DeleteFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to remove.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -382,9 +382,10 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") @@ -448,9 +449,11 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to download query logs.") - cmd.Flags().StringVar(&opts.endDate, "endDate", , "Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") cmd.Flags().StringVar(&opts.startDate, "startDate", , "Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to download query logs.") + cmd.Flags().StringVar(&opts.endDate, "endDate", , "Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().StringVar(&opts.startDate, "startDate", , "Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -509,9 +512,9 @@ func GetDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") @@ -570,9 +573,9 @@ func GetFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the Federated Database to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the Federated Database to return.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -636,8 +639,10 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -697,7 +702,7 @@ func ListFederatedDatabasesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.type_, "type_", "USER", "Type of Federated Database Instances to return.") - + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -757,9 +762,10 @@ func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") @@ -819,9 +825,9 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to retrieve query limits.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to retrieve query limits.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -882,12 +888,13 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to update.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to update.") cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", , "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") - + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") - _ = cmd.MarkFlagRequired("skipRoleValidation") + _ = cmd.MarkFlagRequired("skipRoleValidation") return cmd } diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 15e0d932fe..5e66f293dd 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -76,7 +76,6 @@ func CreatePipelineBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,9 +133,9 @@ func DeletePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -197,9 +196,10 @@ func DeletePipelineRunDatasetBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", , "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", , "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") @@ -259,9 +259,9 @@ func GetPipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -322,9 +322,10 @@ func GetPipelineRunBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", , "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", , "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") @@ -392,9 +393,13 @@ func ListPipelineRunsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", , "If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", , "If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -453,9 +458,9 @@ func ListPipelineSchedulesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -522,9 +527,13 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", , "Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", , "Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -583,7 +592,6 @@ func ListPipelinesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -641,9 +649,9 @@ func PausePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -702,9 +710,9 @@ func ResumePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -763,9 +771,9 @@ func TriggerSnapshotIngestionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -824,9 +832,9 @@ func UpdatePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index a172aa5727..049e420989 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -76,7 +76,6 @@ func CreateDatabaseUserBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,9 +135,10 @@ func DeleteDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") + cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") @@ -200,9 +200,10 @@ func GetDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") + cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") @@ -267,8 +268,10 @@ func ListDatabaseUsersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -328,9 +331,10 @@ func UpdateDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") + cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index 9a977d893d..8b56c2ca37 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -76,7 +76,6 @@ func GetEncryptionAtRestBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,7 +133,6 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index cc307a0dc5..351c984b4c 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -78,9 +78,10 @@ func GetOrganizationEventBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.") cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") - + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("eventId") @@ -141,9 +142,10 @@ func GetProjectEventBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.") cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") - + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("eventId") @@ -215,8 +217,14 @@ func ListOrganizationEventsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") cmd.Flags().StringVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") cmd.Flags().StringVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") + cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + cmd.Flags().StringVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().StringVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -289,8 +297,15 @@ func ListProjectEventsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.clusterNames, "clusterNames", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") cmd.Flags().StringVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") cmd.Flags().StringVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.clusterNames, "clusterNames", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") + cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + cmd.Flags().StringVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().StringVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index e4c1f82b9f..b3e685b735 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -76,9 +76,9 @@ func CreateRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -137,7 +137,6 @@ func DeleteFederationAppBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -197,9 +196,10 @@ func DeleteRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") @@ -259,9 +259,9 @@ func GetConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -320,7 +320,6 @@ func GetFederationSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -378,9 +377,9 @@ func GetIdentityProviderBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") @@ -439,9 +438,9 @@ func GetIdentityProviderMetadataBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") @@ -502,9 +501,10 @@ func GetRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") @@ -564,7 +564,6 @@ func ListConnectedOrgConfigsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -622,7 +621,6 @@ func ListIdentityProvidersBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -680,9 +678,9 @@ func ListRoleMappingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -741,9 +739,9 @@ func RemoveConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -802,9 +800,9 @@ func UpdateConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -863,9 +861,9 @@ func UpdateIdentityProviderBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") @@ -926,9 +924,10 @@ func UpdateRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.") cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index 07e871f515..f07daa8cdd 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -76,9 +76,9 @@ func CreateCustomZoneMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -137,9 +137,9 @@ func CreateManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -198,9 +198,9 @@ func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -263,9 +263,11 @@ func DeleteManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.db, "db", , "Human-readable label that identifies the database that contains the collection.") cmd.Flags().StringVar(&opts.collection, "collection", , "Human-readable label that identifies the collection associated with the managed namespace.") - + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.db, "db", , "Human-readable label that identifies the database that contains the collection.") + cmd.Flags().StringVar(&opts.collection, "collection", , "Human-readable label that identifies the collection associated with the managed namespace.") + _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -324,9 +326,9 @@ func GetManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index 2ade0e5263..d7f37ca286 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -76,9 +76,9 @@ func DownloadInvoiceCSVBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", , "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", , "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") @@ -137,9 +137,9 @@ func GetInvoiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", , "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", , "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") @@ -203,8 +203,10 @@ func ListInvoicesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -262,7 +264,6 @@ func ListPendingInvoicesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 0ba890202a..0fee4bc84a 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -76,7 +76,6 @@ func DeleteLDAPConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,7 +133,6 @@ func GetLDAPConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -192,9 +190,9 @@ func GetLDAPConfigurationStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.requestId, "requestId", , "Unique string that identifies the request to verify an <abbr title=\"Lightweight Directory Access Protocol\">LDAP</abbr> configuration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.requestId, "requestId", , "Unique string that identifies the request to verify an <abbr title=\"Lightweight Directory Access Protocol\">LDAP</abbr> configuration.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("requestId") @@ -253,7 +251,6 @@ func SaveLDAPConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -311,7 +308,6 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index de4b192e24..f04ef896fb 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -78,9 +78,10 @@ func DeleteLegacySnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -142,9 +143,10 @@ func GetLegacyBackupCheckpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", , "Unique 24-hexadecimal digit string that identifies the checkpoint.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", , "Unique 24-hexadecimal digit string that identifies the checkpoint.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("checkpointId") _ = cmd.MarkFlagRequired("clusterName") @@ -206,9 +208,10 @@ func GetLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") cmd.Flags().StringVar(&opts.jobId, "jobId", , "Unique 24-hexadecimal digit string that identifies the restore job.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.jobId, "jobId", , "Unique 24-hexadecimal digit string that identifies the restore job.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("jobId") @@ -270,9 +273,10 @@ func GetLegacySnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -332,9 +336,9 @@ func GetLegacySnapshotScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -399,9 +403,12 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -468,9 +475,13 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.batchId, "batchId", , "Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.batchId, "batchId", , "Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -537,9 +548,13 @@ func ListLegacySnapshotsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.completed, "completed", "true", "Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.completed, "completed", "true", "Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -600,9 +615,10 @@ func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -662,9 +678,9 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 0a0056954e..a7cc7f2556 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -76,9 +76,9 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index c11bcd314b..baf0faf935 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -76,7 +76,6 @@ func DeferMaintenanceWindowBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,7 +133,6 @@ func GetMaintenanceWindowBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -192,7 +190,6 @@ func ResetMaintenanceWindowBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -250,7 +247,6 @@ func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -308,7 +304,6 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index 9f080e8f32..b837fafa31 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -74,8 +74,6 @@ func CreateUserBuilder() *cobra.Command { } - - return cmd } type GetUserOpts struct { @@ -131,7 +129,6 @@ func GetUserBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal digit string that identifies this user.") - _ = cmd.MarkFlagRequired("userId") return cmd @@ -189,7 +186,6 @@ func GetUserByUsernameBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.userName, "userName", , "Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.") - _ = cmd.MarkFlagRequired("userName") return cmd diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index 9c0028c99d..c715d7d530 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -76,9 +76,9 @@ func GetAtlasProcessBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -139,9 +139,10 @@ func GetDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") @@ -213,14 +214,20 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") - _ = cmd.MarkFlagRequired("granularity") + _ = cmd.MarkFlagRequired("granularity") return cmd } type GetDiskMeasurementsOpts struct { @@ -288,14 +295,20 @@ func GetDiskMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("processId") - _ = cmd.MarkFlagRequired("granularity") + _ = cmd.MarkFlagRequired("granularity") return cmd } type GetHostLogsOpts struct { @@ -357,9 +370,12 @@ func GetHostLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.hostName, "hostName", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") cmd.Flags().StringVar(&opts.logName, "logName", , "Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.") - cmd.Flags().StringVar(&opts.endDate, "endDate", , "Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") cmd.Flags().StringVar(&opts.startDate, "startDate", , "Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.hostName, "hostName", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") + cmd.Flags().StringVar(&opts.logName, "logName", , "Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.") + cmd.Flags().StringVar(&opts.endDate, "endDate", , "Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().StringVar(&opts.startDate, "startDate", , "Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostName") _ = cmd.MarkFlagRequired("logName") @@ -429,13 +445,18 @@ func GetHostMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - _ = cmd.MarkFlagRequired("granularity") + _ = cmd.MarkFlagRequired("granularity") return cmd } type GetIndexMetricsOpts struct { @@ -507,17 +528,25 @@ func GetIndexMetricsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.indexName, "indexName", , "Human-readable label that identifies the index.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database.") cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Human-readable label that identifies the collection.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") - + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.indexName, "indexName", , "Human-readable label that identifies the index.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database.") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Human-readable label that identifies the collection.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("indexName") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") - return cmd } type GetMeasurementsOpts struct { @@ -583,14 +612,19 @@ func GetMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") - + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") + _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") - return cmd } type ListAtlasProcessesOpts struct { @@ -651,8 +685,10 @@ func ListAtlasProcessesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -716,9 +752,12 @@ func ListDatabasesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -779,9 +818,10 @@ func ListDiskMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -847,9 +887,12 @@ func ListDiskPartitionsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -922,16 +965,23 @@ func ListIndexMetricsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database.") cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Human-readable label that identifies the collection.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") - + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database.") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Human-readable label that identifies the collection.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") - return cmd } type ListMetricTypesOpts struct { @@ -987,9 +1037,9 @@ func ListMetricTypesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 53b5495e68..32cb3b3d4b 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -76,7 +76,6 @@ func CreateClusterBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,9 +135,10 @@ func DeleteClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.retainBackups, "retainBackups", , "Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.") - + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -197,9 +197,9 @@ func GetClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -263,8 +263,10 @@ func ListClustersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -322,9 +324,9 @@ func TestFailoverBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -383,9 +385,9 @@ func UpdateClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the advanced cluster to modify.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the advanced cluster to modify.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 7dd3c62580..be88615d15 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -76,7 +76,6 @@ func CreatePeeringConnectionBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,7 +133,6 @@ func CreatePeeringContainerBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -192,9 +190,9 @@ func DeletePeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") @@ -253,9 +251,9 @@ func DeletePeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") @@ -314,7 +312,6 @@ func DisablePeeringBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -372,9 +369,9 @@ func GetPeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") @@ -433,9 +430,9 @@ func GetPeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") @@ -501,8 +498,11 @@ func ListPeeringConnectionsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider to use for this VPC peering connection.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider to use for this VPC peering connection.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -567,11 +567,14 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider that serves the desired network peering containers.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider that serves the desired network peering containers.") + _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("providerName") + _ = cmd.MarkFlagRequired("providerName") return cmd } type ListPeeringContainersOpts struct { @@ -632,8 +635,10 @@ func ListPeeringContainersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -691,9 +696,9 @@ func UpdatePeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") @@ -752,9 +757,9 @@ func UpdatePeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") @@ -813,7 +818,6 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index 6d2bc34aec..330e0f8a21 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -76,9 +76,9 @@ func CreateOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -139,9 +139,10 @@ func DeleteOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to delete.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to delete.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") @@ -207,9 +208,12 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.") - cmd.Flags().StringVar(&opts.startDate, "startDate", , "Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") cmd.Flags().StringVar(&opts.endDate, "endDate", , "Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") cmd.Flags().StringVar(&opts.archiveOnly, "archiveOnly", false, "Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.") + cmd.Flags().StringVar(&opts.startDate, "startDate", , "Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") + cmd.Flags().StringVar(&opts.endDate, "endDate", , "Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") + cmd.Flags().StringVar(&opts.archiveOnly, "archiveOnly", false, "Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -270,9 +274,10 @@ func GetOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to return.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to return.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") @@ -338,9 +343,12 @@ func ListOnlineArchivesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -401,9 +409,10 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to update.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to update.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 3841c2fc3e..be9d0c2eda 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -74,8 +74,6 @@ func CreateOrganizationBuilder() *cobra.Command { } - - return cmd } type CreateOrganizationInvitationOpts struct { @@ -131,7 +129,6 @@ func CreateOrganizationInvitationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -189,7 +186,6 @@ func DeleteOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -247,9 +243,9 @@ func DeleteOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") @@ -308,7 +304,6 @@ func GetOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -366,9 +361,9 @@ func GetOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") @@ -427,7 +422,6 @@ func GetOrganizationSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -487,7 +481,7 @@ func ListOrganizationInvitationsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.username, "username", , "Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.") - + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -552,8 +546,11 @@ func ListOrganizationProjectsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.") + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -616,8 +613,10 @@ func ListOrganizationUsersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -679,9 +678,11 @@ func ListOrganizationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.") - return cmd } @@ -738,7 +739,6 @@ func RenameOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -796,7 +796,6 @@ func UpdateOrganizationInvitationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -854,9 +853,9 @@ func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") @@ -915,7 +914,6 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index 4aa000cb13..a9fb0d3863 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -76,7 +76,6 @@ func DisableSlowOperationThresholdingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,7 +133,6 @@ func EnableSlowOperationThresholdingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -200,9 +198,13 @@ func ListSlowQueriesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") cmd.Flags().StringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().StringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") + cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") + cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -265,9 +267,11 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -342,9 +346,17 @@ func ListSuggestedIndexesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") cmd.Flags().StringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") cmd.Flags().StringVar(&opts.nExamples, "nExamples", 5, "Maximum number of example queries that benefit from the suggested index.") cmd.Flags().StringVar(&opts.nIndexes, "nIndexes", , "Number that indicates the maximum indexes to suggest.") cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().StringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") + cmd.Flags().StringVar(&opts.nExamples, "nExamples", 5, "Maximum number of example queries that benefit from the suggested index.") + cmd.Flags().StringVar(&opts.nIndexes, "nIndexes", , "Number that indicates the maximum indexes to suggest.") + cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index b29188b4f8..f02b609c3d 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -78,9 +78,10 @@ func CreatePrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") @@ -140,7 +141,6 @@ func CreatePrivateEndpointServiceBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -202,9 +202,11 @@ func DeletePrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") @@ -267,9 +269,10 @@ func DeletePrivateEndpointServiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") @@ -333,9 +336,11 @@ func GetPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") @@ -398,9 +403,10 @@ func GetPrivateEndpointServiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") @@ -460,7 +466,6 @@ func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -518,9 +523,9 @@ func ListPrivateEndpointServicesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -579,7 +584,6 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index e9d60fafaf..574aab7227 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -76,9 +76,9 @@ func AddProjectApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") @@ -137,7 +137,6 @@ func CreateApiKeyBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -201,9 +200,12 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -262,7 +264,6 @@ func CreateProjectApiKeyBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -320,9 +321,9 @@ func DeleteApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -383,9 +384,10 @@ func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") _ = cmd.MarkFlagRequired("ipAddress") @@ -445,9 +447,9 @@ func GetApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -508,9 +510,10 @@ func GetApiKeyAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("ipAddress") _ = cmd.MarkFlagRequired("apiUserId") @@ -576,9 +579,12 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -642,8 +648,10 @@ func ListApiKeysBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -706,8 +714,10 @@ func ListProjectApiKeysBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -765,9 +775,9 @@ func RemoveProjectApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") @@ -826,9 +836,9 @@ func UpdateApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key you want to update.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key you want to update.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -893,9 +903,12 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index a0bba2a83a..82151944d4 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -81,8 +81,10 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -140,9 +142,9 @@ func DeleteProjectIpAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: - how your application established the connection, - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: - how your application established the connection, - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") @@ -201,9 +203,9 @@ func GetProjectIpAccessListStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Network address or cloud provider security construct that identifies which project access list entry to be verified.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Network address or cloud provider security construct that identifies which project access list entry to be verified.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") @@ -262,9 +264,9 @@ func GetProjectIpListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") @@ -328,8 +330,10 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index fda25319f7..834f8773b4 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -74,9 +74,8 @@ func CreateProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. ") - + return cmd } @@ -133,7 +132,6 @@ func CreateProjectInvitationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -191,7 +189,6 @@ func DeleteProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -249,9 +246,9 @@ func DeleteProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") @@ -310,9 +307,9 @@ func DeleteProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -371,7 +368,6 @@ func GetProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -429,7 +425,6 @@ func GetProjectByNameBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupName, "groupName", , "Human-readable label that identifies this project.") - _ = cmd.MarkFlagRequired("groupName") return cmd @@ -487,9 +482,9 @@ func GetProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") @@ -548,9 +543,9 @@ func GetProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -609,7 +604,6 @@ func GetProjectSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -669,7 +663,7 @@ func ListProjectInvitationsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.username, "username", , "Email address of the user account invited to this project.") - + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -727,7 +721,6 @@ func ListProjectLimitsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -794,8 +787,12 @@ func ListProjectUsersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.flattenTeams, "flattenTeams", false, "Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `\"flattenTeams\" : false`, this resource returns only users with a role in the project. If `\"flattenTeams\" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.") cmd.Flags().StringVar(&opts.includeOrgUsers, "includeOrgUsers", false, "Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `\"includeOrgUsers\": false`, this resource returns only users with a role in the project. If `\"includeOrgUsers\": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.flattenTeams, "flattenTeams", false, "Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `\"flattenTeams\" : false`, this resource returns only users with a role in the project. If `\"flattenTeams\" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.") + cmd.Flags().StringVar(&opts.includeOrgUsers, "includeOrgUsers", false, "Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `\"includeOrgUsers\": false`, this resource returns only users with a role in the project. If `\"includeOrgUsers\": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -855,9 +852,10 @@ func ListProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - return cmd } @@ -914,9 +912,9 @@ func RemoveProjectUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("userId") @@ -975,9 +973,9 @@ func SetProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -1036,7 +1034,6 @@ func UpdateProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1094,7 +1091,6 @@ func UpdateProjectInvitationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1152,9 +1148,9 @@ func UpdateProjectInvitationByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") @@ -1213,7 +1209,6 @@ func UpdateProjectSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index a973012407..1639520a65 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -76,9 +76,9 @@ func CreateRollingIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index 03e5a3d299..bac22b4ee8 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -74,7 +74,5 @@ func GetSystemStatusBuilder() *cobra.Command { } - - return cmd } diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index c231c210c3..c790c11f92 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -76,7 +76,6 @@ func CreateServerlessInstanceBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,9 +133,9 @@ func DeleteServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") @@ -195,9 +194,9 @@ func GetServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") @@ -261,8 +260,10 @@ func ListServerlessInstancesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -320,9 +321,9 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index e72562c163..58de89d0d0 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -76,9 +76,9 @@ func CreateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") @@ -139,9 +139,10 @@ func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") @@ -203,9 +204,10 @@ func GetServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") @@ -265,9 +267,9 @@ func ListServerlessPrivateEndpointsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") @@ -328,9 +330,10 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.") cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index 577b4b9622..a86e48096a 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -76,9 +76,9 @@ func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -139,9 +139,10 @@ func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.restoreId, "restoreId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.restoreId, "restoreId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") - _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("restoreId") @@ -201,9 +202,9 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index 9000280327..b7f4420ea7 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -76,9 +76,9 @@ func DownloadSharedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -139,9 +139,10 @@ func GetSharedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -201,9 +202,9 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 685a1f345d..46e44aa0b0 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -76,7 +76,6 @@ func AddAllTeamsToProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -134,9 +133,9 @@ func AddTeamUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -195,7 +194,6 @@ func CreateTeamBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - _ = cmd.MarkFlagRequired("orgId") return cmd @@ -253,9 +251,9 @@ func DeleteTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to delete.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to delete.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -314,9 +312,9 @@ func GetTeamByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose information you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose information you want to return.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -375,9 +373,9 @@ func GetTeamByNameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamName, "teamName", , "Name of the team whose information you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamName, "teamName", , "Name of the team whose information you want to return.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamName") @@ -441,8 +439,10 @@ func ListOrganizationTeamsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -505,8 +505,10 @@ func ListProjectTeamsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -568,9 +570,11 @@ func ListTeamUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -629,9 +633,9 @@ func RemoveProjectTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") @@ -692,9 +696,10 @@ func RemoveTeamUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.") cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.") + cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") _ = cmd.MarkFlagRequired("userId") @@ -754,9 +759,9 @@ func RenameTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to rename.") + cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to rename.") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -815,9 +820,9 @@ func UpdateTeamRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index e97defb86d..e14e01a96d 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -74,9 +74,8 @@ func VersionedExampleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.additionalInfo, "additionalInfo", false, "") - + return cmd } diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index fd30cf897b..7296362d21 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -82,9 +82,12 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") @@ -143,9 +146,9 @@ func DeleteThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") @@ -204,9 +207,9 @@ func GetThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("integrationType") @@ -270,8 +273,10 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -335,9 +340,12 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 6fd59b28c8..38a04bce2b 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -76,9 +76,9 @@ func CreateDatabaseUserCertificateBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account for whom to create a certificate.") + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account for whom to create a certificate.") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") @@ -137,7 +137,6 @@ func DisableCustomerManagedX509Builder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - _ = cmd.MarkFlagRequired("groupId") return cmd @@ -201,9 +200,12 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account whose certificates you want to return.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account whose certificates you want to return.") + cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 2ec0e7537e..bb6886ecb2 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -71,14 +71,16 @@ func {{operationId}}Builder() *cobra.Command { return opts.Run(cmd.Context()) }, } - {{#pathParams}} - cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}"){{/pathParams}} - {{#queryParams}} - cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}"){{/queryParams}} - {{#pathParams}}{{#required}} - _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/pathParams}}{{#queryParams}}{{#required}} +{{#pathParams}} + cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}") +{{/pathParams}} +{{#queryParams}} + cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}") +{{/queryParams}} +{{#pathParams}}{{#required}} + _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/pathParams}} +{{#queryParams}}{{#required}} _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/queryParams}} - return cmd } {{/operation}} From 5d22732b264f4ac73cbc67f3534fad9b9902e66b Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 31 May 2023 18:10:45 +0100 Subject: [PATCH 08/44] update commands --- internal/generated/api_access_tracking_cmd.go | 12 ++++++ .../generated/api_alert_configurations_cmd.go | 18 +++++++++ internal/generated/api_alerts_cmd.go | 14 +++++++ internal/generated/api_atlas_search_cmd.go | 15 +++++++ internal/generated/api_auditing_cmd.go | 12 ++++++ .../generated/api_aws_clusters_dns_cmd.go | 12 ++++++ internal/generated/api_cloud_backups_cmd.go | 39 +++++++++++++++++++ .../api_cloud_migration_service_cmd.go | 18 +++++++++ .../api_cloud_provider_access_cmd.go | 15 +++++++ .../api_cluster_outage_simulation_cmd.go | 13 +++++++ internal/generated/api_clusters_cmd.go | 19 +++++++++ .../api_custom_database_roles_cmd.go | 15 +++++++ internal/generated/api_data_federation_cmd.go | 24 ++++++++++++ .../generated/api_data_lake_pipelines_cmd.go | 23 +++++++++++ internal/generated/api_database_users_cmd.go | 15 +++++++ ..._rest_using_customer_key_management_cmd.go | 12 ++++++ internal/generated/api_events_cmd.go | 14 +++++++ .../api_federated_authentication_cmd.go | 25 ++++++++++++ internal/generated/api_global_clusters_cmd.go | 16 ++++++++ internal/generated/api_invoices_cmd.go | 14 +++++++ .../generated/api_ldap_configuration_cmd.go | 15 +++++++ internal/generated/api_legacy_backup_cmd.go | 20 ++++++++++ .../api_legacy_backup_restore_jobs_cmd.go | 11 ++++++ .../generated/api_maintenance_windows__cmd.go | 15 +++++++ .../generated/api_mongo_db_cloud_users_cmd.go | 13 +++++++ .../generated/api_monitoring_and_logs_cmd.go | 24 ++++++++++++ .../generated/api_multi_cloud_clusters_cmd.go | 20 ++++++++++ internal/generated/api_network_peering_cmd.go | 24 ++++++++++++ internal/generated/api_online_archive_cmd.go | 16 ++++++++ internal/generated/api_organizations_cmd.go | 25 ++++++++++++ .../generated/api_performance_advisor_cmd.go | 15 +++++++ .../api_private_endpoint_services_cmd.go | 19 +++++++++ .../api_programmatic_api_keys_cmd.go | 24 ++++++++++++ .../api_project_ip_access_list_cmd.go | 15 +++++++ internal/generated/api_projects_cmd.go | 30 ++++++++++++++ internal/generated/api_rolling_index_cmd.go | 11 ++++++ internal/generated/api_root_cmd.go | 11 ++++++ .../generated/api_serverless_instances_cmd.go | 15 +++++++ .../api_serverless_private_endpoints_cmd.go | 15 +++++++ .../api_shared_tier_restore_jobs_cmd.go | 13 +++++++ .../api_shared_tier_snapshots_cmd.go | 13 +++++++ internal/generated/api_teams_cmd.go | 23 +++++++++++ internal/generated/api_test__cmd.go | 11 ++++++ .../api_third_party_integrations_cmd.go | 17 ++++++++ .../generated/api_x509_authentication_cmd.go | 13 +++++++ .../config/go-templates/cmd.mustache | 17 ++++++++ 46 files changed, 790 insertions(+) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index 3b53f9f825..ede89afc4f 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -175,3 +175,15 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { return cmd } + +func AccessTrackingApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns access logs for authentication attempts made to Atlas database deployments. To view database access history, you must have either the Project Owner or Organization Owner role.", + } + cmd.AddCommand( + ListAccessLogsByClusterNameBuilder(), + ListAccessLogsByHostnameBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index eead521033..9a075c5b21 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -513,3 +513,21 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { return cmd } + +func AlertConfigurationsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.", + } + cmd.AddCommand( + CreateAlertConfigurationBuilder(), + DeleteAlertConfigurationBuilder(), + GetAlertConfigurationBuilder(), + ListAlertConfigurationMatchersFieldNamesBuilder(), + ListAlertConfigurationsBuilder(), + ListAlertConfigurationsByAlertIdBuilder(), + ToggleAlertConfigurationBuilder(), + UpdateAlertConfigurationBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 791ff86261..79986bca2c 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -284,3 +284,17 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { return cmd } + +func AlertsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.", + } + cmd.AddCommand( + AcknowledgeAlertBuilder(), + GetAlertBuilder(), + ListAlertsBuilder(), + ListAlertsByAlertConfigurationIdBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index 4f8fe4e06a..d8d57d2423 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -348,3 +348,18 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { return cmd } + +func AtlasSearchApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.", + } + cmd.AddCommand( + CreateAtlasSearchIndexBuilder(), + DeleteAtlasSearchIndexBuilder(), + GetAtlasSearchIndexBuilder(), + ListAtlasSearchIndexesBuilder(), + UpdateAtlasSearchIndexBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index e31bbd8694..5e003e959c 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -137,3 +137,15 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { return cmd } + +func AuditingApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns and edits database auditing settings for MongoDB Cloud projects.", + } + cmd.AddCommand( + GetAuditingConfigurationBuilder(), + UpdateAuditingConfigurationBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index c1d8bee3c3..7e9eb9dcff 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -137,3 +137,15 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { return cmd } + +func AWSClustersDNSApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns and edits custom DNS configurations for MongoDB Cloud database deployments on AWS. The resource requires your Project ID. If you use the VPC peering on AWS and you use your own DNS servers instead of Amazon Route 53, enable custom DNS. Before 31 March 2020, applications deployed within AWS using custom DNS services and VPC-peered with MongoDB Cloud couldn't connect over private IP addresses. Custom DNS resolved to public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings.", + } + cmd.AddCommand( + GetAWSCustomDNSBuilder(), + ToggleAWSCustomDNSBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index 33ba3f5d33..7616c84419 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -1870,3 +1870,42 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { return cmd } + +func CloudBackupsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.", + } + cmd.AddCommand( + CancelBackupRestoreJobBuilder(), + CreateBackupExportJobBuilder(), + CreateBackupRestoreJobBuilder(), + CreateExportBucketBuilder(), + CreateServerlessBackupRestoreJobBuilder(), + DeleteAllBackupSchedulesBuilder(), + DeleteExportBucketBuilder(), + DeleteReplicaSetBackupBuilder(), + DeleteShardedClusterBackupBuilder(), + GetBackupExportJobBuilder(), + GetBackupRestoreJobBuilder(), + GetBackupScheduleBuilder(), + GetDataProtectionSettingsBuilder(), + GetExportBucketBuilder(), + GetReplicaSetBackupBuilder(), + GetServerlessBackupBuilder(), + GetServerlessBackupRestoreJobBuilder(), + GetShardedClusterBackupBuilder(), + ListBackupExportJobsBuilder(), + ListBackupRestoreJobsBuilder(), + ListExportBucketsBuilder(), + ListReplicaSetBackupsBuilder(), + ListServerlessBackupRestoreJobsBuilder(), + ListServerlessBackupsBuilder(), + ListShardedClusterBackupsBuilder(), + TakeSnapshotBuilder(), + UpdateBackupScheduleBuilder(), + UpdateDataProtectionSettingsBuilder(), + UpdateSnapshotRetentionBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index 6500d2567f..4c58543851 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -491,3 +491,21 @@ func ValidateMigrationBuilder() *cobra.Command { return cmd } + +func CloudMigrationServiceApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.", + } + cmd.AddCommand( + CreateLinkTokenBuilder(), + CreatePushMigrationBuilder(), + CutoverMigrationBuilder(), + DeleteLinkTokenBuilder(), + GetPushMigrationBuilder(), + GetValidationStatusBuilder(), + ListSourceProjectsBuilder(), + ValidateMigrationBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index 975735b468..d5c7b23ed2 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -324,3 +324,18 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { return cmd } + +func CloudProviderAccessApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, authorizes, and removes AWS IAM roles in Atlas.", + } + cmd.AddCommand( + AuthorizeCloudProviderAccessRoleBuilder(), + CreateCloudProviderAccessRoleBuilder(), + DeauthorizeCloudProviderAccessRoleBuilder(), + GetCloudProviderAccessRoleBuilder(), + ListCloudProviderAccessRolesBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index f89ae07a7b..1a7207aa85 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -206,3 +206,16 @@ func StartOutageSimulationBuilder() *cobra.Command { return cmd } + +func ClusterOutageSimulationApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, starts, or ends a cluster outage simulation.", + } + cmd.AddCommand( + EndOutageSimulationBuilder(), + GetOutageSimulationBuilder(), + StartOutageSimulationBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 386e87e517..722c9d99f9 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -576,3 +576,22 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { return cmd } + +func ClustersApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.", + } + cmd.AddCommand( + GetClusterAdvancedConfigurationBuilder(), + GetClusterStatusBuilder(), + GetSampleDatasetLoadStatusBuilder(), + ListCloudProviderRegionsBuilder(), + ListClustersForAllProjectsBuilder(), + LoadSampleDatasetBuilder(), + UpdateClusterAdvancedConfigurationBuilder(), + UpgradeSharedClusterBuilder(), + UpgradeSharedClusterToServerlessBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index 541a6c12aa..346faffb2a 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -320,3 +320,18 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { return cmd } + +func CustomDatabaseRolesApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the project level, for all clusters in the project. This resource supports a subset of MongoDB privilege actions. You can create a subset of custom role actions. To create a wider list of custom role actions, use the MongoDB Cloud user interface. Custom roles must include actions that all project's clusters support, and that are compatible with each MongoDB version that your project's clusters use. For example, if your project has MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4.", + } + cmd.AddCommand( + CreateCustomDatabaseRoleBuilder(), + DeleteCustomDatabaseRoleBuilder(), + GetCustomDatabaseRoleBuilder(), + ListCustomDatabaseRolesBuilder(), + UpdateCustomDatabaseRoleBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index 856fc04ce1..d7a77fd72d 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -898,3 +898,27 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("skipRoleValidation") return cmd } + +func DataFederationApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.", + } + cmd.AddCommand( + CreateDataFederationPrivateEndpointBuilder(), + CreateFederatedDatabaseBuilder(), + CreateOneDataFederationQueryLimitBuilder(), + DeleteDataFederationPrivateEndpointBuilder(), + DeleteFederatedDatabaseBuilder(), + DeleteOneDataFederationInstanceQueryLimitBuilder(), + DownloadFederatedDatabaseQueryLogsBuilder(), + GetDataFederationPrivateEndpointBuilder(), + GetFederatedDatabaseBuilder(), + ListDataFederationPrivateEndpointsBuilder(), + ListFederatedDatabasesBuilder(), + ReturnFederatedDatabaseQueryLimitBuilder(), + ReturnFederatedDatabaseQueryLimitsBuilder(), + UpdateFederatedDatabaseBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 5e66f293dd..573a6a1cbe 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -840,3 +840,26 @@ func UpdatePipelineBuilder() *cobra.Command { return cmd } + +func DataLakePipelinesApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.", + } + cmd.AddCommand( + CreatePipelineBuilder(), + DeletePipelineBuilder(), + DeletePipelineRunDatasetBuilder(), + GetPipelineBuilder(), + GetPipelineRunBuilder(), + ListPipelineRunsBuilder(), + ListPipelineSchedulesBuilder(), + ListPipelineSnapshotsBuilder(), + ListPipelinesBuilder(), + PausePipelineBuilder(), + ResumePipelineBuilder(), + TriggerSnapshotIngestionBuilder(), + UpdatePipelineBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 049e420989..ab4062e2a6 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -341,3 +341,18 @@ func UpdateDatabaseUserBuilder() *cobra.Command { return cmd } + +func DatabaseUsersApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes database users.", + } + cmd.AddCommand( + CreateDatabaseUserBuilder(), + DeleteDatabaseUserBuilder(), + GetDatabaseUserBuilder(), + ListDatabaseUsersBuilder(), + UpdateDatabaseUserBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index 8b56c2ca37..f1d41cb811 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -137,3 +137,15 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { return cmd } + +func EncryptionAtRestUsingCustomerKeyManagementApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.", + } + cmd.AddCommand( + GetEncryptionAtRestBuilder(), + UpdateEncryptionAtRestBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 351c984b4c..dc395de174 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -310,3 +310,17 @@ func ListProjectEventsBuilder() *cobra.Command { return cmd } + +func EventsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns events. This collection remains under revision and may change.", + } + cmd.AddCommand( + GetOrganizationEventBuilder(), + GetProjectEventBuilder(), + ListOrganizationEventsBuilder(), + ListProjectEventsBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index b3e685b735..21cb6369d0 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -934,3 +934,28 @@ func UpdateRoleMappingBuilder() *cobra.Command { return cmd } + +func FederatedAuthenticationApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.", + } + cmd.AddCommand( + CreateRoleMappingBuilder(), + DeleteFederationAppBuilder(), + DeleteRoleMappingBuilder(), + GetConnectedOrgConfigBuilder(), + GetFederationSettingsBuilder(), + GetIdentityProviderBuilder(), + GetIdentityProviderMetadataBuilder(), + GetRoleMappingBuilder(), + ListConnectedOrgConfigsBuilder(), + ListIdentityProvidersBuilder(), + ListRoleMappingsBuilder(), + RemoveConnectedOrgConfigBuilder(), + UpdateConnectedOrgConfigBuilder(), + UpdateIdentityProviderBuilder(), + UpdateRoleMappingBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index f07daa8cdd..ea8f985d2e 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -334,3 +334,19 @@ func GetManagedNamespaceBuilder() *cobra.Command { return cmd } + +func GlobalClustersApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. +MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster.", + } + cmd.AddCommand( + CreateCustomZoneMappingBuilder(), + CreateManagedNamespaceBuilder(), + DeleteAllCustomZoneMappingsBuilder(), + DeleteManagedNamespaceBuilder(), + GetManagedNamespaceBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index d7f37ca286..5f41e5bd40 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -268,3 +268,17 @@ func ListPendingInvoicesBuilder() *cobra.Command { return cmd } + +func InvoicesApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns invoices.", + } + cmd.AddCommand( + DownloadInvoiceCSVBuilder(), + GetInvoiceBuilder(), + ListInvoicesBuilder(), + ListPendingInvoicesBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 0fee4bc84a..bc5079efc9 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -312,3 +312,18 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { return cmd } + +func LDAPConfigurationApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.", + } + cmd.AddCommand( + DeleteLDAPConfigurationBuilder(), + GetLDAPConfigurationBuilder(), + GetLDAPConfigurationStatusBuilder(), + SaveLDAPConfigurationBuilder(), + VerifyLDAPConfigurationBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index f04ef896fb..3269bb8076 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -686,3 +686,23 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { return cmd } + +func LegacyBackupApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.", + } + cmd.AddCommand( + DeleteLegacySnapshotBuilder(), + GetLegacyBackupCheckpointBuilder(), + GetLegacyBackupRestoreJobBuilder(), + GetLegacySnapshotBuilder(), + GetLegacySnapshotScheduleBuilder(), + ListLegacyBackupCheckpointsBuilder(), + ListLegacyBackupRestoreJobsBuilder(), + ListLegacySnapshotsBuilder(), + UpdateLegacySnapshotRetentionBuilder(), + UpdateLegacySnapshotScheduleBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index a7cc7f2556..87c6f6c561 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -84,3 +84,14 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { return cmd } + +func LegacyBackupRestoreJobsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "", + } + cmd.AddCommand( + CreateLegacyBackupRestoreJobBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index baf0faf935..37e64852bb 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -308,3 +308,18 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { return cmd } + +func MaintenanceWindowsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, edits, and removes maintenance windows. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. You can defer a scheduled maintenance event for a project up to two times. Deferred maintenance events occur during your preferred maintenance window exactly one week after the previously scheduled date and time.", + } + cmd.AddCommand( + DeferMaintenanceWindowBuilder(), + GetMaintenanceWindowBuilder(), + ResetMaintenanceWindowBuilder(), + ToggleMaintenanceAutoDeferBuilder(), + UpdateMaintenanceWindowBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index b837fafa31..bf488ae745 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -190,3 +190,16 @@ func GetUserByUsernameBuilder() *cobra.Command { return cmd } + +func MongoDBCloudUsersApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, and edits MongoDB Cloud users.", + } + cmd.AddCommand( + CreateUserBuilder(), + GetUserBuilder(), + GetUserByUsernameBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index c715d7d530..03ae4ab889 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -1045,3 +1045,27 @@ func ListMetricTypesBuilder() *cobra.Command { return cmd } + +func MonitoringAndLogsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns database deployment monitoring and logging data.", + } + cmd.AddCommand( + GetAtlasProcessBuilder(), + GetDatabaseBuilder(), + GetDatabaseMeasurementsBuilder(), + GetDiskMeasurementsBuilder(), + GetHostLogsBuilder(), + GetHostMeasurementsBuilder(), + GetIndexMetricsBuilder(), + GetMeasurementsBuilder(), + ListAtlasProcessesBuilder(), + ListDatabasesBuilder(), + ListDiskMeasurementsBuilder(), + ListDiskPartitionsBuilder(), + ListIndexMetricsBuilder(), + ListMetricTypesBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 32cb3b3d4b..77bc43dc1b 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -393,3 +393,23 @@ func UpdateClusterBuilder() *cobra.Command { return cmd } + +func MultiCloudClustersApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. + +The total number of nodes in clusters spanning across regions has a specific constraint on a per-project basis. MongoDB Cloud limits the total number of nodes in other regions in one project to a total of 40. This total excludes Google Cloud regions communicating with each other, shared-tier clusters, or serverless clusters. The total number of nodes between any two regions must meet this constraint. For example, if a project has nodes in clusters spread across three regions: 30 nodes in Region A, 10 nodes in Region B, and 5 nodes in Region C, you can add only 5 more nodes to Region C because if you exclude Region C, Region A + Region B = 40. If you exclude Region B, Region A + Region C = 35, <= 40. If you exclude Region A, Region B + Region C = 15, <= 40. Each combination of regions with the added 5 nodes still meets the per-project constraint. Region A + B = 40. Region A + C = 40. Region B + C = 20. You can't create a multi-region cluster in a project if it has one or more clusters spanning 40 or more nodes in other regions. Each project supports up to 25 database deployments. + +If your MongoDB Cloud project contains a custom role that uses actions introduced in a specific MongoDB version, you must delete that role before you create clusters with an earlier MongoDB version. MongoDB Cloud clusters created after July 2020 use TLS version 1.2 by default. When you create a cluster, MongoDB Cloud creates a network container in the project for the cloud provider to which you deploy the cluster if one doesn't already exist.", + } + cmd.AddCommand( + CreateClusterBuilder(), + DeleteClusterBuilder(), + GetClusterBuilder(), + ListClustersBuilder(), + TestFailoverBuilder(), + UpdateClusterBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index be88615d15..74bdb9d1ac 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -822,3 +822,27 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { return cmd } + +func NetworkPeeringApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes network peering containers and peering connections. +When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block.", + } + cmd.AddCommand( + CreatePeeringConnectionBuilder(), + CreatePeeringContainerBuilder(), + DeletePeeringConnectionBuilder(), + DeletePeeringContainerBuilder(), + DisablePeeringBuilder(), + GetPeeringConnectionBuilder(), + GetPeeringContainerBuilder(), + ListPeeringConnectionsBuilder(), + ListPeeringContainerByCloudProviderBuilder(), + ListPeeringContainersBuilder(), + UpdatePeeringConnectionBuilder(), + UpdatePeeringContainerBuilder(), + VerifyConnectViaPeeringOnlyModeForOneProjectBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index 330e0f8a21..ccaff0e73f 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -419,3 +419,19 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { return cmd } + +func OnlineArchiveApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, or removes an online archive.", + } + cmd.AddCommand( + CreateOnlineArchiveBuilder(), + DeleteOnlineArchiveBuilder(), + DownloadOnlineArchiveQueryLogsBuilder(), + GetOnlineArchiveBuilder(), + ListOnlineArchivesBuilder(), + UpdateOnlineArchiveBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index be9d0c2eda..6468ab8e37 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -918,3 +918,28 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { return cmd } + +func OrganizationsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, and edits organizational units in MongoDB Cloud.", + } + cmd.AddCommand( + CreateOrganizationBuilder(), + CreateOrganizationInvitationBuilder(), + DeleteOrganizationBuilder(), + DeleteOrganizationInvitationBuilder(), + GetOrganizationBuilder(), + GetOrganizationInvitationBuilder(), + GetOrganizationSettingsBuilder(), + ListOrganizationInvitationsBuilder(), + ListOrganizationProjectsBuilder(), + ListOrganizationUsersBuilder(), + ListOrganizationsBuilder(), + RenameOrganizationBuilder(), + UpdateOrganizationInvitationBuilder(), + UpdateOrganizationInvitationByIdBuilder(), + UpdateOrganizationSettingsBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index a9fb0d3863..9cd91c7114 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -362,3 +362,18 @@ func ListSuggestedIndexesBuilder() *cobra.Command { return cmd } + +func PerformanceAdvisorApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns suggested indexes and slow query data for a database deployment. Also enables or disables MongoDB Cloud-managed slow operation thresholds. To view field values in a sample query, you must have the Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted data rather than the field values.", + } + cmd.AddCommand( + DisableSlowOperationThresholdingBuilder(), + EnableSlowOperationThresholdingBuilder(), + ListSlowQueriesBuilder(), + ListSlowQueryNamespacesBuilder(), + ListSuggestedIndexesBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index f02b609c3d..af450fee41 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -588,3 +588,22 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return cmd } + +func PrivateEndpointServicesApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes private endpoint services.", + } + cmd.AddCommand( + CreatePrivateEndpointBuilder(), + CreatePrivateEndpointServiceBuilder(), + DeletePrivateEndpointBuilder(), + DeletePrivateEndpointServiceBuilder(), + GetPrivateEndpointBuilder(), + GetPrivateEndpointServiceBuilder(), + GetRegionalizedPrivateEndpointSettingBuilder(), + ListPrivateEndpointServicesBuilder(), + ToggleRegionalizedPrivateEndpointSettingBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 574aab7227..5f983c03eb 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -914,3 +914,27 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { return cmd } + +func ProgrammaticAPIKeysApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes access tokens to use the MongoDB Cloud API. MongoDB Cloud applies these keys to organizations. These resources can return, assign, or revoke use of these keys within a specified project.", + } + cmd.AddCommand( + AddProjectApiKeyBuilder(), + CreateApiKeyBuilder(), + CreateApiKeyAccessListBuilder(), + CreateProjectApiKeyBuilder(), + DeleteApiKeyBuilder(), + DeleteApiKeyAccessListEntryBuilder(), + GetApiKeyBuilder(), + GetApiKeyAccessListBuilder(), + ListApiKeyAccessListsEntriesBuilder(), + ListApiKeysBuilder(), + ListProjectApiKeysBuilder(), + RemoveProjectApiKeyBuilder(), + UpdateApiKeyBuilder(), + UpdateApiKeyRolesBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 82151944d4..fef1d0a19b 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -338,3 +338,18 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { return cmd } + +func ProjectIPAccessListApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period.", + } + cmd.AddCommand( + CreateProjectIpAccessListBuilder(), + DeleteProjectIpAccessListBuilder(), + GetProjectIpAccessListStatusBuilder(), + GetProjectIpListBuilder(), + ListProjectIpAccessListsBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 834f8773b4..b550ed3b51 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -1213,3 +1213,33 @@ func UpdateProjectSettingsBuilder() *cobra.Command { return cmd } + +func ProjectsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, and edits collections of clusters and users in MongoDB Cloud.", + } + cmd.AddCommand( + CreateProjectBuilder(), + CreateProjectInvitationBuilder(), + DeleteProjectBuilder(), + DeleteProjectInvitationBuilder(), + DeleteProjectLimitBuilder(), + GetProjectBuilder(), + GetProjectByNameBuilder(), + GetProjectInvitationBuilder(), + GetProjectLimitBuilder(), + GetProjectSettingsBuilder(), + ListProjectInvitationsBuilder(), + ListProjectLimitsBuilder(), + ListProjectUsersBuilder(), + ListProjectsBuilder(), + RemoveProjectUserBuilder(), + SetProjectLimitBuilder(), + UpdateProjectBuilder(), + UpdateProjectInvitationBuilder(), + UpdateProjectInvitationByIdBuilder(), + UpdateProjectSettingsBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index 1639520a65..fcd758bf40 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -84,3 +84,14 @@ func CreateRollingIndexBuilder() *cobra.Command { return cmd } + +func RollingIndexApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.", + } + cmd.AddCommand( + CreateRollingIndexBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index bac22b4ee8..2bdeb275b9 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -76,3 +76,14 @@ func GetSystemStatusBuilder() *cobra.Command { return cmd } + +func RootApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns details that describe the MongoDB Cloud build and the access token that requests this resource. This starts the MongoDB Cloud API.", + } + cmd.AddCommand( + GetSystemStatusBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index c790c11f92..c26c371d80 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -329,3 +329,18 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { return cmd } + +func ServerlessInstancesApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes serverless instances.", + } + cmd.AddCommand( + CreateServerlessInstanceBuilder(), + DeleteServerlessInstanceBuilder(), + GetServerlessInstanceBuilder(), + ListServerlessInstancesBuilder(), + UpdateServerlessInstanceBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index 58de89d0d0..c86b542f73 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -340,3 +340,18 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { return cmd } + +func ServerlessPrivateEndpointsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial.", + } + cmd.AddCommand( + CreateServerlessPrivateEndpointBuilder(), + DeleteServerlessPrivateEndpointBuilder(), + GetServerlessPrivateEndpointBuilder(), + ListServerlessPrivateEndpointsBuilder(), + UpdateServerlessPrivateEndpointBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index a86e48096a..8761805c19 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -210,3 +210,16 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { return cmd } + +func SharedTierRestoreJobsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns and adds restore jobs for shared-tier database deployments.", + } + cmd.AddCommand( + CreateSharedClusterBackupRestoreJobBuilder(), + GetSharedClusterBackupRestoreJobBuilder(), + ListSharedClusterBackupRestoreJobsBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index b7f4420ea7..5b00d9ac03 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -210,3 +210,16 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { return cmd } + +func SharedTierSnapshotsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns and requests to download shared-tier database deployment snapshots.", + } + cmd.AddCommand( + DownloadSharedClusterBackupBuilder(), + GetSharedClusterBackupBuilder(), + ListSharedClusterBackupsBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 46e44aa0b0..badaf4a0fc 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -828,3 +828,26 @@ func UpdateTeamRolesBuilder() *cobra.Command { return cmd } + +func TeamsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, or removes teams.", + } + cmd.AddCommand( + AddAllTeamsToProjectBuilder(), + AddTeamUserBuilder(), + CreateTeamBuilder(), + DeleteTeamBuilder(), + GetTeamByIdBuilder(), + GetTeamByNameBuilder(), + ListOrganizationTeamsBuilder(), + ListProjectTeamsBuilder(), + ListTeamUsersBuilder(), + RemoveProjectTeamBuilder(), + RemoveTeamUserBuilder(), + RenameTeamBuilder(), + UpdateTeamRolesBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index e14e01a96d..33272b3028 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -79,3 +79,14 @@ func VersionedExampleBuilder() *cobra.Command { return cmd } + +func TestApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Atlas test endpoints.", + } + cmd.AddCommand( + VersionedExampleBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index 7296362d21..fa89071e4d 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -351,3 +351,20 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { return cmd } + +func ThirdPartyIntegrationsApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, adds, edits, and removes third-party service integration configurations. MongoDB Cloud sends alerts to each third-party service that you configure. + +**IMPORTANT**: Each project can only have one configuration per integrationType.", + } + cmd.AddCommand( + CreateThirdPartyIntegrationBuilder(), + DeleteThirdPartyIntegrationBuilder(), + GetThirdPartyIntegrationBuilder(), + ListThirdPartyIntegrationsBuilder(), + UpdateThirdPartyIntegrationBuilder(), + ) + return cmd +} diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 38a04bce2b..842a084fb1 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -211,3 +211,16 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { return cmd } + +func X509AuthenticationApiBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "<>", + Short: "Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages your certificates, it also manages your Certificate Authority and can generate certificates for your database users. No additional X.509 configuration is required. If you manage your certificates, you must provide a Certificate Authority and generate certificates for your database users.", + } + cmd.AddCommand( + CreateDatabaseUserCertificateBuilder(), + DisableCustomerManagedX509Builder(), + ListDatabaseUserCertificatesBuilder(), + ) + return cmd +} diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index bb6886ecb2..c9f402ae1c 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -85,3 +85,20 @@ func {{operationId}}Builder() *cobra.Command { } {{/operation}} {{/operations}} + +func {{classname}}Builder() *cobra.Command { +{{#operations}} +{{#operation}} +{{#-first}} + cmd := &cobra.Command{ + Use: "<>", + Short: "{{#tags}}{{#-first}}{{description}}{{/-first}}{{/tags}}", + } + cmd.AddCommand( +{{/-first}} + {{operationId}}Builder(), +{{/operation}} +{{/operations}} + ) + return cmd +} From 6b729d5fe5184120088f668d870c74350303a2d9 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 1 Jun 2023 11:15:58 +0100 Subject: [PATCH 09/44] add use join them together --- internal/generated/api_access_tracking_cmd.go | 8 +- .../generated/api_alert_configurations_cmd.go | 20 +-- internal/generated/api_alerts_cmd.go | 12 +- internal/generated/api_atlas_search_cmd.go | 14 +- internal/generated/api_auditing_cmd.go | 8 +- .../generated/api_aws_clusters_dns_cmd.go | 8 +- internal/generated/api_cloud_backups_cmd.go | 62 ++++----- .../api_cloud_migration_service_cmd.go | 20 +-- .../api_cloud_provider_access_cmd.go | 14 +- .../api_cluster_outage_simulation_cmd.go | 10 +- internal/generated/api_clusters_cmd.go | 22 ++-- .../api_custom_database_roles_cmd.go | 14 +- internal/generated/api_data_federation_cmd.go | 32 ++--- .../generated/api_data_lake_pipelines_cmd.go | 30 ++--- internal/generated/api_database_users_cmd.go | 14 +- ..._rest_using_customer_key_management_cmd.go | 8 +- internal/generated/api_events_cmd.go | 12 +- .../api_federated_authentication_cmd.go | 34 ++--- internal/generated/api_global_clusters_cmd.go | 14 +- internal/generated/api_invoices_cmd.go | 12 +- .../generated/api_ldap_configuration_cmd.go | 14 +- internal/generated/api_legacy_backup_cmd.go | 24 ++-- .../api_legacy_backup_restore_jobs_cmd.go | 6 +- .../generated/api_maintenance_windows__cmd.go | 14 +- .../generated/api_mongo_db_cloud_users_cmd.go | 10 +- .../generated/api_monitoring_and_logs_cmd.go | 32 ++--- .../generated/api_multi_cloud_clusters_cmd.go | 16 +-- internal/generated/api_network_peering_cmd.go | 30 ++--- internal/generated/api_online_archive_cmd.go | 16 +-- internal/generated/api_organizations_cmd.go | 34 ++--- .../generated/api_performance_advisor_cmd.go | 14 +- .../api_private_endpoint_services_cmd.go | 22 ++-- .../api_programmatic_api_keys_cmd.go | 32 ++--- .../api_project_ip_access_list_cmd.go | 14 +- internal/generated/api_projects_cmd.go | 44 +++---- internal/generated/api_rolling_index_cmd.go | 6 +- internal/generated/api_root_cmd.go | 6 +- .../generated/api_serverless_instances_cmd.go | 14 +- .../api_serverless_private_endpoints_cmd.go | 14 +- .../api_shared_tier_restore_jobs_cmd.go | 10 +- .../api_shared_tier_snapshots_cmd.go | 10 +- internal/generated/api_teams_cmd.go | 30 ++--- internal/generated/api_test__cmd.go | 6 +- .../api_third_party_integrations_cmd.go | 14 +- .../generated/api_x509_authentication_cmd.go | 10 +- internal/generated/generated.go | 121 +++++++++++++----- .../config/go-templates/cmd.mustache | 6 +- .../config/go-templates/generated.mustache | 81 +++++++----- 48 files changed, 540 insertions(+), 478 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index ede89afc4f..a89cd107e8 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -67,7 +67,7 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { opts := ListAccessLogsByClusterNameOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAccessLogsByClusterName", // Aliases: []string{"?"}, Short: "Return Database Access History for One Cluster using Its Cluster Name", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -143,7 +143,7 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { opts := ListAccessLogsByHostnameOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAccessLogsByHostname", // Aliases: []string{"?"}, Short: "Return Database Access History for One Cluster using Its Hostname", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -176,9 +176,9 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { return cmd } -func AccessTrackingApiBuilder() *cobra.Command { +func AccessTrackingBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "accessTracking", Short: "Returns access logs for authentication attempts made to Atlas database deployments. To view database access history, you must have either the Project Owner or Organization Owner role.", } cmd.AddCommand( diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 9a075c5b21..facfb2bcec 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -55,7 +55,7 @@ func CreateAlertConfigurationBuilder() *cobra.Command { opts := CreateAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createAlertConfiguration", // Aliases: []string{"?"}, Short: "Create One Alert Configuration in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -114,7 +114,7 @@ func DeleteAlertConfigurationBuilder() *cobra.Command { opts := DeleteAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteAlertConfiguration", // Aliases: []string{"?"}, Short: "Remove One Alert Configuration from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -175,7 +175,7 @@ func GetAlertConfigurationBuilder() *cobra.Command { opts := GetAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getAlertConfiguration", // Aliases: []string{"?"}, Short: "Return One Alert Configuration from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -232,7 +232,7 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { opts := ListAlertConfigurationMatchersFieldNamesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAlertConfigurationMatchersFieldNames", // Aliases: []string{"?"}, Short: "Get All Alert Configuration Matchers Field Names", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -293,7 +293,7 @@ func ListAlertConfigurationsBuilder() *cobra.Command { opts := ListAlertConfigurationsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAlertConfigurations", // Aliases: []string{"?"}, Short: "Return All Alert Configurations for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -361,7 +361,7 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { opts := ListAlertConfigurationsByAlertIdOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAlertConfigurationsByAlertId", // Aliases: []string{"?"}, Short: "Return All Alert Configurations Set for One Alert", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -425,7 +425,7 @@ func ToggleAlertConfigurationBuilder() *cobra.Command { opts := ToggleAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "toggleAlertConfiguration", // Aliases: []string{"?"}, Short: "Toggle One State of One Alert Configuration in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -486,7 +486,7 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { opts := UpdateAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateAlertConfiguration", // Aliases: []string{"?"}, Short: "Update One Alert Configuration for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -514,9 +514,9 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { return cmd } -func AlertConfigurationsApiBuilder() *cobra.Command { +func AlertConfigurationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "alertConfigurations", Short: "Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.", } cmd.AddCommand( diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 79986bca2c..85af543901 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -57,7 +57,7 @@ func AcknowledgeAlertBuilder() *cobra.Command { opts := AcknowledgeAlertOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "acknowledgeAlert", // Aliases: []string{"?"}, Short: "Acknowledge One Alert from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -118,7 +118,7 @@ func GetAlertBuilder() *cobra.Command { opts := GetAlertOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getAlert", // Aliases: []string{"?"}, Short: "Return One Alert from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -185,7 +185,7 @@ func ListAlertsBuilder() *cobra.Command { opts := ListAlertsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAlerts", // Aliases: []string{"?"}, Short: "Return All Alerts from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -254,7 +254,7 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { opts := ListAlertsByAlertConfigurationIdOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAlertsByAlertConfigurationId", // Aliases: []string{"?"}, Short: "Return All Open Alerts for Alert Configuration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -285,9 +285,9 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { return cmd } -func AlertsApiBuilder() *cobra.Command { +func AlertsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "alerts", Short: "Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.", } cmd.AddCommand( diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index d8d57d2423..e1df0ddc05 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -57,7 +57,7 @@ func CreateAtlasSearchIndexBuilder() *cobra.Command { opts := CreateAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createAtlasSearchIndex", // Aliases: []string{"?"}, Short: "Create One Atlas Search Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -120,7 +120,7 @@ func DeleteAtlasSearchIndexBuilder() *cobra.Command { opts := DeleteAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteAtlasSearchIndex", // Aliases: []string{"?"}, Short: "Remove One Atlas Search Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -185,7 +185,7 @@ func GetAtlasSearchIndexBuilder() *cobra.Command { opts := GetAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getAtlasSearchIndex", // Aliases: []string{"?"}, Short: "Return One Atlas Search Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -252,7 +252,7 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { opts := ListAtlasSearchIndexesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAtlasSearchIndexes", // Aliases: []string{"?"}, Short: "Return All Atlas Search Indexes for One Collection", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -319,7 +319,7 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { opts := UpdateAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateAtlasSearchIndex", // Aliases: []string{"?"}, Short: "Update One Atlas Search Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -349,9 +349,9 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { return cmd } -func AtlasSearchApiBuilder() *cobra.Command { +func AtlasSearchBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "atlasSearch", Short: "Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.", } cmd.AddCommand( diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index 5e003e959c..87f351156d 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -55,7 +55,7 @@ func GetAuditingConfigurationBuilder() *cobra.Command { opts := GetAuditingConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getAuditingConfiguration", // Aliases: []string{"?"}, Short: "Return the Auditing Configuration for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -112,7 +112,7 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { opts := UpdateAuditingConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateAuditingConfiguration", // Aliases: []string{"?"}, Short: "Update Auditing Configuration for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -138,9 +138,9 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { return cmd } -func AuditingApiBuilder() *cobra.Command { +func AuditingBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "auditing", Short: "Returns and edits database auditing settings for MongoDB Cloud projects.", } cmd.AddCommand( diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 7e9eb9dcff..376a939b3c 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -55,7 +55,7 @@ func GetAWSCustomDNSBuilder() *cobra.Command { opts := GetAWSCustomDNSOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getAWSCustomDNS", // Aliases: []string{"?"}, Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -112,7 +112,7 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { opts := ToggleAWSCustomDNSOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "toggleAWSCustomDNS", // Aliases: []string{"?"}, Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -138,9 +138,9 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { return cmd } -func AWSClustersDNSApiBuilder() *cobra.Command { +func AWSClustersDNSBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "aWSClustersDNS", Short: "Returns and edits custom DNS configurations for MongoDB Cloud database deployments on AWS. The resource requires your Project ID. If you use the VPC peering on AWS and you use your own DNS servers instead of Amazon Route 53, enable custom DNS. Before 31 March 2020, applications deployed within AWS using custom DNS services and VPC-peered with MongoDB Cloud couldn't connect over private IP addresses. Custom DNS resolved to public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings.", } cmd.AddCommand( diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index 7616c84419..00f04d7777 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -59,7 +59,7 @@ func CancelBackupRestoreJobBuilder() *cobra.Command { opts := CancelBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "cancelBackupRestoreJob", // Aliases: []string{"?"}, Short: "Cancel One Restore Job of One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -122,7 +122,7 @@ func CreateBackupExportJobBuilder() *cobra.Command { opts := CreateBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createBackupExportJob", // Aliases: []string{"?"}, Short: "Create One Cloud Backup Snapshot Export Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -183,7 +183,7 @@ func CreateBackupRestoreJobBuilder() *cobra.Command { opts := CreateBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createBackupRestoreJob", // Aliases: []string{"?"}, Short: "Restore One Snapshot of One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -242,7 +242,7 @@ func CreateExportBucketBuilder() *cobra.Command { opts := CreateExportBucketOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createExportBucket", // Aliases: []string{"?"}, Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -301,7 +301,7 @@ func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { opts := CreateServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createServerlessBackupRestoreJob", // Aliases: []string{"?"}, Short: "Restore One Snapshot of One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -362,7 +362,7 @@ func DeleteAllBackupSchedulesBuilder() *cobra.Command { opts := DeleteAllBackupSchedulesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteAllBackupSchedules", // Aliases: []string{"?"}, Short: "Remove All Cloud Backup Schedules", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -423,7 +423,7 @@ func DeleteExportBucketBuilder() *cobra.Command { opts := DeleteExportBucketOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteExportBucket", // Aliases: []string{"?"}, Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -486,7 +486,7 @@ func DeleteReplicaSetBackupBuilder() *cobra.Command { opts := DeleteReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteReplicaSetBackup", // Aliases: []string{"?"}, Short: "Remove One Replica Set Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -551,7 +551,7 @@ func DeleteShardedClusterBackupBuilder() *cobra.Command { opts := DeleteShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteShardedClusterBackup", // Aliases: []string{"?"}, Short: "Remove One Sharded Cluster Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -616,7 +616,7 @@ func GetBackupExportJobBuilder() *cobra.Command { opts := GetBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getBackupExportJob", // Aliases: []string{"?"}, Short: "Return One Cloud Backup Snapshot Export Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -681,7 +681,7 @@ func GetBackupRestoreJobBuilder() *cobra.Command { opts := GetBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getBackupRestoreJob", // Aliases: []string{"?"}, Short: "Return One Restore Job of One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -744,7 +744,7 @@ func GetBackupScheduleBuilder() *cobra.Command { opts := GetBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getBackupSchedule", // Aliases: []string{"?"}, Short: "Return One Cloud Backup Schedule", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -803,7 +803,7 @@ func GetDataProtectionSettingsBuilder() *cobra.Command { opts := GetDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getDataProtectionSettings", // Aliases: []string{"?"}, Short: "Return the Backup Compliance Policy settings", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -862,7 +862,7 @@ func GetExportBucketBuilder() *cobra.Command { opts := GetExportBucketOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getExportBucket", // Aliases: []string{"?"}, Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -925,7 +925,7 @@ func GetReplicaSetBackupBuilder() *cobra.Command { opts := GetReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getReplicaSetBackup", // Aliases: []string{"?"}, Short: "Return One Replica Set Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -990,7 +990,7 @@ func GetServerlessBackupBuilder() *cobra.Command { opts := GetServerlessBackupOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getServerlessBackup", // Aliases: []string{"?"}, Short: "Return One Snapshot of One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1055,7 +1055,7 @@ func GetServerlessBackupRestoreJobBuilder() *cobra.Command { opts := GetServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getServerlessBackupRestoreJob", // Aliases: []string{"?"}, Short: "Return One Restore Job for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1120,7 +1120,7 @@ func GetShardedClusterBackupBuilder() *cobra.Command { opts := GetShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getShardedClusterBackup", // Aliases: []string{"?"}, Short: "Return One Sharded Cluster Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1189,7 +1189,7 @@ func ListBackupExportJobsBuilder() *cobra.Command { opts := ListBackupExportJobsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listBackupExportJobs", // Aliases: []string{"?"}, Short: "Return All Cloud Backup Snapshot Export Jobs", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1259,7 +1259,7 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { opts := ListBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listBackupRestoreJobs", // Aliases: []string{"?"}, Short: "Return All Restore Jobs for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1327,7 +1327,7 @@ func ListExportBucketsBuilder() *cobra.Command { opts := ListExportBucketsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listExportBuckets", // Aliases: []string{"?"}, Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1395,7 +1395,7 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { opts := ListReplicaSetBackupsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listReplicaSetBackups", // Aliases: []string{"?"}, Short: "Return All Replica Set Cloud Backups", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1465,7 +1465,7 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { opts := ListServerlessBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listServerlessBackupRestoreJobs", // Aliases: []string{"?"}, Short: "Return All Restore Jobs for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1535,7 +1535,7 @@ func ListServerlessBackupsBuilder() *cobra.Command { opts := ListServerlessBackupsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listServerlessBackups", // Aliases: []string{"?"}, Short: "Return All Snapshots of One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1599,7 +1599,7 @@ func ListShardedClusterBackupsBuilder() *cobra.Command { opts := ListShardedClusterBackupsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listShardedClusterBackups", // Aliases: []string{"?"}, Short: "Return All Sharded Cluster Cloud Backups", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1660,7 +1660,7 @@ func TakeSnapshotBuilder() *cobra.Command { opts := TakeSnapshotOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "takeSnapshot", // Aliases: []string{"?"}, Short: "Take One On-Demand Snapshot", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1721,7 +1721,7 @@ func UpdateBackupScheduleBuilder() *cobra.Command { opts := UpdateBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateBackupSchedule", // Aliases: []string{"?"}, Short: "Update Cloud Backup Schedule for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1780,7 +1780,7 @@ func UpdateDataProtectionSettingsBuilder() *cobra.Command { opts := UpdateDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateDataProtectionSettings", // Aliases: []string{"?"}, Short: "Update or enable the Backup Compliance Policy settings", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1841,7 +1841,7 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { opts := UpdateSnapshotRetentionOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateSnapshotRetention", // Aliases: []string{"?"}, Short: "Change Expiration Date for One Cloud Backup", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1871,9 +1871,9 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { return cmd } -func CloudBackupsApiBuilder() *cobra.Command { +func CloudBackupsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "cloudBackups", Short: "Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.", } cmd.AddCommand( diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index 4c58543851..ad0aec9a1a 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -55,7 +55,7 @@ func CreateLinkTokenBuilder() *cobra.Command { opts := CreateLinkTokenOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createLinkToken", // Aliases: []string{"?"}, Short: "Create One Link-Token", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -112,7 +112,7 @@ func CreatePushMigrationBuilder() *cobra.Command { opts := CreatePushMigrationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createPushMigration", // Aliases: []string{"?"}, Short: "Migrate One Local Managed Cluster to MongoDB Atlas", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -171,7 +171,7 @@ func CutoverMigrationBuilder() *cobra.Command { opts := CutoverMigrationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "cutoverMigration", // Aliases: []string{"?"}, Short: "Cut Over the Migrated Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -230,7 +230,7 @@ func DeleteLinkTokenBuilder() *cobra.Command { opts := DeleteLinkTokenOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteLinkToken", // Aliases: []string{"?"}, Short: "Remove One Link-Token", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -289,7 +289,7 @@ func GetPushMigrationBuilder() *cobra.Command { opts := GetPushMigrationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getPushMigration", // Aliases: []string{"?"}, Short: "Return One Migration Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -350,7 +350,7 @@ func GetValidationStatusBuilder() *cobra.Command { opts := GetValidationStatusOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getValidationStatus", // Aliases: []string{"?"}, Short: "Return One Migration Validation Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -409,7 +409,7 @@ func ListSourceProjectsBuilder() *cobra.Command { opts := ListSourceProjectsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listSourceProjects", // Aliases: []string{"?"}, Short: "Return All Projects Available for Migration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -466,7 +466,7 @@ func ValidateMigrationBuilder() *cobra.Command { opts := ValidateMigrationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "validateMigration", // Aliases: []string{"?"}, Short: "Validate One Migration Request", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -492,9 +492,9 @@ func ValidateMigrationBuilder() *cobra.Command { return cmd } -func CloudMigrationServiceApiBuilder() *cobra.Command { +func CloudMigrationServiceBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "cloudMigrationService", Short: "Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.", } cmd.AddCommand( diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index d5c7b23ed2..88c6568b57 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -57,7 +57,7 @@ func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { opts := AuthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "authorizeCloudProviderAccessRole", // Aliases: []string{"?"}, Short: "Authorize One Cloud Provider Access Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -116,7 +116,7 @@ func CreateCloudProviderAccessRoleBuilder() *cobra.Command { opts := CreateCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createCloudProviderAccessRole", // Aliases: []string{"?"}, Short: "Create One Cloud Provider Access Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -177,7 +177,7 @@ func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { opts := DeauthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deauthorizeCloudProviderAccessRole", // Aliases: []string{"?"}, Short: "Deauthorize One Cloud Provider Access Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -240,7 +240,7 @@ func GetCloudProviderAccessRoleBuilder() *cobra.Command { opts := GetCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getCloudProviderAccessRole", // Aliases: []string{"?"}, Short: "Return specified Cloud Provider Access Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -299,7 +299,7 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { opts := ListCloudProviderAccessRolesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listCloudProviderAccessRoles", // Aliases: []string{"?"}, Short: "Return All Cloud Provider Access Roles", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -325,9 +325,9 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { return cmd } -func CloudProviderAccessApiBuilder() *cobra.Command { +func CloudProviderAccessBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "cloudProviderAccess", Short: "Returns, adds, authorizes, and removes AWS IAM roles in Atlas.", } cmd.AddCommand( diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 1a7207aa85..3667fcc6a1 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -57,7 +57,7 @@ func EndOutageSimulationBuilder() *cobra.Command { opts := EndOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "endOutageSimulation", // Aliases: []string{"?"}, Short: "End an Outage Simulation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -118,7 +118,7 @@ func GetOutageSimulationBuilder() *cobra.Command { opts := GetOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getOutageSimulation", // Aliases: []string{"?"}, Short: "Return One Outage Simulation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -179,7 +179,7 @@ func StartOutageSimulationBuilder() *cobra.Command { opts := StartOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "startOutageSimulation", // Aliases: []string{"?"}, Short: "Start an Outage Simulation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -207,9 +207,9 @@ func StartOutageSimulationBuilder() *cobra.Command { return cmd } -func ClusterOutageSimulationApiBuilder() *cobra.Command { +func ClusterOutageSimulationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "clusterOutageSimulation", Short: "Returns, starts, or ends a cluster outage simulation.", } cmd.AddCommand( diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 722c9d99f9..8bc945c3b4 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -57,7 +57,7 @@ func GetClusterAdvancedConfigurationBuilder() *cobra.Command { opts := GetClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getClusterAdvancedConfiguration", // Aliases: []string{"?"}, Short: "Return One Advanced Configuration Options for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -118,7 +118,7 @@ func GetClusterStatusBuilder() *cobra.Command { opts := GetClusterStatusOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getClusterStatus", // Aliases: []string{"?"}, Short: "Return Status of All Cluster Operations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -179,7 +179,7 @@ func GetSampleDatasetLoadStatusBuilder() *cobra.Command { opts := GetSampleDatasetLoadStatusOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getSampleDatasetLoadStatus", // Aliases: []string{"?"}, Short: "Check Status of Cluster Sample Dataset Request", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -248,7 +248,7 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { opts := ListCloudProviderRegionsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listCloudProviderRegions", // Aliases: []string{"?"}, Short: "Return All Cloud Provider Regions", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -314,7 +314,7 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { opts := ListClustersForAllProjectsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listClustersForAllProjects", // Aliases: []string{"?"}, Short: "Return All Authorized Clusters in All Projects", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -374,7 +374,7 @@ func LoadSampleDatasetBuilder() *cobra.Command { opts := LoadSampleDatasetOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "loadSampleDataset", // Aliases: []string{"?"}, Short: "Load Sample Dataset Request into Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -435,7 +435,7 @@ func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { opts := UpdateClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateClusterAdvancedConfiguration", // Aliases: []string{"?"}, Short: "Update Advanced Configuration Options for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -494,7 +494,7 @@ func UpgradeSharedClusterBuilder() *cobra.Command { opts := UpgradeSharedClusterOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "upgradeSharedCluster", // Aliases: []string{"?"}, Short: "Upgrade One Shared-tier Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -551,7 +551,7 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { opts := UpgradeSharedClusterToServerlessOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "upgradeSharedClusterToServerless", // Aliases: []string{"?"}, Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -577,9 +577,9 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { return cmd } -func ClustersApiBuilder() *cobra.Command { +func ClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "clusters", Short: "Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.", } cmd.AddCommand( diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index 346faffb2a..f202a3d307 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -55,7 +55,7 @@ func CreateCustomDatabaseRoleBuilder() *cobra.Command { opts := CreateCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createCustomDatabaseRole", // Aliases: []string{"?"}, Short: "Create One Custom Role", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -114,7 +114,7 @@ func DeleteCustomDatabaseRoleBuilder() *cobra.Command { opts := DeleteCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteCustomDatabaseRole", // Aliases: []string{"?"}, Short: "Remove One Custom Role from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -175,7 +175,7 @@ func GetCustomDatabaseRoleBuilder() *cobra.Command { opts := GetCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getCustomDatabaseRole", // Aliases: []string{"?"}, Short: "Return One Custom Role in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -234,7 +234,7 @@ func ListCustomDatabaseRolesBuilder() *cobra.Command { opts := ListCustomDatabaseRolesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listCustomDatabaseRoles", // Aliases: []string{"?"}, Short: "Return All Custom Roles in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -293,7 +293,7 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { opts := UpdateCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateCustomDatabaseRole", // Aliases: []string{"?"}, Short: "Update One Custom Role in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -321,9 +321,9 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { return cmd } -func CustomDatabaseRolesApiBuilder() *cobra.Command { +func CustomDatabaseRolesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "customDatabaseRoles", Short: "Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the project level, for all clusters in the project. This resource supports a subset of MongoDB privilege actions. You can create a subset of custom role actions. To create a wider list of custom role actions, use the MongoDB Cloud user interface. Custom roles must include actions that all project's clusters support, and that are compatible with each MongoDB version that your project's clusters use. For example, if your project has MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4.", } cmd.AddCommand( diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index d7a77fd72d..dbe868902c 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -55,7 +55,7 @@ func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { opts := CreateDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createDataFederationPrivateEndpoint", // Aliases: []string{"?"}, Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -114,7 +114,7 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { opts := CreateFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createFederatedDatabase", // Aliases: []string{"?"}, Short: "Create One Federated Database Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -176,7 +176,7 @@ func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { opts := CreateOneDataFederationQueryLimitOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createOneDataFederationQueryLimit", // Aliases: []string{"?"}, Short: "Configure One Query Limit for One Federated Database Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -239,7 +239,7 @@ func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { opts := DeleteDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteDataFederationPrivateEndpoint", // Aliases: []string{"?"}, Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -300,7 +300,7 @@ func DeleteFederatedDatabaseBuilder() *cobra.Command { opts := DeleteFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteFederatedDatabase", // Aliases: []string{"?"}, Short: "Remove One Federated Database Instance from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -363,7 +363,7 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { opts := DeleteOneDataFederationInstanceQueryLimitOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteOneDataFederationInstanceQueryLimit", // Aliases: []string{"?"}, Short: "Delete One Query Limit For One Federated Database Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -430,7 +430,7 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { opts := DownloadFederatedDatabaseQueryLogsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "downloadFederatedDatabaseQueryLogs", // Aliases: []string{"?"}, Short: "Download Query Logs for One Federated Database Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -493,7 +493,7 @@ func GetDataFederationPrivateEndpointBuilder() *cobra.Command { opts := GetDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getDataFederationPrivateEndpoint", // Aliases: []string{"?"}, Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -554,7 +554,7 @@ func GetFederatedDatabaseBuilder() *cobra.Command { opts := GetFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getFederatedDatabase", // Aliases: []string{"?"}, Short: "Return One Federated Database Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -619,7 +619,7 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { opts := ListDataFederationPrivateEndpointsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listDataFederationPrivateEndpoints", // Aliases: []string{"?"}, Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -681,7 +681,7 @@ func ListFederatedDatabasesBuilder() *cobra.Command { opts := ListFederatedDatabasesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listFederatedDatabases", // Aliases: []string{"?"}, Short: "Return All Federated Database Instances in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -743,7 +743,7 @@ func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { opts := ReturnFederatedDatabaseQueryLimitOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "returnFederatedDatabaseQueryLimit", // Aliases: []string{"?"}, Short: "Return One Federated Database Instance Query Limit for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -806,7 +806,7 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { opts := ReturnFederatedDatabaseQueryLimitsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "returnFederatedDatabaseQueryLimits", // Aliases: []string{"?"}, Short: "Return All Query Limits for One Federated Database Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -869,7 +869,7 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { opts := UpdateFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateFederatedDatabase", // Aliases: []string{"?"}, Short: "Update One Federated Database Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -899,9 +899,9 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { return cmd } -func DataFederationApiBuilder() *cobra.Command { +func DataFederationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "dataFederation", Short: "Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.", } cmd.AddCommand( diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 573a6a1cbe..9fa6efc911 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -55,7 +55,7 @@ func CreatePipelineBuilder() *cobra.Command { opts := CreatePipelineOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createPipeline", // Aliases: []string{"?"}, Short: "Create One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -114,7 +114,7 @@ func DeletePipelineBuilder() *cobra.Command { opts := DeletePipelineOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deletePipeline", // Aliases: []string{"?"}, Short: "Remove One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -177,7 +177,7 @@ func DeletePipelineRunDatasetBuilder() *cobra.Command { opts := DeletePipelineRunDatasetOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deletePipelineRunDataset", // Aliases: []string{"?"}, Short: "Delete Pipeline Run Dataset", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -240,7 +240,7 @@ func GetPipelineBuilder() *cobra.Command { opts := GetPipelineOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getPipeline", // Aliases: []string{"?"}, Short: "Return One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -303,7 +303,7 @@ func GetPipelineRunBuilder() *cobra.Command { opts := GetPipelineRunOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getPipelineRun", // Aliases: []string{"?"}, Short: "Return One Data Lake Pipeline Run", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -374,7 +374,7 @@ func ListPipelineRunsBuilder() *cobra.Command { opts := ListPipelineRunsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPipelineRuns", // Aliases: []string{"?"}, Short: "Return All Data Lake Pipeline Runs from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -439,7 +439,7 @@ func ListPipelineSchedulesBuilder() *cobra.Command { opts := ListPipelineSchedulesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPipelineSchedules", // Aliases: []string{"?"}, Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -508,7 +508,7 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { opts := ListPipelineSnapshotsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPipelineSnapshots", // Aliases: []string{"?"}, Short: "Return Available Backup Snapshots for One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -571,7 +571,7 @@ func ListPipelinesBuilder() *cobra.Command { opts := ListPipelinesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPipelines", // Aliases: []string{"?"}, Short: "Return All Data Lake Pipelines from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -630,7 +630,7 @@ func PausePipelineBuilder() *cobra.Command { opts := PausePipelineOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "pausePipeline", // Aliases: []string{"?"}, Short: "Pause One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -691,7 +691,7 @@ func ResumePipelineBuilder() *cobra.Command { opts := ResumePipelineOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "resumePipeline", // Aliases: []string{"?"}, Short: "Resume One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -752,7 +752,7 @@ func TriggerSnapshotIngestionBuilder() *cobra.Command { opts := TriggerSnapshotIngestionOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "triggerSnapshotIngestion", // Aliases: []string{"?"}, Short: "Trigger on demand snapshot ingestion", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -813,7 +813,7 @@ func UpdatePipelineBuilder() *cobra.Command { opts := UpdatePipelineOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updatePipeline", // Aliases: []string{"?"}, Short: "Update One Data Lake Pipeline", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -841,9 +841,9 @@ func UpdatePipelineBuilder() *cobra.Command { return cmd } -func DataLakePipelinesApiBuilder() *cobra.Command { +func DataLakePipelinesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "dataLakePipelines", Short: "Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.", } cmd.AddCommand( diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index ab4062e2a6..6963d0f664 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -55,7 +55,7 @@ func CreateDatabaseUserBuilder() *cobra.Command { opts := CreateDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createDatabaseUser", // Aliases: []string{"?"}, Short: "Create One Database User in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -116,7 +116,7 @@ func DeleteDatabaseUserBuilder() *cobra.Command { opts := DeleteDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteDatabaseUser", // Aliases: []string{"?"}, Short: "Remove One Database User from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -181,7 +181,7 @@ func GetDatabaseUserBuilder() *cobra.Command { opts := GetDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getDatabaseUser", // Aliases: []string{"?"}, Short: "Return One Database User from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -248,7 +248,7 @@ func ListDatabaseUsersBuilder() *cobra.Command { opts := ListDatabaseUsersOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listDatabaseUsers", // Aliases: []string{"?"}, Short: "Return All Database Users from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -312,7 +312,7 @@ func UpdateDatabaseUserBuilder() *cobra.Command { opts := UpdateDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateDatabaseUser", // Aliases: []string{"?"}, Short: "Update One Database User in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -342,9 +342,9 @@ func UpdateDatabaseUserBuilder() *cobra.Command { return cmd } -func DatabaseUsersApiBuilder() *cobra.Command { +func DatabaseUsersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "databaseUsers", Short: "Returns, adds, edits, and removes database users.", } cmd.AddCommand( diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index f1d41cb811..c3b9f2f4a2 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -55,7 +55,7 @@ func GetEncryptionAtRestBuilder() *cobra.Command { opts := GetEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getEncryptionAtRest", // Aliases: []string{"?"}, Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -112,7 +112,7 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { opts := UpdateEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateEncryptionAtRest", // Aliases: []string{"?"}, Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -138,9 +138,9 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { return cmd } -func EncryptionAtRestUsingCustomerKeyManagementApiBuilder() *cobra.Command { +func EncryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "encryptionAtRestUsingCustomerKeyManagement", Short: "Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.", } cmd.AddCommand( diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index dc395de174..5442dc33bd 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -59,7 +59,7 @@ func GetOrganizationEventBuilder() *cobra.Command { opts := GetOrganizationEventOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getOrganizationEvent", // Aliases: []string{"?"}, Short: "Return One Event from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -123,7 +123,7 @@ func GetProjectEventBuilder() *cobra.Command { opts := GetProjectEventOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getProjectEvent", // Aliases: []string{"?"}, Short: "Return One Event from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -197,7 +197,7 @@ func ListOrganizationEventsBuilder() *cobra.Command { opts := ListOrganizationEventsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listOrganizationEvents", // Aliases: []string{"?"}, Short: "Return All Events from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -277,7 +277,7 @@ func ListProjectEventsBuilder() *cobra.Command { opts := ListProjectEventsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listProjectEvents", // Aliases: []string{"?"}, Short: "Return All Events from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -311,9 +311,9 @@ func ListProjectEventsBuilder() *cobra.Command { return cmd } -func EventsApiBuilder() *cobra.Command { +func EventsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "events", Short: "Returns events. This collection remains under revision and may change.", } cmd.AddCommand( diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index 21cb6369d0..e1b6590ce7 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -57,7 +57,7 @@ func CreateRoleMappingBuilder() *cobra.Command { opts := CreateRoleMappingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createRoleMapping", // Aliases: []string{"?"}, Short: "Add One Role Mapping to One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -116,7 +116,7 @@ func DeleteFederationAppBuilder() *cobra.Command { opts := DeleteFederationAppOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteFederationApp", // Aliases: []string{"?"}, Short: "Delete the federation settings instance.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -177,7 +177,7 @@ func DeleteRoleMappingBuilder() *cobra.Command { opts := DeleteRoleMappingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteRoleMapping", // Aliases: []string{"?"}, Short: "Remove One Role Mapping from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -240,7 +240,7 @@ func GetConnectedOrgConfigBuilder() *cobra.Command { opts := GetConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getConnectedOrgConfig", // Aliases: []string{"?"}, Short: "Return One Org Config Connected to One Federation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -299,7 +299,7 @@ func GetFederationSettingsBuilder() *cobra.Command { opts := GetFederationSettingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getFederationSettings", // Aliases: []string{"?"}, Short: "Return Federation Settings for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -358,7 +358,7 @@ func GetIdentityProviderBuilder() *cobra.Command { opts := GetIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getIdentityProvider", // Aliases: []string{"?"}, Short: "Return one identity provider from the specified federation.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -419,7 +419,7 @@ func GetIdentityProviderMetadataBuilder() *cobra.Command { opts := GetIdentityProviderMetadataOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getIdentityProviderMetadata", // Aliases: []string{"?"}, Short: "Return the metadata of one identity provider in the specified federation.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -482,7 +482,7 @@ func GetRoleMappingBuilder() *cobra.Command { opts := GetRoleMappingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getRoleMapping", // Aliases: []string{"?"}, Short: "Return One Role Mapping from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -543,7 +543,7 @@ func ListConnectedOrgConfigsBuilder() *cobra.Command { opts := ListConnectedOrgConfigsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listConnectedOrgConfigs", // Aliases: []string{"?"}, Short: "Return All Connected Org Configs from the Federation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -600,7 +600,7 @@ func ListIdentityProvidersBuilder() *cobra.Command { opts := ListIdentityProvidersOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listIdentityProviders", // Aliases: []string{"?"}, Short: "Return all identity providers from the specified federation.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -659,7 +659,7 @@ func ListRoleMappingsBuilder() *cobra.Command { opts := ListRoleMappingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listRoleMappings", // Aliases: []string{"?"}, Short: "Return All Role Mappings from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -720,7 +720,7 @@ func RemoveConnectedOrgConfigBuilder() *cobra.Command { opts := RemoveConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "removeConnectedOrgConfig", // Aliases: []string{"?"}, Short: "Remove One Org Config Connected to One Federation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -781,7 +781,7 @@ func UpdateConnectedOrgConfigBuilder() *cobra.Command { opts := UpdateConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateConnectedOrgConfig", // Aliases: []string{"?"}, Short: "Update One Org Config Connected to One Federation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -842,7 +842,7 @@ func UpdateIdentityProviderBuilder() *cobra.Command { opts := UpdateIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateIdentityProvider", // Aliases: []string{"?"}, Short: "Update the identity provider.", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -905,7 +905,7 @@ func UpdateRoleMappingBuilder() *cobra.Command { opts := UpdateRoleMappingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateRoleMapping", // Aliases: []string{"?"}, Short: "Update One Role Mapping in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -935,9 +935,9 @@ func UpdateRoleMappingBuilder() *cobra.Command { return cmd } -func FederatedAuthenticationApiBuilder() *cobra.Command { +func FederatedAuthenticationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "federatedAuthentication", Short: "Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.", } cmd.AddCommand( diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index ea8f985d2e..338a9e48f8 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -57,7 +57,7 @@ func CreateCustomZoneMappingBuilder() *cobra.Command { opts := CreateCustomZoneMappingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createCustomZoneMapping", // Aliases: []string{"?"}, Short: "Add One Entry to One Custom Zone Mapping", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -118,7 +118,7 @@ func CreateManagedNamespaceBuilder() *cobra.Command { opts := CreateManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createManagedNamespace", // Aliases: []string{"?"}, Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -179,7 +179,7 @@ func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { opts := DeleteAllCustomZoneMappingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteAllCustomZoneMappings", // Aliases: []string{"?"}, Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -244,7 +244,7 @@ func DeleteManagedNamespaceBuilder() *cobra.Command { opts := DeleteManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteManagedNamespace", // Aliases: []string{"?"}, Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -307,7 +307,7 @@ func GetManagedNamespaceBuilder() *cobra.Command { opts := GetManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getManagedNamespace", // Aliases: []string{"?"}, Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -335,9 +335,9 @@ func GetManagedNamespaceBuilder() *cobra.Command { return cmd } -func GlobalClustersApiBuilder() *cobra.Command { +func GlobalClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "globalClusters", Short: "Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster.", } diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index 5f41e5bd40..c9e0359f59 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -57,7 +57,7 @@ func DownloadInvoiceCSVBuilder() *cobra.Command { opts := DownloadInvoiceCSVOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "downloadInvoiceCSV", // Aliases: []string{"?"}, Short: "Return One Organization Invoice as CSV", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -118,7 +118,7 @@ func GetInvoiceBuilder() *cobra.Command { opts := GetInvoiceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getInvoice", // Aliases: []string{"?"}, Short: "Return One Organization Invoice", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -183,7 +183,7 @@ func ListInvoicesBuilder() *cobra.Command { opts := ListInvoicesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listInvoices", // Aliases: []string{"?"}, Short: "Return All Invoices for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -243,7 +243,7 @@ func ListPendingInvoicesBuilder() *cobra.Command { opts := ListPendingInvoicesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPendingInvoices", // Aliases: []string{"?"}, Short: "Return All Pending Invoices for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -269,9 +269,9 @@ func ListPendingInvoicesBuilder() *cobra.Command { return cmd } -func InvoicesApiBuilder() *cobra.Command { +func InvoicesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "invoices", Short: "Returns invoices.", } cmd.AddCommand( diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index bc5079efc9..560e701eae 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -55,7 +55,7 @@ func DeleteLDAPConfigurationBuilder() *cobra.Command { opts := DeleteLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteLDAPConfiguration", // Aliases: []string{"?"}, Short: "Remove the Current LDAP User to DN Mapping", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -112,7 +112,7 @@ func GetLDAPConfigurationBuilder() *cobra.Command { opts := GetLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getLDAPConfiguration", // Aliases: []string{"?"}, Short: "Return the Current LDAP or X.509 Configuration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -171,7 +171,7 @@ func GetLDAPConfigurationStatusBuilder() *cobra.Command { opts := GetLDAPConfigurationStatusOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getLDAPConfigurationStatus", // Aliases: []string{"?"}, Short: "Return the Status of One Verify LDAP Configuration Request", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -230,7 +230,7 @@ func SaveLDAPConfigurationBuilder() *cobra.Command { opts := SaveLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "saveLDAPConfiguration", // Aliases: []string{"?"}, Short: "Edit the LDAP or X.509 Configuration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -287,7 +287,7 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { opts := VerifyLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "verifyLDAPConfiguration", // Aliases: []string{"?"}, Short: "Verify the LDAP Configuration in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -313,9 +313,9 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { return cmd } -func LDAPConfigurationApiBuilder() *cobra.Command { +func LDAPConfigurationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "lDAPConfiguration", Short: "Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.", } cmd.AddCommand( diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index 3269bb8076..6c092c8786 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -59,7 +59,7 @@ func DeleteLegacySnapshotBuilder() *cobra.Command { opts := DeleteLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteLegacySnapshot", // Aliases: []string{"?"}, Short: "Remove One Legacy Backup Snapshot", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -124,7 +124,7 @@ func GetLegacyBackupCheckpointBuilder() *cobra.Command { opts := GetLegacyBackupCheckpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getLegacyBackupCheckpoint", // Aliases: []string{"?"}, Short: "Return One Legacy Backup Checkpoint", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -189,7 +189,7 @@ func GetLegacyBackupRestoreJobBuilder() *cobra.Command { opts := GetLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getLegacyBackupRestoreJob", // Aliases: []string{"?"}, Short: "Return One Legacy Backup Restore Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -254,7 +254,7 @@ func GetLegacySnapshotBuilder() *cobra.Command { opts := GetLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getLegacySnapshot", // Aliases: []string{"?"}, Short: "Return One Legacy Backup Snapshot", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -317,7 +317,7 @@ func GetLegacySnapshotScheduleBuilder() *cobra.Command { opts := GetLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getLegacySnapshotSchedule", // Aliases: []string{"?"}, Short: "Return One Snapshot Schedule", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -384,7 +384,7 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { opts := ListLegacyBackupCheckpointsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listLegacyBackupCheckpoints", // Aliases: []string{"?"}, Short: "Return All Legacy Backup Checkpoints", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -456,7 +456,7 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { opts := ListLegacyBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listLegacyBackupRestoreJobs", // Aliases: []string{"?"}, Short: "Return All Legacy Backup Restore Jobs", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -529,7 +529,7 @@ func ListLegacySnapshotsBuilder() *cobra.Command { opts := ListLegacySnapshotsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listLegacySnapshots", // Aliases: []string{"?"}, Short: "Return All Legacy Backup Snapshots", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -596,7 +596,7 @@ func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { opts := UpdateLegacySnapshotRetentionOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateLegacySnapshotRetention", // Aliases: []string{"?"}, Short: "Change One Legacy Backup Snapshot Expiration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -659,7 +659,7 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { opts := UpdateLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateLegacySnapshotSchedule", // Aliases: []string{"?"}, Short: "Update Snapshot Schedule for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -687,9 +687,9 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { return cmd } -func LegacyBackupApiBuilder() *cobra.Command { +func LegacyBackupBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "legacyBackup", Short: "Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.", } cmd.AddCommand( diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 87c6f6c561..850bc6ddf9 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -57,7 +57,7 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { opts := CreateLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createLegacyBackupRestoreJob", // Aliases: []string{"?"}, Short: "Create One Legacy Backup Restore Job", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -85,9 +85,9 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { return cmd } -func LegacyBackupRestoreJobsApiBuilder() *cobra.Command { +func LegacyBackupRestoreJobsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "legacyBackupRestoreJobs", Short: "", } cmd.AddCommand( diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index 37e64852bb..9f4d5a7a8b 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -55,7 +55,7 @@ func DeferMaintenanceWindowBuilder() *cobra.Command { opts := DeferMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deferMaintenanceWindow", // Aliases: []string{"?"}, Short: "Defer One Maintenance Window for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -112,7 +112,7 @@ func GetMaintenanceWindowBuilder() *cobra.Command { opts := GetMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getMaintenanceWindow", // Aliases: []string{"?"}, Short: "Return One Maintenance Window for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -169,7 +169,7 @@ func ResetMaintenanceWindowBuilder() *cobra.Command { opts := ResetMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "resetMaintenanceWindow", // Aliases: []string{"?"}, Short: "Reset One Maintenance Window for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -226,7 +226,7 @@ func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { opts := ToggleMaintenanceAutoDeferOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "toggleMaintenanceAutoDefer", // Aliases: []string{"?"}, Short: "Toggle Automatic Deferral of Maintenance for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -283,7 +283,7 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { opts := UpdateMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateMaintenanceWindow", // Aliases: []string{"?"}, Short: "Update Maintenance Window for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -309,9 +309,9 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { return cmd } -func MaintenanceWindowsApiBuilder() *cobra.Command { +func MaintenanceWindowsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "maintenanceWindows", Short: "Returns, edits, and removes maintenance windows. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. You can defer a scheduled maintenance event for a project up to two times. Deferred maintenance events occur during your preferred maintenance window exactly one week after the previously scheduled date and time.", } cmd.AddCommand( diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index bf488ae745..336507e924 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -53,7 +53,7 @@ func CreateUserBuilder() *cobra.Command { opts := CreateUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createUser", // Aliases: []string{"?"}, Short: "Create One MongoDB Cloud User", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -108,7 +108,7 @@ func GetUserBuilder() *cobra.Command { opts := GetUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getUser", // Aliases: []string{"?"}, Short: "Return One MongoDB Cloud User using Its ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -165,7 +165,7 @@ func GetUserByUsernameBuilder() *cobra.Command { opts := GetUserByUsernameOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getUserByUsername", // Aliases: []string{"?"}, Short: "Return One MongoDB Cloud User using Their Username", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -191,9 +191,9 @@ func GetUserByUsernameBuilder() *cobra.Command { return cmd } -func MongoDBCloudUsersApiBuilder() *cobra.Command { +func MongoDBCloudUsersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "mongoDBCloudUsers", Short: "Returns, adds, and edits MongoDB Cloud users.", } cmd.AddCommand( diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index 03ae4ab889..96fff4d23d 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -57,7 +57,7 @@ func GetAtlasProcessBuilder() *cobra.Command { opts := GetAtlasProcessOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getAtlasProcess", // Aliases: []string{"?"}, Short: "Return One MongoDB Process by ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -120,7 +120,7 @@ func GetDatabaseBuilder() *cobra.Command { opts := GetDatabaseOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getDatabase", // Aliases: []string{"?"}, Short: "Return One Database for a MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -195,7 +195,7 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { opts := GetDatabaseMeasurementsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getDatabaseMeasurements", // Aliases: []string{"?"}, Short: "Return Measurements of One Database for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -276,7 +276,7 @@ func GetDiskMeasurementsBuilder() *cobra.Command { opts := GetDiskMeasurementsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getDiskMeasurements", // Aliases: []string{"?"}, Short: "Return Measurements of One Disk for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -351,7 +351,7 @@ func GetHostLogsBuilder() *cobra.Command { opts := GetHostLogsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getHostLogs", // Aliases: []string{"?"}, Short: "Download Logs for One Multi-Cloud Cluster Host in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -426,7 +426,7 @@ func GetHostMeasurementsBuilder() *cobra.Command { opts := GetHostMeasurementsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getHostMeasurements", // Aliases: []string{"?"}, Short: "Return Measurements for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -509,7 +509,7 @@ func GetIndexMetricsBuilder() *cobra.Command { opts := GetIndexMetricsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getIndexMetrics", // Aliases: []string{"?"}, Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -593,7 +593,7 @@ func GetMeasurementsBuilder() *cobra.Command { opts := GetMeasurementsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getMeasurements", // Aliases: []string{"?"}, Short: "Return Atlas Search Hardware and Status Metrics", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -665,7 +665,7 @@ func ListAtlasProcessesBuilder() *cobra.Command { opts := ListAtlasProcessesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listAtlasProcesses", // Aliases: []string{"?"}, Short: "Return All MongoDB Processes in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -733,7 +733,7 @@ func ListDatabasesBuilder() *cobra.Command { opts := ListDatabasesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listDatabases", // Aliases: []string{"?"}, Short: "Return Available Databases for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -799,7 +799,7 @@ func ListDiskMeasurementsBuilder() *cobra.Command { opts := ListDiskMeasurementsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listDiskMeasurements", // Aliases: []string{"?"}, Short: "Return Measurements of One Disk", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -868,7 +868,7 @@ func ListDiskPartitionsBuilder() *cobra.Command { opts := ListDiskPartitionsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listDiskPartitions", // Aliases: []string{"?"}, Short: "Return Available Disks for One MongoDB Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -946,7 +946,7 @@ func ListIndexMetricsBuilder() *cobra.Command { opts := ListIndexMetricsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listIndexMetrics", // Aliases: []string{"?"}, Short: "Return All Atlas Search Index Metrics for One Namespace", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1018,7 +1018,7 @@ func ListMetricTypesBuilder() *cobra.Command { opts := ListMetricTypesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listMetricTypes", // Aliases: []string{"?"}, Short: "Return All Atlas Search Metric Types for One Process", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1046,9 +1046,9 @@ func ListMetricTypesBuilder() *cobra.Command { return cmd } -func MonitoringAndLogsApiBuilder() *cobra.Command { +func MonitoringAndLogsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "monitoringAndLogs", Short: "Returns database deployment monitoring and logging data.", } cmd.AddCommand( diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 77bc43dc1b..f32a70bdee 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -55,7 +55,7 @@ func CreateClusterBuilder() *cobra.Command { opts := CreateClusterOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createCluster", // Aliases: []string{"?"}, Short: "Create One Multi-Cloud Cluster from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -116,7 +116,7 @@ func DeleteClusterBuilder() *cobra.Command { opts := DeleteClusterOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteCluster", // Aliases: []string{"?"}, Short: "Remove One Multi-Cloud Cluster from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -178,7 +178,7 @@ func GetClusterBuilder() *cobra.Command { opts := GetClusterOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getCluster", // Aliases: []string{"?"}, Short: "Return One Multi-Cloud Cluster from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -243,7 +243,7 @@ func ListClustersBuilder() *cobra.Command { opts := ListClustersOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listClusters", // Aliases: []string{"?"}, Short: "Return All Multi-Cloud Clusters from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -305,7 +305,7 @@ func TestFailoverBuilder() *cobra.Command { opts := TestFailoverOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "testFailover", // Aliases: []string{"?"}, Short: "Test Failover for One Multi-Cloud Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -366,7 +366,7 @@ func UpdateClusterBuilder() *cobra.Command { opts := UpdateClusterOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateCluster", // Aliases: []string{"?"}, Short: "Modify One Multi-Cloud Cluster from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -394,9 +394,9 @@ func UpdateClusterBuilder() *cobra.Command { return cmd } -func MultiCloudClustersApiBuilder() *cobra.Command { +func MultiCloudClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "multiCloudClusters", Short: "Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. The total number of nodes in clusters spanning across regions has a specific constraint on a per-project basis. MongoDB Cloud limits the total number of nodes in other regions in one project to a total of 40. This total excludes Google Cloud regions communicating with each other, shared-tier clusters, or serverless clusters. The total number of nodes between any two regions must meet this constraint. For example, if a project has nodes in clusters spread across three regions: 30 nodes in Region A, 10 nodes in Region B, and 5 nodes in Region C, you can add only 5 more nodes to Region C because if you exclude Region C, Region A + Region B = 40. If you exclude Region B, Region A + Region C = 35, <= 40. If you exclude Region A, Region B + Region C = 15, <= 40. Each combination of regions with the added 5 nodes still meets the per-project constraint. Region A + B = 40. Region A + C = 40. Region B + C = 20. You can't create a multi-region cluster in a project if it has one or more clusters spanning 40 or more nodes in other regions. Each project supports up to 25 database deployments. diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 74bdb9d1ac..4b22051513 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -55,7 +55,7 @@ func CreatePeeringConnectionBuilder() *cobra.Command { opts := CreatePeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createPeeringConnection", // Aliases: []string{"?"}, Short: "Create One New Network Peering Connection", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -112,7 +112,7 @@ func CreatePeeringContainerBuilder() *cobra.Command { opts := CreatePeeringContainerOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createPeeringContainer", // Aliases: []string{"?"}, Short: "Create One New Network Peering Container", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -171,7 +171,7 @@ func DeletePeeringConnectionBuilder() *cobra.Command { opts := DeletePeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deletePeeringConnection", // Aliases: []string{"?"}, Short: "Remove One Existing Network Peering Connection", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -232,7 +232,7 @@ func DeletePeeringContainerBuilder() *cobra.Command { opts := DeletePeeringContainerOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deletePeeringContainer", // Aliases: []string{"?"}, Short: "Remove One Network Peering Container", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -291,7 +291,7 @@ func DisablePeeringBuilder() *cobra.Command { opts := DisablePeeringOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "disablePeering", // Aliases: []string{"?"}, Short: "Disable Connect via Peering Only Mode for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -350,7 +350,7 @@ func GetPeeringConnectionBuilder() *cobra.Command { opts := GetPeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getPeeringConnection", // Aliases: []string{"?"}, Short: "Return One Network Peering Connection in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -411,7 +411,7 @@ func GetPeeringContainerBuilder() *cobra.Command { opts := GetPeeringContainerOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getPeeringContainer", // Aliases: []string{"?"}, Short: "Return One Network Peering Container", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -478,7 +478,7 @@ func ListPeeringConnectionsBuilder() *cobra.Command { opts := ListPeeringConnectionsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPeeringConnections", // Aliases: []string{"?"}, Short: "Return All Network Peering Connections in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -547,7 +547,7 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { opts := ListPeeringContainerByCloudProviderOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPeeringContainerByCloudProvider", // Aliases: []string{"?"}, Short: "Return All Network Peering Containers in One Project for One Cloud Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -615,7 +615,7 @@ func ListPeeringContainersBuilder() *cobra.Command { opts := ListPeeringContainersOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPeeringContainers", // Aliases: []string{"?"}, Short: "Return All Network Peering Containers in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -677,7 +677,7 @@ func UpdatePeeringConnectionBuilder() *cobra.Command { opts := UpdatePeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updatePeeringConnection", // Aliases: []string{"?"}, Short: "Update One New Network Peering Connection", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -738,7 +738,7 @@ func UpdatePeeringContainerBuilder() *cobra.Command { opts := UpdatePeeringContainerOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updatePeeringContainer", // Aliases: []string{"?"}, Short: "Update One Network Peering Container", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -797,7 +797,7 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { opts := VerifyConnectViaPeeringOnlyModeForOneProjectOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "verifyConnectViaPeeringOnlyModeForOneProject", // Aliases: []string{"?"}, Short: "Verify Connect via Peering Only Mode for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -823,9 +823,9 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { return cmd } -func NetworkPeeringApiBuilder() *cobra.Command { +func NetworkPeeringBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "networkPeering", Short: "Returns, adds, edits, and removes network peering containers and peering connections. When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block.", } diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index ccaff0e73f..188a8daf5a 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -57,7 +57,7 @@ func CreateOnlineArchiveBuilder() *cobra.Command { opts := CreateOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createOnlineArchive", // Aliases: []string{"?"}, Short: "Create One Online Archive", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -120,7 +120,7 @@ func DeleteOnlineArchiveBuilder() *cobra.Command { opts := DeleteOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteOnlineArchive", // Aliases: []string{"?"}, Short: "Remove One Online Archive", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -189,7 +189,7 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { opts := DownloadOnlineArchiveQueryLogsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "downloadOnlineArchiveQueryLogs", // Aliases: []string{"?"}, Short: "Download Online Archive Query Logs", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -255,7 +255,7 @@ func GetOnlineArchiveBuilder() *cobra.Command { opts := GetOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getOnlineArchive", // Aliases: []string{"?"}, Short: "Return One Online Archive", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -324,7 +324,7 @@ func ListOnlineArchivesBuilder() *cobra.Command { opts := ListOnlineArchivesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listOnlineArchives", // Aliases: []string{"?"}, Short: "Return All Online Archives for One Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -390,7 +390,7 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { opts := UpdateOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateOnlineArchive", // Aliases: []string{"?"}, Short: "Update One Online Archive", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -420,9 +420,9 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { return cmd } -func OnlineArchiveApiBuilder() *cobra.Command { +func OnlineArchiveBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "onlineArchive", Short: "Returns, adds, edits, or removes an online archive.", } cmd.AddCommand( diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 6468ab8e37..37726c0861 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -53,7 +53,7 @@ func CreateOrganizationBuilder() *cobra.Command { opts := CreateOrganizationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createOrganization", // Aliases: []string{"?"}, Short: "Create One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -108,7 +108,7 @@ func CreateOrganizationInvitationBuilder() *cobra.Command { opts := CreateOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createOrganizationInvitation", // Aliases: []string{"?"}, Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -165,7 +165,7 @@ func DeleteOrganizationBuilder() *cobra.Command { opts := DeleteOrganizationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteOrganization", // Aliases: []string{"?"}, Short: "Remove One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -224,7 +224,7 @@ func DeleteOrganizationInvitationBuilder() *cobra.Command { opts := DeleteOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteOrganizationInvitation", // Aliases: []string{"?"}, Short: "Cancel One Organization Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -283,7 +283,7 @@ func GetOrganizationBuilder() *cobra.Command { opts := GetOrganizationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getOrganization", // Aliases: []string{"?"}, Short: "Return One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -342,7 +342,7 @@ func GetOrganizationInvitationBuilder() *cobra.Command { opts := GetOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getOrganizationInvitation", // Aliases: []string{"?"}, Short: "Return One Organization Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -401,7 +401,7 @@ func GetOrganizationSettingsBuilder() *cobra.Command { opts := GetOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getOrganizationSettings", // Aliases: []string{"?"}, Short: "Return Settings for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -460,7 +460,7 @@ func ListOrganizationInvitationsBuilder() *cobra.Command { opts := ListOrganizationInvitationsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listOrganizationInvitations", // Aliases: []string{"?"}, Short: "Return All Organization Invitations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -526,7 +526,7 @@ func ListOrganizationProjectsBuilder() *cobra.Command { opts := ListOrganizationProjectsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listOrganizationProjects", // Aliases: []string{"?"}, Short: "Return One or More Projects in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -593,7 +593,7 @@ func ListOrganizationUsersBuilder() *cobra.Command { opts := ListOrganizationUsersOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listOrganizationUsers", // Aliases: []string{"?"}, Short: "Return All MongoDB Cloud Users in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -659,7 +659,7 @@ func ListOrganizationsBuilder() *cobra.Command { opts := ListOrganizationsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listOrganizations", // Aliases: []string{"?"}, Short: "Return All Organizations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -718,7 +718,7 @@ func RenameOrganizationBuilder() *cobra.Command { opts := RenameOrganizationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "renameOrganization", // Aliases: []string{"?"}, Short: "Rename One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -775,7 +775,7 @@ func UpdateOrganizationInvitationBuilder() *cobra.Command { opts := UpdateOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateOrganizationInvitation", // Aliases: []string{"?"}, Short: "Update One Organization Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -834,7 +834,7 @@ func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { opts := UpdateOrganizationInvitationByIdOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateOrganizationInvitationById", // Aliases: []string{"?"}, Short: "Update One Organization Invitation by Invitation ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -893,7 +893,7 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { opts := UpdateOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateOrganizationSettings", // Aliases: []string{"?"}, Short: "Update Settings for One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -919,9 +919,9 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { return cmd } -func OrganizationsApiBuilder() *cobra.Command { +func OrganizationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "organizations", Short: "Returns, adds, and edits organizational units in MongoDB Cloud.", } cmd.AddCommand( diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index 9cd91c7114..a08f8912a9 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -55,7 +55,7 @@ func DisableSlowOperationThresholdingBuilder() *cobra.Command { opts := DisableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "disableSlowOperationThresholding", // Aliases: []string{"?"}, Short: "Disable Managed Slow Operation Threshold", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -112,7 +112,7 @@ func EnableSlowOperationThresholdingBuilder() *cobra.Command { opts := EnableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "enableSlowOperationThresholding", // Aliases: []string{"?"}, Short: "Enable Managed Slow Operation Threshold", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -179,7 +179,7 @@ func ListSlowQueriesBuilder() *cobra.Command { opts := ListSlowQueriesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listSlowQueries", // Aliases: []string{"?"}, Short: "Return Slow Queries", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -248,7 +248,7 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { opts := ListSlowQueryNamespacesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listSlowQueryNamespaces", // Aliases: []string{"?"}, Short: "Return All Namespaces for One Host", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -327,7 +327,7 @@ func ListSuggestedIndexesBuilder() *cobra.Command { opts := ListSuggestedIndexesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listSuggestedIndexes", // Aliases: []string{"?"}, Short: "Return Suggested Indexes", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -363,9 +363,9 @@ func ListSuggestedIndexesBuilder() *cobra.Command { return cmd } -func PerformanceAdvisorApiBuilder() *cobra.Command { +func PerformanceAdvisorBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "performanceAdvisor", Short: "Returns suggested indexes and slow query data for a database deployment. Also enables or disables MongoDB Cloud-managed slow operation thresholds. To view field values in a sample query, you must have the Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted data rather than the field values.", } cmd.AddCommand( diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index af450fee41..99ae9ba58d 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -59,7 +59,7 @@ func CreatePrivateEndpointBuilder() *cobra.Command { opts := CreatePrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createPrivateEndpoint", // Aliases: []string{"?"}, Short: "Create One Private Endpoint for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -120,7 +120,7 @@ func CreatePrivateEndpointServiceBuilder() *cobra.Command { opts := CreatePrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createPrivateEndpointService", // Aliases: []string{"?"}, Short: "Create One Private Endpoint Service for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -183,7 +183,7 @@ func DeletePrivateEndpointBuilder() *cobra.Command { opts := DeletePrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deletePrivateEndpoint", // Aliases: []string{"?"}, Short: "Remove One Private Endpoint for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -250,7 +250,7 @@ func DeletePrivateEndpointServiceBuilder() *cobra.Command { opts := DeletePrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deletePrivateEndpointService", // Aliases: []string{"?"}, Short: "Remove One Private Endpoint Service for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -317,7 +317,7 @@ func GetPrivateEndpointBuilder() *cobra.Command { opts := GetPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getPrivateEndpoint", // Aliases: []string{"?"}, Short: "Return One Private Endpoint for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -384,7 +384,7 @@ func GetPrivateEndpointServiceBuilder() *cobra.Command { opts := GetPrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getPrivateEndpointService", // Aliases: []string{"?"}, Short: "Return One Private Endpoint Service for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -445,7 +445,7 @@ func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { opts := GetRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getRegionalizedPrivateEndpointSetting", // Aliases: []string{"?"}, Short: "Return Regionalized Private Endpoint Status", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -504,7 +504,7 @@ func ListPrivateEndpointServicesBuilder() *cobra.Command { opts := ListPrivateEndpointServicesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listPrivateEndpointServices", // Aliases: []string{"?"}, Short: "Return All Private Endpoint Services for One Provider", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -563,7 +563,7 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { opts := ToggleRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "toggleRegionalizedPrivateEndpointSetting", // Aliases: []string{"?"}, Short: "Toggle Regionalized Private Endpoint Status", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -589,9 +589,9 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return cmd } -func PrivateEndpointServicesApiBuilder() *cobra.Command { +func PrivateEndpointServicesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "privateEndpointServices", Short: "Returns, adds, edits, and removes private endpoint services.", } cmd.AddCommand( diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 5f983c03eb..379fcaef88 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -57,7 +57,7 @@ func AddProjectApiKeyBuilder() *cobra.Command { opts := AddProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "addProjectApiKey", // Aliases: []string{"?"}, Short: "Assign One Organization API Key to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -116,7 +116,7 @@ func CreateApiKeyBuilder() *cobra.Command { opts := CreateApiKeyOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createApiKey", // Aliases: []string{"?"}, Short: "Create One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -181,7 +181,7 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { opts := CreateApiKeyAccessListOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createApiKeyAccessList", // Aliases: []string{"?"}, Short: "Create Access List Entries for One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -243,7 +243,7 @@ func CreateProjectApiKeyBuilder() *cobra.Command { opts := CreateProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createProjectApiKey", // Aliases: []string{"?"}, Short: "Create and Assign One Organization API Key to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -302,7 +302,7 @@ func DeleteApiKeyBuilder() *cobra.Command { opts := DeleteApiKeyOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteApiKey", // Aliases: []string{"?"}, Short: "Remove One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -365,7 +365,7 @@ func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { opts := DeleteApiKeyAccessListEntryOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteApiKeyAccessListEntry", // Aliases: []string{"?"}, Short: "Remove One Access List Entry for One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -428,7 +428,7 @@ func GetApiKeyBuilder() *cobra.Command { opts := GetApiKeyOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getApiKey", // Aliases: []string{"?"}, Short: "Return One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -491,7 +491,7 @@ func GetApiKeyAccessListBuilder() *cobra.Command { opts := GetApiKeyAccessListOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getApiKeyAccessList", // Aliases: []string{"?"}, Short: "Return One Access List Entry for One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -560,7 +560,7 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { opts := ListApiKeyAccessListsEntriesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listApiKeyAccessListsEntries", // Aliases: []string{"?"}, Short: "Return All Access List Entries for One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -628,7 +628,7 @@ func ListApiKeysBuilder() *cobra.Command { opts := ListApiKeysOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listApiKeys", // Aliases: []string{"?"}, Short: "Return All Organization API Keys", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -694,7 +694,7 @@ func ListProjectApiKeysBuilder() *cobra.Command { opts := ListProjectApiKeysOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listProjectApiKeys", // Aliases: []string{"?"}, Short: "Return All Organization API Keys Assigned to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -756,7 +756,7 @@ func RemoveProjectApiKeyBuilder() *cobra.Command { opts := RemoveProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "removeProjectApiKey", // Aliases: []string{"?"}, Short: "Unassign One Organization API Key from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -817,7 +817,7 @@ func UpdateApiKeyBuilder() *cobra.Command { opts := UpdateApiKeyOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateApiKey", // Aliases: []string{"?"}, Short: "Update One Organization API Key", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -884,7 +884,7 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { opts := UpdateApiKeyRolesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateApiKeyRoles", // Aliases: []string{"?"}, Short: "Update Roles of One Organization API Key to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -915,9 +915,9 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { return cmd } -func ProgrammaticAPIKeysApiBuilder() *cobra.Command { +func ProgrammaticAPIKeysBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "programmaticAPIKeys", Short: "Returns, adds, edits, and removes access tokens to use the MongoDB Cloud API. MongoDB Cloud applies these keys to organizations. These resources can return, assign, or revoke use of these keys within a specified project.", } cmd.AddCommand( diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index fef1d0a19b..42d906e857 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -61,7 +61,7 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { opts := CreateProjectIpAccessListOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createProjectIpAccessList", // Aliases: []string{"?"}, Short: "Add Entries to Project IP Access List", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -123,7 +123,7 @@ func DeleteProjectIpAccessListBuilder() *cobra.Command { opts := DeleteProjectIpAccessListOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteProjectIpAccessList", // Aliases: []string{"?"}, Short: "Remove One Entry from One Project IP Access List", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -184,7 +184,7 @@ func GetProjectIpAccessListStatusBuilder() *cobra.Command { opts := GetProjectIpAccessListStatusOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getProjectIpAccessListStatus", // Aliases: []string{"?"}, Short: "Return Status of One Project IP Access List Entry", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -245,7 +245,7 @@ func GetProjectIpListBuilder() *cobra.Command { opts := GetProjectIpListOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getProjectIpList", // Aliases: []string{"?"}, Short: "Return One Project IP Access List Entry", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -310,7 +310,7 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { opts := ListProjectIpAccessListsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listProjectIpAccessLists", // Aliases: []string{"?"}, Short: "Return Project IP Access List", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -339,9 +339,9 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { return cmd } -func ProjectIPAccessListApiBuilder() *cobra.Command { +func ProjectIPAccessListBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "projectIPAccessList", Short: "Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period.", } cmd.AddCommand( diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index b550ed3b51..13cda4a27e 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -55,7 +55,7 @@ func CreateProjectBuilder() *cobra.Command { opts := CreateProjectOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createProject", // Aliases: []string{"?"}, Short: "Create One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -111,7 +111,7 @@ func CreateProjectInvitationBuilder() *cobra.Command { opts := CreateProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createProjectInvitation", // Aliases: []string{"?"}, Short: "Invite One MongoDB Cloud User to Join One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -168,7 +168,7 @@ func DeleteProjectBuilder() *cobra.Command { opts := DeleteProjectOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteProject", // Aliases: []string{"?"}, Short: "Remove One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -227,7 +227,7 @@ func DeleteProjectInvitationBuilder() *cobra.Command { opts := DeleteProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteProjectInvitation", // Aliases: []string{"?"}, Short: "Cancel One Project Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -288,7 +288,7 @@ func DeleteProjectLimitBuilder() *cobra.Command { opts := DeleteProjectLimitOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteProjectLimit", // Aliases: []string{"?"}, Short: "Remove One Project Limit", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -347,7 +347,7 @@ func GetProjectBuilder() *cobra.Command { opts := GetProjectOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getProject", // Aliases: []string{"?"}, Short: "Return One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -404,7 +404,7 @@ func GetProjectByNameBuilder() *cobra.Command { opts := GetProjectByNameOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getProjectByName", // Aliases: []string{"?"}, Short: "Return One Project using Its Name", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -463,7 +463,7 @@ func GetProjectInvitationBuilder() *cobra.Command { opts := GetProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getProjectInvitation", // Aliases: []string{"?"}, Short: "Return One Project Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -524,7 +524,7 @@ func GetProjectLimitBuilder() *cobra.Command { opts := GetProjectLimitOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getProjectLimit", // Aliases: []string{"?"}, Short: "Return One Limit for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -583,7 +583,7 @@ func GetProjectSettingsBuilder() *cobra.Command { opts := GetProjectSettingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getProjectSettings", // Aliases: []string{"?"}, Short: "Return One Project Settings", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -642,7 +642,7 @@ func ListProjectInvitationsBuilder() *cobra.Command { opts := ListProjectInvitationsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listProjectInvitations", // Aliases: []string{"?"}, Short: "Return All Project Invitations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -700,7 +700,7 @@ func ListProjectLimitsBuilder() *cobra.Command { opts := ListProjectLimitsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listProjectLimits", // Aliases: []string{"?"}, Short: "Return All Limits for One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -767,7 +767,7 @@ func ListProjectUsersBuilder() *cobra.Command { opts := ListProjectUsersOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listProjectUsers", // Aliases: []string{"?"}, Short: "Return All Users in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -833,7 +833,7 @@ func ListProjectsBuilder() *cobra.Command { opts := ListProjectsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listProjects", // Aliases: []string{"?"}, Short: "Return All Projects", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -893,7 +893,7 @@ func RemoveProjectUserBuilder() *cobra.Command { opts := RemoveProjectUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "removeProjectUser", // Aliases: []string{"?"}, Short: "Remove One User from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -954,7 +954,7 @@ func SetProjectLimitBuilder() *cobra.Command { opts := SetProjectLimitOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "setProjectLimit", // Aliases: []string{"?"}, Short: "Set One Project Limit", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1013,7 +1013,7 @@ func UpdateProjectBuilder() *cobra.Command { opts := UpdateProjectOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateProject", // Aliases: []string{"?"}, Short: "Update One Project Name", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1070,7 +1070,7 @@ func UpdateProjectInvitationBuilder() *cobra.Command { opts := UpdateProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateProjectInvitation", // Aliases: []string{"?"}, Short: "Update One Project Invitation", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1129,7 +1129,7 @@ func UpdateProjectInvitationByIdBuilder() *cobra.Command { opts := UpdateProjectInvitationByIdOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateProjectInvitationById", // Aliases: []string{"?"}, Short: "Update One Project Invitation by Invitation ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1188,7 +1188,7 @@ func UpdateProjectSettingsBuilder() *cobra.Command { opts := UpdateProjectSettingsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateProjectSettings", // Aliases: []string{"?"}, Short: "Update One Project Settings", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -1214,9 +1214,9 @@ func UpdateProjectSettingsBuilder() *cobra.Command { return cmd } -func ProjectsApiBuilder() *cobra.Command { +func ProjectsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "projects", Short: "Returns, adds, and edits collections of clusters and users in MongoDB Cloud.", } cmd.AddCommand( diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index fcd758bf40..5616fe06d0 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -57,7 +57,7 @@ func CreateRollingIndexBuilder() *cobra.Command { opts := CreateRollingIndexOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createRollingIndex", // Aliases: []string{"?"}, Short: "Create One Rolling Index", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -85,9 +85,9 @@ func CreateRollingIndexBuilder() *cobra.Command { return cmd } -func RollingIndexApiBuilder() *cobra.Command { +func RollingIndexBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "rollingIndex", Short: "Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.", } cmd.AddCommand( diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index 2bdeb275b9..b8ea9d8265 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -53,7 +53,7 @@ func GetSystemStatusBuilder() *cobra.Command { opts := GetSystemStatusOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getSystemStatus", // Aliases: []string{"?"}, Short: "Return the status of this MongoDB application", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -77,9 +77,9 @@ func GetSystemStatusBuilder() *cobra.Command { return cmd } -func RootApiBuilder() *cobra.Command { +func RootBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "root", Short: "Returns details that describe the MongoDB Cloud build and the access token that requests this resource. This starts the MongoDB Cloud API.", } cmd.AddCommand( diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index c26c371d80..84da8c020f 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -55,7 +55,7 @@ func CreateServerlessInstanceBuilder() *cobra.Command { opts := CreateServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createServerlessInstance", // Aliases: []string{"?"}, Short: "Create One Serverless Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -114,7 +114,7 @@ func DeleteServerlessInstanceBuilder() *cobra.Command { opts := DeleteServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteServerlessInstance", // Aliases: []string{"?"}, Short: "Remove One Serverless Instance from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -175,7 +175,7 @@ func GetServerlessInstanceBuilder() *cobra.Command { opts := GetServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getServerlessInstance", // Aliases: []string{"?"}, Short: "Return One Serverless Instance from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -240,7 +240,7 @@ func ListServerlessInstancesBuilder() *cobra.Command { opts := ListServerlessInstancesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listServerlessInstances", // Aliases: []string{"?"}, Short: "Return All Serverless Instances from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -302,7 +302,7 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { opts := UpdateServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateServerlessInstance", // Aliases: []string{"?"}, Short: "Update One Serverless Instance in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -330,9 +330,9 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { return cmd } -func ServerlessInstancesApiBuilder() *cobra.Command { +func ServerlessInstancesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "serverlessInstances", Short: "Returns, adds, edits, and removes serverless instances.", } cmd.AddCommand( diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index c86b542f73..58114a510c 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -57,7 +57,7 @@ func CreateServerlessPrivateEndpointBuilder() *cobra.Command { opts := CreateServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createServerlessPrivateEndpoint", // Aliases: []string{"?"}, Short: "Create One Private Endpoint for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -120,7 +120,7 @@ func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { opts := DeleteServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteServerlessPrivateEndpoint", // Aliases: []string{"?"}, Short: "Remove One Private Endpoint for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -185,7 +185,7 @@ func GetServerlessPrivateEndpointBuilder() *cobra.Command { opts := GetServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getServerlessPrivateEndpoint", // Aliases: []string{"?"}, Short: "Return One Private Endpoint for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -248,7 +248,7 @@ func ListServerlessPrivateEndpointsBuilder() *cobra.Command { opts := ListServerlessPrivateEndpointsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listServerlessPrivateEndpoints", // Aliases: []string{"?"}, Short: "Return All Private Endpoints for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -311,7 +311,7 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { opts := UpdateServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateServerlessPrivateEndpoint", // Aliases: []string{"?"}, Short: "Update One Private Endpoint for One Serverless Instance", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -341,9 +341,9 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { return cmd } -func ServerlessPrivateEndpointsApiBuilder() *cobra.Command { +func ServerlessPrivateEndpointsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "serverlessPrivateEndpoints", Short: "Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial.", } cmd.AddCommand( diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index 8761805c19..065affc084 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -57,7 +57,7 @@ func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { opts := CreateSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createSharedClusterBackupRestoreJob", // Aliases: []string{"?"}, Short: "Create One Restore Job from One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -120,7 +120,7 @@ func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { opts := GetSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getSharedClusterBackupRestoreJob", // Aliases: []string{"?"}, Short: "Return One Restore Job for One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -183,7 +183,7 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { opts := ListSharedClusterBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listSharedClusterBackupRestoreJobs", // Aliases: []string{"?"}, Short: "Return All Restore Jobs for One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -211,9 +211,9 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { return cmd } -func SharedTierRestoreJobsApiBuilder() *cobra.Command { +func SharedTierRestoreJobsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "sharedTierRestoreJobs", Short: "Returns and adds restore jobs for shared-tier database deployments.", } cmd.AddCommand( diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index 5b00d9ac03..523b79762a 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -57,7 +57,7 @@ func DownloadSharedClusterBackupBuilder() *cobra.Command { opts := DownloadSharedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "downloadSharedClusterBackup", // Aliases: []string{"?"}, Short: "Download One M2 or M5 Cluster Snapshot", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -120,7 +120,7 @@ func GetSharedClusterBackupBuilder() *cobra.Command { opts := GetSharedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getSharedClusterBackup", // Aliases: []string{"?"}, Short: "Return One Snapshot for One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -183,7 +183,7 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { opts := ListSharedClusterBackupsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listSharedClusterBackups", // Aliases: []string{"?"}, Short: "Return All Snapshots for One M2 or M5 Cluster", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -211,9 +211,9 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { return cmd } -func SharedTierSnapshotsApiBuilder() *cobra.Command { +func SharedTierSnapshotsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "sharedTierSnapshots", Short: "Returns and requests to download shared-tier database deployment snapshots.", } cmd.AddCommand( diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index badaf4a0fc..9b84d83693 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -55,7 +55,7 @@ func AddAllTeamsToProjectBuilder() *cobra.Command { opts := AddAllTeamsToProjectOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "addAllTeamsToProject", // Aliases: []string{"?"}, Short: "Add One or More Teams to One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -114,7 +114,7 @@ func AddTeamUserBuilder() *cobra.Command { opts := AddTeamUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "addTeamUser", // Aliases: []string{"?"}, Short: "Assign MongoDB Cloud Users from One Organization to One Team", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -173,7 +173,7 @@ func CreateTeamBuilder() *cobra.Command { opts := CreateTeamOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createTeam", // Aliases: []string{"?"}, Short: "Create One Team in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -232,7 +232,7 @@ func DeleteTeamBuilder() *cobra.Command { opts := DeleteTeamOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteTeam", // Aliases: []string{"?"}, Short: "Remove One Team from One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -293,7 +293,7 @@ func GetTeamByIdBuilder() *cobra.Command { opts := GetTeamByIdOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getTeamById", // Aliases: []string{"?"}, Short: "Return One Team using its ID", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -354,7 +354,7 @@ func GetTeamByNameBuilder() *cobra.Command { opts := GetTeamByNameOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getTeamByName", // Aliases: []string{"?"}, Short: "Return One Team using its Name", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -419,7 +419,7 @@ func ListOrganizationTeamsBuilder() *cobra.Command { opts := ListOrganizationTeamsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listOrganizationTeams", // Aliases: []string{"?"}, Short: "Return All Teams in One Organization", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -485,7 +485,7 @@ func ListProjectTeamsBuilder() *cobra.Command { opts := ListProjectTeamsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listProjectTeams", // Aliases: []string{"?"}, Short: "Return All Teams in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -551,7 +551,7 @@ func ListTeamUsersBuilder() *cobra.Command { opts := ListTeamUsersOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listTeamUsers", // Aliases: []string{"?"}, Short: "Return All MongoDB Cloud Users Assigned to One Team", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -614,7 +614,7 @@ func RemoveProjectTeamBuilder() *cobra.Command { opts := RemoveProjectTeamOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "removeProjectTeam", // Aliases: []string{"?"}, Short: "Remove One Team from One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -677,7 +677,7 @@ func RemoveTeamUserBuilder() *cobra.Command { opts := RemoveTeamUserOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "removeTeamUser", // Aliases: []string{"?"}, Short: "Remove One MongoDB Cloud User from One Team", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -740,7 +740,7 @@ func RenameTeamBuilder() *cobra.Command { opts := RenameTeamOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "renameTeam", // Aliases: []string{"?"}, Short: "Rename One Team", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -801,7 +801,7 @@ func UpdateTeamRolesBuilder() *cobra.Command { opts := UpdateTeamRolesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateTeamRoles", // Aliases: []string{"?"}, Short: "Update Team Roles in One Project", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -829,9 +829,9 @@ func UpdateTeamRolesBuilder() *cobra.Command { return cmd } -func TeamsApiBuilder() *cobra.Command { +func TeamsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "teams", Short: "Returns, adds, edits, or removes teams.", } cmd.AddCommand( diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index 33272b3028..4f54ed2d40 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -55,7 +55,7 @@ func VersionedExampleBuilder() *cobra.Command { opts := VersionedExampleOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "versionedExample", // Aliases: []string{"?"}, Short: "Example resource info for versioning of the Atlas API", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -80,9 +80,9 @@ func VersionedExampleBuilder() *cobra.Command { return cmd } -func TestApiBuilder() *cobra.Command { +func TestBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "test", Short: "Atlas test endpoints.", } cmd.AddCommand( diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index fa89071e4d..87931b4a6f 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -63,7 +63,7 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { opts := CreateThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createThirdPartyIntegration", // Aliases: []string{"?"}, Short: "Configure One Third-Party Service Integration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -127,7 +127,7 @@ func DeleteThirdPartyIntegrationBuilder() *cobra.Command { opts := DeleteThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "deleteThirdPartyIntegration", // Aliases: []string{"?"}, Short: "Remove One Third-Party Service Integration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -188,7 +188,7 @@ func GetThirdPartyIntegrationBuilder() *cobra.Command { opts := GetThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "getThirdPartyIntegration", // Aliases: []string{"?"}, Short: "Return One Third-Party Service Integration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -253,7 +253,7 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { opts := ListThirdPartyIntegrationsOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listThirdPartyIntegrations", // Aliases: []string{"?"}, Short: "Return All Active Third-Party Service Integrations", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -321,7 +321,7 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { opts := UpdateThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "updateThirdPartyIntegration", // Aliases: []string{"?"}, Short: "Update One Third-Party Service Integration", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -352,9 +352,9 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { return cmd } -func ThirdPartyIntegrationsApiBuilder() *cobra.Command { +func ThirdPartyIntegrationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "thirdPartyIntegrations", Short: "Returns, adds, edits, and removes third-party service integration configurations. MongoDB Cloud sends alerts to each third-party service that you configure. **IMPORTANT**: Each project can only have one configuration per integrationType.", diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 842a084fb1..33b2fbab5a 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -57,7 +57,7 @@ func CreateDatabaseUserCertificateBuilder() *cobra.Command { opts := CreateDatabaseUserCertificateOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "createDatabaseUserCertificate", // Aliases: []string{"?"}, Short: "Create One X.509 Certificate for One MongoDB User", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -116,7 +116,7 @@ func DisableCustomerManagedX509Builder() *cobra.Command { opts := DisableCustomerManagedX509Opts{} cmd := &cobra.Command{ - Use: "<>", + Use: "disableCustomerManagedX509", // Aliases: []string{"?"}, Short: "Disable Customer-Managed X.509", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -181,7 +181,7 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { opts := ListDatabaseUserCertificatesOpts{} cmd := &cobra.Command{ - Use: "<>", + Use: "listDatabaseUserCertificates", // Aliases: []string{"?"}, Short: "Return All X.509 Certificates Assigned to One MongoDB User", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -212,9 +212,9 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { return cmd } -func X509AuthenticationApiBuilder() *cobra.Command { +func X509AuthenticationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "<>", + Use: "x509Authentication", Short: "Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages your certificates, it also manages your Certificate Authority and can generate certificates for your database users. No additional X.509 configuration is required. If you manage your certificates, you must provide a Certificate Authority and generate certificates for your database users.", } cmd.AddCommand( diff --git a/internal/generated/generated.go b/internal/generated/generated.go index b717ef3f86..6c012b240c 100644 --- a/internal/generated/generated.go +++ b/internal/generated/generated.go @@ -18,19 +18,20 @@ package generated import ( "time" - "net" - "net/http" + "net" + "net/http" - "github.com/mongodb-forks/digest" + "github.com/spf13/cobra" + "github.com/mongodb-forks/digest" "go.mongodb.org/atlas-sdk/admin" - "go.mongodb.org/atlas/auth" + "go.mongodb.org/atlas/auth" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/mongodb/mongodb-atlas-cli/internal/log" ) const ( - cloudGovServiceURL = "https://cloud.mongodbgov.com/" - timeout = 5 * time.Second + cloudGovServiceURL = "https://cloud.mongodbgov.com/" + timeout = 5 * time.Second keepAlive = 30 * time.Second maxIdleConns = 5 maxIdleConnsPerHost = 4 @@ -40,18 +41,18 @@ const ( func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { httpTransport := &http.Transport{ - DialContext: (&net.Dialer{ - Timeout: timeout, - KeepAlive: keepAlive, - }).DialContext, - MaxIdleConns: maxIdleConns, - MaxIdleConnsPerHost: maxIdleConnsPerHost, - Proxy: http.ProxyFromEnvironment, - IdleConnTimeout: idleConnTimeout, - ExpectContinueTimeout: expectContinueTimeout, - } - - if username == "" && password == "" && accessToken == nil { + DialContext: (&net.Dialer{ + Timeout: timeout, + KeepAlive: keepAlive, + }).DialContext, + MaxIdleConns: maxIdleConns, + MaxIdleConnsPerHost: maxIdleConnsPerHost, + Proxy: http.ProxyFromEnvironment, + IdleConnTimeout: idleConnTimeout, + ExpectContinueTimeout: expectContinueTimeout, + } + + if username == "" && password == "" && accessToken == nil { return &http.Client{Transport: httpTransport}, nil } if username != "" && password != "" { @@ -71,32 +72,32 @@ func httpClient(username, password string, accessToken *auth.Token) (*http.Clien } func NewClientWithAuth() (*admin.APIClient, error) { - profile := config.Default() + profile := config.Default() - var authToken *auth.Token + var authToken *auth.Token - username := profile.PublicAPIKey() - password := profile.PrivateAPIKey() + username := profile.PublicAPIKey() + password := profile.PrivateAPIKey() - if username == "" && password == "" { - var err error - authToken, err = profile.Token() - if err != nil { - return nil, err - } - } + if username == "" && password == "" { + var err error + authToken, err = profile.Token() + if err != nil { + return nil, err + } + } - baseURL := profile.OpsManagerURL() - if baseURL == "" && profile.Service() == config.CloudGovService { - baseURL = cloudGovServiceURL - } + baseURL := profile.OpsManagerURL() + if baseURL == "" && profile.Service() == config.CloudGovService { + baseURL = cloudGovServiceURL + } - client, err := httpClient(username, password, authToken) + client, err := httpClient(username, password, authToken) if err != nil { return nil, err } - opts := []admin.ClientModifier{ + opts := []admin.ClientModifier{ admin.UseHTTPClient(client), admin.UseUserAgent(config.UserAgent), admin.UseDebug(log.IsDebugLevel())} @@ -120,3 +121,53 @@ func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { tr.token.SetAuthHeader(req) return tr.base.RoundTrip(req) } + +func Commands() []*cobra.Command { + return []*cobra.Command { + AWSClustersDNSBuilder(), + AccessTrackingBuilder(), + AlertConfigurationsBuilder(), + AlertsBuilder(), + AtlasSearchBuilder(), + AuditingBuilder(), + CloudBackupsBuilder(), + CloudMigrationServiceBuilder(), + CloudProviderAccessBuilder(), + ClusterOutageSimulationBuilder(), + ClustersBuilder(), + CustomDatabaseRolesBuilder(), + DataFederationBuilder(), + DataLakePipelinesBuilder(), + DatabaseUsersBuilder(), + EncryptionAtRestUsingCustomerKeyManagementBuilder(), + EventsBuilder(), + FederatedAuthenticationBuilder(), + GlobalClustersBuilder(), + InvoicesBuilder(), + LDAPConfigurationBuilder(), + LegacyBackupBuilder(), + LegacyBackupRestoreJobsBuilder(), + MaintenanceWindowsBuilder(), + MongoDBCloudUsersBuilder(), + MonitoringAndLogsBuilder(), + MultiCloudClustersBuilder(), + NetworkPeeringBuilder(), + OnlineArchiveBuilder(), + OrganizationsBuilder(), + PerformanceAdvisorBuilder(), + PrivateEndpointServicesBuilder(), + ProgrammaticAPIKeysBuilder(), + ProjectIPAccessListBuilder(), + ProjectsBuilder(), + RollingIndexBuilder(), + RootBuilder(), + ServerlessInstancesBuilder(), + ServerlessPrivateEndpointsBuilder(), + SharedTierRestoreJobsBuilder(), + SharedTierSnapshotsBuilder(), + TeamsBuilder(), + TestBuilder(), + ThirdPartyIntegrationsBuilder(), + X509AuthenticationBuilder(), + } +} diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index c9f402ae1c..98b4bc4931 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -52,7 +52,7 @@ func {{operationId}}Builder() *cobra.Command { opts := {{operationId}}Opts{} cmd := &cobra.Command{ - Use: "<>", + Use: "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}", // Aliases: []string{"?"}, Short: "{{ summary }}", Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? @@ -86,12 +86,12 @@ func {{operationId}}Builder() *cobra.Command { {{/operation}} {{/operations}} -func {{classname}}Builder() *cobra.Command { +func {{baseName}}Builder() *cobra.Command { {{#operations}} {{#operation}} {{#-first}} cmd := &cobra.Command{ - Use: "<>", + Use: "{{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}", Short: "{{#tags}}{{#-first}}{{description}}{{/-first}}{{/tags}}", } cmd.AddCommand( diff --git a/tools/openapi-generator/config/go-templates/generated.mustache b/tools/openapi-generator/config/go-templates/generated.mustache index 574962ea77..76269f0108 100644 --- a/tools/openapi-generator/config/go-templates/generated.mustache +++ b/tools/openapi-generator/config/go-templates/generated.mustache @@ -3,19 +3,20 @@ package {{packageName}} import ( "time" - "net" - "net/http" + "net" + "net/http" - "github.com/mongodb-forks/digest" + "github.com/spf13/cobra" + "github.com/mongodb-forks/digest" "go.mongodb.org/atlas-sdk/admin" - "go.mongodb.org/atlas/auth" + "go.mongodb.org/atlas/auth" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/config" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/log" ) const ( - cloudGovServiceURL = "https://cloud.mongodbgov.com/" - timeout = 5 * time.Second + cloudGovServiceURL = "https://cloud.mongodbgov.com/" + timeout = 5 * time.Second keepAlive = 30 * time.Second maxIdleConns = 5 maxIdleConnsPerHost = 4 @@ -25,18 +26,18 @@ const ( func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { httpTransport := &http.Transport{ - DialContext: (&net.Dialer{ - Timeout: timeout, - KeepAlive: keepAlive, - }).DialContext, - MaxIdleConns: maxIdleConns, - MaxIdleConnsPerHost: maxIdleConnsPerHost, - Proxy: http.ProxyFromEnvironment, - IdleConnTimeout: idleConnTimeout, - ExpectContinueTimeout: expectContinueTimeout, - } - - if username == "" && password == "" && accessToken == nil { + DialContext: (&net.Dialer{ + Timeout: timeout, + KeepAlive: keepAlive, + }).DialContext, + MaxIdleConns: maxIdleConns, + MaxIdleConnsPerHost: maxIdleConnsPerHost, + Proxy: http.ProxyFromEnvironment, + IdleConnTimeout: idleConnTimeout, + ExpectContinueTimeout: expectContinueTimeout, + } + + if username == "" && password == "" && accessToken == nil { return &http.Client{Transport: httpTransport}, nil } if username != "" && password != "" { @@ -56,32 +57,32 @@ func httpClient(username, password string, accessToken *auth.Token) (*http.Clien } func NewClientWithAuth() (*admin.APIClient, error) { - profile := config.Default() + profile := config.Default() - var authToken *auth.Token + var authToken *auth.Token - username := profile.PublicAPIKey() - password := profile.PrivateAPIKey() + username := profile.PublicAPIKey() + password := profile.PrivateAPIKey() - if username == "" && password == "" { - var err error - authToken, err = profile.Token() - if err != nil { - return nil, err - } - } + if username == "" && password == "" { + var err error + authToken, err = profile.Token() + if err != nil { + return nil, err + } + } - baseURL := profile.OpsManagerURL() - if baseURL == "" && profile.Service() == config.CloudGovService { - baseURL = cloudGovServiceURL - } + baseURL := profile.OpsManagerURL() + if baseURL == "" && profile.Service() == config.CloudGovService { + baseURL = cloudGovServiceURL + } - client, err := httpClient(username, password, authToken) + client, err := httpClient(username, password, authToken) if err != nil { return nil, err } - opts := []admin.ClientModifier{ + opts := []admin.ClientModifier{ admin.UseHTTPClient(client), admin.UseUserAgent(config.UserAgent), admin.UseDebug(log.IsDebugLevel())} @@ -105,3 +106,13 @@ func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { tr.token.SetAuthHeader(req) return tr.base.RoundTrip(req) } + +func Commands() []*cobra.Command { + return []*cobra.Command { +{{#apiInfo}} +{{#apis}} + {{baseName}}Builder(), +{{/apis}} +{{/apiInfo}} + } +} From 0d78284c65950fa991756c021da15c4fc66312b8 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 1 Jun 2023 13:40:32 +0100 Subject: [PATCH 10/44] switch to generated commands --- internal/cli/root/atlas/builder.go | 100 ++++++++++++----------------- 1 file changed, 42 insertions(+), 58 deletions(-) diff --git a/internal/cli/root/atlas/builder.go b/internal/cli/root/atlas/builder.go index 0ec682e458..45a7333d1c 100644 --- a/internal/cli/root/atlas/builder.go +++ b/internal/cli/root/atlas/builder.go @@ -25,41 +25,14 @@ import ( "time" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/accesslists" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/accesslogs" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/alerts" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/backup" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/cloudproviders" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/clusters" atlasConfig "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/config" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/customdbroles" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/customdns" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/datalake" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/datalakepipelines" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/dbusers" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/events" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/integrations" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/kubernetes" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/livemigrations" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/logs" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/maintenance" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/metrics" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/networking" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/organizations" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/performanceadvisor" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/privateendpoints" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/processes" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/projects" "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/quickstart" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/security" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/serverless" "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/setup" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/teams" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/users" "github.com/mongodb/mongodb-atlas-cli/internal/cli/auth" "github.com/mongodb/mongodb-atlas-cli/internal/cli/figautocomplete" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/generated" "github.com/mongodb/mongodb-atlas-cli/internal/homebrew" "github.com/mongodb/mongodb-atlas-cli/internal/latestrelease" "github.com/mongodb/mongodb-atlas-cli/internal/log" @@ -186,44 +159,55 @@ Use the --help flag with any command for more info on that command.`, registerCmd := auth.RegisterBuilder() registerCmd.Hidden = true - rootCmd.AddCommand( + cmdList := append([]*cobra.Command{ atlasConfig.Builder(), auth.Builder(), quickstart.Builder(), setup.Builder(), - projects.Builder(), - organizations.Builder(), - users.Builder(), - teams.Builder(), - clusters.Builder(), - dbusers.Builder(), - customdbroles.Builder(), - accesslists.Builder(), - datalake.Builder(), - datalakepipelines.Builder(), - alerts.Builder(), - backup.Builder(), - events.Builder(), - metrics.Builder(), - performanceadvisor.Builder(), - logs.Builder(), - processes.Builder(), - privateendpoints.Builder(), - networking.Builder(), - security.Builder(), - integrations.Builder(), - maintenance.Builder(), - customdns.Builder(), - cloudproviders.Builder(), - serverless.Builder(), - livemigrations.Builder(), - accesslogs.Builder(), loginCmd, logoutCmd, whoCmd, registerCmd, - figautocomplete.Builder(), - kubernetes.Builder(), + }, generated.Commands()...) + rootCmd.AddCommand( + cmdList..., + /*atlasConfig.Builder(), + auth.Builder(), + quickstart.Builder(), + setup.Builder(), + projects.Builder(), + organizations.Builder(), + users.Builder(), + teams.Builder(), + clusters.Builder(), + dbusers.Builder(), + customdbroles.Builder(), + accesslists.Builder(), + datalake.Builder(), + datalakepipelines.Builder(), + alerts.Builder(), + backup.Builder(), + events.Builder(), + metrics.Builder(), + performanceadvisor.Builder(), + logs.Builder(), + processes.Builder(), + privateendpoints.Builder(), + networking.Builder(), + security.Builder(), + integrations.Builder(), + maintenance.Builder(), + customdns.Builder(), + cloudproviders.Builder(), + serverless.Builder(), + livemigrations.Builder(), + accesslogs.Builder(), + loginCmd, + logoutCmd, + whoCmd, + registerCmd, + figautocomplete.Builder(), + kubernetes.Builder(),*/ ) rootCmd.PersistentFlags().StringVarP(&profile, flag.Profile, flag.ProfileShort, "", usage.ProfileAtlasCLI) From 6860410f3b8e4ea3ca6af08c3efa06a835934b63 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 1 Jun 2023 16:38:59 +0100 Subject: [PATCH 11/44] map ints like SDK --- internal/generated/api_access_tracking_cmd.go | 4 ++-- .../generated/api_alert_configurations_cmd.go | 8 +++---- internal/generated/api_alerts_cmd.go | 8 +++---- internal/generated/api_cloud_backups_cmd.go | 24 +++++++++---------- internal/generated/api_clusters_cmd.go | 8 +++---- internal/generated/api_data_federation_cmd.go | 4 ++-- .../generated/api_data_lake_pipelines_cmd.go | 8 +++---- internal/generated/api_database_users_cmd.go | 4 ++-- internal/generated/api_events_cmd.go | 8 +++---- internal/generated/api_invoices_cmd.go | 4 ++-- internal/generated/api_legacy_backup_cmd.go | 12 +++++----- .../generated/api_monitoring_and_logs_cmd.go | 12 +++++----- .../generated/api_multi_cloud_clusters_cmd.go | 4 ++-- internal/generated/api_network_peering_cmd.go | 12 +++++----- internal/generated/api_online_archive_cmd.go | 4 ++-- internal/generated/api_organizations_cmd.go | 12 +++++----- .../generated/api_performance_advisor_cmd.go | 4 ++-- .../api_programmatic_api_keys_cmd.go | 20 ++++++++-------- .../api_project_ip_access_list_cmd.go | 8 +++---- internal/generated/api_projects_cmd.go | 8 +++---- .../generated/api_serverless_instances_cmd.go | 4 ++-- internal/generated/api_teams_cmd.go | 12 +++++----- .../api_third_party_integrations_cmd.go | 12 +++++----- .../generated/api_x509_authentication_cmd.go | 4 ++-- tools/openapi-generator/package.json | 2 +- 25 files changed, 105 insertions(+), 105 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index a89cd107e8..f6aef73d28 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -32,7 +32,7 @@ type ListAccessLogsByClusterNameOpts struct { authResult bool end int64 ipAddress string - nLogs int32 + nLogs int start int64 } @@ -108,7 +108,7 @@ type ListAccessLogsByHostnameOpts struct { authResult bool end int64 ipAddress string - nLogs int32 + nLogs int start int64 } diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index facfb2bcec..35cb5d6ef5 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -261,8 +261,8 @@ type ListAlertConfigurationsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListAlertConfigurationsOpts) initClient(ctx context.Context) func() error { @@ -328,8 +328,8 @@ type ListAlertConfigurationsByAlertIdOpts struct { groupId string alertId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListAlertConfigurationsByAlertIdOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 85af543901..67130c712f 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -151,8 +151,8 @@ type ListAlertsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int status string } @@ -221,8 +221,8 @@ type ListAlertsByAlertConfigurationIdOpts struct { groupId string alertConfigId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListAlertsByAlertConfigurationIdOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index 00f04d7777..3e5696c125 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -1156,8 +1156,8 @@ type ListBackupExportJobsOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListBackupExportJobsOpts) initClient(ctx context.Context) func() error { @@ -1226,8 +1226,8 @@ type ListBackupRestoreJobsOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { @@ -1295,8 +1295,8 @@ type ListExportBucketsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListExportBucketsOpts) initClient(ctx context.Context) func() error { @@ -1362,8 +1362,8 @@ type ListReplicaSetBackupsOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListReplicaSetBackupsOpts) initClient(ctx context.Context) func() error { @@ -1432,8 +1432,8 @@ type ListServerlessBackupRestoreJobsOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListServerlessBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { @@ -1502,8 +1502,8 @@ type ListServerlessBackupsOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListServerlessBackupsOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 8bc945c3b4..55548f49c9 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -212,8 +212,8 @@ type ListCloudProviderRegionsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int providers []string tier string } @@ -283,8 +283,8 @@ type ListClustersForAllProjectsOpts struct { cli.OutputOpts client *admin.APIClient includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListClustersForAllProjectsOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index dbe868902c..de131f8bb8 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -587,8 +587,8 @@ type ListDataFederationPrivateEndpointsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListDataFederationPrivateEndpointsOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 9fa6efc911..3686c71192 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -339,8 +339,8 @@ type ListPipelineRunsOpts struct { groupId string pipelineName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int createdBefore time.Time } @@ -473,8 +473,8 @@ type ListPipelineSnapshotsOpts struct { groupId string pipelineName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int completedAfter time.Time } diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 6963d0f664..298b5e02fb 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -216,8 +216,8 @@ type ListDatabaseUsersOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListDatabaseUsersOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 5442dc33bd..639112138d 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -157,8 +157,8 @@ type ListOrganizationEventsOpts struct { client *admin.APIClient orgId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int eventType []string includeRaw bool maxDate time.Time @@ -235,8 +235,8 @@ type ListProjectEventsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int clusterNames []string eventType []string includeRaw bool diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index c9e0359f59..31e59d0780 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -151,8 +151,8 @@ type ListInvoicesOpts struct { client *admin.APIClient orgId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListInvoicesOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index 6c092c8786..ed97a211d4 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -351,8 +351,8 @@ type ListLegacyBackupCheckpointsOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListLegacyBackupCheckpointsOpts) initClient(ctx context.Context) func() error { @@ -421,8 +421,8 @@ type ListLegacyBackupRestoreJobsOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int batchId string } @@ -494,8 +494,8 @@ type ListLegacySnapshotsOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int completed string } diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index 96fff4d23d..52987a9eef 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -633,8 +633,8 @@ type ListAtlasProcessesOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListAtlasProcessesOpts) initClient(ctx context.Context) func() error { @@ -700,8 +700,8 @@ type ListDatabasesOpts struct { groupId string processId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListDatabasesOpts) initClient(ctx context.Context) func() error { @@ -835,8 +835,8 @@ type ListDiskPartitionsOpts struct { groupId string processId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListDiskPartitionsOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index f32a70bdee..46887d0238 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -211,8 +211,8 @@ type ListClustersOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListClustersOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 4b22051513..39ab2bd35b 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -444,8 +444,8 @@ type ListPeeringConnectionsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int providerName string } @@ -513,8 +513,8 @@ type ListPeeringContainerByCloudProviderOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int providerName string } @@ -583,8 +583,8 @@ type ListPeeringContainersOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListPeeringContainersOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index 188a8daf5a..91e8fcd173 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -291,8 +291,8 @@ type ListOnlineArchivesOpts struct { groupId string clusterName string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListOnlineArchivesOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 37726c0861..e704bf282c 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -492,8 +492,8 @@ type ListOrganizationProjectsOpts struct { client *admin.APIClient orgId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int name string } @@ -561,8 +561,8 @@ type ListOrganizationUsersOpts struct { client *admin.APIClient orgId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListOrganizationUsersOpts) initClient(ctx context.Context) func() error { @@ -626,8 +626,8 @@ type ListOrganizationsOpts struct { cli.OutputOpts client *admin.APIClient includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int name string } diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index a08f8912a9..c59b99a1df 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -284,8 +284,8 @@ type ListSuggestedIndexesOpts struct { groupId string processId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int duration int64 namespaces []string nExamples int64 diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 379fcaef88..65a4f21016 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -148,8 +148,8 @@ type CreateApiKeyAccessListOpts struct { orgId string apiUserId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *CreateApiKeyAccessListOpts) initClient(ctx context.Context) func() error { @@ -527,8 +527,8 @@ type ListApiKeyAccessListsEntriesOpts struct { orgId string apiUserId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListApiKeyAccessListsEntriesOpts) initClient(ctx context.Context) func() error { @@ -596,8 +596,8 @@ type ListApiKeysOpts struct { client *admin.APIClient orgId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListApiKeysOpts) initClient(ctx context.Context) func() error { @@ -662,8 +662,8 @@ type ListProjectApiKeysOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListProjectApiKeysOpts) initClient(ctx context.Context) func() error { @@ -850,8 +850,8 @@ type UpdateApiKeyRolesOpts struct { client *admin.APIClient groupId string apiUserId string - pageNum int32 - itemsPerPage int32 + pageNum int + itemsPerPage int includeCount bool } diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 42d906e857..023c6db740 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -29,8 +29,8 @@ type CreateProjectIpAccessListOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *CreateProjectIpAccessListOpts) initClient(ctx context.Context) func() error { @@ -278,8 +278,8 @@ type ListProjectIpAccessListsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListProjectIpAccessListsOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 13cda4a27e..a61770ecba 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -731,8 +731,8 @@ type ListProjectUsersOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int flattenTeams bool includeOrgUsers bool } @@ -802,8 +802,8 @@ type ListProjectsOpts struct { cli.OutputOpts client *admin.APIClient includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListProjectsOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index 84da8c020f..0d37f30682 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -208,8 +208,8 @@ type ListServerlessInstancesOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListServerlessInstancesOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 9b84d83693..8f98daeae5 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -386,9 +386,9 @@ type ListOrganizationTeamsOpts struct { cli.OutputOpts client *admin.APIClient orgId string - itemsPerPage int32 + itemsPerPage int includeCount bool - pageNum int32 + pageNum int } func (opts *ListOrganizationTeamsOpts) initClient(ctx context.Context) func() error { @@ -453,8 +453,8 @@ type ListProjectTeamsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListProjectTeamsOpts) initClient(ctx context.Context) func() error { @@ -519,8 +519,8 @@ type ListTeamUsersOpts struct { client *admin.APIClient orgId string teamId string - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListTeamUsersOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index 87931b4a6f..0918ed61af 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -30,8 +30,8 @@ type CreateThirdPartyIntegrationOpts struct { integrationType string groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *CreateThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { @@ -221,8 +221,8 @@ type ListThirdPartyIntegrationsOpts struct { client *admin.APIClient groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListThirdPartyIntegrationsOpts) initClient(ctx context.Context) func() error { @@ -288,8 +288,8 @@ type UpdateThirdPartyIntegrationOpts struct { integrationType string groupId string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *UpdateThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 33b2fbab5a..5a98596259 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -148,8 +148,8 @@ type ListDatabaseUserCertificatesOpts struct { groupId string username string includeCount bool - itemsPerPage int32 - pageNum int32 + itemsPerPage int + pageNum int } func (opts *ListDatabaseUserCertificatesOpts) initClient(ctx context.Context) func() error { diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index 196cf2f5f1..f160df1212 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -5,7 +5,7 @@ "scripts": { "generate:clear": "rm -rf ../../internal/generated", "generate:init": "mkdir -p ../../internal/generated && cp ./config/.openapi-generator-ignore ../../internal/generated/.openapi-generator-ignore", - "generate:run": "openapi-generator-cli generate -c './config/config.yaml' -o ../../internal/generated", + "generate:run": "openapi-generator-cli generate -c './config/config.yaml' --type-mappings=integer=int -o ../../internal/generated", "generate": "npm run generate:clear && npm run generate:init && npm run generate:run" }, "repository": { From 231eaffb4206a57b02a762307fb00f1d4241479f Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 1 Jun 2023 17:14:58 +0100 Subject: [PATCH 12/44] types --- internal/generated/api_access_tracking_cmd.go | 16 ++--- .../generated/api_alert_configurations_cmd.go | 12 ++-- internal/generated/api_alerts_cmd.go | 12 ++-- internal/generated/api_cloud_backups_cmd.go | 36 ++++++------ internal/generated/api_clusters_cmd.go | 14 ++--- internal/generated/api_data_federation_cmd.go | 14 ++--- .../generated/api_data_lake_pipelines_cmd.go | 16 ++--- internal/generated/api_database_users_cmd.go | 6 +- internal/generated/api_events_cmd.go | 34 +++++------ internal/generated/api_invoices_cmd.go | 6 +- internal/generated/api_legacy_backup_cmd.go | 18 +++--- .../generated/api_monitoring_and_logs_cmd.go | 58 +++++++++---------- .../generated/api_multi_cloud_clusters_cmd.go | 8 +-- internal/generated/api_network_peering_cmd.go | 18 +++--- internal/generated/api_online_archive_cmd.go | 12 ++-- internal/generated/api_organizations_cmd.go | 18 +++--- .../generated/api_performance_advisor_cmd.go | 28 ++++----- .../api_programmatic_api_keys_cmd.go | 30 +++++----- .../api_project_ip_access_list_cmd.go | 12 ++-- internal/generated/api_projects_cmd.go | 16 ++--- .../generated/api_serverless_instances_cmd.go | 6 +- internal/generated/api_teams_cmd.go | 16 ++--- internal/generated/api_test__cmd.go | 2 +- .../api_third_party_integrations_cmd.go | 18 +++--- .../generated/api_x509_authentication_cmd.go | 6 +- .../config/go-templates/cmd.mustache | 4 +- 26 files changed, 218 insertions(+), 218 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index f6aef73d28..f210f6cfd8 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -88,11 +88,11 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") - cmd.Flags().StringVar(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().BoolVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") + cmd.Flags().Int64Var(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") - cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") + cmd.Flags().Int64Var(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -164,11 +164,11 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.hostname, "hostname", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") - cmd.Flags().StringVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") - cmd.Flags().StringVar(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().BoolVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") + cmd.Flags().Int64Var(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") - cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") + cmd.Flags().Int64Var(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostname") diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 35cb5d6ef5..7dce0e6be8 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -313,9 +313,9 @@ func ListAlertConfigurationsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") @@ -382,9 +382,9 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 67130c712f..d3ef402ed4 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -205,9 +205,9 @@ func ListAlertsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.status, "status", , "Status of the alerts to return. Omit to return all alerts in all statuses.") _ = cmd.MarkFlagRequired("groupId") @@ -275,9 +275,9 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index 3e5696c125..20c34c3047 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -1210,9 +1210,9 @@ func ListBackupExportJobsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1280,9 +1280,9 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1347,9 +1347,9 @@ func ListExportBucketsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") @@ -1416,9 +1416,9 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1486,9 +1486,9 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1556,9 +1556,9 @@ func ListServerlessBackupsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 55548f49c9..b1b033d618 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -268,10 +268,10 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.providers, "providers", , "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().[]stringVar(&opts.providers, "providers", , "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") cmd.Flags().StringVar(&opts.tier, "tier", , "Cluster tier for which to retrieve the regions.") _ = cmd.MarkFlagRequired("groupId") @@ -333,9 +333,9 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") return cmd diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index de131f8bb8..104a996ab3 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -134,7 +134,7 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", false, "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") + cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") _ = cmd.MarkFlagRequired("groupId") @@ -451,8 +451,8 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to download query logs.") - cmd.Flags().StringVar(&opts.endDate, "endDate", , "Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") - cmd.Flags().StringVar(&opts.startDate, "startDate", , "Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().Int64Var(&opts.endDate, "endDate", , "Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().Int64Var(&opts.startDate, "startDate", , "Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -639,9 +639,9 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") @@ -890,7 +890,7 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to update.") - cmd.Flags().StringVar(&opts.skipRoleValidation, "skipRoleValidation", , "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") + cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", , "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 3686c71192..e70220d4e3 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -395,10 +395,10 @@ func ListPipelineRunsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", , "If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().Time.TimeVar(&opts.createdBefore, "createdBefore", , "If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -529,10 +529,10 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", , "Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().Time.TimeVar(&opts.completedAfter, "completedAfter", , "Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 298b5e02fb..20a5107e9e 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -268,9 +268,9 @@ func ListDatabaseUsersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 639112138d..846b949363 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -80,7 +80,7 @@ func GetOrganizationEventBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("eventId") @@ -144,7 +144,7 @@ func GetProjectEventBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("eventId") @@ -217,13 +217,13 @@ func ListOrganizationEventsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") - cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") - cmd.Flags().StringVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") - cmd.Flags().StringVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().[]stringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") + cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + cmd.Flags().Time.TimeVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().Time.TimeVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") _ = cmd.MarkFlagRequired("orgId") @@ -297,14 +297,14 @@ func ListProjectEventsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.clusterNames, "clusterNames", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") - cmd.Flags().StringVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") - cmd.Flags().StringVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") - cmd.Flags().StringVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().[]stringVar(&opts.clusterNames, "clusterNames", , "Human-readable label that identifies the cluster.") + cmd.Flags().[]stringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") + cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + cmd.Flags().Time.TimeVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().Time.TimeVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index 31e59d0780..ae6c7661bb 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -203,9 +203,9 @@ func ListInvoicesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index ed97a211d4..234bb8946f 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -405,9 +405,9 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -477,9 +477,9 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.batchId, "batchId", , "Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.") _ = cmd.MarkFlagRequired("groupId") @@ -550,9 +550,9 @@ func ListLegacySnapshotsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.completed, "completed", "true", "Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index 52987a9eef..54bd815730 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -217,11 +217,11 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") @@ -298,11 +298,11 @@ func GetDiskMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("partitionName") @@ -373,8 +373,8 @@ func GetHostLogsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.hostName, "hostName", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") cmd.Flags().StringVar(&opts.logName, "logName", , "Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.") - cmd.Flags().StringVar(&opts.endDate, "endDate", , "Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") - cmd.Flags().StringVar(&opts.startDate, "startDate", , "Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().Int64Var(&opts.endDate, "endDate", , "Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().Int64Var(&opts.startDate, "startDate", , "Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostName") @@ -447,11 +447,11 @@ func GetHostMeasurementsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -535,9 +535,9 @@ func GetIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("indexName") @@ -616,9 +616,9 @@ func GetMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") + cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") @@ -685,9 +685,9 @@ func ListAtlasProcessesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") @@ -754,9 +754,9 @@ func ListDatabasesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -889,9 +889,9 @@ func ListDiskPartitionsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -971,9 +971,9 @@ func ListIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("databaseName") diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 46887d0238..24fd2e6f2f 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -137,7 +137,7 @@ func DeleteClusterBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.retainBackups, "retainBackups", , "Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.") + cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", , "Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -263,9 +263,9 @@ func ListClustersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 39ab2bd35b..bb6de14a2c 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -498,9 +498,9 @@ func ListPeeringConnectionsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider to use for this VPC peering connection.") _ = cmd.MarkFlagRequired("groupId") @@ -567,9 +567,9 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider that serves the desired network peering containers.") _ = cmd.MarkFlagRequired("groupId") @@ -635,9 +635,9 @@ func ListPeeringContainersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index 91e8fcd173..eb0a51f115 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -210,9 +210,9 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.") - cmd.Flags().StringVar(&opts.startDate, "startDate", , "Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") - cmd.Flags().StringVar(&opts.endDate, "endDate", , "Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") - cmd.Flags().StringVar(&opts.archiveOnly, "archiveOnly", false, "Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.") + cmd.Flags().Int64Var(&opts.startDate, "startDate", , "Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") + cmd.Flags().Int64Var(&opts.endDate, "endDate", , "Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") + cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, "Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -345,9 +345,9 @@ func ListOnlineArchivesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index e704bf282c..5ba539666e 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -546,9 +546,9 @@ func ListOrganizationProjectsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.") _ = cmd.MarkFlagRequired("orgId") @@ -613,9 +613,9 @@ func ListOrganizationUsersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") @@ -678,9 +678,9 @@ func ListOrganizationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.") diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index c59b99a1df..5889f517b6 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -200,10 +200,10 @@ func ListSlowQueriesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().StringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") - cmd.Flags().StringVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().Int64Var(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().[]stringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") + cmd.Flags().Int64Var(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") + cmd.Flags().Int64Var(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -269,8 +269,8 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().Int64Var(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().Int64Var(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -348,14 +348,14 @@ func ListSuggestedIndexesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().StringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") - cmd.Flags().StringVar(&opts.nExamples, "nExamples", 5, "Maximum number of example queries that benefit from the suggested index.") - cmd.Flags().StringVar(&opts.nIndexes, "nIndexes", , "Number that indicates the maximum indexes to suggest.") - cmd.Flags().StringVar(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().Int64Var(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().[]stringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") + cmd.Flags().Int64Var(&opts.nExamples, "nExamples", 5, "Maximum number of example queries that benefit from the suggested index.") + cmd.Flags().Int64Var(&opts.nIndexes, "nIndexes", , "Number that indicates the maximum indexes to suggest.") + cmd.Flags().Int64Var(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 65a4f21016..38c8742f3e 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -202,9 +202,9 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -581,9 +581,9 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -648,9 +648,9 @@ func ListApiKeysBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") @@ -714,9 +714,9 @@ func ListProjectApiKeysBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") @@ -905,9 +905,9 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 023c6db740..40ab07fde2 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -81,9 +81,9 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") @@ -330,9 +330,9 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index a61770ecba..940a94f313 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -787,11 +787,11 @@ func ListProjectUsersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.flattenTeams, "flattenTeams", false, "Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `\"flattenTeams\" : false`, this resource returns only users with a role in the project. If `\"flattenTeams\" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.") - cmd.Flags().StringVar(&opts.includeOrgUsers, "includeOrgUsers", false, "Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `\"includeOrgUsers\": false`, this resource returns only users with a role in the project. If `\"includeOrgUsers\": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.flattenTeams, "flattenTeams", false, "Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `\"flattenTeams\" : false`, this resource returns only users with a role in the project. If `\"flattenTeams\" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.") + cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, "Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `\"includeOrgUsers\": false`, this resource returns only users with a role in the project. If `\"includeOrgUsers\": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.") _ = cmd.MarkFlagRequired("groupId") @@ -852,9 +852,9 @@ func ListProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") return cmd diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index 0d37f30682..6353e2137a 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -260,9 +260,9 @@ func ListServerlessInstancesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 8f98daeae5..60ff805ec9 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -439,9 +439,9 @@ func ListOrganizationTeamsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") @@ -505,9 +505,9 @@ func ListProjectTeamsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") @@ -572,8 +572,8 @@ func ListTeamUsersBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index 4f54ed2d40..8c6ebdc04a 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -74,7 +74,7 @@ func VersionedExampleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.additionalInfo, "additionalInfo", false, "") + cmd.Flags().BoolVar(&opts.additionalInfo, "additionalInfo", false, "") return cmd diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index 0918ed61af..191fe86183 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -84,9 +84,9 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") @@ -273,9 +273,9 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") @@ -342,9 +342,9 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 5a98596259..f91950e1b6 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -202,9 +202,9 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account whose certificates you want to return.") - cmd.Flags().StringVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().StringVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().StringVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 98b4bc4931..272b56dcf2 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -72,10 +72,10 @@ func {{operationId}}Builder() *cobra.Command { }, } {{#pathParams}} - cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}") + cmd.Flags().{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}Var(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}") {{/pathParams}} {{#queryParams}} - cmd.Flags().StringVar(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}") + cmd.Flags().{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}Var(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}") {{/queryParams}} {{#pathParams}}{{#required}} _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/pathParams}} From ccec47b00368d0be242fe47ed1c017df0e27be6f Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 1 Jun 2023 17:43:40 +0100 Subject: [PATCH 13/44] fix default values --- internal/generated/api_access_tracking_cmd.go | 35 +- .../generated/api_alert_configurations_cmd.go | 74 ++--- internal/generated/api_alerts_cmd.go | 40 +-- internal/generated/api_atlas_search_cmd.go | 62 ++-- internal/generated/api_auditing_cmd.go | 18 +- .../generated/api_aws_clusters_dns_cmd.go | 18 +- internal/generated/api_cloud_backups_cmd.go | 298 +++++++++--------- .../api_cloud_migration_service_cmd.go | 72 +++-- .../api_cloud_provider_access_cmd.go | 50 +-- .../api_cluster_outage_simulation_cmd.go | 31 +- internal/generated/api_clusters_cmd.go | 83 ++--- .../api_custom_database_roles_cmd.go | 48 +-- internal/generated/api_data_federation_cmd.go | 145 +++++---- .../generated/api_data_lake_pipelines_cmd.go | 127 ++++---- internal/generated/api_database_users_cmd.go | 54 ++-- ..._rest_using_customer_key_management_cmd.go | 18 +- internal/generated/api_events_cmd.go | 33 +- .../api_federated_authentication_cmd.go | 146 +++++---- internal/generated/api_global_clusters_cmd.go | 56 ++-- internal/generated/api_invoices_cmd.go | 33 +- .../generated/api_ldap_configuration_cmd.go | 44 +-- internal/generated/api_legacy_backup_cmd.go | 111 ++++--- .../api_legacy_backup_restore_jobs_cmd.go | 13 +- .../generated/api_maintenance_windows__cmd.go | 39 ++- .../generated/api_mongo_db_cloud_users_cmd.go | 23 +- .../generated/api_monitoring_and_logs_cmd.go | 203 ++++++------ .../generated/api_multi_cloud_clusters_cmd.go | 59 ++-- internal/generated/api_network_peering_cmd.go | 127 ++++---- internal/generated/api_online_archive_cmd.go | 71 +++-- internal/generated/api_organizations_cmd.go | 132 ++++---- .../generated/api_performance_advisor_cmd.go | 56 ++-- .../api_private_endpoint_services_cmd.go | 99 +++--- .../api_programmatic_api_keys_cmd.go | 141 +++++---- .../api_project_ip_access_list_cmd.go | 45 ++- internal/generated/api_projects_cmd.go | 176 ++++++----- internal/generated/api_rolling_index_cmd.go | 13 +- internal/generated/api_root_cmd.go | 6 +- .../generated/api_serverless_instances_cmd.go | 48 +-- .../api_serverless_private_endpoints_cmd.go | 58 ++-- .../api_shared_tier_restore_jobs_cmd.go | 33 +- .../api_shared_tier_snapshots_cmd.go | 33 +- internal/generated/api_teams_cmd.go | 127 ++++---- internal/generated/api_test__cmd.go | 6 +- .../api_third_party_integrations_cmd.go | 50 +-- .../generated/api_x509_authentication_cmd.go | 29 +- .../config/go-templates/cmd.mustache | 38 +-- 46 files changed, 1616 insertions(+), 1605 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index f210f6cfd8..936eb7d8b6 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -36,7 +36,7 @@ type ListAccessLogsByClusterNameOpts struct { start int64 } -func (opts *ListAccessLogsByClusterNameOpts) initClient(ctx context.Context) func() error { +func (opts *ListAccessLogsByClusterNameOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -78,7 +78,7 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -86,17 +86,16 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().BoolVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") - cmd.Flags().Int64Var(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().BoolVar(&opts.authResult, "authResult", false, "Flag that indicates whether the response returns the successful authentication attempts only.") + cmd.Flags().Int64Var(&opts.end, "end", 0, "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "One Internet Protocol address that attempted to authenticate with the database.") cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().Int64Var(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().Int64Var(&opts.start, "start", 0, "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListAccessLogsByHostnameOpts struct { @@ -112,7 +111,7 @@ type ListAccessLogsByHostnameOpts struct { start int64 } -func (opts *ListAccessLogsByHostnameOpts) initClient(ctx context.Context) func() error { +func (opts *ListAccessLogsByHostnameOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -154,7 +153,7 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -162,17 +161,16 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.hostname, "hostname", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") - cmd.Flags().BoolVar(&opts.authResult, "authResult", , "Flag that indicates whether the response returns the successful authentication attempts only.") - cmd.Flags().Int64Var(&opts.end, "end", , "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One Internet Protocol address that attempted to authenticate with the database.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.hostname, "hostname", "", "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") + cmd.Flags().BoolVar(&opts.authResult, "authResult", false, "Flag that indicates whether the response returns the successful authentication attempts only.") + cmd.Flags().Int64Var(&opts.end, "end", 0, "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "One Internet Protocol address that attempted to authenticate with the database.") cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().Int64Var(&opts.start, "start", , "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().Int64Var(&opts.start, "start", 0, "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostname") - return cmd } @@ -187,3 +185,4 @@ func AccessTrackingBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 7dce0e6be8..ee983413fc 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -28,9 +28,10 @@ type CreateAlertConfigurationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateAlertConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *CreateAlertConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreateAlertConfigurationOpts) initClient(ctx context.Context) func() func (opts *CreateAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreateAlertConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreateAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteAlertConfigurationOpts struct { @@ -88,7 +90,7 @@ type DeleteAlertConfigurationOpts struct { alertConfigId string } -func (opts *DeleteAlertConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteAlertConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -125,7 +127,7 @@ func DeleteAlertConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -133,12 +135,11 @@ func DeleteAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") - return cmd } type GetAlertConfigurationOpts struct { @@ -149,7 +150,7 @@ type GetAlertConfigurationOpts struct { alertConfigId string } -func (opts *GetAlertConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *GetAlertConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -186,7 +187,7 @@ func GetAlertConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -194,12 +195,11 @@ func GetAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") - return cmd } type ListAlertConfigurationMatchersFieldNamesOpts struct { @@ -208,7 +208,7 @@ type ListAlertConfigurationMatchersFieldNamesOpts struct { client *admin.APIClient } -func (opts *ListAlertConfigurationMatchersFieldNamesOpts) initClient(ctx context.Context) func() error { +func (opts *ListAlertConfigurationMatchersFieldNamesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -243,7 +243,7 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -252,7 +252,6 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { }, } - return cmd } type ListAlertConfigurationsOpts struct { @@ -265,7 +264,7 @@ type ListAlertConfigurationsOpts struct { pageNum int } -func (opts *ListAlertConfigurationsOpts) initClient(ctx context.Context) func() error { +func (opts *ListAlertConfigurationsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -304,7 +303,7 @@ func ListAlertConfigurationsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -312,13 +311,12 @@ func ListAlertConfigurationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListAlertConfigurationsByAlertIdOpts struct { @@ -332,7 +330,7 @@ type ListAlertConfigurationsByAlertIdOpts struct { pageNum int } -func (opts *ListAlertConfigurationsByAlertIdOpts) initClient(ctx context.Context) func() error { +func (opts *ListAlertConfigurationsByAlertIdOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -372,7 +370,7 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -380,15 +378,14 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertId, "alertId", "", "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") - return cmd } type ToggleAlertConfigurationOpts struct { @@ -397,9 +394,10 @@ type ToggleAlertConfigurationOpts struct { client *admin.APIClient groupId string alertConfigId string + } -func (opts *ToggleAlertConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *ToggleAlertConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -411,6 +409,7 @@ func (opts *ToggleAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.ToggleAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, + } resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -436,7 +435,7 @@ func ToggleAlertConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -444,12 +443,12 @@ func ToggleAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") - return cmd } type UpdateAlertConfigurationOpts struct { @@ -458,9 +457,10 @@ type UpdateAlertConfigurationOpts struct { client *admin.APIClient groupId string alertConfigId string + } -func (opts *UpdateAlertConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateAlertConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -472,6 +472,7 @@ func (opts *UpdateAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.UpdateAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, + } resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -497,7 +498,7 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -505,12 +506,12 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") - return cmd } @@ -531,3 +532,4 @@ func AlertConfigurationsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index d3ef402ed4..ce6573d741 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -29,9 +29,10 @@ type AcknowledgeAlertOpts struct { client *admin.APIClient groupId string alertId string + } -func (opts *AcknowledgeAlertOpts) initClient(ctx context.Context) func() error { +func (opts *AcknowledgeAlertOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *AcknowledgeAlertOpts) Run(ctx context.Context) error { params := &admin.AcknowledgeAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, + } resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func AcknowledgeAlertBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func AcknowledgeAlertBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertId, "alertId", "", "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") - return cmd } type GetAlertOpts struct { @@ -92,7 +94,7 @@ type GetAlertOpts struct { alertId string } -func (opts *GetAlertOpts) initClient(ctx context.Context) func() error { +func (opts *GetAlertOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -129,7 +131,7 @@ func GetAlertBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -137,12 +139,11 @@ func GetAlertBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertId, "alertId", , "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertId, "alertId", "", "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") - return cmd } type ListAlertsOpts struct { @@ -156,7 +157,7 @@ type ListAlertsOpts struct { status string } -func (opts *ListAlertsOpts) initClient(ctx context.Context) func() error { +func (opts *ListAlertsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -196,7 +197,7 @@ func ListAlertsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -204,14 +205,13 @@ func ListAlertsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.status, "status", , "Status of the alerts to return. Omit to return all alerts in all statuses.") + cmd.Flags().StringVar(&opts.status, "status", "", "Status of the alerts to return. Omit to return all alerts in all statuses.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListAlertsByAlertConfigurationIdOpts struct { @@ -225,7 +225,7 @@ type ListAlertsByAlertConfigurationIdOpts struct { pageNum int } -func (opts *ListAlertsByAlertConfigurationIdOpts) initClient(ctx context.Context) func() error { +func (opts *ListAlertsByAlertConfigurationIdOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -265,7 +265,7 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -273,15 +273,14 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", , "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") - return cmd } @@ -298,3 +297,4 @@ func AlertsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index e1df0ddc05..a9d68ce6e7 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -29,9 +29,10 @@ type CreateAtlasSearchIndexOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateAtlasSearchIndexOpts) initClient(ctx context.Context) func() error { +func (opts *CreateAtlasSearchIndexOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.CreateAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateAtlasSearchIndexBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection on which to create an Atlas Search index.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the collection on which to create an Atlas Search index.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type DeleteAtlasSearchIndexOpts struct { @@ -93,7 +95,7 @@ type DeleteAtlasSearchIndexOpts struct { indexId string } -func (opts *DeleteAtlasSearchIndexOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteAtlasSearchIndexOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -131,7 +133,7 @@ func DeleteAtlasSearchIndexBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -139,14 +141,13 @@ func DeleteAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the database and collection with one or more Application Search indexes.") - cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the database and collection with one or more Application Search indexes.") + cmd.Flags().StringVar(&opts.indexId, "indexId", "", "Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") - return cmd } type GetAtlasSearchIndexOpts struct { @@ -158,7 +159,7 @@ type GetAtlasSearchIndexOpts struct { indexId string } -func (opts *GetAtlasSearchIndexOpts) initClient(ctx context.Context) func() error { +func (opts *GetAtlasSearchIndexOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -196,7 +197,7 @@ func GetAtlasSearchIndexBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -204,14 +205,13 @@ func GetAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection with one or more Atlas Search indexes.") - cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the collection with one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.indexId, "indexId", "", "Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") - return cmd } type ListAtlasSearchIndexesOpts struct { @@ -224,7 +224,7 @@ type ListAtlasSearchIndexesOpts struct { databaseName string } -func (opts *ListAtlasSearchIndexesOpts) initClient(ctx context.Context) func() error { +func (opts *ListAtlasSearchIndexesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -263,7 +263,7 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -271,16 +271,15 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection with one or more Atlas Search indexes.") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Name of the collection that contains one or more Atlas Search indexes.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the collection with one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "Name of the collection that contains one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("databaseName") - return cmd } type UpdateAtlasSearchIndexOpts struct { @@ -290,9 +289,10 @@ type UpdateAtlasSearchIndexOpts struct { groupId string clusterName string indexId string + } -func (opts *UpdateAtlasSearchIndexOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateAtlasSearchIndexOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -305,6 +305,7 @@ func (opts *UpdateAtlasSearchIndexOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, IndexId: opts.indexId, + } resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -330,7 +331,7 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -338,14 +339,14 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Name of the cluster that contains the collection whose Atlas Search index to update.") - cmd.Flags().StringVar(&opts.indexId, "indexId", , "Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the collection whose Atlas Search index to update.") + cmd.Flags().StringVar(&opts.indexId, "indexId", "", "Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") - return cmd } @@ -363,3 +364,4 @@ func AtlasSearchBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index 87f351156d..ae3dabfefa 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -30,7 +30,7 @@ type GetAuditingConfigurationOpts struct { groupId string } -func (opts *GetAuditingConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *GetAuditingConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -66,7 +66,7 @@ func GetAuditingConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +74,9 @@ func GetAuditingConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateAuditingConfigurationOpts struct { @@ -85,9 +84,10 @@ type UpdateAuditingConfigurationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpdateAuditingConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateAuditingConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -98,6 +98,7 @@ func (opts *UpdateAuditingConfigurationOpts) initClient(ctx context.Context) fun func (opts *UpdateAuditingConfigurationOpts) Run(ctx context.Context) error { params := &admin.UpdateAuditingConfigurationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -123,7 +124,7 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -131,10 +132,10 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -149,3 +150,4 @@ func AuditingBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 376a939b3c..5a4f1c3fe9 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -30,7 +30,7 @@ type GetAWSCustomDNSOpts struct { groupId string } -func (opts *GetAWSCustomDNSOpts) initClient(ctx context.Context) func() error { +func (opts *GetAWSCustomDNSOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -66,7 +66,7 @@ func GetAWSCustomDNSBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +74,9 @@ func GetAWSCustomDNSBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ToggleAWSCustomDNSOpts struct { @@ -85,9 +84,10 @@ type ToggleAWSCustomDNSOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *ToggleAWSCustomDNSOpts) initClient(ctx context.Context) func() error { +func (opts *ToggleAWSCustomDNSOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -98,6 +98,7 @@ func (opts *ToggleAWSCustomDNSOpts) initClient(ctx context.Context) func() error func (opts *ToggleAWSCustomDNSOpts) Run(ctx context.Context) error { params := &admin.ToggleAWSCustomDNSApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params).Execute() if err != nil { @@ -123,7 +124,7 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -131,10 +132,10 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -149,3 +150,4 @@ func AWSClustersDNSBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index 20c34c3047..ef6abd39c1 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -32,7 +32,7 @@ type CancelBackupRestoreJobOpts struct { restoreJobId string } -func (opts *CancelBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *CancelBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -70,7 +70,7 @@ func CancelBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -78,14 +78,13 @@ func CancelBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "Unique 24-hexadecimal digit string that identifies the restore job to remove.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") - return cmd } type CreateBackupExportJobOpts struct { @@ -94,9 +93,10 @@ type CreateBackupExportJobOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateBackupExportJobOpts) initClient(ctx context.Context) func() error { +func (opts *CreateBackupExportJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -108,6 +108,7 @@ func (opts *CreateBackupExportJobOpts) Run(ctx context.Context) error { params := &admin.CreateBackupExportJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params).Execute() if err != nil { @@ -133,7 +134,7 @@ func CreateBackupExportJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -141,12 +142,12 @@ func CreateBackupExportJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type CreateBackupRestoreJobOpts struct { @@ -155,9 +156,10 @@ type CreateBackupRestoreJobOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *CreateBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -169,6 +171,7 @@ func (opts *CreateBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -194,7 +197,7 @@ func CreateBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -202,12 +205,12 @@ func CreateBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type CreateExportBucketOpts struct { @@ -215,9 +218,10 @@ type CreateExportBucketOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateExportBucketOpts) initClient(ctx context.Context) func() error { +func (opts *CreateExportBucketOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -228,6 +232,7 @@ func (opts *CreateExportBucketOpts) initClient(ctx context.Context) func() error func (opts *CreateExportBucketOpts) Run(ctx context.Context) error { params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params).Execute() if err != nil { @@ -253,7 +258,7 @@ func CreateExportBucketBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -261,10 +266,10 @@ func CreateExportBucketBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type CreateServerlessBackupRestoreJobOpts struct { @@ -273,9 +278,10 @@ type CreateServerlessBackupRestoreJobOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateServerlessBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *CreateServerlessBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -287,6 +293,7 @@ func (opts *CreateServerlessBackupRestoreJobOpts) Run(ctx context.Context) error params := &admin.CreateServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -312,7 +319,7 @@ func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -320,12 +327,12 @@ func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance whose snapshot you want to restore.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance whose snapshot you want to restore.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type DeleteAllBackupSchedulesOpts struct { @@ -336,7 +343,7 @@ type DeleteAllBackupSchedulesOpts struct { clusterName string } -func (opts *DeleteAllBackupSchedulesOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteAllBackupSchedulesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -373,7 +380,7 @@ func DeleteAllBackupSchedulesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -381,12 +388,11 @@ func DeleteAllBackupSchedulesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type DeleteExportBucketOpts struct { @@ -397,7 +403,7 @@ type DeleteExportBucketOpts struct { exportBucketId string } -func (opts *DeleteExportBucketOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteExportBucketOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -434,7 +440,7 @@ func DeleteExportBucketBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -442,12 +448,11 @@ func DeleteExportBucketBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") - return cmd } type DeleteReplicaSetBackupOpts struct { @@ -459,7 +464,7 @@ type DeleteReplicaSetBackupOpts struct { snapshotId string } -func (opts *DeleteReplicaSetBackupOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteReplicaSetBackupOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -497,7 +502,7 @@ func DeleteReplicaSetBackupBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -505,14 +510,13 @@ func DeleteReplicaSetBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type DeleteShardedClusterBackupOpts struct { @@ -524,7 +528,7 @@ type DeleteShardedClusterBackupOpts struct { snapshotId string } -func (opts *DeleteShardedClusterBackupOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteShardedClusterBackupOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -562,7 +566,7 @@ func DeleteShardedClusterBackupBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -570,14 +574,13 @@ func DeleteShardedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type GetBackupExportJobOpts struct { @@ -589,7 +592,7 @@ type GetBackupExportJobOpts struct { exportId string } -func (opts *GetBackupExportJobOpts) initClient(ctx context.Context) func() error { +func (opts *GetBackupExportJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -627,7 +630,7 @@ func GetBackupExportJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -635,14 +638,13 @@ func GetBackupExportJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.exportId, "exportId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.exportId, "exportId", "", "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("exportId") - return cmd } type GetBackupRestoreJobOpts struct { @@ -654,7 +656,7 @@ type GetBackupRestoreJobOpts struct { restoreJobId string } -func (opts *GetBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *GetBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -692,7 +694,7 @@ func GetBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -700,14 +702,13 @@ func GetBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the restore jobs you want to return.") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "Unique 24-hexadecimal digit string that identifies the restore job to return.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") - return cmd } type GetBackupScheduleOpts struct { @@ -718,7 +719,7 @@ type GetBackupScheduleOpts struct { clusterName string } -func (opts *GetBackupScheduleOpts) initClient(ctx context.Context) func() error { +func (opts *GetBackupScheduleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -755,7 +756,7 @@ func GetBackupScheduleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -763,12 +764,11 @@ func GetBackupScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type GetDataProtectionSettingsOpts struct { @@ -778,7 +778,7 @@ type GetDataProtectionSettingsOpts struct { groupId string } -func (opts *GetDataProtectionSettingsOpts) initClient(ctx context.Context) func() error { +func (opts *GetDataProtectionSettingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -814,7 +814,7 @@ func GetDataProtectionSettingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -822,10 +822,9 @@ func GetDataProtectionSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetExportBucketOpts struct { @@ -836,7 +835,7 @@ type GetExportBucketOpts struct { exportBucketId string } -func (opts *GetExportBucketOpts) initClient(ctx context.Context) func() error { +func (opts *GetExportBucketOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -873,7 +872,7 @@ func GetExportBucketBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -881,12 +880,11 @@ func GetExportBucketBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", , "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") - return cmd } type GetReplicaSetBackupOpts struct { @@ -898,7 +896,7 @@ type GetReplicaSetBackupOpts struct { snapshotId string } -func (opts *GetReplicaSetBackupOpts) initClient(ctx context.Context) func() error { +func (opts *GetReplicaSetBackupOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -936,7 +934,7 @@ func GetReplicaSetBackupBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -944,14 +942,13 @@ func GetReplicaSetBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type GetServerlessBackupOpts struct { @@ -963,7 +960,7 @@ type GetServerlessBackupOpts struct { snapshotId string } -func (opts *GetServerlessBackupOpts) initClient(ctx context.Context) func() error { +func (opts *GetServerlessBackupOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1001,7 +998,7 @@ func GetServerlessBackupBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1009,14 +1006,13 @@ func GetServerlessBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type GetServerlessBackupRestoreJobOpts struct { @@ -1028,7 +1024,7 @@ type GetServerlessBackupRestoreJobOpts struct { restoreJobId string } -func (opts *GetServerlessBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *GetServerlessBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1066,7 +1062,7 @@ func GetServerlessBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1074,14 +1070,13 @@ func GetServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "Unique 24-hexadecimal digit string that identifies the restore job to return.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") - return cmd } type GetShardedClusterBackupOpts struct { @@ -1093,7 +1088,7 @@ type GetShardedClusterBackupOpts struct { snapshotId string } -func (opts *GetShardedClusterBackupOpts) initClient(ctx context.Context) func() error { +func (opts *GetShardedClusterBackupOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1131,7 +1126,7 @@ func GetShardedClusterBackupBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1139,14 +1134,13 @@ func GetShardedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type ListBackupExportJobsOpts struct { @@ -1160,7 +1154,7 @@ type ListBackupExportJobsOpts struct { pageNum int } -func (opts *ListBackupExportJobsOpts) initClient(ctx context.Context) func() error { +func (opts *ListBackupExportJobsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1200,7 +1194,7 @@ func ListBackupExportJobsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1208,15 +1202,14 @@ func ListBackupExportJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListBackupRestoreJobsOpts struct { @@ -1230,7 +1223,7 @@ type ListBackupRestoreJobsOpts struct { pageNum int } -func (opts *ListBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { +func (opts *ListBackupRestoreJobsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1270,7 +1263,7 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1278,15 +1271,14 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the restore jobs you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the restore jobs you want to return.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListExportBucketsOpts struct { @@ -1299,7 +1291,7 @@ type ListExportBucketsOpts struct { pageNum int } -func (opts *ListExportBucketsOpts) initClient(ctx context.Context) func() error { +func (opts *ListExportBucketsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1338,7 +1330,7 @@ func ListExportBucketsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1346,13 +1338,12 @@ func ListExportBucketsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListReplicaSetBackupsOpts struct { @@ -1366,7 +1357,7 @@ type ListReplicaSetBackupsOpts struct { pageNum int } -func (opts *ListReplicaSetBackupsOpts) initClient(ctx context.Context) func() error { +func (opts *ListReplicaSetBackupsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1406,7 +1397,7 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1414,15 +1405,14 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListServerlessBackupRestoreJobsOpts struct { @@ -1436,7 +1426,7 @@ type ListServerlessBackupRestoreJobsOpts struct { pageNum int } -func (opts *ListServerlessBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { +func (opts *ListServerlessBackupRestoreJobsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1476,7 +1466,7 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1484,15 +1474,14 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListServerlessBackupsOpts struct { @@ -1506,7 +1495,7 @@ type ListServerlessBackupsOpts struct { pageNum int } -func (opts *ListServerlessBackupsOpts) initClient(ctx context.Context) func() error { +func (opts *ListServerlessBackupsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1546,7 +1535,7 @@ func ListServerlessBackupsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1554,15 +1543,14 @@ func ListServerlessBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListShardedClusterBackupsOpts struct { @@ -1573,7 +1561,7 @@ type ListShardedClusterBackupsOpts struct { clusterName string } -func (opts *ListShardedClusterBackupsOpts) initClient(ctx context.Context) func() error { +func (opts *ListShardedClusterBackupsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1610,7 +1598,7 @@ func ListShardedClusterBackupsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1618,12 +1606,11 @@ func ListShardedClusterBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type TakeSnapshotOpts struct { @@ -1632,9 +1619,10 @@ type TakeSnapshotOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *TakeSnapshotOpts) initClient(ctx context.Context) func() error { +func (opts *TakeSnapshotOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1646,6 +1634,7 @@ func (opts *TakeSnapshotOpts) Run(ctx context.Context) error { params := &admin.TakeSnapshotApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params).Execute() if err != nil { @@ -1671,7 +1660,7 @@ func TakeSnapshotBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1679,12 +1668,12 @@ func TakeSnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type UpdateBackupScheduleOpts struct { @@ -1693,9 +1682,10 @@ type UpdateBackupScheduleOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *UpdateBackupScheduleOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateBackupScheduleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1707,6 +1697,7 @@ func (opts *UpdateBackupScheduleOpts) Run(ctx context.Context) error { params := &admin.UpdateBackupScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params).Execute() if err != nil { @@ -1732,7 +1723,7 @@ func UpdateBackupScheduleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1740,12 +1731,12 @@ func UpdateBackupScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type UpdateDataProtectionSettingsOpts struct { @@ -1753,9 +1744,10 @@ type UpdateDataProtectionSettingsOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpdateDataProtectionSettingsOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateDataProtectionSettingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1766,6 +1758,7 @@ func (opts *UpdateDataProtectionSettingsOpts) initClient(ctx context.Context) fu func (opts *UpdateDataProtectionSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params).Execute() if err != nil { @@ -1791,7 +1784,7 @@ func UpdateDataProtectionSettingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1799,10 +1792,10 @@ func UpdateDataProtectionSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateSnapshotRetentionOpts struct { @@ -1812,9 +1805,10 @@ type UpdateSnapshotRetentionOpts struct { groupId string clusterName string snapshotId string + } -func (opts *UpdateSnapshotRetentionOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateSnapshotRetentionOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1827,6 +1821,7 @@ func (opts *UpdateSnapshotRetentionOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, + } resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() if err != nil { @@ -1852,7 +1847,7 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1860,14 +1855,14 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } @@ -1909,3 +1904,4 @@ func CloudBackupsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index ad0aec9a1a..63b0fb4c99 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -28,9 +28,10 @@ type CreateLinkTokenOpts struct { cli.OutputOpts client *admin.APIClient orgId string + } -func (opts *CreateLinkTokenOpts) initClient(ctx context.Context) func() error { +func (opts *CreateLinkTokenOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreateLinkTokenOpts) initClient(ctx context.Context) func() error { func (opts *CreateLinkTokenOpts) Run(ctx context.Context) error { params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreateLinkTokenBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreateLinkTokenBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("orgId") - return cmd } type CreatePushMigrationOpts struct { @@ -85,9 +87,10 @@ type CreatePushMigrationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreatePushMigrationOpts) initClient(ctx context.Context) func() error { +func (opts *CreatePushMigrationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -98,6 +101,7 @@ func (opts *CreatePushMigrationOpts) initClient(ctx context.Context) func() erro func (opts *CreatePushMigrationOpts) Run(ctx context.Context) error { params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params).Execute() if err != nil { @@ -123,7 +127,7 @@ func CreatePushMigrationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -131,10 +135,10 @@ func CreatePushMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type CutoverMigrationOpts struct { @@ -145,7 +149,7 @@ type CutoverMigrationOpts struct { liveMigrationId string } -func (opts *CutoverMigrationOpts) initClient(ctx context.Context) func() error { +func (opts *CutoverMigrationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -182,7 +186,7 @@ func CutoverMigrationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -190,12 +194,11 @@ func CutoverMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", , "Unique 24-hexadecimal digit string that identifies the migration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "Unique 24-hexadecimal digit string that identifies the migration.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") - return cmd } type DeleteLinkTokenOpts struct { @@ -205,7 +208,7 @@ type DeleteLinkTokenOpts struct { orgId string } -func (opts *DeleteLinkTokenOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteLinkTokenOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -241,7 +244,7 @@ func DeleteLinkTokenBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -249,10 +252,9 @@ func DeleteLinkTokenBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type GetPushMigrationOpts struct { @@ -263,7 +265,7 @@ type GetPushMigrationOpts struct { liveMigrationId string } -func (opts *GetPushMigrationOpts) initClient(ctx context.Context) func() error { +func (opts *GetPushMigrationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -300,7 +302,7 @@ func GetPushMigrationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -308,12 +310,11 @@ func GetPushMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", , "Unique 24-hexadecimal digit string that identifies the migration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "Unique 24-hexadecimal digit string that identifies the migration.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") - return cmd } type GetValidationStatusOpts struct { @@ -324,7 +325,7 @@ type GetValidationStatusOpts struct { validationId string } -func (opts *GetValidationStatusOpts) initClient(ctx context.Context) func() error { +func (opts *GetValidationStatusOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -361,7 +362,7 @@ func GetValidationStatusBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -369,12 +370,11 @@ func GetValidationStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.validationId, "validationId", , "Unique 24-hexadecimal digit string that identifies the validation job.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.validationId, "validationId", "", "Unique 24-hexadecimal digit string that identifies the validation job.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("validationId") - return cmd } type ListSourceProjectsOpts struct { @@ -384,7 +384,7 @@ type ListSourceProjectsOpts struct { orgId string } -func (opts *ListSourceProjectsOpts) initClient(ctx context.Context) func() error { +func (opts *ListSourceProjectsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -420,7 +420,7 @@ func ListSourceProjectsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -428,10 +428,9 @@ func ListSourceProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ValidateMigrationOpts struct { @@ -439,9 +438,10 @@ type ValidateMigrationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *ValidateMigrationOpts) initClient(ctx context.Context) func() error { +func (opts *ValidateMigrationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -452,6 +452,7 @@ func (opts *ValidateMigrationOpts) initClient(ctx context.Context) func() error func (opts *ValidateMigrationOpts) Run(ctx context.Context) error { params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params).Execute() if err != nil { @@ -477,7 +478,7 @@ func ValidateMigrationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -485,10 +486,10 @@ func ValidateMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -509,3 +510,4 @@ func CloudMigrationServiceBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index 88c6568b57..22d5b3a3c6 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -29,9 +29,10 @@ type AuthorizeCloudProviderAccessRoleOpts struct { client *admin.APIClient groupId string roleId string + } -func (opts *AuthorizeCloudProviderAccessRoleOpts) initClient(ctx context.Context) func() error { +func (opts *AuthorizeCloudProviderAccessRoleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *AuthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error params := &admin.AuthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, RoleId: opts.roleId, + } resp, _, err := opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleId, "roleId", "", "Unique 24-hexadecimal digit string that identifies the role.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") - return cmd } type CreateCloudProviderAccessRoleOpts struct { @@ -89,9 +91,10 @@ type CreateCloudProviderAccessRoleOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateCloudProviderAccessRoleOpts) initClient(ctx context.Context) func() error { +func (opts *CreateCloudProviderAccessRoleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -102,6 +105,7 @@ func (opts *CreateCloudProviderAccessRoleOpts) initClient(ctx context.Context) f func (opts *CreateCloudProviderAccessRoleOpts) Run(ctx context.Context) error { params := &admin.CreateCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { @@ -127,7 +131,7 @@ func CreateCloudProviderAccessRoleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -135,10 +139,10 @@ func CreateCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeauthorizeCloudProviderAccessRoleOpts struct { @@ -150,7 +154,7 @@ type DeauthorizeCloudProviderAccessRoleOpts struct { roleId string } -func (opts *DeauthorizeCloudProviderAccessRoleOpts) initClient(ctx context.Context) func() error { +func (opts *DeauthorizeCloudProviderAccessRoleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -188,7 +192,7 @@ func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -196,14 +200,13 @@ func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", , "Human-readable label that identifies the cloud provider of the role to deauthorize.") - cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "Human-readable label that identifies the cloud provider of the role to deauthorize.") + cmd.Flags().StringVar(&opts.roleId, "roleId", "", "Unique 24-hexadecimal digit string that identifies the role.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("roleId") - return cmd } type GetCloudProviderAccessRoleOpts struct { @@ -214,7 +217,7 @@ type GetCloudProviderAccessRoleOpts struct { roleId string } -func (opts *GetCloudProviderAccessRoleOpts) initClient(ctx context.Context) func() error { +func (opts *GetCloudProviderAccessRoleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -251,7 +254,7 @@ func GetCloudProviderAccessRoleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -259,12 +262,11 @@ func GetCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleId, "roleId", , "Unique 24-hexadecimal digit string that identifies the role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleId, "roleId", "", "Unique 24-hexadecimal digit string that identifies the role.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") - return cmd } type ListCloudProviderAccessRolesOpts struct { @@ -274,7 +276,7 @@ type ListCloudProviderAccessRolesOpts struct { groupId string } -func (opts *ListCloudProviderAccessRolesOpts) initClient(ctx context.Context) func() error { +func (opts *ListCloudProviderAccessRolesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -310,7 +312,7 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -318,10 +320,9 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -339,3 +340,4 @@ func CloudProviderAccessBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 3667fcc6a1..c816aa2843 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -31,7 +31,7 @@ type EndOutageSimulationOpts struct { clusterName string } -func (opts *EndOutageSimulationOpts) initClient(ctx context.Context) func() error { +func (opts *EndOutageSimulationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -68,7 +68,7 @@ func EndOutageSimulationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +76,11 @@ func EndOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that is undergoing outage simulation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that is undergoing outage simulation.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type GetOutageSimulationOpts struct { @@ -92,7 +91,7 @@ type GetOutageSimulationOpts struct { clusterName string } -func (opts *GetOutageSimulationOpts) initClient(ctx context.Context) func() error { +func (opts *GetOutageSimulationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -129,7 +128,7 @@ func GetOutageSimulationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -137,12 +136,11 @@ func GetOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that is undergoing outage simulation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that is undergoing outage simulation.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type StartOutageSimulationOpts struct { @@ -151,9 +149,10 @@ type StartOutageSimulationOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *StartOutageSimulationOpts) initClient(ctx context.Context) func() error { +func (opts *StartOutageSimulationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -165,6 +164,7 @@ func (opts *StartOutageSimulationOpts) Run(ctx context.Context) error { params := &admin.StartOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params).Execute() if err != nil { @@ -190,7 +190,7 @@ func StartOutageSimulationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -198,12 +198,12 @@ func StartOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster to undergo an outage simulation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster to undergo an outage simulation.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } @@ -219,3 +219,4 @@ func ClusterOutageSimulationBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index b1b033d618..ed1655be12 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -31,7 +31,7 @@ type GetClusterAdvancedConfigurationOpts struct { clusterName string } -func (opts *GetClusterAdvancedConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *GetClusterAdvancedConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -68,7 +68,7 @@ func GetClusterAdvancedConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +76,11 @@ func GetClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type GetClusterStatusOpts struct { @@ -92,7 +91,7 @@ type GetClusterStatusOpts struct { clusterName string } -func (opts *GetClusterStatusOpts) initClient(ctx context.Context) func() error { +func (opts *GetClusterStatusOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -129,7 +128,7 @@ func GetClusterStatusBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -137,12 +136,11 @@ func GetClusterStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type GetSampleDatasetLoadStatusOpts struct { @@ -153,7 +151,7 @@ type GetSampleDatasetLoadStatusOpts struct { sampleDatasetId string } -func (opts *GetSampleDatasetLoadStatusOpts) initClient(ctx context.Context) func() error { +func (opts *GetSampleDatasetLoadStatusOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -190,7 +188,7 @@ func GetSampleDatasetLoadStatusBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -198,12 +196,11 @@ func GetSampleDatasetLoadStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", , "Unique 24-hexadecimal digit string that identifies the loaded sample dataset.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", "Unique 24-hexadecimal digit string that identifies the loaded sample dataset.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("sampleDatasetId") - return cmd } type ListCloudProviderRegionsOpts struct { @@ -218,7 +215,7 @@ type ListCloudProviderRegionsOpts struct { tier string } -func (opts *ListCloudProviderRegionsOpts) initClient(ctx context.Context) func() error { +func (opts *ListCloudProviderRegionsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -259,7 +256,7 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -267,15 +264,14 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().[]stringVar(&opts.providers, "providers", , "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") - cmd.Flags().StringVar(&opts.tier, "tier", , "Cluster tier for which to retrieve the regions.") + cmd.Flags().StringVar(&opts.tier, "tier", "", "Cluster tier for which to retrieve the regions.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListClustersForAllProjectsOpts struct { @@ -287,7 +283,7 @@ type ListClustersForAllProjectsOpts struct { pageNum int } -func (opts *ListClustersForAllProjectsOpts) initClient(ctx context.Context) func() error { +func (opts *ListClustersForAllProjectsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -325,7 +321,7 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -337,7 +333,6 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - return cmd } type LoadSampleDatasetOpts struct { @@ -348,7 +343,7 @@ type LoadSampleDatasetOpts struct { name string } -func (opts *LoadSampleDatasetOpts) initClient(ctx context.Context) func() error { +func (opts *LoadSampleDatasetOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -385,7 +380,7 @@ func LoadSampleDatasetBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -393,12 +388,11 @@ func LoadSampleDatasetBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the cluster into which you load the sample dataset.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label that identifies the cluster into which you load the sample dataset.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") - return cmd } type UpdateClusterAdvancedConfigurationOpts struct { @@ -407,9 +401,10 @@ type UpdateClusterAdvancedConfigurationOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *UpdateClusterAdvancedConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateClusterAdvancedConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -421,6 +416,7 @@ func (opts *UpdateClusterAdvancedConfigurationOpts) Run(ctx context.Context) err params := &admin.UpdateClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -446,7 +442,7 @@ func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -454,12 +450,12 @@ func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type UpgradeSharedClusterOpts struct { @@ -467,9 +463,10 @@ type UpgradeSharedClusterOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpgradeSharedClusterOpts) initClient(ctx context.Context) func() error { +func (opts *UpgradeSharedClusterOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -480,6 +477,7 @@ func (opts *UpgradeSharedClusterOpts) initClient(ctx context.Context) func() err func (opts *UpgradeSharedClusterOpts) Run(ctx context.Context) error { params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() if err != nil { @@ -505,7 +503,7 @@ func UpgradeSharedClusterBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -513,10 +511,10 @@ func UpgradeSharedClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpgradeSharedClusterToServerlessOpts struct { @@ -524,9 +522,10 @@ type UpgradeSharedClusterToServerlessOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpgradeSharedClusterToServerlessOpts) initClient(ctx context.Context) func() error { +func (opts *UpgradeSharedClusterToServerlessOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -537,6 +536,7 @@ func (opts *UpgradeSharedClusterToServerlessOpts) initClient(ctx context.Context func (opts *UpgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error { params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params).Execute() if err != nil { @@ -562,7 +562,7 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -570,10 +570,10 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -595,3 +595,4 @@ func ClustersBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index f202a3d307..f3acd13042 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -28,9 +28,10 @@ type CreateCustomDatabaseRoleOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateCustomDatabaseRoleOpts) initClient(ctx context.Context) func() error { +func (opts *CreateCustomDatabaseRoleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreateCustomDatabaseRoleOpts) initClient(ctx context.Context) func() func (opts *CreateCustomDatabaseRoleOpts) Run(ctx context.Context) error { params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreateCustomDatabaseRoleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreateCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteCustomDatabaseRoleOpts struct { @@ -88,7 +90,7 @@ type DeleteCustomDatabaseRoleOpts struct { roleName string } -func (opts *DeleteCustomDatabaseRoleOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteCustomDatabaseRoleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -125,7 +127,7 @@ func DeleteCustomDatabaseRoleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -133,12 +135,11 @@ func DeleteCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleName, "roleName", "", "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") - return cmd } type GetCustomDatabaseRoleOpts struct { @@ -149,7 +150,7 @@ type GetCustomDatabaseRoleOpts struct { roleName string } -func (opts *GetCustomDatabaseRoleOpts) initClient(ctx context.Context) func() error { +func (opts *GetCustomDatabaseRoleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -186,7 +187,7 @@ func GetCustomDatabaseRoleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -194,12 +195,11 @@ func GetCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleName, "roleName", "", "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") - return cmd } type ListCustomDatabaseRolesOpts struct { @@ -209,7 +209,7 @@ type ListCustomDatabaseRolesOpts struct { groupId string } -func (opts *ListCustomDatabaseRolesOpts) initClient(ctx context.Context) func() error { +func (opts *ListCustomDatabaseRolesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -245,7 +245,7 @@ func ListCustomDatabaseRolesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -253,10 +253,9 @@ func ListCustomDatabaseRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateCustomDatabaseRoleOpts struct { @@ -265,9 +264,10 @@ type UpdateCustomDatabaseRoleOpts struct { client *admin.APIClient groupId string roleName string + } -func (opts *UpdateCustomDatabaseRoleOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateCustomDatabaseRoleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -279,6 +279,7 @@ func (opts *UpdateCustomDatabaseRoleOpts) Run(ctx context.Context) error { params := &admin.UpdateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, + } resp, _, err := opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { @@ -304,7 +305,7 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -312,12 +313,12 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleName, "roleName", , "Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.roleName, "roleName", "", "Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") - return cmd } @@ -335,3 +336,4 @@ func CustomDatabaseRolesBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index 104a996ab3..1f1de04f4d 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -28,9 +28,10 @@ type CreateDataFederationPrivateEndpointOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateDataFederationPrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *CreateDataFederationPrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreateDataFederationPrivateEndpointOpts) initClient(ctx context.Cont func (opts *CreateDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type CreateFederatedDatabaseOpts struct { @@ -85,10 +87,11 @@ type CreateFederatedDatabaseOpts struct { cli.OutputOpts client *admin.APIClient groupId string + skipRoleValidation bool } -func (opts *CreateFederatedDatabaseOpts) initClient(ctx context.Context) func() error { +func (opts *CreateFederatedDatabaseOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -99,6 +102,7 @@ func (opts *CreateFederatedDatabaseOpts) initClient(ctx context.Context) func() func (opts *CreateFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, + SkipRoleValidation: opts.skipRoleValidation, } resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() @@ -125,7 +129,7 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -133,11 +137,11 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type CreateOneDataFederationQueryLimitOpts struct { @@ -147,9 +151,10 @@ type CreateOneDataFederationQueryLimitOpts struct { groupId string tenantName string limitName string + } -func (opts *CreateOneDataFederationQueryLimitOpts) initClient(ctx context.Context) func() error { +func (opts *CreateOneDataFederationQueryLimitOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -162,6 +167,7 @@ func (opts *CreateOneDataFederationQueryLimitOpts) Run(ctx context.Context) erro GroupId: opts.groupId, TenantName: opts.tenantName, LimitName: opts.limitName, + } resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params).Execute() if err != nil { @@ -187,7 +193,7 @@ func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -195,14 +201,14 @@ func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to which the query limit applies.") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") - return cmd } type DeleteDataFederationPrivateEndpointOpts struct { @@ -213,7 +219,7 @@ type DeleteDataFederationPrivateEndpointOpts struct { endpointId string } -func (opts *DeleteDataFederationPrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteDataFederationPrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -250,7 +256,7 @@ func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -258,12 +264,11 @@ func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") - return cmd } type DeleteFederatedDatabaseOpts struct { @@ -274,7 +279,7 @@ type DeleteFederatedDatabaseOpts struct { tenantName string } -func (opts *DeleteFederatedDatabaseOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteFederatedDatabaseOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -311,7 +316,7 @@ func DeleteFederatedDatabaseBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -319,12 +324,11 @@ func DeleteFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to remove.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") - return cmd } type DeleteOneDataFederationInstanceQueryLimitOpts struct { @@ -336,7 +340,7 @@ type DeleteOneDataFederationInstanceQueryLimitOpts struct { limitName string } -func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -374,7 +378,7 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -382,14 +386,13 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to which the query limit applies.") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") - return cmd } type DownloadFederatedDatabaseQueryLogsOpts struct { @@ -402,7 +405,7 @@ type DownloadFederatedDatabaseQueryLogsOpts struct { startDate int64 } -func (opts *DownloadFederatedDatabaseQueryLogsOpts) initClient(ctx context.Context) func() error { +func (opts *DownloadFederatedDatabaseQueryLogsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -441,7 +444,7 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -449,14 +452,13 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to download query logs.") - cmd.Flags().Int64Var(&opts.endDate, "endDate", , "Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") - cmd.Flags().Int64Var(&opts.startDate, "startDate", , "Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance for which you want to download query logs.") + cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, "Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, "Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") - return cmd } type GetDataFederationPrivateEndpointOpts struct { @@ -467,7 +469,7 @@ type GetDataFederationPrivateEndpointOpts struct { endpointId string } -func (opts *GetDataFederationPrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *GetDataFederationPrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -504,7 +506,7 @@ func GetDataFederationPrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -512,12 +514,11 @@ func GetDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") - return cmd } type GetFederatedDatabaseOpts struct { @@ -528,7 +529,7 @@ type GetFederatedDatabaseOpts struct { tenantName string } -func (opts *GetFederatedDatabaseOpts) initClient(ctx context.Context) func() error { +func (opts *GetFederatedDatabaseOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -565,7 +566,7 @@ func GetFederatedDatabaseBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -573,12 +574,11 @@ func GetFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the Federated Database to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the Federated Database to return.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") - return cmd } type ListDataFederationPrivateEndpointsOpts struct { @@ -591,7 +591,7 @@ type ListDataFederationPrivateEndpointsOpts struct { pageNum int } -func (opts *ListDataFederationPrivateEndpointsOpts) initClient(ctx context.Context) func() error { +func (opts *ListDataFederationPrivateEndpointsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -630,7 +630,7 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -638,13 +638,12 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListFederatedDatabasesOpts struct { @@ -655,7 +654,7 @@ type ListFederatedDatabasesOpts struct { type_ string } -func (opts *ListFederatedDatabasesOpts) initClient(ctx context.Context) func() error { +func (opts *ListFederatedDatabasesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -692,7 +691,7 @@ func ListFederatedDatabasesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -700,11 +699,10 @@ func ListFederatedDatabasesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.type_, "type_", "USER", "Type of Federated Database Instances to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", "Type of Federated Database Instances to return.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ReturnFederatedDatabaseQueryLimitOpts struct { @@ -716,7 +714,7 @@ type ReturnFederatedDatabaseQueryLimitOpts struct { limitName string } -func (opts *ReturnFederatedDatabaseQueryLimitOpts) initClient(ctx context.Context) func() error { +func (opts *ReturnFederatedDatabaseQueryLimitOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -754,7 +752,7 @@ func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -762,14 +760,13 @@ func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to which the query limit applies.") - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to which the query limit applies.") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") - return cmd } type ReturnFederatedDatabaseQueryLimitsOpts struct { @@ -780,7 +777,7 @@ type ReturnFederatedDatabaseQueryLimitsOpts struct { tenantName string } -func (opts *ReturnFederatedDatabaseQueryLimitsOpts) initClient(ctx context.Context) func() error { +func (opts *ReturnFederatedDatabaseQueryLimitsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -817,7 +814,7 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -825,12 +822,11 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance for which you want to retrieve query limits.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance for which you want to retrieve query limits.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") - return cmd } type UpdateFederatedDatabaseOpts struct { @@ -840,9 +836,10 @@ type UpdateFederatedDatabaseOpts struct { groupId string tenantName string skipRoleValidation bool + } -func (opts *UpdateFederatedDatabaseOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateFederatedDatabaseOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -855,6 +852,7 @@ func (opts *UpdateFederatedDatabaseOpts) Run(ctx context.Context) error { GroupId: opts.groupId, TenantName: opts.tenantName, SkipRoleValidation: opts.skipRoleValidation, + } resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { @@ -880,7 +878,7 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -888,13 +886,13 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", , "Human-readable label that identifies the federated database instance to update.") - cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", , "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to update.") + cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") - _ = cmd.MarkFlagRequired("skipRoleValidation") return cmd } @@ -922,3 +920,4 @@ func DataFederationBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index e70220d4e3..590abe21c0 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -28,9 +28,10 @@ type CreatePipelineOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreatePipelineOpts) initClient(ctx context.Context) func() error { +func (opts *CreatePipelineOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreatePipelineOpts) initClient(ctx context.Context) func() error { func (opts *CreatePipelineOpts) Run(ctx context.Context) error { params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreatePipelineBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreatePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeletePipelineOpts struct { @@ -88,7 +90,7 @@ type DeletePipelineOpts struct { pipelineName string } -func (opts *DeletePipelineOpts) initClient(ctx context.Context) func() error { +func (opts *DeletePipelineOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -125,7 +127,7 @@ func DeletePipelineBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -133,12 +135,11 @@ func DeletePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } type DeletePipelineRunDatasetOpts struct { @@ -150,7 +151,7 @@ type DeletePipelineRunDatasetOpts struct { pipelineRunId string } -func (opts *DeletePipelineRunDatasetOpts) initClient(ctx context.Context) func() error { +func (opts *DeletePipelineRunDatasetOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -188,7 +189,7 @@ func DeletePipelineRunDatasetBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -196,14 +197,13 @@ func DeletePipelineRunDatasetBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", , "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") - return cmd } type GetPipelineOpts struct { @@ -214,7 +214,7 @@ type GetPipelineOpts struct { pipelineName string } -func (opts *GetPipelineOpts) initClient(ctx context.Context) func() error { +func (opts *GetPipelineOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -251,7 +251,7 @@ func GetPipelineBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -259,12 +259,11 @@ func GetPipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } type GetPipelineRunOpts struct { @@ -276,7 +275,7 @@ type GetPipelineRunOpts struct { pipelineRunId string } -func (opts *GetPipelineRunOpts) initClient(ctx context.Context) func() error { +func (opts *GetPipelineRunOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -314,7 +313,7 @@ func GetPipelineRunBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -322,14 +321,13 @@ func GetPipelineRunBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", , "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") - return cmd } type ListPipelineRunsOpts struct { @@ -344,7 +342,7 @@ type ListPipelineRunsOpts struct { createdBefore time.Time } -func (opts *ListPipelineRunsOpts) initClient(ctx context.Context) func() error { +func (opts *ListPipelineRunsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -385,7 +383,7 @@ func ListPipelineRunsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -393,8 +391,8 @@ func ListPipelineRunsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") @@ -402,7 +400,6 @@ func ListPipelineRunsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } type ListPipelineSchedulesOpts struct { @@ -413,7 +410,7 @@ type ListPipelineSchedulesOpts struct { pipelineName string } -func (opts *ListPipelineSchedulesOpts) initClient(ctx context.Context) func() error { +func (opts *ListPipelineSchedulesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -450,7 +447,7 @@ func ListPipelineSchedulesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -458,12 +455,11 @@ func ListPipelineSchedulesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } type ListPipelineSnapshotsOpts struct { @@ -478,7 +474,7 @@ type ListPipelineSnapshotsOpts struct { completedAfter time.Time } -func (opts *ListPipelineSnapshotsOpts) initClient(ctx context.Context) func() error { +func (opts *ListPipelineSnapshotsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -519,7 +515,7 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -527,8 +523,8 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") @@ -536,7 +532,6 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } type ListPipelinesOpts struct { @@ -546,7 +541,7 @@ type ListPipelinesOpts struct { groupId string } -func (opts *ListPipelinesOpts) initClient(ctx context.Context) func() error { +func (opts *ListPipelinesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -582,7 +577,7 @@ func ListPipelinesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -590,10 +585,9 @@ func ListPipelinesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type PausePipelineOpts struct { @@ -604,7 +598,7 @@ type PausePipelineOpts struct { pipelineName string } -func (opts *PausePipelineOpts) initClient(ctx context.Context) func() error { +func (opts *PausePipelineOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -641,7 +635,7 @@ func PausePipelineBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -649,12 +643,11 @@ func PausePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } type ResumePipelineOpts struct { @@ -665,7 +658,7 @@ type ResumePipelineOpts struct { pipelineName string } -func (opts *ResumePipelineOpts) initClient(ctx context.Context) func() error { +func (opts *ResumePipelineOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -702,7 +695,7 @@ func ResumePipelineBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -710,12 +703,11 @@ func ResumePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } type TriggerSnapshotIngestionOpts struct { @@ -724,9 +716,10 @@ type TriggerSnapshotIngestionOpts struct { client *admin.APIClient groupId string pipelineName string + } -func (opts *TriggerSnapshotIngestionOpts) initClient(ctx context.Context) func() error { +func (opts *TriggerSnapshotIngestionOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -738,6 +731,7 @@ func (opts *TriggerSnapshotIngestionOpts) Run(ctx context.Context) error { params := &admin.TriggerSnapshotIngestionApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, + } resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() if err != nil { @@ -763,7 +757,7 @@ func TriggerSnapshotIngestionBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -771,12 +765,12 @@ func TriggerSnapshotIngestionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } type UpdatePipelineOpts struct { @@ -785,9 +779,10 @@ type UpdatePipelineOpts struct { client *admin.APIClient groupId string pipelineName string + } -func (opts *UpdatePipelineOpts) initClient(ctx context.Context) func() error { +func (opts *UpdatePipelineOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -799,6 +794,7 @@ func (opts *UpdatePipelineOpts) Run(ctx context.Context) error { params := &admin.UpdatePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, + } resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() if err != nil { @@ -824,7 +820,7 @@ func UpdatePipelineBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -832,12 +828,12 @@ func UpdatePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", , "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") - return cmd } @@ -863,3 +859,4 @@ func DataLakePipelinesBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 20a5107e9e..e7f48a53f4 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -28,9 +28,10 @@ type CreateDatabaseUserOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateDatabaseUserOpts) initClient(ctx context.Context) func() error { +func (opts *CreateDatabaseUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreateDatabaseUserOpts) initClient(ctx context.Context) func() error func (opts *CreateDatabaseUserOpts) Run(ctx context.Context) error { params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreateDatabaseUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreateDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteDatabaseUserOpts struct { @@ -89,7 +91,7 @@ type DeleteDatabaseUserOpts struct { username string } -func (opts *DeleteDatabaseUserOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteDatabaseUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -127,7 +129,7 @@ func DeleteDatabaseUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -135,14 +137,13 @@ func DeleteDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") - cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") + cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") - return cmd } type GetDatabaseUserOpts struct { @@ -154,7 +155,7 @@ type GetDatabaseUserOpts struct { username string } -func (opts *GetDatabaseUserOpts) initClient(ctx context.Context) func() error { +func (opts *GetDatabaseUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -192,7 +193,7 @@ func GetDatabaseUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -200,14 +201,13 @@ func GetDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") - cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") + cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") - return cmd } type ListDatabaseUsersOpts struct { @@ -220,7 +220,7 @@ type ListDatabaseUsersOpts struct { pageNum int } -func (opts *ListDatabaseUsersOpts) initClient(ctx context.Context) func() error { +func (opts *ListDatabaseUsersOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -259,7 +259,7 @@ func ListDatabaseUsersBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -267,13 +267,12 @@ func ListDatabaseUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateDatabaseUserOpts struct { @@ -283,9 +282,10 @@ type UpdateDatabaseUserOpts struct { groupId string databaseName string username string + } -func (opts *UpdateDatabaseUserOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateDatabaseUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -298,6 +298,7 @@ func (opts *UpdateDatabaseUserOpts) Run(ctx context.Context) error { GroupId: opts.groupId, DatabaseName: opts.databaseName, Username: opts.username, + } resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params).Execute() if err != nil { @@ -323,7 +324,7 @@ func UpdateDatabaseUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -331,14 +332,14 @@ func UpdateDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") - cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") + cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") - return cmd } @@ -356,3 +357,4 @@ func DatabaseUsersBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index c3b9f2f4a2..a780f68e19 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -30,7 +30,7 @@ type GetEncryptionAtRestOpts struct { groupId string } -func (opts *GetEncryptionAtRestOpts) initClient(ctx context.Context) func() error { +func (opts *GetEncryptionAtRestOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -66,7 +66,7 @@ func GetEncryptionAtRestBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +74,9 @@ func GetEncryptionAtRestBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateEncryptionAtRestOpts struct { @@ -85,9 +84,10 @@ type UpdateEncryptionAtRestOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpdateEncryptionAtRestOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateEncryptionAtRestOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -98,6 +98,7 @@ func (opts *UpdateEncryptionAtRestOpts) initClient(ctx context.Context) func() e func (opts *UpdateEncryptionAtRestOpts) Run(ctx context.Context) error { params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params).Execute() if err != nil { @@ -123,7 +124,7 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -131,10 +132,10 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -149,3 +150,4 @@ func EncryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 846b949363..9989e8feea 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -32,7 +32,7 @@ type GetOrganizationEventOpts struct { includeRaw bool } -func (opts *GetOrganizationEventOpts) initClient(ctx context.Context) func() error { +func (opts *GetOrganizationEventOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -70,7 +70,7 @@ func GetOrganizationEventBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -78,13 +78,12 @@ func GetOrganizationEventBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.eventId, "eventId", "", "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("eventId") - return cmd } type GetProjectEventOpts struct { @@ -96,7 +95,7 @@ type GetProjectEventOpts struct { includeRaw bool } -func (opts *GetProjectEventOpts) initClient(ctx context.Context) func() error { +func (opts *GetProjectEventOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -134,7 +133,7 @@ func GetProjectEventBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -142,13 +141,12 @@ func GetProjectEventBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.eventId, "eventId", , "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.eventId, "eventId", "", "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("eventId") - return cmd } type ListOrganizationEventsOpts struct { @@ -165,7 +163,7 @@ type ListOrganizationEventsOpts struct { minDate time.Time } -func (opts *ListOrganizationEventsOpts) initClient(ctx context.Context) func() error { +func (opts *ListOrganizationEventsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -208,7 +206,7 @@ func ListOrganizationEventsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -216,7 +214,7 @@ func ListOrganizationEventsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") @@ -226,7 +224,6 @@ func ListOrganizationEventsBuilder() *cobra.Command { cmd.Flags().Time.TimeVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListProjectEventsOpts struct { @@ -244,7 +241,7 @@ type ListProjectEventsOpts struct { minDate time.Time } -func (opts *ListProjectEventsOpts) initClient(ctx context.Context) func() error { +func (opts *ListProjectEventsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -288,7 +285,7 @@ func ListProjectEventsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -296,7 +293,7 @@ func ListProjectEventsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") @@ -307,7 +304,6 @@ func ListProjectEventsBuilder() *cobra.Command { cmd.Flags().Time.TimeVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -324,3 +320,4 @@ func EventsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index e1b6590ce7..d84a53b80a 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -29,9 +29,10 @@ type CreateRoleMappingOpts struct { client *admin.APIClient federationSettingsId string orgId string + } -func (opts *CreateRoleMappingOpts) initClient(ctx context.Context) func() error { +func (opts *CreateRoleMappingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateRoleMappingOpts) Run(ctx context.Context) error { params := &admin.CreateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, + } resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateRoleMappingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") - return cmd } type DeleteFederationAppOpts struct { @@ -91,7 +93,7 @@ type DeleteFederationAppOpts struct { federationSettingsId string } -func (opts *DeleteFederationAppOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteFederationAppOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -127,7 +129,7 @@ func DeleteFederationAppBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -135,10 +137,9 @@ func DeleteFederationAppBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") _ = cmd.MarkFlagRequired("federationSettingsId") - return cmd } type DeleteRoleMappingOpts struct { @@ -150,7 +151,7 @@ type DeleteRoleMappingOpts struct { orgId string } -func (opts *DeleteRoleMappingOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteRoleMappingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -188,7 +189,7 @@ func DeleteRoleMappingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -196,14 +197,13 @@ func DeleteRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.") - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.id, "id", "", "Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") - return cmd } type GetConnectedOrgConfigOpts struct { @@ -214,7 +214,7 @@ type GetConnectedOrgConfigOpts struct { orgId string } -func (opts *GetConnectedOrgConfigOpts) initClient(ctx context.Context) func() error { +func (opts *GetConnectedOrgConfigOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -251,7 +251,7 @@ func GetConnectedOrgConfigBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -259,12 +259,11 @@ func GetConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.") _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") - return cmd } type GetFederationSettingsOpts struct { @@ -274,7 +273,7 @@ type GetFederationSettingsOpts struct { orgId string } -func (opts *GetFederationSettingsOpts) initClient(ctx context.Context) func() error { +func (opts *GetFederationSettingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -310,7 +309,7 @@ func GetFederationSettingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -318,10 +317,9 @@ func GetFederationSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type GetIdentityProviderOpts struct { @@ -332,7 +330,7 @@ type GetIdentityProviderOpts struct { identityProviderId string } -func (opts *GetIdentityProviderOpts) initClient(ctx context.Context) func() error { +func (opts *GetIdentityProviderOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -369,7 +367,7 @@ func GetIdentityProviderBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -377,12 +375,11 @@ func GetIdentityProviderBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "Unique 20-hexadecimal digit string that identifies the identity provider.") _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") - return cmd } type GetIdentityProviderMetadataOpts struct { @@ -393,7 +390,7 @@ type GetIdentityProviderMetadataOpts struct { identityProviderId string } -func (opts *GetIdentityProviderMetadataOpts) initClient(ctx context.Context) func() error { +func (opts *GetIdentityProviderMetadataOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -430,7 +427,7 @@ func GetIdentityProviderMetadataBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -438,12 +435,11 @@ func GetIdentityProviderMetadataBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "Unique 20-hexadecimal digit string that identifies the identity provider.") _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") - return cmd } type GetRoleMappingOpts struct { @@ -455,7 +451,7 @@ type GetRoleMappingOpts struct { orgId string } -func (opts *GetRoleMappingOpts) initClient(ctx context.Context) func() error { +func (opts *GetRoleMappingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -493,7 +489,7 @@ func GetRoleMappingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -501,14 +497,13 @@ func GetRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.") - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.id, "id", "", "Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListConnectedOrgConfigsOpts struct { @@ -518,7 +513,7 @@ type ListConnectedOrgConfigsOpts struct { federationSettingsId string } -func (opts *ListConnectedOrgConfigsOpts) initClient(ctx context.Context) func() error { +func (opts *ListConnectedOrgConfigsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -554,7 +549,7 @@ func ListConnectedOrgConfigsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -562,10 +557,9 @@ func ListConnectedOrgConfigsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") _ = cmd.MarkFlagRequired("federationSettingsId") - return cmd } type ListIdentityProvidersOpts struct { @@ -575,7 +569,7 @@ type ListIdentityProvidersOpts struct { federationSettingsId string } -func (opts *ListIdentityProvidersOpts) initClient(ctx context.Context) func() error { +func (opts *ListIdentityProvidersOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -611,7 +605,7 @@ func ListIdentityProvidersBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -619,10 +613,9 @@ func ListIdentityProvidersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") _ = cmd.MarkFlagRequired("federationSettingsId") - return cmd } type ListRoleMappingsOpts struct { @@ -633,7 +626,7 @@ type ListRoleMappingsOpts struct { orgId string } -func (opts *ListRoleMappingsOpts) initClient(ctx context.Context) func() error { +func (opts *ListRoleMappingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -670,7 +663,7 @@ func ListRoleMappingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -678,12 +671,11 @@ func ListRoleMappingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") - return cmd } type RemoveConnectedOrgConfigOpts struct { @@ -694,7 +686,7 @@ type RemoveConnectedOrgConfigOpts struct { orgId string } -func (opts *RemoveConnectedOrgConfigOpts) initClient(ctx context.Context) func() error { +func (opts *RemoveConnectedOrgConfigOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -731,7 +723,7 @@ func RemoveConnectedOrgConfigBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -739,12 +731,11 @@ func RemoveConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.") _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") - return cmd } type UpdateConnectedOrgConfigOpts struct { @@ -753,9 +744,10 @@ type UpdateConnectedOrgConfigOpts struct { client *admin.APIClient federationSettingsId string orgId string + } -func (opts *UpdateConnectedOrgConfigOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateConnectedOrgConfigOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -767,6 +759,7 @@ func (opts *UpdateConnectedOrgConfigOpts) Run(ctx context.Context) error { params := &admin.UpdateConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, + } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { @@ -792,7 +785,7 @@ func UpdateConnectedOrgConfigBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -800,12 +793,12 @@ func UpdateConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.") + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") - return cmd } type UpdateIdentityProviderOpts struct { @@ -814,9 +807,10 @@ type UpdateIdentityProviderOpts struct { client *admin.APIClient federationSettingsId string identityProviderId string + } -func (opts *UpdateIdentityProviderOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateIdentityProviderOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -828,6 +822,7 @@ func (opts *UpdateIdentityProviderOpts) Run(ctx context.Context) error { params := &admin.UpdateIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, + } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params).Execute() if err != nil { @@ -853,7 +848,7 @@ func UpdateIdentityProviderBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -861,12 +856,12 @@ func UpdateIdentityProviderBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", , "Unique 20-hexadecimal digit string that identifies the identity provider.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "Unique 20-hexadecimal digit string that identifies the identity provider.") + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") - return cmd } type UpdateRoleMappingOpts struct { @@ -876,9 +871,10 @@ type UpdateRoleMappingOpts struct { federationSettingsId string id string orgId string + } -func (opts *UpdateRoleMappingOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateRoleMappingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -891,6 +887,7 @@ func (opts *UpdateRoleMappingOpts) Run(ctx context.Context) error { FederationSettingsId: opts.federationSettingsId, Id: opts.id, OrgId: opts.orgId, + } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -916,7 +913,7 @@ func UpdateRoleMappingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -924,14 +921,14 @@ func UpdateRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", , "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.id, "id", , "Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.") - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.id, "id", "", "Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") - return cmd } @@ -959,3 +956,4 @@ func FederatedAuthenticationBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index 338a9e48f8..f1ad65c8a5 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -29,9 +29,10 @@ type CreateCustomZoneMappingOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateCustomZoneMappingOpts) initClient(ctx context.Context) func() error { +func (opts *CreateCustomZoneMappingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateCustomZoneMappingOpts) Run(ctx context.Context) error { params := &admin.CreateCustomZoneMappingApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateCustomZoneMappingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateCustomZoneMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type CreateManagedNamespaceOpts struct { @@ -90,9 +92,10 @@ type CreateManagedNamespaceOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateManagedNamespaceOpts) initClient(ctx context.Context) func() error { +func (opts *CreateManagedNamespaceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -104,6 +107,7 @@ func (opts *CreateManagedNamespaceOpts) Run(ctx context.Context) error { params := &admin.CreateManagedNamespaceApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params).Execute() if err != nil { @@ -129,7 +133,7 @@ func CreateManagedNamespaceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -137,12 +141,12 @@ func CreateManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type DeleteAllCustomZoneMappingsOpts struct { @@ -153,7 +157,7 @@ type DeleteAllCustomZoneMappingsOpts struct { clusterName string } -func (opts *DeleteAllCustomZoneMappingsOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteAllCustomZoneMappingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -190,7 +194,7 @@ func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -198,12 +202,11 @@ func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type DeleteManagedNamespaceOpts struct { @@ -216,7 +219,7 @@ type DeleteManagedNamespaceOpts struct { collection string } -func (opts *DeleteManagedNamespaceOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteManagedNamespaceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -255,7 +258,7 @@ func DeleteManagedNamespaceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -263,14 +266,13 @@ func DeleteManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.db, "db", , "Human-readable label that identifies the database that contains the collection.") - cmd.Flags().StringVar(&opts.collection, "collection", , "Human-readable label that identifies the collection associated with the managed namespace.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.db, "db", "", "Human-readable label that identifies the database that contains the collection.") + cmd.Flags().StringVar(&opts.collection, "collection", "", "Human-readable label that identifies the collection associated with the managed namespace.") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetManagedNamespaceOpts struct { @@ -281,7 +283,7 @@ type GetManagedNamespaceOpts struct { clusterName string } -func (opts *GetManagedNamespaceOpts) initClient(ctx context.Context) func() error { +func (opts *GetManagedNamespaceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -318,7 +320,7 @@ func GetManagedNamespaceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -326,12 +328,11 @@ func GetManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } @@ -350,3 +351,4 @@ MongoDB Cloud shards the empty collection using the required location field and ) return cmd } + diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index ae6c7661bb..52dead929a 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -31,7 +31,7 @@ type DownloadInvoiceCSVOpts struct { invoiceId string } -func (opts *DownloadInvoiceCSVOpts) initClient(ctx context.Context) func() error { +func (opts *DownloadInvoiceCSVOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -68,7 +68,7 @@ func DownloadInvoiceCSVBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +76,11 @@ func DownloadInvoiceCSVBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", , "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") - return cmd } type GetInvoiceOpts struct { @@ -92,7 +91,7 @@ type GetInvoiceOpts struct { invoiceId string } -func (opts *GetInvoiceOpts) initClient(ctx context.Context) func() error { +func (opts *GetInvoiceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -129,7 +128,7 @@ func GetInvoiceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -137,12 +136,11 @@ func GetInvoiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", , "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") - return cmd } type ListInvoicesOpts struct { @@ -155,7 +153,7 @@ type ListInvoicesOpts struct { pageNum int } -func (opts *ListInvoicesOpts) initClient(ctx context.Context) func() error { +func (opts *ListInvoicesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -194,7 +192,7 @@ func ListInvoicesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -202,13 +200,12 @@ func ListInvoicesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListPendingInvoicesOpts struct { @@ -218,7 +215,7 @@ type ListPendingInvoicesOpts struct { orgId string } -func (opts *ListPendingInvoicesOpts) initClient(ctx context.Context) func() error { +func (opts *ListPendingInvoicesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -254,7 +251,7 @@ func ListPendingInvoicesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -262,10 +259,9 @@ func ListPendingInvoicesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("orgId") - return cmd } @@ -282,3 +278,4 @@ func InvoicesBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 560e701eae..2bda083a1c 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -30,7 +30,7 @@ type DeleteLDAPConfigurationOpts struct { groupId string } -func (opts *DeleteLDAPConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteLDAPConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -66,7 +66,7 @@ func DeleteLDAPConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +74,9 @@ func DeleteLDAPConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetLDAPConfigurationOpts struct { @@ -87,7 +86,7 @@ type GetLDAPConfigurationOpts struct { groupId string } -func (opts *GetLDAPConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *GetLDAPConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -123,7 +122,7 @@ func GetLDAPConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -131,10 +130,9 @@ func GetLDAPConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetLDAPConfigurationStatusOpts struct { @@ -145,7 +143,7 @@ type GetLDAPConfigurationStatusOpts struct { requestId string } -func (opts *GetLDAPConfigurationStatusOpts) initClient(ctx context.Context) func() error { +func (opts *GetLDAPConfigurationStatusOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -182,7 +180,7 @@ func GetLDAPConfigurationStatusBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -190,12 +188,11 @@ func GetLDAPConfigurationStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.requestId, "requestId", , "Unique string that identifies the request to verify an <abbr title=\"Lightweight Directory Access Protocol\">LDAP</abbr> configuration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.requestId, "requestId", "", "Unique string that identifies the request to verify an <abbr title=\"Lightweight Directory Access Protocol\">LDAP</abbr> configuration.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("requestId") - return cmd } type SaveLDAPConfigurationOpts struct { @@ -203,9 +200,10 @@ type SaveLDAPConfigurationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *SaveLDAPConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *SaveLDAPConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -216,6 +214,7 @@ func (opts *SaveLDAPConfigurationOpts) initClient(ctx context.Context) func() er func (opts *SaveLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -241,7 +240,7 @@ func SaveLDAPConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -249,10 +248,10 @@ func SaveLDAPConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type VerifyLDAPConfigurationOpts struct { @@ -260,9 +259,10 @@ type VerifyLDAPConfigurationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *VerifyLDAPConfigurationOpts) initClient(ctx context.Context) func() error { +func (opts *VerifyLDAPConfigurationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -273,6 +273,7 @@ func (opts *VerifyLDAPConfigurationOpts) initClient(ctx context.Context) func() func (opts *VerifyLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -298,7 +299,7 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -306,10 +307,10 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -327,3 +328,4 @@ func LDAPConfigurationBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index 234bb8946f..faf057c7f6 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -32,7 +32,7 @@ type DeleteLegacySnapshotOpts struct { snapshotId string } -func (opts *DeleteLegacySnapshotOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteLegacySnapshotOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -70,7 +70,7 @@ func DeleteLegacySnapshotBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -78,14 +78,13 @@ func DeleteLegacySnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type GetLegacyBackupCheckpointOpts struct { @@ -97,7 +96,7 @@ type GetLegacyBackupCheckpointOpts struct { clusterName string } -func (opts *GetLegacyBackupCheckpointOpts) initClient(ctx context.Context) func() error { +func (opts *GetLegacyBackupCheckpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -135,7 +134,7 @@ func GetLegacyBackupCheckpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -143,14 +142,13 @@ func GetLegacyBackupCheckpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", , "Unique 24-hexadecimal digit string that identifies the checkpoint.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", "Unique 24-hexadecimal digit string that identifies the checkpoint.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("checkpointId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type GetLegacyBackupRestoreJobOpts struct { @@ -162,7 +160,7 @@ type GetLegacyBackupRestoreJobOpts struct { jobId string } -func (opts *GetLegacyBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *GetLegacyBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -200,7 +198,7 @@ func GetLegacyBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -208,14 +206,13 @@ func GetLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") - cmd.Flags().StringVar(&opts.jobId, "jobId", , "Unique 24-hexadecimal digit string that identifies the restore job.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.jobId, "jobId", "", "Unique 24-hexadecimal digit string that identifies the restore job.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("jobId") - return cmd } type GetLegacySnapshotOpts struct { @@ -227,7 +224,7 @@ type GetLegacySnapshotOpts struct { snapshotId string } -func (opts *GetLegacySnapshotOpts) initClient(ctx context.Context) func() error { +func (opts *GetLegacySnapshotOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -265,7 +262,7 @@ func GetLegacySnapshotBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -273,14 +270,13 @@ func GetLegacySnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type GetLegacySnapshotScheduleOpts struct { @@ -291,7 +287,7 @@ type GetLegacySnapshotScheduleOpts struct { clusterName string } -func (opts *GetLegacySnapshotScheduleOpts) initClient(ctx context.Context) func() error { +func (opts *GetLegacySnapshotScheduleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -328,7 +324,7 @@ func GetLegacySnapshotScheduleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -336,12 +332,11 @@ func GetLegacySnapshotScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListLegacyBackupCheckpointsOpts struct { @@ -355,7 +350,7 @@ type ListLegacyBackupCheckpointsOpts struct { pageNum int } -func (opts *ListLegacyBackupCheckpointsOpts) initClient(ctx context.Context) func() error { +func (opts *ListLegacyBackupCheckpointsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -395,7 +390,7 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -403,15 +398,14 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListLegacyBackupRestoreJobsOpts struct { @@ -426,7 +420,7 @@ type ListLegacyBackupRestoreJobsOpts struct { batchId string } -func (opts *ListLegacyBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { +func (opts *ListLegacyBackupRestoreJobsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -467,7 +461,7 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -475,16 +469,15 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.batchId, "batchId", , "Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.") + cmd.Flags().StringVar(&opts.batchId, "batchId", "", "Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListLegacySnapshotsOpts struct { @@ -499,7 +492,7 @@ type ListLegacySnapshotsOpts struct { completed string } -func (opts *ListLegacySnapshotsOpts) initClient(ctx context.Context) func() error { +func (opts *ListLegacySnapshotsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -540,7 +533,7 @@ func ListLegacySnapshotsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -548,16 +541,15 @@ func ListLegacySnapshotsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.completed, "completed", "true", "Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.") + cmd.Flags().StringVar(&opts.completed, "completed", ""true"", "Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type UpdateLegacySnapshotRetentionOpts struct { @@ -567,9 +559,10 @@ type UpdateLegacySnapshotRetentionOpts struct { groupId string clusterName string snapshotId string + } -func (opts *UpdateLegacySnapshotRetentionOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateLegacySnapshotRetentionOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -582,6 +575,7 @@ func (opts *UpdateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, + } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() if err != nil { @@ -607,7 +601,7 @@ func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -615,14 +609,14 @@ func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type UpdateLegacySnapshotScheduleOpts struct { @@ -631,9 +625,10 @@ type UpdateLegacySnapshotScheduleOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *UpdateLegacySnapshotScheduleOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateLegacySnapshotScheduleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -645,6 +640,7 @@ func (opts *UpdateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { params := &admin.UpdateLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { @@ -670,7 +666,7 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -678,12 +674,12 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } @@ -706,3 +702,4 @@ func LegacyBackupBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 850bc6ddf9..317b9bf2a4 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -29,9 +29,10 @@ type CreateLegacyBackupRestoreJobOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateLegacyBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *CreateLegacyBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } @@ -95,3 +97,4 @@ func LegacyBackupRestoreJobsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index 9f4d5a7a8b..73c4171566 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -30,7 +30,7 @@ type DeferMaintenanceWindowOpts struct { groupId string } -func (opts *DeferMaintenanceWindowOpts) initClient(ctx context.Context) func() error { +func (opts *DeferMaintenanceWindowOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -66,7 +66,7 @@ func DeferMaintenanceWindowBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +74,9 @@ func DeferMaintenanceWindowBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetMaintenanceWindowOpts struct { @@ -87,7 +86,7 @@ type GetMaintenanceWindowOpts struct { groupId string } -func (opts *GetMaintenanceWindowOpts) initClient(ctx context.Context) func() error { +func (opts *GetMaintenanceWindowOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -123,7 +122,7 @@ func GetMaintenanceWindowBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -131,10 +130,9 @@ func GetMaintenanceWindowBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ResetMaintenanceWindowOpts struct { @@ -144,7 +142,7 @@ type ResetMaintenanceWindowOpts struct { groupId string } -func (opts *ResetMaintenanceWindowOpts) initClient(ctx context.Context) func() error { +func (opts *ResetMaintenanceWindowOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -180,7 +178,7 @@ func ResetMaintenanceWindowBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -188,10 +186,9 @@ func ResetMaintenanceWindowBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ToggleMaintenanceAutoDeferOpts struct { @@ -201,7 +198,7 @@ type ToggleMaintenanceAutoDeferOpts struct { groupId string } -func (opts *ToggleMaintenanceAutoDeferOpts) initClient(ctx context.Context) func() error { +func (opts *ToggleMaintenanceAutoDeferOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -237,7 +234,7 @@ func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -245,10 +242,9 @@ func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateMaintenanceWindowOpts struct { @@ -256,9 +252,10 @@ type UpdateMaintenanceWindowOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpdateMaintenanceWindowOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateMaintenanceWindowOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -269,6 +266,7 @@ func (opts *UpdateMaintenanceWindowOpts) initClient(ctx context.Context) func() func (opts *UpdateMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.UpdateMaintenanceWindowApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { @@ -294,7 +292,7 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -302,10 +300,10 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -323,3 +321,4 @@ func MaintenanceWindowsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index 336507e924..bae7fe19a9 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -27,9 +27,10 @@ type CreateUserOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient + } -func (opts *CreateUserOpts) initClient(ctx context.Context) func() error { +func (opts *CreateUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -39,6 +40,7 @@ func (opts *CreateUserOpts) initClient(ctx context.Context) func() error { func (opts *CreateUserOpts) Run(ctx context.Context) error { params := &admin.CreateUserApiParams{ + } resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params).Execute() if err != nil { @@ -64,7 +66,7 @@ func CreateUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -72,7 +74,7 @@ func CreateUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - + return cmd } @@ -83,7 +85,7 @@ type GetUserOpts struct { userId string } -func (opts *GetUserOpts) initClient(ctx context.Context) func() error { +func (opts *GetUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -119,7 +121,7 @@ func GetUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -127,10 +129,9 @@ func GetUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal digit string that identifies this user.") + cmd.Flags().StringVar(&opts.userId, "userId", "", "Unique 24-hexadecimal digit string that identifies this user.") _ = cmd.MarkFlagRequired("userId") - return cmd } type GetUserByUsernameOpts struct { @@ -140,7 +141,7 @@ type GetUserByUsernameOpts struct { userName string } -func (opts *GetUserByUsernameOpts) initClient(ctx context.Context) func() error { +func (opts *GetUserByUsernameOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -176,7 +177,7 @@ func GetUserByUsernameBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -184,10 +185,9 @@ func GetUserByUsernameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.userName, "userName", , "Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.") + cmd.Flags().StringVar(&opts.userName, "userName", "", "Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.") _ = cmd.MarkFlagRequired("userName") - return cmd } @@ -203,3 +203,4 @@ func MongoDBCloudUsersBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index 54bd815730..f2b212e8e5 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -31,7 +31,7 @@ type GetAtlasProcessOpts struct { processId string } -func (opts *GetAtlasProcessOpts) initClient(ctx context.Context) func() error { +func (opts *GetAtlasProcessOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -68,7 +68,7 @@ func GetAtlasProcessBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +76,11 @@ func GetAtlasProcessBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - return cmd } type GetDatabaseOpts struct { @@ -93,7 +92,7 @@ type GetDatabaseOpts struct { processId string } -func (opts *GetDatabaseOpts) initClient(ctx context.Context) func() error { +func (opts *GetDatabaseOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -131,7 +130,7 @@ func GetDatabaseBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -139,14 +138,13 @@ func GetDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database that the specified MongoDB process serves.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") - return cmd } type GetDatabaseMeasurementsOpts struct { @@ -156,14 +154,14 @@ type GetDatabaseMeasurementsOpts struct { groupId string databaseName string processId string - m []string granularity string + m []string period string start time.Time end time.Time } -func (opts *GetDatabaseMeasurementsOpts) initClient(ctx context.Context) func() error { +func (opts *GetDatabaseMeasurementsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -176,8 +174,8 @@ func (opts *GetDatabaseMeasurementsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, DatabaseName: opts.databaseName, ProcessId: opts.processId, - M: opts.m, Granularity: opts.granularity, + M: opts.m, Period: opts.period, Start: opts.start, End: opts.end, @@ -206,7 +204,7 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -214,19 +212,18 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database that the specified MongoDB process serves.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database that the specified MongoDB process serves.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") - _ = cmd.MarkFlagRequired("granularity") return cmd } @@ -237,14 +234,14 @@ type GetDiskMeasurementsOpts struct { groupId string partitionName string processId string - m []string granularity string + m []string period string start time.Time end time.Time } -func (opts *GetDiskMeasurementsOpts) initClient(ctx context.Context) func() error { +func (opts *GetDiskMeasurementsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -257,8 +254,8 @@ func (opts *GetDiskMeasurementsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, PartitionName: opts.partitionName, ProcessId: opts.processId, - M: opts.m, Granularity: opts.granularity, + M: opts.m, Period: opts.period, Start: opts.start, End: opts.end, @@ -287,7 +284,7 @@ func GetDiskMeasurementsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -295,19 +292,18 @@ func GetDiskMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "Human-readable label of the disk or partition to which the measurements apply.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("processId") - _ = cmd.MarkFlagRequired("granularity") return cmd } @@ -322,7 +318,7 @@ type GetHostLogsOpts struct { startDate int64 } -func (opts *GetHostLogsOpts) initClient(ctx context.Context) func() error { +func (opts *GetHostLogsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -362,7 +358,7 @@ func GetHostLogsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -370,16 +366,15 @@ func GetHostLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.hostName, "hostName", , "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") - cmd.Flags().StringVar(&opts.logName, "logName", , "Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.") - cmd.Flags().Int64Var(&opts.endDate, "endDate", , "Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") - cmd.Flags().Int64Var(&opts.startDate, "startDate", , "Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.hostName, "hostName", "", "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") + cmd.Flags().StringVar(&opts.logName, "logName", "", "Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.") + cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, "Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, "Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostName") _ = cmd.MarkFlagRequired("logName") - return cmd } type GetHostMeasurementsOpts struct { @@ -388,14 +383,14 @@ type GetHostMeasurementsOpts struct { client *admin.APIClient groupId string processId string + granularity string m []string period string - granularity string start time.Time end time.Time } -func (opts *GetHostMeasurementsOpts) initClient(ctx context.Context) func() error { +func (opts *GetHostMeasurementsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -407,9 +402,9 @@ func (opts *GetHostMeasurementsOpts) Run(ctx context.Context) error { params := &admin.GetHostMeasurementsApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, + Granularity: opts.granularity, M: opts.m, Period: opts.period, - Granularity: opts.granularity, Start: opts.start, End: opts.end, } @@ -437,7 +432,7 @@ func GetHostMeasurementsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -445,17 +440,16 @@ func GetHostMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") - cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - _ = cmd.MarkFlagRequired("granularity") return cmd } @@ -469,13 +463,13 @@ type GetIndexMetricsOpts struct { collectionName string groupId string granularity string + metrics []string period string start time.Time end time.Time - metrics []string } -func (opts *GetIndexMetricsOpts) initClient(ctx context.Context) func() error { +func (opts *GetIndexMetricsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -491,10 +485,10 @@ func (opts *GetIndexMetricsOpts) Run(ctx context.Context) error { CollectionName: opts.collectionName, GroupId: opts.groupId, Granularity: opts.granularity, + Metrics: opts.metrics, Period: opts.period, Start: opts.start, End: opts.end, - Metrics: opts.metrics, } resp, _, err := opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params).Execute() if err != nil { @@ -520,7 +514,7 @@ func GetIndexMetricsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -528,23 +522,22 @@ func GetIndexMetricsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.indexName, "indexName", , "Human-readable label that identifies the index.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database.") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Human-readable label that identifies the collection.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.indexName, "indexName", "", "Human-readable label that identifies the index.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database.") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "Human-readable label that identifies the collection.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("indexName") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") return cmd @@ -556,13 +549,13 @@ type GetMeasurementsOpts struct { processId string groupId string granularity string + metrics []string period string start time.Time end time.Time - metrics []string } -func (opts *GetMeasurementsOpts) initClient(ctx context.Context) func() error { +func (opts *GetMeasurementsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -575,10 +568,10 @@ func (opts *GetMeasurementsOpts) Run(ctx context.Context) error { ProcessId: opts.processId, GroupId: opts.groupId, Granularity: opts.granularity, + Metrics: opts.metrics, Period: opts.period, Start: opts.start, End: opts.end, - Metrics: opts.metrics, } resp, _, err := opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -604,7 +597,7 @@ func GetMeasurementsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -612,17 +605,16 @@ func GetMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") + cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") return cmd @@ -637,7 +629,7 @@ type ListAtlasProcessesOpts struct { pageNum int } -func (opts *ListAtlasProcessesOpts) initClient(ctx context.Context) func() error { +func (opts *ListAtlasProcessesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -676,7 +668,7 @@ func ListAtlasProcessesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -684,13 +676,12 @@ func ListAtlasProcessesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListDatabasesOpts struct { @@ -704,7 +695,7 @@ type ListDatabasesOpts struct { pageNum int } -func (opts *ListDatabasesOpts) initClient(ctx context.Context) func() error { +func (opts *ListDatabasesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -744,7 +735,7 @@ func ListDatabasesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -752,15 +743,14 @@ func ListDatabasesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - return cmd } type ListDiskMeasurementsOpts struct { @@ -772,7 +762,7 @@ type ListDiskMeasurementsOpts struct { processId string } -func (opts *ListDiskMeasurementsOpts) initClient(ctx context.Context) func() error { +func (opts *ListDiskMeasurementsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -810,7 +800,7 @@ func ListDiskMeasurementsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -818,14 +808,13 @@ func ListDiskMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.partitionName, "partitionName", , "Human-readable label of the disk or partition to which the measurements apply.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "Human-readable label of the disk or partition to which the measurements apply.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - return cmd } type ListDiskPartitionsOpts struct { @@ -839,7 +828,7 @@ type ListDiskPartitionsOpts struct { pageNum int } -func (opts *ListDiskPartitionsOpts) initClient(ctx context.Context) func() error { +func (opts *ListDiskPartitionsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -879,7 +868,7 @@ func ListDiskPartitionsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -887,15 +876,14 @@ func ListDiskPartitionsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - return cmd } type ListIndexMetricsOpts struct { @@ -907,13 +895,13 @@ type ListIndexMetricsOpts struct { collectionName string groupId string granularity string + metrics []string period string start time.Time end time.Time - metrics []string } -func (opts *ListIndexMetricsOpts) initClient(ctx context.Context) func() error { +func (opts *ListIndexMetricsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -928,10 +916,10 @@ func (opts *ListIndexMetricsOpts) Run(ctx context.Context) error { CollectionName: opts.collectionName, GroupId: opts.groupId, Granularity: opts.granularity, + Metrics: opts.metrics, Period: opts.period, Start: opts.start, End: opts.end, - Metrics: opts.metrics, } resp, _, err := opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params).Execute() if err != nil { @@ -957,7 +945,7 @@ func ListIndexMetricsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -965,21 +953,20 @@ func ListIndexMetricsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", , "Human-readable label that identifies the database.") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", , "Human-readable label that identifies the collection.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", , "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringVar(&opts.period, "period", , "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database.") + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "Human-readable label that identifies the collection.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") + cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") return cmd @@ -992,7 +979,7 @@ type ListMetricTypesOpts struct { groupId string } -func (opts *ListMetricTypesOpts) initClient(ctx context.Context) func() error { +func (opts *ListMetricTypesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1029,7 +1016,7 @@ func ListMetricTypesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1037,12 +1024,11 @@ func ListMetricTypesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -1069,3 +1055,4 @@ func MonitoringAndLogsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 24fd2e6f2f..37128dd1fe 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -28,9 +28,10 @@ type CreateClusterOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateClusterOpts) initClient(ctx context.Context) func() error { +func (opts *CreateClusterOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreateClusterOpts) initClient(ctx context.Context) func() error { func (opts *CreateClusterOpts) Run(ctx context.Context) error { params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.MultiCloudClustersApi.CreateClusterWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreateClusterBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreateClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteClusterOpts struct { @@ -89,7 +91,7 @@ type DeleteClusterOpts struct { retainBackups bool } -func (opts *DeleteClusterOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteClusterOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -127,7 +129,7 @@ func DeleteClusterBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -135,13 +137,12 @@ func DeleteClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", , "Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, "Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type GetClusterOpts struct { @@ -152,7 +153,7 @@ type GetClusterOpts struct { clusterName string } -func (opts *GetClusterOpts) initClient(ctx context.Context) func() error { +func (opts *GetClusterOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -189,7 +190,7 @@ func GetClusterBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -197,12 +198,11 @@ func GetClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListClustersOpts struct { @@ -215,7 +215,7 @@ type ListClustersOpts struct { pageNum int } -func (opts *ListClustersOpts) initClient(ctx context.Context) func() error { +func (opts *ListClustersOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -254,7 +254,7 @@ func ListClustersBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -262,13 +262,12 @@ func ListClustersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type TestFailoverOpts struct { @@ -279,7 +278,7 @@ type TestFailoverOpts struct { clusterName string } -func (opts *TestFailoverOpts) initClient(ctx context.Context) func() error { +func (opts *TestFailoverOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -316,7 +315,7 @@ func TestFailoverBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -324,12 +323,11 @@ func TestFailoverBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type UpdateClusterOpts struct { @@ -338,9 +336,10 @@ type UpdateClusterOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *UpdateClusterOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateClusterOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -352,6 +351,7 @@ func (opts *UpdateClusterOpts) Run(ctx context.Context) error { params := &admin.UpdateClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.MultiCloudClustersApi.UpdateClusterWithParams(ctx, params).Execute() if err != nil { @@ -377,7 +377,7 @@ func UpdateClusterBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -385,12 +385,12 @@ func UpdateClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the advanced cluster to modify.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the advanced cluster to modify.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } @@ -413,3 +413,4 @@ If your MongoDB Cloud project contains a custom role that uses actions introduce ) return cmd } + diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index bb6de14a2c..ab37bdb647 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -28,9 +28,10 @@ type CreatePeeringConnectionOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreatePeeringConnectionOpts) initClient(ctx context.Context) func() error { +func (opts *CreatePeeringConnectionOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreatePeeringConnectionOpts) initClient(ctx context.Context) func() func (opts *CreatePeeringConnectionOpts) Run(ctx context.Context) error { params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreatePeeringConnectionBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreatePeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type CreatePeeringContainerOpts struct { @@ -85,9 +87,10 @@ type CreatePeeringContainerOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreatePeeringContainerOpts) initClient(ctx context.Context) func() error { +func (opts *CreatePeeringContainerOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -98,6 +101,7 @@ func (opts *CreatePeeringContainerOpts) initClient(ctx context.Context) func() e func (opts *CreatePeeringContainerOpts) Run(ctx context.Context) error { params := &admin.CreatePeeringContainerApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params).Execute() if err != nil { @@ -123,7 +127,7 @@ func CreatePeeringContainerBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -131,10 +135,10 @@ func CreatePeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeletePeeringConnectionOpts struct { @@ -145,7 +149,7 @@ type DeletePeeringConnectionOpts struct { peerId string } -func (opts *DeletePeeringConnectionOpts) initClient(ctx context.Context) func() error { +func (opts *DeletePeeringConnectionOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -182,7 +186,7 @@ func DeletePeeringConnectionBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -190,12 +194,11 @@ func DeletePeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.peerId, "peerId", "", "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") - return cmd } type DeletePeeringContainerOpts struct { @@ -206,7 +209,7 @@ type DeletePeeringContainerOpts struct { containerId string } -func (opts *DeletePeeringContainerOpts) initClient(ctx context.Context) func() error { +func (opts *DeletePeeringContainerOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -243,7 +246,7 @@ func DeletePeeringContainerBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -251,12 +254,11 @@ func DeletePeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.containerId, "containerId", "", "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") - return cmd } type DisablePeeringOpts struct { @@ -264,9 +266,10 @@ type DisablePeeringOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *DisablePeeringOpts) initClient(ctx context.Context) func() error { +func (opts *DisablePeeringOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -277,6 +280,7 @@ func (opts *DisablePeeringOpts) initClient(ctx context.Context) func() error { func (opts *DisablePeeringOpts) Run(ctx context.Context) error { params := &admin.DisablePeeringApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params).Execute() if err != nil { @@ -302,7 +306,7 @@ func DisablePeeringBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -310,10 +314,10 @@ func DisablePeeringBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetPeeringConnectionOpts struct { @@ -324,7 +328,7 @@ type GetPeeringConnectionOpts struct { peerId string } -func (opts *GetPeeringConnectionOpts) initClient(ctx context.Context) func() error { +func (opts *GetPeeringConnectionOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -361,7 +365,7 @@ func GetPeeringConnectionBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -369,12 +373,11 @@ func GetPeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.peerId, "peerId", "", "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") - return cmd } type GetPeeringContainerOpts struct { @@ -385,7 +388,7 @@ type GetPeeringContainerOpts struct { containerId string } -func (opts *GetPeeringContainerOpts) initClient(ctx context.Context) func() error { +func (opts *GetPeeringContainerOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -422,7 +425,7 @@ func GetPeeringContainerBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -430,12 +433,11 @@ func GetPeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.containerId, "containerId", "", "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") - return cmd } type ListPeeringConnectionsOpts struct { @@ -449,7 +451,7 @@ type ListPeeringConnectionsOpts struct { providerName string } -func (opts *ListPeeringConnectionsOpts) initClient(ctx context.Context) func() error { +func (opts *ListPeeringConnectionsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -489,7 +491,7 @@ func ListPeeringConnectionsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -497,14 +499,13 @@ func ListPeeringConnectionsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider to use for this VPC peering connection.") + cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", "Cloud service provider to use for this VPC peering connection.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListPeeringContainerByCloudProviderOpts struct { @@ -512,13 +513,13 @@ type ListPeeringContainerByCloudProviderOpts struct { cli.OutputOpts client *admin.APIClient groupId string + providerName string includeCount bool itemsPerPage int pageNum int - providerName string } -func (opts *ListPeeringContainerByCloudProviderOpts) initClient(ctx context.Context) func() error { +func (opts *ListPeeringContainerByCloudProviderOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -529,10 +530,10 @@ func (opts *ListPeeringContainerByCloudProviderOpts) initClient(ctx context.Cont func (opts *ListPeeringContainerByCloudProviderOpts) Run(ctx context.Context) error { params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, + ProviderName: opts.providerName, IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, - ProviderName: opts.providerName, } resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params).Execute() if err != nil { @@ -558,7 +559,7 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -566,14 +567,13 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", "Cloud service provider that serves the desired network peering containers.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.providerName, "providerName", "AWS", "Cloud service provider that serves the desired network peering containers.") _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("providerName") return cmd } @@ -587,7 +587,7 @@ type ListPeeringContainersOpts struct { pageNum int } -func (opts *ListPeeringContainersOpts) initClient(ctx context.Context) func() error { +func (opts *ListPeeringContainersOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -626,7 +626,7 @@ func ListPeeringContainersBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -634,13 +634,12 @@ func ListPeeringContainersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdatePeeringConnectionOpts struct { @@ -649,9 +648,10 @@ type UpdatePeeringConnectionOpts struct { client *admin.APIClient groupId string peerId string + } -func (opts *UpdatePeeringConnectionOpts) initClient(ctx context.Context) func() error { +func (opts *UpdatePeeringConnectionOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -663,6 +663,7 @@ func (opts *UpdatePeeringConnectionOpts) Run(ctx context.Context) error { params := &admin.UpdatePeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, + } resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { @@ -688,7 +689,7 @@ func UpdatePeeringConnectionBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -696,12 +697,12 @@ func UpdatePeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.peerId, "peerId", , "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.peerId, "peerId", "", "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") - return cmd } type UpdatePeeringContainerOpts struct { @@ -710,9 +711,10 @@ type UpdatePeeringContainerOpts struct { client *admin.APIClient groupId string containerId string + } -func (opts *UpdatePeeringContainerOpts) initClient(ctx context.Context) func() error { +func (opts *UpdatePeeringContainerOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -724,6 +726,7 @@ func (opts *UpdatePeeringContainerOpts) Run(ctx context.Context) error { params := &admin.UpdatePeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, + } resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params).Execute() if err != nil { @@ -749,7 +752,7 @@ func UpdatePeeringContainerBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -757,12 +760,12 @@ func UpdatePeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.containerId, "containerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.containerId, "containerId", "", "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") - return cmd } type VerifyConnectViaPeeringOnlyModeForOneProjectOpts struct { @@ -772,7 +775,7 @@ type VerifyConnectViaPeeringOnlyModeForOneProjectOpts struct { groupId string } -func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) initClient(ctx context.Context) func() error { +func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -808,7 +811,7 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -816,10 +819,9 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -846,3 +848,4 @@ When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected ) return cmd } + diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index eb0a51f115..0042f1e288 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -29,9 +29,10 @@ type CreateOnlineArchiveOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateOnlineArchiveOpts) initClient(ctx context.Context) func() error { +func (opts *CreateOnlineArchiveOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.CreateOnlineArchiveApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateOnlineArchiveBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type DeleteOnlineArchiveOpts struct { @@ -93,7 +95,7 @@ type DeleteOnlineArchiveOpts struct { clusterName string } -func (opts *DeleteOnlineArchiveOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteOnlineArchiveOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -131,7 +133,7 @@ func DeleteOnlineArchiveBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -139,14 +141,13 @@ func DeleteOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to delete.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "Unique 24-hexadecimal digit string that identifies the online archive to delete.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type DownloadOnlineArchiveQueryLogsOpts struct { @@ -160,7 +161,7 @@ type DownloadOnlineArchiveQueryLogsOpts struct { archiveOnly bool } -func (opts *DownloadOnlineArchiveQueryLogsOpts) initClient(ctx context.Context) func() error { +func (opts *DownloadOnlineArchiveQueryLogsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -200,7 +201,7 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -208,15 +209,14 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.") - cmd.Flags().Int64Var(&opts.startDate, "startDate", , "Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") - cmd.Flags().Int64Var(&opts.endDate, "endDate", , "Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.") + cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, "Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") + cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, "Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, "Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type GetOnlineArchiveOpts struct { @@ -228,7 +228,7 @@ type GetOnlineArchiveOpts struct { clusterName string } -func (opts *GetOnlineArchiveOpts) initClient(ctx context.Context) func() error { +func (opts *GetOnlineArchiveOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -266,7 +266,7 @@ func GetOnlineArchiveBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -274,14 +274,13 @@ func GetOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to return.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "Unique 24-hexadecimal digit string that identifies the online archive to return.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type ListOnlineArchivesOpts struct { @@ -295,7 +294,7 @@ type ListOnlineArchivesOpts struct { pageNum int } -func (opts *ListOnlineArchivesOpts) initClient(ctx context.Context) func() error { +func (opts *ListOnlineArchivesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -335,7 +334,7 @@ func ListOnlineArchivesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -343,15 +342,14 @@ func ListOnlineArchivesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } type UpdateOnlineArchiveOpts struct { @@ -361,9 +359,10 @@ type UpdateOnlineArchiveOpts struct { groupId string archiveId string clusterName string + } -func (opts *UpdateOnlineArchiveOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateOnlineArchiveOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -376,6 +375,7 @@ func (opts *UpdateOnlineArchiveOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ArchiveId: opts.archiveId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { @@ -401,7 +401,7 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -409,14 +409,14 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", , "Unique 24-hexadecimal digit string that identifies the online archive to update.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "Unique 24-hexadecimal digit string that identifies the online archive to update.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } @@ -435,3 +435,4 @@ func OnlineArchiveBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 5ba539666e..390dca0189 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -27,9 +27,10 @@ type CreateOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient + } -func (opts *CreateOrganizationOpts) initClient(ctx context.Context) func() error { +func (opts *CreateOrganizationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -39,6 +40,7 @@ func (opts *CreateOrganizationOpts) initClient(ctx context.Context) func() error func (opts *CreateOrganizationOpts) Run(ctx context.Context) error { params := &admin.CreateOrganizationApiParams{ + } resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params).Execute() if err != nil { @@ -64,7 +66,7 @@ func CreateOrganizationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -72,7 +74,7 @@ func CreateOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - + return cmd } @@ -81,9 +83,10 @@ type CreateOrganizationInvitationOpts struct { cli.OutputOpts client *admin.APIClient orgId string + } -func (opts *CreateOrganizationInvitationOpts) initClient(ctx context.Context) func() error { +func (opts *CreateOrganizationInvitationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -94,6 +97,7 @@ func (opts *CreateOrganizationInvitationOpts) initClient(ctx context.Context) fu func (opts *CreateOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { @@ -119,7 +123,7 @@ func CreateOrganizationInvitationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -127,10 +131,10 @@ func CreateOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("orgId") - return cmd } type DeleteOrganizationOpts struct { @@ -140,7 +144,7 @@ type DeleteOrganizationOpts struct { orgId string } -func (opts *DeleteOrganizationOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteOrganizationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -176,7 +180,7 @@ func DeleteOrganizationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -184,10 +188,9 @@ func DeleteOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type DeleteOrganizationInvitationOpts struct { @@ -198,7 +201,7 @@ type DeleteOrganizationInvitationOpts struct { invitationId string } -func (opts *DeleteOrganizationInvitationOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteOrganizationInvitationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -235,7 +238,7 @@ func DeleteOrganizationInvitationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -243,12 +246,11 @@ func DeleteOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") - return cmd } type GetOrganizationOpts struct { @@ -258,7 +260,7 @@ type GetOrganizationOpts struct { orgId string } -func (opts *GetOrganizationOpts) initClient(ctx context.Context) func() error { +func (opts *GetOrganizationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -294,7 +296,7 @@ func GetOrganizationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -302,10 +304,9 @@ func GetOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type GetOrganizationInvitationOpts struct { @@ -316,7 +317,7 @@ type GetOrganizationInvitationOpts struct { invitationId string } -func (opts *GetOrganizationInvitationOpts) initClient(ctx context.Context) func() error { +func (opts *GetOrganizationInvitationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -353,7 +354,7 @@ func GetOrganizationInvitationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -361,12 +362,11 @@ func GetOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") - return cmd } type GetOrganizationSettingsOpts struct { @@ -376,7 +376,7 @@ type GetOrganizationSettingsOpts struct { orgId string } -func (opts *GetOrganizationSettingsOpts) initClient(ctx context.Context) func() error { +func (opts *GetOrganizationSettingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -412,7 +412,7 @@ func GetOrganizationSettingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -420,10 +420,9 @@ func GetOrganizationSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListOrganizationInvitationsOpts struct { @@ -434,7 +433,7 @@ type ListOrganizationInvitationsOpts struct { username string } -func (opts *ListOrganizationInvitationsOpts) initClient(ctx context.Context) func() error { +func (opts *ListOrganizationInvitationsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -471,7 +470,7 @@ func ListOrganizationInvitationsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -479,11 +478,10 @@ func ListOrganizationInvitationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.username, "username", , "Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.username, "username", "", "Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListOrganizationProjectsOpts struct { @@ -497,7 +495,7 @@ type ListOrganizationProjectsOpts struct { name string } -func (opts *ListOrganizationProjectsOpts) initClient(ctx context.Context) func() error { +func (opts *ListOrganizationProjectsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -537,7 +535,7 @@ func ListOrganizationProjectsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -545,14 +543,13 @@ func ListOrganizationProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.") + cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListOrganizationUsersOpts struct { @@ -565,7 +562,7 @@ type ListOrganizationUsersOpts struct { pageNum int } -func (opts *ListOrganizationUsersOpts) initClient(ctx context.Context) func() error { +func (opts *ListOrganizationUsersOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -604,7 +601,7 @@ func ListOrganizationUsersBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -612,13 +609,12 @@ func ListOrganizationUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListOrganizationsOpts struct { @@ -631,7 +627,7 @@ type ListOrganizationsOpts struct { name string } -func (opts *ListOrganizationsOpts) initClient(ctx context.Context) func() error { +func (opts *ListOrganizationsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -670,7 +666,7 @@ func ListOrganizationsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -681,8 +677,7 @@ func ListOrganizationsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.") - + cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.") return cmd } @@ -691,9 +686,10 @@ type RenameOrganizationOpts struct { cli.OutputOpts client *admin.APIClient orgId string + } -func (opts *RenameOrganizationOpts) initClient(ctx context.Context) func() error { +func (opts *RenameOrganizationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -704,6 +700,7 @@ func (opts *RenameOrganizationOpts) initClient(ctx context.Context) func() error func (opts *RenameOrganizationOpts) Run(ctx context.Context) error { params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() if err != nil { @@ -729,7 +726,7 @@ func RenameOrganizationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -737,10 +734,10 @@ func RenameOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("orgId") - return cmd } type UpdateOrganizationInvitationOpts struct { @@ -748,9 +745,10 @@ type UpdateOrganizationInvitationOpts struct { cli.OutputOpts client *admin.APIClient orgId string + } -func (opts *UpdateOrganizationInvitationOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateOrganizationInvitationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -761,6 +759,7 @@ func (opts *UpdateOrganizationInvitationOpts) initClient(ctx context.Context) fu func (opts *UpdateOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { @@ -786,7 +785,7 @@ func UpdateOrganizationInvitationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -794,10 +793,10 @@ func UpdateOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("orgId") - return cmd } type UpdateOrganizationInvitationByIdOpts struct { @@ -806,9 +805,10 @@ type UpdateOrganizationInvitationByIdOpts struct { client *admin.APIClient orgId string invitationId string + } -func (opts *UpdateOrganizationInvitationByIdOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateOrganizationInvitationByIdOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -820,6 +820,7 @@ func (opts *UpdateOrganizationInvitationByIdOpts) Run(ctx context.Context) error params := &admin.UpdateOrganizationInvitationByIdApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, + } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params).Execute() if err != nil { @@ -845,7 +846,7 @@ func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -853,12 +854,12 @@ func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") - return cmd } type UpdateOrganizationSettingsOpts struct { @@ -866,9 +867,10 @@ type UpdateOrganizationSettingsOpts struct { cli.OutputOpts client *admin.APIClient orgId string + } -func (opts *UpdateOrganizationSettingsOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateOrganizationSettingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -879,6 +881,7 @@ func (opts *UpdateOrganizationSettingsOpts) initClient(ctx context.Context) func func (opts *UpdateOrganizationSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params).Execute() if err != nil { @@ -904,7 +907,7 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -912,10 +915,10 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("orgId") - return cmd } @@ -943,3 +946,4 @@ func OrganizationsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index 5889f517b6..c3284af567 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -30,7 +30,7 @@ type DisableSlowOperationThresholdingOpts struct { groupId string } -func (opts *DisableSlowOperationThresholdingOpts) initClient(ctx context.Context) func() error { +func (opts *DisableSlowOperationThresholdingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -66,7 +66,7 @@ func DisableSlowOperationThresholdingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +74,9 @@ func DisableSlowOperationThresholdingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type EnableSlowOperationThresholdingOpts struct { @@ -87,7 +86,7 @@ type EnableSlowOperationThresholdingOpts struct { groupId string } -func (opts *EnableSlowOperationThresholdingOpts) initClient(ctx context.Context) func() error { +func (opts *EnableSlowOperationThresholdingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -123,7 +122,7 @@ func EnableSlowOperationThresholdingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -131,10 +130,9 @@ func EnableSlowOperationThresholdingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListSlowQueriesOpts struct { @@ -149,7 +147,7 @@ type ListSlowQueriesOpts struct { since int64 } -func (opts *ListSlowQueriesOpts) initClient(ctx context.Context) func() error { +func (opts *ListSlowQueriesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -190,7 +188,7 @@ func ListSlowQueriesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -198,16 +196,15 @@ func ListSlowQueriesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().Int64Var(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().Int64Var(&opts.duration, "duration", 0, "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") cmd.Flags().[]stringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") cmd.Flags().Int64Var(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().Int64Var(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().Int64Var(&opts.since, "since", 0, "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - return cmd } type ListSlowQueryNamespacesOpts struct { @@ -220,7 +217,7 @@ type ListSlowQueryNamespacesOpts struct { since int64 } -func (opts *ListSlowQueryNamespacesOpts) initClient(ctx context.Context) func() error { +func (opts *ListSlowQueryNamespacesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -259,7 +256,7 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -267,14 +264,13 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().Int64Var(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().Int64Var(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().Int64Var(&opts.duration, "duration", 0, "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().Int64Var(&opts.since, "since", 0, "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - return cmd } type ListSuggestedIndexesOpts struct { @@ -293,7 +289,7 @@ type ListSuggestedIndexesOpts struct { since int64 } -func (opts *ListSuggestedIndexesOpts) initClient(ctx context.Context) func() error { +func (opts *ListSuggestedIndexesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -338,7 +334,7 @@ func ListSuggestedIndexesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -346,20 +342,19 @@ func ListSuggestedIndexesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", , "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().Int64Var(&opts.duration, "duration", , "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().Int64Var(&opts.duration, "duration", 0, "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") cmd.Flags().[]stringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") cmd.Flags().Int64Var(&opts.nExamples, "nExamples", 5, "Maximum number of example queries that benefit from the suggested index.") - cmd.Flags().Int64Var(&opts.nIndexes, "nIndexes", , "Number that indicates the maximum indexes to suggest.") - cmd.Flags().Int64Var(&opts.since, "since", , "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().Int64Var(&opts.nIndexes, "nIndexes", 0, "Number that indicates the maximum indexes to suggest.") + cmd.Flags().Int64Var(&opts.since, "since", 0, "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") - return cmd } @@ -377,3 +372,4 @@ func PerformanceAdvisorBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index 99ae9ba58d..f3dfc714ec 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -30,9 +30,10 @@ type CreatePrivateEndpointOpts struct { groupId string cloudProvider string endpointServiceId string + } -func (opts *CreatePrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *CreatePrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -45,6 +46,7 @@ func (opts *CreatePrivateEndpointOpts) Run(ctx context.Context) error { GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, + } resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -70,7 +72,7 @@ func CreatePrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -78,14 +80,14 @@ func CreatePrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") - return cmd } type CreatePrivateEndpointServiceOpts struct { @@ -93,9 +95,10 @@ type CreatePrivateEndpointServiceOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreatePrivateEndpointServiceOpts) initClient(ctx context.Context) func() error { +func (opts *CreatePrivateEndpointServiceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -106,6 +109,7 @@ func (opts *CreatePrivateEndpointServiceOpts) initClient(ctx context.Context) fu func (opts *CreatePrivateEndpointServiceOpts) Run(ctx context.Context) error { params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { @@ -131,7 +135,7 @@ func CreatePrivateEndpointServiceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -139,10 +143,10 @@ func CreatePrivateEndpointServiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeletePrivateEndpointOpts struct { @@ -155,7 +159,7 @@ type DeletePrivateEndpointOpts struct { endpointServiceId string } -func (opts *DeletePrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *DeletePrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -194,7 +198,7 @@ func DeletePrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -202,16 +206,15 @@ func DeletePrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") _ = cmd.MarkFlagRequired("endpointServiceId") - return cmd } type DeletePrivateEndpointServiceOpts struct { @@ -223,7 +226,7 @@ type DeletePrivateEndpointServiceOpts struct { endpointServiceId string } -func (opts *DeletePrivateEndpointServiceOpts) initClient(ctx context.Context) func() error { +func (opts *DeletePrivateEndpointServiceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -261,7 +264,7 @@ func DeletePrivateEndpointServiceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -269,14 +272,13 @@ func DeletePrivateEndpointServiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint service.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") - return cmd } type GetPrivateEndpointOpts struct { @@ -289,7 +291,7 @@ type GetPrivateEndpointOpts struct { endpointServiceId string } -func (opts *GetPrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *GetPrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -328,7 +330,7 @@ func GetPrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -336,16 +338,15 @@ func GetPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") _ = cmd.MarkFlagRequired("endpointServiceId") - return cmd } type GetPrivateEndpointServiceOpts struct { @@ -357,7 +358,7 @@ type GetPrivateEndpointServiceOpts struct { endpointServiceId string } -func (opts *GetPrivateEndpointServiceOpts) initClient(ctx context.Context) func() error { +func (opts *GetPrivateEndpointServiceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -395,7 +396,7 @@ func GetPrivateEndpointServiceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -403,14 +404,13 @@ func GetPrivateEndpointServiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", , "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint service.") + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") - return cmd } type GetRegionalizedPrivateEndpointSettingOpts struct { @@ -420,7 +420,7 @@ type GetRegionalizedPrivateEndpointSettingOpts struct { groupId string } -func (opts *GetRegionalizedPrivateEndpointSettingOpts) initClient(ctx context.Context) func() error { +func (opts *GetRegionalizedPrivateEndpointSettingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -456,7 +456,7 @@ func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -464,10 +464,9 @@ func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListPrivateEndpointServicesOpts struct { @@ -478,7 +477,7 @@ type ListPrivateEndpointServicesOpts struct { cloudProvider string } -func (opts *ListPrivateEndpointServicesOpts) initClient(ctx context.Context) func() error { +func (opts *ListPrivateEndpointServicesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -515,7 +514,7 @@ func ListPrivateEndpointServicesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -523,12 +522,11 @@ func ListPrivateEndpointServicesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "AWS", "Cloud service provider that manages this private endpoint service.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint service.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") - return cmd } type ToggleRegionalizedPrivateEndpointSettingOpts struct { @@ -536,9 +534,10 @@ type ToggleRegionalizedPrivateEndpointSettingOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) initClient(ctx context.Context) func() error { +func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -549,6 +548,7 @@ func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) initClient(ctx context func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { params := &admin.ToggleRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() if err != nil { @@ -574,7 +574,7 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -582,10 +582,10 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -607,3 +607,4 @@ func PrivateEndpointServicesBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 38c8742f3e..fdb9c0ac3f 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -29,9 +29,10 @@ type AddProjectApiKeyOpts struct { client *admin.APIClient groupId string apiUserId string + } -func (opts *AddProjectApiKeyOpts) initClient(ctx context.Context) func() error { +func (opts *AddProjectApiKeyOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *AddProjectApiKeyOpts) Run(ctx context.Context) error { params := &admin.AddProjectApiKeyApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, + } resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func AddProjectApiKeyBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func AddProjectApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } type CreateApiKeyOpts struct { @@ -89,9 +91,10 @@ type CreateApiKeyOpts struct { cli.OutputOpts client *admin.APIClient orgId string + } -func (opts *CreateApiKeyOpts) initClient(ctx context.Context) func() error { +func (opts *CreateApiKeyOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -102,6 +105,7 @@ func (opts *CreateApiKeyOpts) initClient(ctx context.Context) func() error { func (opts *CreateApiKeyOpts) Run(ctx context.Context) error { params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -127,7 +131,7 @@ func CreateApiKeyBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -135,10 +139,10 @@ func CreateApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("orgId") - return cmd } type CreateApiKeyAccessListOpts struct { @@ -147,12 +151,13 @@ type CreateApiKeyAccessListOpts struct { client *admin.APIClient orgId string apiUserId string + includeCount bool itemsPerPage int pageNum int } -func (opts *CreateApiKeyAccessListOpts) initClient(ctx context.Context) func() error { +func (opts *CreateApiKeyAccessListOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -164,6 +169,7 @@ func (opts *CreateApiKeyAccessListOpts) Run(ctx context.Context) error { params := &admin.CreateApiKeyAccessListApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, + IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, @@ -192,7 +198,7 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -200,15 +206,15 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } type CreateProjectApiKeyOpts struct { @@ -216,9 +222,10 @@ type CreateProjectApiKeyOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateProjectApiKeyOpts) initClient(ctx context.Context) func() error { +func (opts *CreateProjectApiKeyOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -229,6 +236,7 @@ func (opts *CreateProjectApiKeyOpts) initClient(ctx context.Context) func() erro func (opts *CreateProjectApiKeyOpts) Run(ctx context.Context) error { params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -254,7 +262,7 @@ func CreateProjectApiKeyBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -262,10 +270,10 @@ func CreateProjectApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteApiKeyOpts struct { @@ -276,7 +284,7 @@ type DeleteApiKeyOpts struct { apiUserId string } -func (opts *DeleteApiKeyOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteApiKeyOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -313,7 +321,7 @@ func DeleteApiKeyBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -321,12 +329,11 @@ func DeleteApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } type DeleteApiKeyAccessListEntryOpts struct { @@ -338,7 +345,7 @@ type DeleteApiKeyAccessListEntryOpts struct { ipAddress string } -func (opts *DeleteApiKeyAccessListEntryOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteApiKeyAccessListEntryOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -376,7 +383,7 @@ func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -384,14 +391,13 @@ func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") _ = cmd.MarkFlagRequired("ipAddress") - return cmd } type GetApiKeyOpts struct { @@ -402,7 +408,7 @@ type GetApiKeyOpts struct { apiUserId string } -func (opts *GetApiKeyOpts) initClient(ctx context.Context) func() error { +func (opts *GetApiKeyOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -439,7 +445,7 @@ func GetApiKeyBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -447,12 +453,11 @@ func GetApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } type GetApiKeyAccessListOpts struct { @@ -464,7 +469,7 @@ type GetApiKeyAccessListOpts struct { apiUserId string } -func (opts *GetApiKeyAccessListOpts) initClient(ctx context.Context) func() error { +func (opts *GetApiKeyAccessListOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -502,7 +507,7 @@ func GetApiKeyAccessListBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -510,14 +515,13 @@ func GetApiKeyAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", , "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("ipAddress") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } type ListApiKeyAccessListsEntriesOpts struct { @@ -531,7 +535,7 @@ type ListApiKeyAccessListsEntriesOpts struct { pageNum int } -func (opts *ListApiKeyAccessListsEntriesOpts) initClient(ctx context.Context) func() error { +func (opts *ListApiKeyAccessListsEntriesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -571,7 +575,7 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -579,15 +583,14 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } type ListApiKeysOpts struct { @@ -600,7 +603,7 @@ type ListApiKeysOpts struct { pageNum int } -func (opts *ListApiKeysOpts) initClient(ctx context.Context) func() error { +func (opts *ListApiKeysOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -639,7 +642,7 @@ func ListApiKeysBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -647,13 +650,12 @@ func ListApiKeysBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListProjectApiKeysOpts struct { @@ -666,7 +668,7 @@ type ListProjectApiKeysOpts struct { pageNum int } -func (opts *ListProjectApiKeysOpts) initClient(ctx context.Context) func() error { +func (opts *ListProjectApiKeysOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -705,7 +707,7 @@ func ListProjectApiKeysBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -713,13 +715,12 @@ func ListProjectApiKeysBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type RemoveProjectApiKeyOpts struct { @@ -730,7 +731,7 @@ type RemoveProjectApiKeyOpts struct { apiUserId string } -func (opts *RemoveProjectApiKeyOpts) initClient(ctx context.Context) func() error { +func (opts *RemoveProjectApiKeyOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -767,7 +768,7 @@ func RemoveProjectApiKeyBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -775,12 +776,11 @@ func RemoveProjectApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } type UpdateApiKeyOpts struct { @@ -789,9 +789,10 @@ type UpdateApiKeyOpts struct { client *admin.APIClient orgId string apiUserId string + } -func (opts *UpdateApiKeyOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateApiKeyOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -803,6 +804,7 @@ func (opts *UpdateApiKeyOpts) Run(ctx context.Context) error { params := &admin.UpdateApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, + } resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -828,7 +830,7 @@ func UpdateApiKeyBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -836,12 +838,12 @@ func UpdateApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key you want to update.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key you want to update.") + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } type UpdateApiKeyRolesOpts struct { @@ -850,12 +852,13 @@ type UpdateApiKeyRolesOpts struct { client *admin.APIClient groupId string apiUserId string + pageNum int itemsPerPage int includeCount bool } -func (opts *UpdateApiKeyRolesOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateApiKeyRolesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -867,6 +870,7 @@ func (opts *UpdateApiKeyRolesOpts) Run(ctx context.Context) error { params := &admin.UpdateApiKeyRolesApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, + PageNum: opts.pageNum, ItemsPerPage: opts.itemsPerPage, IncludeCount: opts.includeCount, @@ -895,7 +899,7 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -903,15 +907,15 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", , "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") - return cmd } @@ -938,3 +942,4 @@ func ProgrammaticAPIKeysBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 40ab07fde2..f088087125 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -28,12 +28,13 @@ type CreateProjectIpAccessListOpts struct { cli.OutputOpts client *admin.APIClient groupId string + includeCount bool itemsPerPage int pageNum int } -func (opts *CreateProjectIpAccessListOpts) initClient(ctx context.Context) func() error { +func (opts *CreateProjectIpAccessListOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -44,6 +45,7 @@ func (opts *CreateProjectIpAccessListOpts) initClient(ctx context.Context) func( func (opts *CreateProjectIpAccessListOpts) Run(ctx context.Context) error { params := &admin.CreateProjectIpAccessListApiParams{ GroupId: opts.groupId, + IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, @@ -72,7 +74,7 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -80,13 +82,13 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteProjectIpAccessListOpts struct { @@ -97,7 +99,7 @@ type DeleteProjectIpAccessListOpts struct { entryValue string } -func (opts *DeleteProjectIpAccessListOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteProjectIpAccessListOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -134,7 +136,7 @@ func DeleteProjectIpAccessListBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -142,12 +144,11 @@ func DeleteProjectIpAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: - how your application established the connection, - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: - how your application established the connection, - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") - return cmd } type GetProjectIpAccessListStatusOpts struct { @@ -158,7 +159,7 @@ type GetProjectIpAccessListStatusOpts struct { entryValue string } -func (opts *GetProjectIpAccessListStatusOpts) initClient(ctx context.Context) func() error { +func (opts *GetProjectIpAccessListStatusOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -195,7 +196,7 @@ func GetProjectIpAccessListStatusBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -203,12 +204,11 @@ func GetProjectIpAccessListStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Network address or cloud provider security construct that identifies which project access list entry to be verified.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "Network address or cloud provider security construct that identifies which project access list entry to be verified.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") - return cmd } type GetProjectIpListOpts struct { @@ -219,7 +219,7 @@ type GetProjectIpListOpts struct { entryValue string } -func (opts *GetProjectIpListOpts) initClient(ctx context.Context) func() error { +func (opts *GetProjectIpListOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -256,7 +256,7 @@ func GetProjectIpListBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -264,12 +264,11 @@ func GetProjectIpListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", , "Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") - return cmd } type ListProjectIpAccessListsOpts struct { @@ -282,7 +281,7 @@ type ListProjectIpAccessListsOpts struct { pageNum int } -func (opts *ListProjectIpAccessListsOpts) initClient(ctx context.Context) func() error { +func (opts *ListProjectIpAccessListsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -321,7 +320,7 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -329,13 +328,12 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -353,3 +351,4 @@ func ProjectIPAccessListBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 940a94f313..17887de11c 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -27,10 +27,11 @@ type CreateProjectOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient + projectOwnerId string } -func (opts *CreateProjectOpts) initClient(ctx context.Context) func() error { +func (opts *CreateProjectOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -40,6 +41,7 @@ func (opts *CreateProjectOpts) initClient(ctx context.Context) func() error { func (opts *CreateProjectOpts) Run(ctx context.Context) error { params := &admin.CreateProjectApiParams{ + ProjectOwnerId: opts.projectOwnerId, } resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params).Execute() @@ -66,7 +68,7 @@ func CreateProjectBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,8 +76,8 @@ func CreateProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", , "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. ") - + + cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. ") return cmd } @@ -84,9 +86,10 @@ type CreateProjectInvitationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateProjectInvitationOpts) initClient(ctx context.Context) func() error { +func (opts *CreateProjectInvitationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -97,6 +100,7 @@ func (opts *CreateProjectInvitationOpts) initClient(ctx context.Context) func() func (opts *CreateProjectInvitationOpts) Run(ctx context.Context) error { params := &admin.CreateProjectInvitationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params).Execute() if err != nil { @@ -122,7 +126,7 @@ func CreateProjectInvitationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -130,10 +134,10 @@ func CreateProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteProjectOpts struct { @@ -143,7 +147,7 @@ type DeleteProjectOpts struct { groupId string } -func (opts *DeleteProjectOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteProjectOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -179,7 +183,7 @@ func DeleteProjectBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -187,10 +191,9 @@ func DeleteProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteProjectInvitationOpts struct { @@ -201,7 +204,7 @@ type DeleteProjectInvitationOpts struct { invitationId string } -func (opts *DeleteProjectInvitationOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteProjectInvitationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -238,7 +241,7 @@ func DeleteProjectInvitationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -246,12 +249,11 @@ func DeleteProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") - return cmd } type DeleteProjectLimitOpts struct { @@ -262,7 +264,7 @@ type DeleteProjectLimitOpts struct { groupId string } -func (opts *DeleteProjectLimitOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteProjectLimitOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -299,7 +301,7 @@ func DeleteProjectLimitBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -307,12 +309,11 @@ func DeleteProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetProjectOpts struct { @@ -322,7 +323,7 @@ type GetProjectOpts struct { groupId string } -func (opts *GetProjectOpts) initClient(ctx context.Context) func() error { +func (opts *GetProjectOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -358,7 +359,7 @@ func GetProjectBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -366,10 +367,9 @@ func GetProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetProjectByNameOpts struct { @@ -379,7 +379,7 @@ type GetProjectByNameOpts struct { groupName string } -func (opts *GetProjectByNameOpts) initClient(ctx context.Context) func() error { +func (opts *GetProjectByNameOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -415,7 +415,7 @@ func GetProjectByNameBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -423,10 +423,9 @@ func GetProjectByNameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupName, "groupName", , "Human-readable label that identifies this project.") + cmd.Flags().StringVar(&opts.groupName, "groupName", "", "Human-readable label that identifies this project.") _ = cmd.MarkFlagRequired("groupName") - return cmd } type GetProjectInvitationOpts struct { @@ -437,7 +436,7 @@ type GetProjectInvitationOpts struct { invitationId string } -func (opts *GetProjectInvitationOpts) initClient(ctx context.Context) func() error { +func (opts *GetProjectInvitationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -474,7 +473,7 @@ func GetProjectInvitationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -482,12 +481,11 @@ func GetProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") - return cmd } type GetProjectLimitOpts struct { @@ -498,7 +496,7 @@ type GetProjectLimitOpts struct { groupId string } -func (opts *GetProjectLimitOpts) initClient(ctx context.Context) func() error { +func (opts *GetProjectLimitOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -535,7 +533,7 @@ func GetProjectLimitBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -543,12 +541,11 @@ func GetProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetProjectSettingsOpts struct { @@ -558,7 +555,7 @@ type GetProjectSettingsOpts struct { groupId string } -func (opts *GetProjectSettingsOpts) initClient(ctx context.Context) func() error { +func (opts *GetProjectSettingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -594,7 +591,7 @@ func GetProjectSettingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -602,10 +599,9 @@ func GetProjectSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListProjectInvitationsOpts struct { @@ -616,7 +612,7 @@ type ListProjectInvitationsOpts struct { username string } -func (opts *ListProjectInvitationsOpts) initClient(ctx context.Context) func() error { +func (opts *ListProjectInvitationsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -653,7 +649,7 @@ func ListProjectInvitationsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -661,11 +657,10 @@ func ListProjectInvitationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.username, "username", , "Email address of the user account invited to this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.username, "username", "", "Email address of the user account invited to this project.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListProjectLimitsOpts struct { @@ -675,7 +670,7 @@ type ListProjectLimitsOpts struct { groupId string } -func (opts *ListProjectLimitsOpts) initClient(ctx context.Context) func() error { +func (opts *ListProjectLimitsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -711,7 +706,7 @@ func ListProjectLimitsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -719,10 +714,9 @@ func ListProjectLimitsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListProjectUsersOpts struct { @@ -737,7 +731,7 @@ type ListProjectUsersOpts struct { includeOrgUsers bool } -func (opts *ListProjectUsersOpts) initClient(ctx context.Context) func() error { +func (opts *ListProjectUsersOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -778,7 +772,7 @@ func ListProjectUsersBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -786,7 +780,7 @@ func ListProjectUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") @@ -794,7 +788,6 @@ func ListProjectUsersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, "Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `\"includeOrgUsers\": false`, this resource returns only users with a role in the project. If `\"includeOrgUsers\": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListProjectsOpts struct { @@ -806,7 +799,7 @@ type ListProjectsOpts struct { pageNum int } -func (opts *ListProjectsOpts) initClient(ctx context.Context) func() error { +func (opts *ListProjectsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -844,7 +837,7 @@ func ListProjectsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -856,7 +849,6 @@ func ListProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - return cmd } type RemoveProjectUserOpts struct { @@ -867,7 +859,7 @@ type RemoveProjectUserOpts struct { userId string } -func (opts *RemoveProjectUserOpts) initClient(ctx context.Context) func() error { +func (opts *RemoveProjectUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -904,7 +896,7 @@ func RemoveProjectUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -912,12 +904,11 @@ func RemoveProjectUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.userId, "userId", "", "Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("userId") - return cmd } type SetProjectLimitOpts struct { @@ -926,9 +917,10 @@ type SetProjectLimitOpts struct { client *admin.APIClient limitName string groupId string + } -func (opts *SetProjectLimitOpts) initClient(ctx context.Context) func() error { +func (opts *SetProjectLimitOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -940,6 +932,7 @@ func (opts *SetProjectLimitOpts) Run(ctx context.Context) error { params := &admin.SetProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, + } resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params).Execute() if err != nil { @@ -965,7 +958,7 @@ func SetProjectLimitBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -973,12 +966,12 @@ func SetProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", , "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateProjectOpts struct { @@ -986,9 +979,10 @@ type UpdateProjectOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpdateProjectOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateProjectOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -999,6 +993,7 @@ func (opts *UpdateProjectOpts) initClient(ctx context.Context) func() error { func (opts *UpdateProjectOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params).Execute() if err != nil { @@ -1024,7 +1019,7 @@ func UpdateProjectBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1032,10 +1027,10 @@ func UpdateProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateProjectInvitationOpts struct { @@ -1043,9 +1038,10 @@ type UpdateProjectInvitationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpdateProjectInvitationOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateProjectInvitationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1056,6 +1052,7 @@ func (opts *UpdateProjectInvitationOpts) initClient(ctx context.Context) func() func (opts *UpdateProjectInvitationOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectInvitationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params).Execute() if err != nil { @@ -1081,7 +1078,7 @@ func UpdateProjectInvitationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1089,10 +1086,10 @@ func UpdateProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateProjectInvitationByIdOpts struct { @@ -1101,9 +1098,10 @@ type UpdateProjectInvitationByIdOpts struct { client *admin.APIClient groupId string invitationId string + } -func (opts *UpdateProjectInvitationByIdOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateProjectInvitationByIdOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1115,6 +1113,7 @@ func (opts *UpdateProjectInvitationByIdOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectInvitationByIdApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, + } resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params).Execute() if err != nil { @@ -1140,7 +1139,7 @@ func UpdateProjectInvitationByIdBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1148,12 +1147,12 @@ func UpdateProjectInvitationByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", , "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") - return cmd } type UpdateProjectSettingsOpts struct { @@ -1161,9 +1160,10 @@ type UpdateProjectSettingsOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *UpdateProjectSettingsOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateProjectSettingsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -1174,6 +1174,7 @@ func (opts *UpdateProjectSettingsOpts) initClient(ctx context.Context) func() er func (opts *UpdateProjectSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectSettingsApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params).Execute() if err != nil { @@ -1199,7 +1200,7 @@ func UpdateProjectSettingsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -1207,10 +1208,10 @@ func UpdateProjectSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -1243,3 +1244,4 @@ func ProjectsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index 5616fe06d0..68e685e9d0 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -29,9 +29,10 @@ type CreateRollingIndexOpts struct { client *admin.APIClient groupId string clusterName string + } -func (opts *CreateRollingIndexOpts) initClient(ctx context.Context) func() error { +func (opts *CreateRollingIndexOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateRollingIndexOpts) Run(ctx context.Context) error { params := &admin.CreateRollingIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + } _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateRollingIndexBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateRollingIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } @@ -95,3 +97,4 @@ func RollingIndexBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index b8ea9d8265..1db2781f0f 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -29,7 +29,7 @@ type GetSystemStatusOpts struct { client *admin.APIClient } -func (opts *GetSystemStatusOpts) initClient(ctx context.Context) func() error { +func (opts *GetSystemStatusOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -64,7 +64,7 @@ func GetSystemStatusBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -73,7 +73,6 @@ func GetSystemStatusBuilder() *cobra.Command { }, } - return cmd } @@ -87,3 +86,4 @@ func RootBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index 6353e2137a..9462312ea2 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -28,9 +28,10 @@ type CreateServerlessInstanceOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *CreateServerlessInstanceOpts) initClient(ctx context.Context) func() error { +func (opts *CreateServerlessInstanceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *CreateServerlessInstanceOpts) initClient(ctx context.Context) func() func (opts *CreateServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func CreateServerlessInstanceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func CreateServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteServerlessInstanceOpts struct { @@ -88,7 +90,7 @@ type DeleteServerlessInstanceOpts struct { name string } -func (opts *DeleteServerlessInstanceOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteServerlessInstanceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -125,7 +127,7 @@ func DeleteServerlessInstanceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -133,12 +135,11 @@ func DeleteServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label that identifies the serverless instance.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") - return cmd } type GetServerlessInstanceOpts struct { @@ -149,7 +150,7 @@ type GetServerlessInstanceOpts struct { name string } -func (opts *GetServerlessInstanceOpts) initClient(ctx context.Context) func() error { +func (opts *GetServerlessInstanceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -186,7 +187,7 @@ func GetServerlessInstanceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -194,12 +195,11 @@ func GetServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label that identifies the serverless instance.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") - return cmd } type ListServerlessInstancesOpts struct { @@ -212,7 +212,7 @@ type ListServerlessInstancesOpts struct { pageNum int } -func (opts *ListServerlessInstancesOpts) initClient(ctx context.Context) func() error { +func (opts *ListServerlessInstancesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -251,7 +251,7 @@ func ListServerlessInstancesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -259,13 +259,12 @@ func ListServerlessInstancesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateServerlessInstanceOpts struct { @@ -274,9 +273,10 @@ type UpdateServerlessInstanceOpts struct { client *admin.APIClient groupId string name string + } -func (opts *UpdateServerlessInstanceOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateServerlessInstanceOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -288,6 +288,7 @@ func (opts *UpdateServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.UpdateServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, + } resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -313,7 +314,7 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -321,12 +322,12 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.name, "name", , "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label that identifies the serverless instance.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") - return cmd } @@ -344,3 +345,4 @@ func ServerlessInstancesBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index 58114a510c..ddc835516c 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -29,9 +29,10 @@ type CreateServerlessPrivateEndpointOpts struct { client *admin.APIClient groupId string instanceName string + } -func (opts *CreateServerlessPrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *CreateServerlessPrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateServerlessPrivateEndpointOpts) Run(ctx context.Context) error params := &admin.CreateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, + } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateServerlessPrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") - return cmd } type DeleteServerlessPrivateEndpointOpts struct { @@ -93,7 +95,7 @@ type DeleteServerlessPrivateEndpointOpts struct { endpointId string } -func (opts *DeleteServerlessPrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteServerlessPrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -131,7 +133,7 @@ func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -139,14 +141,13 @@ func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") - return cmd } type GetServerlessPrivateEndpointOpts struct { @@ -158,7 +159,7 @@ type GetServerlessPrivateEndpointOpts struct { endpointId string } -func (opts *GetServerlessPrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *GetServerlessPrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -196,7 +197,7 @@ func GetServerlessPrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -204,14 +205,13 @@ func GetServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 24-hexadecimal digit string that identifies the tenant endpoint.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") - return cmd } type ListServerlessPrivateEndpointsOpts struct { @@ -222,7 +222,7 @@ type ListServerlessPrivateEndpointsOpts struct { instanceName string } -func (opts *ListServerlessPrivateEndpointsOpts) initClient(ctx context.Context) func() error { +func (opts *ListServerlessPrivateEndpointsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -259,7 +259,7 @@ func ListServerlessPrivateEndpointsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -267,12 +267,11 @@ func ListServerlessPrivateEndpointsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") - return cmd } type UpdateServerlessPrivateEndpointOpts struct { @@ -282,9 +281,10 @@ type UpdateServerlessPrivateEndpointOpts struct { groupId string instanceName string endpointId string + } -func (opts *UpdateServerlessPrivateEndpointOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateServerlessPrivateEndpointOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -297,6 +297,7 @@ func (opts *UpdateServerlessPrivateEndpointOpts) Run(ctx context.Context) error GroupId: opts.groupId, InstanceName: opts.instanceName, EndpointId: opts.endpointId, + } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -322,7 +323,7 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -330,14 +331,14 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", , "Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", , "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.") + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") - return cmd } @@ -355,3 +356,4 @@ func ServerlessPrivateEndpointsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index 065affc084..e141368db1 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -29,9 +29,10 @@ type CreateSharedClusterBackupRestoreJobOpts struct { client *admin.APIClient clusterName string groupId string + } -func (opts *CreateSharedClusterBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *CreateSharedClusterBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) er params := &admin.CreateSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, + } resp, _, err := opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetSharedClusterBackupRestoreJobOpts struct { @@ -93,7 +95,7 @@ type GetSharedClusterBackupRestoreJobOpts struct { restoreId string } -func (opts *GetSharedClusterBackupRestoreJobOpts) initClient(ctx context.Context) func() error { +func (opts *GetSharedClusterBackupRestoreJobOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -131,7 +133,7 @@ func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -139,14 +141,13 @@ func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.restoreId, "restoreId", , "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", "Unique 24-hexadecimal digit string that identifies the restore job to return.") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("restoreId") - return cmd } type ListSharedClusterBackupRestoreJobsOpts struct { @@ -157,7 +158,7 @@ type ListSharedClusterBackupRestoreJobsOpts struct { groupId string } -func (opts *ListSharedClusterBackupRestoreJobsOpts) initClient(ctx context.Context) func() error { +func (opts *ListSharedClusterBackupRestoreJobsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -194,7 +195,7 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -202,12 +203,11 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -223,3 +223,4 @@ func SharedTierRestoreJobsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index 523b79762a..e76cd784ee 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -29,9 +29,10 @@ type DownloadSharedClusterBackupOpts struct { client *admin.APIClient clusterName string groupId string + } -func (opts *DownloadSharedClusterBackupOpts) initClient(ctx context.Context) func() error { +func (opts *DownloadSharedClusterBackupOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *DownloadSharedClusterBackupOpts) Run(ctx context.Context) error { params := &admin.DownloadSharedClusterBackupApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, + } resp, _, err := opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func DownloadSharedClusterBackupBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func DownloadSharedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetSharedClusterBackupOpts struct { @@ -93,7 +95,7 @@ type GetSharedClusterBackupOpts struct { snapshotId string } -func (opts *GetSharedClusterBackupOpts) initClient(ctx context.Context) func() error { +func (opts *GetSharedClusterBackupOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -131,7 +133,7 @@ func GetSharedClusterBackupBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -139,14 +141,13 @@ func GetSharedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", , "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") - return cmd } type ListSharedClusterBackupsOpts struct { @@ -157,7 +158,7 @@ type ListSharedClusterBackupsOpts struct { clusterName string } -func (opts *ListSharedClusterBackupsOpts) initClient(ctx context.Context) func() error { +func (opts *ListSharedClusterBackupsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -194,7 +195,7 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -202,12 +203,11 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", , "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") - return cmd } @@ -223,3 +223,4 @@ func SharedTierSnapshotsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 60ff805ec9..356c623abb 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -28,9 +28,10 @@ type AddAllTeamsToProjectOpts struct { cli.OutputOpts client *admin.APIClient groupId string + } -func (opts *AddAllTeamsToProjectOpts) initClient(ctx context.Context) func() error { +func (opts *AddAllTeamsToProjectOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -41,6 +42,7 @@ func (opts *AddAllTeamsToProjectOpts) initClient(ctx context.Context) func() err func (opts *AddAllTeamsToProjectOpts) Run(ctx context.Context) error { params := &admin.AddAllTeamsToProjectApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params).Execute() if err != nil { @@ -66,7 +68,7 @@ func AddAllTeamsToProjectBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -74,10 +76,10 @@ func AddAllTeamsToProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + _ = cmd.MarkFlagRequired("groupId") - return cmd } type AddTeamUserOpts struct { @@ -86,9 +88,10 @@ type AddTeamUserOpts struct { client *admin.APIClient orgId string teamId string + } -func (opts *AddTeamUserOpts) initClient(ctx context.Context) func() error { +func (opts *AddTeamUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -100,6 +103,7 @@ func (opts *AddTeamUserOpts) Run(ctx context.Context) error { params := &admin.AddTeamUserApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, + } resp, _, err := opts.client.TeamsApi.AddTeamUserWithParams(ctx, params).Execute() if err != nil { @@ -125,7 +129,7 @@ func AddTeamUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -133,12 +137,12 @@ func AddTeamUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.") + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") - return cmd } type CreateTeamOpts struct { @@ -146,9 +150,10 @@ type CreateTeamOpts struct { cli.OutputOpts client *admin.APIClient orgId string + } -func (opts *CreateTeamOpts) initClient(ctx context.Context) func() error { +func (opts *CreateTeamOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -159,6 +164,7 @@ func (opts *CreateTeamOpts) initClient(ctx context.Context) func() error { func (opts *CreateTeamOpts) Run(ctx context.Context) error { params := &admin.CreateTeamApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.TeamsApi.CreateTeamWithParams(ctx, params).Execute() if err != nil { @@ -184,7 +190,7 @@ func CreateTeamBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -192,10 +198,10 @@ func CreateTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + _ = cmd.MarkFlagRequired("orgId") - return cmd } type DeleteTeamOpts struct { @@ -206,7 +212,7 @@ type DeleteTeamOpts struct { teamId string } -func (opts *DeleteTeamOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteTeamOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -243,7 +249,7 @@ func DeleteTeamBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -251,12 +257,11 @@ func DeleteTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to delete.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team that you want to delete.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") - return cmd } type GetTeamByIdOpts struct { @@ -267,7 +272,7 @@ type GetTeamByIdOpts struct { teamId string } -func (opts *GetTeamByIdOpts) initClient(ctx context.Context) func() error { +func (opts *GetTeamByIdOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -304,7 +309,7 @@ func GetTeamByIdBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -312,12 +317,11 @@ func GetTeamByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose information you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team whose information you want to return.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") - return cmd } type GetTeamByNameOpts struct { @@ -328,7 +332,7 @@ type GetTeamByNameOpts struct { teamName string } -func (opts *GetTeamByNameOpts) initClient(ctx context.Context) func() error { +func (opts *GetTeamByNameOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -365,7 +369,7 @@ func GetTeamByNameBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -373,12 +377,11 @@ func GetTeamByNameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamName, "teamName", , "Name of the team whose information you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamName, "teamName", "", "Name of the team whose information you want to return.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamName") - return cmd } type ListOrganizationTeamsOpts struct { @@ -391,7 +394,7 @@ type ListOrganizationTeamsOpts struct { pageNum int } -func (opts *ListOrganizationTeamsOpts) initClient(ctx context.Context) func() error { +func (opts *ListOrganizationTeamsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -430,7 +433,7 @@ func ListOrganizationTeamsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -438,13 +441,12 @@ func ListOrganizationTeamsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") - return cmd } type ListProjectTeamsOpts struct { @@ -457,7 +459,7 @@ type ListProjectTeamsOpts struct { pageNum int } -func (opts *ListProjectTeamsOpts) initClient(ctx context.Context) func() error { +func (opts *ListProjectTeamsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -496,7 +498,7 @@ func ListProjectTeamsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -504,13 +506,12 @@ func ListProjectTeamsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListTeamUsersOpts struct { @@ -523,7 +524,7 @@ type ListTeamUsersOpts struct { pageNum int } -func (opts *ListTeamUsersOpts) initClient(ctx context.Context) func() error { +func (opts *ListTeamUsersOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -562,7 +563,7 @@ func ListTeamUsersBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -570,14 +571,13 @@ func ListTeamUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") - return cmd } type RemoveProjectTeamOpts struct { @@ -588,7 +588,7 @@ type RemoveProjectTeamOpts struct { teamId string } -func (opts *RemoveProjectTeamOpts) initClient(ctx context.Context) func() error { +func (opts *RemoveProjectTeamOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -625,7 +625,7 @@ func RemoveProjectTeamBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -633,12 +633,11 @@ func RemoveProjectTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") - return cmd } type RemoveTeamUserOpts struct { @@ -650,7 +649,7 @@ type RemoveTeamUserOpts struct { userId string } -func (opts *RemoveTeamUserOpts) initClient(ctx context.Context) func() error { +func (opts *RemoveTeamUserOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -688,7 +687,7 @@ func RemoveTeamUserBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -696,14 +695,13 @@ func RemoveTeamUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.") - cmd.Flags().StringVar(&opts.userId, "userId", , "Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.") + cmd.Flags().StringVar(&opts.userId, "userId", "", "Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.") _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") _ = cmd.MarkFlagRequired("userId") - return cmd } type RenameTeamOpts struct { @@ -712,9 +710,10 @@ type RenameTeamOpts struct { client *admin.APIClient orgId string teamId string + } -func (opts *RenameTeamOpts) initClient(ctx context.Context) func() error { +func (opts *RenameTeamOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -726,6 +725,7 @@ func (opts *RenameTeamOpts) Run(ctx context.Context) error { params := &admin.RenameTeamApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, + } resp, _, err := opts.client.TeamsApi.RenameTeamWithParams(ctx, params).Execute() if err != nil { @@ -751,7 +751,7 @@ func RenameTeamBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -759,12 +759,12 @@ func RenameTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", , "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team that you want to rename.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team that you want to rename.") + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") - return cmd } type UpdateTeamRolesOpts struct { @@ -773,9 +773,10 @@ type UpdateTeamRolesOpts struct { client *admin.APIClient groupId string teamId string + } -func (opts *UpdateTeamRolesOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateTeamRolesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -787,6 +788,7 @@ func (opts *UpdateTeamRolesOpts) Run(ctx context.Context) error { params := &admin.UpdateTeamRolesApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, + } resp, _, err := opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params).Execute() if err != nil { @@ -812,7 +814,7 @@ func UpdateTeamRolesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -820,12 +822,12 @@ func UpdateTeamRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.teamId, "teamId", , "Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") - return cmd } @@ -851,3 +853,4 @@ func TeamsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index 8c6ebdc04a..60edbfc0cf 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -30,7 +30,7 @@ type VersionedExampleOpts struct { additionalInfo bool } -func (opts *VersionedExampleOpts) initClient(ctx context.Context) func() error { +func (opts *VersionedExampleOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -66,7 +66,7 @@ func VersionedExampleBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,7 +76,6 @@ func VersionedExampleBuilder() *cobra.Command { } cmd.Flags().BoolVar(&opts.additionalInfo, "additionalInfo", false, "") - return cmd } @@ -90,3 +89,4 @@ func TestBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index 191fe86183..d8a340de4d 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -29,12 +29,13 @@ type CreateThirdPartyIntegrationOpts struct { client *admin.APIClient integrationType string groupId string + includeCount bool itemsPerPage int pageNum int } -func (opts *CreateThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { +func (opts *CreateThirdPartyIntegrationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -46,6 +47,7 @@ func (opts *CreateThirdPartyIntegrationOpts) Run(ctx context.Context) error { params := &admin.CreateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, + IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, @@ -74,7 +76,7 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -82,15 +84,15 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") - return cmd } type DeleteThirdPartyIntegrationOpts struct { @@ -101,7 +103,7 @@ type DeleteThirdPartyIntegrationOpts struct { groupId string } -func (opts *DeleteThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { +func (opts *DeleteThirdPartyIntegrationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -138,7 +140,7 @@ func DeleteThirdPartyIntegrationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -146,12 +148,11 @@ func DeleteThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") - return cmd } type GetThirdPartyIntegrationOpts struct { @@ -162,7 +163,7 @@ type GetThirdPartyIntegrationOpts struct { integrationType string } -func (opts *GetThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { +func (opts *GetThirdPartyIntegrationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -199,7 +200,7 @@ func GetThirdPartyIntegrationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -207,12 +208,11 @@ func GetThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("integrationType") - return cmd } type ListThirdPartyIntegrationsOpts struct { @@ -225,7 +225,7 @@ type ListThirdPartyIntegrationsOpts struct { pageNum int } -func (opts *ListThirdPartyIntegrationsOpts) initClient(ctx context.Context) func() error { +func (opts *ListThirdPartyIntegrationsOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -264,7 +264,7 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -272,13 +272,12 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type UpdateThirdPartyIntegrationOpts struct { @@ -287,12 +286,13 @@ type UpdateThirdPartyIntegrationOpts struct { client *admin.APIClient integrationType string groupId string + includeCount bool itemsPerPage int pageNum int } -func (opts *UpdateThirdPartyIntegrationOpts) initClient(ctx context.Context) func() error { +func (opts *UpdateThirdPartyIntegrationOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -304,6 +304,7 @@ func (opts *UpdateThirdPartyIntegrationOpts) Run(ctx context.Context) error { params := &admin.UpdateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, + IncludeCount: opts.includeCount, ItemsPerPage: opts.itemsPerPage, PageNum: opts.pageNum, @@ -332,7 +333,7 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -340,15 +341,15 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", , "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") - return cmd } @@ -368,3 +369,4 @@ func ThirdPartyIntegrationsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index f91950e1b6..6799ca4a6b 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -29,9 +29,10 @@ type CreateDatabaseUserCertificateOpts struct { client *admin.APIClient groupId string username string + } -func (opts *CreateDatabaseUserCertificateOpts) initClient(ctx context.Context) func() error { +func (opts *CreateDatabaseUserCertificateOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -43,6 +44,7 @@ func (opts *CreateDatabaseUserCertificateOpts) Run(ctx context.Context) error { params := &admin.CreateDatabaseUserCertificateApiParams{ GroupId: opts.groupId, Username: opts.username, + } _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() if err != nil { @@ -68,7 +70,7 @@ func CreateDatabaseUserCertificateBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -76,12 +78,12 @@ func CreateDatabaseUserCertificateBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account for whom to create a certificate.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the MongoDB database user account for whom to create a certificate.") + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") - return cmd } type DisableCustomerManagedX509Opts struct { @@ -91,7 +93,7 @@ type DisableCustomerManagedX509Opts struct { groupId string } -func (opts *DisableCustomerManagedX509Opts) initClient(ctx context.Context) func() error { +func (opts *DisableCustomerManagedX509Opts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -127,7 +129,7 @@ func DisableCustomerManagedX509Builder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -135,10 +137,9 @@ func DisableCustomerManagedX509Builder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") _ = cmd.MarkFlagRequired("groupId") - return cmd } type ListDatabaseUserCertificatesOpts struct { @@ -152,7 +153,7 @@ type ListDatabaseUserCertificatesOpts struct { pageNum int } -func (opts *ListDatabaseUserCertificatesOpts) initClient(ctx context.Context) func() error { +func (opts *ListDatabaseUserCertificatesOpts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -192,7 +193,7 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -200,15 +201,14 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", , "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.username, "username", , "Human-readable label that represents the MongoDB database user account whose certificates you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the MongoDB database user account whose certificates you want to return.") cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") - return cmd } @@ -224,3 +224,4 @@ func X509AuthenticationBuilder() *cobra.Command { ) return cmd } + diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 272b56dcf2..a75dcb8bd0 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -14,15 +14,12 @@ type {{operationId}}Opts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - {{#pathParams}} - {{paramName}} {{{dataType}}} - {{/pathParams}} - {{#queryParams}} - {{paramName}} {{{dataType}}} - {{/queryParams}} + {{#allParams}} + {{^isBodyParam}}{{paramName}} {{{dataType}}}{{/isBodyParam}} + {{/allParams}} } -func (opts *{{operationId}}Opts) initClient(ctx context.Context) func() error { +func (opts *{{operationId}}Opts) initClient() func() error { return func() error { var err error opts.client, err = NewClientWithAuth() @@ -32,12 +29,9 @@ func (opts *{{operationId}}Opts) initClient(ctx context.Context) func() error { func (opts *{{operationId}}Opts) Run(ctx context.Context) error { params := &admin.{{operationId}}ApiParams{ - {{#pathParams}} - {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}}, - {{/pathParams}} - {{#queryParams}} - {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}}, - {{/queryParams}} + {{#allParams}} + {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}},{{/isBodyParam}} + {{/allParams}} } {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params).Execute() if err != nil { @@ -63,7 +57,7 @@ func {{operationId}}Builder() *cobra.Command { PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( //opts.ValidateProjectID, - opts.initClient(cmd.Context()), + opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) }, @@ -71,16 +65,11 @@ func {{operationId}}Builder() *cobra.Command { return opts.Run(cmd.Context()) }, } -{{#pathParams}} - cmd.Flags().{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}Var(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}") -{{/pathParams}} -{{#queryParams}} - cmd.Flags().{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}Var(&opts.{{paramName}}, "{{paramName}}", {{defaultValue}}, "{{description}}") -{{/queryParams}} -{{#pathParams}}{{#required}} - _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/pathParams}} -{{#queryParams}}{{#required}} - _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/queryParams}} +{{#allParams}} + {{^isBodyParam}}cmd.Flags().{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isString}}"{{/isString}}{{^defaultValue}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, "{{description}}"){{/isBodyParam}} +{{/allParams}} +{{#allParams}}{{^isBodyParam}}{{#required}} + _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/isBodyParam}}{{/allParams}} return cmd } {{/operation}} @@ -102,3 +91,4 @@ func {{baseName}}Builder() *cobra.Command { ) return cmd } + From 4516cda693db50348862e5c49d0905cee14366c2 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 1 Jun 2023 17:47:21 +0100 Subject: [PATCH 14/44] wip --- internal/generated/api_access_tracking_cmd.go | 4 -- .../generated/api_alert_configurations_cmd.go | 16 ----- internal/generated/api_alerts_cmd.go | 8 --- internal/generated/api_atlas_search_cmd.go | 10 ---- internal/generated/api_auditing_cmd.go | 4 -- .../generated/api_aws_clusters_dns_cmd.go | 4 -- internal/generated/api_cloud_backups_cmd.go | 58 ------------------- .../api_cloud_migration_service_cmd.go | 16 ----- .../api_cloud_provider_access_cmd.go | 10 ---- .../api_cluster_outage_simulation_cmd.go | 6 -- internal/generated/api_clusters_cmd.go | 18 ------ .../api_custom_database_roles_cmd.go | 10 ---- internal/generated/api_data_federation_cmd.go | 28 --------- .../generated/api_data_lake_pipelines_cmd.go | 26 --------- internal/generated/api_database_users_cmd.go | 10 ---- ..._rest_using_customer_key_management_cmd.go | 4 -- internal/generated/api_events_cmd.go | 8 --- .../api_federated_authentication_cmd.go | 30 ---------- internal/generated/api_global_clusters_cmd.go | 10 ---- internal/generated/api_invoices_cmd.go | 8 --- .../generated/api_ldap_configuration_cmd.go | 10 ---- internal/generated/api_legacy_backup_cmd.go | 20 ------- .../api_legacy_backup_restore_jobs_cmd.go | 2 - .../generated/api_maintenance_windows__cmd.go | 10 ---- .../generated/api_mongo_db_cloud_users_cmd.go | 6 -- .../generated/api_monitoring_and_logs_cmd.go | 28 --------- .../generated/api_multi_cloud_clusters_cmd.go | 12 ---- internal/generated/api_network_peering_cmd.go | 26 --------- internal/generated/api_online_archive_cmd.go | 12 ---- internal/generated/api_organizations_cmd.go | 30 ---------- .../generated/api_performance_advisor_cmd.go | 10 ---- .../api_private_endpoint_services_cmd.go | 18 ------ .../api_programmatic_api_keys_cmd.go | 28 --------- .../api_project_ip_access_list_cmd.go | 10 ---- internal/generated/api_projects_cmd.go | 40 ------------- internal/generated/api_rolling_index_cmd.go | 2 - internal/generated/api_root_cmd.go | 2 - .../generated/api_serverless_instances_cmd.go | 10 ---- .../api_serverless_private_endpoints_cmd.go | 10 ---- .../api_shared_tier_restore_jobs_cmd.go | 6 -- .../api_shared_tier_snapshots_cmd.go | 6 -- internal/generated/api_teams_cmd.go | 26 --------- internal/generated/api_test__cmd.go | 2 - .../api_third_party_integrations_cmd.go | 10 ---- .../generated/api_x509_authentication_cmd.go | 6 -- .../config/go-templates/cmd.mustache | 2 - 46 files changed, 632 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index 936eb7d8b6..c5fb54a061 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -70,8 +70,6 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { Use: "listAccessLogsByClusterName", // Aliases: []string{"?"}, Short: "Return Database Access History for One Cluster using Its Cluster Name", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -145,8 +143,6 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { Use: "listAccessLogsByHostname", // Aliases: []string{"?"}, Short: "Return Database Access History for One Cluster using Its Hostname", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index ee983413fc..a547729919 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -60,8 +60,6 @@ func CreateAlertConfigurationBuilder() *cobra.Command { Use: "createAlertConfiguration", // Aliases: []string{"?"}, Short: "Create One Alert Configuration in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -119,8 +117,6 @@ func DeleteAlertConfigurationBuilder() *cobra.Command { Use: "deleteAlertConfiguration", // Aliases: []string{"?"}, Short: "Remove One Alert Configuration from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -179,8 +175,6 @@ func GetAlertConfigurationBuilder() *cobra.Command { Use: "getAlertConfiguration", // Aliases: []string{"?"}, Short: "Return One Alert Configuration from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -235,8 +229,6 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { Use: "listAlertConfigurationMatchersFieldNames", // Aliases: []string{"?"}, Short: "Get All Alert Configuration Matchers Field Names", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -295,8 +287,6 @@ func ListAlertConfigurationsBuilder() *cobra.Command { Use: "listAlertConfigurations", // Aliases: []string{"?"}, Short: "Return All Alert Configurations for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -362,8 +352,6 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { Use: "listAlertConfigurationsByAlertId", // Aliases: []string{"?"}, Short: "Return All Alert Configurations Set for One Alert", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -427,8 +415,6 @@ func ToggleAlertConfigurationBuilder() *cobra.Command { Use: "toggleAlertConfiguration", // Aliases: []string{"?"}, Short: "Toggle One State of One Alert Configuration in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -490,8 +476,6 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { Use: "updateAlertConfiguration", // Aliases: []string{"?"}, Short: "Update One Alert Configuration for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index ce6573d741..701080dea0 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -62,8 +62,6 @@ func AcknowledgeAlertBuilder() *cobra.Command { Use: "acknowledgeAlert", // Aliases: []string{"?"}, Short: "Acknowledge One Alert from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -123,8 +121,6 @@ func GetAlertBuilder() *cobra.Command { Use: "getAlert", // Aliases: []string{"?"}, Short: "Return One Alert from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -189,8 +185,6 @@ func ListAlertsBuilder() *cobra.Command { Use: "listAlerts", // Aliases: []string{"?"}, Short: "Return All Alerts from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -257,8 +251,6 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { Use: "listAlertsByAlertConfigurationId", // Aliases: []string{"?"}, Short: "Return All Open Alerts for Alert Configuration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index a9d68ce6e7..394f556319 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -62,8 +62,6 @@ func CreateAtlasSearchIndexBuilder() *cobra.Command { Use: "createAtlasSearchIndex", // Aliases: []string{"?"}, Short: "Create One Atlas Search Index", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -125,8 +123,6 @@ func DeleteAtlasSearchIndexBuilder() *cobra.Command { Use: "deleteAtlasSearchIndex", // Aliases: []string{"?"}, Short: "Remove One Atlas Search Index", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -189,8 +185,6 @@ func GetAtlasSearchIndexBuilder() *cobra.Command { Use: "getAtlasSearchIndex", // Aliases: []string{"?"}, Short: "Return One Atlas Search Index", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -255,8 +249,6 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { Use: "listAtlasSearchIndexes", // Aliases: []string{"?"}, Short: "Return All Atlas Search Indexes for One Collection", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -323,8 +315,6 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { Use: "updateAtlasSearchIndex", // Aliases: []string{"?"}, Short: "Update One Atlas Search Index", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index ae3dabfefa..a78081b24e 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -58,8 +58,6 @@ func GetAuditingConfigurationBuilder() *cobra.Command { Use: "getAuditingConfiguration", // Aliases: []string{"?"}, Short: "Return the Auditing Configuration for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -116,8 +114,6 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { Use: "updateAuditingConfiguration", // Aliases: []string{"?"}, Short: "Update Auditing Configuration for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 5a4f1c3fe9..794b0ced95 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -58,8 +58,6 @@ func GetAWSCustomDNSBuilder() *cobra.Command { Use: "getAWSCustomDNS", // Aliases: []string{"?"}, Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -116,8 +114,6 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { Use: "toggleAWSCustomDNS", // Aliases: []string{"?"}, Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index ef6abd39c1..bf29ffb3d8 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -62,8 +62,6 @@ func CancelBackupRestoreJobBuilder() *cobra.Command { Use: "cancelBackupRestoreJob", // Aliases: []string{"?"}, Short: "Cancel One Restore Job of One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -126,8 +124,6 @@ func CreateBackupExportJobBuilder() *cobra.Command { Use: "createBackupExportJob", // Aliases: []string{"?"}, Short: "Create One Cloud Backup Snapshot Export Job", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -189,8 +185,6 @@ func CreateBackupRestoreJobBuilder() *cobra.Command { Use: "createBackupRestoreJob", // Aliases: []string{"?"}, Short: "Restore One Snapshot of One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -250,8 +244,6 @@ func CreateExportBucketBuilder() *cobra.Command { Use: "createExportBucket", // Aliases: []string{"?"}, Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -311,8 +303,6 @@ func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { Use: "createServerlessBackupRestoreJob", // Aliases: []string{"?"}, Short: "Restore One Snapshot of One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -372,8 +362,6 @@ func DeleteAllBackupSchedulesBuilder() *cobra.Command { Use: "deleteAllBackupSchedules", // Aliases: []string{"?"}, Short: "Remove All Cloud Backup Schedules", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -432,8 +420,6 @@ func DeleteExportBucketBuilder() *cobra.Command { Use: "deleteExportBucket", // Aliases: []string{"?"}, Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -494,8 +480,6 @@ func DeleteReplicaSetBackupBuilder() *cobra.Command { Use: "deleteReplicaSetBackup", // Aliases: []string{"?"}, Short: "Remove One Replica Set Cloud Backup", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -558,8 +542,6 @@ func DeleteShardedClusterBackupBuilder() *cobra.Command { Use: "deleteShardedClusterBackup", // Aliases: []string{"?"}, Short: "Remove One Sharded Cluster Cloud Backup", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -622,8 +604,6 @@ func GetBackupExportJobBuilder() *cobra.Command { Use: "getBackupExportJob", // Aliases: []string{"?"}, Short: "Return One Cloud Backup Snapshot Export Job", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -686,8 +666,6 @@ func GetBackupRestoreJobBuilder() *cobra.Command { Use: "getBackupRestoreJob", // Aliases: []string{"?"}, Short: "Return One Restore Job of One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -748,8 +726,6 @@ func GetBackupScheduleBuilder() *cobra.Command { Use: "getBackupSchedule", // Aliases: []string{"?"}, Short: "Return One Cloud Backup Schedule", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -806,8 +782,6 @@ func GetDataProtectionSettingsBuilder() *cobra.Command { Use: "getDataProtectionSettings", // Aliases: []string{"?"}, Short: "Return the Backup Compliance Policy settings", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -864,8 +838,6 @@ func GetExportBucketBuilder() *cobra.Command { Use: "getExportBucket", // Aliases: []string{"?"}, Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -926,8 +898,6 @@ func GetReplicaSetBackupBuilder() *cobra.Command { Use: "getReplicaSetBackup", // Aliases: []string{"?"}, Short: "Return One Replica Set Cloud Backup", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -990,8 +960,6 @@ func GetServerlessBackupBuilder() *cobra.Command { Use: "getServerlessBackup", // Aliases: []string{"?"}, Short: "Return One Snapshot of One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1054,8 +1022,6 @@ func GetServerlessBackupRestoreJobBuilder() *cobra.Command { Use: "getServerlessBackupRestoreJob", // Aliases: []string{"?"}, Short: "Return One Restore Job for One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1118,8 +1084,6 @@ func GetShardedClusterBackupBuilder() *cobra.Command { Use: "getShardedClusterBackup", // Aliases: []string{"?"}, Short: "Return One Sharded Cluster Cloud Backup", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1186,8 +1150,6 @@ func ListBackupExportJobsBuilder() *cobra.Command { Use: "listBackupExportJobs", // Aliases: []string{"?"}, Short: "Return All Cloud Backup Snapshot Export Jobs", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1255,8 +1217,6 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { Use: "listBackupRestoreJobs", // Aliases: []string{"?"}, Short: "Return All Restore Jobs for One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1322,8 +1282,6 @@ func ListExportBucketsBuilder() *cobra.Command { Use: "listExportBuckets", // Aliases: []string{"?"}, Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1389,8 +1347,6 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { Use: "listReplicaSetBackups", // Aliases: []string{"?"}, Short: "Return All Replica Set Cloud Backups", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1458,8 +1414,6 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { Use: "listServerlessBackupRestoreJobs", // Aliases: []string{"?"}, Short: "Return All Restore Jobs for One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1527,8 +1481,6 @@ func ListServerlessBackupsBuilder() *cobra.Command { Use: "listServerlessBackups", // Aliases: []string{"?"}, Short: "Return All Snapshots of One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1590,8 +1542,6 @@ func ListShardedClusterBackupsBuilder() *cobra.Command { Use: "listShardedClusterBackups", // Aliases: []string{"?"}, Short: "Return All Sharded Cluster Cloud Backups", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1652,8 +1602,6 @@ func TakeSnapshotBuilder() *cobra.Command { Use: "takeSnapshot", // Aliases: []string{"?"}, Short: "Take One On-Demand Snapshot", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1715,8 +1663,6 @@ func UpdateBackupScheduleBuilder() *cobra.Command { Use: "updateBackupSchedule", // Aliases: []string{"?"}, Short: "Update Cloud Backup Schedule for One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1776,8 +1722,6 @@ func UpdateDataProtectionSettingsBuilder() *cobra.Command { Use: "updateDataProtectionSettings", // Aliases: []string{"?"}, Short: "Update or enable the Backup Compliance Policy settings", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1839,8 +1783,6 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { Use: "updateSnapshotRetention", // Aliases: []string{"?"}, Short: "Change Expiration Date for One Cloud Backup", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index 63b0fb4c99..74016d4574 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -60,8 +60,6 @@ func CreateLinkTokenBuilder() *cobra.Command { Use: "createLinkToken", // Aliases: []string{"?"}, Short: "Create One Link-Token", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -119,8 +117,6 @@ func CreatePushMigrationBuilder() *cobra.Command { Use: "createPushMigration", // Aliases: []string{"?"}, Short: "Migrate One Local Managed Cluster to MongoDB Atlas", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -178,8 +174,6 @@ func CutoverMigrationBuilder() *cobra.Command { Use: "cutoverMigration", // Aliases: []string{"?"}, Short: "Cut Over the Migrated Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -236,8 +230,6 @@ func DeleteLinkTokenBuilder() *cobra.Command { Use: "deleteLinkToken", // Aliases: []string{"?"}, Short: "Remove One Link-Token", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -294,8 +286,6 @@ func GetPushMigrationBuilder() *cobra.Command { Use: "getPushMigration", // Aliases: []string{"?"}, Short: "Return One Migration Job", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -354,8 +344,6 @@ func GetValidationStatusBuilder() *cobra.Command { Use: "getValidationStatus", // Aliases: []string{"?"}, Short: "Return One Migration Validation Job", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -412,8 +400,6 @@ func ListSourceProjectsBuilder() *cobra.Command { Use: "listSourceProjects", // Aliases: []string{"?"}, Short: "Return All Projects Available for Migration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -470,8 +456,6 @@ func ValidateMigrationBuilder() *cobra.Command { Use: "validateMigration", // Aliases: []string{"?"}, Short: "Validate One Migration Request", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index 22d5b3a3c6..0d8fa16cbb 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -62,8 +62,6 @@ func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { Use: "authorizeCloudProviderAccessRole", // Aliases: []string{"?"}, Short: "Authorize One Cloud Provider Access Role", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -123,8 +121,6 @@ func CreateCloudProviderAccessRoleBuilder() *cobra.Command { Use: "createCloudProviderAccessRole", // Aliases: []string{"?"}, Short: "Create One Cloud Provider Access Role", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -184,8 +180,6 @@ func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { Use: "deauthorizeCloudProviderAccessRole", // Aliases: []string{"?"}, Short: "Deauthorize One Cloud Provider Access Role", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -246,8 +240,6 @@ func GetCloudProviderAccessRoleBuilder() *cobra.Command { Use: "getCloudProviderAccessRole", // Aliases: []string{"?"}, Short: "Return specified Cloud Provider Access Role", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -304,8 +296,6 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { Use: "listCloudProviderAccessRoles", // Aliases: []string{"?"}, Short: "Return All Cloud Provider Access Roles", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index c816aa2843..23df1e4ca1 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -60,8 +60,6 @@ func EndOutageSimulationBuilder() *cobra.Command { Use: "endOutageSimulation", // Aliases: []string{"?"}, Short: "End an Outage Simulation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -120,8 +118,6 @@ func GetOutageSimulationBuilder() *cobra.Command { Use: "getOutageSimulation", // Aliases: []string{"?"}, Short: "Return One Outage Simulation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -182,8 +178,6 @@ func StartOutageSimulationBuilder() *cobra.Command { Use: "startOutageSimulation", // Aliases: []string{"?"}, Short: "Start an Outage Simulation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index ed1655be12..f01f14e113 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -60,8 +60,6 @@ func GetClusterAdvancedConfigurationBuilder() *cobra.Command { Use: "getClusterAdvancedConfiguration", // Aliases: []string{"?"}, Short: "Return One Advanced Configuration Options for One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -120,8 +118,6 @@ func GetClusterStatusBuilder() *cobra.Command { Use: "getClusterStatus", // Aliases: []string{"?"}, Short: "Return Status of All Cluster Operations", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -180,8 +176,6 @@ func GetSampleDatasetLoadStatusBuilder() *cobra.Command { Use: "getSampleDatasetLoadStatus", // Aliases: []string{"?"}, Short: "Check Status of Cluster Sample Dataset Request", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -248,8 +242,6 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { Use: "listCloudProviderRegions", // Aliases: []string{"?"}, Short: "Return All Cloud Provider Regions", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -313,8 +305,6 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { Use: "listClustersForAllProjects", // Aliases: []string{"?"}, Short: "Return All Authorized Clusters in All Projects", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -372,8 +362,6 @@ func LoadSampleDatasetBuilder() *cobra.Command { Use: "loadSampleDataset", // Aliases: []string{"?"}, Short: "Load Sample Dataset Request into Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -434,8 +422,6 @@ func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { Use: "updateClusterAdvancedConfiguration", // Aliases: []string{"?"}, Short: "Update Advanced Configuration Options for One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -495,8 +481,6 @@ func UpgradeSharedClusterBuilder() *cobra.Command { Use: "upgradeSharedCluster", // Aliases: []string{"?"}, Short: "Upgrade One Shared-tier Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -554,8 +538,6 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { Use: "upgradeSharedClusterToServerless", // Aliases: []string{"?"}, Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index f3acd13042..8a800095ca 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -60,8 +60,6 @@ func CreateCustomDatabaseRoleBuilder() *cobra.Command { Use: "createCustomDatabaseRole", // Aliases: []string{"?"}, Short: "Create One Custom Role", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -119,8 +117,6 @@ func DeleteCustomDatabaseRoleBuilder() *cobra.Command { Use: "deleteCustomDatabaseRole", // Aliases: []string{"?"}, Short: "Remove One Custom Role from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -179,8 +175,6 @@ func GetCustomDatabaseRoleBuilder() *cobra.Command { Use: "getCustomDatabaseRole", // Aliases: []string{"?"}, Short: "Return One Custom Role in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -237,8 +231,6 @@ func ListCustomDatabaseRolesBuilder() *cobra.Command { Use: "listCustomDatabaseRoles", // Aliases: []string{"?"}, Short: "Return All Custom Roles in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -297,8 +289,6 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { Use: "updateCustomDatabaseRole", // Aliases: []string{"?"}, Short: "Update One Custom Role in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index 1f1de04f4d..994f651c2a 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -60,8 +60,6 @@ func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { Use: "createDataFederationPrivateEndpoint", // Aliases: []string{"?"}, Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -121,8 +119,6 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { Use: "createFederatedDatabase", // Aliases: []string{"?"}, Short: "Create One Federated Database Instance in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -185,8 +181,6 @@ func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { Use: "createOneDataFederationQueryLimit", // Aliases: []string{"?"}, Short: "Configure One Query Limit for One Federated Database Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -248,8 +242,6 @@ func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { Use: "deleteDataFederationPrivateEndpoint", // Aliases: []string{"?"}, Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -308,8 +300,6 @@ func DeleteFederatedDatabaseBuilder() *cobra.Command { Use: "deleteFederatedDatabase", // Aliases: []string{"?"}, Short: "Remove One Federated Database Instance from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -370,8 +360,6 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { Use: "deleteOneDataFederationInstanceQueryLimit", // Aliases: []string{"?"}, Short: "Delete One Query Limit For One Federated Database Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -436,8 +424,6 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { Use: "downloadFederatedDatabaseQueryLogs", // Aliases: []string{"?"}, Short: "Download Query Logs for One Federated Database Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -498,8 +484,6 @@ func GetDataFederationPrivateEndpointBuilder() *cobra.Command { Use: "getDataFederationPrivateEndpoint", // Aliases: []string{"?"}, Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -558,8 +542,6 @@ func GetFederatedDatabaseBuilder() *cobra.Command { Use: "getFederatedDatabase", // Aliases: []string{"?"}, Short: "Return One Federated Database Instance in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -622,8 +604,6 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { Use: "listDataFederationPrivateEndpoints", // Aliases: []string{"?"}, Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -683,8 +663,6 @@ func ListFederatedDatabasesBuilder() *cobra.Command { Use: "listFederatedDatabases", // Aliases: []string{"?"}, Short: "Return All Federated Database Instances in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -744,8 +722,6 @@ func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { Use: "returnFederatedDatabaseQueryLimit", // Aliases: []string{"?"}, Short: "Return One Federated Database Instance Query Limit for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -806,8 +782,6 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { Use: "returnFederatedDatabaseQueryLimits", // Aliases: []string{"?"}, Short: "Return All Query Limits for One Federated Database Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -870,8 +844,6 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { Use: "updateFederatedDatabase", // Aliases: []string{"?"}, Short: "Update One Federated Database Instance in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 590abe21c0..64333d73e4 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -60,8 +60,6 @@ func CreatePipelineBuilder() *cobra.Command { Use: "createPipeline", // Aliases: []string{"?"}, Short: "Create One Data Lake Pipeline", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -119,8 +117,6 @@ func DeletePipelineBuilder() *cobra.Command { Use: "deletePipeline", // Aliases: []string{"?"}, Short: "Remove One Data Lake Pipeline", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -181,8 +177,6 @@ func DeletePipelineRunDatasetBuilder() *cobra.Command { Use: "deletePipelineRunDataset", // Aliases: []string{"?"}, Short: "Delete Pipeline Run Dataset", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -243,8 +237,6 @@ func GetPipelineBuilder() *cobra.Command { Use: "getPipeline", // Aliases: []string{"?"}, Short: "Return One Data Lake Pipeline", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -305,8 +297,6 @@ func GetPipelineRunBuilder() *cobra.Command { Use: "getPipelineRun", // Aliases: []string{"?"}, Short: "Return One Data Lake Pipeline Run", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -375,8 +365,6 @@ func ListPipelineRunsBuilder() *cobra.Command { Use: "listPipelineRuns", // Aliases: []string{"?"}, Short: "Return All Data Lake Pipeline Runs from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -439,8 +427,6 @@ func ListPipelineSchedulesBuilder() *cobra.Command { Use: "listPipelineSchedules", // Aliases: []string{"?"}, Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -507,8 +493,6 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { Use: "listPipelineSnapshots", // Aliases: []string{"?"}, Short: "Return Available Backup Snapshots for One Data Lake Pipeline", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -569,8 +553,6 @@ func ListPipelinesBuilder() *cobra.Command { Use: "listPipelines", // Aliases: []string{"?"}, Short: "Return All Data Lake Pipelines from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -627,8 +609,6 @@ func PausePipelineBuilder() *cobra.Command { Use: "pausePipeline", // Aliases: []string{"?"}, Short: "Pause One Data Lake Pipeline", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -687,8 +667,6 @@ func ResumePipelineBuilder() *cobra.Command { Use: "resumePipeline", // Aliases: []string{"?"}, Short: "Resume One Data Lake Pipeline", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -749,8 +727,6 @@ func TriggerSnapshotIngestionBuilder() *cobra.Command { Use: "triggerSnapshotIngestion", // Aliases: []string{"?"}, Short: "Trigger on demand snapshot ingestion", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -812,8 +788,6 @@ func UpdatePipelineBuilder() *cobra.Command { Use: "updatePipeline", // Aliases: []string{"?"}, Short: "Update One Data Lake Pipeline", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index e7f48a53f4..2407bb5df3 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -60,8 +60,6 @@ func CreateDatabaseUserBuilder() *cobra.Command { Use: "createDatabaseUser", // Aliases: []string{"?"}, Short: "Create One Database User in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -121,8 +119,6 @@ func DeleteDatabaseUserBuilder() *cobra.Command { Use: "deleteDatabaseUser", // Aliases: []string{"?"}, Short: "Remove One Database User from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -185,8 +181,6 @@ func GetDatabaseUserBuilder() *cobra.Command { Use: "getDatabaseUser", // Aliases: []string{"?"}, Short: "Return One Database User from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -251,8 +245,6 @@ func ListDatabaseUsersBuilder() *cobra.Command { Use: "listDatabaseUsers", // Aliases: []string{"?"}, Short: "Return All Database Users from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -316,8 +308,6 @@ func UpdateDatabaseUserBuilder() *cobra.Command { Use: "updateDatabaseUser", // Aliases: []string{"?"}, Short: "Update One Database User in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index a780f68e19..7100d507ba 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -58,8 +58,6 @@ func GetEncryptionAtRestBuilder() *cobra.Command { Use: "getEncryptionAtRest", // Aliases: []string{"?"}, Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -116,8 +114,6 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { Use: "updateEncryptionAtRest", // Aliases: []string{"?"}, Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 9989e8feea..21e98f0ae1 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -62,8 +62,6 @@ func GetOrganizationEventBuilder() *cobra.Command { Use: "getOrganizationEvent", // Aliases: []string{"?"}, Short: "Return One Event from One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -125,8 +123,6 @@ func GetProjectEventBuilder() *cobra.Command { Use: "getProjectEvent", // Aliases: []string{"?"}, Short: "Return One Event from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -198,8 +194,6 @@ func ListOrganizationEventsBuilder() *cobra.Command { Use: "listOrganizationEvents", // Aliases: []string{"?"}, Short: "Return All Events from One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -277,8 +271,6 @@ func ListProjectEventsBuilder() *cobra.Command { Use: "listProjectEvents", // Aliases: []string{"?"}, Short: "Return All Events from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index d84a53b80a..3ed3b9988f 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -62,8 +62,6 @@ func CreateRoleMappingBuilder() *cobra.Command { Use: "createRoleMapping", // Aliases: []string{"?"}, Short: "Add One Role Mapping to One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -121,8 +119,6 @@ func DeleteFederationAppBuilder() *cobra.Command { Use: "deleteFederationApp", // Aliases: []string{"?"}, Short: "Delete the federation settings instance.", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -181,8 +177,6 @@ func DeleteRoleMappingBuilder() *cobra.Command { Use: "deleteRoleMapping", // Aliases: []string{"?"}, Short: "Remove One Role Mapping from One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -243,8 +237,6 @@ func GetConnectedOrgConfigBuilder() *cobra.Command { Use: "getConnectedOrgConfig", // Aliases: []string{"?"}, Short: "Return One Org Config Connected to One Federation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -301,8 +293,6 @@ func GetFederationSettingsBuilder() *cobra.Command { Use: "getFederationSettings", // Aliases: []string{"?"}, Short: "Return Federation Settings for One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -359,8 +349,6 @@ func GetIdentityProviderBuilder() *cobra.Command { Use: "getIdentityProvider", // Aliases: []string{"?"}, Short: "Return one identity provider from the specified federation.", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -419,8 +407,6 @@ func GetIdentityProviderMetadataBuilder() *cobra.Command { Use: "getIdentityProviderMetadata", // Aliases: []string{"?"}, Short: "Return the metadata of one identity provider in the specified federation.", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -481,8 +467,6 @@ func GetRoleMappingBuilder() *cobra.Command { Use: "getRoleMapping", // Aliases: []string{"?"}, Short: "Return One Role Mapping from One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -541,8 +525,6 @@ func ListConnectedOrgConfigsBuilder() *cobra.Command { Use: "listConnectedOrgConfigs", // Aliases: []string{"?"}, Short: "Return All Connected Org Configs from the Federation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -597,8 +579,6 @@ func ListIdentityProvidersBuilder() *cobra.Command { Use: "listIdentityProviders", // Aliases: []string{"?"}, Short: "Return all identity providers from the specified federation.", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -655,8 +635,6 @@ func ListRoleMappingsBuilder() *cobra.Command { Use: "listRoleMappings", // Aliases: []string{"?"}, Short: "Return All Role Mappings from One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -715,8 +693,6 @@ func RemoveConnectedOrgConfigBuilder() *cobra.Command { Use: "removeConnectedOrgConfig", // Aliases: []string{"?"}, Short: "Remove One Org Config Connected to One Federation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -777,8 +753,6 @@ func UpdateConnectedOrgConfigBuilder() *cobra.Command { Use: "updateConnectedOrgConfig", // Aliases: []string{"?"}, Short: "Update One Org Config Connected to One Federation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -840,8 +814,6 @@ func UpdateIdentityProviderBuilder() *cobra.Command { Use: "updateIdentityProvider", // Aliases: []string{"?"}, Short: "Update the identity provider.", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -905,8 +877,6 @@ func UpdateRoleMappingBuilder() *cobra.Command { Use: "updateRoleMapping", // Aliases: []string{"?"}, Short: "Update One Role Mapping in One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index f1ad65c8a5..99345c3f2b 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -62,8 +62,6 @@ func CreateCustomZoneMappingBuilder() *cobra.Command { Use: "createCustomZoneMapping", // Aliases: []string{"?"}, Short: "Add One Entry to One Custom Zone Mapping", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -125,8 +123,6 @@ func CreateManagedNamespaceBuilder() *cobra.Command { Use: "createManagedNamespace", // Aliases: []string{"?"}, Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -186,8 +182,6 @@ func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { Use: "deleteAllCustomZoneMappings", // Aliases: []string{"?"}, Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -250,8 +244,6 @@ func DeleteManagedNamespaceBuilder() *cobra.Command { Use: "deleteManagedNamespace", // Aliases: []string{"?"}, Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -312,8 +304,6 @@ func GetManagedNamespaceBuilder() *cobra.Command { Use: "getManagedNamespace", // Aliases: []string{"?"}, Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index 52dead929a..b28cc1c859 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -60,8 +60,6 @@ func DownloadInvoiceCSVBuilder() *cobra.Command { Use: "downloadInvoiceCSV", // Aliases: []string{"?"}, Short: "Return One Organization Invoice as CSV", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -120,8 +118,6 @@ func GetInvoiceBuilder() *cobra.Command { Use: "getInvoice", // Aliases: []string{"?"}, Short: "Return One Organization Invoice", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -184,8 +180,6 @@ func ListInvoicesBuilder() *cobra.Command { Use: "listInvoices", // Aliases: []string{"?"}, Short: "Return All Invoices for One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -243,8 +237,6 @@ func ListPendingInvoicesBuilder() *cobra.Command { Use: "listPendingInvoices", // Aliases: []string{"?"}, Short: "Return All Pending Invoices for One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 2bda083a1c..28fc846727 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -58,8 +58,6 @@ func DeleteLDAPConfigurationBuilder() *cobra.Command { Use: "deleteLDAPConfiguration", // Aliases: []string{"?"}, Short: "Remove the Current LDAP User to DN Mapping", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -114,8 +112,6 @@ func GetLDAPConfigurationBuilder() *cobra.Command { Use: "getLDAPConfiguration", // Aliases: []string{"?"}, Short: "Return the Current LDAP or X.509 Configuration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -172,8 +168,6 @@ func GetLDAPConfigurationStatusBuilder() *cobra.Command { Use: "getLDAPConfigurationStatus", // Aliases: []string{"?"}, Short: "Return the Status of One Verify LDAP Configuration Request", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -232,8 +226,6 @@ func SaveLDAPConfigurationBuilder() *cobra.Command { Use: "saveLDAPConfiguration", // Aliases: []string{"?"}, Short: "Edit the LDAP or X.509 Configuration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -291,8 +283,6 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { Use: "verifyLDAPConfiguration", // Aliases: []string{"?"}, Short: "Verify the LDAP Configuration in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index faf057c7f6..310d072882 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -62,8 +62,6 @@ func DeleteLegacySnapshotBuilder() *cobra.Command { Use: "deleteLegacySnapshot", // Aliases: []string{"?"}, Short: "Remove One Legacy Backup Snapshot", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -126,8 +124,6 @@ func GetLegacyBackupCheckpointBuilder() *cobra.Command { Use: "getLegacyBackupCheckpoint", // Aliases: []string{"?"}, Short: "Return One Legacy Backup Checkpoint", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -190,8 +186,6 @@ func GetLegacyBackupRestoreJobBuilder() *cobra.Command { Use: "getLegacyBackupRestoreJob", // Aliases: []string{"?"}, Short: "Return One Legacy Backup Restore Job", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -254,8 +248,6 @@ func GetLegacySnapshotBuilder() *cobra.Command { Use: "getLegacySnapshot", // Aliases: []string{"?"}, Short: "Return One Legacy Backup Snapshot", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -316,8 +308,6 @@ func GetLegacySnapshotScheduleBuilder() *cobra.Command { Use: "getLegacySnapshotSchedule", // Aliases: []string{"?"}, Short: "Return One Snapshot Schedule", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -382,8 +372,6 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { Use: "listLegacyBackupCheckpoints", // Aliases: []string{"?"}, Short: "Return All Legacy Backup Checkpoints", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -453,8 +441,6 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { Use: "listLegacyBackupRestoreJobs", // Aliases: []string{"?"}, Short: "Return All Legacy Backup Restore Jobs", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -525,8 +511,6 @@ func ListLegacySnapshotsBuilder() *cobra.Command { Use: "listLegacySnapshots", // Aliases: []string{"?"}, Short: "Return All Legacy Backup Snapshots", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -593,8 +577,6 @@ func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { Use: "updateLegacySnapshotRetention", // Aliases: []string{"?"}, Short: "Change One Legacy Backup Snapshot Expiration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -658,8 +640,6 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { Use: "updateLegacySnapshotSchedule", // Aliases: []string{"?"}, Short: "Update Snapshot Schedule for One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 317b9bf2a4..8f4850253a 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -62,8 +62,6 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { Use: "createLegacyBackupRestoreJob", // Aliases: []string{"?"}, Short: "Create One Legacy Backup Restore Job", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index 73c4171566..a3ae9f3615 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -58,8 +58,6 @@ func DeferMaintenanceWindowBuilder() *cobra.Command { Use: "deferMaintenanceWindow", // Aliases: []string{"?"}, Short: "Defer One Maintenance Window for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -114,8 +112,6 @@ func GetMaintenanceWindowBuilder() *cobra.Command { Use: "getMaintenanceWindow", // Aliases: []string{"?"}, Short: "Return One Maintenance Window for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -170,8 +166,6 @@ func ResetMaintenanceWindowBuilder() *cobra.Command { Use: "resetMaintenanceWindow", // Aliases: []string{"?"}, Short: "Reset One Maintenance Window for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -226,8 +220,6 @@ func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { Use: "toggleMaintenanceAutoDefer", // Aliases: []string{"?"}, Short: "Toggle Automatic Deferral of Maintenance for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -284,8 +276,6 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { Use: "updateMaintenanceWindow", // Aliases: []string{"?"}, Short: "Update Maintenance Window for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index bae7fe19a9..adf2155e5d 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -58,8 +58,6 @@ func CreateUserBuilder() *cobra.Command { Use: "createUser", // Aliases: []string{"?"}, Short: "Create One MongoDB Cloud User", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -113,8 +111,6 @@ func GetUserBuilder() *cobra.Command { Use: "getUser", // Aliases: []string{"?"}, Short: "Return One MongoDB Cloud User using Its ID", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -169,8 +165,6 @@ func GetUserByUsernameBuilder() *cobra.Command { Use: "getUserByUsername", // Aliases: []string{"?"}, Short: "Return One MongoDB Cloud User using Their Username", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index f2b212e8e5..5774a2246d 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -60,8 +60,6 @@ func GetAtlasProcessBuilder() *cobra.Command { Use: "getAtlasProcess", // Aliases: []string{"?"}, Short: "Return One MongoDB Process by ID", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -122,8 +120,6 @@ func GetDatabaseBuilder() *cobra.Command { Use: "getDatabase", // Aliases: []string{"?"}, Short: "Return One Database for a MongoDB Process", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -196,8 +192,6 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { Use: "getDatabaseMeasurements", // Aliases: []string{"?"}, Short: "Return Measurements of One Database for One MongoDB Process", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -276,8 +270,6 @@ func GetDiskMeasurementsBuilder() *cobra.Command { Use: "getDiskMeasurements", // Aliases: []string{"?"}, Short: "Return Measurements of One Disk for One MongoDB Process", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -350,8 +342,6 @@ func GetHostLogsBuilder() *cobra.Command { Use: "getHostLogs", // Aliases: []string{"?"}, Short: "Download Logs for One Multi-Cloud Cluster Host in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -424,8 +414,6 @@ func GetHostMeasurementsBuilder() *cobra.Command { Use: "getHostMeasurements", // Aliases: []string{"?"}, Short: "Return Measurements for One MongoDB Process", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -506,8 +494,6 @@ func GetIndexMetricsBuilder() *cobra.Command { Use: "getIndexMetrics", // Aliases: []string{"?"}, Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -589,8 +575,6 @@ func GetMeasurementsBuilder() *cobra.Command { Use: "getMeasurements", // Aliases: []string{"?"}, Short: "Return Atlas Search Hardware and Status Metrics", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -660,8 +644,6 @@ func ListAtlasProcessesBuilder() *cobra.Command { Use: "listAtlasProcesses", // Aliases: []string{"?"}, Short: "Return All MongoDB Processes in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -727,8 +709,6 @@ func ListDatabasesBuilder() *cobra.Command { Use: "listDatabases", // Aliases: []string{"?"}, Short: "Return Available Databases for One MongoDB Process", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -792,8 +772,6 @@ func ListDiskMeasurementsBuilder() *cobra.Command { Use: "listDiskMeasurements", // Aliases: []string{"?"}, Short: "Return Measurements of One Disk", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -860,8 +838,6 @@ func ListDiskPartitionsBuilder() *cobra.Command { Use: "listDiskPartitions", // Aliases: []string{"?"}, Short: "Return Available Disks for One MongoDB Process", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -937,8 +913,6 @@ func ListIndexMetricsBuilder() *cobra.Command { Use: "listIndexMetrics", // Aliases: []string{"?"}, Short: "Return All Atlas Search Index Metrics for One Namespace", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1008,8 +982,6 @@ func ListMetricTypesBuilder() *cobra.Command { Use: "listMetricTypes", // Aliases: []string{"?"}, Short: "Return All Atlas Search Metric Types for One Process", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 37128dd1fe..8282f2e736 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -60,8 +60,6 @@ func CreateClusterBuilder() *cobra.Command { Use: "createCluster", // Aliases: []string{"?"}, Short: "Create One Multi-Cloud Cluster from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -121,8 +119,6 @@ func DeleteClusterBuilder() *cobra.Command { Use: "deleteCluster", // Aliases: []string{"?"}, Short: "Remove One Multi-Cloud Cluster from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -182,8 +178,6 @@ func GetClusterBuilder() *cobra.Command { Use: "getCluster", // Aliases: []string{"?"}, Short: "Return One Multi-Cloud Cluster from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -246,8 +240,6 @@ func ListClustersBuilder() *cobra.Command { Use: "listClusters", // Aliases: []string{"?"}, Short: "Return All Multi-Cloud Clusters from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -307,8 +299,6 @@ func TestFailoverBuilder() *cobra.Command { Use: "testFailover", // Aliases: []string{"?"}, Short: "Test Failover for One Multi-Cloud Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -369,8 +359,6 @@ func UpdateClusterBuilder() *cobra.Command { Use: "updateCluster", // Aliases: []string{"?"}, Short: "Modify One Multi-Cloud Cluster from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index ab37bdb647..db36971eb2 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -60,8 +60,6 @@ func CreatePeeringConnectionBuilder() *cobra.Command { Use: "createPeeringConnection", // Aliases: []string{"?"}, Short: "Create One New Network Peering Connection", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -119,8 +117,6 @@ func CreatePeeringContainerBuilder() *cobra.Command { Use: "createPeeringContainer", // Aliases: []string{"?"}, Short: "Create One New Network Peering Container", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -178,8 +174,6 @@ func DeletePeeringConnectionBuilder() *cobra.Command { Use: "deletePeeringConnection", // Aliases: []string{"?"}, Short: "Remove One Existing Network Peering Connection", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -238,8 +232,6 @@ func DeletePeeringContainerBuilder() *cobra.Command { Use: "deletePeeringContainer", // Aliases: []string{"?"}, Short: "Remove One Network Peering Container", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -298,8 +290,6 @@ func DisablePeeringBuilder() *cobra.Command { Use: "disablePeering", // Aliases: []string{"?"}, Short: "Disable Connect via Peering Only Mode for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -357,8 +347,6 @@ func GetPeeringConnectionBuilder() *cobra.Command { Use: "getPeeringConnection", // Aliases: []string{"?"}, Short: "Return One Network Peering Connection in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -417,8 +405,6 @@ func GetPeeringContainerBuilder() *cobra.Command { Use: "getPeeringContainer", // Aliases: []string{"?"}, Short: "Return One Network Peering Container", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -483,8 +469,6 @@ func ListPeeringConnectionsBuilder() *cobra.Command { Use: "listPeeringConnections", // Aliases: []string{"?"}, Short: "Return All Network Peering Connections in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -551,8 +535,6 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { Use: "listPeeringContainerByCloudProvider", // Aliases: []string{"?"}, Short: "Return All Network Peering Containers in One Project for One Cloud Provider", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -618,8 +600,6 @@ func ListPeeringContainersBuilder() *cobra.Command { Use: "listPeeringContainers", // Aliases: []string{"?"}, Short: "Return All Network Peering Containers in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -681,8 +661,6 @@ func UpdatePeeringConnectionBuilder() *cobra.Command { Use: "updatePeeringConnection", // Aliases: []string{"?"}, Short: "Update One New Network Peering Connection", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -744,8 +722,6 @@ func UpdatePeeringContainerBuilder() *cobra.Command { Use: "updatePeeringContainer", // Aliases: []string{"?"}, Short: "Update One Network Peering Container", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -803,8 +779,6 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { Use: "verifyConnectViaPeeringOnlyModeForOneProject", // Aliases: []string{"?"}, Short: "Verify Connect via Peering Only Mode for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index 0042f1e288..299396ea0f 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -62,8 +62,6 @@ func CreateOnlineArchiveBuilder() *cobra.Command { Use: "createOnlineArchive", // Aliases: []string{"?"}, Short: "Create One Online Archive", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -125,8 +123,6 @@ func DeleteOnlineArchiveBuilder() *cobra.Command { Use: "deleteOnlineArchive", // Aliases: []string{"?"}, Short: "Remove One Online Archive", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -193,8 +189,6 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { Use: "downloadOnlineArchiveQueryLogs", // Aliases: []string{"?"}, Short: "Download Online Archive Query Logs", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -258,8 +252,6 @@ func GetOnlineArchiveBuilder() *cobra.Command { Use: "getOnlineArchive", // Aliases: []string{"?"}, Short: "Return One Online Archive", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -326,8 +318,6 @@ func ListOnlineArchivesBuilder() *cobra.Command { Use: "listOnlineArchives", // Aliases: []string{"?"}, Short: "Return All Online Archives for One Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -393,8 +383,6 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { Use: "updateOnlineArchive", // Aliases: []string{"?"}, Short: "Update One Online Archive", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 390dca0189..c50fe8e23b 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -58,8 +58,6 @@ func CreateOrganizationBuilder() *cobra.Command { Use: "createOrganization", // Aliases: []string{"?"}, Short: "Create One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -115,8 +113,6 @@ func CreateOrganizationInvitationBuilder() *cobra.Command { Use: "createOrganizationInvitation", // Aliases: []string{"?"}, Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -172,8 +168,6 @@ func DeleteOrganizationBuilder() *cobra.Command { Use: "deleteOrganization", // Aliases: []string{"?"}, Short: "Remove One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -230,8 +224,6 @@ func DeleteOrganizationInvitationBuilder() *cobra.Command { Use: "deleteOrganizationInvitation", // Aliases: []string{"?"}, Short: "Cancel One Organization Invitation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -288,8 +280,6 @@ func GetOrganizationBuilder() *cobra.Command { Use: "getOrganization", // Aliases: []string{"?"}, Short: "Return One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -346,8 +336,6 @@ func GetOrganizationInvitationBuilder() *cobra.Command { Use: "getOrganizationInvitation", // Aliases: []string{"?"}, Short: "Return One Organization Invitation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -404,8 +392,6 @@ func GetOrganizationSettingsBuilder() *cobra.Command { Use: "getOrganizationSettings", // Aliases: []string{"?"}, Short: "Return Settings for One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -462,8 +448,6 @@ func ListOrganizationInvitationsBuilder() *cobra.Command { Use: "listOrganizationInvitations", // Aliases: []string{"?"}, Short: "Return All Organization Invitations", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -527,8 +511,6 @@ func ListOrganizationProjectsBuilder() *cobra.Command { Use: "listOrganizationProjects", // Aliases: []string{"?"}, Short: "Return One or More Projects in One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -593,8 +575,6 @@ func ListOrganizationUsersBuilder() *cobra.Command { Use: "listOrganizationUsers", // Aliases: []string{"?"}, Short: "Return All MongoDB Cloud Users in One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -658,8 +638,6 @@ func ListOrganizationsBuilder() *cobra.Command { Use: "listOrganizations", // Aliases: []string{"?"}, Short: "Return All Organizations", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -718,8 +696,6 @@ func RenameOrganizationBuilder() *cobra.Command { Use: "renameOrganization", // Aliases: []string{"?"}, Short: "Rename One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -777,8 +753,6 @@ func UpdateOrganizationInvitationBuilder() *cobra.Command { Use: "updateOrganizationInvitation", // Aliases: []string{"?"}, Short: "Update One Organization Invitation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -838,8 +812,6 @@ func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { Use: "updateOrganizationInvitationById", // Aliases: []string{"?"}, Short: "Update One Organization Invitation by Invitation ID", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -899,8 +871,6 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { Use: "updateOrganizationSettings", // Aliases: []string{"?"}, Short: "Update Settings for One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index c3284af567..2b8839b33f 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -58,8 +58,6 @@ func DisableSlowOperationThresholdingBuilder() *cobra.Command { Use: "disableSlowOperationThresholding", // Aliases: []string{"?"}, Short: "Disable Managed Slow Operation Threshold", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -114,8 +112,6 @@ func EnableSlowOperationThresholdingBuilder() *cobra.Command { Use: "enableSlowOperationThresholding", // Aliases: []string{"?"}, Short: "Enable Managed Slow Operation Threshold", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -180,8 +176,6 @@ func ListSlowQueriesBuilder() *cobra.Command { Use: "listSlowQueries", // Aliases: []string{"?"}, Short: "Return Slow Queries", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -248,8 +242,6 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { Use: "listSlowQueryNamespaces", // Aliases: []string{"?"}, Short: "Return All Namespaces for One Host", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -326,8 +318,6 @@ func ListSuggestedIndexesBuilder() *cobra.Command { Use: "listSuggestedIndexes", // Aliases: []string{"?"}, Short: "Return Suggested Indexes", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index f3dfc714ec..12ff57ced0 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -64,8 +64,6 @@ func CreatePrivateEndpointBuilder() *cobra.Command { Use: "createPrivateEndpoint", // Aliases: []string{"?"}, Short: "Create One Private Endpoint for One Provider", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -127,8 +125,6 @@ func CreatePrivateEndpointServiceBuilder() *cobra.Command { Use: "createPrivateEndpointService", // Aliases: []string{"?"}, Short: "Create One Private Endpoint Service for One Provider", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -190,8 +186,6 @@ func DeletePrivateEndpointBuilder() *cobra.Command { Use: "deletePrivateEndpoint", // Aliases: []string{"?"}, Short: "Remove One Private Endpoint for One Provider", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -256,8 +250,6 @@ func DeletePrivateEndpointServiceBuilder() *cobra.Command { Use: "deletePrivateEndpointService", // Aliases: []string{"?"}, Short: "Remove One Private Endpoint Service for One Provider", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -322,8 +314,6 @@ func GetPrivateEndpointBuilder() *cobra.Command { Use: "getPrivateEndpoint", // Aliases: []string{"?"}, Short: "Return One Private Endpoint for One Provider", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -388,8 +378,6 @@ func GetPrivateEndpointServiceBuilder() *cobra.Command { Use: "getPrivateEndpointService", // Aliases: []string{"?"}, Short: "Return One Private Endpoint Service for One Provider", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -448,8 +436,6 @@ func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { Use: "getRegionalizedPrivateEndpointSetting", // Aliases: []string{"?"}, Short: "Return Regionalized Private Endpoint Status", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -506,8 +492,6 @@ func ListPrivateEndpointServicesBuilder() *cobra.Command { Use: "listPrivateEndpointServices", // Aliases: []string{"?"}, Short: "Return All Private Endpoint Services for One Provider", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -566,8 +550,6 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { Use: "toggleRegionalizedPrivateEndpointSetting", // Aliases: []string{"?"}, Short: "Toggle Regionalized Private Endpoint Status", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index fdb9c0ac3f..1f78ea98d0 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -62,8 +62,6 @@ func AddProjectApiKeyBuilder() *cobra.Command { Use: "addProjectApiKey", // Aliases: []string{"?"}, Short: "Assign One Organization API Key to One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -123,8 +121,6 @@ func CreateApiKeyBuilder() *cobra.Command { Use: "createApiKey", // Aliases: []string{"?"}, Short: "Create One Organization API Key", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -190,8 +186,6 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { Use: "createApiKeyAccessList", // Aliases: []string{"?"}, Short: "Create Access List Entries for One Organization API Key", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -254,8 +248,6 @@ func CreateProjectApiKeyBuilder() *cobra.Command { Use: "createProjectApiKey", // Aliases: []string{"?"}, Short: "Create and Assign One Organization API Key to One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -313,8 +305,6 @@ func DeleteApiKeyBuilder() *cobra.Command { Use: "deleteApiKey", // Aliases: []string{"?"}, Short: "Remove One Organization API Key", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -375,8 +365,6 @@ func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { Use: "deleteApiKeyAccessListEntry", // Aliases: []string{"?"}, Short: "Remove One Access List Entry for One Organization API Key", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -437,8 +425,6 @@ func GetApiKeyBuilder() *cobra.Command { Use: "getApiKey", // Aliases: []string{"?"}, Short: "Return One Organization API Key", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -499,8 +485,6 @@ func GetApiKeyAccessListBuilder() *cobra.Command { Use: "getApiKeyAccessList", // Aliases: []string{"?"}, Short: "Return One Access List Entry for One Organization API Key", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -567,8 +551,6 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { Use: "listApiKeyAccessListsEntries", // Aliases: []string{"?"}, Short: "Return All Access List Entries for One Organization API Key", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -634,8 +616,6 @@ func ListApiKeysBuilder() *cobra.Command { Use: "listApiKeys", // Aliases: []string{"?"}, Short: "Return All Organization API Keys", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -699,8 +679,6 @@ func ListProjectApiKeysBuilder() *cobra.Command { Use: "listProjectApiKeys", // Aliases: []string{"?"}, Short: "Return All Organization API Keys Assigned to One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -760,8 +738,6 @@ func RemoveProjectApiKeyBuilder() *cobra.Command { Use: "removeProjectApiKey", // Aliases: []string{"?"}, Short: "Unassign One Organization API Key from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -822,8 +798,6 @@ func UpdateApiKeyBuilder() *cobra.Command { Use: "updateApiKey", // Aliases: []string{"?"}, Short: "Update One Organization API Key", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -891,8 +865,6 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { Use: "updateApiKeyRoles", // Aliases: []string{"?"}, Short: "Update Roles of One Organization API Key to One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index f088087125..2bfb3d67d2 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -66,8 +66,6 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { Use: "createProjectIpAccessList", // Aliases: []string{"?"}, Short: "Add Entries to Project IP Access List", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -128,8 +126,6 @@ func DeleteProjectIpAccessListBuilder() *cobra.Command { Use: "deleteProjectIpAccessList", // Aliases: []string{"?"}, Short: "Remove One Entry from One Project IP Access List", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -188,8 +184,6 @@ func GetProjectIpAccessListStatusBuilder() *cobra.Command { Use: "getProjectIpAccessListStatus", // Aliases: []string{"?"}, Short: "Return Status of One Project IP Access List Entry", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -248,8 +242,6 @@ func GetProjectIpListBuilder() *cobra.Command { Use: "getProjectIpList", // Aliases: []string{"?"}, Short: "Return One Project IP Access List Entry", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -312,8 +304,6 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { Use: "listProjectIpAccessLists", // Aliases: []string{"?"}, Short: "Return Project IP Access List", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 17887de11c..2ae8f18088 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -60,8 +60,6 @@ func CreateProjectBuilder() *cobra.Command { Use: "createProject", // Aliases: []string{"?"}, Short: "Create One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -118,8 +116,6 @@ func CreateProjectInvitationBuilder() *cobra.Command { Use: "createProjectInvitation", // Aliases: []string{"?"}, Short: "Invite One MongoDB Cloud User to Join One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -175,8 +171,6 @@ func DeleteProjectBuilder() *cobra.Command { Use: "deleteProject", // Aliases: []string{"?"}, Short: "Remove One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -233,8 +227,6 @@ func DeleteProjectInvitationBuilder() *cobra.Command { Use: "deleteProjectInvitation", // Aliases: []string{"?"}, Short: "Cancel One Project Invitation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -293,8 +285,6 @@ func DeleteProjectLimitBuilder() *cobra.Command { Use: "deleteProjectLimit", // Aliases: []string{"?"}, Short: "Remove One Project Limit", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -351,8 +341,6 @@ func GetProjectBuilder() *cobra.Command { Use: "getProject", // Aliases: []string{"?"}, Short: "Return One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -407,8 +395,6 @@ func GetProjectByNameBuilder() *cobra.Command { Use: "getProjectByName", // Aliases: []string{"?"}, Short: "Return One Project using Its Name", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -465,8 +451,6 @@ func GetProjectInvitationBuilder() *cobra.Command { Use: "getProjectInvitation", // Aliases: []string{"?"}, Short: "Return One Project Invitation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -525,8 +509,6 @@ func GetProjectLimitBuilder() *cobra.Command { Use: "getProjectLimit", // Aliases: []string{"?"}, Short: "Return One Limit for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -583,8 +565,6 @@ func GetProjectSettingsBuilder() *cobra.Command { Use: "getProjectSettings", // Aliases: []string{"?"}, Short: "Return One Project Settings", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -641,8 +621,6 @@ func ListProjectInvitationsBuilder() *cobra.Command { Use: "listProjectInvitations", // Aliases: []string{"?"}, Short: "Return All Project Invitations", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -698,8 +676,6 @@ func ListProjectLimitsBuilder() *cobra.Command { Use: "listProjectLimits", // Aliases: []string{"?"}, Short: "Return All Limits for One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -764,8 +740,6 @@ func ListProjectUsersBuilder() *cobra.Command { Use: "listProjectUsers", // Aliases: []string{"?"}, Short: "Return All Users in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -829,8 +803,6 @@ func ListProjectsBuilder() *cobra.Command { Use: "listProjects", // Aliases: []string{"?"}, Short: "Return All Projects", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -888,8 +860,6 @@ func RemoveProjectUserBuilder() *cobra.Command { Use: "removeProjectUser", // Aliases: []string{"?"}, Short: "Remove One User from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -950,8 +920,6 @@ func SetProjectLimitBuilder() *cobra.Command { Use: "setProjectLimit", // Aliases: []string{"?"}, Short: "Set One Project Limit", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1011,8 +979,6 @@ func UpdateProjectBuilder() *cobra.Command { Use: "updateProject", // Aliases: []string{"?"}, Short: "Update One Project Name", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1070,8 +1036,6 @@ func UpdateProjectInvitationBuilder() *cobra.Command { Use: "updateProjectInvitation", // Aliases: []string{"?"}, Short: "Update One Project Invitation", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1131,8 +1095,6 @@ func UpdateProjectInvitationByIdBuilder() *cobra.Command { Use: "updateProjectInvitationById", // Aliases: []string{"?"}, Short: "Update One Project Invitation by Invitation ID", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -1192,8 +1154,6 @@ func UpdateProjectSettingsBuilder() *cobra.Command { Use: "updateProjectSettings", // Aliases: []string{"?"}, Short: "Update One Project Settings", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index 68e685e9d0..ba0e571472 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -62,8 +62,6 @@ func CreateRollingIndexBuilder() *cobra.Command { Use: "createRollingIndex", // Aliases: []string{"?"}, Short: "Create One Rolling Index", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index 1db2781f0f..2c8f233f36 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -56,8 +56,6 @@ func GetSystemStatusBuilder() *cobra.Command { Use: "getSystemStatus", // Aliases: []string{"?"}, Short: "Return the status of this MongoDB application", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index 9462312ea2..c15a361602 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -60,8 +60,6 @@ func CreateServerlessInstanceBuilder() *cobra.Command { Use: "createServerlessInstance", // Aliases: []string{"?"}, Short: "Create One Serverless Instance in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -119,8 +117,6 @@ func DeleteServerlessInstanceBuilder() *cobra.Command { Use: "deleteServerlessInstance", // Aliases: []string{"?"}, Short: "Remove One Serverless Instance from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -179,8 +175,6 @@ func GetServerlessInstanceBuilder() *cobra.Command { Use: "getServerlessInstance", // Aliases: []string{"?"}, Short: "Return One Serverless Instance from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -243,8 +237,6 @@ func ListServerlessInstancesBuilder() *cobra.Command { Use: "listServerlessInstances", // Aliases: []string{"?"}, Short: "Return All Serverless Instances from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -306,8 +298,6 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { Use: "updateServerlessInstance", // Aliases: []string{"?"}, Short: "Update One Serverless Instance in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index ddc835516c..f310903daa 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -62,8 +62,6 @@ func CreateServerlessPrivateEndpointBuilder() *cobra.Command { Use: "createServerlessPrivateEndpoint", // Aliases: []string{"?"}, Short: "Create One Private Endpoint for One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -125,8 +123,6 @@ func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { Use: "deleteServerlessPrivateEndpoint", // Aliases: []string{"?"}, Short: "Remove One Private Endpoint for One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -189,8 +185,6 @@ func GetServerlessPrivateEndpointBuilder() *cobra.Command { Use: "getServerlessPrivateEndpoint", // Aliases: []string{"?"}, Short: "Return One Private Endpoint for One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -251,8 +245,6 @@ func ListServerlessPrivateEndpointsBuilder() *cobra.Command { Use: "listServerlessPrivateEndpoints", // Aliases: []string{"?"}, Short: "Return All Private Endpoints for One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -315,8 +307,6 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { Use: "updateServerlessPrivateEndpoint", // Aliases: []string{"?"}, Short: "Update One Private Endpoint for One Serverless Instance", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index e141368db1..c26c843689 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -62,8 +62,6 @@ func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { Use: "createSharedClusterBackupRestoreJob", // Aliases: []string{"?"}, Short: "Create One Restore Job from One M2 or M5 Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -125,8 +123,6 @@ func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { Use: "getSharedClusterBackupRestoreJob", // Aliases: []string{"?"}, Short: "Return One Restore Job for One M2 or M5 Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -187,8 +183,6 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { Use: "listSharedClusterBackupRestoreJobs", // Aliases: []string{"?"}, Short: "Return All Restore Jobs for One M2 or M5 Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index e76cd784ee..25e25612dc 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -62,8 +62,6 @@ func DownloadSharedClusterBackupBuilder() *cobra.Command { Use: "downloadSharedClusterBackup", // Aliases: []string{"?"}, Short: "Download One M2 or M5 Cluster Snapshot", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -125,8 +123,6 @@ func GetSharedClusterBackupBuilder() *cobra.Command { Use: "getSharedClusterBackup", // Aliases: []string{"?"}, Short: "Return One Snapshot for One M2 or M5 Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -187,8 +183,6 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { Use: "listSharedClusterBackups", // Aliases: []string{"?"}, Short: "Return All Snapshots for One M2 or M5 Cluster", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 356c623abb..5ea5cc6ec2 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -60,8 +60,6 @@ func AddAllTeamsToProjectBuilder() *cobra.Command { Use: "addAllTeamsToProject", // Aliases: []string{"?"}, Short: "Add One or More Teams to One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -121,8 +119,6 @@ func AddTeamUserBuilder() *cobra.Command { Use: "addTeamUser", // Aliases: []string{"?"}, Short: "Assign MongoDB Cloud Users from One Organization to One Team", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -182,8 +178,6 @@ func CreateTeamBuilder() *cobra.Command { Use: "createTeam", // Aliases: []string{"?"}, Short: "Create One Team in One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -241,8 +235,6 @@ func DeleteTeamBuilder() *cobra.Command { Use: "deleteTeam", // Aliases: []string{"?"}, Short: "Remove One Team from One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -301,8 +293,6 @@ func GetTeamByIdBuilder() *cobra.Command { Use: "getTeamById", // Aliases: []string{"?"}, Short: "Return One Team using its ID", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -361,8 +351,6 @@ func GetTeamByNameBuilder() *cobra.Command { Use: "getTeamByName", // Aliases: []string{"?"}, Short: "Return One Team using its Name", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -425,8 +413,6 @@ func ListOrganizationTeamsBuilder() *cobra.Command { Use: "listOrganizationTeams", // Aliases: []string{"?"}, Short: "Return All Teams in One Organization", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -490,8 +476,6 @@ func ListProjectTeamsBuilder() *cobra.Command { Use: "listProjectTeams", // Aliases: []string{"?"}, Short: "Return All Teams in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -555,8 +539,6 @@ func ListTeamUsersBuilder() *cobra.Command { Use: "listTeamUsers", // Aliases: []string{"?"}, Short: "Return All MongoDB Cloud Users Assigned to One Team", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -617,8 +599,6 @@ func RemoveProjectTeamBuilder() *cobra.Command { Use: "removeProjectTeam", // Aliases: []string{"?"}, Short: "Remove One Team from One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -679,8 +659,6 @@ func RemoveTeamUserBuilder() *cobra.Command { Use: "removeTeamUser", // Aliases: []string{"?"}, Short: "Remove One MongoDB Cloud User from One Team", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -743,8 +721,6 @@ func RenameTeamBuilder() *cobra.Command { Use: "renameTeam", // Aliases: []string{"?"}, Short: "Rename One Team", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -806,8 +782,6 @@ func UpdateTeamRolesBuilder() *cobra.Command { Use: "updateTeamRoles", // Aliases: []string{"?"}, Short: "Update Team Roles in One Project", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index 60edbfc0cf..f5f9c649dc 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -58,8 +58,6 @@ func VersionedExampleBuilder() *cobra.Command { Use: "versionedExample", // Aliases: []string{"?"}, Short: "Example resource info for versioning of the Atlas API", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index d8a340de4d..7302453ad8 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -68,8 +68,6 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { Use: "createThirdPartyIntegration", // Aliases: []string{"?"}, Short: "Configure One Third-Party Service Integration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -132,8 +130,6 @@ func DeleteThirdPartyIntegrationBuilder() *cobra.Command { Use: "deleteThirdPartyIntegration", // Aliases: []string{"?"}, Short: "Remove One Third-Party Service Integration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -192,8 +188,6 @@ func GetThirdPartyIntegrationBuilder() *cobra.Command { Use: "getThirdPartyIntegration", // Aliases: []string{"?"}, Short: "Return One Third-Party Service Integration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -256,8 +250,6 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { Use: "listThirdPartyIntegrations", // Aliases: []string{"?"}, Short: "Return All Active Third-Party Service Integrations", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -325,8 +317,6 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { Use: "updateThirdPartyIntegration", // Aliases: []string{"?"}, Short: "Update One Third-Party Service Integration", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 6799ca4a6b..156b0283be 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -62,8 +62,6 @@ func CreateDatabaseUserCertificateBuilder() *cobra.Command { Use: "createDatabaseUserCertificate", // Aliases: []string{"?"}, Short: "Create One X.509 Certificate for One MongoDB User", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -121,8 +119,6 @@ func DisableCustomerManagedX509Builder() *cobra.Command { Use: "disableCustomerManagedX509", // Aliases: []string{"?"}, Short: "Disable Customer-Managed X.509", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, @@ -185,8 +181,6 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { Use: "listDatabaseUserCertificates", // Aliases: []string{"?"}, Short: "Return All X.509 Certificates Assigned to One MongoDB User", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index a75dcb8bd0..5f62f954f9 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -49,8 +49,6 @@ func {{operationId}}Builder() *cobra.Command { Use: "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}", // Aliases: []string{"?"}, Short: "{{ summary }}", - Long: fmt.Sprintf(usage.RequiredRole, "Project Read Only"), // how to tell? - Args: require.NoArgs, Annotations: map[string]string{ "output": template, }, From af57e130c98cac33ef77af6dc422839e223cfa97 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 2 Jun 2023 11:30:37 +0100 Subject: [PATCH 15/44] fix for slices --- internal/generated/api_access_tracking_cmd.go | 2 -- .../generated/api_alert_configurations_cmd.go | 8 ----- internal/generated/api_alerts_cmd.go | 4 --- internal/generated/api_atlas_search_cmd.go | 5 ---- internal/generated/api_auditing_cmd.go | 2 -- .../generated/api_aws_clusters_dns_cmd.go | 2 -- internal/generated/api_cloud_backups_cmd.go | 29 ------------------- .../api_cloud_migration_service_cmd.go | 8 ----- .../api_cloud_provider_access_cmd.go | 5 ---- .../api_cluster_outage_simulation_cmd.go | 3 -- internal/generated/api_clusters_cmd.go | 11 +------ .../api_custom_database_roles_cmd.go | 5 ---- internal/generated/api_data_federation_cmd.go | 14 --------- .../generated/api_data_lake_pipelines_cmd.go | 13 --------- internal/generated/api_database_users_cmd.go | 5 ---- ..._rest_using_customer_key_management_cmd.go | 2 -- internal/generated/api_events_cmd.go | 10 ++----- .../api_federated_authentication_cmd.go | 15 ---------- internal/generated/api_global_clusters_cmd.go | 5 ---- internal/generated/api_invoices_cmd.go | 4 --- .../generated/api_ldap_configuration_cmd.go | 5 ---- internal/generated/api_legacy_backup_cmd.go | 10 ------- .../api_legacy_backup_restore_jobs_cmd.go | 1 - .../generated/api_maintenance_windows__cmd.go | 5 ---- .../generated/api_mongo_db_cloud_users_cmd.go | 3 -- .../generated/api_monitoring_and_logs_cmd.go | 26 ++++------------- .../generated/api_multi_cloud_clusters_cmd.go | 6 ---- internal/generated/api_network_peering_cmd.go | 13 --------- internal/generated/api_online_archive_cmd.go | 6 ---- internal/generated/api_organizations_cmd.go | 15 ---------- .../generated/api_performance_advisor_cmd.go | 9 ++---- .../api_private_endpoint_services_cmd.go | 9 ------ .../api_programmatic_api_keys_cmd.go | 14 --------- .../api_project_ip_access_list_cmd.go | 5 ---- internal/generated/api_projects_cmd.go | 20 ------------- internal/generated/api_rolling_index_cmd.go | 1 - internal/generated/api_root_cmd.go | 1 - .../generated/api_serverless_instances_cmd.go | 5 ---- .../api_serverless_private_endpoints_cmd.go | 5 ---- .../api_shared_tier_restore_jobs_cmd.go | 3 -- .../api_shared_tier_snapshots_cmd.go | 3 -- internal/generated/api_teams_cmd.go | 13 --------- internal/generated/api_test__cmd.go | 1 - .../api_third_party_integrations_cmd.go | 5 ---- .../generated/api_x509_authentication_cmd.go | 3 -- .../config/go-templates/cmd.mustache | 3 +- 46 files changed, 13 insertions(+), 329 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index c5fb54a061..ed66fa8364 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -75,7 +75,6 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -148,7 +147,6 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index a547729919..57df131558 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -65,7 +65,6 @@ func CreateAlertConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -122,7 +121,6 @@ func DeleteAlertConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -180,7 +178,6 @@ func GetAlertConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -234,7 +231,6 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -292,7 +288,6 @@ func ListAlertConfigurationsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -357,7 +352,6 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -420,7 +414,6 @@ func ToggleAlertConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -481,7 +474,6 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 701080dea0..96f8f53442 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -67,7 +67,6 @@ func AcknowledgeAlertBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -126,7 +125,6 @@ func GetAlertBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -190,7 +188,6 @@ func ListAlertsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -256,7 +253,6 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index 394f556319..7f109e451e 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -67,7 +67,6 @@ func CreateAtlasSearchIndexBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -128,7 +127,6 @@ func DeleteAtlasSearchIndexBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -190,7 +188,6 @@ func GetAtlasSearchIndexBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -254,7 +251,6 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -320,7 +316,6 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index a78081b24e..1d54a121c4 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -63,7 +63,6 @@ func GetAuditingConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -119,7 +118,6 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 794b0ced95..26985fc5e6 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -63,7 +63,6 @@ func GetAWSCustomDNSBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -119,7 +118,6 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index bf29ffb3d8..195bc6d1de 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -67,7 +67,6 @@ func CancelBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -129,7 +128,6 @@ func CreateBackupExportJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -190,7 +188,6 @@ func CreateBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -249,7 +246,6 @@ func CreateExportBucketBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -308,7 +304,6 @@ func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -367,7 +362,6 @@ func DeleteAllBackupSchedulesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -425,7 +419,6 @@ func DeleteExportBucketBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -485,7 +478,6 @@ func DeleteReplicaSetBackupBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -547,7 +539,6 @@ func DeleteShardedClusterBackupBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -609,7 +600,6 @@ func GetBackupExportJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -671,7 +661,6 @@ func GetBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -731,7 +720,6 @@ func GetBackupScheduleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -787,7 +775,6 @@ func GetDataProtectionSettingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -843,7 +830,6 @@ func GetExportBucketBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -903,7 +889,6 @@ func GetReplicaSetBackupBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -965,7 +950,6 @@ func GetServerlessBackupBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1027,7 +1011,6 @@ func GetServerlessBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1089,7 +1072,6 @@ func GetShardedClusterBackupBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1155,7 +1137,6 @@ func ListBackupExportJobsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1222,7 +1203,6 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1287,7 +1267,6 @@ func ListExportBucketsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1352,7 +1331,6 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1419,7 +1397,6 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1486,7 +1463,6 @@ func ListServerlessBackupsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1547,7 +1523,6 @@ func ListShardedClusterBackupsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1607,7 +1582,6 @@ func TakeSnapshotBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1668,7 +1642,6 @@ func UpdateBackupScheduleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1727,7 +1700,6 @@ func UpdateDataProtectionSettingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1788,7 +1760,6 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index 74016d4574..981d04e654 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -65,7 +65,6 @@ func CreateLinkTokenBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -122,7 +121,6 @@ func CreatePushMigrationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -179,7 +177,6 @@ func CutoverMigrationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -235,7 +232,6 @@ func DeleteLinkTokenBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -291,7 +287,6 @@ func GetPushMigrationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -349,7 +344,6 @@ func GetValidationStatusBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -405,7 +399,6 @@ func ListSourceProjectsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -461,7 +454,6 @@ func ValidateMigrationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index 0d8fa16cbb..eea114a056 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -67,7 +67,6 @@ func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -126,7 +125,6 @@ func CreateCloudProviderAccessRoleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -185,7 +183,6 @@ func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -245,7 +242,6 @@ func GetCloudProviderAccessRoleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -301,7 +297,6 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 23df1e4ca1..351304ef70 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -65,7 +65,6 @@ func EndOutageSimulationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -123,7 +122,6 @@ func GetOutageSimulationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -183,7 +181,6 @@ func StartOutageSimulationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index f01f14e113..cea6cd4431 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -65,7 +65,6 @@ func GetClusterAdvancedConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -123,7 +122,6 @@ func GetClusterStatusBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -181,7 +179,6 @@ func GetSampleDatasetLoadStatusBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -247,7 +244,6 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -260,7 +256,7 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().[]stringVar(&opts.providers, "providers", , "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") + cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") cmd.Flags().StringVar(&opts.tier, "tier", "", "Cluster tier for which to retrieve the regions.") _ = cmd.MarkFlagRequired("groupId") @@ -310,7 +306,6 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -367,7 +362,6 @@ func LoadSampleDatasetBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -427,7 +421,6 @@ func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -486,7 +479,6 @@ func UpgradeSharedClusterBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -543,7 +535,6 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index 8a800095ca..f090aeda27 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -65,7 +65,6 @@ func CreateCustomDatabaseRoleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -122,7 +121,6 @@ func DeleteCustomDatabaseRoleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -180,7 +178,6 @@ func GetCustomDatabaseRoleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -236,7 +233,6 @@ func ListCustomDatabaseRolesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -294,7 +290,6 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index 994f651c2a..de68291626 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -65,7 +65,6 @@ func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -124,7 +123,6 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -186,7 +184,6 @@ func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -247,7 +244,6 @@ func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -305,7 +301,6 @@ func DeleteFederatedDatabaseBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -365,7 +360,6 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -429,7 +423,6 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -489,7 +482,6 @@ func GetDataFederationPrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -547,7 +539,6 @@ func GetFederatedDatabaseBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -609,7 +600,6 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -668,7 +658,6 @@ func ListFederatedDatabasesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -727,7 +716,6 @@ func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -787,7 +775,6 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -849,7 +836,6 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 64333d73e4..989deddee8 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -65,7 +65,6 @@ func CreatePipelineBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -122,7 +121,6 @@ func DeletePipelineBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -182,7 +180,6 @@ func DeletePipelineRunDatasetBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -242,7 +239,6 @@ func GetPipelineBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -302,7 +298,6 @@ func GetPipelineRunBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -370,7 +365,6 @@ func ListPipelineRunsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -432,7 +426,6 @@ func ListPipelineSchedulesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -498,7 +491,6 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -558,7 +550,6 @@ func ListPipelinesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -614,7 +605,6 @@ func PausePipelineBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -672,7 +662,6 @@ func ResumePipelineBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -732,7 +721,6 @@ func TriggerSnapshotIngestionBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -793,7 +781,6 @@ func UpdatePipelineBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 2407bb5df3..27bd186b68 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -65,7 +65,6 @@ func CreateDatabaseUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -124,7 +123,6 @@ func DeleteDatabaseUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -186,7 +184,6 @@ func GetDatabaseUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -250,7 +247,6 @@ func ListDatabaseUsersBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -313,7 +309,6 @@ func UpdateDatabaseUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index 7100d507ba..ec6562531e 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -63,7 +63,6 @@ func GetEncryptionAtRestBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -119,7 +118,6 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 21e98f0ae1..9b073ca4ae 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -67,7 +67,6 @@ func GetOrganizationEventBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -128,7 +127,6 @@ func GetProjectEventBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -199,7 +197,6 @@ func ListOrganizationEventsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -212,7 +209,7 @@ func ListOrganizationEventsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().[]stringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") + cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") cmd.Flags().Time.TimeVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") cmd.Flags().Time.TimeVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") @@ -276,7 +273,6 @@ func ListProjectEventsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -289,8 +285,8 @@ func ListProjectEventsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().[]stringVar(&opts.clusterNames, "clusterNames", , "Human-readable label that identifies the cluster.") - cmd.Flags().[]stringVar(&opts.eventType, "eventType", , "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") + cmd.Flags().StringSliceVar(&opts.clusterNames, "clusterNames", nil, "Human-readable label that identifies the cluster.") + cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") cmd.Flags().Time.TimeVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") cmd.Flags().Time.TimeVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index 3ed3b9988f..7da9b7f569 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -67,7 +67,6 @@ func CreateRoleMappingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -124,7 +123,6 @@ func DeleteFederationAppBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -182,7 +180,6 @@ func DeleteRoleMappingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -242,7 +239,6 @@ func GetConnectedOrgConfigBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -298,7 +294,6 @@ func GetFederationSettingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -354,7 +349,6 @@ func GetIdentityProviderBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -412,7 +406,6 @@ func GetIdentityProviderMetadataBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -472,7 +465,6 @@ func GetRoleMappingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -530,7 +522,6 @@ func ListConnectedOrgConfigsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -584,7 +575,6 @@ func ListIdentityProvidersBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -640,7 +630,6 @@ func ListRoleMappingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -698,7 +687,6 @@ func RemoveConnectedOrgConfigBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -758,7 +746,6 @@ func UpdateConnectedOrgConfigBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -819,7 +806,6 @@ func UpdateIdentityProviderBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -882,7 +868,6 @@ func UpdateRoleMappingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index 99345c3f2b..72dae2addf 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -67,7 +67,6 @@ func CreateCustomZoneMappingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -128,7 +127,6 @@ func CreateManagedNamespaceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -187,7 +185,6 @@ func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -249,7 +246,6 @@ func DeleteManagedNamespaceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -309,7 +305,6 @@ func GetManagedNamespaceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index b28cc1c859..0d19e8abae 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -65,7 +65,6 @@ func DownloadInvoiceCSVBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -123,7 +122,6 @@ func GetInvoiceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -185,7 +183,6 @@ func ListInvoicesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -242,7 +239,6 @@ func ListPendingInvoicesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 28fc846727..c5ac15c6ed 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -63,7 +63,6 @@ func DeleteLDAPConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -117,7 +116,6 @@ func GetLDAPConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -173,7 +171,6 @@ func GetLDAPConfigurationStatusBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -231,7 +228,6 @@ func SaveLDAPConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -288,7 +284,6 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index 310d072882..eff41b027d 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -67,7 +67,6 @@ func DeleteLegacySnapshotBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -129,7 +128,6 @@ func GetLegacyBackupCheckpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -191,7 +189,6 @@ func GetLegacyBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -253,7 +250,6 @@ func GetLegacySnapshotBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -313,7 +309,6 @@ func GetLegacySnapshotScheduleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -377,7 +372,6 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -446,7 +440,6 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -516,7 +509,6 @@ func ListLegacySnapshotsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -582,7 +574,6 @@ func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -645,7 +636,6 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 8f4850253a..aa69c5129a 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -67,7 +67,6 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index a3ae9f3615..4a96fd1e2f 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -63,7 +63,6 @@ func DeferMaintenanceWindowBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -117,7 +116,6 @@ func GetMaintenanceWindowBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -171,7 +169,6 @@ func ResetMaintenanceWindowBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -225,7 +222,6 @@ func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -281,7 +277,6 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index adf2155e5d..7beb73454b 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -63,7 +63,6 @@ func CreateUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -116,7 +115,6 @@ func GetUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -170,7 +168,6 @@ func GetUserByUsernameBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index 5774a2246d..ce9e814519 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -65,7 +65,6 @@ func GetAtlasProcessBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -125,7 +124,6 @@ func GetDatabaseBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -197,7 +195,6 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -210,7 +207,7 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database that the specified MongoDB process serves.") cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") @@ -275,7 +272,6 @@ func GetDiskMeasurementsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -288,7 +284,7 @@ func GetDiskMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "Human-readable label of the disk or partition to which the measurements apply.") cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") @@ -347,7 +343,6 @@ func GetHostLogsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -419,7 +414,6 @@ func GetHostMeasurementsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -431,7 +425,7 @@ func GetHostMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().[]stringVar(&opts.m, "m", , "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") + cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") @@ -499,7 +493,6 @@ func GetIndexMetricsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -514,7 +507,7 @@ func GetIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "Human-readable label that identifies the collection.") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the measurements that MongoDB Atlas reports for the associated data series.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") @@ -580,7 +573,6 @@ func GetMeasurementsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -592,7 +584,7 @@ func GetMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") + cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") @@ -649,7 +641,6 @@ func ListAtlasProcessesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -714,7 +705,6 @@ func ListDatabasesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -777,7 +767,6 @@ func ListDiskMeasurementsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -843,7 +832,6 @@ func ListDiskPartitionsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -918,7 +906,6 @@ func ListIndexMetricsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -932,7 +919,7 @@ func ListIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "Human-readable label that identifies the collection.") cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().[]stringVar(&opts.metrics, "metrics", , "List that contains the measurements that MongoDB Atlas reports for the associated data series.") + cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the measurements that MongoDB Atlas reports for the associated data series.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") @@ -987,7 +974,6 @@ func ListMetricTypesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 8282f2e736..08abf3e6b9 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -65,7 +65,6 @@ func CreateClusterBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -124,7 +123,6 @@ func DeleteClusterBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -183,7 +181,6 @@ func GetClusterBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -245,7 +242,6 @@ func ListClustersBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -304,7 +300,6 @@ func TestFailoverBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -364,7 +359,6 @@ func UpdateClusterBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index db36971eb2..7dd325abd3 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -65,7 +65,6 @@ func CreatePeeringConnectionBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -122,7 +121,6 @@ func CreatePeeringContainerBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -179,7 +177,6 @@ func DeletePeeringConnectionBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -237,7 +234,6 @@ func DeletePeeringContainerBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -295,7 +291,6 @@ func DisablePeeringBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -352,7 +347,6 @@ func GetPeeringConnectionBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -410,7 +404,6 @@ func GetPeeringContainerBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -474,7 +467,6 @@ func ListPeeringConnectionsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -540,7 +532,6 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -605,7 +596,6 @@ func ListPeeringContainersBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -666,7 +656,6 @@ func UpdatePeeringConnectionBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -727,7 +716,6 @@ func UpdatePeeringContainerBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -784,7 +772,6 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index 299396ea0f..e7b98bd260 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -67,7 +67,6 @@ func CreateOnlineArchiveBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -128,7 +127,6 @@ func DeleteOnlineArchiveBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -194,7 +192,6 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -257,7 +254,6 @@ func GetOnlineArchiveBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -323,7 +319,6 @@ func ListOnlineArchivesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -388,7 +383,6 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index c50fe8e23b..84cabbfabc 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -63,7 +63,6 @@ func CreateOrganizationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -118,7 +117,6 @@ func CreateOrganizationInvitationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -173,7 +171,6 @@ func DeleteOrganizationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -229,7 +226,6 @@ func DeleteOrganizationInvitationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -285,7 +281,6 @@ func GetOrganizationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -341,7 +336,6 @@ func GetOrganizationInvitationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -397,7 +391,6 @@ func GetOrganizationSettingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -453,7 +446,6 @@ func ListOrganizationInvitationsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -516,7 +508,6 @@ func ListOrganizationProjectsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -580,7 +571,6 @@ func ListOrganizationUsersBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -643,7 +633,6 @@ func ListOrganizationsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -701,7 +690,6 @@ func RenameOrganizationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -758,7 +746,6 @@ func UpdateOrganizationInvitationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -817,7 +804,6 @@ func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -876,7 +862,6 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index 2b8839b33f..e8e2bfee8b 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -63,7 +63,6 @@ func DisableSlowOperationThresholdingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -117,7 +116,6 @@ func EnableSlowOperationThresholdingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -181,7 +179,6 @@ func ListSlowQueriesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -193,7 +190,7 @@ func ListSlowQueriesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") cmd.Flags().Int64Var(&opts.duration, "duration", 0, "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().[]stringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") + cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") cmd.Flags().Int64Var(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") cmd.Flags().Int64Var(&opts.since, "since", 0, "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") @@ -247,7 +244,6 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -323,7 +319,6 @@ func ListSuggestedIndexesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -338,7 +333,7 @@ func ListSuggestedIndexesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().Int64Var(&opts.duration, "duration", 0, "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().[]stringVar(&opts.namespaces, "namespaces", , "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") + cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") cmd.Flags().Int64Var(&opts.nExamples, "nExamples", 5, "Maximum number of example queries that benefit from the suggested index.") cmd.Flags().Int64Var(&opts.nIndexes, "nIndexes", 0, "Number that indicates the maximum indexes to suggest.") cmd.Flags().Int64Var(&opts.since, "since", 0, "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index 12ff57ced0..6d1ebbe632 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -69,7 +69,6 @@ func CreatePrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -130,7 +129,6 @@ func CreatePrivateEndpointServiceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -191,7 +189,6 @@ func DeletePrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -255,7 +252,6 @@ func DeletePrivateEndpointServiceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -319,7 +315,6 @@ func GetPrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -383,7 +378,6 @@ func GetPrivateEndpointServiceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -441,7 +435,6 @@ func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -497,7 +490,6 @@ func ListPrivateEndpointServicesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -555,7 +547,6 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 1f78ea98d0..619c9fbda3 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -67,7 +67,6 @@ func AddProjectApiKeyBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -126,7 +125,6 @@ func CreateApiKeyBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -191,7 +189,6 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -253,7 +250,6 @@ func CreateProjectApiKeyBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -310,7 +306,6 @@ func DeleteApiKeyBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -370,7 +365,6 @@ func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -430,7 +424,6 @@ func GetApiKeyBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -490,7 +483,6 @@ func GetApiKeyAccessListBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -556,7 +548,6 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -621,7 +612,6 @@ func ListApiKeysBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -684,7 +674,6 @@ func ListProjectApiKeysBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -743,7 +732,6 @@ func RemoveProjectApiKeyBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -803,7 +791,6 @@ func UpdateApiKeyBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -870,7 +857,6 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 2bfb3d67d2..8f6011e20f 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -71,7 +71,6 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -131,7 +130,6 @@ func DeleteProjectIpAccessListBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -189,7 +187,6 @@ func GetProjectIpAccessListStatusBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -247,7 +244,6 @@ func GetProjectIpListBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -309,7 +305,6 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 2ae8f18088..f57bd76f5d 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -65,7 +65,6 @@ func CreateProjectBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -121,7 +120,6 @@ func CreateProjectInvitationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -176,7 +174,6 @@ func DeleteProjectBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -232,7 +229,6 @@ func DeleteProjectInvitationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -290,7 +286,6 @@ func DeleteProjectLimitBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -346,7 +341,6 @@ func GetProjectBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -400,7 +394,6 @@ func GetProjectByNameBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -456,7 +449,6 @@ func GetProjectInvitationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -514,7 +506,6 @@ func GetProjectLimitBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -570,7 +561,6 @@ func GetProjectSettingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -626,7 +616,6 @@ func ListProjectInvitationsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -681,7 +670,6 @@ func ListProjectLimitsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -745,7 +733,6 @@ func ListProjectUsersBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -808,7 +795,6 @@ func ListProjectsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -865,7 +851,6 @@ func RemoveProjectUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -925,7 +910,6 @@ func SetProjectLimitBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -984,7 +968,6 @@ func UpdateProjectBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1041,7 +1024,6 @@ func UpdateProjectInvitationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1100,7 +1082,6 @@ func UpdateProjectInvitationByIdBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -1159,7 +1140,6 @@ func UpdateProjectSettingsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index ba0e571472..a5dba2f393 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -67,7 +67,6 @@ func CreateRollingIndexBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index 2c8f233f36..d9c8ed7e7f 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -61,7 +61,6 @@ func GetSystemStatusBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index c15a361602..c5f25cf9be 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -65,7 +65,6 @@ func CreateServerlessInstanceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -122,7 +121,6 @@ func DeleteServerlessInstanceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -180,7 +178,6 @@ func GetServerlessInstanceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -242,7 +239,6 @@ func ListServerlessInstancesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -303,7 +299,6 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index f310903daa..e5d211ac7e 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -67,7 +67,6 @@ func CreateServerlessPrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -128,7 +127,6 @@ func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -190,7 +188,6 @@ func GetServerlessPrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -250,7 +247,6 @@ func ListServerlessPrivateEndpointsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -312,7 +308,6 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index c26c843689..5e7be7dd0f 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -67,7 +67,6 @@ func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -128,7 +127,6 @@ func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -188,7 +186,6 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index 25e25612dc..b19754a4f9 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -67,7 +67,6 @@ func DownloadSharedClusterBackupBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -128,7 +127,6 @@ func GetSharedClusterBackupBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -188,7 +186,6 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 5ea5cc6ec2..4f9532c3d2 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -65,7 +65,6 @@ func AddAllTeamsToProjectBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -124,7 +123,6 @@ func AddTeamUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -183,7 +181,6 @@ func CreateTeamBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -240,7 +237,6 @@ func DeleteTeamBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -298,7 +294,6 @@ func GetTeamByIdBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -356,7 +351,6 @@ func GetTeamByNameBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -418,7 +412,6 @@ func ListOrganizationTeamsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -481,7 +474,6 @@ func ListProjectTeamsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -544,7 +536,6 @@ func ListTeamUsersBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -604,7 +595,6 @@ func RemoveProjectTeamBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -664,7 +654,6 @@ func RemoveTeamUserBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -726,7 +715,6 @@ func RenameTeamBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -787,7 +775,6 @@ func UpdateTeamRolesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index f5f9c649dc..4bb696e80c 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -63,7 +63,6 @@ func VersionedExampleBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index 7302453ad8..45a9a7d03a 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -73,7 +73,6 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -135,7 +134,6 @@ func DeleteThirdPartyIntegrationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -193,7 +191,6 @@ func GetThirdPartyIntegrationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -255,7 +252,6 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -322,7 +318,6 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 156b0283be..8546fbb647 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -67,7 +67,6 @@ func CreateDatabaseUserCertificateBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -124,7 +123,6 @@ func DisableCustomerManagedX509Builder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -186,7 +184,6 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 5f62f954f9..8e7bad770e 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -54,7 +54,6 @@ func {{operationId}}Builder() *cobra.Command { }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( - //opts.ValidateProjectID, opts.initClient(), opts.InitOutput(cmd.OutOrStdout(), template), ) @@ -64,7 +63,7 @@ func {{operationId}}Builder() *cobra.Command { }, } {{#allParams}} - {{^isBodyParam}}cmd.Flags().{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isString}}"{{/isString}}{{^defaultValue}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, "{{description}}"){{/isBodyParam}} + {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, "{{description}}"){{/isBodyParam}} {{/allParams}} {{#allParams}}{{^isBodyParam}}{{#required}} _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/isBodyParam}}{{/allParams}} From ea04153fcb505c5b21d35acb67157ba71a58861d Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 2 Jun 2023 11:49:05 +0100 Subject: [PATCH 16/44] cover dateTime --- internal/generated/api_access_tracking_cmd.go | 33 ++-- .../generated/api_alert_configurations_cmd.go | 55 +++--- internal/generated/api_alerts_cmd.go | 37 ++-- internal/generated/api_atlas_search_cmd.go | 28 ++- internal/generated/api_auditing_cmd.go | 13 +- .../generated/api_aws_clusters_dns_cmd.go | 13 +- internal/generated/api_cloud_backups_cmd.go | 184 ++++++++--------- .../api_cloud_migration_service_cmd.go | 43 ++-- .../api_cloud_provider_access_cmd.go | 28 ++- .../api_cluster_outage_simulation_cmd.go | 18 +- internal/generated/api_clusters_cmd.go | 64 +++--- .../api_custom_database_roles_cmd.go | 28 ++- internal/generated/api_data_federation_cmd.go | 87 ++++---- .../generated/api_data_lake_pipelines_cmd.go | 92 ++++----- internal/generated/api_database_users_cmd.go | 34 ++-- ..._rest_using_customer_key_management_cmd.go | 13 +- internal/generated/api_events_cmd.go | 73 ++++--- .../api_federated_authentication_cmd.go | 78 ++++---- internal/generated/api_global_clusters_cmd.go | 32 ++- internal/generated/api_invoices_cmd.go | 29 ++- .../generated/api_ldap_configuration_cmd.go | 28 ++- internal/generated/api_legacy_backup_cmd.go | 75 ++++--- .../api_legacy_backup_restore_jobs_cmd.go | 8 +- .../generated/api_maintenance_windows__cmd.go | 28 ++- .../generated/api_mongo_db_cloud_users_cmd.go | 18 +- .../generated/api_monitoring_and_logs_cmd.go | 185 ++++++++---------- .../generated/api_multi_cloud_clusters_cmd.go | 41 ++-- internal/generated/api_network_peering_cmd.go | 88 ++++----- internal/generated/api_online_archive_cmd.go | 45 ++--- internal/generated/api_organizations_cmd.go | 102 +++++----- .../generated/api_performance_advisor_cmd.go | 56 +++--- .../api_private_endpoint_services_cmd.go | 48 ++--- .../api_programmatic_api_keys_cmd.go | 103 +++++----- .../api_project_ip_access_list_cmd.go | 40 ++-- internal/generated/api_projects_cmd.go | 123 +++++------- internal/generated/api_rolling_index_cmd.go | 8 +- internal/generated/api_root_cmd.go | 8 +- .../generated/api_serverless_instances_cmd.go | 34 ++-- .../api_serverless_private_endpoints_cmd.go | 28 ++- .../api_shared_tier_restore_jobs_cmd.go | 18 +- .../api_shared_tier_snapshots_cmd.go | 18 +- internal/generated/api_teams_cmd.go | 84 ++++---- internal/generated/api_test__cmd.go | 10 +- .../api_third_party_integrations_cmd.go | 46 +++-- .../generated/api_x509_authentication_cmd.go | 24 +-- internal/generated/generated.go | 12 ++ .../config/go-templates/cmd.mustache | 12 +- .../config/go-templates/generated.mustache | 12 ++ tools/openapi-generator/package.json | 2 +- 49 files changed, 1066 insertions(+), 1220 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index ed66fa8364..2fc63d6317 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -48,11 +51,11 @@ func (opts *ListAccessLogsByClusterNameOpts) Run(ctx context.Context) error { params := &admin.ListAccessLogsByClusterNameApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - AuthResult: opts.authResult, - End: opts.end, - IpAddress: opts.ipAddress, - NLogs: opts.nLogs, - Start: opts.start, + AuthResult: &opts.authResult, + End: &opts.end, + IpAddress: &opts.ipAddress, + NLogs: &opts.nLogs, + Start: &opts.start, } resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(ctx, params).Execute() if err != nil { @@ -67,9 +70,8 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { opts := ListAccessLogsByClusterNameOpts{} cmd := &cobra.Command{ - Use: "listAccessLogsByClusterName", - // Aliases: []string{"?"}, - Short: "Return Database Access History for One Cluster using Its Cluster Name", + Use: "listAccessLogsByClusterName", + Short: "Return Database Access History for One Cluster using Its Cluster Name", Annotations: map[string]string{ "output": template, }, @@ -120,11 +122,11 @@ func (opts *ListAccessLogsByHostnameOpts) Run(ctx context.Context) error { params := &admin.ListAccessLogsByHostnameApiParams{ GroupId: opts.groupId, Hostname: opts.hostname, - AuthResult: opts.authResult, - End: opts.end, - IpAddress: opts.ipAddress, - NLogs: opts.nLogs, - Start: opts.start, + AuthResult: &opts.authResult, + End: &opts.end, + IpAddress: &opts.ipAddress, + NLogs: &opts.nLogs, + Start: &opts.start, } resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByHostnameWithParams(ctx, params).Execute() if err != nil { @@ -139,9 +141,8 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { opts := ListAccessLogsByHostnameOpts{} cmd := &cobra.Command{ - Use: "listAccessLogsByHostname", - // Aliases: []string{"?"}, - Short: "Return Database Access History for One Cluster using Its Hostname", + Use: "listAccessLogsByHostname", + Short: "Return Database Access History for One Cluster using Its Hostname", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 57df131558..2095563c15 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreateAlertConfigurationBuilder() *cobra.Command { opts := CreateAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "createAlertConfiguration", - // Aliases: []string{"?"}, - Short: "Create One Alert Configuration in One Project", + Use: "createAlertConfiguration", + Short: "Create One Alert Configuration in One Project", Annotations: map[string]string{ "output": template, }, @@ -113,9 +115,8 @@ func DeleteAlertConfigurationBuilder() *cobra.Command { opts := DeleteAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "deleteAlertConfiguration", - // Aliases: []string{"?"}, - Short: "Remove One Alert Configuration from One Project", + Use: "deleteAlertConfiguration", + Short: "Remove One Alert Configuration from One Project", Annotations: map[string]string{ "output": template, }, @@ -170,9 +171,8 @@ func GetAlertConfigurationBuilder() *cobra.Command { opts := GetAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "getAlertConfiguration", - // Aliases: []string{"?"}, - Short: "Return One Alert Configuration from One Project", + Use: "getAlertConfiguration", + Short: "Return One Alert Configuration from One Project", Annotations: map[string]string{ "output": template, }, @@ -223,9 +223,8 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { opts := ListAlertConfigurationMatchersFieldNamesOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurationMatchersFieldNames", - // Aliases: []string{"?"}, - Short: "Get All Alert Configuration Matchers Field Names", + Use: "listAlertConfigurationMatchersFieldNames", + Short: "Get All Alert Configuration Matchers Field Names", Annotations: map[string]string{ "output": template, }, @@ -263,9 +262,9 @@ func (opts *ListAlertConfigurationsOpts) initClient() func() error { func (opts *ListAlertConfigurationsOpts) Run(ctx context.Context) error { params := &admin.ListAlertConfigurationsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params).Execute() if err != nil { @@ -280,9 +279,8 @@ func ListAlertConfigurationsBuilder() *cobra.Command { opts := ListAlertConfigurationsOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurations", - // Aliases: []string{"?"}, - Short: "Return All Alert Configurations for One Project", + Use: "listAlertConfigurations", + Short: "Return All Alert Configurations for One Project", Annotations: map[string]string{ "output": template, }, @@ -327,9 +325,9 @@ func (opts *ListAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error params := &admin.ListAlertConfigurationsByAlertIdApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params).Execute() if err != nil { @@ -344,9 +342,8 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { opts := ListAlertConfigurationsByAlertIdOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurationsByAlertId", - // Aliases: []string{"?"}, - Short: "Return All Alert Configurations Set for One Alert", + Use: "listAlertConfigurationsByAlertId", + Short: "Return All Alert Configurations Set for One Alert", Annotations: map[string]string{ "output": template, }, @@ -406,9 +403,8 @@ func ToggleAlertConfigurationBuilder() *cobra.Command { opts := ToggleAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "toggleAlertConfiguration", - // Aliases: []string{"?"}, - Short: "Toggle One State of One Alert Configuration in One Project", + Use: "toggleAlertConfiguration", + Short: "Toggle One State of One Alert Configuration in One Project", Annotations: map[string]string{ "output": template, }, @@ -466,9 +462,8 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { opts := UpdateAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "updateAlertConfiguration", - // Aliases: []string{"?"}, - Short: "Update One Alert Configuration for One Project", + Use: "updateAlertConfiguration", + Short: "Update One Alert Configuration for One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 96f8f53442..d1a30cd928 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func AcknowledgeAlertBuilder() *cobra.Command { opts := AcknowledgeAlertOpts{} cmd := &cobra.Command{ - Use: "acknowledgeAlert", - // Aliases: []string{"?"}, - Short: "Acknowledge One Alert from One Project", + Use: "acknowledgeAlert", + Short: "Acknowledge One Alert from One Project", Annotations: map[string]string{ "output": template, }, @@ -117,9 +119,8 @@ func GetAlertBuilder() *cobra.Command { opts := GetAlertOpts{} cmd := &cobra.Command{ - Use: "getAlert", - // Aliases: []string{"?"}, - Short: "Return One Alert from One Project", + Use: "getAlert", + Short: "Return One Alert from One Project", Annotations: map[string]string{ "output": template, }, @@ -162,10 +163,10 @@ func (opts *ListAlertsOpts) initClient() func() error { func (opts *ListAlertsOpts) Run(ctx context.Context) error { params := &admin.ListAlertsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - Status: opts.status, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + Status: &opts.status, } resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params).Execute() if err != nil { @@ -180,9 +181,8 @@ func ListAlertsBuilder() *cobra.Command { opts := ListAlertsOpts{} cmd := &cobra.Command{ - Use: "listAlerts", - // Aliases: []string{"?"}, - Short: "Return All Alerts from One Project", + Use: "listAlerts", + Short: "Return All Alerts from One Project", Annotations: map[string]string{ "output": template, }, @@ -228,9 +228,9 @@ func (opts *ListAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error params := &admin.ListAlertsByAlertConfigurationIdApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params).Execute() if err != nil { @@ -245,9 +245,8 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { opts := ListAlertsByAlertConfigurationIdOpts{} cmd := &cobra.Command{ - Use: "listAlertsByAlertConfigurationId", - // Aliases: []string{"?"}, - Short: "Return All Open Alerts for Alert Configuration", + Use: "listAlertsByAlertConfigurationId", + Short: "Return All Open Alerts for Alert Configuration", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index 7f109e451e..027278cf2d 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateAtlasSearchIndexBuilder() *cobra.Command { opts := CreateAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "createAtlasSearchIndex", - // Aliases: []string{"?"}, - Short: "Create One Atlas Search Index", + Use: "createAtlasSearchIndex", + Short: "Create One Atlas Search Index", Annotations: map[string]string{ "output": template, }, @@ -119,9 +121,8 @@ func DeleteAtlasSearchIndexBuilder() *cobra.Command { opts := DeleteAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "deleteAtlasSearchIndex", - // Aliases: []string{"?"}, - Short: "Remove One Atlas Search Index", + Use: "deleteAtlasSearchIndex", + Short: "Remove One Atlas Search Index", Annotations: map[string]string{ "output": template, }, @@ -180,9 +181,8 @@ func GetAtlasSearchIndexBuilder() *cobra.Command { opts := GetAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "getAtlasSearchIndex", - // Aliases: []string{"?"}, - Short: "Return One Atlas Search Index", + Use: "getAtlasSearchIndex", + Short: "Return One Atlas Search Index", Annotations: map[string]string{ "output": template, }, @@ -243,9 +243,8 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { opts := ListAtlasSearchIndexesOpts{} cmd := &cobra.Command{ - Use: "listAtlasSearchIndexes", - // Aliases: []string{"?"}, - Short: "Return All Atlas Search Indexes for One Collection", + Use: "listAtlasSearchIndexes", + Short: "Return All Atlas Search Indexes for One Collection", Annotations: map[string]string{ "output": template, }, @@ -308,9 +307,8 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { opts := UpdateAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "updateAtlasSearchIndex", - // Aliases: []string{"?"}, - Short: "Update One Atlas Search Index", + Use: "updateAtlasSearchIndex", + Short: "Update One Atlas Search Index", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index 1d54a121c4..538f4c1266 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -55,9 +58,8 @@ func GetAuditingConfigurationBuilder() *cobra.Command { opts := GetAuditingConfigurationOpts{} cmd := &cobra.Command{ - Use: "getAuditingConfiguration", - // Aliases: []string{"?"}, - Short: "Return the Auditing Configuration for One Project", + Use: "getAuditingConfiguration", + Short: "Return the Auditing Configuration for One Project", Annotations: map[string]string{ "output": template, }, @@ -110,9 +112,8 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { opts := UpdateAuditingConfigurationOpts{} cmd := &cobra.Command{ - Use: "updateAuditingConfiguration", - // Aliases: []string{"?"}, - Short: "Update Auditing Configuration for One Project", + Use: "updateAuditingConfiguration", + Short: "Update Auditing Configuration for One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 26985fc5e6..d303079d50 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -55,9 +58,8 @@ func GetAWSCustomDNSBuilder() *cobra.Command { opts := GetAWSCustomDNSOpts{} cmd := &cobra.Command{ - Use: "getAWSCustomDNS", - // Aliases: []string{"?"}, - Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", + Use: "getAWSCustomDNS", + Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", Annotations: map[string]string{ "output": template, }, @@ -110,9 +112,8 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { opts := ToggleAWSCustomDNSOpts{} cmd := &cobra.Command{ - Use: "toggleAWSCustomDNS", - // Aliases: []string{"?"}, - Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", + Use: "toggleAWSCustomDNS", + Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index 195bc6d1de..2a167ed829 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CancelBackupRestoreJobBuilder() *cobra.Command { opts := CancelBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "cancelBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Cancel One Restore Job of One Cluster", + Use: "cancelBackupRestoreJob", + Short: "Cancel One Restore Job of One Cluster", Annotations: map[string]string{ "output": template, }, @@ -120,9 +122,8 @@ func CreateBackupExportJobBuilder() *cobra.Command { opts := CreateBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "createBackupExportJob", - // Aliases: []string{"?"}, - Short: "Create One Cloud Backup Snapshot Export Job", + Use: "createBackupExportJob", + Short: "Create One Cloud Backup Snapshot Export Job", Annotations: map[string]string{ "output": template, }, @@ -180,9 +181,8 @@ func CreateBackupRestoreJobBuilder() *cobra.Command { opts := CreateBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Restore One Snapshot of One Cluster", + Use: "createBackupRestoreJob", + Short: "Restore One Snapshot of One Cluster", Annotations: map[string]string{ "output": template, }, @@ -238,9 +238,8 @@ func CreateExportBucketBuilder() *cobra.Command { opts := CreateExportBucketOpts{} cmd := &cobra.Command{ - Use: "createExportBucket", - // Aliases: []string{"?"}, - Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", + Use: "createExportBucket", + Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Annotations: map[string]string{ "output": template, }, @@ -296,9 +295,8 @@ func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { opts := CreateServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createServerlessBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Restore One Snapshot of One Serverless Instance", + Use: "createServerlessBackupRestoreJob", + Short: "Restore One Snapshot of One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -354,9 +352,8 @@ func DeleteAllBackupSchedulesBuilder() *cobra.Command { opts := DeleteAllBackupSchedulesOpts{} cmd := &cobra.Command{ - Use: "deleteAllBackupSchedules", - // Aliases: []string{"?"}, - Short: "Remove All Cloud Backup Schedules", + Use: "deleteAllBackupSchedules", + Short: "Remove All Cloud Backup Schedules", Annotations: map[string]string{ "output": template, }, @@ -411,9 +408,8 @@ func DeleteExportBucketBuilder() *cobra.Command { opts := DeleteExportBucketOpts{} cmd := &cobra.Command{ - Use: "deleteExportBucket", - // Aliases: []string{"?"}, - Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", + Use: "deleteExportBucket", + Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Annotations: map[string]string{ "output": template, }, @@ -470,9 +466,8 @@ func DeleteReplicaSetBackupBuilder() *cobra.Command { opts := DeleteReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "deleteReplicaSetBackup", - // Aliases: []string{"?"}, - Short: "Remove One Replica Set Cloud Backup", + Use: "deleteReplicaSetBackup", + Short: "Remove One Replica Set Cloud Backup", Annotations: map[string]string{ "output": template, }, @@ -531,9 +526,8 @@ func DeleteShardedClusterBackupBuilder() *cobra.Command { opts := DeleteShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "deleteShardedClusterBackup", - // Aliases: []string{"?"}, - Short: "Remove One Sharded Cluster Cloud Backup", + Use: "deleteShardedClusterBackup", + Short: "Remove One Sharded Cluster Cloud Backup", Annotations: map[string]string{ "output": template, }, @@ -592,9 +586,8 @@ func GetBackupExportJobBuilder() *cobra.Command { opts := GetBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "getBackupExportJob", - // Aliases: []string{"?"}, - Short: "Return One Cloud Backup Snapshot Export Job", + Use: "getBackupExportJob", + Short: "Return One Cloud Backup Snapshot Export Job", Annotations: map[string]string{ "output": template, }, @@ -653,9 +646,8 @@ func GetBackupRestoreJobBuilder() *cobra.Command { opts := GetBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Return One Restore Job of One Cluster", + Use: "getBackupRestoreJob", + Short: "Return One Restore Job of One Cluster", Annotations: map[string]string{ "output": template, }, @@ -712,9 +704,8 @@ func GetBackupScheduleBuilder() *cobra.Command { opts := GetBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "getBackupSchedule", - // Aliases: []string{"?"}, - Short: "Return One Cloud Backup Schedule", + Use: "getBackupSchedule", + Short: "Return One Cloud Backup Schedule", Annotations: map[string]string{ "output": template, }, @@ -767,9 +758,8 @@ func GetDataProtectionSettingsBuilder() *cobra.Command { opts := GetDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "getDataProtectionSettings", - // Aliases: []string{"?"}, - Short: "Return the Backup Compliance Policy settings", + Use: "getDataProtectionSettings", + Short: "Return the Backup Compliance Policy settings", Annotations: map[string]string{ "output": template, }, @@ -822,9 +812,8 @@ func GetExportBucketBuilder() *cobra.Command { opts := GetExportBucketOpts{} cmd := &cobra.Command{ - Use: "getExportBucket", - // Aliases: []string{"?"}, - Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", + Use: "getExportBucket", + Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", Annotations: map[string]string{ "output": template, }, @@ -881,9 +870,8 @@ func GetReplicaSetBackupBuilder() *cobra.Command { opts := GetReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "getReplicaSetBackup", - // Aliases: []string{"?"}, - Short: "Return One Replica Set Cloud Backup", + Use: "getReplicaSetBackup", + Short: "Return One Replica Set Cloud Backup", Annotations: map[string]string{ "output": template, }, @@ -942,9 +930,8 @@ func GetServerlessBackupBuilder() *cobra.Command { opts := GetServerlessBackupOpts{} cmd := &cobra.Command{ - Use: "getServerlessBackup", - // Aliases: []string{"?"}, - Short: "Return One Snapshot of One Serverless Instance", + Use: "getServerlessBackup", + Short: "Return One Snapshot of One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -1003,9 +990,8 @@ func GetServerlessBackupRestoreJobBuilder() *cobra.Command { opts := GetServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getServerlessBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Return One Restore Job for One Serverless Instance", + Use: "getServerlessBackupRestoreJob", + Short: "Return One Restore Job for One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -1064,9 +1050,8 @@ func GetShardedClusterBackupBuilder() *cobra.Command { opts := GetShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "getShardedClusterBackup", - // Aliases: []string{"?"}, - Short: "Return One Sharded Cluster Cloud Backup", + Use: "getShardedClusterBackup", + Short: "Return One Sharded Cluster Cloud Backup", Annotations: map[string]string{ "output": template, }, @@ -1112,9 +1097,9 @@ func (opts *ListBackupExportJobsOpts) Run(ctx context.Context) error { params := &admin.ListBackupExportJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params).Execute() if err != nil { @@ -1129,9 +1114,8 @@ func ListBackupExportJobsBuilder() *cobra.Command { opts := ListBackupExportJobsOpts{} cmd := &cobra.Command{ - Use: "listBackupExportJobs", - // Aliases: []string{"?"}, - Short: "Return All Cloud Backup Snapshot Export Jobs", + Use: "listBackupExportJobs", + Short: "Return All Cloud Backup Snapshot Export Jobs", Annotations: map[string]string{ "output": template, }, @@ -1178,9 +1162,9 @@ func (opts *ListBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -1195,9 +1179,8 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { opts := ListBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listBackupRestoreJobs", - // Aliases: []string{"?"}, - Short: "Return All Restore Jobs for One Cluster", + Use: "listBackupRestoreJobs", + Short: "Return All Restore Jobs for One Cluster", Annotations: map[string]string{ "output": template, }, @@ -1242,9 +1225,9 @@ func (opts *ListExportBucketsOpts) initClient() func() error { func (opts *ListExportBucketsOpts) Run(ctx context.Context) error { params := &admin.ListExportBucketsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params).Execute() if err != nil { @@ -1259,9 +1242,8 @@ func ListExportBucketsBuilder() *cobra.Command { opts := ListExportBucketsOpts{} cmd := &cobra.Command{ - Use: "listExportBuckets", - // Aliases: []string{"?"}, - Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", + Use: "listExportBuckets", + Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", Annotations: map[string]string{ "output": template, }, @@ -1306,9 +1288,9 @@ func (opts *ListReplicaSetBackupsOpts) Run(ctx context.Context) error { params := &admin.ListReplicaSetBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params).Execute() if err != nil { @@ -1323,9 +1305,8 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { opts := ListReplicaSetBackupsOpts{} cmd := &cobra.Command{ - Use: "listReplicaSetBackups", - // Aliases: []string{"?"}, - Short: "Return All Replica Set Cloud Backups", + Use: "listReplicaSetBackups", + Short: "Return All Replica Set Cloud Backups", Annotations: map[string]string{ "output": template, }, @@ -1372,9 +1353,9 @@ func (opts *ListServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error params := &admin.ListServerlessBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -1389,9 +1370,8 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { opts := ListServerlessBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listServerlessBackupRestoreJobs", - // Aliases: []string{"?"}, - Short: "Return All Restore Jobs for One Serverless Instance", + Use: "listServerlessBackupRestoreJobs", + Short: "Return All Restore Jobs for One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -1438,9 +1418,9 @@ func (opts *ListServerlessBackupsOpts) Run(ctx context.Context) error { params := &admin.ListServerlessBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params).Execute() if err != nil { @@ -1455,9 +1435,8 @@ func ListServerlessBackupsBuilder() *cobra.Command { opts := ListServerlessBackupsOpts{} cmd := &cobra.Command{ - Use: "listServerlessBackups", - // Aliases: []string{"?"}, - Short: "Return All Snapshots of One Serverless Instance", + Use: "listServerlessBackups", + Short: "Return All Snapshots of One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -1515,9 +1494,8 @@ func ListShardedClusterBackupsBuilder() *cobra.Command { opts := ListShardedClusterBackupsOpts{} cmd := &cobra.Command{ - Use: "listShardedClusterBackups", - // Aliases: []string{"?"}, - Short: "Return All Sharded Cluster Cloud Backups", + Use: "listShardedClusterBackups", + Short: "Return All Sharded Cluster Cloud Backups", Annotations: map[string]string{ "output": template, }, @@ -1574,9 +1552,8 @@ func TakeSnapshotBuilder() *cobra.Command { opts := TakeSnapshotOpts{} cmd := &cobra.Command{ - Use: "takeSnapshot", - // Aliases: []string{"?"}, - Short: "Take One On-Demand Snapshot", + Use: "takeSnapshot", + Short: "Take One On-Demand Snapshot", Annotations: map[string]string{ "output": template, }, @@ -1634,9 +1611,8 @@ func UpdateBackupScheduleBuilder() *cobra.Command { opts := UpdateBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "updateBackupSchedule", - // Aliases: []string{"?"}, - Short: "Update Cloud Backup Schedule for One Cluster", + Use: "updateBackupSchedule", + Short: "Update Cloud Backup Schedule for One Cluster", Annotations: map[string]string{ "output": template, }, @@ -1692,9 +1668,8 @@ func UpdateDataProtectionSettingsBuilder() *cobra.Command { opts := UpdateDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "updateDataProtectionSettings", - // Aliases: []string{"?"}, - Short: "Update or enable the Backup Compliance Policy settings", + Use: "updateDataProtectionSettings", + Short: "Update or enable the Backup Compliance Policy settings", Annotations: map[string]string{ "output": template, }, @@ -1752,9 +1727,8 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { opts := UpdateSnapshotRetentionOpts{} cmd := &cobra.Command{ - Use: "updateSnapshotRetention", - // Aliases: []string{"?"}, - Short: "Change Expiration Date for One Cloud Backup", + Use: "updateSnapshotRetention", + Short: "Change Expiration Date for One Cloud Backup", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index 981d04e654..1139a37947 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreateLinkTokenBuilder() *cobra.Command { opts := CreateLinkTokenOpts{} cmd := &cobra.Command{ - Use: "createLinkToken", - // Aliases: []string{"?"}, - Short: "Create One Link-Token", + Use: "createLinkToken", + Short: "Create One Link-Token", Annotations: map[string]string{ "output": template, }, @@ -113,9 +115,8 @@ func CreatePushMigrationBuilder() *cobra.Command { opts := CreatePushMigrationOpts{} cmd := &cobra.Command{ - Use: "createPushMigration", - // Aliases: []string{"?"}, - Short: "Migrate One Local Managed Cluster to MongoDB Atlas", + Use: "createPushMigration", + Short: "Migrate One Local Managed Cluster to MongoDB Atlas", Annotations: map[string]string{ "output": template, }, @@ -169,9 +170,8 @@ func CutoverMigrationBuilder() *cobra.Command { opts := CutoverMigrationOpts{} cmd := &cobra.Command{ - Use: "cutoverMigration", - // Aliases: []string{"?"}, - Short: "Cut Over the Migrated Cluster", + Use: "cutoverMigration", + Short: "Cut Over the Migrated Cluster", Annotations: map[string]string{ "output": template, }, @@ -224,9 +224,8 @@ func DeleteLinkTokenBuilder() *cobra.Command { opts := DeleteLinkTokenOpts{} cmd := &cobra.Command{ - Use: "deleteLinkToken", - // Aliases: []string{"?"}, - Short: "Remove One Link-Token", + Use: "deleteLinkToken", + Short: "Remove One Link-Token", Annotations: map[string]string{ "output": template, }, @@ -279,9 +278,8 @@ func GetPushMigrationBuilder() *cobra.Command { opts := GetPushMigrationOpts{} cmd := &cobra.Command{ - Use: "getPushMigration", - // Aliases: []string{"?"}, - Short: "Return One Migration Job", + Use: "getPushMigration", + Short: "Return One Migration Job", Annotations: map[string]string{ "output": template, }, @@ -336,9 +334,8 @@ func GetValidationStatusBuilder() *cobra.Command { opts := GetValidationStatusOpts{} cmd := &cobra.Command{ - Use: "getValidationStatus", - // Aliases: []string{"?"}, - Short: "Return One Migration Validation Job", + Use: "getValidationStatus", + Short: "Return One Migration Validation Job", Annotations: map[string]string{ "output": template, }, @@ -391,9 +388,8 @@ func ListSourceProjectsBuilder() *cobra.Command { opts := ListSourceProjectsOpts{} cmd := &cobra.Command{ - Use: "listSourceProjects", - // Aliases: []string{"?"}, - Short: "Return All Projects Available for Migration", + Use: "listSourceProjects", + Short: "Return All Projects Available for Migration", Annotations: map[string]string{ "output": template, }, @@ -446,9 +442,8 @@ func ValidateMigrationBuilder() *cobra.Command { opts := ValidateMigrationOpts{} cmd := &cobra.Command{ - Use: "validateMigration", - // Aliases: []string{"?"}, - Short: "Validate One Migration Request", + Use: "validateMigration", + Short: "Validate One Migration Request", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index eea114a056..d2a7151e12 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { opts := AuthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "authorizeCloudProviderAccessRole", - // Aliases: []string{"?"}, - Short: "Authorize One Cloud Provider Access Role", + Use: "authorizeCloudProviderAccessRole", + Short: "Authorize One Cloud Provider Access Role", Annotations: map[string]string{ "output": template, }, @@ -117,9 +119,8 @@ func CreateCloudProviderAccessRoleBuilder() *cobra.Command { opts := CreateCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "createCloudProviderAccessRole", - // Aliases: []string{"?"}, - Short: "Create One Cloud Provider Access Role", + Use: "createCloudProviderAccessRole", + Short: "Create One Cloud Provider Access Role", Annotations: map[string]string{ "output": template, }, @@ -175,9 +176,8 @@ func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { opts := DeauthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "deauthorizeCloudProviderAccessRole", - // Aliases: []string{"?"}, - Short: "Deauthorize One Cloud Provider Access Role", + Use: "deauthorizeCloudProviderAccessRole", + Short: "Deauthorize One Cloud Provider Access Role", Annotations: map[string]string{ "output": template, }, @@ -234,9 +234,8 @@ func GetCloudProviderAccessRoleBuilder() *cobra.Command { opts := GetCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "getCloudProviderAccessRole", - // Aliases: []string{"?"}, - Short: "Return specified Cloud Provider Access Role", + Use: "getCloudProviderAccessRole", + Short: "Return specified Cloud Provider Access Role", Annotations: map[string]string{ "output": template, }, @@ -289,9 +288,8 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { opts := ListCloudProviderAccessRolesOpts{} cmd := &cobra.Command{ - Use: "listCloudProviderAccessRoles", - // Aliases: []string{"?"}, - Short: "Return All Cloud Provider Access Roles", + Use: "listCloudProviderAccessRoles", + Short: "Return All Cloud Provider Access Roles", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 351304ef70..4fec26d660 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func EndOutageSimulationBuilder() *cobra.Command { opts := EndOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "endOutageSimulation", - // Aliases: []string{"?"}, - Short: "End an Outage Simulation", + Use: "endOutageSimulation", + Short: "End an Outage Simulation", Annotations: map[string]string{ "output": template, }, @@ -114,9 +116,8 @@ func GetOutageSimulationBuilder() *cobra.Command { opts := GetOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "getOutageSimulation", - // Aliases: []string{"?"}, - Short: "Return One Outage Simulation", + Use: "getOutageSimulation", + Short: "Return One Outage Simulation", Annotations: map[string]string{ "output": template, }, @@ -173,9 +174,8 @@ func StartOutageSimulationBuilder() *cobra.Command { opts := StartOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "startOutageSimulation", - // Aliases: []string{"?"}, - Short: "Start an Outage Simulation", + Use: "startOutageSimulation", + Short: "Start an Outage Simulation", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index cea6cd4431..7b3104b4fb 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func GetClusterAdvancedConfigurationBuilder() *cobra.Command { opts := GetClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "getClusterAdvancedConfiguration", - // Aliases: []string{"?"}, - Short: "Return One Advanced Configuration Options for One Cluster", + Use: "getClusterAdvancedConfiguration", + Short: "Return One Advanced Configuration Options for One Cluster", Annotations: map[string]string{ "output": template, }, @@ -114,9 +116,8 @@ func GetClusterStatusBuilder() *cobra.Command { opts := GetClusterStatusOpts{} cmd := &cobra.Command{ - Use: "getClusterStatus", - // Aliases: []string{"?"}, - Short: "Return Status of All Cluster Operations", + Use: "getClusterStatus", + Short: "Return Status of All Cluster Operations", Annotations: map[string]string{ "output": template, }, @@ -171,9 +172,8 @@ func GetSampleDatasetLoadStatusBuilder() *cobra.Command { opts := GetSampleDatasetLoadStatusOpts{} cmd := &cobra.Command{ - Use: "getSampleDatasetLoadStatus", - // Aliases: []string{"?"}, - Short: "Check Status of Cluster Sample Dataset Request", + Use: "getSampleDatasetLoadStatus", + Short: "Check Status of Cluster Sample Dataset Request", Annotations: map[string]string{ "output": template, }, @@ -217,11 +217,11 @@ func (opts *ListCloudProviderRegionsOpts) initClient() func() error { func (opts *ListCloudProviderRegionsOpts) Run(ctx context.Context) error { params := &admin.ListCloudProviderRegionsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - Providers: opts.providers, - Tier: opts.tier, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + Providers: &opts.providers, + Tier: &opts.tier, } resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params).Execute() if err != nil { @@ -236,9 +236,8 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { opts := ListCloudProviderRegionsOpts{} cmd := &cobra.Command{ - Use: "listCloudProviderRegions", - // Aliases: []string{"?"}, - Short: "Return All Cloud Provider Regions", + Use: "listCloudProviderRegions", + Short: "Return All Cloud Provider Regions", Annotations: map[string]string{ "output": template, }, @@ -281,9 +280,9 @@ func (opts *ListClustersForAllProjectsOpts) initClient() func() error { func (opts *ListClustersForAllProjectsOpts) Run(ctx context.Context) error { params := &admin.ListClustersForAllProjectsApiParams{ - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params).Execute() if err != nil { @@ -298,9 +297,8 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { opts := ListClustersForAllProjectsOpts{} cmd := &cobra.Command{ - Use: "listClustersForAllProjects", - // Aliases: []string{"?"}, - Short: "Return All Authorized Clusters in All Projects", + Use: "listClustersForAllProjects", + Short: "Return All Authorized Clusters in All Projects", Annotations: map[string]string{ "output": template, }, @@ -354,9 +352,8 @@ func LoadSampleDatasetBuilder() *cobra.Command { opts := LoadSampleDatasetOpts{} cmd := &cobra.Command{ - Use: "loadSampleDataset", - // Aliases: []string{"?"}, - Short: "Load Sample Dataset Request into Cluster", + Use: "loadSampleDataset", + Short: "Load Sample Dataset Request into Cluster", Annotations: map[string]string{ "output": template, }, @@ -413,9 +410,8 @@ func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { opts := UpdateClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "updateClusterAdvancedConfiguration", - // Aliases: []string{"?"}, - Short: "Update Advanced Configuration Options for One Cluster", + Use: "updateClusterAdvancedConfiguration", + Short: "Update Advanced Configuration Options for One Cluster", Annotations: map[string]string{ "output": template, }, @@ -471,9 +467,8 @@ func UpgradeSharedClusterBuilder() *cobra.Command { opts := UpgradeSharedClusterOpts{} cmd := &cobra.Command{ - Use: "upgradeSharedCluster", - // Aliases: []string{"?"}, - Short: "Upgrade One Shared-tier Cluster", + Use: "upgradeSharedCluster", + Short: "Upgrade One Shared-tier Cluster", Annotations: map[string]string{ "output": template, }, @@ -527,9 +522,8 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { opts := UpgradeSharedClusterToServerlessOpts{} cmd := &cobra.Command{ - Use: "upgradeSharedClusterToServerless", - // Aliases: []string{"?"}, - Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", + Use: "upgradeSharedClusterToServerless", + Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index f090aeda27..b3db8c7709 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreateCustomDatabaseRoleBuilder() *cobra.Command { opts := CreateCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "createCustomDatabaseRole", - // Aliases: []string{"?"}, - Short: "Create One Custom Role", + Use: "createCustomDatabaseRole", + Short: "Create One Custom Role", Annotations: map[string]string{ "output": template, }, @@ -113,9 +115,8 @@ func DeleteCustomDatabaseRoleBuilder() *cobra.Command { opts := DeleteCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "deleteCustomDatabaseRole", - // Aliases: []string{"?"}, - Short: "Remove One Custom Role from One Project", + Use: "deleteCustomDatabaseRole", + Short: "Remove One Custom Role from One Project", Annotations: map[string]string{ "output": template, }, @@ -170,9 +171,8 @@ func GetCustomDatabaseRoleBuilder() *cobra.Command { opts := GetCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "getCustomDatabaseRole", - // Aliases: []string{"?"}, - Short: "Return One Custom Role in One Project", + Use: "getCustomDatabaseRole", + Short: "Return One Custom Role in One Project", Annotations: map[string]string{ "output": template, }, @@ -225,9 +225,8 @@ func ListCustomDatabaseRolesBuilder() *cobra.Command { opts := ListCustomDatabaseRolesOpts{} cmd := &cobra.Command{ - Use: "listCustomDatabaseRoles", - // Aliases: []string{"?"}, - Short: "Return All Custom Roles in One Project", + Use: "listCustomDatabaseRoles", + Short: "Return All Custom Roles in One Project", Annotations: map[string]string{ "output": template, }, @@ -282,9 +281,8 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { opts := UpdateCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "updateCustomDatabaseRole", - // Aliases: []string{"?"}, - Short: "Update One Custom Role in One Project", + Use: "updateCustomDatabaseRole", + Short: "Update One Custom Role in One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index de68291626..4bb895daca 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { opts := CreateDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "createDataFederationPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", + Use: "createDataFederationPrivateEndpoint", + Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", Annotations: map[string]string{ "output": template, }, @@ -100,7 +102,7 @@ func (opts *CreateFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, - SkipRoleValidation: opts.skipRoleValidation, + SkipRoleValidation: &opts.skipRoleValidation, } resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { @@ -115,9 +117,8 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { opts := CreateFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "createFederatedDatabase", - // Aliases: []string{"?"}, - Short: "Create One Federated Database Instance in One Project", + Use: "createFederatedDatabase", + Short: "Create One Federated Database Instance in One Project", Annotations: map[string]string{ "output": template, }, @@ -176,9 +177,8 @@ func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { opts := CreateOneDataFederationQueryLimitOpts{} cmd := &cobra.Command{ - Use: "createOneDataFederationQueryLimit", - // Aliases: []string{"?"}, - Short: "Configure One Query Limit for One Federated Database Instance", + Use: "createOneDataFederationQueryLimit", + Short: "Configure One Query Limit for One Federated Database Instance", Annotations: map[string]string{ "output": template, }, @@ -236,9 +236,8 @@ func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { opts := DeleteDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "deleteDataFederationPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", + Use: "deleteDataFederationPrivateEndpoint", + Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", Annotations: map[string]string{ "output": template, }, @@ -293,9 +292,8 @@ func DeleteFederatedDatabaseBuilder() *cobra.Command { opts := DeleteFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "deleteFederatedDatabase", - // Aliases: []string{"?"}, - Short: "Remove One Federated Database Instance from One Project", + Use: "deleteFederatedDatabase", + Short: "Remove One Federated Database Instance from One Project", Annotations: map[string]string{ "output": template, }, @@ -352,9 +350,8 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { opts := DeleteOneDataFederationInstanceQueryLimitOpts{} cmd := &cobra.Command{ - Use: "deleteOneDataFederationInstanceQueryLimit", - // Aliases: []string{"?"}, - Short: "Delete One Query Limit For One Federated Database Instance", + Use: "deleteOneDataFederationInstanceQueryLimit", + Short: "Delete One Query Limit For One Federated Database Instance", Annotations: map[string]string{ "output": template, }, @@ -399,8 +396,8 @@ func (opts *DownloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) err params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, - EndDate: opts.endDate, - StartDate: opts.startDate, + EndDate: &opts.endDate, + StartDate: &opts.startDate, } resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params).Execute() if err != nil { @@ -415,9 +412,8 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { opts := DownloadFederatedDatabaseQueryLogsOpts{} cmd := &cobra.Command{ - Use: "downloadFederatedDatabaseQueryLogs", - // Aliases: []string{"?"}, - Short: "Download Query Logs for One Federated Database Instance", + Use: "downloadFederatedDatabaseQueryLogs", + Short: "Download Query Logs for One Federated Database Instance", Annotations: map[string]string{ "output": template, }, @@ -474,9 +470,8 @@ func GetDataFederationPrivateEndpointBuilder() *cobra.Command { opts := GetDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "getDataFederationPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", + Use: "getDataFederationPrivateEndpoint", + Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", Annotations: map[string]string{ "output": template, }, @@ -531,9 +526,8 @@ func GetFederatedDatabaseBuilder() *cobra.Command { opts := GetFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "getFederatedDatabase", - // Aliases: []string{"?"}, - Short: "Return One Federated Database Instance in One Project", + Use: "getFederatedDatabase", + Short: "Return One Federated Database Instance in One Project", Annotations: map[string]string{ "output": template, }, @@ -575,9 +569,9 @@ func (opts *ListDataFederationPrivateEndpointsOpts) initClient() func() error { func (opts *ListDataFederationPrivateEndpointsOpts) Run(ctx context.Context) error { params := &admin.ListDataFederationPrivateEndpointsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params).Execute() if err != nil { @@ -592,9 +586,8 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { opts := ListDataFederationPrivateEndpointsOpts{} cmd := &cobra.Command{ - Use: "listDataFederationPrivateEndpoints", - // Aliases: []string{"?"}, - Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", + Use: "listDataFederationPrivateEndpoints", + Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", Annotations: map[string]string{ "output": template, }, @@ -635,7 +628,7 @@ func (opts *ListFederatedDatabasesOpts) initClient() func() error { func (opts *ListFederatedDatabasesOpts) Run(ctx context.Context) error { params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, - Type_: opts.type_, + Type_: &opts.type_, } resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params).Execute() if err != nil { @@ -650,9 +643,8 @@ func ListFederatedDatabasesBuilder() *cobra.Command { opts := ListFederatedDatabasesOpts{} cmd := &cobra.Command{ - Use: "listFederatedDatabases", - // Aliases: []string{"?"}, - Short: "Return All Federated Database Instances in One Project", + Use: "listFederatedDatabases", + Short: "Return All Federated Database Instances in One Project", Annotations: map[string]string{ "output": template, }, @@ -708,9 +700,8 @@ func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { opts := ReturnFederatedDatabaseQueryLimitOpts{} cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimit", - // Aliases: []string{"?"}, - Short: "Return One Federated Database Instance Query Limit for One Project", + Use: "returnFederatedDatabaseQueryLimit", + Short: "Return One Federated Database Instance Query Limit for One Project", Annotations: map[string]string{ "output": template, }, @@ -767,9 +758,8 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { opts := ReturnFederatedDatabaseQueryLimitsOpts{} cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimits", - // Aliases: []string{"?"}, - Short: "Return All Query Limits for One Federated Database Instance", + Use: "returnFederatedDatabaseQueryLimits", + Short: "Return All Query Limits for One Federated Database Instance", Annotations: map[string]string{ "output": template, }, @@ -828,9 +818,8 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { opts := UpdateFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "updateFederatedDatabase", - // Aliases: []string{"?"}, - Short: "Update One Federated Database Instance in One Project", + Use: "updateFederatedDatabase", + Short: "Update One Federated Database Instance in One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 989deddee8..93b5d9be21 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreatePipelineBuilder() *cobra.Command { opts := CreatePipelineOpts{} cmd := &cobra.Command{ - Use: "createPipeline", - // Aliases: []string{"?"}, - Short: "Create One Data Lake Pipeline", + Use: "createPipeline", + Short: "Create One Data Lake Pipeline", Annotations: map[string]string{ "output": template, }, @@ -113,9 +115,8 @@ func DeletePipelineBuilder() *cobra.Command { opts := DeletePipelineOpts{} cmd := &cobra.Command{ - Use: "deletePipeline", - // Aliases: []string{"?"}, - Short: "Remove One Data Lake Pipeline", + Use: "deletePipeline", + Short: "Remove One Data Lake Pipeline", Annotations: map[string]string{ "output": template, }, @@ -172,9 +173,8 @@ func DeletePipelineRunDatasetBuilder() *cobra.Command { opts := DeletePipelineRunDatasetOpts{} cmd := &cobra.Command{ - Use: "deletePipelineRunDataset", - // Aliases: []string{"?"}, - Short: "Delete Pipeline Run Dataset", + Use: "deletePipelineRunDataset", + Short: "Delete Pipeline Run Dataset", Annotations: map[string]string{ "output": template, }, @@ -231,9 +231,8 @@ func GetPipelineBuilder() *cobra.Command { opts := GetPipelineOpts{} cmd := &cobra.Command{ - Use: "getPipeline", - // Aliases: []string{"?"}, - Short: "Return One Data Lake Pipeline", + Use: "getPipeline", + Short: "Return One Data Lake Pipeline", Annotations: map[string]string{ "output": template, }, @@ -290,9 +289,8 @@ func GetPipelineRunBuilder() *cobra.Command { opts := GetPipelineRunOpts{} cmd := &cobra.Command{ - Use: "getPipelineRun", - // Aliases: []string{"?"}, - Short: "Return One Data Lake Pipeline Run", + Use: "getPipelineRun", + Short: "Return One Data Lake Pipeline Run", Annotations: map[string]string{ "output": template, }, @@ -324,7 +322,7 @@ type ListPipelineRunsOpts struct { includeCount bool itemsPerPage int pageNum int - createdBefore time.Time + createdBefore string } func (opts *ListPipelineRunsOpts) initClient() func() error { @@ -339,10 +337,10 @@ func (opts *ListPipelineRunsOpts) Run(ctx context.Context) error { params := &admin.ListPipelineRunsApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - CreatedBefore: opts.createdBefore, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + CreatedBefore: convertTime(&opts.createdBefore), } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params).Execute() if err != nil { @@ -357,9 +355,8 @@ func ListPipelineRunsBuilder() *cobra.Command { opts := ListPipelineRunsOpts{} cmd := &cobra.Command{ - Use: "listPipelineRuns", - // Aliases: []string{"?"}, - Short: "Return All Data Lake Pipeline Runs from One Project", + Use: "listPipelineRuns", + Short: "Return All Data Lake Pipeline Runs from One Project", Annotations: map[string]string{ "output": template, }, @@ -378,7 +375,7 @@ func ListPipelineRunsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().Time.TimeVar(&opts.createdBefore, "createdBefore", , "If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.") + cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", "If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -418,9 +415,8 @@ func ListPipelineSchedulesBuilder() *cobra.Command { opts := ListPipelineSchedulesOpts{} cmd := &cobra.Command{ - Use: "listPipelineSchedules", - // Aliases: []string{"?"}, - Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", + Use: "listPipelineSchedules", + Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", Annotations: map[string]string{ "output": template, }, @@ -450,7 +446,7 @@ type ListPipelineSnapshotsOpts struct { includeCount bool itemsPerPage int pageNum int - completedAfter time.Time + completedAfter string } func (opts *ListPipelineSnapshotsOpts) initClient() func() error { @@ -465,10 +461,10 @@ func (opts *ListPipelineSnapshotsOpts) Run(ctx context.Context) error { params := &admin.ListPipelineSnapshotsApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - CompletedAfter: opts.completedAfter, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + CompletedAfter: convertTime(&opts.completedAfter), } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params).Execute() if err != nil { @@ -483,9 +479,8 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { opts := ListPipelineSnapshotsOpts{} cmd := &cobra.Command{ - Use: "listPipelineSnapshots", - // Aliases: []string{"?"}, - Short: "Return Available Backup Snapshots for One Data Lake Pipeline", + Use: "listPipelineSnapshots", + Short: "Return Available Backup Snapshots for One Data Lake Pipeline", Annotations: map[string]string{ "output": template, }, @@ -504,7 +499,7 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().Time.TimeVar(&opts.completedAfter, "completedAfter", , "Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.") + cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", "Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -542,9 +537,8 @@ func ListPipelinesBuilder() *cobra.Command { opts := ListPipelinesOpts{} cmd := &cobra.Command{ - Use: "listPipelines", - // Aliases: []string{"?"}, - Short: "Return All Data Lake Pipelines from One Project", + Use: "listPipelines", + Short: "Return All Data Lake Pipelines from One Project", Annotations: map[string]string{ "output": template, }, @@ -597,9 +591,8 @@ func PausePipelineBuilder() *cobra.Command { opts := PausePipelineOpts{} cmd := &cobra.Command{ - Use: "pausePipeline", - // Aliases: []string{"?"}, - Short: "Pause One Data Lake Pipeline", + Use: "pausePipeline", + Short: "Pause One Data Lake Pipeline", Annotations: map[string]string{ "output": template, }, @@ -654,9 +647,8 @@ func ResumePipelineBuilder() *cobra.Command { opts := ResumePipelineOpts{} cmd := &cobra.Command{ - Use: "resumePipeline", - // Aliases: []string{"?"}, - Short: "Resume One Data Lake Pipeline", + Use: "resumePipeline", + Short: "Resume One Data Lake Pipeline", Annotations: map[string]string{ "output": template, }, @@ -713,9 +705,8 @@ func TriggerSnapshotIngestionBuilder() *cobra.Command { opts := TriggerSnapshotIngestionOpts{} cmd := &cobra.Command{ - Use: "triggerSnapshotIngestion", - // Aliases: []string{"?"}, - Short: "Trigger on demand snapshot ingestion", + Use: "triggerSnapshotIngestion", + Short: "Trigger on demand snapshot ingestion", Annotations: map[string]string{ "output": template, }, @@ -773,9 +764,8 @@ func UpdatePipelineBuilder() *cobra.Command { opts := UpdatePipelineOpts{} cmd := &cobra.Command{ - Use: "updatePipeline", - // Aliases: []string{"?"}, - Short: "Update One Data Lake Pipeline", + Use: "updatePipeline", + Short: "Update One Data Lake Pipeline", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 27bd186b68..0dcb1daa2e 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreateDatabaseUserBuilder() *cobra.Command { opts := CreateDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "createDatabaseUser", - // Aliases: []string{"?"}, - Short: "Create One Database User in One Project", + Use: "createDatabaseUser", + Short: "Create One Database User in One Project", Annotations: map[string]string{ "output": template, }, @@ -115,9 +117,8 @@ func DeleteDatabaseUserBuilder() *cobra.Command { opts := DeleteDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "deleteDatabaseUser", - // Aliases: []string{"?"}, - Short: "Remove One Database User from One Project", + Use: "deleteDatabaseUser", + Short: "Remove One Database User from One Project", Annotations: map[string]string{ "output": template, }, @@ -176,9 +177,8 @@ func GetDatabaseUserBuilder() *cobra.Command { opts := GetDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "getDatabaseUser", - // Aliases: []string{"?"}, - Short: "Return One Database User from One Project", + Use: "getDatabaseUser", + Short: "Return One Database User from One Project", Annotations: map[string]string{ "output": template, }, @@ -222,9 +222,9 @@ func (opts *ListDatabaseUsersOpts) initClient() func() error { func (opts *ListDatabaseUsersOpts) Run(ctx context.Context) error { params := &admin.ListDatabaseUsersApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.DatabaseUsersApi.ListDatabaseUsersWithParams(ctx, params).Execute() if err != nil { @@ -239,9 +239,8 @@ func ListDatabaseUsersBuilder() *cobra.Command { opts := ListDatabaseUsersOpts{} cmd := &cobra.Command{ - Use: "listDatabaseUsers", - // Aliases: []string{"?"}, - Short: "Return All Database Users from One Project", + Use: "listDatabaseUsers", + Short: "Return All Database Users from One Project", Annotations: map[string]string{ "output": template, }, @@ -301,9 +300,8 @@ func UpdateDatabaseUserBuilder() *cobra.Command { opts := UpdateDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "updateDatabaseUser", - // Aliases: []string{"?"}, - Short: "Update One Database User in One Project", + Use: "updateDatabaseUser", + Short: "Update One Database User in One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index ec6562531e..eb8d266f0e 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -55,9 +58,8 @@ func GetEncryptionAtRestBuilder() *cobra.Command { opts := GetEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "getEncryptionAtRest", - // Aliases: []string{"?"}, - Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", + Use: "getEncryptionAtRest", + Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Annotations: map[string]string{ "output": template, }, @@ -110,9 +112,8 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { opts := UpdateEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "updateEncryptionAtRest", - // Aliases: []string{"?"}, - Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", + Use: "updateEncryptionAtRest", + Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 9b073ca4ae..72f5771e1b 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -44,7 +47,7 @@ func (opts *GetOrganizationEventOpts) Run(ctx context.Context) error { params := &admin.GetOrganizationEventApiParams{ OrgId: opts.orgId, EventId: opts.eventId, - IncludeRaw: opts.includeRaw, + IncludeRaw: &opts.includeRaw, } resp, _, err := opts.client.EventsApi.GetOrganizationEventWithParams(ctx, params).Execute() if err != nil { @@ -59,9 +62,8 @@ func GetOrganizationEventBuilder() *cobra.Command { opts := GetOrganizationEventOpts{} cmd := &cobra.Command{ - Use: "getOrganizationEvent", - // Aliases: []string{"?"}, - Short: "Return One Event from One Organization", + Use: "getOrganizationEvent", + Short: "Return One Event from One Organization", Annotations: map[string]string{ "output": template, }, @@ -104,7 +106,7 @@ func (opts *GetProjectEventOpts) Run(ctx context.Context) error { params := &admin.GetProjectEventApiParams{ GroupId: opts.groupId, EventId: opts.eventId, - IncludeRaw: opts.includeRaw, + IncludeRaw: &opts.includeRaw, } resp, _, err := opts.client.EventsApi.GetProjectEventWithParams(ctx, params).Execute() if err != nil { @@ -119,9 +121,8 @@ func GetProjectEventBuilder() *cobra.Command { opts := GetProjectEventOpts{} cmd := &cobra.Command{ - Use: "getProjectEvent", - // Aliases: []string{"?"}, - Short: "Return One Event from One Project", + Use: "getProjectEvent", + Short: "Return One Event from One Project", Annotations: map[string]string{ "output": template, }, @@ -153,8 +154,8 @@ type ListOrganizationEventsOpts struct { pageNum int eventType []string includeRaw bool - maxDate time.Time - minDate time.Time + maxDate string + minDate string } func (opts *ListOrganizationEventsOpts) initClient() func() error { @@ -168,13 +169,13 @@ func (opts *ListOrganizationEventsOpts) initClient() func() error { func (opts *ListOrganizationEventsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationEventsApiParams{ OrgId: opts.orgId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - EventType: opts.eventType, - IncludeRaw: opts.includeRaw, - MaxDate: opts.maxDate, - MinDate: opts.minDate, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + EventType: &opts.eventType, + IncludeRaw: &opts.includeRaw, + MaxDate: convertTime(&opts.maxDate), + MinDate: convertTime(&opts.minDate), } resp, _, err := opts.client.EventsApi.ListOrganizationEventsWithParams(ctx, params).Execute() if err != nil { @@ -189,9 +190,8 @@ func ListOrganizationEventsBuilder() *cobra.Command { opts := ListOrganizationEventsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationEvents", - // Aliases: []string{"?"}, - Short: "Return All Events from One Organization", + Use: "listOrganizationEvents", + Short: "Return All Events from One Organization", Annotations: map[string]string{ "output": template, }, @@ -211,8 +211,8 @@ func ListOrganizationEventsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") - cmd.Flags().Time.TimeVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") - cmd.Flags().Time.TimeVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().StringVar(&opts.minDate, "minDate", "", "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") _ = cmd.MarkFlagRequired("orgId") return cmd @@ -228,8 +228,8 @@ type ListProjectEventsOpts struct { clusterNames []string eventType []string includeRaw bool - maxDate time.Time - minDate time.Time + maxDate string + minDate string } func (opts *ListProjectEventsOpts) initClient() func() error { @@ -243,14 +243,14 @@ func (opts *ListProjectEventsOpts) initClient() func() error { func (opts *ListProjectEventsOpts) Run(ctx context.Context) error { params := &admin.ListProjectEventsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - ClusterNames: opts.clusterNames, - EventType: opts.eventType, - IncludeRaw: opts.includeRaw, - MaxDate: opts.maxDate, - MinDate: opts.minDate, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + ClusterNames: &opts.clusterNames, + EventType: &opts.eventType, + IncludeRaw: &opts.includeRaw, + MaxDate: convertTime(&opts.maxDate), + MinDate: convertTime(&opts.minDate), } resp, _, err := opts.client.EventsApi.ListProjectEventsWithParams(ctx, params).Execute() if err != nil { @@ -265,9 +265,8 @@ func ListProjectEventsBuilder() *cobra.Command { opts := ListProjectEventsOpts{} cmd := &cobra.Command{ - Use: "listProjectEvents", - // Aliases: []string{"?"}, - Short: "Return All Events from One Project", + Use: "listProjectEvents", + Short: "Return All Events from One Project", Annotations: map[string]string{ "output": template, }, @@ -288,8 +287,8 @@ func ListProjectEventsBuilder() *cobra.Command { cmd.Flags().StringSliceVar(&opts.clusterNames, "clusterNames", nil, "Human-readable label that identifies the cluster.") cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") - cmd.Flags().Time.TimeVar(&opts.maxDate, "maxDate", , "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") - cmd.Flags().Time.TimeVar(&opts.minDate, "minDate", , "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().StringVar(&opts.minDate, "minDate", "", "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index 7da9b7f569..a72be93db2 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateRoleMappingBuilder() *cobra.Command { opts := CreateRoleMappingOpts{} cmd := &cobra.Command{ - Use: "createRoleMapping", - // Aliases: []string{"?"}, - Short: "Add One Role Mapping to One Organization", + Use: "createRoleMapping", + Short: "Add One Role Mapping to One Organization", Annotations: map[string]string{ "output": template, }, @@ -115,9 +117,8 @@ func DeleteFederationAppBuilder() *cobra.Command { opts := DeleteFederationAppOpts{} cmd := &cobra.Command{ - Use: "deleteFederationApp", - // Aliases: []string{"?"}, - Short: "Delete the federation settings instance.", + Use: "deleteFederationApp", + Short: "Delete the federation settings instance.", Annotations: map[string]string{ "output": template, }, @@ -172,9 +173,8 @@ func DeleteRoleMappingBuilder() *cobra.Command { opts := DeleteRoleMappingOpts{} cmd := &cobra.Command{ - Use: "deleteRoleMapping", - // Aliases: []string{"?"}, - Short: "Remove One Role Mapping from One Organization", + Use: "deleteRoleMapping", + Short: "Remove One Role Mapping from One Organization", Annotations: map[string]string{ "output": template, }, @@ -231,9 +231,8 @@ func GetConnectedOrgConfigBuilder() *cobra.Command { opts := GetConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "getConnectedOrgConfig", - // Aliases: []string{"?"}, - Short: "Return One Org Config Connected to One Federation", + Use: "getConnectedOrgConfig", + Short: "Return One Org Config Connected to One Federation", Annotations: map[string]string{ "output": template, }, @@ -286,9 +285,8 @@ func GetFederationSettingsBuilder() *cobra.Command { opts := GetFederationSettingsOpts{} cmd := &cobra.Command{ - Use: "getFederationSettings", - // Aliases: []string{"?"}, - Short: "Return Federation Settings for One Organization", + Use: "getFederationSettings", + Short: "Return Federation Settings for One Organization", Annotations: map[string]string{ "output": template, }, @@ -341,9 +339,8 @@ func GetIdentityProviderBuilder() *cobra.Command { opts := GetIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "getIdentityProvider", - // Aliases: []string{"?"}, - Short: "Return one identity provider from the specified federation.", + Use: "getIdentityProvider", + Short: "Return one identity provider from the specified federation.", Annotations: map[string]string{ "output": template, }, @@ -398,9 +395,8 @@ func GetIdentityProviderMetadataBuilder() *cobra.Command { opts := GetIdentityProviderMetadataOpts{} cmd := &cobra.Command{ - Use: "getIdentityProviderMetadata", - // Aliases: []string{"?"}, - Short: "Return the metadata of one identity provider in the specified federation.", + Use: "getIdentityProviderMetadata", + Short: "Return the metadata of one identity provider in the specified federation.", Annotations: map[string]string{ "output": template, }, @@ -457,9 +453,8 @@ func GetRoleMappingBuilder() *cobra.Command { opts := GetRoleMappingOpts{} cmd := &cobra.Command{ - Use: "getRoleMapping", - // Aliases: []string{"?"}, - Short: "Return One Role Mapping from One Organization", + Use: "getRoleMapping", + Short: "Return One Role Mapping from One Organization", Annotations: map[string]string{ "output": template, }, @@ -514,9 +509,8 @@ func ListConnectedOrgConfigsBuilder() *cobra.Command { opts := ListConnectedOrgConfigsOpts{} cmd := &cobra.Command{ - Use: "listConnectedOrgConfigs", - // Aliases: []string{"?"}, - Short: "Return All Connected Org Configs from the Federation", + Use: "listConnectedOrgConfigs", + Short: "Return All Connected Org Configs from the Federation", Annotations: map[string]string{ "output": template, }, @@ -567,9 +561,8 @@ func ListIdentityProvidersBuilder() *cobra.Command { opts := ListIdentityProvidersOpts{} cmd := &cobra.Command{ - Use: "listIdentityProviders", - // Aliases: []string{"?"}, - Short: "Return all identity providers from the specified federation.", + Use: "listIdentityProviders", + Short: "Return all identity providers from the specified federation.", Annotations: map[string]string{ "output": template, }, @@ -622,9 +615,8 @@ func ListRoleMappingsBuilder() *cobra.Command { opts := ListRoleMappingsOpts{} cmd := &cobra.Command{ - Use: "listRoleMappings", - // Aliases: []string{"?"}, - Short: "Return All Role Mappings from One Organization", + Use: "listRoleMappings", + Short: "Return All Role Mappings from One Organization", Annotations: map[string]string{ "output": template, }, @@ -679,9 +671,8 @@ func RemoveConnectedOrgConfigBuilder() *cobra.Command { opts := RemoveConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "removeConnectedOrgConfig", - // Aliases: []string{"?"}, - Short: "Remove One Org Config Connected to One Federation", + Use: "removeConnectedOrgConfig", + Short: "Remove One Org Config Connected to One Federation", Annotations: map[string]string{ "output": template, }, @@ -738,9 +729,8 @@ func UpdateConnectedOrgConfigBuilder() *cobra.Command { opts := UpdateConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "updateConnectedOrgConfig", - // Aliases: []string{"?"}, - Short: "Update One Org Config Connected to One Federation", + Use: "updateConnectedOrgConfig", + Short: "Update One Org Config Connected to One Federation", Annotations: map[string]string{ "output": template, }, @@ -798,9 +788,8 @@ func UpdateIdentityProviderBuilder() *cobra.Command { opts := UpdateIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "updateIdentityProvider", - // Aliases: []string{"?"}, - Short: "Update the identity provider.", + Use: "updateIdentityProvider", + Short: "Update the identity provider.", Annotations: map[string]string{ "output": template, }, @@ -860,9 +849,8 @@ func UpdateRoleMappingBuilder() *cobra.Command { opts := UpdateRoleMappingOpts{} cmd := &cobra.Command{ - Use: "updateRoleMapping", - // Aliases: []string{"?"}, - Short: "Update One Role Mapping in One Organization", + Use: "updateRoleMapping", + Short: "Update One Role Mapping in One Organization", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index 72dae2addf..114235a8cd 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateCustomZoneMappingBuilder() *cobra.Command { opts := CreateCustomZoneMappingOpts{} cmd := &cobra.Command{ - Use: "createCustomZoneMapping", - // Aliases: []string{"?"}, - Short: "Add One Entry to One Custom Zone Mapping", + Use: "createCustomZoneMapping", + Short: "Add One Entry to One Custom Zone Mapping", Annotations: map[string]string{ "output": template, }, @@ -119,9 +121,8 @@ func CreateManagedNamespaceBuilder() *cobra.Command { opts := CreateManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "createManagedNamespace", - // Aliases: []string{"?"}, - Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", + Use: "createManagedNamespace", + Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", Annotations: map[string]string{ "output": template, }, @@ -177,9 +178,8 @@ func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { opts := DeleteAllCustomZoneMappingsOpts{} cmd := &cobra.Command{ - Use: "deleteAllCustomZoneMappings", - // Aliases: []string{"?"}, - Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", + Use: "deleteAllCustomZoneMappings", + Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", Annotations: map[string]string{ "output": template, }, @@ -222,8 +222,8 @@ func (opts *DeleteManagedNamespaceOpts) Run(ctx context.Context) error { params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, - Db: opts.db, - Collection: opts.collection, + Db: &opts.db, + Collection: &opts.collection, } resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params).Execute() if err != nil { @@ -238,9 +238,8 @@ func DeleteManagedNamespaceBuilder() *cobra.Command { opts := DeleteManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "deleteManagedNamespace", - // Aliases: []string{"?"}, - Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", + Use: "deleteManagedNamespace", + Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", Annotations: map[string]string{ "output": template, }, @@ -297,9 +296,8 @@ func GetManagedNamespaceBuilder() *cobra.Command { opts := GetManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "getManagedNamespace", - // Aliases: []string{"?"}, - Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", + Use: "getManagedNamespace", + Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index 0d19e8abae..53dd9e4484 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func DownloadInvoiceCSVBuilder() *cobra.Command { opts := DownloadInvoiceCSVOpts{} cmd := &cobra.Command{ - Use: "downloadInvoiceCSV", - // Aliases: []string{"?"}, - Short: "Return One Organization Invoice as CSV", + Use: "downloadInvoiceCSV", + Short: "Return One Organization Invoice as CSV", Annotations: map[string]string{ "output": template, }, @@ -114,9 +116,8 @@ func GetInvoiceBuilder() *cobra.Command { opts := GetInvoiceOpts{} cmd := &cobra.Command{ - Use: "getInvoice", - // Aliases: []string{"?"}, - Short: "Return One Organization Invoice", + Use: "getInvoice", + Short: "Return One Organization Invoice", Annotations: map[string]string{ "output": template, }, @@ -158,9 +159,9 @@ func (opts *ListInvoicesOpts) initClient() func() error { func (opts *ListInvoicesOpts) Run(ctx context.Context) error { params := &admin.ListInvoicesApiParams{ OrgId: opts.orgId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.InvoicesApi.ListInvoicesWithParams(ctx, params).Execute() if err != nil { @@ -175,9 +176,8 @@ func ListInvoicesBuilder() *cobra.Command { opts := ListInvoicesOpts{} cmd := &cobra.Command{ - Use: "listInvoices", - // Aliases: []string{"?"}, - Short: "Return All Invoices for One Organization", + Use: "listInvoices", + Short: "Return All Invoices for One Organization", Annotations: map[string]string{ "output": template, }, @@ -231,9 +231,8 @@ func ListPendingInvoicesBuilder() *cobra.Command { opts := ListPendingInvoicesOpts{} cmd := &cobra.Command{ - Use: "listPendingInvoices", - // Aliases: []string{"?"}, - Short: "Return All Pending Invoices for One Organization", + Use: "listPendingInvoices", + Short: "Return All Pending Invoices for One Organization", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index c5ac15c6ed..46bc190713 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -55,9 +58,8 @@ func DeleteLDAPConfigurationBuilder() *cobra.Command { opts := DeleteLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "deleteLDAPConfiguration", - // Aliases: []string{"?"}, - Short: "Remove the Current LDAP User to DN Mapping", + Use: "deleteLDAPConfiguration", + Short: "Remove the Current LDAP User to DN Mapping", Annotations: map[string]string{ "output": template, }, @@ -108,9 +110,8 @@ func GetLDAPConfigurationBuilder() *cobra.Command { opts := GetLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "getLDAPConfiguration", - // Aliases: []string{"?"}, - Short: "Return the Current LDAP or X.509 Configuration", + Use: "getLDAPConfiguration", + Short: "Return the Current LDAP or X.509 Configuration", Annotations: map[string]string{ "output": template, }, @@ -163,9 +164,8 @@ func GetLDAPConfigurationStatusBuilder() *cobra.Command { opts := GetLDAPConfigurationStatusOpts{} cmd := &cobra.Command{ - Use: "getLDAPConfigurationStatus", - // Aliases: []string{"?"}, - Short: "Return the Status of One Verify LDAP Configuration Request", + Use: "getLDAPConfigurationStatus", + Short: "Return the Status of One Verify LDAP Configuration Request", Annotations: map[string]string{ "output": template, }, @@ -220,9 +220,8 @@ func SaveLDAPConfigurationBuilder() *cobra.Command { opts := SaveLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "saveLDAPConfiguration", - // Aliases: []string{"?"}, - Short: "Edit the LDAP or X.509 Configuration", + Use: "saveLDAPConfiguration", + Short: "Edit the LDAP or X.509 Configuration", Annotations: map[string]string{ "output": template, }, @@ -276,9 +275,8 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { opts := VerifyLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "verifyLDAPConfiguration", - // Aliases: []string{"?"}, - Short: "Verify the LDAP Configuration in One Project", + Use: "verifyLDAPConfiguration", + Short: "Verify the LDAP Configuration in One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index eff41b027d..57487aa593 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func DeleteLegacySnapshotBuilder() *cobra.Command { opts := DeleteLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "deleteLegacySnapshot", - // Aliases: []string{"?"}, - Short: "Remove One Legacy Backup Snapshot", + Use: "deleteLegacySnapshot", + Short: "Remove One Legacy Backup Snapshot", Annotations: map[string]string{ "output": template, }, @@ -120,9 +122,8 @@ func GetLegacyBackupCheckpointBuilder() *cobra.Command { opts := GetLegacyBackupCheckpointOpts{} cmd := &cobra.Command{ - Use: "getLegacyBackupCheckpoint", - // Aliases: []string{"?"}, - Short: "Return One Legacy Backup Checkpoint", + Use: "getLegacyBackupCheckpoint", + Short: "Return One Legacy Backup Checkpoint", Annotations: map[string]string{ "output": template, }, @@ -181,9 +182,8 @@ func GetLegacyBackupRestoreJobBuilder() *cobra.Command { opts := GetLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getLegacyBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Return One Legacy Backup Restore Job", + Use: "getLegacyBackupRestoreJob", + Short: "Return One Legacy Backup Restore Job", Annotations: map[string]string{ "output": template, }, @@ -242,9 +242,8 @@ func GetLegacySnapshotBuilder() *cobra.Command { opts := GetLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "getLegacySnapshot", - // Aliases: []string{"?"}, - Short: "Return One Legacy Backup Snapshot", + Use: "getLegacySnapshot", + Short: "Return One Legacy Backup Snapshot", Annotations: map[string]string{ "output": template, }, @@ -301,9 +300,8 @@ func GetLegacySnapshotScheduleBuilder() *cobra.Command { opts := GetLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "getLegacySnapshotSchedule", - // Aliases: []string{"?"}, - Short: "Return One Snapshot Schedule", + Use: "getLegacySnapshotSchedule", + Short: "Return One Snapshot Schedule", Annotations: map[string]string{ "output": template, }, @@ -347,9 +345,9 @@ func (opts *ListLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { params := &admin.ListLegacyBackupCheckpointsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params).Execute() if err != nil { @@ -364,9 +362,8 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { opts := ListLegacyBackupCheckpointsOpts{} cmd := &cobra.Command{ - Use: "listLegacyBackupCheckpoints", - // Aliases: []string{"?"}, - Short: "Return All Legacy Backup Checkpoints", + Use: "listLegacyBackupCheckpoints", + Short: "Return All Legacy Backup Checkpoints", Annotations: map[string]string{ "output": template, }, @@ -414,10 +411,10 @@ func (opts *ListLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListLegacyBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - BatchId: opts.batchId, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + BatchId: &opts.batchId, } resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -432,9 +429,8 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { opts := ListLegacyBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listLegacyBackupRestoreJobs", - // Aliases: []string{"?"}, - Short: "Return All Legacy Backup Restore Jobs", + Use: "listLegacyBackupRestoreJobs", + Short: "Return All Legacy Backup Restore Jobs", Annotations: map[string]string{ "output": template, }, @@ -483,10 +479,10 @@ func (opts *ListLegacySnapshotsOpts) Run(ctx context.Context) error { params := &admin.ListLegacySnapshotsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - Completed: opts.completed, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + Completed: &opts.completed, } resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params).Execute() if err != nil { @@ -501,9 +497,8 @@ func ListLegacySnapshotsBuilder() *cobra.Command { opts := ListLegacySnapshotsOpts{} cmd := &cobra.Command{ - Use: "listLegacySnapshots", - // Aliases: []string{"?"}, - Short: "Return All Legacy Backup Snapshots", + Use: "listLegacySnapshots", + Short: "Return All Legacy Backup Snapshots", Annotations: map[string]string{ "output": template, }, @@ -566,9 +561,8 @@ func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { opts := UpdateLegacySnapshotRetentionOpts{} cmd := &cobra.Command{ - Use: "updateLegacySnapshotRetention", - // Aliases: []string{"?"}, - Short: "Change One Legacy Backup Snapshot Expiration", + Use: "updateLegacySnapshotRetention", + Short: "Change One Legacy Backup Snapshot Expiration", Annotations: map[string]string{ "output": template, }, @@ -628,9 +622,8 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { opts := UpdateLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "updateLegacySnapshotSchedule", - // Aliases: []string{"?"}, - Short: "Update Snapshot Schedule for One Cluster", + Use: "updateLegacySnapshotSchedule", + Short: "Update Snapshot Schedule for One Cluster", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index aa69c5129a..e8ffa021f2 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { opts := CreateLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createLegacyBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Create One Legacy Backup Restore Job", + Use: "createLegacyBackupRestoreJob", + Short: "Create One Legacy Backup Restore Job", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index 4a96fd1e2f..31478fe202 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -55,9 +58,8 @@ func DeferMaintenanceWindowBuilder() *cobra.Command { opts := DeferMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "deferMaintenanceWindow", - // Aliases: []string{"?"}, - Short: "Defer One Maintenance Window for One Project", + Use: "deferMaintenanceWindow", + Short: "Defer One Maintenance Window for One Project", Annotations: map[string]string{ "output": template, }, @@ -108,9 +110,8 @@ func GetMaintenanceWindowBuilder() *cobra.Command { opts := GetMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "getMaintenanceWindow", - // Aliases: []string{"?"}, - Short: "Return One Maintenance Window for One Project", + Use: "getMaintenanceWindow", + Short: "Return One Maintenance Window for One Project", Annotations: map[string]string{ "output": template, }, @@ -161,9 +162,8 @@ func ResetMaintenanceWindowBuilder() *cobra.Command { opts := ResetMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "resetMaintenanceWindow", - // Aliases: []string{"?"}, - Short: "Reset One Maintenance Window for One Project", + Use: "resetMaintenanceWindow", + Short: "Reset One Maintenance Window for One Project", Annotations: map[string]string{ "output": template, }, @@ -214,9 +214,8 @@ func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { opts := ToggleMaintenanceAutoDeferOpts{} cmd := &cobra.Command{ - Use: "toggleMaintenanceAutoDefer", - // Aliases: []string{"?"}, - Short: "Toggle Automatic Deferral of Maintenance for One Project", + Use: "toggleMaintenanceAutoDefer", + Short: "Toggle Automatic Deferral of Maintenance for One Project", Annotations: map[string]string{ "output": template, }, @@ -269,9 +268,8 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { opts := UpdateMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "updateMaintenanceWindow", - // Aliases: []string{"?"}, - Short: "Update Maintenance Window for One Project", + Use: "updateMaintenanceWindow", + Short: "Update Maintenance Window for One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index 7beb73454b..e599174d3d 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -55,9 +58,8 @@ func CreateUserBuilder() *cobra.Command { opts := CreateUserOpts{} cmd := &cobra.Command{ - Use: "createUser", - // Aliases: []string{"?"}, - Short: "Create One MongoDB Cloud User", + Use: "createUser", + Short: "Create One MongoDB Cloud User", Annotations: map[string]string{ "output": template, }, @@ -107,9 +109,8 @@ func GetUserBuilder() *cobra.Command { opts := GetUserOpts{} cmd := &cobra.Command{ - Use: "getUser", - // Aliases: []string{"?"}, - Short: "Return One MongoDB Cloud User using Its ID", + Use: "getUser", + Short: "Return One MongoDB Cloud User using Its ID", Annotations: map[string]string{ "output": template, }, @@ -160,9 +161,8 @@ func GetUserByUsernameBuilder() *cobra.Command { opts := GetUserByUsernameOpts{} cmd := &cobra.Command{ - Use: "getUserByUsername", - // Aliases: []string{"?"}, - Short: "Return One MongoDB Cloud User using Their Username", + Use: "getUserByUsername", + Short: "Return One MongoDB Cloud User using Their Username", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index ce9e814519..ad7977c04b 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func GetAtlasProcessBuilder() *cobra.Command { opts := GetAtlasProcessOpts{} cmd := &cobra.Command{ - Use: "getAtlasProcess", - // Aliases: []string{"?"}, - Short: "Return One MongoDB Process by ID", + Use: "getAtlasProcess", + Short: "Return One MongoDB Process by ID", Annotations: map[string]string{ "output": template, }, @@ -116,9 +118,8 @@ func GetDatabaseBuilder() *cobra.Command { opts := GetDatabaseOpts{} cmd := &cobra.Command{ - Use: "getDatabase", - // Aliases: []string{"?"}, - Short: "Return One Database for a MongoDB Process", + Use: "getDatabase", + Short: "Return One Database for a MongoDB Process", Annotations: map[string]string{ "output": template, }, @@ -151,8 +152,8 @@ type GetDatabaseMeasurementsOpts struct { granularity string m []string period string - start time.Time - end time.Time + start string + end string } func (opts *GetDatabaseMeasurementsOpts) initClient() func() error { @@ -169,10 +170,10 @@ func (opts *GetDatabaseMeasurementsOpts) Run(ctx context.Context) error { DatabaseName: opts.databaseName, ProcessId: opts.processId, Granularity: opts.granularity, - M: opts.m, - Period: opts.period, - Start: opts.start, - End: opts.end, + M: &opts.m, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -187,9 +188,8 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { opts := GetDatabaseMeasurementsOpts{} cmd := &cobra.Command{ - Use: "getDatabaseMeasurements", - // Aliases: []string{"?"}, - Short: "Return Measurements of One Database for One MongoDB Process", + Use: "getDatabaseMeasurements", + Short: "Return Measurements of One Database for One MongoDB Process", Annotations: map[string]string{ "output": template, }, @@ -209,8 +209,8 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") @@ -228,8 +228,8 @@ type GetDiskMeasurementsOpts struct { granularity string m []string period string - start time.Time - end time.Time + start string + end string } func (opts *GetDiskMeasurementsOpts) initClient() func() error { @@ -246,10 +246,10 @@ func (opts *GetDiskMeasurementsOpts) Run(ctx context.Context) error { PartitionName: opts.partitionName, ProcessId: opts.processId, Granularity: opts.granularity, - M: opts.m, - Period: opts.period, - Start: opts.start, - End: opts.end, + M: &opts.m, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -264,9 +264,8 @@ func GetDiskMeasurementsBuilder() *cobra.Command { opts := GetDiskMeasurementsOpts{} cmd := &cobra.Command{ - Use: "getDiskMeasurements", - // Aliases: []string{"?"}, - Short: "Return Measurements of One Disk for One MongoDB Process", + Use: "getDiskMeasurements", + Short: "Return Measurements of One Disk for One MongoDB Process", Annotations: map[string]string{ "output": template, }, @@ -286,8 +285,8 @@ func GetDiskMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("partitionName") @@ -319,8 +318,8 @@ func (opts *GetHostLogsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, HostName: opts.hostName, LogName: opts.logName, - EndDate: opts.endDate, - StartDate: opts.startDate, + EndDate: &opts.endDate, + StartDate: &opts.startDate, } resp, _, err := opts.client.MonitoringAndLogsApi.GetHostLogsWithParams(ctx, params).Execute() if err != nil { @@ -335,9 +334,8 @@ func GetHostLogsBuilder() *cobra.Command { opts := GetHostLogsOpts{} cmd := &cobra.Command{ - Use: "getHostLogs", - // Aliases: []string{"?"}, - Short: "Download Logs for One Multi-Cloud Cluster Host in One Project", + Use: "getHostLogs", + Short: "Download Logs for One Multi-Cloud Cluster Host in One Project", Annotations: map[string]string{ "output": template, }, @@ -371,8 +369,8 @@ type GetHostMeasurementsOpts struct { granularity string m []string period string - start time.Time - end time.Time + start string + end string } func (opts *GetHostMeasurementsOpts) initClient() func() error { @@ -388,10 +386,10 @@ func (opts *GetHostMeasurementsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ProcessId: opts.processId, Granularity: opts.granularity, - M: opts.m, - Period: opts.period, - Start: opts.start, - End: opts.end, + M: &opts.m, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetHostMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -406,9 +404,8 @@ func GetHostMeasurementsBuilder() *cobra.Command { opts := GetHostMeasurementsOpts{} cmd := &cobra.Command{ - Use: "getHostMeasurements", - // Aliases: []string{"?"}, - Short: "Return Measurements for One MongoDB Process", + Use: "getHostMeasurements", + Short: "Return Measurements for One MongoDB Process", Annotations: map[string]string{ "output": template, }, @@ -427,8 +424,8 @@ func GetHostMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -447,8 +444,8 @@ type GetIndexMetricsOpts struct { granularity string metrics []string period string - start time.Time - end time.Time + start string + end string } func (opts *GetIndexMetricsOpts) initClient() func() error { @@ -468,9 +465,9 @@ func (opts *GetIndexMetricsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Granularity: opts.granularity, Metrics: opts.metrics, - Period: opts.period, - Start: opts.start, - End: opts.end, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params).Execute() if err != nil { @@ -485,9 +482,8 @@ func GetIndexMetricsBuilder() *cobra.Command { opts := GetIndexMetricsOpts{} cmd := &cobra.Command{ - Use: "getIndexMetrics", - // Aliases: []string{"?"}, - Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", + Use: "getIndexMetrics", + Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", Annotations: map[string]string{ "output": template, }, @@ -509,8 +505,8 @@ func GetIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the measurements that MongoDB Atlas reports for the associated data series.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("indexName") @@ -530,8 +526,8 @@ type GetMeasurementsOpts struct { granularity string metrics []string period string - start time.Time - end time.Time + start string + end string } func (opts *GetMeasurementsOpts) initClient() func() error { @@ -548,9 +544,9 @@ func (opts *GetMeasurementsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Granularity: opts.granularity, Metrics: opts.metrics, - Period: opts.period, - Start: opts.start, - End: opts.end, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -565,9 +561,8 @@ func GetMeasurementsBuilder() *cobra.Command { opts := GetMeasurementsOpts{} cmd := &cobra.Command{ - Use: "getMeasurements", - // Aliases: []string{"?"}, - Short: "Return Atlas Search Hardware and Status Metrics", + Use: "getMeasurements", + Short: "Return Atlas Search Hardware and Status Metrics", Annotations: map[string]string{ "output": template, }, @@ -586,8 +581,8 @@ func GetMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") @@ -616,9 +611,9 @@ func (opts *ListAtlasProcessesOpts) initClient() func() error { func (opts *ListAtlasProcessesOpts) Run(ctx context.Context) error { params := &admin.ListAtlasProcessesApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MonitoringAndLogsApi.ListAtlasProcessesWithParams(ctx, params).Execute() if err != nil { @@ -633,9 +628,8 @@ func ListAtlasProcessesBuilder() *cobra.Command { opts := ListAtlasProcessesOpts{} cmd := &cobra.Command{ - Use: "listAtlasProcesses", - // Aliases: []string{"?"}, - Short: "Return All MongoDB Processes in One Project", + Use: "listAtlasProcesses", + Short: "Return All MongoDB Processes in One Project", Annotations: map[string]string{ "output": template, }, @@ -680,9 +674,9 @@ func (opts *ListDatabasesOpts) Run(ctx context.Context) error { params := &admin.ListDatabasesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MonitoringAndLogsApi.ListDatabasesWithParams(ctx, params).Execute() if err != nil { @@ -697,9 +691,8 @@ func ListDatabasesBuilder() *cobra.Command { opts := ListDatabasesOpts{} cmd := &cobra.Command{ - Use: "listDatabases", - // Aliases: []string{"?"}, - Short: "Return Available Databases for One MongoDB Process", + Use: "listDatabases", + Short: "Return Available Databases for One MongoDB Process", Annotations: map[string]string{ "output": template, }, @@ -759,9 +752,8 @@ func ListDiskMeasurementsBuilder() *cobra.Command { opts := ListDiskMeasurementsOpts{} cmd := &cobra.Command{ - Use: "listDiskMeasurements", - // Aliases: []string{"?"}, - Short: "Return Measurements of One Disk", + Use: "listDiskMeasurements", + Short: "Return Measurements of One Disk", Annotations: map[string]string{ "output": template, }, @@ -807,9 +799,9 @@ func (opts *ListDiskPartitionsOpts) Run(ctx context.Context) error { params := &admin.ListDiskPartitionsApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskPartitionsWithParams(ctx, params).Execute() if err != nil { @@ -824,9 +816,8 @@ func ListDiskPartitionsBuilder() *cobra.Command { opts := ListDiskPartitionsOpts{} cmd := &cobra.Command{ - Use: "listDiskPartitions", - // Aliases: []string{"?"}, - Short: "Return Available Disks for One MongoDB Process", + Use: "listDiskPartitions", + Short: "Return Available Disks for One MongoDB Process", Annotations: map[string]string{ "output": template, }, @@ -861,8 +852,8 @@ type ListIndexMetricsOpts struct { granularity string metrics []string period string - start time.Time - end time.Time + start string + end string } func (opts *ListIndexMetricsOpts) initClient() func() error { @@ -881,9 +872,9 @@ func (opts *ListIndexMetricsOpts) Run(ctx context.Context) error { GroupId: opts.groupId, Granularity: opts.granularity, Metrics: opts.metrics, - Period: opts.period, - Start: opts.start, - End: opts.end, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params).Execute() if err != nil { @@ -898,9 +889,8 @@ func ListIndexMetricsBuilder() *cobra.Command { opts := ListIndexMetricsOpts{} cmd := &cobra.Command{ - Use: "listIndexMetrics", - // Aliases: []string{"?"}, - Short: "Return All Atlas Search Index Metrics for One Namespace", + Use: "listIndexMetrics", + Short: "Return All Atlas Search Index Metrics for One Namespace", Annotations: map[string]string{ "output": template, }, @@ -921,8 +911,8 @@ func ListIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the measurements that MongoDB Atlas reports for the associated data series.") cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().Time.TimeVar(&opts.start, "start", , "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().Time.TimeVar(&opts.end, "end", , "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("databaseName") @@ -966,9 +956,8 @@ func ListMetricTypesBuilder() *cobra.Command { opts := ListMetricTypesOpts{} cmd := &cobra.Command{ - Use: "listMetricTypes", - // Aliases: []string{"?"}, - Short: "Return All Atlas Search Metric Types for One Process", + Use: "listMetricTypes", + Short: "Return All Atlas Search Metric Types for One Process", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index 08abf3e6b9..a0dcb34695 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreateClusterBuilder() *cobra.Command { opts := CreateClusterOpts{} cmd := &cobra.Command{ - Use: "createCluster", - // Aliases: []string{"?"}, - Short: "Create One Multi-Cloud Cluster from One Project", + Use: "createCluster", + Short: "Create One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ "output": template, }, @@ -100,7 +102,7 @@ func (opts *DeleteClusterOpts) Run(ctx context.Context) error { params := &admin.DeleteClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - RetainBackups: opts.retainBackups, + RetainBackups: &opts.retainBackups, } _, err := opts.client.MultiCloudClustersApi.DeleteClusterWithParams(ctx, params).Execute() if err != nil { @@ -115,9 +117,8 @@ func DeleteClusterBuilder() *cobra.Command { opts := DeleteClusterOpts{} cmd := &cobra.Command{ - Use: "deleteCluster", - // Aliases: []string{"?"}, - Short: "Remove One Multi-Cloud Cluster from One Project", + Use: "deleteCluster", + Short: "Remove One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ "output": template, }, @@ -173,9 +174,8 @@ func GetClusterBuilder() *cobra.Command { opts := GetClusterOpts{} cmd := &cobra.Command{ - Use: "getCluster", - // Aliases: []string{"?"}, - Short: "Return One Multi-Cloud Cluster from One Project", + Use: "getCluster", + Short: "Return One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ "output": template, }, @@ -217,9 +217,9 @@ func (opts *ListClustersOpts) initClient() func() error { func (opts *ListClustersOpts) Run(ctx context.Context) error { params := &admin.ListClustersApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MultiCloudClustersApi.ListClustersWithParams(ctx, params).Execute() if err != nil { @@ -234,9 +234,8 @@ func ListClustersBuilder() *cobra.Command { opts := ListClustersOpts{} cmd := &cobra.Command{ - Use: "listClusters", - // Aliases: []string{"?"}, - Short: "Return All Multi-Cloud Clusters from One Project", + Use: "listClusters", + Short: "Return All Multi-Cloud Clusters from One Project", Annotations: map[string]string{ "output": template, }, @@ -292,9 +291,8 @@ func TestFailoverBuilder() *cobra.Command { opts := TestFailoverOpts{} cmd := &cobra.Command{ - Use: "testFailover", - // Aliases: []string{"?"}, - Short: "Test Failover for One Multi-Cloud Cluster", + Use: "testFailover", + Short: "Test Failover for One Multi-Cloud Cluster", Annotations: map[string]string{ "output": template, }, @@ -351,9 +349,8 @@ func UpdateClusterBuilder() *cobra.Command { opts := UpdateClusterOpts{} cmd := &cobra.Command{ - Use: "updateCluster", - // Aliases: []string{"?"}, - Short: "Modify One Multi-Cloud Cluster from One Project", + Use: "updateCluster", + Short: "Modify One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 7dd325abd3..1d2e5daa6d 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreatePeeringConnectionBuilder() *cobra.Command { opts := CreatePeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "createPeeringConnection", - // Aliases: []string{"?"}, - Short: "Create One New Network Peering Connection", + Use: "createPeeringConnection", + Short: "Create One New Network Peering Connection", Annotations: map[string]string{ "output": template, }, @@ -113,9 +115,8 @@ func CreatePeeringContainerBuilder() *cobra.Command { opts := CreatePeeringContainerOpts{} cmd := &cobra.Command{ - Use: "createPeeringContainer", - // Aliases: []string{"?"}, - Short: "Create One New Network Peering Container", + Use: "createPeeringContainer", + Short: "Create One New Network Peering Container", Annotations: map[string]string{ "output": template, }, @@ -169,9 +170,8 @@ func DeletePeeringConnectionBuilder() *cobra.Command { opts := DeletePeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "deletePeeringConnection", - // Aliases: []string{"?"}, - Short: "Remove One Existing Network Peering Connection", + Use: "deletePeeringConnection", + Short: "Remove One Existing Network Peering Connection", Annotations: map[string]string{ "output": template, }, @@ -226,9 +226,8 @@ func DeletePeeringContainerBuilder() *cobra.Command { opts := DeletePeeringContainerOpts{} cmd := &cobra.Command{ - Use: "deletePeeringContainer", - // Aliases: []string{"?"}, - Short: "Remove One Network Peering Container", + Use: "deletePeeringContainer", + Short: "Remove One Network Peering Container", Annotations: map[string]string{ "output": template, }, @@ -283,9 +282,8 @@ func DisablePeeringBuilder() *cobra.Command { opts := DisablePeeringOpts{} cmd := &cobra.Command{ - Use: "disablePeering", - // Aliases: []string{"?"}, - Short: "Disable Connect via Peering Only Mode for One Project", + Use: "disablePeering", + Short: "Disable Connect via Peering Only Mode for One Project", Annotations: map[string]string{ "output": template, }, @@ -339,9 +337,8 @@ func GetPeeringConnectionBuilder() *cobra.Command { opts := GetPeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "getPeeringConnection", - // Aliases: []string{"?"}, - Short: "Return One Network Peering Connection in One Project", + Use: "getPeeringConnection", + Short: "Return One Network Peering Connection in One Project", Annotations: map[string]string{ "output": template, }, @@ -396,9 +393,8 @@ func GetPeeringContainerBuilder() *cobra.Command { opts := GetPeeringContainerOpts{} cmd := &cobra.Command{ - Use: "getPeeringContainer", - // Aliases: []string{"?"}, - Short: "Return One Network Peering Container", + Use: "getPeeringContainer", + Short: "Return One Network Peering Container", Annotations: map[string]string{ "output": template, }, @@ -441,10 +437,10 @@ func (opts *ListPeeringConnectionsOpts) initClient() func() error { func (opts *ListPeeringConnectionsOpts) Run(ctx context.Context) error { params := &admin.ListPeeringConnectionsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - ProviderName: opts.providerName, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + ProviderName: &opts.providerName, } resp, _, err := opts.client.NetworkPeeringApi.ListPeeringConnectionsWithParams(ctx, params).Execute() if err != nil { @@ -459,9 +455,8 @@ func ListPeeringConnectionsBuilder() *cobra.Command { opts := ListPeeringConnectionsOpts{} cmd := &cobra.Command{ - Use: "listPeeringConnections", - // Aliases: []string{"?"}, - Short: "Return All Network Peering Connections in One Project", + Use: "listPeeringConnections", + Short: "Return All Network Peering Connections in One Project", Annotations: map[string]string{ "output": template, }, @@ -507,9 +502,9 @@ func (opts *ListPeeringContainerByCloudProviderOpts) Run(ctx context.Context) er params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, ProviderName: opts.providerName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params).Execute() if err != nil { @@ -524,9 +519,8 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { opts := ListPeeringContainerByCloudProviderOpts{} cmd := &cobra.Command{ - Use: "listPeeringContainerByCloudProvider", - // Aliases: []string{"?"}, - Short: "Return All Network Peering Containers in One Project for One Cloud Provider", + Use: "listPeeringContainerByCloudProvider", + Short: "Return All Network Peering Containers in One Project for One Cloud Provider", Annotations: map[string]string{ "output": template, }, @@ -571,9 +565,9 @@ func (opts *ListPeeringContainersOpts) initClient() func() error { func (opts *ListPeeringContainersOpts) Run(ctx context.Context) error { params := &admin.ListPeeringContainersApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainersWithParams(ctx, params).Execute() if err != nil { @@ -588,9 +582,8 @@ func ListPeeringContainersBuilder() *cobra.Command { opts := ListPeeringContainersOpts{} cmd := &cobra.Command{ - Use: "listPeeringContainers", - // Aliases: []string{"?"}, - Short: "Return All Network Peering Containers in One Project", + Use: "listPeeringContainers", + Short: "Return All Network Peering Containers in One Project", Annotations: map[string]string{ "output": template, }, @@ -648,9 +641,8 @@ func UpdatePeeringConnectionBuilder() *cobra.Command { opts := UpdatePeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "updatePeeringConnection", - // Aliases: []string{"?"}, - Short: "Update One New Network Peering Connection", + Use: "updatePeeringConnection", + Short: "Update One New Network Peering Connection", Annotations: map[string]string{ "output": template, }, @@ -708,9 +700,8 @@ func UpdatePeeringContainerBuilder() *cobra.Command { opts := UpdatePeeringContainerOpts{} cmd := &cobra.Command{ - Use: "updatePeeringContainer", - // Aliases: []string{"?"}, - Short: "Update One Network Peering Container", + Use: "updatePeeringContainer", + Short: "Update One Network Peering Container", Annotations: map[string]string{ "output": template, }, @@ -764,9 +755,8 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { opts := VerifyConnectViaPeeringOnlyModeForOneProjectOpts{} cmd := &cobra.Command{ - Use: "verifyConnectViaPeeringOnlyModeForOneProject", - // Aliases: []string{"?"}, - Short: "Verify Connect via Peering Only Mode for One Project", + Use: "verifyConnectViaPeeringOnlyModeForOneProject", + Short: "Verify Connect via Peering Only Mode for One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index e7b98bd260..257186b473 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateOnlineArchiveBuilder() *cobra.Command { opts := CreateOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "createOnlineArchive", - // Aliases: []string{"?"}, - Short: "Create One Online Archive", + Use: "createOnlineArchive", + Short: "Create One Online Archive", Annotations: map[string]string{ "output": template, }, @@ -119,9 +121,8 @@ func DeleteOnlineArchiveBuilder() *cobra.Command { opts := DeleteOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "deleteOnlineArchive", - // Aliases: []string{"?"}, - Short: "Remove One Online Archive", + Use: "deleteOnlineArchive", + Short: "Remove One Online Archive", Annotations: map[string]string{ "output": template, }, @@ -167,9 +168,9 @@ func (opts *DownloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - StartDate: opts.startDate, - EndDate: opts.endDate, - ArchiveOnly: opts.archiveOnly, + StartDate: &opts.startDate, + EndDate: &opts.endDate, + ArchiveOnly: &opts.archiveOnly, } resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params).Execute() if err != nil { @@ -184,9 +185,8 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { opts := DownloadOnlineArchiveQueryLogsOpts{} cmd := &cobra.Command{ - Use: "downloadOnlineArchiveQueryLogs", - // Aliases: []string{"?"}, - Short: "Download Online Archive Query Logs", + Use: "downloadOnlineArchiveQueryLogs", + Short: "Download Online Archive Query Logs", Annotations: map[string]string{ "output": template, }, @@ -246,9 +246,8 @@ func GetOnlineArchiveBuilder() *cobra.Command { opts := GetOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "getOnlineArchive", - // Aliases: []string{"?"}, - Short: "Return One Online Archive", + Use: "getOnlineArchive", + Short: "Return One Online Archive", Annotations: map[string]string{ "output": template, }, @@ -294,9 +293,9 @@ func (opts *ListOnlineArchivesOpts) Run(ctx context.Context) error { params := &admin.ListOnlineArchivesApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params).Execute() if err != nil { @@ -311,9 +310,8 @@ func ListOnlineArchivesBuilder() *cobra.Command { opts := ListOnlineArchivesOpts{} cmd := &cobra.Command{ - Use: "listOnlineArchives", - // Aliases: []string{"?"}, - Short: "Return All Online Archives for One Cluster", + Use: "listOnlineArchives", + Short: "Return All Online Archives for One Cluster", Annotations: map[string]string{ "output": template, }, @@ -375,9 +373,8 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { opts := UpdateOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "updateOnlineArchive", - // Aliases: []string{"?"}, - Short: "Update One Online Archive", + Use: "updateOnlineArchive", + Short: "Update One Online Archive", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 84cabbfabc..4f829fd713 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -55,9 +58,8 @@ func CreateOrganizationBuilder() *cobra.Command { opts := CreateOrganizationOpts{} cmd := &cobra.Command{ - Use: "createOrganization", - // Aliases: []string{"?"}, - Short: "Create One Organization", + Use: "createOrganization", + Short: "Create One Organization", Annotations: map[string]string{ "output": template, }, @@ -109,9 +111,8 @@ func CreateOrganizationInvitationBuilder() *cobra.Command { opts := CreateOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "createOrganizationInvitation", - // Aliases: []string{"?"}, - Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", + Use: "createOrganizationInvitation", + Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", Annotations: map[string]string{ "output": template, }, @@ -163,9 +164,8 @@ func DeleteOrganizationBuilder() *cobra.Command { opts := DeleteOrganizationOpts{} cmd := &cobra.Command{ - Use: "deleteOrganization", - // Aliases: []string{"?"}, - Short: "Remove One Organization", + Use: "deleteOrganization", + Short: "Remove One Organization", Annotations: map[string]string{ "output": template, }, @@ -218,9 +218,8 @@ func DeleteOrganizationInvitationBuilder() *cobra.Command { opts := DeleteOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "deleteOrganizationInvitation", - // Aliases: []string{"?"}, - Short: "Cancel One Organization Invitation", + Use: "deleteOrganizationInvitation", + Short: "Cancel One Organization Invitation", Annotations: map[string]string{ "output": template, }, @@ -273,9 +272,8 @@ func GetOrganizationBuilder() *cobra.Command { opts := GetOrganizationOpts{} cmd := &cobra.Command{ - Use: "getOrganization", - // Aliases: []string{"?"}, - Short: "Return One Organization", + Use: "getOrganization", + Short: "Return One Organization", Annotations: map[string]string{ "output": template, }, @@ -328,9 +326,8 @@ func GetOrganizationInvitationBuilder() *cobra.Command { opts := GetOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "getOrganizationInvitation", - // Aliases: []string{"?"}, - Short: "Return One Organization Invitation", + Use: "getOrganizationInvitation", + Short: "Return One Organization Invitation", Annotations: map[string]string{ "output": template, }, @@ -383,9 +380,8 @@ func GetOrganizationSettingsBuilder() *cobra.Command { opts := GetOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "getOrganizationSettings", - // Aliases: []string{"?"}, - Short: "Return Settings for One Organization", + Use: "getOrganizationSettings", + Short: "Return Settings for One Organization", Annotations: map[string]string{ "output": template, }, @@ -423,7 +419,7 @@ func (opts *ListOrganizationInvitationsOpts) initClient() func() error { func (opts *ListOrganizationInvitationsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationInvitationsApiParams{ OrgId: opts.orgId, - Username: opts.username, + Username: &opts.username, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params).Execute() if err != nil { @@ -438,9 +434,8 @@ func ListOrganizationInvitationsBuilder() *cobra.Command { opts := ListOrganizationInvitationsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationInvitations", - // Aliases: []string{"?"}, - Short: "Return All Organization Invitations", + Use: "listOrganizationInvitations", + Short: "Return All Organization Invitations", Annotations: map[string]string{ "output": template, }, @@ -482,10 +477,10 @@ func (opts *ListOrganizationProjectsOpts) initClient() func() error { func (opts *ListOrganizationProjectsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationProjectsApiParams{ OrgId: opts.orgId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - Name: opts.name, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + Name: &opts.name, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params).Execute() if err != nil { @@ -500,9 +495,8 @@ func ListOrganizationProjectsBuilder() *cobra.Command { opts := ListOrganizationProjectsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationProjects", - // Aliases: []string{"?"}, - Short: "Return One or More Projects in One Organization", + Use: "listOrganizationProjects", + Short: "Return One or More Projects in One Organization", Annotations: map[string]string{ "output": template, }, @@ -546,9 +540,9 @@ func (opts *ListOrganizationUsersOpts) initClient() func() error { func (opts *ListOrganizationUsersOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationUsersApiParams{ OrgId: opts.orgId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params).Execute() if err != nil { @@ -563,9 +557,8 @@ func ListOrganizationUsersBuilder() *cobra.Command { opts := ListOrganizationUsersOpts{} cmd := &cobra.Command{ - Use: "listOrganizationUsers", - // Aliases: []string{"?"}, - Short: "Return All MongoDB Cloud Users in One Organization", + Use: "listOrganizationUsers", + Short: "Return All MongoDB Cloud Users in One Organization", Annotations: map[string]string{ "output": template, }, @@ -607,10 +600,10 @@ func (opts *ListOrganizationsOpts) initClient() func() error { func (opts *ListOrganizationsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationsApiParams{ - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - Name: opts.name, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + Name: &opts.name, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params).Execute() if err != nil { @@ -625,9 +618,8 @@ func ListOrganizationsBuilder() *cobra.Command { opts := ListOrganizationsOpts{} cmd := &cobra.Command{ - Use: "listOrganizations", - // Aliases: []string{"?"}, - Short: "Return All Organizations", + Use: "listOrganizations", + Short: "Return All Organizations", Annotations: map[string]string{ "output": template, }, @@ -682,9 +674,8 @@ func RenameOrganizationBuilder() *cobra.Command { opts := RenameOrganizationOpts{} cmd := &cobra.Command{ - Use: "renameOrganization", - // Aliases: []string{"?"}, - Short: "Rename One Organization", + Use: "renameOrganization", + Short: "Rename One Organization", Annotations: map[string]string{ "output": template, }, @@ -738,9 +729,8 @@ func UpdateOrganizationInvitationBuilder() *cobra.Command { opts := UpdateOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationInvitation", - // Aliases: []string{"?"}, - Short: "Update One Organization Invitation", + Use: "updateOrganizationInvitation", + Short: "Update One Organization Invitation", Annotations: map[string]string{ "output": template, }, @@ -796,9 +786,8 @@ func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { opts := UpdateOrganizationInvitationByIdOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationInvitationById", - // Aliases: []string{"?"}, - Short: "Update One Organization Invitation by Invitation ID", + Use: "updateOrganizationInvitationById", + Short: "Update One Organization Invitation by Invitation ID", Annotations: map[string]string{ "output": template, }, @@ -854,9 +843,8 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { opts := UpdateOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationSettings", - // Aliases: []string{"?"}, - Short: "Update Settings for One Organization", + Use: "updateOrganizationSettings", + Short: "Update Settings for One Organization", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index e8e2bfee8b..149c16bc64 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -55,9 +58,8 @@ func DisableSlowOperationThresholdingBuilder() *cobra.Command { opts := DisableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ - Use: "disableSlowOperationThresholding", - // Aliases: []string{"?"}, - Short: "Disable Managed Slow Operation Threshold", + Use: "disableSlowOperationThresholding", + Short: "Disable Managed Slow Operation Threshold", Annotations: map[string]string{ "output": template, }, @@ -108,9 +110,8 @@ func EnableSlowOperationThresholdingBuilder() *cobra.Command { opts := EnableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ - Use: "enableSlowOperationThresholding", - // Aliases: []string{"?"}, - Short: "Enable Managed Slow Operation Threshold", + Use: "enableSlowOperationThresholding", + Short: "Enable Managed Slow Operation Threshold", Annotations: map[string]string{ "output": template, }, @@ -153,10 +154,10 @@ func (opts *ListSlowQueriesOpts) Run(ctx context.Context) error { params := &admin.ListSlowQueriesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, - Duration: opts.duration, - Namespaces: opts.namespaces, - NLogs: opts.nLogs, - Since: opts.since, + Duration: &opts.duration, + Namespaces: &opts.namespaces, + NLogs: &opts.nLogs, + Since: &opts.since, } resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueriesWithParams(ctx, params).Execute() if err != nil { @@ -171,9 +172,8 @@ func ListSlowQueriesBuilder() *cobra.Command { opts := ListSlowQueriesOpts{} cmd := &cobra.Command{ - Use: "listSlowQueries", - // Aliases: []string{"?"}, - Short: "Return Slow Queries", + Use: "listSlowQueries", + Short: "Return Slow Queries", Annotations: map[string]string{ "output": template, }, @@ -220,8 +220,8 @@ func (opts *ListSlowQueryNamespacesOpts) Run(ctx context.Context) error { params := &admin.ListSlowQueryNamespacesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, - Duration: opts.duration, - Since: opts.since, + Duration: &opts.duration, + Since: &opts.since, } resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(ctx, params).Execute() if err != nil { @@ -236,9 +236,8 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { opts := ListSlowQueryNamespacesOpts{} cmd := &cobra.Command{ - Use: "listSlowQueryNamespaces", - // Aliases: []string{"?"}, - Short: "Return All Namespaces for One Host", + Use: "listSlowQueryNamespaces", + Short: "Return All Namespaces for One Host", Annotations: map[string]string{ "output": template, }, @@ -289,14 +288,14 @@ func (opts *ListSuggestedIndexesOpts) Run(ctx context.Context) error { params := &admin.ListSuggestedIndexesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - Duration: opts.duration, - Namespaces: opts.namespaces, - NExamples: opts.nExamples, - NIndexes: opts.nIndexes, - Since: opts.since, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + Duration: &opts.duration, + Namespaces: &opts.namespaces, + NExamples: &opts.nExamples, + NIndexes: &opts.nIndexes, + Since: &opts.since, } resp, _, err := opts.client.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(ctx, params).Execute() if err != nil { @@ -311,9 +310,8 @@ func ListSuggestedIndexesBuilder() *cobra.Command { opts := ListSuggestedIndexesOpts{} cmd := &cobra.Command{ - Use: "listSuggestedIndexes", - // Aliases: []string{"?"}, - Short: "Return Suggested Indexes", + Use: "listSuggestedIndexes", + Short: "Return Suggested Indexes", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index 6d1ebbe632..9fcef2c9c4 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -61,9 +64,8 @@ func CreatePrivateEndpointBuilder() *cobra.Command { opts := CreatePrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "createPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Create One Private Endpoint for One Provider", + Use: "createPrivateEndpoint", + Short: "Create One Private Endpoint for One Provider", Annotations: map[string]string{ "output": template, }, @@ -121,9 +123,8 @@ func CreatePrivateEndpointServiceBuilder() *cobra.Command { opts := CreatePrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "createPrivateEndpointService", - // Aliases: []string{"?"}, - Short: "Create One Private Endpoint Service for One Provider", + Use: "createPrivateEndpointService", + Short: "Create One Private Endpoint Service for One Provider", Annotations: map[string]string{ "output": template, }, @@ -181,9 +182,8 @@ func DeletePrivateEndpointBuilder() *cobra.Command { opts := DeletePrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "deletePrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Remove One Private Endpoint for One Provider", + Use: "deletePrivateEndpoint", + Short: "Remove One Private Endpoint for One Provider", Annotations: map[string]string{ "output": template, }, @@ -244,9 +244,8 @@ func DeletePrivateEndpointServiceBuilder() *cobra.Command { opts := DeletePrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "deletePrivateEndpointService", - // Aliases: []string{"?"}, - Short: "Remove One Private Endpoint Service for One Provider", + Use: "deletePrivateEndpointService", + Short: "Remove One Private Endpoint Service for One Provider", Annotations: map[string]string{ "output": template, }, @@ -307,9 +306,8 @@ func GetPrivateEndpointBuilder() *cobra.Command { opts := GetPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "getPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Return One Private Endpoint for One Provider", + Use: "getPrivateEndpoint", + Short: "Return One Private Endpoint for One Provider", Annotations: map[string]string{ "output": template, }, @@ -370,9 +368,8 @@ func GetPrivateEndpointServiceBuilder() *cobra.Command { opts := GetPrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "getPrivateEndpointService", - // Aliases: []string{"?"}, - Short: "Return One Private Endpoint Service for One Provider", + Use: "getPrivateEndpointService", + Short: "Return One Private Endpoint Service for One Provider", Annotations: map[string]string{ "output": template, }, @@ -427,9 +424,8 @@ func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { opts := GetRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ - Use: "getRegionalizedPrivateEndpointSetting", - // Aliases: []string{"?"}, - Short: "Return Regionalized Private Endpoint Status", + Use: "getRegionalizedPrivateEndpointSetting", + Short: "Return Regionalized Private Endpoint Status", Annotations: map[string]string{ "output": template, }, @@ -482,9 +478,8 @@ func ListPrivateEndpointServicesBuilder() *cobra.Command { opts := ListPrivateEndpointServicesOpts{} cmd := &cobra.Command{ - Use: "listPrivateEndpointServices", - // Aliases: []string{"?"}, - Short: "Return All Private Endpoint Services for One Provider", + Use: "listPrivateEndpointServices", + Short: "Return All Private Endpoint Services for One Provider", Annotations: map[string]string{ "output": template, }, @@ -539,9 +534,8 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { opts := ToggleRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ - Use: "toggleRegionalizedPrivateEndpointSetting", - // Aliases: []string{"?"}, - Short: "Toggle Regionalized Private Endpoint Status", + Use: "toggleRegionalizedPrivateEndpointSetting", + Short: "Toggle Regionalized Private Endpoint Status", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 619c9fbda3..ca36612e57 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func AddProjectApiKeyBuilder() *cobra.Command { opts := AddProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "addProjectApiKey", - // Aliases: []string{"?"}, - Short: "Assign One Organization API Key to One Project", + Use: "addProjectApiKey", + Short: "Assign One Organization API Key to One Project", Annotations: map[string]string{ "output": template, }, @@ -117,9 +119,8 @@ func CreateApiKeyBuilder() *cobra.Command { opts := CreateApiKeyOpts{} cmd := &cobra.Command{ - Use: "createApiKey", - // Aliases: []string{"?"}, - Short: "Create One Organization API Key", + Use: "createApiKey", + Short: "Create One Organization API Key", Annotations: map[string]string{ "output": template, }, @@ -164,9 +165,9 @@ func (opts *CreateApiKeyAccessListOpts) Run(ctx context.Context) error { OrgId: opts.orgId, ApiUserId: opts.apiUserId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params).Execute() if err != nil { @@ -181,9 +182,8 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { opts := CreateApiKeyAccessListOpts{} cmd := &cobra.Command{ - Use: "createApiKeyAccessList", - // Aliases: []string{"?"}, - Short: "Create Access List Entries for One Organization API Key", + Use: "createApiKeyAccessList", + Short: "Create Access List Entries for One Organization API Key", Annotations: map[string]string{ "output": template, }, @@ -242,9 +242,8 @@ func CreateProjectApiKeyBuilder() *cobra.Command { opts := CreateProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "createProjectApiKey", - // Aliases: []string{"?"}, - Short: "Create and Assign One Organization API Key to One Project", + Use: "createProjectApiKey", + Short: "Create and Assign One Organization API Key to One Project", Annotations: map[string]string{ "output": template, }, @@ -298,9 +297,8 @@ func DeleteApiKeyBuilder() *cobra.Command { opts := DeleteApiKeyOpts{} cmd := &cobra.Command{ - Use: "deleteApiKey", - // Aliases: []string{"?"}, - Short: "Remove One Organization API Key", + Use: "deleteApiKey", + Short: "Remove One Organization API Key", Annotations: map[string]string{ "output": template, }, @@ -357,9 +355,8 @@ func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { opts := DeleteApiKeyAccessListEntryOpts{} cmd := &cobra.Command{ - Use: "deleteApiKeyAccessListEntry", - // Aliases: []string{"?"}, - Short: "Remove One Access List Entry for One Organization API Key", + Use: "deleteApiKeyAccessListEntry", + Short: "Remove One Access List Entry for One Organization API Key", Annotations: map[string]string{ "output": template, }, @@ -416,9 +413,8 @@ func GetApiKeyBuilder() *cobra.Command { opts := GetApiKeyOpts{} cmd := &cobra.Command{ - Use: "getApiKey", - // Aliases: []string{"?"}, - Short: "Return One Organization API Key", + Use: "getApiKey", + Short: "Return One Organization API Key", Annotations: map[string]string{ "output": template, }, @@ -475,9 +471,8 @@ func GetApiKeyAccessListBuilder() *cobra.Command { opts := GetApiKeyAccessListOpts{} cmd := &cobra.Command{ - Use: "getApiKeyAccessList", - // Aliases: []string{"?"}, - Short: "Return One Access List Entry for One Organization API Key", + Use: "getApiKeyAccessList", + Short: "Return One Access List Entry for One Organization API Key", Annotations: map[string]string{ "output": template, }, @@ -523,9 +518,9 @@ func (opts *ListApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { params := &admin.ListApiKeyAccessListsEntriesApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(ctx, params).Execute() if err != nil { @@ -540,9 +535,8 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { opts := ListApiKeyAccessListsEntriesOpts{} cmd := &cobra.Command{ - Use: "listApiKeyAccessListsEntries", - // Aliases: []string{"?"}, - Short: "Return All Access List Entries for One Organization API Key", + Use: "listApiKeyAccessListsEntries", + Short: "Return All Access List Entries for One Organization API Key", Annotations: map[string]string{ "output": template, }, @@ -587,9 +581,9 @@ func (opts *ListApiKeysOpts) initClient() func() error { func (opts *ListApiKeysOpts) Run(ctx context.Context) error { params := &admin.ListApiKeysApiParams{ OrgId: opts.orgId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeysWithParams(ctx, params).Execute() if err != nil { @@ -604,9 +598,8 @@ func ListApiKeysBuilder() *cobra.Command { opts := ListApiKeysOpts{} cmd := &cobra.Command{ - Use: "listApiKeys", - // Aliases: []string{"?"}, - Short: "Return All Organization API Keys", + Use: "listApiKeys", + Short: "Return All Organization API Keys", Annotations: map[string]string{ "output": template, }, @@ -649,9 +642,9 @@ func (opts *ListProjectApiKeysOpts) initClient() func() error { func (opts *ListProjectApiKeysOpts) Run(ctx context.Context) error { params := &admin.ListProjectApiKeysApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(ctx, params).Execute() if err != nil { @@ -666,9 +659,8 @@ func ListProjectApiKeysBuilder() *cobra.Command { opts := ListProjectApiKeysOpts{} cmd := &cobra.Command{ - Use: "listProjectApiKeys", - // Aliases: []string{"?"}, - Short: "Return All Organization API Keys Assigned to One Project", + Use: "listProjectApiKeys", + Short: "Return All Organization API Keys Assigned to One Project", Annotations: map[string]string{ "output": template, }, @@ -724,9 +716,8 @@ func RemoveProjectApiKeyBuilder() *cobra.Command { opts := RemoveProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "removeProjectApiKey", - // Aliases: []string{"?"}, - Short: "Unassign One Organization API Key from One Project", + Use: "removeProjectApiKey", + Short: "Unassign One Organization API Key from One Project", Annotations: map[string]string{ "output": template, }, @@ -783,9 +774,8 @@ func UpdateApiKeyBuilder() *cobra.Command { opts := UpdateApiKeyOpts{} cmd := &cobra.Command{ - Use: "updateApiKey", - // Aliases: []string{"?"}, - Short: "Update One Organization API Key", + Use: "updateApiKey", + Short: "Update One Organization API Key", Annotations: map[string]string{ "output": template, }, @@ -832,9 +822,9 @@ func (opts *UpdateApiKeyRolesOpts) Run(ctx context.Context) error { GroupId: opts.groupId, ApiUserId: opts.apiUserId, - PageNum: opts.pageNum, - ItemsPerPage: opts.itemsPerPage, - IncludeCount: opts.includeCount, + PageNum: &opts.pageNum, + ItemsPerPage: &opts.itemsPerPage, + IncludeCount: &opts.includeCount, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params).Execute() if err != nil { @@ -849,9 +839,8 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { opts := UpdateApiKeyRolesOpts{} cmd := &cobra.Command{ - Use: "updateApiKeyRoles", - // Aliases: []string{"?"}, - Short: "Update Roles of One Organization API Key to One Project", + Use: "updateApiKeyRoles", + Short: "Update Roles of One Organization API Key to One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 8f6011e20f..7738032cb3 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -46,9 +49,9 @@ func (opts *CreateProjectIpAccessListOpts) Run(ctx context.Context) error { params := &admin.CreateProjectIpAccessListApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params).Execute() if err != nil { @@ -63,9 +66,8 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { opts := CreateProjectIpAccessListOpts{} cmd := &cobra.Command{ - Use: "createProjectIpAccessList", - // Aliases: []string{"?"}, - Short: "Add Entries to Project IP Access List", + Use: "createProjectIpAccessList", + Short: "Add Entries to Project IP Access List", Annotations: map[string]string{ "output": template, }, @@ -122,9 +124,8 @@ func DeleteProjectIpAccessListBuilder() *cobra.Command { opts := DeleteProjectIpAccessListOpts{} cmd := &cobra.Command{ - Use: "deleteProjectIpAccessList", - // Aliases: []string{"?"}, - Short: "Remove One Entry from One Project IP Access List", + Use: "deleteProjectIpAccessList", + Short: "Remove One Entry from One Project IP Access List", Annotations: map[string]string{ "output": template, }, @@ -179,9 +180,8 @@ func GetProjectIpAccessListStatusBuilder() *cobra.Command { opts := GetProjectIpAccessListStatusOpts{} cmd := &cobra.Command{ - Use: "getProjectIpAccessListStatus", - // Aliases: []string{"?"}, - Short: "Return Status of One Project IP Access List Entry", + Use: "getProjectIpAccessListStatus", + Short: "Return Status of One Project IP Access List Entry", Annotations: map[string]string{ "output": template, }, @@ -236,9 +236,8 @@ func GetProjectIpListBuilder() *cobra.Command { opts := GetProjectIpListOpts{} cmd := &cobra.Command{ - Use: "getProjectIpList", - // Aliases: []string{"?"}, - Short: "Return One Project IP Access List Entry", + Use: "getProjectIpList", + Short: "Return One Project IP Access List Entry", Annotations: map[string]string{ "output": template, }, @@ -280,9 +279,9 @@ func (opts *ListProjectIpAccessListsOpts) initClient() func() error { func (opts *ListProjectIpAccessListsOpts) Run(ctx context.Context) error { params := &admin.ListProjectIpAccessListsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(ctx, params).Execute() if err != nil { @@ -297,9 +296,8 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { opts := ListProjectIpAccessListsOpts{} cmd := &cobra.Command{ - Use: "listProjectIpAccessLists", - // Aliases: []string{"?"}, - Short: "Return Project IP Access List", + Use: "listProjectIpAccessLists", + Short: "Return Project IP Access List", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index f57bd76f5d..7706f9bac5 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -42,7 +45,7 @@ func (opts *CreateProjectOpts) initClient() func() error { func (opts *CreateProjectOpts) Run(ctx context.Context) error { params := &admin.CreateProjectApiParams{ - ProjectOwnerId: opts.projectOwnerId, + ProjectOwnerId: &opts.projectOwnerId, } resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params).Execute() if err != nil { @@ -57,9 +60,8 @@ func CreateProjectBuilder() *cobra.Command { opts := CreateProjectOpts{} cmd := &cobra.Command{ - Use: "createProject", - // Aliases: []string{"?"}, - Short: "Create One Project", + Use: "createProject", + Short: "Create One Project", Annotations: map[string]string{ "output": template, }, @@ -112,9 +114,8 @@ func CreateProjectInvitationBuilder() *cobra.Command { opts := CreateProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "createProjectInvitation", - // Aliases: []string{"?"}, - Short: "Invite One MongoDB Cloud User to Join One Project", + Use: "createProjectInvitation", + Short: "Invite One MongoDB Cloud User to Join One Project", Annotations: map[string]string{ "output": template, }, @@ -166,9 +167,8 @@ func DeleteProjectBuilder() *cobra.Command { opts := DeleteProjectOpts{} cmd := &cobra.Command{ - Use: "deleteProject", - // Aliases: []string{"?"}, - Short: "Remove One Project", + Use: "deleteProject", + Short: "Remove One Project", Annotations: map[string]string{ "output": template, }, @@ -221,9 +221,8 @@ func DeleteProjectInvitationBuilder() *cobra.Command { opts := DeleteProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "deleteProjectInvitation", - // Aliases: []string{"?"}, - Short: "Cancel One Project Invitation", + Use: "deleteProjectInvitation", + Short: "Cancel One Project Invitation", Annotations: map[string]string{ "output": template, }, @@ -278,9 +277,8 @@ func DeleteProjectLimitBuilder() *cobra.Command { opts := DeleteProjectLimitOpts{} cmd := &cobra.Command{ - Use: "deleteProjectLimit", - // Aliases: []string{"?"}, - Short: "Remove One Project Limit", + Use: "deleteProjectLimit", + Short: "Remove One Project Limit", Annotations: map[string]string{ "output": template, }, @@ -333,9 +331,8 @@ func GetProjectBuilder() *cobra.Command { opts := GetProjectOpts{} cmd := &cobra.Command{ - Use: "getProject", - // Aliases: []string{"?"}, - Short: "Return One Project", + Use: "getProject", + Short: "Return One Project", Annotations: map[string]string{ "output": template, }, @@ -386,9 +383,8 @@ func GetProjectByNameBuilder() *cobra.Command { opts := GetProjectByNameOpts{} cmd := &cobra.Command{ - Use: "getProjectByName", - // Aliases: []string{"?"}, - Short: "Return One Project using Its Name", + Use: "getProjectByName", + Short: "Return One Project using Its Name", Annotations: map[string]string{ "output": template, }, @@ -441,9 +437,8 @@ func GetProjectInvitationBuilder() *cobra.Command { opts := GetProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "getProjectInvitation", - // Aliases: []string{"?"}, - Short: "Return One Project Invitation", + Use: "getProjectInvitation", + Short: "Return One Project Invitation", Annotations: map[string]string{ "output": template, }, @@ -498,9 +493,8 @@ func GetProjectLimitBuilder() *cobra.Command { opts := GetProjectLimitOpts{} cmd := &cobra.Command{ - Use: "getProjectLimit", - // Aliases: []string{"?"}, - Short: "Return One Limit for One Project", + Use: "getProjectLimit", + Short: "Return One Limit for One Project", Annotations: map[string]string{ "output": template, }, @@ -553,9 +547,8 @@ func GetProjectSettingsBuilder() *cobra.Command { opts := GetProjectSettingsOpts{} cmd := &cobra.Command{ - Use: "getProjectSettings", - // Aliases: []string{"?"}, - Short: "Return One Project Settings", + Use: "getProjectSettings", + Short: "Return One Project Settings", Annotations: map[string]string{ "output": template, }, @@ -593,7 +586,7 @@ func (opts *ListProjectInvitationsOpts) initClient() func() error { func (opts *ListProjectInvitationsOpts) Run(ctx context.Context) error { params := &admin.ListProjectInvitationsApiParams{ GroupId: opts.groupId, - Username: opts.username, + Username: &opts.username, } resp, _, err := opts.client.ProjectsApi.ListProjectInvitationsWithParams(ctx, params).Execute() if err != nil { @@ -608,9 +601,8 @@ func ListProjectInvitationsBuilder() *cobra.Command { opts := ListProjectInvitationsOpts{} cmd := &cobra.Command{ - Use: "listProjectInvitations", - // Aliases: []string{"?"}, - Short: "Return All Project Invitations", + Use: "listProjectInvitations", + Short: "Return All Project Invitations", Annotations: map[string]string{ "output": template, }, @@ -662,9 +654,8 @@ func ListProjectLimitsBuilder() *cobra.Command { opts := ListProjectLimitsOpts{} cmd := &cobra.Command{ - Use: "listProjectLimits", - // Aliases: []string{"?"}, - Short: "Return All Limits for One Project", + Use: "listProjectLimits", + Short: "Return All Limits for One Project", Annotations: map[string]string{ "output": template, }, @@ -706,11 +697,11 @@ func (opts *ListProjectUsersOpts) initClient() func() error { func (opts *ListProjectUsersOpts) Run(ctx context.Context) error { params := &admin.ListProjectUsersApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, - FlattenTeams: opts.flattenTeams, - IncludeOrgUsers: opts.includeOrgUsers, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + FlattenTeams: &opts.flattenTeams, + IncludeOrgUsers: &opts.includeOrgUsers, } resp, _, err := opts.client.ProjectsApi.ListProjectUsersWithParams(ctx, params).Execute() if err != nil { @@ -725,9 +716,8 @@ func ListProjectUsersBuilder() *cobra.Command { opts := ListProjectUsersOpts{} cmd := &cobra.Command{ - Use: "listProjectUsers", - // Aliases: []string{"?"}, - Short: "Return All Users in One Project", + Use: "listProjectUsers", + Short: "Return All Users in One Project", Annotations: map[string]string{ "output": template, }, @@ -770,9 +760,9 @@ func (opts *ListProjectsOpts) initClient() func() error { func (opts *ListProjectsOpts) Run(ctx context.Context) error { params := &admin.ListProjectsApiParams{ - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProjectsApi.ListProjectsWithParams(ctx, params).Execute() if err != nil { @@ -787,9 +777,8 @@ func ListProjectsBuilder() *cobra.Command { opts := ListProjectsOpts{} cmd := &cobra.Command{ - Use: "listProjects", - // Aliases: []string{"?"}, - Short: "Return All Projects", + Use: "listProjects", + Short: "Return All Projects", Annotations: map[string]string{ "output": template, }, @@ -843,9 +832,8 @@ func RemoveProjectUserBuilder() *cobra.Command { opts := RemoveProjectUserOpts{} cmd := &cobra.Command{ - Use: "removeProjectUser", - // Aliases: []string{"?"}, - Short: "Remove One User from One Project", + Use: "removeProjectUser", + Short: "Remove One User from One Project", Annotations: map[string]string{ "output": template, }, @@ -902,9 +890,8 @@ func SetProjectLimitBuilder() *cobra.Command { opts := SetProjectLimitOpts{} cmd := &cobra.Command{ - Use: "setProjectLimit", - // Aliases: []string{"?"}, - Short: "Set One Project Limit", + Use: "setProjectLimit", + Short: "Set One Project Limit", Annotations: map[string]string{ "output": template, }, @@ -960,9 +947,8 @@ func UpdateProjectBuilder() *cobra.Command { opts := UpdateProjectOpts{} cmd := &cobra.Command{ - Use: "updateProject", - // Aliases: []string{"?"}, - Short: "Update One Project Name", + Use: "updateProject", + Short: "Update One Project Name", Annotations: map[string]string{ "output": template, }, @@ -1016,9 +1002,8 @@ func UpdateProjectInvitationBuilder() *cobra.Command { opts := UpdateProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "updateProjectInvitation", - // Aliases: []string{"?"}, - Short: "Update One Project Invitation", + Use: "updateProjectInvitation", + Short: "Update One Project Invitation", Annotations: map[string]string{ "output": template, }, @@ -1074,9 +1059,8 @@ func UpdateProjectInvitationByIdBuilder() *cobra.Command { opts := UpdateProjectInvitationByIdOpts{} cmd := &cobra.Command{ - Use: "updateProjectInvitationById", - // Aliases: []string{"?"}, - Short: "Update One Project Invitation by Invitation ID", + Use: "updateProjectInvitationById", + Short: "Update One Project Invitation by Invitation ID", Annotations: map[string]string{ "output": template, }, @@ -1132,9 +1116,8 @@ func UpdateProjectSettingsBuilder() *cobra.Command { opts := UpdateProjectSettingsOpts{} cmd := &cobra.Command{ - Use: "updateProjectSettings", - // Aliases: []string{"?"}, - Short: "Update One Project Settings", + Use: "updateProjectSettings", + Short: "Update One Project Settings", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index a5dba2f393..7a241db3c9 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateRollingIndexBuilder() *cobra.Command { opts := CreateRollingIndexOpts{} cmd := &cobra.Command{ - Use: "createRollingIndex", - // Aliases: []string{"?"}, - Short: "Create One Rolling Index", + Use: "createRollingIndex", + Short: "Create One Rolling Index", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index d9c8ed7e7f..07d1d8c545 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -53,9 +56,8 @@ func GetSystemStatusBuilder() *cobra.Command { opts := GetSystemStatusOpts{} cmd := &cobra.Command{ - Use: "getSystemStatus", - // Aliases: []string{"?"}, - Short: "Return the status of this MongoDB application", + Use: "getSystemStatus", + Short: "Return the status of this MongoDB application", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index c5f25cf9be..06a761be33 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func CreateServerlessInstanceBuilder() *cobra.Command { opts := CreateServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "createServerlessInstance", - // Aliases: []string{"?"}, - Short: "Create One Serverless Instance in One Project", + Use: "createServerlessInstance", + Short: "Create One Serverless Instance in One Project", Annotations: map[string]string{ "output": template, }, @@ -113,9 +115,8 @@ func DeleteServerlessInstanceBuilder() *cobra.Command { opts := DeleteServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "deleteServerlessInstance", - // Aliases: []string{"?"}, - Short: "Remove One Serverless Instance from One Project", + Use: "deleteServerlessInstance", + Short: "Remove One Serverless Instance from One Project", Annotations: map[string]string{ "output": template, }, @@ -170,9 +171,8 @@ func GetServerlessInstanceBuilder() *cobra.Command { opts := GetServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "getServerlessInstance", - // Aliases: []string{"?"}, - Short: "Return One Serverless Instance from One Project", + Use: "getServerlessInstance", + Short: "Return One Serverless Instance from One Project", Annotations: map[string]string{ "output": template, }, @@ -214,9 +214,9 @@ func (opts *ListServerlessInstancesOpts) initClient() func() error { func (opts *ListServerlessInstancesOpts) Run(ctx context.Context) error { params := &admin.ListServerlessInstancesApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params).Execute() if err != nil { @@ -231,9 +231,8 @@ func ListServerlessInstancesBuilder() *cobra.Command { opts := ListServerlessInstancesOpts{} cmd := &cobra.Command{ - Use: "listServerlessInstances", - // Aliases: []string{"?"}, - Short: "Return All Serverless Instances from One Project", + Use: "listServerlessInstances", + Short: "Return All Serverless Instances from One Project", Annotations: map[string]string{ "output": template, }, @@ -291,9 +290,8 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { opts := UpdateServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "updateServerlessInstance", - // Aliases: []string{"?"}, - Short: "Update One Serverless Instance in One Project", + Use: "updateServerlessInstance", + Short: "Update One Serverless Instance in One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index e5d211ac7e..2554f45d4c 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateServerlessPrivateEndpointBuilder() *cobra.Command { opts := CreateServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "createServerlessPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Create One Private Endpoint for One Serverless Instance", + Use: "createServerlessPrivateEndpoint", + Short: "Create One Private Endpoint for One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -119,9 +121,8 @@ func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { opts := DeleteServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "deleteServerlessPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Remove One Private Endpoint for One Serverless Instance", + Use: "deleteServerlessPrivateEndpoint", + Short: "Remove One Private Endpoint for One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -180,9 +181,8 @@ func GetServerlessPrivateEndpointBuilder() *cobra.Command { opts := GetServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "getServerlessPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Return One Private Endpoint for One Serverless Instance", + Use: "getServerlessPrivateEndpoint", + Short: "Return One Private Endpoint for One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -239,9 +239,8 @@ func ListServerlessPrivateEndpointsBuilder() *cobra.Command { opts := ListServerlessPrivateEndpointsOpts{} cmd := &cobra.Command{ - Use: "listServerlessPrivateEndpoints", - // Aliases: []string{"?"}, - Short: "Return All Private Endpoints for One Serverless Instance", + Use: "listServerlessPrivateEndpoints", + Short: "Return All Private Endpoints for One Serverless Instance", Annotations: map[string]string{ "output": template, }, @@ -300,9 +299,8 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { opts := UpdateServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "updateServerlessPrivateEndpoint", - // Aliases: []string{"?"}, - Short: "Update One Private Endpoint for One Serverless Instance", + Use: "updateServerlessPrivateEndpoint", + Short: "Update One Private Endpoint for One Serverless Instance", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index 5e7be7dd0f..0b13bf95a3 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { opts := CreateSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createSharedClusterBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Create One Restore Job from One M2 or M5 Cluster", + Use: "createSharedClusterBackupRestoreJob", + Short: "Create One Restore Job from One M2 or M5 Cluster", Annotations: map[string]string{ "output": template, }, @@ -119,9 +121,8 @@ func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { opts := GetSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getSharedClusterBackupRestoreJob", - // Aliases: []string{"?"}, - Short: "Return One Restore Job for One M2 or M5 Cluster", + Use: "getSharedClusterBackupRestoreJob", + Short: "Return One Restore Job for One M2 or M5 Cluster", Annotations: map[string]string{ "output": template, }, @@ -178,9 +179,8 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { opts := ListSharedClusterBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listSharedClusterBackupRestoreJobs", - // Aliases: []string{"?"}, - Short: "Return All Restore Jobs for One M2 or M5 Cluster", + Use: "listSharedClusterBackupRestoreJobs", + Short: "Return All Restore Jobs for One M2 or M5 Cluster", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index b19754a4f9..68a0f20447 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func DownloadSharedClusterBackupBuilder() *cobra.Command { opts := DownloadSharedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "downloadSharedClusterBackup", - // Aliases: []string{"?"}, - Short: "Download One M2 or M5 Cluster Snapshot", + Use: "downloadSharedClusterBackup", + Short: "Download One M2 or M5 Cluster Snapshot", Annotations: map[string]string{ "output": template, }, @@ -119,9 +121,8 @@ func GetSharedClusterBackupBuilder() *cobra.Command { opts := GetSharedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "getSharedClusterBackup", - // Aliases: []string{"?"}, - Short: "Return One Snapshot for One M2 or M5 Cluster", + Use: "getSharedClusterBackup", + Short: "Return One Snapshot for One M2 or M5 Cluster", Annotations: map[string]string{ "output": template, }, @@ -178,9 +179,8 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { opts := ListSharedClusterBackupsOpts{} cmd := &cobra.Command{ - Use: "listSharedClusterBackups", - // Aliases: []string{"?"}, - Short: "Return All Snapshots for One M2 or M5 Cluster", + Use: "listSharedClusterBackups", + Short: "Return All Snapshots for One M2 or M5 Cluster", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 4f9532c3d2..9810f583b2 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -57,9 +60,8 @@ func AddAllTeamsToProjectBuilder() *cobra.Command { opts := AddAllTeamsToProjectOpts{} cmd := &cobra.Command{ - Use: "addAllTeamsToProject", - // Aliases: []string{"?"}, - Short: "Add One or More Teams to One Project", + Use: "addAllTeamsToProject", + Short: "Add One or More Teams to One Project", Annotations: map[string]string{ "output": template, }, @@ -115,9 +117,8 @@ func AddTeamUserBuilder() *cobra.Command { opts := AddTeamUserOpts{} cmd := &cobra.Command{ - Use: "addTeamUser", - // Aliases: []string{"?"}, - Short: "Assign MongoDB Cloud Users from One Organization to One Team", + Use: "addTeamUser", + Short: "Assign MongoDB Cloud Users from One Organization to One Team", Annotations: map[string]string{ "output": template, }, @@ -173,9 +174,8 @@ func CreateTeamBuilder() *cobra.Command { opts := CreateTeamOpts{} cmd := &cobra.Command{ - Use: "createTeam", - // Aliases: []string{"?"}, - Short: "Create One Team in One Organization", + Use: "createTeam", + Short: "Create One Team in One Organization", Annotations: map[string]string{ "output": template, }, @@ -229,9 +229,8 @@ func DeleteTeamBuilder() *cobra.Command { opts := DeleteTeamOpts{} cmd := &cobra.Command{ - Use: "deleteTeam", - // Aliases: []string{"?"}, - Short: "Remove One Team from One Organization", + Use: "deleteTeam", + Short: "Remove One Team from One Organization", Annotations: map[string]string{ "output": template, }, @@ -286,9 +285,8 @@ func GetTeamByIdBuilder() *cobra.Command { opts := GetTeamByIdOpts{} cmd := &cobra.Command{ - Use: "getTeamById", - // Aliases: []string{"?"}, - Short: "Return One Team using its ID", + Use: "getTeamById", + Short: "Return One Team using its ID", Annotations: map[string]string{ "output": template, }, @@ -343,9 +341,8 @@ func GetTeamByNameBuilder() *cobra.Command { opts := GetTeamByNameOpts{} cmd := &cobra.Command{ - Use: "getTeamByName", - // Aliases: []string{"?"}, - Short: "Return One Team using its Name", + Use: "getTeamByName", + Short: "Return One Team using its Name", Annotations: map[string]string{ "output": template, }, @@ -387,9 +384,9 @@ func (opts *ListOrganizationTeamsOpts) initClient() func() error { func (opts *ListOrganizationTeamsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationTeamsApiParams{ OrgId: opts.orgId, - ItemsPerPage: opts.itemsPerPage, - IncludeCount: opts.includeCount, - PageNum: opts.pageNum, + ItemsPerPage: &opts.itemsPerPage, + IncludeCount: &opts.includeCount, + PageNum: &opts.pageNum, } resp, _, err := opts.client.TeamsApi.ListOrganizationTeamsWithParams(ctx, params).Execute() if err != nil { @@ -404,9 +401,8 @@ func ListOrganizationTeamsBuilder() *cobra.Command { opts := ListOrganizationTeamsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationTeams", - // Aliases: []string{"?"}, - Short: "Return All Teams in One Organization", + Use: "listOrganizationTeams", + Short: "Return All Teams in One Organization", Annotations: map[string]string{ "output": template, }, @@ -449,9 +445,9 @@ func (opts *ListProjectTeamsOpts) initClient() func() error { func (opts *ListProjectTeamsOpts) Run(ctx context.Context) error { params := &admin.ListProjectTeamsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.TeamsApi.ListProjectTeamsWithParams(ctx, params).Execute() if err != nil { @@ -466,9 +462,8 @@ func ListProjectTeamsBuilder() *cobra.Command { opts := ListProjectTeamsOpts{} cmd := &cobra.Command{ - Use: "listProjectTeams", - // Aliases: []string{"?"}, - Short: "Return All Teams in One Project", + Use: "listProjectTeams", + Short: "Return All Teams in One Project", Annotations: map[string]string{ "output": template, }, @@ -512,8 +507,8 @@ func (opts *ListTeamUsersOpts) Run(ctx context.Context) error { params := &admin.ListTeamUsersApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.TeamsApi.ListTeamUsersWithParams(ctx, params).Execute() if err != nil { @@ -528,9 +523,8 @@ func ListTeamUsersBuilder() *cobra.Command { opts := ListTeamUsersOpts{} cmd := &cobra.Command{ - Use: "listTeamUsers", - // Aliases: []string{"?"}, - Short: "Return All MongoDB Cloud Users Assigned to One Team", + Use: "listTeamUsers", + Short: "Return All MongoDB Cloud Users Assigned to One Team", Annotations: map[string]string{ "output": template, }, @@ -587,9 +581,8 @@ func RemoveProjectTeamBuilder() *cobra.Command { opts := RemoveProjectTeamOpts{} cmd := &cobra.Command{ - Use: "removeProjectTeam", - // Aliases: []string{"?"}, - Short: "Remove One Team from One Project", + Use: "removeProjectTeam", + Short: "Remove One Team from One Project", Annotations: map[string]string{ "output": template, }, @@ -646,9 +639,8 @@ func RemoveTeamUserBuilder() *cobra.Command { opts := RemoveTeamUserOpts{} cmd := &cobra.Command{ - Use: "removeTeamUser", - // Aliases: []string{"?"}, - Short: "Remove One MongoDB Cloud User from One Team", + Use: "removeTeamUser", + Short: "Remove One MongoDB Cloud User from One Team", Annotations: map[string]string{ "output": template, }, @@ -707,9 +699,8 @@ func RenameTeamBuilder() *cobra.Command { opts := RenameTeamOpts{} cmd := &cobra.Command{ - Use: "renameTeam", - // Aliases: []string{"?"}, - Short: "Rename One Team", + Use: "renameTeam", + Short: "Rename One Team", Annotations: map[string]string{ "output": template, }, @@ -767,9 +758,8 @@ func UpdateTeamRolesBuilder() *cobra.Command { opts := UpdateTeamRolesOpts{} cmd := &cobra.Command{ - Use: "updateTeamRoles", - // Aliases: []string{"?"}, - Short: "Update Team Roles in One Project", + Use: "updateTeamRoles", + Short: "Update Team Roles in One Project", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index 4bb696e80c..a2151cb3a2 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -40,7 +43,7 @@ func (opts *VersionedExampleOpts) initClient() func() error { func (opts *VersionedExampleOpts) Run(ctx context.Context) error { params := &admin.VersionedExampleApiParams{ - AdditionalInfo: opts.additionalInfo, + AdditionalInfo: &opts.additionalInfo, } resp, _, err := opts.client.TestApi.VersionedExampleWithParams(ctx, params).Execute() if err != nil { @@ -55,9 +58,8 @@ func VersionedExampleBuilder() *cobra.Command { opts := VersionedExampleOpts{} cmd := &cobra.Command{ - Use: "versionedExample", - // Aliases: []string{"?"}, - Short: "Example resource info for versioning of the Atlas API", + Use: "versionedExample", + Short: "Example resource info for versioning of the Atlas API", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index 45a9a7d03a..ae593e3c5e 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -48,9 +51,9 @@ func (opts *CreateThirdPartyIntegrationOpts) Run(ctx context.Context) error { IntegrationType: opts.integrationType, GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { @@ -65,9 +68,8 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { opts := CreateThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "createThirdPartyIntegration", - // Aliases: []string{"?"}, - Short: "Configure One Third-Party Service Integration", + Use: "createThirdPartyIntegration", + Short: "Configure One Third-Party Service Integration", Annotations: map[string]string{ "output": template, }, @@ -126,9 +128,8 @@ func DeleteThirdPartyIntegrationBuilder() *cobra.Command { opts := DeleteThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "deleteThirdPartyIntegration", - // Aliases: []string{"?"}, - Short: "Remove One Third-Party Service Integration", + Use: "deleteThirdPartyIntegration", + Short: "Remove One Third-Party Service Integration", Annotations: map[string]string{ "output": template, }, @@ -183,9 +184,8 @@ func GetThirdPartyIntegrationBuilder() *cobra.Command { opts := GetThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "getThirdPartyIntegration", - // Aliases: []string{"?"}, - Short: "Return One Third-Party Service Integration", + Use: "getThirdPartyIntegration", + Short: "Return One Third-Party Service Integration", Annotations: map[string]string{ "output": template, }, @@ -227,9 +227,9 @@ func (opts *ListThirdPartyIntegrationsOpts) initClient() func() error { func (opts *ListThirdPartyIntegrationsOpts) Run(ctx context.Context) error { params := &admin.ListThirdPartyIntegrationsApiParams{ GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(ctx, params).Execute() if err != nil { @@ -244,9 +244,8 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { opts := ListThirdPartyIntegrationsOpts{} cmd := &cobra.Command{ - Use: "listThirdPartyIntegrations", - // Aliases: []string{"?"}, - Short: "Return All Active Third-Party Service Integrations", + Use: "listThirdPartyIntegrations", + Short: "Return All Active Third-Party Service Integrations", Annotations: map[string]string{ "output": template, }, @@ -293,9 +292,9 @@ func (opts *UpdateThirdPartyIntegrationOpts) Run(ctx context.Context) error { IntegrationType: opts.integrationType, GroupId: opts.groupId, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { @@ -310,9 +309,8 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { opts := UpdateThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "updateThirdPartyIntegration", - // Aliases: []string{"?"}, - Short: "Update One Third-Party Service Integration", + Use: "updateThirdPartyIntegration", + Short: "Update One Third-Party Service Integration", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 8546fbb647..5602ec0d22 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -18,6 +18,9 @@ package generated import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "github.com/mongodb/mongodb-atlas-cli/internal/cli" @@ -59,9 +62,8 @@ func CreateDatabaseUserCertificateBuilder() *cobra.Command { opts := CreateDatabaseUserCertificateOpts{} cmd := &cobra.Command{ - Use: "createDatabaseUserCertificate", - // Aliases: []string{"?"}, - Short: "Create One X.509 Certificate for One MongoDB User", + Use: "createDatabaseUserCertificate", + Short: "Create One X.509 Certificate for One MongoDB User", Annotations: map[string]string{ "output": template, }, @@ -115,9 +117,8 @@ func DisableCustomerManagedX509Builder() *cobra.Command { opts := DisableCustomerManagedX509Opts{} cmd := &cobra.Command{ - Use: "disableCustomerManagedX509", - // Aliases: []string{"?"}, - Short: "Disable Customer-Managed X.509", + Use: "disableCustomerManagedX509", + Short: "Disable Customer-Managed X.509", Annotations: map[string]string{ "output": template, }, @@ -159,9 +160,9 @@ func (opts *ListDatabaseUserCertificatesOpts) Run(ctx context.Context) error { params := &admin.ListDatabaseUserCertificatesApiParams{ GroupId: opts.groupId, Username: opts.username, - IncludeCount: opts.includeCount, - ItemsPerPage: opts.itemsPerPage, - PageNum: opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(ctx, params).Execute() if err != nil { @@ -176,9 +177,8 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { opts := ListDatabaseUserCertificatesOpts{} cmd := &cobra.Command{ - Use: "listDatabaseUserCertificates", - // Aliases: []string{"?"}, - Short: "Return All X.509 Certificates Assigned to One MongoDB User", + Use: "listDatabaseUserCertificates", + Short: "Return All X.509 Certificates Assigned to One MongoDB User", Annotations: map[string]string{ "output": template, }, diff --git a/internal/generated/generated.go b/internal/generated/generated.go index 6c012b240c..5cb152cc9c 100644 --- a/internal/generated/generated.go +++ b/internal/generated/generated.go @@ -122,6 +122,18 @@ func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { return tr.base.RoundTrip(req) } +func convertTime(s *string) *time.Time { + if s == nil { + return nil + } + + r, err := time.Parse(time.RFC3339, s) + if err != nil { + return nil + } + return r +} + func Commands() []*cobra.Command { return []*cobra.Command { AWSClustersDNSBuilder(), diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 8e7bad770e..7fe223ff81 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -3,6 +3,9 @@ package {{packageName}} import ( "context" + "os" + "time" + "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/cli" @@ -30,7 +33,7 @@ func (opts *{{operationId}}Opts) initClient() func() error { func (opts *{{operationId}}Opts) Run(ctx context.Context) error { params := &admin.{{operationId}}ApiParams{ {{#allParams}} - {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: opts.{{paramName}},{{/isBodyParam}} + {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: {{#isDateTime}}convertTime({{/isDateTime}}{{^required}}&{{/required}}opts.{{paramName}}{{#isDateTime}}){{/isDateTime}},{{/isBodyParam}} {{/allParams}} } {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params).Execute() @@ -46,9 +49,8 @@ func {{operationId}}Builder() *cobra.Command { opts := {{operationId}}Opts{} cmd := &cobra.Command{ - Use: "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}", - // Aliases: []string{"?"}, - Short: "{{ summary }}", + Use: "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}", + Short: "{{ summary }}", Annotations: map[string]string{ "output": template, }, @@ -63,7 +65,7 @@ func {{operationId}}Builder() *cobra.Command { }, } {{#allParams}} - {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, "{{description}}"){{/isBodyParam}} + {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, "{{description}}"){{/isBodyParam}} {{/allParams}} {{#allParams}}{{^isBodyParam}}{{#required}} _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/isBodyParam}}{{/allParams}} diff --git a/tools/openapi-generator/config/go-templates/generated.mustache b/tools/openapi-generator/config/go-templates/generated.mustache index 76269f0108..d9fbf6ac85 100644 --- a/tools/openapi-generator/config/go-templates/generated.mustache +++ b/tools/openapi-generator/config/go-templates/generated.mustache @@ -107,6 +107,18 @@ func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { return tr.base.RoundTrip(req) } +func convertTime(s *string) *time.Time { + if s == nil { + return nil + } + + r, err := time.Parse(time.RFC3339, s) + if err != nil { + return nil + } + return r +} + func Commands() []*cobra.Command { return []*cobra.Command { {{#apiInfo}} diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index f160df1212..fe2625eb94 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -5,7 +5,7 @@ "scripts": { "generate:clear": "rm -rf ../../internal/generated", "generate:init": "mkdir -p ../../internal/generated && cp ./config/.openapi-generator-ignore ../../internal/generated/.openapi-generator-ignore", - "generate:run": "openapi-generator-cli generate -c './config/config.yaml' --type-mappings=integer=int -o ../../internal/generated", + "generate:run": "openapi-generator-cli generate -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/generated", "generate": "npm run generate:clear && npm run generate:init && npm run generate:run" }, "repository": { From 6e6ab6ec9d2f82f7f7c0a4de8bfda294afa515da Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 2 Jun 2023 17:06:01 +0100 Subject: [PATCH 17/44] fix issues --- internal/cli/root/atlas/builder_test.go | 2 +- internal/generated/api_access_tracking_cmd.go | 132 ++- .../generated/api_alert_configurations_cmd.go | 274 ++--- internal/generated/api_alerts_cmd.go | 161 +-- internal/generated/api_atlas_search_cmd.go | 201 ++-- internal/generated/api_auditing_cmd.go | 63 +- .../generated/api_aws_clusters_dns_cmd.go | 63 +- internal/generated/api_cloud_backups_cmd.go | 1053 +++++++++-------- .../api_cloud_migration_service_cmd.go | 231 ++-- .../api_cloud_provider_access_cmd.go | 165 +-- .../api_cluster_outage_simulation_cmd.go | 106 +- internal/generated/api_clusters_cmd.go | 306 ++--- .../api_custom_database_roles_cmd.go | 159 +-- internal/generated/api_data_federation_cmd.go | 519 ++++---- .../generated/api_data_lake_pipelines_cmd.go | 470 ++++---- internal/generated/api_database_users_cmd.go | 224 ++-- ..._rest_using_customer_key_management_cmd.go | 63 +- internal/generated/api_events_cmd.go | 212 ++-- .../api_federated_authentication_cmd.go | 451 ++++--- internal/generated/api_global_clusters_cmd.go | 185 +-- internal/generated/api_invoices_cmd.go | 128 +- .../generated/api_ldap_configuration_cmd.go | 147 +-- internal/generated/api_legacy_backup_cmd.go | 410 ++++--- .../api_legacy_backup_restore_jobs_cmd.go | 44 +- .../generated/api_maintenance_windows__cmd.go | 138 ++- .../generated/api_mongo_db_cloud_users_cmd.go | 79 +- .../generated/api_monitoring_and_logs_cmd.go | 736 ++++++------ .../generated/api_multi_cloud_clusters_cmd.go | 212 ++-- internal/generated/api_network_peering_cmd.go | 436 +++---- internal/generated/api_online_archive_cmd.go | 248 ++-- internal/generated/api_organizations_cmd.go | 444 ++++--- .../generated/api_performance_advisor_cmd.go | 251 ++-- .../api_private_endpoint_services_cmd.go | 322 ++--- .../api_programmatic_api_keys_cmd.go | 492 ++++---- .../api_project_ip_access_list_cmd.go | 187 +-- internal/generated/api_projects_cmd.go | 654 +++++----- internal/generated/api_rolling_index_cmd.go | 44 +- internal/generated/api_root_cmd.go | 32 +- .../generated/api_serverless_instances_cmd.go | 173 +-- .../api_serverless_private_endpoints_cmd.go | 189 +-- .../api_shared_tier_restore_jobs_cmd.go | 112 +- .../api_shared_tier_snapshots_cmd.go | 112 +- internal/generated/api_teams_cmd.go | 418 +++---- internal/generated/api_test__cmd.go | 33 +- .../api_third_party_integrations_cmd.go | 207 ++-- .../generated/api_x509_authentication_cmd.go | 114 +- internal/generated/generated.go | 96 +- .../config/go-templates/cmd.mustache | 22 +- .../config/go-templates/generated.mustache | 8 +- tools/openapi-generator/package.json | 2 +- 50 files changed, 6006 insertions(+), 5524 deletions(-) diff --git a/internal/cli/root/atlas/builder_test.go b/internal/cli/root/atlas/builder_test.go index 88f05807a9..b6c97a120a 100644 --- a/internal/cli/root/atlas/builder_test.go +++ b/internal/cli/root/atlas/builder_test.go @@ -35,7 +35,7 @@ func TestBuilder(t *testing.T) { test.CmdValidator( t, Builder(), - 37, + 53, []string{}, ) } diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index 2fc63d6317..49d80679e9 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -18,44 +18,42 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type ListAccessLogsByClusterNameOpts struct { +type listAccessLogsByClusterNameOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - authResult bool - end int64 - ipAddress string - nLogs int - start int64 + authResult bool + end int64 + ipAddress string + nLogs int + start int64 } -func (opts *ListAccessLogsByClusterNameOpts) initClient() func() error { +func (opts *listAccessLogsByClusterNameOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAccessLogsByClusterNameOpts) Run(ctx context.Context) error { +func (opts *listAccessLogsByClusterNameOpts) Run(ctx context.Context) error { params := &admin.ListAccessLogsByClusterNameApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - AuthResult: &opts.authResult, - End: &opts.end, - IpAddress: &opts.ipAddress, - NLogs: &opts.nLogs, - Start: &opts.start, + AuthResult: &opts.authResult, + End: &opts.end, + IpAddress: &opts.ipAddress, + NLogs: &opts.nLogs, + Start: &opts.start, } resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(ctx, params).Execute() if err != nil { @@ -65,15 +63,15 @@ func (opts *ListAccessLogsByClusterNameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListAccessLogsByClusterNameBuilder() *cobra.Command { +func listAccessLogsByClusterNameBuilder() *cobra.Command { const template = "<>" - opts := ListAccessLogsByClusterNameOpts{} + opts := listAccessLogsByClusterNameOpts{} cmd := &cobra.Command{ - Use: "listAccessLogsByClusterName", + Use: "listAccessLogsByClusterName", Short: "Return Database Access History for One Cluster using Its Cluster Name", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -85,48 +83,51 @@ func ListAccessLogsByClusterNameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().BoolVar(&opts.authResult, "authResult", false, "Flag that indicates whether the response returns the successful authentication attempts only.") - cmd.Flags().Int64Var(&opts.end, "end", 0, "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "One Internet Protocol address that attempted to authenticate with the database.") - cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().Int64Var(&opts.start, "start", 0, "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().BoolVar(&opts.authResult, "authResult", false, `Flag that indicates whether the response returns the successful authentication attempts only.`) + cmd.Flags().Int64Var(&opts.end, "end", 0, `Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.`) + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One Internet Protocol address that attempted to authenticate with the database.`) + cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) + cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListAccessLogsByHostnameOpts struct { + +type listAccessLogsByHostnameOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - hostname string + client *admin.APIClient + groupId string + hostname string authResult bool - end int64 - ipAddress string - nLogs int - start int64 + end int64 + ipAddress string + nLogs int + start int64 } -func (opts *ListAccessLogsByHostnameOpts) initClient() func() error { +func (opts *listAccessLogsByHostnameOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAccessLogsByHostnameOpts) Run(ctx context.Context) error { +func (opts *listAccessLogsByHostnameOpts) Run(ctx context.Context) error { params := &admin.ListAccessLogsByHostnameApiParams{ - GroupId: opts.groupId, - Hostname: opts.hostname, + GroupId: opts.groupId, + Hostname: opts.hostname, AuthResult: &opts.authResult, - End: &opts.end, - IpAddress: &opts.ipAddress, - NLogs: &opts.nLogs, - Start: &opts.start, + End: &opts.end, + IpAddress: &opts.ipAddress, + NLogs: &opts.nLogs, + Start: &opts.start, } resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByHostnameWithParams(ctx, params).Execute() if err != nil { @@ -136,15 +137,15 @@ func (opts *ListAccessLogsByHostnameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListAccessLogsByHostnameBuilder() *cobra.Command { +func listAccessLogsByHostnameBuilder() *cobra.Command { const template = "<>" - opts := ListAccessLogsByHostnameOpts{} + opts := listAccessLogsByHostnameOpts{} cmd := &cobra.Command{ - Use: "listAccessLogsByHostname", + Use: "listAccessLogsByHostname", Short: "Return Database Access History for One Cluster using Its Hostname", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -156,28 +157,29 @@ func ListAccessLogsByHostnameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.hostname, "hostname", "", "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") - cmd.Flags().BoolVar(&opts.authResult, "authResult", false, "Flag that indicates whether the response returns the successful authentication attempts only.") - cmd.Flags().Int64Var(&opts.end, "end", 0, "Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "One Internet Protocol address that attempted to authenticate with the database.") - cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().Int64Var(&opts.start, "start", 0, "Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.hostname, "hostname", "", `Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.`) + cmd.Flags().BoolVar(&opts.authResult, "authResult", false, `Flag that indicates whether the response returns the successful authentication attempts only.`) + cmd.Flags().Int64Var(&opts.end, "end", 0, `Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.`) + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One Internet Protocol address that attempted to authenticate with the database.`) + cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) + cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostname") return cmd } -func AccessTrackingBuilder() *cobra.Command { +func accessTrackingBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "accessTracking", - Short: "Returns access logs for authentication attempts made to Atlas database deployments. To view database access history, you must have either the Project Owner or Organization Owner role.", + Use: "accessTracking", + Short: `Returns access logs for authentication attempts made to Atlas database deployments. To view database access history, you must have either the Project Owner or Organization Owner role.`, } cmd.AddCommand( - ListAccessLogsByClusterNameBuilder(), - ListAccessLogsByHostnameBuilder(), + listAccessLogsByClusterNameBuilder(), + listAccessLogsByHostnameBuilder(), ) return cmd } - diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 2095563c15..10c666fed5 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateAlertConfigurationOpts struct { +type createAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateAlertConfigurationOpts) initClient() func() error { +func (opts *createAlertConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *createAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreateAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateAlertConfigurationBuilder() *cobra.Command { +func createAlertConfigurationBuilder() *cobra.Command { const template = "<>" - opts := CreateAlertConfigurationOpts{} + opts := createAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "createAlertConfiguration", + Use: "createAlertConfiguration", Short: "Create One Alert Configuration in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,31 +71,33 @@ func CreateAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteAlertConfigurationOpts struct { + +type deleteAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string } -func (opts *DeleteAlertConfigurationOpts) initClient() func() error { +func (opts *deleteAlertConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *deleteAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.DeleteAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params).Execute() @@ -110,15 +108,15 @@ func (opts *DeleteAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func DeleteAlertConfigurationBuilder() *cobra.Command { +func deleteAlertConfigurationBuilder() *cobra.Command { const template = "<>" - opts := DeleteAlertConfigurationOpts{} + opts := deleteAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "deleteAlertConfiguration", + Use: "deleteAlertConfiguration", Short: "Remove One Alert Configuration from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -130,32 +128,35 @@ func DeleteAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } -type GetAlertConfigurationOpts struct { + +type getAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string } -func (opts *GetAlertConfigurationOpts) initClient() func() error { +func (opts *getAlertConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *getAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.GetAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } resp, _, err := opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params).Execute() @@ -166,15 +167,15 @@ func (opts *GetAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetAlertConfigurationBuilder() *cobra.Command { +func getAlertConfigurationBuilder() *cobra.Command { const template = "<>" - opts := GetAlertConfigurationOpts{} + opts := getAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "getAlertConfiguration", + Use: "getAlertConfiguration", Short: "Return One Alert Configuration from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -186,30 +187,32 @@ func GetAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } -type ListAlertConfigurationMatchersFieldNamesOpts struct { + +type listAlertConfigurationMatchersFieldNamesOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient } -func (opts *ListAlertConfigurationMatchersFieldNamesOpts) initClient() func() error { +func (opts *listAlertConfigurationMatchersFieldNamesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Context) error { - params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{ - } +func (opts *listAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Context) error { + params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{} resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params).Execute() if err != nil { return err @@ -218,15 +221,15 @@ func (opts *ListAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Contex return opts.Print(resp) } -func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { +func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { const template = "<>" - opts := ListAlertConfigurationMatchersFieldNamesOpts{} + opts := listAlertConfigurationMatchersFieldNamesOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurationMatchersFieldNames", + Use: "listAlertConfigurationMatchersFieldNames", Short: "Get All Alert Configuration Matchers Field Names", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -241,30 +244,31 @@ func ListAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { return cmd } -type ListAlertConfigurationsOpts struct { + +type listAlertConfigurationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListAlertConfigurationsOpts) initClient() func() error { +func (opts *listAlertConfigurationsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAlertConfigurationsOpts) Run(ctx context.Context) error { +func (opts *listAlertConfigurationsOpts) Run(ctx context.Context) error { params := &admin.ListAlertConfigurationsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params).Execute() if err != nil { @@ -274,15 +278,15 @@ func (opts *ListAlertConfigurationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListAlertConfigurationsBuilder() *cobra.Command { +func listAlertConfigurationsBuilder() *cobra.Command { const template = "<>" - opts := ListAlertConfigurationsOpts{} + opts := listAlertConfigurationsOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurations", + Use: "listAlertConfigurations", Short: "Return All Alert Configurations for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -294,40 +298,43 @@ func ListAlertConfigurationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListAlertConfigurationsByAlertIdOpts struct { + +type listAlertConfigurationsByAlertIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - alertId string + client *admin.APIClient + groupId string + alertId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListAlertConfigurationsByAlertIdOpts) initClient() func() error { +func (opts *listAlertConfigurationsByAlertIdOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error { +func (opts *listAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error { params := &admin.ListAlertConfigurationsByAlertIdApiParams{ - GroupId: opts.groupId, - AlertId: opts.alertId, + GroupId: opts.groupId, + AlertId: opts.alertId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params).Execute() if err != nil { @@ -337,15 +344,15 @@ func (opts *ListAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error return opts.Print(resp) } -func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { +func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { const template = "<>" - opts := ListAlertConfigurationsByAlertIdOpts{} + opts := listAlertConfigurationsByAlertIdOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurationsByAlertId", + Use: "listAlertConfigurationsByAlertId", Short: "Return All Alert Configurations Set for One Alert", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -357,38 +364,39 @@ func ListAlertConfigurationsByAlertIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertId, "alertId", "", "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } -type ToggleAlertConfigurationOpts struct { + +type toggleAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string - } -func (opts *ToggleAlertConfigurationOpts) initClient() func() error { +func (opts *toggleAlertConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ToggleAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *toggleAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.ToggleAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - } resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -398,15 +406,15 @@ func (opts *ToggleAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ToggleAlertConfigurationBuilder() *cobra.Command { +func toggleAlertConfigurationBuilder() *cobra.Command { const template = "<>" - opts := ToggleAlertConfigurationOpts{} + opts := toggleAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "toggleAlertConfiguration", + Use: "toggleAlertConfiguration", Short: "Toggle One State of One Alert Configuration in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -418,36 +426,36 @@ func ToggleAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } -type UpdateAlertConfigurationOpts struct { + +type updateAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string - } -func (opts *UpdateAlertConfigurationOpts) initClient() func() error { +func (opts *updateAlertConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *updateAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.UpdateAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - } resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -457,15 +465,15 @@ func (opts *UpdateAlertConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateAlertConfigurationBuilder() *cobra.Command { +func updateAlertConfigurationBuilder() *cobra.Command { const template = "<>" - opts := UpdateAlertConfigurationOpts{} + opts := updateAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "updateAlertConfiguration", + Use: "updateAlertConfiguration", Short: "Update One Alert Configuration for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -477,30 +485,30 @@ func UpdateAlertConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } -func AlertConfigurationsBuilder() *cobra.Command { +func alertConfigurationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "alertConfigurations", - Short: "Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.", + Use: "alertConfigurations", + Short: `Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.`, } cmd.AddCommand( - CreateAlertConfigurationBuilder(), - DeleteAlertConfigurationBuilder(), - GetAlertConfigurationBuilder(), - ListAlertConfigurationMatchersFieldNamesBuilder(), - ListAlertConfigurationsBuilder(), - ListAlertConfigurationsByAlertIdBuilder(), - ToggleAlertConfigurationBuilder(), - UpdateAlertConfigurationBuilder(), + createAlertConfigurationBuilder(), + deleteAlertConfigurationBuilder(), + getAlertConfigurationBuilder(), + listAlertConfigurationMatchersFieldNamesBuilder(), + listAlertConfigurationsBuilder(), + listAlertConfigurationsByAlertIdBuilder(), + toggleAlertConfigurationBuilder(), + updateAlertConfigurationBuilder(), ) return cmd } - diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index d1a30cd928..9aa72e7f53 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type AcknowledgeAlertOpts struct { +type acknowledgeAlertOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string alertId string - } -func (opts *AcknowledgeAlertOpts) initClient() func() error { +func (opts *acknowledgeAlertOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *AcknowledgeAlertOpts) Run(ctx context.Context) error { +func (opts *acknowledgeAlertOpts) Run(ctx context.Context) error { params := &admin.AcknowledgeAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, - } resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *AcknowledgeAlertOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func AcknowledgeAlertBuilder() *cobra.Command { +func acknowledgeAlertBuilder() *cobra.Command { const template = "<>" - opts := AcknowledgeAlertOpts{} + opts := acknowledgeAlertOpts{} cmd := &cobra.Command{ - Use: "acknowledgeAlert", + Use: "acknowledgeAlert", Short: "Acknowledge One Alert from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,31 +73,33 @@ func AcknowledgeAlertBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertId, "alertId", "", "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } -type GetAlertOpts struct { + +type getAlertOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string alertId string } -func (opts *GetAlertOpts) initClient() func() error { +func (opts *getAlertOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetAlertOpts) Run(ctx context.Context) error { +func (opts *getAlertOpts) Run(ctx context.Context) error { params := &admin.GetAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, @@ -114,15 +112,15 @@ func (opts *GetAlertOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetAlertBuilder() *cobra.Command { +func getAlertBuilder() *cobra.Command { const template = "<>" - opts := GetAlertOpts{} + opts := getAlertOpts{} cmd := &cobra.Command{ - Use: "getAlert", + Use: "getAlert", Short: "Return One Alert from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -134,39 +132,42 @@ func GetAlertBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertId, "alertId", "", "Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } -type ListAlertsOpts struct { + +type listAlertsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int - status string + pageNum int + status string } -func (opts *ListAlertsOpts) initClient() func() error { +func (opts *listAlertsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAlertsOpts) Run(ctx context.Context) error { +func (opts *listAlertsOpts) Run(ctx context.Context) error { params := &admin.ListAlertsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Status: &opts.status, + PageNum: &opts.pageNum, + Status: &opts.status, } resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params).Execute() if err != nil { @@ -176,15 +177,15 @@ func (opts *ListAlertsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListAlertsBuilder() *cobra.Command { +func listAlertsBuilder() *cobra.Command { const template = "<>" - opts := ListAlertsOpts{} + opts := listAlertsOpts{} cmd := &cobra.Command{ - Use: "listAlerts", + Use: "listAlerts", Short: "Return All Alerts from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -196,41 +197,44 @@ func ListAlertsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.status, "status", "", "Status of the alerts to return. Omit to return all alerts in all statuses.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.status, "status", "", `Status of the alerts to return. Omit to return all alerts in all statuses.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListAlertsByAlertConfigurationIdOpts struct { + +type listAlertsByAlertConfigurationIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string - includeCount bool - itemsPerPage int - pageNum int + includeCount bool + itemsPerPage int + pageNum int } -func (opts *ListAlertsByAlertConfigurationIdOpts) initClient() func() error { +func (opts *listAlertsByAlertConfigurationIdOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error { +func (opts *listAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error { params := &admin.ListAlertsByAlertConfigurationIdApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params).Execute() if err != nil { @@ -240,15 +244,15 @@ func (opts *ListAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error return opts.Print(resp) } -func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { +func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { const template = "<>" - opts := ListAlertsByAlertConfigurationIdOpts{} + opts := listAlertsByAlertConfigurationIdOpts{} cmd := &cobra.Command{ - Use: "listAlertsByAlertConfigurationId", + Use: "listAlertsByAlertConfigurationId", Short: "Return All Open Alerts for Alert Configuration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -260,28 +264,29 @@ func ListAlertsByAlertConfigurationIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", "Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } -func AlertsBuilder() *cobra.Command { +func alertsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "alerts", - Short: "Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.", + Use: "alerts", + Short: `Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.`, } cmd.AddCommand( - AcknowledgeAlertBuilder(), - GetAlertBuilder(), - ListAlertsBuilder(), - ListAlertsByAlertConfigurationIdBuilder(), + acknowledgeAlertBuilder(), + getAlertBuilder(), + listAlertsBuilder(), + listAlertsByAlertConfigurationIdBuilder(), ) return cmd } - diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index 027278cf2d..73d425eefb 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateAtlasSearchIndexOpts struct { +type createAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateAtlasSearchIndexOpts) initClient() func() error { +func (opts *createAtlasSearchIndexOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateAtlasSearchIndexOpts) Run(ctx context.Context) error { +func (opts *createAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.CreateAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateAtlasSearchIndexOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateAtlasSearchIndexBuilder() *cobra.Command { +func createAtlasSearchIndexBuilder() *cobra.Command { const template = "<>" - opts := CreateAtlasSearchIndexOpts{} + opts := createAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "createAtlasSearchIndex", + Use: "createAtlasSearchIndex", Short: "Create One Atlas Search Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,36 +73,38 @@ func CreateAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the collection on which to create an Atlas Search index.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection on which to create an Atlas Search index.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type DeleteAtlasSearchIndexOpts struct { + +type deleteAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string + indexId string } -func (opts *DeleteAtlasSearchIndexOpts) initClient() func() error { +func (opts *deleteAtlasSearchIndexOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteAtlasSearchIndexOpts) Run(ctx context.Context) error { +func (opts *deleteAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.DeleteAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, + IndexId: opts.indexId, } resp, _, err := opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -116,15 +114,15 @@ func (opts *DeleteAtlasSearchIndexOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteAtlasSearchIndexBuilder() *cobra.Command { +func deleteAtlasSearchIndexBuilder() *cobra.Command { const template = "<>" - opts := DeleteAtlasSearchIndexOpts{} + opts := deleteAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "deleteAtlasSearchIndex", + Use: "deleteAtlasSearchIndex", Short: "Remove One Atlas Search Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,37 +134,40 @@ func DeleteAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the database and collection with one or more Application Search indexes.") - cmd.Flags().StringVar(&opts.indexId, "indexId", "", "Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the database and collection with one or more Application Search indexes.`) + cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd } -type GetAtlasSearchIndexOpts struct { + +type getAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string + indexId string } -func (opts *GetAtlasSearchIndexOpts) initClient() func() error { +func (opts *getAtlasSearchIndexOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetAtlasSearchIndexOpts) Run(ctx context.Context) error { +func (opts *getAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.GetAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, + IndexId: opts.indexId, } resp, _, err := opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -176,15 +177,15 @@ func (opts *GetAtlasSearchIndexOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetAtlasSearchIndexBuilder() *cobra.Command { +func getAtlasSearchIndexBuilder() *cobra.Command { const template = "<>" - opts := GetAtlasSearchIndexOpts{} + opts := getAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "getAtlasSearchIndex", + Use: "getAtlasSearchIndex", Short: "Return One Atlas Search Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -196,39 +197,42 @@ func GetAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the collection with one or more Atlas Search indexes.") - cmd.Flags().StringVar(&opts.indexId, "indexId", "", "Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) + cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd } -type ListAtlasSearchIndexesOpts struct { + +type listAtlasSearchIndexesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string collectionName string - databaseName string + databaseName string } -func (opts *ListAtlasSearchIndexesOpts) initClient() func() error { +func (opts *listAtlasSearchIndexesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAtlasSearchIndexesOpts) Run(ctx context.Context) error { +func (opts *listAtlasSearchIndexesOpts) Run(ctx context.Context) error { params := &admin.ListAtlasSearchIndexesApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, CollectionName: opts.collectionName, - DatabaseName: opts.databaseName, + DatabaseName: opts.databaseName, } resp, _, err := opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params).Execute() if err != nil { @@ -238,15 +242,15 @@ func (opts *ListAtlasSearchIndexesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListAtlasSearchIndexesBuilder() *cobra.Command { +func listAtlasSearchIndexesBuilder() *cobra.Command { const template = "<>" - opts := ListAtlasSearchIndexesOpts{} + opts := listAtlasSearchIndexesOpts{} cmd := &cobra.Command{ - Use: "listAtlasSearchIndexes", + Use: "listAtlasSearchIndexes", Short: "Return All Atlas Search Indexes for One Collection", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -258,10 +262,12 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the collection with one or more Atlas Search indexes.") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "Name of the collection that contains one or more Atlas Search indexes.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Name of the collection that contains one or more Atlas Search indexes.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -269,30 +275,29 @@ func ListAtlasSearchIndexesBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("databaseName") return cmd } -type UpdateAtlasSearchIndexOpts struct { + +type updateAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string - + indexId string } -func (opts *UpdateAtlasSearchIndexOpts) initClient() func() error { +func (opts *updateAtlasSearchIndexOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateAtlasSearchIndexOpts) Run(ctx context.Context) error { +func (opts *updateAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.UpdateAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, - + IndexId: opts.indexId, } resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -302,15 +307,15 @@ func (opts *UpdateAtlasSearchIndexOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateAtlasSearchIndexBuilder() *cobra.Command { +func updateAtlasSearchIndexBuilder() *cobra.Command { const template = "<>" - opts := UpdateAtlasSearchIndexOpts{} + opts := updateAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "updateAtlasSearchIndex", + Use: "updateAtlasSearchIndex", Short: "Update One Atlas Search Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -322,10 +327,11 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Name of the cluster that contains the collection whose Atlas Search index to update.") - cmd.Flags().StringVar(&opts.indexId, "indexId", "", "Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection whose Atlas Search index to update.`) + cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -333,18 +339,17 @@ func UpdateAtlasSearchIndexBuilder() *cobra.Command { return cmd } -func AtlasSearchBuilder() *cobra.Command { +func atlasSearchBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "atlasSearch", - Short: "Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.", + Use: "atlasSearch", + Short: `Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.`, } cmd.AddCommand( - CreateAtlasSearchIndexBuilder(), - DeleteAtlasSearchIndexBuilder(), - GetAtlasSearchIndexBuilder(), - ListAtlasSearchIndexesBuilder(), - UpdateAtlasSearchIndexBuilder(), + createAtlasSearchIndexBuilder(), + deleteAtlasSearchIndexBuilder(), + getAtlasSearchIndexBuilder(), + listAtlasSearchIndexesBuilder(), + updateAtlasSearchIndexBuilder(), ) return cmd } - diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index 538f4c1266..59230993e4 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -18,30 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type GetAuditingConfigurationOpts struct { +type getAuditingConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetAuditingConfigurationOpts) initClient() func() error { +func (opts *getAuditingConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetAuditingConfigurationOpts) Run(ctx context.Context) error { +func (opts *getAuditingConfigurationOpts) Run(ctx context.Context) error { params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, } @@ -53,15 +51,15 @@ func (opts *GetAuditingConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetAuditingConfigurationBuilder() *cobra.Command { +func getAuditingConfigurationBuilder() *cobra.Command { const template = "<>" - opts := GetAuditingConfigurationOpts{} + opts := getAuditingConfigurationOpts{} cmd := &cobra.Command{ - Use: "getAuditingConfiguration", + Use: "getAuditingConfiguration", Short: "Return the Auditing Configuration for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,31 +71,32 @@ func GetAuditingConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateAuditingConfigurationOpts struct { + +type updateAuditingConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpdateAuditingConfigurationOpts) initClient() func() error { +func (opts *updateAuditingConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateAuditingConfigurationOpts) Run(ctx context.Context) error { +func (opts *updateAuditingConfigurationOpts) Run(ctx context.Context) error { params := &admin.UpdateAuditingConfigurationApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -107,15 +106,15 @@ func (opts *UpdateAuditingConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateAuditingConfigurationBuilder() *cobra.Command { +func updateAuditingConfigurationBuilder() *cobra.Command { const template = "<>" - opts := UpdateAuditingConfigurationOpts{} + opts := updateAuditingConfigurationOpts{} cmd := &cobra.Command{ - Use: "updateAuditingConfiguration", + Use: "updateAuditingConfiguration", Short: "Update Auditing Configuration for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -127,22 +126,22 @@ func UpdateAuditingConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func AuditingBuilder() *cobra.Command { +func auditingBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "auditing", - Short: "Returns and edits database auditing settings for MongoDB Cloud projects.", + Use: "auditing", + Short: `Returns and edits database auditing settings for MongoDB Cloud projects.`, } cmd.AddCommand( - GetAuditingConfigurationBuilder(), - UpdateAuditingConfigurationBuilder(), + getAuditingConfigurationBuilder(), + updateAuditingConfigurationBuilder(), ) return cmd } - diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index d303079d50..d8a2e4b6ed 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -18,30 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type GetAWSCustomDNSOpts struct { +type getAWSCustomDNSOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetAWSCustomDNSOpts) initClient() func() error { +func (opts *getAWSCustomDNSOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetAWSCustomDNSOpts) Run(ctx context.Context) error { +func (opts *getAWSCustomDNSOpts) Run(ctx context.Context) error { params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, } @@ -53,15 +51,15 @@ func (opts *GetAWSCustomDNSOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetAWSCustomDNSBuilder() *cobra.Command { +func getAWSCustomDNSBuilder() *cobra.Command { const template = "<>" - opts := GetAWSCustomDNSOpts{} + opts := getAWSCustomDNSOpts{} cmd := &cobra.Command{ - Use: "getAWSCustomDNS", + Use: "getAWSCustomDNS", Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,31 +71,32 @@ func GetAWSCustomDNSBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ToggleAWSCustomDNSOpts struct { + +type toggleAWSCustomDNSOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *ToggleAWSCustomDNSOpts) initClient() func() error { +func (opts *toggleAWSCustomDNSOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ToggleAWSCustomDNSOpts) Run(ctx context.Context) error { +func (opts *toggleAWSCustomDNSOpts) Run(ctx context.Context) error { params := &admin.ToggleAWSCustomDNSApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params).Execute() if err != nil { @@ -107,15 +106,15 @@ func (opts *ToggleAWSCustomDNSOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ToggleAWSCustomDNSBuilder() *cobra.Command { +func toggleAWSCustomDNSBuilder() *cobra.Command { const template = "<>" - opts := ToggleAWSCustomDNSOpts{} + opts := toggleAWSCustomDNSOpts{} cmd := &cobra.Command{ - Use: "toggleAWSCustomDNS", + Use: "toggleAWSCustomDNS", Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -127,22 +126,22 @@ func ToggleAWSCustomDNSBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func AWSClustersDNSBuilder() *cobra.Command { +func aWSClustersDNSBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "aWSClustersDNS", - Short: "Returns and edits custom DNS configurations for MongoDB Cloud database deployments on AWS. The resource requires your Project ID. If you use the VPC peering on AWS and you use your own DNS servers instead of Amazon Route 53, enable custom DNS. Before 31 March 2020, applications deployed within AWS using custom DNS services and VPC-peered with MongoDB Cloud couldn't connect over private IP addresses. Custom DNS resolved to public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings.", + Use: "aWSClustersDNS", + Short: `Returns and edits custom DNS configurations for MongoDB Cloud database deployments on AWS. The resource requires your Project ID. If you use the VPC peering on AWS and you use your own DNS servers instead of Amazon Route 53, enable custom DNS. Before 31 March 2020, applications deployed within AWS using custom DNS services and VPC-peered with MongoDB Cloud couldn't connect over private IP addresses. Custom DNS resolved to public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings.`, } cmd.AddCommand( - GetAWSCustomDNSBuilder(), - ToggleAWSCustomDNSBuilder(), + getAWSCustomDNSBuilder(), + toggleAWSCustomDNSBuilder(), ) return cmd } - diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index 2a167ed829..d349b7c911 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -18,35 +18,33 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CancelBackupRestoreJobOpts struct { +type cancelBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } -func (opts *CancelBackupRestoreJobOpts) initClient() func() error { +func (opts *cancelBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CancelBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *cancelBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CancelBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params).Execute() @@ -57,15 +55,15 @@ func (opts *CancelBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CancelBackupRestoreJobBuilder() *cobra.Command { +func cancelBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := CancelBackupRestoreJobOpts{} + opts := cancelBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "cancelBackupRestoreJob", + Use: "cancelBackupRestoreJob", Short: "Cancel One Restore Job of One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,37 +75,38 @@ func CancelBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "Unique 24-hexadecimal digit string that identifies the restore job to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to remove.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } -type CreateBackupExportJobOpts struct { + +type createBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateBackupExportJobOpts) initClient() func() error { +func (opts *createBackupExportJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateBackupExportJobOpts) Run(ctx context.Context) error { +func (opts *createBackupExportJobOpts) Run(ctx context.Context) error { params := &admin.CreateBackupExportJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params).Execute() if err != nil { @@ -117,15 +116,15 @@ func (opts *CreateBackupExportJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateBackupExportJobBuilder() *cobra.Command { +func createBackupExportJobBuilder() *cobra.Command { const template = "<>" - opts := CreateBackupExportJobOpts{} + opts := createBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "createBackupExportJob", + Use: "createBackupExportJob", Short: "Create One Cloud Backup Snapshot Export Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -137,36 +136,36 @@ func CreateBackupExportJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type CreateBackupRestoreJobOpts struct { + +type createBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateBackupRestoreJobOpts) initClient() func() error { +func (opts *createBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *createBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -176,15 +175,15 @@ func (opts *CreateBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateBackupRestoreJobBuilder() *cobra.Command { +func createBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := CreateBackupRestoreJobOpts{} + opts := createBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createBackupRestoreJob", + Use: "createBackupRestoreJob", Short: "Restore One Snapshot of One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -196,34 +195,34 @@ func CreateBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type CreateExportBucketOpts struct { + +type createExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateExportBucketOpts) initClient() func() error { +func (opts *createExportBucketOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateExportBucketOpts) Run(ctx context.Context) error { +func (opts *createExportBucketOpts) Run(ctx context.Context) error { params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params).Execute() if err != nil { @@ -233,15 +232,15 @@ func (opts *CreateExportBucketOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateExportBucketBuilder() *cobra.Command { +func createExportBucketBuilder() *cobra.Command { const template = "<>" - opts := CreateExportBucketOpts{} + opts := createExportBucketOpts{} cmd := &cobra.Command{ - Use: "createExportBucket", + Use: "createExportBucket", Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -253,34 +252,34 @@ func CreateExportBucketBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type CreateServerlessBackupRestoreJobOpts struct { + +type createServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateServerlessBackupRestoreJobOpts) initClient() func() error { +func (opts *createServerlessBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *createServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateServerlessBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -290,15 +289,15 @@ func (opts *CreateServerlessBackupRestoreJobOpts) Run(ctx context.Context) error return opts.Print(resp) } -func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { +func createServerlessBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := CreateServerlessBackupRestoreJobOpts{} + opts := createServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createServerlessBackupRestoreJob", + Use: "createServerlessBackupRestoreJob", Short: "Restore One Snapshot of One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -310,33 +309,35 @@ func CreateServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance whose snapshot you want to restore.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance whose snapshot you want to restore.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type DeleteAllBackupSchedulesOpts struct { + +type deleteAllBackupSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *DeleteAllBackupSchedulesOpts) initClient() func() error { +func (opts *deleteAllBackupSchedulesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteAllBackupSchedulesOpts) Run(ctx context.Context) error { +func (opts *deleteAllBackupSchedulesOpts) Run(ctx context.Context) error { params := &admin.DeleteAllBackupSchedulesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params).Execute() @@ -347,15 +348,15 @@ func (opts *DeleteAllBackupSchedulesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteAllBackupSchedulesBuilder() *cobra.Command { +func deleteAllBackupSchedulesBuilder() *cobra.Command { const template = "<>" - opts := DeleteAllBackupSchedulesOpts{} + opts := deleteAllBackupSchedulesOpts{} cmd := &cobra.Command{ - Use: "deleteAllBackupSchedules", + Use: "deleteAllBackupSchedules", Short: "Remove All Cloud Backup Schedules", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -367,32 +368,35 @@ func DeleteAllBackupSchedulesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type DeleteExportBucketOpts struct { + +type deleteExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string exportBucketId string } -func (opts *DeleteExportBucketOpts) initClient() func() error { +func (opts *deleteExportBucketOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteExportBucketOpts) Run(ctx context.Context) error { +func (opts *deleteExportBucketOpts) Run(ctx context.Context) error { params := &admin.DeleteExportBucketApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } resp, _, err := opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params).Execute() @@ -403,15 +407,15 @@ func (opts *DeleteExportBucketOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteExportBucketBuilder() *cobra.Command { +func deleteExportBucketBuilder() *cobra.Command { const template = "<>" - opts := DeleteExportBucketOpts{} + opts := deleteExportBucketOpts{} cmd := &cobra.Command{ - Use: "deleteExportBucket", + Use: "deleteExportBucket", Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -423,35 +427,38 @@ func DeleteExportBucketBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") return cmd } -type DeleteReplicaSetBackupOpts struct { + +type deleteReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } -func (opts *DeleteReplicaSetBackupOpts) initClient() func() error { +func (opts *deleteReplicaSetBackupOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteReplicaSetBackupOpts) Run(ctx context.Context) error { +func (opts *deleteReplicaSetBackupOpts) Run(ctx context.Context) error { params := &admin.DeleteReplicaSetBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { @@ -461,15 +468,15 @@ func (opts *DeleteReplicaSetBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteReplicaSetBackupBuilder() *cobra.Command { +func deleteReplicaSetBackupBuilder() *cobra.Command { const template = "<>" - opts := DeleteReplicaSetBackupOpts{} + opts := deleteReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "deleteReplicaSetBackup", + Use: "deleteReplicaSetBackup", Short: "Remove One Replica Set Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -481,37 +488,40 @@ func DeleteReplicaSetBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type DeleteShardedClusterBackupOpts struct { + +type deleteShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } -func (opts *DeleteShardedClusterBackupOpts) initClient() func() error { +func (opts *deleteShardedClusterBackupOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteShardedClusterBackupOpts) Run(ctx context.Context) error { +func (opts *deleteShardedClusterBackupOpts) Run(ctx context.Context) error { params := &admin.DeleteShardedClusterBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { @@ -521,15 +531,15 @@ func (opts *DeleteShardedClusterBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteShardedClusterBackupBuilder() *cobra.Command { +func deleteShardedClusterBackupBuilder() *cobra.Command { const template = "<>" - opts := DeleteShardedClusterBackupOpts{} + opts := deleteShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "deleteShardedClusterBackup", + Use: "deleteShardedClusterBackup", Short: "Remove One Sharded Cluster Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -541,37 +551,40 @@ func DeleteShardedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type GetBackupExportJobOpts struct { + +type getBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - exportId string + exportId string } -func (opts *GetBackupExportJobOpts) initClient() func() error { +func (opts *getBackupExportJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetBackupExportJobOpts) Run(ctx context.Context) error { +func (opts *getBackupExportJobOpts) Run(ctx context.Context) error { params := &admin.GetBackupExportJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - ExportId: opts.exportId, + ExportId: opts.exportId, } resp, _, err := opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params).Execute() if err != nil { @@ -581,15 +594,15 @@ func (opts *GetBackupExportJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetBackupExportJobBuilder() *cobra.Command { +func getBackupExportJobBuilder() *cobra.Command { const template = "<>" - opts := GetBackupExportJobOpts{} + opts := getBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "getBackupExportJob", + Use: "getBackupExportJob", Short: "Return One Cloud Backup Snapshot Export Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -601,36 +614,39 @@ func GetBackupExportJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.exportId, "exportId", "", "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.exportId, "exportId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("exportId") return cmd } -type GetBackupRestoreJobOpts struct { + +type getBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } -func (opts *GetBackupRestoreJobOpts) initClient() func() error { +func (opts *getBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *getBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.GetBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params).Execute() @@ -641,15 +657,15 @@ func (opts *GetBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetBackupRestoreJobBuilder() *cobra.Command { +func getBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := GetBackupRestoreJobOpts{} + opts := getBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getBackupRestoreJob", + Use: "getBackupRestoreJob", Short: "Return One Restore Job of One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -661,34 +677,37 @@ func GetBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the restore jobs you want to return.") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } -type GetBackupScheduleOpts struct { + +type getBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *GetBackupScheduleOpts) initClient() func() error { +func (opts *getBackupScheduleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetBackupScheduleOpts) Run(ctx context.Context) error { +func (opts *getBackupScheduleOpts) Run(ctx context.Context) error { params := &admin.GetBackupScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params).Execute() @@ -699,15 +718,15 @@ func (opts *GetBackupScheduleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetBackupScheduleBuilder() *cobra.Command { +func getBackupScheduleBuilder() *cobra.Command { const template = "<>" - opts := GetBackupScheduleOpts{} + opts := getBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "getBackupSchedule", + Use: "getBackupSchedule", Short: "Return One Cloud Backup Schedule", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -719,29 +738,32 @@ func GetBackupScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type GetDataProtectionSettingsOpts struct { + +type getDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetDataProtectionSettingsOpts) initClient() func() error { +func (opts *getDataProtectionSettingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetDataProtectionSettingsOpts) Run(ctx context.Context) error { +func (opts *getDataProtectionSettingsOpts) Run(ctx context.Context) error { params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, } @@ -753,15 +775,15 @@ func (opts *GetDataProtectionSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetDataProtectionSettingsBuilder() *cobra.Command { +func getDataProtectionSettingsBuilder() *cobra.Command { const template = "<>" - opts := GetDataProtectionSettingsOpts{} + opts := getDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "getDataProtectionSettings", + Use: "getDataProtectionSettings", Short: "Return the Backup Compliance Policy settings", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -773,30 +795,33 @@ func GetDataProtectionSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetExportBucketOpts struct { + +type getExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string exportBucketId string } -func (opts *GetExportBucketOpts) initClient() func() error { +func (opts *getExportBucketOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetExportBucketOpts) Run(ctx context.Context) error { +func (opts *getExportBucketOpts) Run(ctx context.Context) error { params := &admin.GetExportBucketApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } resp, _, err := opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params).Execute() @@ -807,15 +832,15 @@ func (opts *GetExportBucketOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetExportBucketBuilder() *cobra.Command { +func getExportBucketBuilder() *cobra.Command { const template = "<>" - opts := GetExportBucketOpts{} + opts := getExportBucketOpts{} cmd := &cobra.Command{ - Use: "getExportBucket", + Use: "getExportBucket", Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -827,35 +852,38 @@ func GetExportBucketBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", "Unique string that identifies the AWS S3 bucket to which you export your snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") return cmd } -type GetReplicaSetBackupOpts struct { + +type getReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } -func (opts *GetReplicaSetBackupOpts) initClient() func() error { +func (opts *getReplicaSetBackupOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetReplicaSetBackupOpts) Run(ctx context.Context) error { +func (opts *getReplicaSetBackupOpts) Run(ctx context.Context) error { params := &admin.GetReplicaSetBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { @@ -865,15 +893,15 @@ func (opts *GetReplicaSetBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetReplicaSetBackupBuilder() *cobra.Command { +func getReplicaSetBackupBuilder() *cobra.Command { const template = "<>" - opts := GetReplicaSetBackupOpts{} + opts := getReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "getReplicaSetBackup", + Use: "getReplicaSetBackup", Short: "Return One Replica Set Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -885,37 +913,40 @@ func GetReplicaSetBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type GetServerlessBackupOpts struct { + +type getServerlessBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } -func (opts *GetServerlessBackupOpts) initClient() func() error { +func (opts *getServerlessBackupOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetServerlessBackupOpts) Run(ctx context.Context) error { +func (opts *getServerlessBackupOpts) Run(ctx context.Context) error { params := &admin.GetServerlessBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params).Execute() if err != nil { @@ -925,15 +956,15 @@ func (opts *GetServerlessBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetServerlessBackupBuilder() *cobra.Command { +func getServerlessBackupBuilder() *cobra.Command { const template = "<>" - opts := GetServerlessBackupOpts{} + opts := getServerlessBackupOpts{} cmd := &cobra.Command{ - Use: "getServerlessBackup", + Use: "getServerlessBackup", Short: "Return One Snapshot of One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -945,36 +976,39 @@ func GetServerlessBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type GetServerlessBackupRestoreJobOpts struct { + +type getServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } -func (opts *GetServerlessBackupRestoreJobOpts) initClient() func() error { +func (opts *getServerlessBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *getServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.GetServerlessBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params).Execute() @@ -985,15 +1019,15 @@ func (opts *GetServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetServerlessBackupRestoreJobBuilder() *cobra.Command { +func getServerlessBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := GetServerlessBackupRestoreJobOpts{} + opts := getServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getServerlessBackupRestoreJob", + Use: "getServerlessBackupRestoreJob", Short: "Return One Restore Job for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1005,37 +1039,40 @@ func GetServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance.") - cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) + cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } -type GetShardedClusterBackupOpts struct { + +type getShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } -func (opts *GetShardedClusterBackupOpts) initClient() func() error { +func (opts *getShardedClusterBackupOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetShardedClusterBackupOpts) Run(ctx context.Context) error { +func (opts *getShardedClusterBackupOpts) Run(ctx context.Context) error { params := &admin.GetShardedClusterBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { @@ -1045,15 +1082,15 @@ func (opts *GetShardedClusterBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetShardedClusterBackupBuilder() *cobra.Command { +func getShardedClusterBackupBuilder() *cobra.Command { const template = "<>" - opts := GetShardedClusterBackupOpts{} + opts := getShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "getShardedClusterBackup", + Use: "getShardedClusterBackup", Short: "Return One Sharded Cluster Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1065,41 +1102,44 @@ func GetShardedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type ListBackupExportJobsOpts struct { + +type listBackupExportJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListBackupExportJobsOpts) initClient() func() error { +func (opts *listBackupExportJobsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListBackupExportJobsOpts) Run(ctx context.Context) error { +func (opts *listBackupExportJobsOpts) Run(ctx context.Context) error { params := &admin.ListBackupExportJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params).Execute() if err != nil { @@ -1109,15 +1149,15 @@ func (opts *ListBackupExportJobsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListBackupExportJobsBuilder() *cobra.Command { +func listBackupExportJobsBuilder() *cobra.Command { const template = "<>" - opts := ListBackupExportJobsOpts{} + opts := listBackupExportJobsOpts{} cmd := &cobra.Command{ - Use: "listBackupExportJobs", + Use: "listBackupExportJobs", Short: "Return All Cloud Backup Snapshot Export Jobs", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1129,42 +1169,45 @@ func ListBackupExportJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListBackupRestoreJobsOpts struct { + +type listBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListBackupRestoreJobsOpts) initClient() func() error { +func (opts *listBackupRestoreJobsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListBackupRestoreJobsOpts) Run(ctx context.Context) error { +func (opts *listBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -1174,15 +1217,15 @@ func (opts *ListBackupRestoreJobsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListBackupRestoreJobsBuilder() *cobra.Command { +func listBackupRestoreJobsBuilder() *cobra.Command { const template = "<>" - opts := ListBackupRestoreJobsOpts{} + opts := listBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listBackupRestoreJobs", + Use: "listBackupRestoreJobs", Short: "Return All Restore Jobs for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1194,40 +1237,43 @@ func ListBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the restore jobs you want to return.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListExportBucketsOpts struct { + +type listExportBucketsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListExportBucketsOpts) initClient() func() error { +func (opts *listExportBucketsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListExportBucketsOpts) Run(ctx context.Context) error { +func (opts *listExportBucketsOpts) Run(ctx context.Context) error { params := &admin.ListExportBucketsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params).Execute() if err != nil { @@ -1237,15 +1283,15 @@ func (opts *ListExportBucketsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListExportBucketsBuilder() *cobra.Command { +func listExportBucketsBuilder() *cobra.Command { const template = "<>" - opts := ListExportBucketsOpts{} + opts := listExportBucketsOpts{} cmd := &cobra.Command{ - Use: "listExportBuckets", + Use: "listExportBuckets", Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1257,40 +1303,43 @@ func ListExportBucketsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListReplicaSetBackupsOpts struct { + +type listReplicaSetBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListReplicaSetBackupsOpts) initClient() func() error { +func (opts *listReplicaSetBackupsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListReplicaSetBackupsOpts) Run(ctx context.Context) error { +func (opts *listReplicaSetBackupsOpts) Run(ctx context.Context) error { params := &admin.ListReplicaSetBackupsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params).Execute() if err != nil { @@ -1300,15 +1349,15 @@ func (opts *ListReplicaSetBackupsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListReplicaSetBackupsBuilder() *cobra.Command { +func listReplicaSetBackupsBuilder() *cobra.Command { const template = "<>" - opts := ListReplicaSetBackupsOpts{} + opts := listReplicaSetBackupsOpts{} cmd := &cobra.Command{ - Use: "listReplicaSetBackups", + Use: "listReplicaSetBackups", Short: "Return All Replica Set Cloud Backups", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1320,42 +1369,45 @@ func ListReplicaSetBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListServerlessBackupRestoreJobsOpts struct { + +type listServerlessBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListServerlessBackupRestoreJobsOpts) initClient() func() error { +func (opts *listServerlessBackupRestoreJobsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error { +func (opts *listServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListServerlessBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -1365,15 +1417,15 @@ func (opts *ListServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error return opts.Print(resp) } -func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { +func listServerlessBackupRestoreJobsBuilder() *cobra.Command { const template = "<>" - opts := ListServerlessBackupRestoreJobsOpts{} + opts := listServerlessBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listServerlessBackupRestoreJobs", + Use: "listServerlessBackupRestoreJobs", Short: "Return All Restore Jobs for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1385,42 +1437,45 @@ func ListServerlessBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListServerlessBackupsOpts struct { + +type listServerlessBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListServerlessBackupsOpts) initClient() func() error { +func (opts *listServerlessBackupsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListServerlessBackupsOpts) Run(ctx context.Context) error { +func (opts *listServerlessBackupsOpts) Run(ctx context.Context) error { params := &admin.ListServerlessBackupsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params).Execute() if err != nil { @@ -1430,15 +1485,15 @@ func (opts *ListServerlessBackupsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListServerlessBackupsBuilder() *cobra.Command { +func listServerlessBackupsBuilder() *cobra.Command { const template = "<>" - opts := ListServerlessBackupsOpts{} + opts := listServerlessBackupsOpts{} cmd := &cobra.Command{ - Use: "listServerlessBackups", + Use: "listServerlessBackups", Short: "Return All Snapshots of One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1450,35 +1505,38 @@ func ListServerlessBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the serverless instance.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListShardedClusterBackupsOpts struct { + +type listShardedClusterBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *ListShardedClusterBackupsOpts) initClient() func() error { +func (opts *listShardedClusterBackupsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListShardedClusterBackupsOpts) Run(ctx context.Context) error { +func (opts *listShardedClusterBackupsOpts) Run(ctx context.Context) error { params := &admin.ListShardedClusterBackupsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params).Execute() @@ -1489,15 +1547,15 @@ func (opts *ListShardedClusterBackupsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListShardedClusterBackupsBuilder() *cobra.Command { +func listShardedClusterBackupsBuilder() *cobra.Command { const template = "<>" - opts := ListShardedClusterBackupsOpts{} + opts := listShardedClusterBackupsOpts{} cmd := &cobra.Command{ - Use: "listShardedClusterBackups", + Use: "listShardedClusterBackups", Short: "Return All Sharded Cluster Cloud Backups", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1509,35 +1567,36 @@ func ListShardedClusterBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type TakeSnapshotOpts struct { + +type takeSnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *TakeSnapshotOpts) initClient() func() error { +func (opts *takeSnapshotOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *TakeSnapshotOpts) Run(ctx context.Context) error { +func (opts *takeSnapshotOpts) Run(ctx context.Context) error { params := &admin.TakeSnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params).Execute() if err != nil { @@ -1547,15 +1606,15 @@ func (opts *TakeSnapshotOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func TakeSnapshotBuilder() *cobra.Command { +func takeSnapshotBuilder() *cobra.Command { const template = "<>" - opts := TakeSnapshotOpts{} + opts := takeSnapshotOpts{} cmd := &cobra.Command{ - Use: "takeSnapshot", + Use: "takeSnapshot", Short: "Take One On-Demand Snapshot", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1567,36 +1626,36 @@ func TakeSnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type UpdateBackupScheduleOpts struct { + +type updateBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *UpdateBackupScheduleOpts) initClient() func() error { +func (opts *updateBackupScheduleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateBackupScheduleOpts) Run(ctx context.Context) error { +func (opts *updateBackupScheduleOpts) Run(ctx context.Context) error { params := &admin.UpdateBackupScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params).Execute() if err != nil { @@ -1606,15 +1665,15 @@ func (opts *UpdateBackupScheduleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateBackupScheduleBuilder() *cobra.Command { +func updateBackupScheduleBuilder() *cobra.Command { const template = "<>" - opts := UpdateBackupScheduleOpts{} + opts := updateBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "updateBackupSchedule", + Use: "updateBackupSchedule", Short: "Update Cloud Backup Schedule for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1626,34 +1685,34 @@ func UpdateBackupScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type UpdateDataProtectionSettingsOpts struct { + +type updateDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpdateDataProtectionSettingsOpts) initClient() func() error { +func (opts *updateDataProtectionSettingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateDataProtectionSettingsOpts) Run(ctx context.Context) error { +func (opts *updateDataProtectionSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params).Execute() if err != nil { @@ -1663,15 +1722,15 @@ func (opts *UpdateDataProtectionSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateDataProtectionSettingsBuilder() *cobra.Command { +func updateDataProtectionSettingsBuilder() *cobra.Command { const template = "<>" - opts := UpdateDataProtectionSettingsOpts{} + opts := updateDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "updateDataProtectionSettings", + Use: "updateDataProtectionSettings", Short: "Update or enable the Backup Compliance Policy settings", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1683,36 +1742,36 @@ func UpdateDataProtectionSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateSnapshotRetentionOpts struct { + +type updateSnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string - + snapshotId string } -func (opts *UpdateSnapshotRetentionOpts) initClient() func() error { +func (opts *updateSnapshotRetentionOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateSnapshotRetentionOpts) Run(ctx context.Context) error { +func (opts *updateSnapshotRetentionOpts) Run(ctx context.Context) error { params := &admin.UpdateSnapshotRetentionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, - + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() if err != nil { @@ -1722,15 +1781,15 @@ func (opts *UpdateSnapshotRetentionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateSnapshotRetentionBuilder() *cobra.Command { +func updateSnapshotRetentionBuilder() *cobra.Command { const template = "<>" - opts := UpdateSnapshotRetentionOpts{} + opts := updateSnapshotRetentionOpts{} cmd := &cobra.Command{ - Use: "updateSnapshotRetention", + Use: "updateSnapshotRetention", Short: "Change Expiration Date for One Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1742,10 +1801,11 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1753,42 +1813,41 @@ func UpdateSnapshotRetentionBuilder() *cobra.Command { return cmd } -func CloudBackupsBuilder() *cobra.Command { +func cloudBackupsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "cloudBackups", - Short: "Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.", + Use: "cloudBackups", + Short: `Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.`, } cmd.AddCommand( - CancelBackupRestoreJobBuilder(), - CreateBackupExportJobBuilder(), - CreateBackupRestoreJobBuilder(), - CreateExportBucketBuilder(), - CreateServerlessBackupRestoreJobBuilder(), - DeleteAllBackupSchedulesBuilder(), - DeleteExportBucketBuilder(), - DeleteReplicaSetBackupBuilder(), - DeleteShardedClusterBackupBuilder(), - GetBackupExportJobBuilder(), - GetBackupRestoreJobBuilder(), - GetBackupScheduleBuilder(), - GetDataProtectionSettingsBuilder(), - GetExportBucketBuilder(), - GetReplicaSetBackupBuilder(), - GetServerlessBackupBuilder(), - GetServerlessBackupRestoreJobBuilder(), - GetShardedClusterBackupBuilder(), - ListBackupExportJobsBuilder(), - ListBackupRestoreJobsBuilder(), - ListExportBucketsBuilder(), - ListReplicaSetBackupsBuilder(), - ListServerlessBackupRestoreJobsBuilder(), - ListServerlessBackupsBuilder(), - ListShardedClusterBackupsBuilder(), - TakeSnapshotBuilder(), - UpdateBackupScheduleBuilder(), - UpdateDataProtectionSettingsBuilder(), - UpdateSnapshotRetentionBuilder(), + cancelBackupRestoreJobBuilder(), + createBackupExportJobBuilder(), + createBackupRestoreJobBuilder(), + createExportBucketBuilder(), + createServerlessBackupRestoreJobBuilder(), + deleteAllBackupSchedulesBuilder(), + deleteExportBucketBuilder(), + deleteReplicaSetBackupBuilder(), + deleteShardedClusterBackupBuilder(), + getBackupExportJobBuilder(), + getBackupRestoreJobBuilder(), + getBackupScheduleBuilder(), + getDataProtectionSettingsBuilder(), + getExportBucketBuilder(), + getReplicaSetBackupBuilder(), + getServerlessBackupBuilder(), + getServerlessBackupRestoreJobBuilder(), + getShardedClusterBackupBuilder(), + listBackupExportJobsBuilder(), + listBackupRestoreJobsBuilder(), + listExportBucketsBuilder(), + listReplicaSetBackupsBuilder(), + listServerlessBackupRestoreJobsBuilder(), + listServerlessBackupsBuilder(), + listShardedClusterBackupsBuilder(), + takeSnapshotBuilder(), + updateBackupScheduleBuilder(), + updateDataProtectionSettingsBuilder(), + updateSnapshotRetentionBuilder(), ) return cmd } - diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index 1139a37947..f934f95165 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateLinkTokenOpts struct { +type createLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string } -func (opts *CreateLinkTokenOpts) initClient() func() error { +func (opts *createLinkTokenOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateLinkTokenOpts) Run(ctx context.Context) error { +func (opts *createLinkTokenOpts) Run(ctx context.Context) error { params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, - } resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreateLinkTokenOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateLinkTokenBuilder() *cobra.Command { +func createLinkTokenBuilder() *cobra.Command { const template = "<>" - opts := CreateLinkTokenOpts{} + opts := createLinkTokenOpts{} cmd := &cobra.Command{ - Use: "createLinkToken", + Use: "createLinkToken", Short: "Create One Link-Token", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,32 +71,30 @@ func CreateLinkTokenBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type CreatePushMigrationOpts struct { + +type createPushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreatePushMigrationOpts) initClient() func() error { +func (opts *createPushMigrationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreatePushMigrationOpts) Run(ctx context.Context) error { +func (opts *createPushMigrationOpts) Run(ctx context.Context) error { params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params).Execute() if err != nil { @@ -110,15 +104,15 @@ func (opts *CreatePushMigrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreatePushMigrationBuilder() *cobra.Command { +func createPushMigrationBuilder() *cobra.Command { const template = "<>" - opts := CreatePushMigrationOpts{} + opts := createPushMigrationOpts{} cmd := &cobra.Command{ - Use: "createPushMigration", + Use: "createPushMigration", Short: "Migrate One Local Managed Cluster to MongoDB Atlas", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -130,31 +124,33 @@ func CreatePushMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type CutoverMigrationOpts struct { + +type cutoverMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string liveMigrationId string } -func (opts *CutoverMigrationOpts) initClient() func() error { +func (opts *cutoverMigrationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CutoverMigrationOpts) Run(ctx context.Context) error { +func (opts *cutoverMigrationOpts) Run(ctx context.Context) error { params := &admin.CutoverMigrationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params).Execute() @@ -165,15 +161,15 @@ func (opts *CutoverMigrationOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func CutoverMigrationBuilder() *cobra.Command { +func cutoverMigrationBuilder() *cobra.Command { const template = "<>" - opts := CutoverMigrationOpts{} + opts := cutoverMigrationOpts{} cmd := &cobra.Command{ - Use: "cutoverMigration", + Use: "cutoverMigration", Short: "Cut Over the Migrated Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -185,29 +181,32 @@ func CutoverMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "Unique 24-hexadecimal digit string that identifies the migration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } -type DeleteLinkTokenOpts struct { + +type deleteLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } -func (opts *DeleteLinkTokenOpts) initClient() func() error { +func (opts *deleteLinkTokenOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteLinkTokenOpts) Run(ctx context.Context) error { +func (opts *deleteLinkTokenOpts) Run(ctx context.Context) error { params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, } @@ -219,15 +218,15 @@ func (opts *DeleteLinkTokenOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteLinkTokenBuilder() *cobra.Command { +func deleteLinkTokenBuilder() *cobra.Command { const template = "<>" - opts := DeleteLinkTokenOpts{} + opts := deleteLinkTokenOpts{} cmd := &cobra.Command{ - Use: "deleteLinkToken", + Use: "deleteLinkToken", Short: "Remove One Link-Token", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -239,30 +238,31 @@ func DeleteLinkTokenBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type GetPushMigrationOpts struct { + +type getPushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string liveMigrationId string } -func (opts *GetPushMigrationOpts) initClient() func() error { +func (opts *getPushMigrationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetPushMigrationOpts) Run(ctx context.Context) error { +func (opts *getPushMigrationOpts) Run(ctx context.Context) error { params := &admin.GetPushMigrationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } resp, _, err := opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params).Execute() @@ -273,15 +273,15 @@ func (opts *GetPushMigrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetPushMigrationBuilder() *cobra.Command { +func getPushMigrationBuilder() *cobra.Command { const template = "<>" - opts := GetPushMigrationOpts{} + opts := getPushMigrationOpts{} cmd := &cobra.Command{ - Use: "getPushMigration", + Use: "getPushMigration", Short: "Return One Migration Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -293,32 +293,35 @@ func GetPushMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", "Unique 24-hexadecimal digit string that identifies the migration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } -type GetValidationStatusOpts struct { + +type getValidationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string validationId string } -func (opts *GetValidationStatusOpts) initClient() func() error { +func (opts *getValidationStatusOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetValidationStatusOpts) Run(ctx context.Context) error { +func (opts *getValidationStatusOpts) Run(ctx context.Context) error { params := &admin.GetValidationStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ValidationId: opts.validationId, } resp, _, err := opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params).Execute() @@ -329,15 +332,15 @@ func (opts *GetValidationStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetValidationStatusBuilder() *cobra.Command { +func getValidationStatusBuilder() *cobra.Command { const template = "<>" - opts := GetValidationStatusOpts{} + opts := getValidationStatusOpts{} cmd := &cobra.Command{ - Use: "getValidationStatus", + Use: "getValidationStatus", Short: "Return One Migration Validation Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -349,29 +352,32 @@ func GetValidationStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.validationId, "validationId", "", "Unique 24-hexadecimal digit string that identifies the validation job.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("validationId") return cmd } -type ListSourceProjectsOpts struct { + +type listSourceProjectsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } -func (opts *ListSourceProjectsOpts) initClient() func() error { +func (opts *listSourceProjectsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListSourceProjectsOpts) Run(ctx context.Context) error { +func (opts *listSourceProjectsOpts) Run(ctx context.Context) error { params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, } @@ -383,15 +389,15 @@ func (opts *ListSourceProjectsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListSourceProjectsBuilder() *cobra.Command { +func listSourceProjectsBuilder() *cobra.Command { const template = "<>" - opts := ListSourceProjectsOpts{} + opts := listSourceProjectsOpts{} cmd := &cobra.Command{ - Use: "listSourceProjects", + Use: "listSourceProjects", Short: "Return All Projects Available for Migration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -403,31 +409,30 @@ func ListSourceProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ValidateMigrationOpts struct { + +type validateMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *ValidateMigrationOpts) initClient() func() error { +func (opts *validateMigrationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ValidateMigrationOpts) Run(ctx context.Context) error { +func (opts *validateMigrationOpts) Run(ctx context.Context) error { params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params).Execute() if err != nil { @@ -437,15 +442,15 @@ func (opts *ValidateMigrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ValidateMigrationBuilder() *cobra.Command { +func validateMigrationBuilder() *cobra.Command { const template = "<>" - opts := ValidateMigrationOpts{} + opts := validateMigrationOpts{} cmd := &cobra.Command{ - Use: "validateMigration", + Use: "validateMigration", Short: "Validate One Migration Request", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -457,28 +462,28 @@ func ValidateMigrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func CloudMigrationServiceBuilder() *cobra.Command { +func cloudMigrationServiceBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "cloudMigrationService", - Short: "Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.", + Use: "cloudMigrationService", + Short: `Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.`, } cmd.AddCommand( - CreateLinkTokenBuilder(), - CreatePushMigrationBuilder(), - CutoverMigrationBuilder(), - DeleteLinkTokenBuilder(), - GetPushMigrationBuilder(), - GetValidationStatusBuilder(), - ListSourceProjectsBuilder(), - ValidateMigrationBuilder(), + createLinkTokenBuilder(), + createPushMigrationBuilder(), + cutoverMigrationBuilder(), + deleteLinkTokenBuilder(), + getPushMigrationBuilder(), + getValidationStatusBuilder(), + listSourceProjectsBuilder(), + validateMigrationBuilder(), ) return cmd } - diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index d2a7151e12..3a5cd6c2a1 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type AuthorizeCloudProviderAccessRoleOpts struct { +type authorizeCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - roleId string - + roleId string } -func (opts *AuthorizeCloudProviderAccessRoleOpts) initClient() func() error { +func (opts *authorizeCloudProviderAccessRoleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *AuthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error { +func (opts *authorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error { params := &admin.AuthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, - RoleId: opts.roleId, - + RoleId: opts.roleId, } resp, _, err := opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *AuthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error return opts.Print(resp) } -func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { +func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { const template = "<>" - opts := AuthorizeCloudProviderAccessRoleOpts{} + opts := authorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "authorizeCloudProviderAccessRole", + Use: "authorizeCloudProviderAccessRole", Short: "Authorize One Cloud Provider Access Role", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,34 +73,34 @@ func AuthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleId, "roleId", "", "Unique 24-hexadecimal digit string that identifies the role.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") return cmd } -type CreateCloudProviderAccessRoleOpts struct { + +type createCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateCloudProviderAccessRoleOpts) initClient() func() error { +func (opts *createCloudProviderAccessRoleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateCloudProviderAccessRoleOpts) Run(ctx context.Context) error { +func (opts *createCloudProviderAccessRoleOpts) Run(ctx context.Context) error { params := &admin.CreateCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { @@ -114,15 +110,15 @@ func (opts *CreateCloudProviderAccessRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateCloudProviderAccessRoleBuilder() *cobra.Command { +func createCloudProviderAccessRoleBuilder() *cobra.Command { const template = "<>" - opts := CreateCloudProviderAccessRoleOpts{} + opts := createCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "createCloudProviderAccessRole", + Use: "createCloudProviderAccessRole", Short: "Create One Cloud Provider Access Role", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -134,34 +130,36 @@ func CreateCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeauthorizeCloudProviderAccessRoleOpts struct { + +type deauthorizeCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string cloudProvider string - roleId string + roleId string } -func (opts *DeauthorizeCloudProviderAccessRoleOpts) initClient() func() error { +func (opts *deauthorizeCloudProviderAccessRoleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error { +func (opts *deauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error { params := &admin.DeauthorizeCloudProviderAccessRoleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, CloudProvider: opts.cloudProvider, - RoleId: opts.roleId, + RoleId: opts.roleId, } _, err := opts.client.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { @@ -171,15 +169,15 @@ func (opts *DeauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) err return opts.Print(nil) } -func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { +func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { const template = "<>" - opts := DeauthorizeCloudProviderAccessRoleOpts{} + opts := deauthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "deauthorizeCloudProviderAccessRole", + Use: "deauthorizeCloudProviderAccessRole", Short: "Deauthorize One Cloud Provider Access Role", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -191,35 +189,38 @@ func DeauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", "Human-readable label that identifies the cloud provider of the role to deauthorize.") - cmd.Flags().StringVar(&opts.roleId, "roleId", "", "Unique 24-hexadecimal digit string that identifies the role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider of the role to deauthorize.`) + cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("roleId") return cmd } -type GetCloudProviderAccessRoleOpts struct { + +type getCloudProviderAccessRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - roleId string + roleId string } -func (opts *GetCloudProviderAccessRoleOpts) initClient() func() error { +func (opts *getCloudProviderAccessRoleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetCloudProviderAccessRoleOpts) Run(ctx context.Context) error { +func (opts *getCloudProviderAccessRoleOpts) Run(ctx context.Context) error { params := &admin.GetCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, - RoleId: opts.roleId, + RoleId: opts.roleId, } resp, _, err := opts.client.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { @@ -229,15 +230,15 @@ func (opts *GetCloudProviderAccessRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetCloudProviderAccessRoleBuilder() *cobra.Command { +func getCloudProviderAccessRoleBuilder() *cobra.Command { const template = "<>" - opts := GetCloudProviderAccessRoleOpts{} + opts := getCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ - Use: "getCloudProviderAccessRole", + Use: "getCloudProviderAccessRole", Short: "Return specified Cloud Provider Access Role", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -249,29 +250,32 @@ func GetCloudProviderAccessRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleId, "roleId", "", "Unique 24-hexadecimal digit string that identifies the role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") return cmd } -type ListCloudProviderAccessRolesOpts struct { + +type listCloudProviderAccessRolesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *ListCloudProviderAccessRolesOpts) initClient() func() error { +func (opts *listCloudProviderAccessRolesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListCloudProviderAccessRolesOpts) Run(ctx context.Context) error { +func (opts *listCloudProviderAccessRolesOpts) Run(ctx context.Context) error { params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, } @@ -283,15 +287,15 @@ func (opts *ListCloudProviderAccessRolesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListCloudProviderAccessRolesBuilder() *cobra.Command { +func listCloudProviderAccessRolesBuilder() *cobra.Command { const template = "<>" - opts := ListCloudProviderAccessRolesOpts{} + opts := listCloudProviderAccessRolesOpts{} cmd := &cobra.Command{ - Use: "listCloudProviderAccessRoles", + Use: "listCloudProviderAccessRoles", Short: "Return All Cloud Provider Access Roles", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -303,24 +307,25 @@ func ListCloudProviderAccessRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func CloudProviderAccessBuilder() *cobra.Command { +func cloudProviderAccessBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "cloudProviderAccess", - Short: "Returns, adds, authorizes, and removes AWS IAM roles in Atlas.", + Use: "cloudProviderAccess", + Short: `Returns, adds, authorizes, and removes AWS IAM roles in Atlas.`, } cmd.AddCommand( - AuthorizeCloudProviderAccessRoleBuilder(), - CreateCloudProviderAccessRoleBuilder(), - DeauthorizeCloudProviderAccessRoleBuilder(), - GetCloudProviderAccessRoleBuilder(), - ListCloudProviderAccessRolesBuilder(), + authorizeCloudProviderAccessRoleBuilder(), + createCloudProviderAccessRoleBuilder(), + deauthorizeCloudProviderAccessRoleBuilder(), + getCloudProviderAccessRoleBuilder(), + listCloudProviderAccessRolesBuilder(), ) return cmd } - diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 4fec26d660..f830abc067 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -18,33 +18,31 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type EndOutageSimulationOpts struct { +type endOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *EndOutageSimulationOpts) initClient() func() error { +func (opts *endOutageSimulationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *EndOutageSimulationOpts) Run(ctx context.Context) error { +func (opts *endOutageSimulationOpts) Run(ctx context.Context) error { params := &admin.EndOutageSimulationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.ClusterOutageSimulationApi.EndOutageSimulationWithParams(ctx, params).Execute() @@ -55,15 +53,15 @@ func (opts *EndOutageSimulationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func EndOutageSimulationBuilder() *cobra.Command { +func endOutageSimulationBuilder() *cobra.Command { const template = "<>" - opts := EndOutageSimulationOpts{} + opts := endOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "endOutageSimulation", + Use: "endOutageSimulation", Short: "End an Outage Simulation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,32 +73,35 @@ func EndOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that is undergoing outage simulation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type GetOutageSimulationOpts struct { + +type getOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *GetOutageSimulationOpts) initClient() func() error { +func (opts *getOutageSimulationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetOutageSimulationOpts) Run(ctx context.Context) error { +func (opts *getOutageSimulationOpts) Run(ctx context.Context) error { params := &admin.GetOutageSimulationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.ClusterOutageSimulationApi.GetOutageSimulationWithParams(ctx, params).Execute() @@ -111,15 +112,15 @@ func (opts *GetOutageSimulationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetOutageSimulationBuilder() *cobra.Command { +func getOutageSimulationBuilder() *cobra.Command { const template = "<>" - opts := GetOutageSimulationOpts{} + opts := getOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "getOutageSimulation", + Use: "getOutageSimulation", Short: "Return One Outage Simulation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -131,35 +132,36 @@ func GetOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that is undergoing outage simulation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type StartOutageSimulationOpts struct { + +type startOutageSimulationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *StartOutageSimulationOpts) initClient() func() error { +func (opts *startOutageSimulationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *StartOutageSimulationOpts) Run(ctx context.Context) error { +func (opts *startOutageSimulationOpts) Run(ctx context.Context) error { params := &admin.StartOutageSimulationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params).Execute() if err != nil { @@ -169,15 +171,15 @@ func (opts *StartOutageSimulationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func StartOutageSimulationBuilder() *cobra.Command { +func startOutageSimulationBuilder() *cobra.Command { const template = "<>" - opts := StartOutageSimulationOpts{} + opts := startOutageSimulationOpts{} cmd := &cobra.Command{ - Use: "startOutageSimulation", + Use: "startOutageSimulation", Short: "Start an Outage Simulation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -189,25 +191,25 @@ func StartOutageSimulationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster to undergo an outage simulation.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to undergo an outage simulation.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -func ClusterOutageSimulationBuilder() *cobra.Command { +func clusterOutageSimulationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "clusterOutageSimulation", - Short: "Returns, starts, or ends a cluster outage simulation.", + Use: "clusterOutageSimulation", + Short: `Returns, starts, or ends a cluster outage simulation.`, } cmd.AddCommand( - EndOutageSimulationBuilder(), - GetOutageSimulationBuilder(), - StartOutageSimulationBuilder(), + endOutageSimulationBuilder(), + getOutageSimulationBuilder(), + startOutageSimulationBuilder(), ) return cmd } - diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 7b3104b4fb..a0733ca828 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -18,33 +18,31 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type GetClusterAdvancedConfigurationOpts struct { +type getClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *GetClusterAdvancedConfigurationOpts) initClient() func() error { +func (opts *getClusterAdvancedConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { +func (opts *getClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { params := &admin.GetClusterAdvancedConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params).Execute() @@ -55,15 +53,15 @@ func (opts *GetClusterAdvancedConfigurationOpts) Run(ctx context.Context) error return opts.Print(resp) } -func GetClusterAdvancedConfigurationBuilder() *cobra.Command { +func getClusterAdvancedConfigurationBuilder() *cobra.Command { const template = "<>" - opts := GetClusterAdvancedConfigurationOpts{} + opts := getClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "getClusterAdvancedConfiguration", + Use: "getClusterAdvancedConfiguration", Short: "Return One Advanced Configuration Options for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,32 +73,35 @@ func GetClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type GetClusterStatusOpts struct { + +type getClusterStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *GetClusterStatusOpts) initClient() func() error { +func (opts *getClusterStatusOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetClusterStatusOpts) Run(ctx context.Context) error { +func (opts *getClusterStatusOpts) Run(ctx context.Context) error { params := &admin.GetClusterStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params).Execute() @@ -111,15 +112,15 @@ func (opts *GetClusterStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetClusterStatusBuilder() *cobra.Command { +func getClusterStatusBuilder() *cobra.Command { const template = "<>" - opts := GetClusterStatusOpts{} + opts := getClusterStatusOpts{} cmd := &cobra.Command{ - Use: "getClusterStatus", + Use: "getClusterStatus", Short: "Return Status of All Cluster Operations", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -131,32 +132,35 @@ func GetClusterStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type GetSampleDatasetLoadStatusOpts struct { + +type getSampleDatasetLoadStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string sampleDatasetId string } -func (opts *GetSampleDatasetLoadStatusOpts) initClient() func() error { +func (opts *getSampleDatasetLoadStatusOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { +func (opts *getSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { params := &admin.GetSampleDatasetLoadStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, SampleDatasetId: opts.sampleDatasetId, } resp, _, err := opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params).Execute() @@ -167,15 +171,15 @@ func (opts *GetSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetSampleDatasetLoadStatusBuilder() *cobra.Command { +func getSampleDatasetLoadStatusBuilder() *cobra.Command { const template = "<>" - opts := GetSampleDatasetLoadStatusOpts{} + opts := getSampleDatasetLoadStatusOpts{} cmd := &cobra.Command{ - Use: "getSampleDatasetLoadStatus", + Use: "getSampleDatasetLoadStatus", Short: "Check Status of Cluster Sample Dataset Request", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -187,41 +191,44 @@ func GetSampleDatasetLoadStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", "Unique 24-hexadecimal digit string that identifies the loaded sample dataset.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("sampleDatasetId") return cmd } -type ListCloudProviderRegionsOpts struct { + +type listCloudProviderRegionsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int - providers []string - tier string + pageNum int + providers []string + tier string } -func (opts *ListCloudProviderRegionsOpts) initClient() func() error { +func (opts *listCloudProviderRegionsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListCloudProviderRegionsOpts) Run(ctx context.Context) error { +func (opts *listCloudProviderRegionsOpts) Run(ctx context.Context) error { params := &admin.ListCloudProviderRegionsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Providers: &opts.providers, - Tier: &opts.tier, + PageNum: &opts.pageNum, + Providers: &opts.providers, + Tier: &opts.tier, } resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params).Execute() if err != nil { @@ -231,15 +238,15 @@ func (opts *ListCloudProviderRegionsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListCloudProviderRegionsBuilder() *cobra.Command { +func listCloudProviderRegionsBuilder() *cobra.Command { const template = "<>" - opts := ListCloudProviderRegionsOpts{} + opts := listCloudProviderRegionsOpts{} cmd := &cobra.Command{ - Use: "listCloudProviderRegions", + Use: "listCloudProviderRegions", Short: "Return All Cloud Provider Regions", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -251,38 +258,41 @@ func ListCloudProviderRegionsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, "Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.") - cmd.Flags().StringVar(&opts.tier, "tier", "", "Cluster tier for which to retrieve the regions.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, `Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.`) + cmd.Flags().StringVar(&opts.tier, "tier", "", `Cluster tier for which to retrieve the regions.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListClustersForAllProjectsOpts struct { + +type listClustersForAllProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListClustersForAllProjectsOpts) initClient() func() error { +func (opts *listClustersForAllProjectsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListClustersForAllProjectsOpts) Run(ctx context.Context) error { +func (opts *listClustersForAllProjectsOpts) Run(ctx context.Context) error { params := &admin.ListClustersForAllProjectsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params).Execute() if err != nil { @@ -292,15 +302,15 @@ func (opts *ListClustersForAllProjectsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListClustersForAllProjectsBuilder() *cobra.Command { +func listClustersForAllProjectsBuilder() *cobra.Command { const template = "<>" - opts := ListClustersForAllProjectsOpts{} + opts := listClustersForAllProjectsOpts{} cmd := &cobra.Command{ - Use: "listClustersForAllProjects", + Use: "listClustersForAllProjects", Short: "Return All Authorized Clusters in All Projects", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -312,32 +322,33 @@ func ListClustersForAllProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) return cmd } -type LoadSampleDatasetOpts struct { + +type loadSampleDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } -func (opts *LoadSampleDatasetOpts) initClient() func() error { +func (opts *loadSampleDatasetOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *LoadSampleDatasetOpts) Run(ctx context.Context) error { +func (opts *loadSampleDatasetOpts) Run(ctx context.Context) error { params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params).Execute() if err != nil { @@ -347,15 +358,15 @@ func (opts *LoadSampleDatasetOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func LoadSampleDatasetBuilder() *cobra.Command { +func loadSampleDatasetBuilder() *cobra.Command { const template = "<>" - opts := LoadSampleDatasetOpts{} + opts := loadSampleDatasetOpts{} cmd := &cobra.Command{ - Use: "loadSampleDataset", + Use: "loadSampleDataset", Short: "Load Sample Dataset Request into Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -367,35 +378,36 @@ func LoadSampleDatasetBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label that identifies the cluster into which you load the sample dataset.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } -type UpdateClusterAdvancedConfigurationOpts struct { + +type updateClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *UpdateClusterAdvancedConfigurationOpts) initClient() func() error { +func (opts *updateClusterAdvancedConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { +func (opts *updateClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { params := &admin.UpdateClusterAdvancedConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -405,15 +417,15 @@ func (opts *UpdateClusterAdvancedConfigurationOpts) Run(ctx context.Context) err return opts.Print(resp) } -func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { +func updateClusterAdvancedConfigurationBuilder() *cobra.Command { const template = "<>" - opts := UpdateClusterAdvancedConfigurationOpts{} + opts := updateClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "updateClusterAdvancedConfiguration", + Use: "updateClusterAdvancedConfiguration", Short: "Update Advanced Configuration Options for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -425,34 +437,34 @@ func UpdateClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type UpgradeSharedClusterOpts struct { + +type upgradeSharedClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpgradeSharedClusterOpts) initClient() func() error { +func (opts *upgradeSharedClusterOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpgradeSharedClusterOpts) Run(ctx context.Context) error { +func (opts *upgradeSharedClusterOpts) Run(ctx context.Context) error { params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() if err != nil { @@ -462,15 +474,15 @@ func (opts *UpgradeSharedClusterOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpgradeSharedClusterBuilder() *cobra.Command { +func upgradeSharedClusterBuilder() *cobra.Command { const template = "<>" - opts := UpgradeSharedClusterOpts{} + opts := upgradeSharedClusterOpts{} cmd := &cobra.Command{ - Use: "upgradeSharedCluster", + Use: "upgradeSharedCluster", Short: "Upgrade One Shared-tier Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -482,32 +494,32 @@ func UpgradeSharedClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpgradeSharedClusterToServerlessOpts struct { + +type upgradeSharedClusterToServerlessOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpgradeSharedClusterToServerlessOpts) initClient() func() error { +func (opts *upgradeSharedClusterToServerlessOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error { +func (opts *upgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error { params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params).Execute() if err != nil { @@ -517,15 +529,15 @@ func (opts *UpgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error return opts.Print(resp) } -func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { +func upgradeSharedClusterToServerlessBuilder() *cobra.Command { const template = "<>" - opts := UpgradeSharedClusterToServerlessOpts{} + opts := upgradeSharedClusterToServerlessOpts{} cmd := &cobra.Command{ - Use: "upgradeSharedClusterToServerless", + Use: "upgradeSharedClusterToServerless", Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -537,29 +549,29 @@ func UpgradeSharedClusterToServerlessBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func ClustersBuilder() *cobra.Command { +func clustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "clusters", - Short: "Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.", + Use: "clusters", + Short: `Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.`, } cmd.AddCommand( - GetClusterAdvancedConfigurationBuilder(), - GetClusterStatusBuilder(), - GetSampleDatasetLoadStatusBuilder(), - ListCloudProviderRegionsBuilder(), - ListClustersForAllProjectsBuilder(), - LoadSampleDatasetBuilder(), - UpdateClusterAdvancedConfigurationBuilder(), - UpgradeSharedClusterBuilder(), - UpgradeSharedClusterToServerlessBuilder(), + getClusterAdvancedConfigurationBuilder(), + getClusterStatusBuilder(), + getSampleDatasetLoadStatusBuilder(), + listCloudProviderRegionsBuilder(), + listClustersForAllProjectsBuilder(), + loadSampleDatasetBuilder(), + updateClusterAdvancedConfigurationBuilder(), + upgradeSharedClusterBuilder(), + upgradeSharedClusterToServerlessBuilder(), ) return cmd } - diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index b3db8c7709..7dcb12a113 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateCustomDatabaseRoleOpts struct { +type createCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateCustomDatabaseRoleOpts) initClient() func() error { +func (opts *createCustomDatabaseRoleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateCustomDatabaseRoleOpts) Run(ctx context.Context) error { +func (opts *createCustomDatabaseRoleOpts) Run(ctx context.Context) error { params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreateCustomDatabaseRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateCustomDatabaseRoleBuilder() *cobra.Command { +func createCustomDatabaseRoleBuilder() *cobra.Command { const template = "<>" - opts := CreateCustomDatabaseRoleOpts{} + opts := createCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "createCustomDatabaseRole", + Use: "createCustomDatabaseRole", Short: "Create One Custom Role", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,31 +71,33 @@ func CreateCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteCustomDatabaseRoleOpts struct { + +type deleteCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string roleName string } -func (opts *DeleteCustomDatabaseRoleOpts) initClient() func() error { +func (opts *deleteCustomDatabaseRoleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteCustomDatabaseRoleOpts) Run(ctx context.Context) error { +func (opts *deleteCustomDatabaseRoleOpts) Run(ctx context.Context) error { params := &admin.DeleteCustomDatabaseRoleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, RoleName: opts.roleName, } _, err := opts.client.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(ctx, params).Execute() @@ -110,15 +108,15 @@ func (opts *DeleteCustomDatabaseRoleOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func DeleteCustomDatabaseRoleBuilder() *cobra.Command { +func deleteCustomDatabaseRoleBuilder() *cobra.Command { const template = "<>" - opts := DeleteCustomDatabaseRoleOpts{} + opts := deleteCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "deleteCustomDatabaseRole", + Use: "deleteCustomDatabaseRole", Short: "Remove One Custom Role from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -130,32 +128,35 @@ func DeleteCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleName, "roleName", "", "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd } -type GetCustomDatabaseRoleOpts struct { + +type getCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string roleName string } -func (opts *GetCustomDatabaseRoleOpts) initClient() func() error { +func (opts *getCustomDatabaseRoleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetCustomDatabaseRoleOpts) Run(ctx context.Context) error { +func (opts *getCustomDatabaseRoleOpts) Run(ctx context.Context) error { params := &admin.GetCustomDatabaseRoleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, RoleName: opts.roleName, } resp, _, err := opts.client.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(ctx, params).Execute() @@ -166,15 +167,15 @@ func (opts *GetCustomDatabaseRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetCustomDatabaseRoleBuilder() *cobra.Command { +func getCustomDatabaseRoleBuilder() *cobra.Command { const template = "<>" - opts := GetCustomDatabaseRoleOpts{} + opts := getCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "getCustomDatabaseRole", + Use: "getCustomDatabaseRole", Short: "Return One Custom Role in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -186,29 +187,32 @@ func GetCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleName, "roleName", "", "Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd } -type ListCustomDatabaseRolesOpts struct { + +type listCustomDatabaseRolesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *ListCustomDatabaseRolesOpts) initClient() func() error { +func (opts *listCustomDatabaseRolesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListCustomDatabaseRolesOpts) Run(ctx context.Context) error { +func (opts *listCustomDatabaseRolesOpts) Run(ctx context.Context) error { params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, } @@ -220,15 +224,15 @@ func (opts *ListCustomDatabaseRolesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListCustomDatabaseRolesBuilder() *cobra.Command { +func listCustomDatabaseRolesBuilder() *cobra.Command { const template = "<>" - opts := ListCustomDatabaseRolesOpts{} + opts := listCustomDatabaseRolesOpts{} cmd := &cobra.Command{ - Use: "listCustomDatabaseRoles", + Use: "listCustomDatabaseRoles", Short: "Return All Custom Roles in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -240,33 +244,34 @@ func ListCustomDatabaseRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateCustomDatabaseRoleOpts struct { + +type updateCustomDatabaseRoleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string roleName string - } -func (opts *UpdateCustomDatabaseRoleOpts) initClient() func() error { +func (opts *updateCustomDatabaseRoleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateCustomDatabaseRoleOpts) Run(ctx context.Context) error { +func (opts *updateCustomDatabaseRoleOpts) Run(ctx context.Context) error { params := &admin.UpdateCustomDatabaseRoleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, RoleName: opts.roleName, - } resp, _, err := opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { @@ -276,15 +281,15 @@ func (opts *UpdateCustomDatabaseRoleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateCustomDatabaseRoleBuilder() *cobra.Command { +func updateCustomDatabaseRoleBuilder() *cobra.Command { const template = "<>" - opts := UpdateCustomDatabaseRoleOpts{} + opts := updateCustomDatabaseRoleOpts{} cmd := &cobra.Command{ - Use: "updateCustomDatabaseRole", + Use: "updateCustomDatabaseRole", Short: "Update One Custom Role in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -296,27 +301,27 @@ func UpdateCustomDatabaseRoleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.roleName, "roleName", "", "Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd } -func CustomDatabaseRolesBuilder() *cobra.Command { +func customDatabaseRolesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "customDatabaseRoles", - Short: "Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the project level, for all clusters in the project. This resource supports a subset of MongoDB privilege actions. You can create a subset of custom role actions. To create a wider list of custom role actions, use the MongoDB Cloud user interface. Custom roles must include actions that all project's clusters support, and that are compatible with each MongoDB version that your project's clusters use. For example, if your project has MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4.", + Use: "customDatabaseRoles", + Short: `Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the project level, for all clusters in the project. This resource supports a subset of MongoDB privilege actions. You can create a subset of custom role actions. To create a wider list of custom role actions, use the MongoDB Cloud user interface. Custom roles must include actions that all project's clusters support, and that are compatible with each MongoDB version that your project's clusters use. For example, if your project has MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4.`, } cmd.AddCommand( - CreateCustomDatabaseRoleBuilder(), - DeleteCustomDatabaseRoleBuilder(), - GetCustomDatabaseRoleBuilder(), - ListCustomDatabaseRolesBuilder(), - UpdateCustomDatabaseRoleBuilder(), + createCustomDatabaseRoleBuilder(), + deleteCustomDatabaseRoleBuilder(), + getCustomDatabaseRoleBuilder(), + listCustomDatabaseRolesBuilder(), + updateCustomDatabaseRoleBuilder(), ) return cmd } - diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index 4bb895daca..553bcaf717 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateDataFederationPrivateEndpointOpts struct { +type createDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateDataFederationPrivateEndpointOpts) initClient() func() error { +func (opts *createDataFederationPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *createDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreateDataFederationPrivateEndpointOpts) Run(ctx context.Context) er return opts.Print(resp) } -func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { +func createDataFederationPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := CreateDataFederationPrivateEndpointOpts{} + opts := createDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "createDataFederationPrivateEndpoint", + Use: "createDataFederationPrivateEndpoint", Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,33 +71,35 @@ func CreateDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type CreateFederatedDatabaseOpts struct { + +type createFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + skipRoleValidation bool } -func (opts *CreateFederatedDatabaseOpts) initClient() func() error { +func (opts *createFederatedDatabaseOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateFederatedDatabaseOpts) Run(ctx context.Context) error { +func (opts *createFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, - + SkipRoleValidation: &opts.skipRoleValidation, } resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() @@ -112,15 +110,15 @@ func (opts *CreateFederatedDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateFederatedDatabaseBuilder() *cobra.Command { +func createFederatedDatabaseBuilder() *cobra.Command { const template = "<>" - opts := CreateFederatedDatabaseOpts{} + opts := createFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "createFederatedDatabase", + Use: "createFederatedDatabase", Short: "Create One Federated Database Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -132,37 +130,38 @@ func CreateFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - - cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type CreateOneDataFederationQueryLimitOpts struct { + +type createOneDataFederationQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string - + limitName string } -func (opts *CreateOneDataFederationQueryLimitOpts) initClient() func() error { +func (opts *createOneDataFederationQueryLimitOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateOneDataFederationQueryLimitOpts) Run(ctx context.Context) error { +func (opts *createOneDataFederationQueryLimitOpts) Run(ctx context.Context) error { params := &admin.CreateOneDataFederationQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, - + LimitName: opts.limitName, } resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params).Execute() if err != nil { @@ -172,15 +171,15 @@ func (opts *CreateOneDataFederationQueryLimitOpts) Run(ctx context.Context) erro return opts.Print(resp) } -func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { +func createOneDataFederationQueryLimitBuilder() *cobra.Command { const template = "<>" - opts := CreateOneDataFederationQueryLimitOpts{} + opts := createOneDataFederationQueryLimitOpts{} cmd := &cobra.Command{ - Use: "createOneDataFederationQueryLimit", + Use: "createOneDataFederationQueryLimit", Short: "Configure One Query Limit for One Federated Database Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -192,35 +191,45 @@ func CreateOneDataFederationQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to which the query limit applies.") - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) + cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. + +| Limit Name | Description | Default | +| --- | --- | --- | +| bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | +| bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | +| bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | +| bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | +`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } -type DeleteDataFederationPrivateEndpointOpts struct { + +type deleteDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string endpointId string } -func (opts *DeleteDataFederationPrivateEndpointOpts) initClient() func() error { +func (opts *deleteDataFederationPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *deleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.DeleteDataFederationPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EndpointId: opts.endpointId, } resp, _, err := opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params).Execute() @@ -231,15 +240,15 @@ func (opts *DeleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) er return opts.Print(resp) } -func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { +func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := DeleteDataFederationPrivateEndpointOpts{} + opts := deleteDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "deleteDataFederationPrivateEndpoint", + Use: "deleteDataFederationPrivateEndpoint", Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -251,32 +260,35 @@ func DeleteDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") return cmd } -type DeleteFederatedDatabaseOpts struct { + +type deleteFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } -func (opts *DeleteFederatedDatabaseOpts) initClient() func() error { +func (opts *deleteFederatedDatabaseOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteFederatedDatabaseOpts) Run(ctx context.Context) error { +func (opts *deleteFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.DeleteFederatedDatabaseApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params).Execute() @@ -287,15 +299,15 @@ func (opts *DeleteFederatedDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteFederatedDatabaseBuilder() *cobra.Command { +func deleteFederatedDatabaseBuilder() *cobra.Command { const template = "<>" - opts := DeleteFederatedDatabaseOpts{} + opts := deleteFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "deleteFederatedDatabase", + Use: "deleteFederatedDatabase", Short: "Remove One Federated Database Instance from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -307,35 +319,38 @@ func DeleteFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } -type DeleteOneDataFederationInstanceQueryLimitOpts struct { + +type deleteOneDataFederationInstanceQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string + limitName string } -func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) initClient() func() error { +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Context) error { +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Context) error { params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, + LimitName: opts.limitName, } resp, _, err := opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params).Execute() if err != nil { @@ -345,15 +360,15 @@ func (opts *DeleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Conte return opts.Print(resp) } -func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { +func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { const template = "<>" - opts := DeleteOneDataFederationInstanceQueryLimitOpts{} + opts := deleteOneDataFederationInstanceQueryLimitOpts{} cmd := &cobra.Command{ - Use: "deleteOneDataFederationInstanceQueryLimit", + Use: "deleteOneDataFederationInstanceQueryLimit", Short: "Delete One Query Limit For One Federated Database Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -365,39 +380,50 @@ func DeleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to which the query limit applies.") - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) + cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. + +| Limit Name | Description | Default | +| --- | --- | --- | +| bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | +| bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | +| bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | +| bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | +`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } -type DownloadFederatedDatabaseQueryLogsOpts struct { + +type downloadFederatedDatabaseQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - endDate int64 - startDate int64 + endDate int64 + startDate int64 } -func (opts *DownloadFederatedDatabaseQueryLogsOpts) initClient() func() error { +func (opts *downloadFederatedDatabaseQueryLogsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DownloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) error { +func (opts *downloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) error { params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - EndDate: &opts.endDate, - StartDate: &opts.startDate, + EndDate: &opts.endDate, + StartDate: &opts.startDate, } resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params).Execute() if err != nil { @@ -407,15 +433,15 @@ func (opts *DownloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) err return opts.Print(resp) } -func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { +func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { const template = "<>" - opts := DownloadFederatedDatabaseQueryLogsOpts{} + opts := downloadFederatedDatabaseQueryLogsOpts{} cmd := &cobra.Command{ - Use: "downloadFederatedDatabaseQueryLogs", + Use: "downloadFederatedDatabaseQueryLogs", Short: "Download Query Logs for One Federated Database Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -427,34 +453,37 @@ func DownloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance for which you want to download query logs.") - cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, "Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") - cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, "Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to download query logs.`) + cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) + cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } -type GetDataFederationPrivateEndpointOpts struct { + +type getDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string endpointId string } -func (opts *GetDataFederationPrivateEndpointOpts) initClient() func() error { +func (opts *getDataFederationPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *getDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.GetDataFederationPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EndpointId: opts.endpointId, } resp, _, err := opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params).Execute() @@ -465,15 +494,15 @@ func (opts *GetDataFederationPrivateEndpointOpts) Run(ctx context.Context) error return opts.Print(resp) } -func GetDataFederationPrivateEndpointBuilder() *cobra.Command { +func getDataFederationPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := GetDataFederationPrivateEndpointOpts{} + opts := getDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "getDataFederationPrivateEndpoint", + Use: "getDataFederationPrivateEndpoint", Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -485,32 +514,35 @@ func GetDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") return cmd } -type GetFederatedDatabaseOpts struct { + +type getFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } -func (opts *GetFederatedDatabaseOpts) initClient() func() error { +func (opts *getFederatedDatabaseOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetFederatedDatabaseOpts) Run(ctx context.Context) error { +func (opts *getFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.GetFederatedDatabaseApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params).Execute() @@ -521,15 +553,15 @@ func (opts *GetFederatedDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetFederatedDatabaseBuilder() *cobra.Command { +func getFederatedDatabaseBuilder() *cobra.Command { const template = "<>" - opts := GetFederatedDatabaseOpts{} + opts := getFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "getFederatedDatabase", + Use: "getFederatedDatabase", Short: "Return One Federated Database Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -541,37 +573,40 @@ func GetFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the Federated Database to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } -type ListDataFederationPrivateEndpointsOpts struct { + +type listDataFederationPrivateEndpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListDataFederationPrivateEndpointsOpts) initClient() func() error { +func (opts *listDataFederationPrivateEndpointsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListDataFederationPrivateEndpointsOpts) Run(ctx context.Context) error { +func (opts *listDataFederationPrivateEndpointsOpts) Run(ctx context.Context) error { params := &admin.ListDataFederationPrivateEndpointsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params).Execute() if err != nil { @@ -581,15 +616,15 @@ func (opts *ListDataFederationPrivateEndpointsOpts) Run(ctx context.Context) err return opts.Print(resp) } -func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { +func listDataFederationPrivateEndpointsBuilder() *cobra.Command { const template = "<>" - opts := ListDataFederationPrivateEndpointsOpts{} + opts := listDataFederationPrivateEndpointsOpts{} cmd := &cobra.Command{ - Use: "listDataFederationPrivateEndpoints", + Use: "listDataFederationPrivateEndpoints", Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -601,34 +636,37 @@ func ListDataFederationPrivateEndpointsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListFederatedDatabasesOpts struct { + +type listFederatedDatabasesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - type_ string + type_ string } -func (opts *ListFederatedDatabasesOpts) initClient() func() error { +func (opts *listFederatedDatabasesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListFederatedDatabasesOpts) Run(ctx context.Context) error { +func (opts *listFederatedDatabasesOpts) Run(ctx context.Context) error { params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, - Type_: &opts.type_, + Type_: &opts.type_, } resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params).Execute() if err != nil { @@ -638,15 +676,15 @@ func (opts *ListFederatedDatabasesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListFederatedDatabasesBuilder() *cobra.Command { +func listFederatedDatabasesBuilder() *cobra.Command { const template = "<>" - opts := ListFederatedDatabasesOpts{} + opts := listFederatedDatabasesOpts{} cmd := &cobra.Command{ - Use: "listFederatedDatabases", + Use: "listFederatedDatabases", Short: "Return All Federated Database Instances in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -658,34 +696,37 @@ func ListFederatedDatabasesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", "Type of Federated Database Instances to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ReturnFederatedDatabaseQueryLimitOpts struct { + +type returnFederatedDatabaseQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string + limitName string } -func (opts *ReturnFederatedDatabaseQueryLimitOpts) initClient() func() error { +func (opts *returnFederatedDatabaseQueryLimitOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ReturnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context) error { +func (opts *returnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context) error { params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, + LimitName: opts.limitName, } resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params).Execute() if err != nil { @@ -695,15 +736,15 @@ func (opts *ReturnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context) erro return opts.Print(resp) } -func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { +func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { const template = "<>" - opts := ReturnFederatedDatabaseQueryLimitOpts{} + opts := returnFederatedDatabaseQueryLimitOpts{} cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimit", + Use: "returnFederatedDatabaseQueryLimit", Short: "Return One Federated Database Instance Query Limit for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -715,34 +756,45 @@ func ReturnFederatedDatabaseQueryLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to which the query limit applies.") - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this data federation instance limit. | Limit Name | Description | Default | | --- | --- | --- | | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) + cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. + +| Limit Name | Description | Default | +| --- | --- | --- | +| bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | +| bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | +| bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | +| bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | +`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } -type ReturnFederatedDatabaseQueryLimitsOpts struct { + +type returnFederatedDatabaseQueryLimitsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } -func (opts *ReturnFederatedDatabaseQueryLimitsOpts) initClient() func() error { +func (opts *returnFederatedDatabaseQueryLimitsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ReturnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) error { +func (opts *returnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) error { params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params).Execute() @@ -753,15 +805,15 @@ func (opts *ReturnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) err return opts.Print(resp) } -func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { +func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { const template = "<>" - opts := ReturnFederatedDatabaseQueryLimitsOpts{} + opts := returnFederatedDatabaseQueryLimitsOpts{} cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimits", + Use: "returnFederatedDatabaseQueryLimits", Short: "Return All Query Limits for One Federated Database Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -773,37 +825,38 @@ func ReturnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance for which you want to retrieve query limits.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } -type UpdateFederatedDatabaseOpts struct { + +type updateFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - tenantName string + client *admin.APIClient + groupId string + tenantName string skipRoleValidation bool - } -func (opts *UpdateFederatedDatabaseOpts) initClient() func() error { +func (opts *updateFederatedDatabaseOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateFederatedDatabaseOpts) Run(ctx context.Context) error { +func (opts *updateFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.UpdateFederatedDatabaseApiParams{ - GroupId: opts.groupId, - TenantName: opts.tenantName, - SkipRoleValidation: opts.skipRoleValidation, - + GroupId: opts.groupId, + TenantName: opts.tenantName, + SkipRoleValidation: &opts.skipRoleValidation, } resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { @@ -813,15 +866,15 @@ func (opts *UpdateFederatedDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateFederatedDatabaseBuilder() *cobra.Command { +func updateFederatedDatabaseBuilder() *cobra.Command { const template = "<>" - opts := UpdateFederatedDatabaseOpts{} + opts := updateFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "updateFederatedDatabase", + Use: "updateFederatedDatabase", Short: "Update One Federated Database Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -833,10 +886,11 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", "Human-readable label that identifies the federated database instance to update.") - cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, "Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to update.`) + cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -844,27 +898,26 @@ func UpdateFederatedDatabaseBuilder() *cobra.Command { return cmd } -func DataFederationBuilder() *cobra.Command { +func dataFederationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "dataFederation", - Short: "Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.", + Use: "dataFederation", + Short: `Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.`, } cmd.AddCommand( - CreateDataFederationPrivateEndpointBuilder(), - CreateFederatedDatabaseBuilder(), - CreateOneDataFederationQueryLimitBuilder(), - DeleteDataFederationPrivateEndpointBuilder(), - DeleteFederatedDatabaseBuilder(), - DeleteOneDataFederationInstanceQueryLimitBuilder(), - DownloadFederatedDatabaseQueryLogsBuilder(), - GetDataFederationPrivateEndpointBuilder(), - GetFederatedDatabaseBuilder(), - ListDataFederationPrivateEndpointsBuilder(), - ListFederatedDatabasesBuilder(), - ReturnFederatedDatabaseQueryLimitBuilder(), - ReturnFederatedDatabaseQueryLimitsBuilder(), - UpdateFederatedDatabaseBuilder(), + createDataFederationPrivateEndpointBuilder(), + createFederatedDatabaseBuilder(), + createOneDataFederationQueryLimitBuilder(), + deleteDataFederationPrivateEndpointBuilder(), + deleteFederatedDatabaseBuilder(), + deleteOneDataFederationInstanceQueryLimitBuilder(), + downloadFederatedDatabaseQueryLogsBuilder(), + getDataFederationPrivateEndpointBuilder(), + getFederatedDatabaseBuilder(), + listDataFederationPrivateEndpointsBuilder(), + listFederatedDatabasesBuilder(), + returnFederatedDatabaseQueryLimitBuilder(), + returnFederatedDatabaseQueryLimitsBuilder(), + updateFederatedDatabaseBuilder(), ) return cmd } - diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 93b5d9be21..342ed41148 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreatePipelineOpts struct { +type createPipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreatePipelineOpts) initClient() func() error { +func (opts *createPipelineOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreatePipelineOpts) Run(ctx context.Context) error { +func (opts *createPipelineOpts) Run(ctx context.Context) error { params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreatePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreatePipelineBuilder() *cobra.Command { +func createPipelineBuilder() *cobra.Command { const template = "<>" - opts := CreatePipelineOpts{} + opts := createPipelineOpts{} cmd := &cobra.Command{ - Use: "createPipeline", + Use: "createPipeline", Short: "Create One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,31 +71,33 @@ func CreatePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeletePipelineOpts struct { + +type deletePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } -func (opts *DeletePipelineOpts) initClient() func() error { +func (opts *deletePipelineOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeletePipelineOpts) Run(ctx context.Context) error { +func (opts *deletePipelineOpts) Run(ctx context.Context) error { params := &admin.DeletePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params).Execute() @@ -110,15 +108,15 @@ func (opts *DeletePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeletePipelineBuilder() *cobra.Command { +func deletePipelineBuilder() *cobra.Command { const template = "<>" - opts := DeletePipelineOpts{} + opts := deletePipelineOpts{} cmd := &cobra.Command{ - Use: "deletePipeline", + Use: "deletePipeline", Short: "Remove One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -130,34 +128,37 @@ func DeletePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -type DeletePipelineRunDatasetOpts struct { + +type deletePipelineRunDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string + client *admin.APIClient + groupId string + pipelineName string pipelineRunId string } -func (opts *DeletePipelineRunDatasetOpts) initClient() func() error { +func (opts *deletePipelineRunDatasetOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeletePipelineRunDatasetOpts) Run(ctx context.Context) error { +func (opts *deletePipelineRunDatasetOpts) Run(ctx context.Context) error { params := &admin.DeletePipelineRunDatasetApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params).Execute() @@ -168,15 +169,15 @@ func (opts *DeletePipelineRunDatasetOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeletePipelineRunDatasetBuilder() *cobra.Command { +func deletePipelineRunDatasetBuilder() *cobra.Command { const template = "<>" - opts := DeletePipelineRunDatasetOpts{} + opts := deletePipelineRunDatasetOpts{} cmd := &cobra.Command{ - Use: "deletePipelineRunDataset", + Use: "deletePipelineRunDataset", Short: "Delete Pipeline Run Dataset", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -188,34 +189,37 @@ func DeletePipelineRunDatasetBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd } -type GetPipelineOpts struct { + +type getPipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } -func (opts *GetPipelineOpts) initClient() func() error { +func (opts *getPipelineOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetPipelineOpts) Run(ctx context.Context) error { +func (opts *getPipelineOpts) Run(ctx context.Context) error { params := &admin.GetPipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params).Execute() @@ -226,15 +230,15 @@ func (opts *GetPipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetPipelineBuilder() *cobra.Command { +func getPipelineBuilder() *cobra.Command { const template = "<>" - opts := GetPipelineOpts{} + opts := getPipelineOpts{} cmd := &cobra.Command{ - Use: "getPipeline", + Use: "getPipeline", Short: "Return One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -246,34 +250,37 @@ func GetPipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -type GetPipelineRunOpts struct { + +type getPipelineRunOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string + client *admin.APIClient + groupId string + pipelineName string pipelineRunId string } -func (opts *GetPipelineRunOpts) initClient() func() error { +func (opts *getPipelineRunOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetPipelineRunOpts) Run(ctx context.Context) error { +func (opts *getPipelineRunOpts) Run(ctx context.Context) error { params := &admin.GetPipelineRunApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params).Execute() @@ -284,15 +291,15 @@ func (opts *GetPipelineRunOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetPipelineRunBuilder() *cobra.Command { +func getPipelineRunBuilder() *cobra.Command { const template = "<>" - opts := GetPipelineRunOpts{} + opts := getPipelineRunOpts{} cmd := &cobra.Command{ - Use: "getPipelineRun", + Use: "getPipelineRun", Short: "Return One Data Lake Pipeline Run", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -304,42 +311,45 @@ func GetPipelineRunBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", "Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd } -type ListPipelineRunsOpts struct { + +type listPipelineRunsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string - includeCount bool - itemsPerPage int - pageNum int + client *admin.APIClient + groupId string + pipelineName string + includeCount bool + itemsPerPage int + pageNum int createdBefore string } -func (opts *ListPipelineRunsOpts) initClient() func() error { +func (opts *listPipelineRunsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPipelineRunsOpts) Run(ctx context.Context) error { +func (opts *listPipelineRunsOpts) Run(ctx context.Context) error { params := &admin.ListPipelineRunsApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, CreatedBefore: convertTime(&opts.createdBefore), } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params).Execute() @@ -350,15 +360,15 @@ func (opts *ListPipelineRunsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListPipelineRunsBuilder() *cobra.Command { +func listPipelineRunsBuilder() *cobra.Command { const template = "<>" - opts := ListPipelineRunsOpts{} + opts := listPipelineRunsOpts{} cmd := &cobra.Command{ - Use: "listPipelineRuns", + Use: "listPipelineRuns", Short: "Return All Data Lake Pipeline Runs from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -370,36 +380,39 @@ func ListPipelineRunsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", "If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", `If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -type ListPipelineSchedulesOpts struct { + +type listPipelineSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } -func (opts *ListPipelineSchedulesOpts) initClient() func() error { +func (opts *listPipelineSchedulesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPipelineSchedulesOpts) Run(ctx context.Context) error { +func (opts *listPipelineSchedulesOpts) Run(ctx context.Context) error { params := &admin.ListPipelineSchedulesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params).Execute() @@ -410,15 +423,15 @@ func (opts *ListPipelineSchedulesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListPipelineSchedulesBuilder() *cobra.Command { +func listPipelineSchedulesBuilder() *cobra.Command { const template = "<>" - opts := ListPipelineSchedulesOpts{} + opts := listPipelineSchedulesOpts{} cmd := &cobra.Command{ - Use: "listPipelineSchedules", + Use: "listPipelineSchedules", Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -430,40 +443,43 @@ func ListPipelineSchedulesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -type ListPipelineSnapshotsOpts struct { + +type listPipelineSnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string - includeCount bool - itemsPerPage int - pageNum int + client *admin.APIClient + groupId string + pipelineName string + includeCount bool + itemsPerPage int + pageNum int completedAfter string } -func (opts *ListPipelineSnapshotsOpts) initClient() func() error { +func (opts *listPipelineSnapshotsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPipelineSnapshotsOpts) Run(ctx context.Context) error { +func (opts *listPipelineSnapshotsOpts) Run(ctx context.Context) error { params := &admin.ListPipelineSnapshotsApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, CompletedAfter: convertTime(&opts.completedAfter), } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params).Execute() @@ -474,15 +490,15 @@ func (opts *ListPipelineSnapshotsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListPipelineSnapshotsBuilder() *cobra.Command { +func listPipelineSnapshotsBuilder() *cobra.Command { const template = "<>" - opts := ListPipelineSnapshotsOpts{} + opts := listPipelineSnapshotsOpts{} cmd := &cobra.Command{ - Use: "listPipelineSnapshots", + Use: "listPipelineSnapshots", Short: "Return Available Backup Snapshots for One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -494,33 +510,36 @@ func ListPipelineSnapshotsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", "Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", `Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -type ListPipelinesOpts struct { + +type listPipelinesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *ListPipelinesOpts) initClient() func() error { +func (opts *listPipelinesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPipelinesOpts) Run(ctx context.Context) error { +func (opts *listPipelinesOpts) Run(ctx context.Context) error { params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, } @@ -532,15 +551,15 @@ func (opts *ListPipelinesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListPipelinesBuilder() *cobra.Command { +func listPipelinesBuilder() *cobra.Command { const template = "<>" - opts := ListPipelinesOpts{} + opts := listPipelinesOpts{} cmd := &cobra.Command{ - Use: "listPipelines", + Use: "listPipelines", Short: "Return All Data Lake Pipelines from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -552,30 +571,33 @@ func ListPipelinesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type PausePipelineOpts struct { + +type pausePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } -func (opts *PausePipelineOpts) initClient() func() error { +func (opts *pausePipelineOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *PausePipelineOpts) Run(ctx context.Context) error { +func (opts *pausePipelineOpts) Run(ctx context.Context) error { params := &admin.PausePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params).Execute() @@ -586,15 +608,15 @@ func (opts *PausePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func PausePipelineBuilder() *cobra.Command { +func pausePipelineBuilder() *cobra.Command { const template = "<>" - opts := PausePipelineOpts{} + opts := pausePipelineOpts{} cmd := &cobra.Command{ - Use: "pausePipeline", + Use: "pausePipeline", Short: "Pause One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -606,32 +628,35 @@ func PausePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -type ResumePipelineOpts struct { + +type resumePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } -func (opts *ResumePipelineOpts) initClient() func() error { +func (opts *resumePipelineOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ResumePipelineOpts) Run(ctx context.Context) error { +func (opts *resumePipelineOpts) Run(ctx context.Context) error { params := &admin.ResumePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params).Execute() @@ -642,15 +667,15 @@ func (opts *ResumePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ResumePipelineBuilder() *cobra.Command { +func resumePipelineBuilder() *cobra.Command { const template = "<>" - opts := ResumePipelineOpts{} + opts := resumePipelineOpts{} cmd := &cobra.Command{ - Use: "resumePipeline", + Use: "resumePipeline", Short: "Resume One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -662,35 +687,36 @@ func ResumePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -type TriggerSnapshotIngestionOpts struct { + +type triggerSnapshotIngestionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string - } -func (opts *TriggerSnapshotIngestionOpts) initClient() func() error { +func (opts *triggerSnapshotIngestionOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *TriggerSnapshotIngestionOpts) Run(ctx context.Context) error { +func (opts *triggerSnapshotIngestionOpts) Run(ctx context.Context) error { params := &admin.TriggerSnapshotIngestionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, - } resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() if err != nil { @@ -700,15 +726,15 @@ func (opts *TriggerSnapshotIngestionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func TriggerSnapshotIngestionBuilder() *cobra.Command { +func triggerSnapshotIngestionBuilder() *cobra.Command { const template = "<>" - opts := TriggerSnapshotIngestionOpts{} + opts := triggerSnapshotIngestionOpts{} cmd := &cobra.Command{ - Use: "triggerSnapshotIngestion", + Use: "triggerSnapshotIngestion", Short: "Trigger on demand snapshot ingestion", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -720,36 +746,36 @@ func TriggerSnapshotIngestionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -type UpdatePipelineOpts struct { + +type updatePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string - } -func (opts *UpdatePipelineOpts) initClient() func() error { +func (opts *updatePipelineOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdatePipelineOpts) Run(ctx context.Context) error { +func (opts *updatePipelineOpts) Run(ctx context.Context) error { params := &admin.UpdatePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, - } resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() if err != nil { @@ -759,15 +785,15 @@ func (opts *UpdatePipelineOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdatePipelineBuilder() *cobra.Command { +func updatePipelineBuilder() *cobra.Command { const template = "<>" - opts := UpdatePipelineOpts{} + opts := updatePipelineOpts{} cmd := &cobra.Command{ - Use: "updatePipeline", + Use: "updatePipeline", Short: "Update One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -779,35 +805,35 @@ func UpdatePipelineBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", "Human-readable label that identifies the Data Lake Pipeline.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } -func DataLakePipelinesBuilder() *cobra.Command { +func dataLakePipelinesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "dataLakePipelines", - Short: "Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.", + Use: "dataLakePipelines", + Short: `Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.`, } cmd.AddCommand( - CreatePipelineBuilder(), - DeletePipelineBuilder(), - DeletePipelineRunDatasetBuilder(), - GetPipelineBuilder(), - GetPipelineRunBuilder(), - ListPipelineRunsBuilder(), - ListPipelineSchedulesBuilder(), - ListPipelineSnapshotsBuilder(), - ListPipelinesBuilder(), - PausePipelineBuilder(), - ResumePipelineBuilder(), - TriggerSnapshotIngestionBuilder(), - UpdatePipelineBuilder(), + createPipelineBuilder(), + deletePipelineBuilder(), + deletePipelineRunDatasetBuilder(), + getPipelineBuilder(), + getPipelineRunBuilder(), + listPipelineRunsBuilder(), + listPipelineSchedulesBuilder(), + listPipelineSnapshotsBuilder(), + listPipelinesBuilder(), + pausePipelineBuilder(), + resumePipelineBuilder(), + triggerSnapshotIngestionBuilder(), + updatePipelineBuilder(), ) return cmd } - diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 0dcb1daa2e..c0e405a7f5 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateDatabaseUserOpts struct { +type createDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateDatabaseUserOpts) initClient() func() error { +func (opts *createDatabaseUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateDatabaseUserOpts) Run(ctx context.Context) error { +func (opts *createDatabaseUserOpts) Run(ctx context.Context) error { params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreateDatabaseUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateDatabaseUserBuilder() *cobra.Command { +func createDatabaseUserBuilder() *cobra.Command { const template = "<>" - opts := CreateDatabaseUserOpts{} + opts := createDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "createDatabaseUser", + Use: "createDatabaseUser", Short: "Create One Database User in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,34 +71,36 @@ func CreateDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteDatabaseUserOpts struct { + +type deleteDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string databaseName string - username string + username string } -func (opts *DeleteDatabaseUserOpts) initClient() func() error { +func (opts *deleteDatabaseUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteDatabaseUserOpts) Run(ctx context.Context) error { +func (opts *deleteDatabaseUserOpts) Run(ctx context.Context) error { params := &admin.DeleteDatabaseUserApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, DatabaseName: opts.databaseName, - Username: opts.username, + Username: opts.username, } resp, _, err := opts.client.DatabaseUsersApi.DeleteDatabaseUserWithParams(ctx, params).Execute() if err != nil { @@ -112,15 +110,15 @@ func (opts *DeleteDatabaseUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteDatabaseUserBuilder() *cobra.Command { +func deleteDatabaseUserBuilder() *cobra.Command { const template = "<>" - opts := DeleteDatabaseUserOpts{} + opts := deleteDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "deleteDatabaseUser", + Use: "deleteDatabaseUser", Short: "Remove One Database User from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -132,37 +130,51 @@ func DeleteDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") - cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.`) + cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + +| Authentication Method | Parameter Needed | Parameter Value | username Format | +|---|---|---|---| +| AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | +| AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | +| x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | +`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") return cmd } -type GetDatabaseUserOpts struct { + +type getDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string databaseName string - username string + username string } -func (opts *GetDatabaseUserOpts) initClient() func() error { +func (opts *getDatabaseUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetDatabaseUserOpts) Run(ctx context.Context) error { +func (opts *getDatabaseUserOpts) Run(ctx context.Context) error { params := &admin.GetDatabaseUserApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, DatabaseName: opts.databaseName, - Username: opts.username, + Username: opts.username, } resp, _, err := opts.client.DatabaseUsersApi.GetDatabaseUserWithParams(ctx, params).Execute() if err != nil { @@ -172,15 +184,15 @@ func (opts *GetDatabaseUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetDatabaseUserBuilder() *cobra.Command { +func getDatabaseUserBuilder() *cobra.Command { const template = "<>" - opts := GetDatabaseUserOpts{} + opts := getDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "getDatabaseUser", + Use: "getDatabaseUser", Short: "Return One Database User from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -192,39 +204,53 @@ func GetDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") - cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.`) + cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + +| Authentication Method | Parameter Needed | Parameter Value | username Format | +|---|---|---|---| +| AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | +| AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | +| x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | +`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") return cmd } -type ListDatabaseUsersOpts struct { + +type listDatabaseUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListDatabaseUsersOpts) initClient() func() error { +func (opts *listDatabaseUsersOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListDatabaseUsersOpts) Run(ctx context.Context) error { +func (opts *listDatabaseUsersOpts) Run(ctx context.Context) error { params := &admin.ListDatabaseUsersApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.DatabaseUsersApi.ListDatabaseUsersWithParams(ctx, params).Execute() if err != nil { @@ -234,15 +260,15 @@ func (opts *ListDatabaseUsersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListDatabaseUsersBuilder() *cobra.Command { +func listDatabaseUsersBuilder() *cobra.Command { const template = "<>" - opts := ListDatabaseUsersOpts{} + opts := listDatabaseUsersOpts{} cmd := &cobra.Command{ - Use: "listDatabaseUsers", + Use: "listDatabaseUsers", Short: "Return All Database Users from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -254,38 +280,39 @@ func ListDatabaseUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateDatabaseUserOpts struct { + +type updateDatabaseUserOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string databaseName string - username string - + username string } -func (opts *UpdateDatabaseUserOpts) initClient() func() error { +func (opts *updateDatabaseUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateDatabaseUserOpts) Run(ctx context.Context) error { +func (opts *updateDatabaseUserOpts) Run(ctx context.Context) error { params := &admin.UpdateDatabaseUserApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, DatabaseName: opts.databaseName, - Username: opts.username, - + Username: opts.username, } resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params).Execute() if err != nil { @@ -295,15 +322,15 @@ func (opts *UpdateDatabaseUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateDatabaseUserBuilder() *cobra.Command { +func updateDatabaseUserBuilder() *cobra.Command { const template = "<>" - opts := UpdateDatabaseUserOpts{} + opts := updateDatabaseUserOpts{} cmd := &cobra.Command{ - Use: "updateDatabaseUser", + Use: "updateDatabaseUser", Short: "Update One Database User in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -315,10 +342,22 @@ func UpdateDatabaseUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.") - cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| | AWS IAM | awsType | ROLE | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | AWS IAM | awsType | USER | <abbr title=\"Amazon Resource Name\">ARN</abbr> | | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | ") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.`) + cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + +| Authentication Method | Parameter Needed | Parameter Value | username Format | +|---|---|---|---| +| AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | +| AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | +| x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | +`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") @@ -326,18 +365,17 @@ func UpdateDatabaseUserBuilder() *cobra.Command { return cmd } -func DatabaseUsersBuilder() *cobra.Command { +func databaseUsersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "databaseUsers", - Short: "Returns, adds, edits, and removes database users.", + Use: "databaseUsers", + Short: `Returns, adds, edits, and removes database users.`, } cmd.AddCommand( - CreateDatabaseUserBuilder(), - DeleteDatabaseUserBuilder(), - GetDatabaseUserBuilder(), - ListDatabaseUsersBuilder(), - UpdateDatabaseUserBuilder(), + createDatabaseUserBuilder(), + deleteDatabaseUserBuilder(), + getDatabaseUserBuilder(), + listDatabaseUsersBuilder(), + updateDatabaseUserBuilder(), ) return cmd } - diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index eb8d266f0e..f1d27b3add 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -18,30 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type GetEncryptionAtRestOpts struct { +type getEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetEncryptionAtRestOpts) initClient() func() error { +func (opts *getEncryptionAtRestOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetEncryptionAtRestOpts) Run(ctx context.Context) error { +func (opts *getEncryptionAtRestOpts) Run(ctx context.Context) error { params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, } @@ -53,15 +51,15 @@ func (opts *GetEncryptionAtRestOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetEncryptionAtRestBuilder() *cobra.Command { +func getEncryptionAtRestBuilder() *cobra.Command { const template = "<>" - opts := GetEncryptionAtRestOpts{} + opts := getEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "getEncryptionAtRest", + Use: "getEncryptionAtRest", Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,31 +71,32 @@ func GetEncryptionAtRestBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateEncryptionAtRestOpts struct { + +type updateEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpdateEncryptionAtRestOpts) initClient() func() error { +func (opts *updateEncryptionAtRestOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateEncryptionAtRestOpts) Run(ctx context.Context) error { +func (opts *updateEncryptionAtRestOpts) Run(ctx context.Context) error { params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params).Execute() if err != nil { @@ -107,15 +106,15 @@ func (opts *UpdateEncryptionAtRestOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateEncryptionAtRestBuilder() *cobra.Command { +func updateEncryptionAtRestBuilder() *cobra.Command { const template = "<>" - opts := UpdateEncryptionAtRestOpts{} + opts := updateEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "updateEncryptionAtRest", + Use: "updateEncryptionAtRest", Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -127,22 +126,22 @@ func UpdateEncryptionAtRestBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func EncryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { +func encryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "encryptionAtRestUsingCustomerKeyManagement", - Short: "Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.", + Use: "encryptionAtRestUsingCustomerKeyManagement", + Short: `Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.`, } cmd.AddCommand( - GetEncryptionAtRestBuilder(), - UpdateEncryptionAtRestBuilder(), + getEncryptionAtRestBuilder(), + updateEncryptionAtRestBuilder(), ) return cmd } - diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 72f5771e1b..e33f41bca8 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -18,35 +18,33 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type GetOrganizationEventOpts struct { +type getOrganizationEventOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string - eventId string + client *admin.APIClient + orgId string + eventId string includeRaw bool } -func (opts *GetOrganizationEventOpts) initClient() func() error { +func (opts *getOrganizationEventOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetOrganizationEventOpts) Run(ctx context.Context) error { +func (opts *getOrganizationEventOpts) Run(ctx context.Context) error { params := &admin.GetOrganizationEventApiParams{ - OrgId: opts.orgId, - EventId: opts.eventId, + OrgId: opts.orgId, + EventId: opts.eventId, IncludeRaw: &opts.includeRaw, } resp, _, err := opts.client.EventsApi.GetOrganizationEventWithParams(ctx, params).Execute() @@ -57,15 +55,15 @@ func (opts *GetOrganizationEventOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetOrganizationEventBuilder() *cobra.Command { +func getOrganizationEventBuilder() *cobra.Command { const template = "<>" - opts := GetOrganizationEventOpts{} + opts := getOrganizationEventOpts{} cmd := &cobra.Command{ - Use: "getOrganizationEvent", + Use: "getOrganizationEvent", Short: "Return One Event from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,35 +75,36 @@ func GetOrganizationEventBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.eventId, "eventId", "", "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("eventId") return cmd } -type GetProjectEventOpts struct { + +type getProjectEventOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - eventId string + client *admin.APIClient + groupId string + eventId string includeRaw bool } -func (opts *GetProjectEventOpts) initClient() func() error { +func (opts *getProjectEventOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetProjectEventOpts) Run(ctx context.Context) error { +func (opts *getProjectEventOpts) Run(ctx context.Context) error { params := &admin.GetProjectEventApiParams{ - GroupId: opts.groupId, - EventId: opts.eventId, + GroupId: opts.groupId, + EventId: opts.eventId, IncludeRaw: &opts.includeRaw, } resp, _, err := opts.client.EventsApi.GetProjectEventWithParams(ctx, params).Execute() @@ -116,15 +115,15 @@ func (opts *GetProjectEventOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetProjectEventBuilder() *cobra.Command { +func getProjectEventBuilder() *cobra.Command { const template = "<>" - opts := GetProjectEventOpts{} + opts := getProjectEventOpts{} cmd := &cobra.Command{ - Use: "getProjectEvent", + Use: "getProjectEvent", Short: "Return One Event from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,46 +135,49 @@ func GetProjectEventBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.eventId, "eventId", "", "Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("eventId") return cmd } -type ListOrganizationEventsOpts struct { + +type listOrganizationEventsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int - eventType []string - includeRaw bool - maxDate string - minDate string + pageNum int + eventType []string + includeRaw bool + maxDate string + minDate string } -func (opts *ListOrganizationEventsOpts) initClient() func() error { +func (opts *listOrganizationEventsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListOrganizationEventsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationEventsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationEventsApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - EventType: &opts.eventType, - IncludeRaw: &opts.includeRaw, - MaxDate: convertTime(&opts.maxDate), - MinDate: convertTime(&opts.minDate), + PageNum: &opts.pageNum, + EventType: &opts.eventType, + IncludeRaw: &opts.includeRaw, + MaxDate: convertTime(&opts.maxDate), + MinDate: convertTime(&opts.minDate), } resp, _, err := opts.client.EventsApi.ListOrganizationEventsWithParams(ctx, params).Execute() if err != nil { @@ -185,15 +187,15 @@ func (opts *ListOrganizationEventsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListOrganizationEventsBuilder() *cobra.Command { +func listOrganizationEventsBuilder() *cobra.Command { const template = "<>" - opts := ListOrganizationEventsOpts{} + opts := listOrganizationEventsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationEvents", + Use: "listOrganizationEvents", Short: "Return All Events from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -205,52 +207,55 @@ func ListOrganizationEventsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") - cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") - cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") - cmd.Flags().StringVar(&opts.minDate, "minDate", "", "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, `Category of incident recorded at this moment in time. + +**IMPORTANT**: The complete list of event type values changes frequently.`) + cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) + cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListProjectEventsOpts struct { + +type listProjectEventsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int clusterNames []string - eventType []string - includeRaw bool - maxDate string - minDate string + eventType []string + includeRaw bool + maxDate string + minDate string } -func (opts *ListProjectEventsOpts) initClient() func() error { +func (opts *listProjectEventsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListProjectEventsOpts) Run(ctx context.Context) error { +func (opts *listProjectEventsOpts) Run(ctx context.Context) error { params := &admin.ListProjectEventsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, ClusterNames: &opts.clusterNames, - EventType: &opts.eventType, - IncludeRaw: &opts.includeRaw, - MaxDate: convertTime(&opts.maxDate), - MinDate: convertTime(&opts.minDate), + EventType: &opts.eventType, + IncludeRaw: &opts.includeRaw, + MaxDate: convertTime(&opts.maxDate), + MinDate: convertTime(&opts.minDate), } resp, _, err := opts.client.EventsApi.ListProjectEventsWithParams(ctx, params).Execute() if err != nil { @@ -260,15 +265,15 @@ func (opts *ListProjectEventsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListProjectEventsBuilder() *cobra.Command { +func listProjectEventsBuilder() *cobra.Command { const template = "<>" - opts := ListProjectEventsOpts{} + opts := listProjectEventsOpts{} cmd := &cobra.Command{ - Use: "listProjectEvents", + Use: "listProjectEvents", Short: "Return All Events from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -280,31 +285,34 @@ func ListProjectEventsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringSliceVar(&opts.clusterNames, "clusterNames", nil, "Human-readable label that identifies the cluster.") - cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, "Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.") - cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, "Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.") - cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", "Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") - cmd.Flags().StringVar(&opts.minDate, "minDate", "", "Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601</a> timestamp format in UTC.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringSliceVar(&opts.clusterNames, "clusterNames", nil, `Human-readable label that identifies the cluster.`) + cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, `Category of incident recorded at this moment in time. + +**IMPORTANT**: The complete list of event type values changes frequently.`) + cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) + cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func EventsBuilder() *cobra.Command { +func eventsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "events", - Short: "Returns events. This collection remains under revision and may change.", + Use: "events", + Short: `Returns events. This collection remains under revision and may change.`, } cmd.AddCommand( - GetOrganizationEventBuilder(), - GetProjectEventBuilder(), - ListOrganizationEventsBuilder(), - ListProjectEventsBuilder(), + getOrganizationEventBuilder(), + getProjectEventBuilder(), + listOrganizationEventsBuilder(), + listProjectEventsBuilder(), ) return cmd } - diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index a72be93db2..1ba8859c28 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateRoleMappingOpts struct { +type createRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string - + orgId string } -func (opts *CreateRoleMappingOpts) initClient() func() error { +func (opts *createRoleMappingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateRoleMappingOpts) Run(ctx context.Context) error { +func (opts *createRoleMappingOpts) Run(ctx context.Context) error { params := &admin.CreateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, - + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateRoleMappingOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateRoleMappingBuilder() *cobra.Command { +func createRoleMappingBuilder() *cobra.Command { const template = "<>" - opts := CreateRoleMappingOpts{} + opts := createRoleMappingOpts{} cmd := &cobra.Command{ - Use: "createRoleMapping", + Use: "createRoleMapping", Short: "Add One Role Mapping to One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,30 +73,30 @@ func CreateRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } -type DeleteFederationAppOpts struct { + +type deleteFederationAppOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } -func (opts *DeleteFederationAppOpts) initClient() func() error { +func (opts *deleteFederationAppOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteFederationAppOpts) Run(ctx context.Context) error { +func (opts *deleteFederationAppOpts) Run(ctx context.Context) error { params := &admin.DeleteFederationAppApiParams{ FederationSettingsId: opts.federationSettingsId, } @@ -112,15 +108,15 @@ func (opts *DeleteFederationAppOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func DeleteFederationAppBuilder() *cobra.Command { +func deleteFederationAppBuilder() *cobra.Command { const template = "<>" - opts := DeleteFederationAppOpts{} + opts := deleteFederationAppOpts{} cmd := &cobra.Command{ - Use: "deleteFederationApp", + Use: "deleteFederationApp", Short: "Delete the federation settings instance.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -132,33 +128,34 @@ func DeleteFederationAppBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } -type DeleteRoleMappingOpts struct { + +type deleteRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string + id string + orgId string } -func (opts *DeleteRoleMappingOpts) initClient() func() error { +func (opts *deleteRoleMappingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteRoleMappingOpts) Run(ctx context.Context) error { +func (opts *deleteRoleMappingOpts) Run(ctx context.Context) error { params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, + Id: opts.id, + OrgId: opts.orgId, } _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -168,15 +165,15 @@ func (opts *DeleteRoleMappingOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func DeleteRoleMappingBuilder() *cobra.Command { +func deleteRoleMappingBuilder() *cobra.Command { const template = "<>" - opts := DeleteRoleMappingOpts{} + opts := deleteRoleMappingOpts{} cmd := &cobra.Command{ - Use: "deleteRoleMapping", + Use: "deleteRoleMapping", Short: "Remove One Role Mapping from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -188,35 +185,36 @@ func DeleteRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.id, "id", "", "Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") return cmd } -type GetConnectedOrgConfigOpts struct { + +type getConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } -func (opts *GetConnectedOrgConfigOpts) initClient() func() error { +func (opts *getConnectedOrgConfigOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetConnectedOrgConfigOpts) Run(ctx context.Context) error { +func (opts *getConnectedOrgConfigOpts) Run(ctx context.Context) error { params := &admin.GetConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { @@ -226,15 +224,15 @@ func (opts *GetConnectedOrgConfigOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetConnectedOrgConfigBuilder() *cobra.Command { +func getConnectedOrgConfigBuilder() *cobra.Command { const template = "<>" - opts := GetConnectedOrgConfigOpts{} + opts := getConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "getConnectedOrgConfig", + Use: "getConnectedOrgConfig", Short: "Return One Org Config Connected to One Federation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -246,29 +244,30 @@ func GetConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } -type GetFederationSettingsOpts struct { + +type getFederationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } -func (opts *GetFederationSettingsOpts) initClient() func() error { +func (opts *getFederationSettingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetFederationSettingsOpts) Run(ctx context.Context) error { +func (opts *getFederationSettingsOpts) Run(ctx context.Context) error { params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, } @@ -280,15 +279,15 @@ func (opts *GetFederationSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetFederationSettingsBuilder() *cobra.Command { +func getFederationSettingsBuilder() *cobra.Command { const template = "<>" - opts := GetFederationSettingsOpts{} + opts := getFederationSettingsOpts{} cmd := &cobra.Command{ - Use: "getFederationSettings", + Use: "getFederationSettings", Short: "Return Federation Settings for One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -300,31 +299,32 @@ func GetFederationSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type GetIdentityProviderOpts struct { + +type getIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string + identityProviderId string } -func (opts *GetIdentityProviderOpts) initClient() func() error { +func (opts *getIdentityProviderOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetIdentityProviderOpts) Run(ctx context.Context) error { +func (opts *getIdentityProviderOpts) Run(ctx context.Context) error { params := &admin.GetIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, + IdentityProviderId: opts.identityProviderId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params).Execute() if err != nil { @@ -334,15 +334,15 @@ func (opts *GetIdentityProviderOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetIdentityProviderBuilder() *cobra.Command { +func getIdentityProviderBuilder() *cobra.Command { const template = "<>" - opts := GetIdentityProviderOpts{} + opts := getIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "getIdentityProvider", + Use: "getIdentityProvider", Short: "Return one identity provider from the specified federation.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -354,33 +354,34 @@ func GetIdentityProviderBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "Unique 20-hexadecimal digit string that identifies the identity provider.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } -type GetIdentityProviderMetadataOpts struct { + +type getIdentityProviderMetadataOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string + identityProviderId string } -func (opts *GetIdentityProviderMetadataOpts) initClient() func() error { +func (opts *getIdentityProviderMetadataOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetIdentityProviderMetadataOpts) Run(ctx context.Context) error { +func (opts *getIdentityProviderMetadataOpts) Run(ctx context.Context) error { params := &admin.GetIdentityProviderMetadataApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, + IdentityProviderId: opts.identityProviderId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params).Execute() if err != nil { @@ -390,15 +391,15 @@ func (opts *GetIdentityProviderMetadataOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetIdentityProviderMetadataBuilder() *cobra.Command { +func getIdentityProviderMetadataBuilder() *cobra.Command { const template = "<>" - opts := GetIdentityProviderMetadataOpts{} + opts := getIdentityProviderMetadataOpts{} cmd := &cobra.Command{ - Use: "getIdentityProviderMetadata", + Use: "getIdentityProviderMetadata", Short: "Return the metadata of one identity provider in the specified federation.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -410,35 +411,36 @@ func GetIdentityProviderMetadataBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "Unique 20-hexadecimal digit string that identifies the identity provider.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } -type GetRoleMappingOpts struct { + +type getRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string + id string + orgId string } -func (opts *GetRoleMappingOpts) initClient() func() error { +func (opts *getRoleMappingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetRoleMappingOpts) Run(ctx context.Context) error { +func (opts *getRoleMappingOpts) Run(ctx context.Context) error { params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, + Id: opts.id, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -448,15 +450,15 @@ func (opts *GetRoleMappingOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetRoleMappingBuilder() *cobra.Command { +func getRoleMappingBuilder() *cobra.Command { const template = "<>" - opts := GetRoleMappingOpts{} + opts := getRoleMappingOpts{} cmd := &cobra.Command{ - Use: "getRoleMapping", + Use: "getRoleMapping", Short: "Return One Role Mapping from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -468,31 +470,32 @@ func GetRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.id, "id", "", "Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListConnectedOrgConfigsOpts struct { + +type listConnectedOrgConfigsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } -func (opts *ListConnectedOrgConfigsOpts) initClient() func() error { +func (opts *listConnectedOrgConfigsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListConnectedOrgConfigsOpts) Run(ctx context.Context) error { +func (opts *listConnectedOrgConfigsOpts) Run(ctx context.Context) error { params := &admin.ListConnectedOrgConfigsApiParams{ FederationSettingsId: opts.federationSettingsId, } @@ -504,15 +507,15 @@ func (opts *ListConnectedOrgConfigsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListConnectedOrgConfigsBuilder() *cobra.Command { +func listConnectedOrgConfigsBuilder() *cobra.Command { const template = "<>" - opts := ListConnectedOrgConfigsOpts{} + opts := listConnectedOrgConfigsOpts{} cmd := &cobra.Command{ - Use: "listConnectedOrgConfigs", + Use: "listConnectedOrgConfigs", Short: "Return All Connected Org Configs from the Federation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -524,27 +527,28 @@ func ListConnectedOrgConfigsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } -type ListIdentityProvidersOpts struct { + +type listIdentityProvidersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } -func (opts *ListIdentityProvidersOpts) initClient() func() error { +func (opts *listIdentityProvidersOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListIdentityProvidersOpts) Run(ctx context.Context) error { +func (opts *listIdentityProvidersOpts) Run(ctx context.Context) error { params := &admin.ListIdentityProvidersApiParams{ FederationSettingsId: opts.federationSettingsId, } @@ -556,15 +560,15 @@ func (opts *ListIdentityProvidersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListIdentityProvidersBuilder() *cobra.Command { +func listIdentityProvidersBuilder() *cobra.Command { const template = "<>" - opts := ListIdentityProvidersOpts{} + opts := listIdentityProvidersOpts{} cmd := &cobra.Command{ - Use: "listIdentityProviders", + Use: "listIdentityProviders", Short: "Return all identity providers from the specified federation.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -576,31 +580,32 @@ func ListIdentityProvidersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } -type ListRoleMappingsOpts struct { + +type listRoleMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } -func (opts *ListRoleMappingsOpts) initClient() func() error { +func (opts *listRoleMappingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListRoleMappingsOpts) Run(ctx context.Context) error { +func (opts *listRoleMappingsOpts) Run(ctx context.Context) error { params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params).Execute() if err != nil { @@ -610,15 +615,15 @@ func (opts *ListRoleMappingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListRoleMappingsBuilder() *cobra.Command { +func listRoleMappingsBuilder() *cobra.Command { const template = "<>" - opts := ListRoleMappingsOpts{} + opts := listRoleMappingsOpts{} cmd := &cobra.Command{ - Use: "listRoleMappings", + Use: "listRoleMappings", Short: "Return All Role Mappings from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -630,33 +635,34 @@ func ListRoleMappingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } -type RemoveConnectedOrgConfigOpts struct { + +type removeConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } -func (opts *RemoveConnectedOrgConfigOpts) initClient() func() error { +func (opts *removeConnectedOrgConfigOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *RemoveConnectedOrgConfigOpts) Run(ctx context.Context) error { +func (opts *removeConnectedOrgConfigOpts) Run(ctx context.Context) error { params := &admin.RemoveConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { @@ -666,15 +672,15 @@ func (opts *RemoveConnectedOrgConfigOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func RemoveConnectedOrgConfigBuilder() *cobra.Command { +func removeConnectedOrgConfigBuilder() *cobra.Command { const template = "<>" - opts := RemoveConnectedOrgConfigOpts{} + opts := removeConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "removeConnectedOrgConfig", + Use: "removeConnectedOrgConfig", Short: "Remove One Org Config Connected to One Federation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -686,35 +692,34 @@ func RemoveConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.") + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } -type UpdateConnectedOrgConfigOpts struct { + +type updateConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string - + orgId string } -func (opts *UpdateConnectedOrgConfigOpts) initClient() func() error { +func (opts *updateConnectedOrgConfigOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateConnectedOrgConfigOpts) Run(ctx context.Context) error { +func (opts *updateConnectedOrgConfigOpts) Run(ctx context.Context) error { params := &admin.UpdateConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, - + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { @@ -724,15 +729,15 @@ func (opts *UpdateConnectedOrgConfigOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateConnectedOrgConfigBuilder() *cobra.Command { +func updateConnectedOrgConfigBuilder() *cobra.Command { const template = "<>" - opts := UpdateConnectedOrgConfigOpts{} + opts := updateConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "updateConnectedOrgConfig", + Use: "updateConnectedOrgConfig", Short: "Update One Org Config Connected to One Federation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -744,36 +749,34 @@ func UpdateConnectedOrgConfigBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.") - + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } -type UpdateIdentityProviderOpts struct { + +type updateIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string - + identityProviderId string } -func (opts *UpdateIdentityProviderOpts) initClient() func() error { +func (opts *updateIdentityProviderOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateIdentityProviderOpts) Run(ctx context.Context) error { +func (opts *updateIdentityProviderOpts) Run(ctx context.Context) error { params := &admin.UpdateIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, - + IdentityProviderId: opts.identityProviderId, } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params).Execute() if err != nil { @@ -783,15 +786,15 @@ func (opts *UpdateIdentityProviderOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateIdentityProviderBuilder() *cobra.Command { +func updateIdentityProviderBuilder() *cobra.Command { const template = "<>" - opts := UpdateIdentityProviderOpts{} + opts := updateIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "updateIdentityProvider", + Use: "updateIdentityProvider", Short: "Update the identity provider.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -803,38 +806,36 @@ func UpdateIdentityProviderBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", "Unique 20-hexadecimal digit string that identifies the identity provider.") - + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } -type UpdateRoleMappingOpts struct { + +type updateRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string - + id string + orgId string } -func (opts *UpdateRoleMappingOpts) initClient() func() error { +func (opts *updateRoleMappingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateRoleMappingOpts) Run(ctx context.Context) error { +func (opts *updateRoleMappingOpts) Run(ctx context.Context) error { params := &admin.UpdateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, - + Id: opts.id, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -844,15 +845,15 @@ func (opts *UpdateRoleMappingOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateRoleMappingBuilder() *cobra.Command { +func updateRoleMappingBuilder() *cobra.Command { const template = "<>" - opts := UpdateRoleMappingOpts{} + opts := updateRoleMappingOpts{} cmd := &cobra.Command{ - Use: "updateRoleMapping", + Use: "updateRoleMapping", Short: "Update One Role Mapping in One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -864,10 +865,9 @@ func UpdateRoleMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", "Unique 24-hexadecimal digit string that identifies your federation.") - cmd.Flags().StringVar(&opts.id, "id", "", "Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") @@ -875,28 +875,27 @@ func UpdateRoleMappingBuilder() *cobra.Command { return cmd } -func FederatedAuthenticationBuilder() *cobra.Command { +func federatedAuthenticationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "federatedAuthentication", - Short: "Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.", + Use: "federatedAuthentication", + Short: `Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.`, } cmd.AddCommand( - CreateRoleMappingBuilder(), - DeleteFederationAppBuilder(), - DeleteRoleMappingBuilder(), - GetConnectedOrgConfigBuilder(), - GetFederationSettingsBuilder(), - GetIdentityProviderBuilder(), - GetIdentityProviderMetadataBuilder(), - GetRoleMappingBuilder(), - ListConnectedOrgConfigsBuilder(), - ListIdentityProvidersBuilder(), - ListRoleMappingsBuilder(), - RemoveConnectedOrgConfigBuilder(), - UpdateConnectedOrgConfigBuilder(), - UpdateIdentityProviderBuilder(), - UpdateRoleMappingBuilder(), + createRoleMappingBuilder(), + deleteFederationAppBuilder(), + deleteRoleMappingBuilder(), + getConnectedOrgConfigBuilder(), + getFederationSettingsBuilder(), + getIdentityProviderBuilder(), + getIdentityProviderMetadataBuilder(), + getRoleMappingBuilder(), + listConnectedOrgConfigsBuilder(), + listIdentityProvidersBuilder(), + listRoleMappingsBuilder(), + removeConnectedOrgConfigBuilder(), + updateConnectedOrgConfigBuilder(), + updateIdentityProviderBuilder(), + updateRoleMappingBuilder(), ) return cmd } - diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index 114235a8cd..54ccaa18a1 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateCustomZoneMappingOpts struct { +type createCustomZoneMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateCustomZoneMappingOpts) initClient() func() error { +func (opts *createCustomZoneMappingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateCustomZoneMappingOpts) Run(ctx context.Context) error { +func (opts *createCustomZoneMappingOpts) Run(ctx context.Context) error { params := &admin.CreateCustomZoneMappingApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateCustomZoneMappingOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateCustomZoneMappingBuilder() *cobra.Command { +func createCustomZoneMappingBuilder() *cobra.Command { const template = "<>" - opts := CreateCustomZoneMappingOpts{} + opts := createCustomZoneMappingOpts{} cmd := &cobra.Command{ - Use: "createCustomZoneMapping", + Use: "createCustomZoneMapping", Short: "Add One Entry to One Custom Zone Mapping", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,36 +73,36 @@ func CreateCustomZoneMappingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type CreateManagedNamespaceOpts struct { + +type createManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateManagedNamespaceOpts) initClient() func() error { +func (opts *createManagedNamespaceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateManagedNamespaceOpts) Run(ctx context.Context) error { +func (opts *createManagedNamespaceOpts) Run(ctx context.Context) error { params := &admin.CreateManagedNamespaceApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params).Execute() if err != nil { @@ -116,15 +112,15 @@ func (opts *CreateManagedNamespaceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateManagedNamespaceBuilder() *cobra.Command { +func createManagedNamespaceBuilder() *cobra.Command { const template = "<>" - opts := CreateManagedNamespaceOpts{} + opts := createManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "createManagedNamespace", + Use: "createManagedNamespace", Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,33 +132,35 @@ func CreateManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type DeleteAllCustomZoneMappingsOpts struct { + +type deleteAllCustomZoneMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *DeleteAllCustomZoneMappingsOpts) initClient() func() error { +func (opts *deleteAllCustomZoneMappingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { +func (opts *deleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { params := &admin.DeleteAllCustomZoneMappingsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params).Execute() @@ -173,15 +171,15 @@ func (opts *DeleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { +func deleteAllCustomZoneMappingsBuilder() *cobra.Command { const template = "<>" - opts := DeleteAllCustomZoneMappingsOpts{} + opts := deleteAllCustomZoneMappingsOpts{} cmd := &cobra.Command{ - Use: "deleteAllCustomZoneMappings", + Use: "deleteAllCustomZoneMappings", Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -193,37 +191,40 @@ func DeleteAllCustomZoneMappingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type DeleteManagedNamespaceOpts struct { + +type deleteManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient clusterName string - groupId string - db string - collection string + groupId string + db string + collection string } -func (opts *DeleteManagedNamespaceOpts) initClient() func() error { +func (opts *deleteManagedNamespaceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteManagedNamespaceOpts) Run(ctx context.Context) error { +func (opts *deleteManagedNamespaceOpts) Run(ctx context.Context) error { params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, - GroupId: opts.groupId, - Db: &opts.db, - Collection: &opts.collection, + GroupId: opts.groupId, + Db: &opts.db, + Collection: &opts.collection, } resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params).Execute() if err != nil { @@ -233,15 +234,15 @@ func (opts *DeleteManagedNamespaceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteManagedNamespaceBuilder() *cobra.Command { +func deleteManagedNamespaceBuilder() *cobra.Command { const template = "<>" - opts := DeleteManagedNamespaceOpts{} + opts := deleteManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "deleteManagedNamespace", + Use: "deleteManagedNamespace", Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -253,34 +254,37 @@ func DeleteManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.db, "db", "", "Human-readable label that identifies the database that contains the collection.") - cmd.Flags().StringVar(&opts.collection, "collection", "", "Human-readable label that identifies the collection associated with the managed namespace.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label that identifies the database that contains the collection.`) + cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetManagedNamespaceOpts struct { + +type getManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *GetManagedNamespaceOpts) initClient() func() error { +func (opts *getManagedNamespaceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetManagedNamespaceOpts) Run(ctx context.Context) error { +func (opts *getManagedNamespaceOpts) Run(ctx context.Context) error { params := &admin.GetManagedNamespaceApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params).Execute() @@ -291,15 +295,15 @@ func (opts *GetManagedNamespaceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetManagedNamespaceBuilder() *cobra.Command { +func getManagedNamespaceBuilder() *cobra.Command { const template = "<>" - opts := GetManagedNamespaceOpts{} + opts := getManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "getManagedNamespace", + Use: "getManagedNamespace", Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -311,27 +315,28 @@ func GetManagedNamespaceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -func GlobalClustersBuilder() *cobra.Command { +func globalClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "globalClusters", - Short: "Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. -MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster.", + Use: "globalClusters", + Short: `Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. +MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster.`, } cmd.AddCommand( - CreateCustomZoneMappingBuilder(), - CreateManagedNamespaceBuilder(), - DeleteAllCustomZoneMappingsBuilder(), - DeleteManagedNamespaceBuilder(), - GetManagedNamespaceBuilder(), + createCustomZoneMappingBuilder(), + createManagedNamespaceBuilder(), + deleteAllCustomZoneMappingsBuilder(), + deleteManagedNamespaceBuilder(), + getManagedNamespaceBuilder(), ) return cmd } - diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index 53dd9e4484..c2b19ae7f0 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -18,33 +18,31 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type DownloadInvoiceCSVOpts struct { +type downloadInvoiceCSVOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invoiceId string } -func (opts *DownloadInvoiceCSVOpts) initClient() func() error { +func (opts *downloadInvoiceCSVOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DownloadInvoiceCSVOpts) Run(ctx context.Context) error { +func (opts *downloadInvoiceCSVOpts) Run(ctx context.Context) error { params := &admin.DownloadInvoiceCSVApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvoiceId: opts.invoiceId, } _, err := opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params).Execute() @@ -55,15 +53,15 @@ func (opts *DownloadInvoiceCSVOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func DownloadInvoiceCSVBuilder() *cobra.Command { +func downloadInvoiceCSVBuilder() *cobra.Command { const template = "<>" - opts := DownloadInvoiceCSVOpts{} + opts := downloadInvoiceCSVOpts{} cmd := &cobra.Command{ - Use: "downloadInvoiceCSV", + Use: "downloadInvoiceCSV", Short: "Return One Organization Invoice as CSV", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,32 +73,33 @@ func DownloadInvoiceCSVBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") return cmd } -type GetInvoiceOpts struct { + +type getInvoiceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invoiceId string } -func (opts *GetInvoiceOpts) initClient() func() error { +func (opts *getInvoiceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetInvoiceOpts) Run(ctx context.Context) error { +func (opts *getInvoiceOpts) Run(ctx context.Context) error { params := &admin.GetInvoiceApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvoiceId: opts.invoiceId, } resp, _, err := opts.client.InvoicesApi.GetInvoiceWithParams(ctx, params).Execute() @@ -111,15 +110,15 @@ func (opts *GetInvoiceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetInvoiceBuilder() *cobra.Command { +func getInvoiceBuilder() *cobra.Command { const template = "<>" - opts := GetInvoiceOpts{} + opts := getInvoiceOpts{} cmd := &cobra.Command{ - Use: "getInvoice", + Use: "getInvoice", Short: "Return One Organization Invoice", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -131,37 +130,38 @@ func GetInvoiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", "Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") return cmd } -type ListInvoicesOpts struct { + +type listInvoicesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListInvoicesOpts) initClient() func() error { +func (opts *listInvoicesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListInvoicesOpts) Run(ctx context.Context) error { +func (opts *listInvoicesOpts) Run(ctx context.Context) error { params := &admin.ListInvoicesApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.InvoicesApi.ListInvoicesWithParams(ctx, params).Execute() if err != nil { @@ -171,15 +171,15 @@ func (opts *ListInvoicesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListInvoicesBuilder() *cobra.Command { +func listInvoicesBuilder() *cobra.Command { const template = "<>" - opts := ListInvoicesOpts{} + opts := listInvoicesOpts{} cmd := &cobra.Command{ - Use: "listInvoices", + Use: "listInvoices", Short: "Return All Invoices for One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -191,30 +191,31 @@ func ListInvoicesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListPendingInvoicesOpts struct { + +type listPendingInvoicesOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } -func (opts *ListPendingInvoicesOpts) initClient() func() error { +func (opts *listPendingInvoicesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPendingInvoicesOpts) Run(ctx context.Context) error { +func (opts *listPendingInvoicesOpts) Run(ctx context.Context) error { params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, } @@ -226,15 +227,15 @@ func (opts *ListPendingInvoicesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListPendingInvoicesBuilder() *cobra.Command { +func listPendingInvoicesBuilder() *cobra.Command { const template = "<>" - opts := ListPendingInvoicesOpts{} + opts := listPendingInvoicesOpts{} cmd := &cobra.Command{ - Use: "listPendingInvoices", + Use: "listPendingInvoices", Short: "Return All Pending Invoices for One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -246,23 +247,22 @@ func ListPendingInvoicesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -func InvoicesBuilder() *cobra.Command { +func invoicesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "invoices", - Short: "Returns invoices.", + Use: "invoices", + Short: `Returns invoices.`, } cmd.AddCommand( - DownloadInvoiceCSVBuilder(), - GetInvoiceBuilder(), - ListInvoicesBuilder(), - ListPendingInvoicesBuilder(), + downloadInvoiceCSVBuilder(), + getInvoiceBuilder(), + listInvoicesBuilder(), + listPendingInvoicesBuilder(), ) return cmd } - diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 46bc190713..2b7e45df2e 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -18,30 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type DeleteLDAPConfigurationOpts struct { +type deleteLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *DeleteLDAPConfigurationOpts) initClient() func() error { +func (opts *deleteLDAPConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteLDAPConfigurationOpts) Run(ctx context.Context) error { +func (opts *deleteLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, } @@ -53,15 +51,15 @@ func (opts *DeleteLDAPConfigurationOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func DeleteLDAPConfigurationBuilder() *cobra.Command { +func deleteLDAPConfigurationBuilder() *cobra.Command { const template = "<>" - opts := DeleteLDAPConfigurationOpts{} + opts := deleteLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "deleteLDAPConfiguration", + Use: "deleteLDAPConfiguration", Short: "Remove the Current LDAP User to DN Mapping", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,27 +71,30 @@ func DeleteLDAPConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetLDAPConfigurationOpts struct { + +type getLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetLDAPConfigurationOpts) initClient() func() error { +func (opts *getLDAPConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetLDAPConfigurationOpts) Run(ctx context.Context) error { +func (opts *getLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, } @@ -105,15 +106,15 @@ func (opts *GetLDAPConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetLDAPConfigurationBuilder() *cobra.Command { +func getLDAPConfigurationBuilder() *cobra.Command { const template = "<>" - opts := GetLDAPConfigurationOpts{} + opts := getLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "getLDAPConfiguration", + Use: "getLDAPConfiguration", Short: "Return the Current LDAP or X.509 Configuration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -125,30 +126,33 @@ func GetLDAPConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetLDAPConfigurationStatusOpts struct { + +type getLDAPConfigurationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string requestId string } -func (opts *GetLDAPConfigurationStatusOpts) initClient() func() error { +func (opts *getLDAPConfigurationStatusOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetLDAPConfigurationStatusOpts) Run(ctx context.Context) error { +func (opts *getLDAPConfigurationStatusOpts) Run(ctx context.Context) error { params := &admin.GetLDAPConfigurationStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, RequestId: opts.requestId, } resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params).Execute() @@ -159,15 +163,15 @@ func (opts *GetLDAPConfigurationStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetLDAPConfigurationStatusBuilder() *cobra.Command { +func getLDAPConfigurationStatusBuilder() *cobra.Command { const template = "<>" - opts := GetLDAPConfigurationStatusOpts{} + opts := getLDAPConfigurationStatusOpts{} cmd := &cobra.Command{ - Use: "getLDAPConfigurationStatus", + Use: "getLDAPConfigurationStatus", Short: "Return the Status of One Verify LDAP Configuration Request", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -179,33 +183,34 @@ func GetLDAPConfigurationStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.requestId, "requestId", "", "Unique string that identifies the request to verify an <abbr title=\"Lightweight Directory Access Protocol\">LDAP</abbr> configuration.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("requestId") return cmd } -type SaveLDAPConfigurationOpts struct { + +type saveLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *SaveLDAPConfigurationOpts) initClient() func() error { +func (opts *saveLDAPConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *SaveLDAPConfigurationOpts) Run(ctx context.Context) error { +func (opts *saveLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -215,15 +220,15 @@ func (opts *SaveLDAPConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func SaveLDAPConfigurationBuilder() *cobra.Command { +func saveLDAPConfigurationBuilder() *cobra.Command { const template = "<>" - opts := SaveLDAPConfigurationOpts{} + opts := saveLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "saveLDAPConfiguration", + Use: "saveLDAPConfiguration", Short: "Edit the LDAP or X.509 Configuration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -235,32 +240,32 @@ func SaveLDAPConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type VerifyLDAPConfigurationOpts struct { + +type verifyLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *VerifyLDAPConfigurationOpts) initClient() func() error { +func (opts *verifyLDAPConfigurationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *VerifyLDAPConfigurationOpts) Run(ctx context.Context) error { +func (opts *verifyLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -270,15 +275,15 @@ func (opts *VerifyLDAPConfigurationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func VerifyLDAPConfigurationBuilder() *cobra.Command { +func verifyLDAPConfigurationBuilder() *cobra.Command { const template = "<>" - opts := VerifyLDAPConfigurationOpts{} + opts := verifyLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "verifyLDAPConfiguration", + Use: "verifyLDAPConfiguration", Short: "Verify the LDAP Configuration in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -290,25 +295,25 @@ func VerifyLDAPConfigurationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func LDAPConfigurationBuilder() *cobra.Command { +func lDAPConfigurationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "lDAPConfiguration", - Short: "Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.", + Use: "lDAPConfiguration", + Short: `Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.`, } cmd.AddCommand( - DeleteLDAPConfigurationBuilder(), - GetLDAPConfigurationBuilder(), - GetLDAPConfigurationStatusBuilder(), - SaveLDAPConfigurationBuilder(), - VerifyLDAPConfigurationBuilder(), + deleteLDAPConfigurationBuilder(), + getLDAPConfigurationBuilder(), + getLDAPConfigurationStatusBuilder(), + saveLDAPConfigurationBuilder(), + verifyLDAPConfigurationBuilder(), ) return cmd } - diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index 57487aa593..f121f5e8d3 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -18,36 +18,34 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type DeleteLegacySnapshotOpts struct { +type deleteLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } -func (opts *DeleteLegacySnapshotOpts) initClient() func() error { +func (opts *deleteLegacySnapshotOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteLegacySnapshotOpts) Run(ctx context.Context) error { +func (opts *deleteLegacySnapshotOpts) Run(ctx context.Context) error { params := &admin.DeleteLegacySnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +55,15 @@ func (opts *DeleteLegacySnapshotOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteLegacySnapshotBuilder() *cobra.Command { +func deleteLegacySnapshotBuilder() *cobra.Command { const template = "<>" - opts := DeleteLegacySnapshotOpts{} + opts := deleteLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "deleteLegacySnapshot", + Use: "deleteLegacySnapshot", Short: "Remove One Legacy Backup Snapshot", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,37 +75,40 @@ func DeleteLegacySnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type GetLegacyBackupCheckpointOpts struct { + +type getLegacyBackupCheckpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string checkpointId string - clusterName string + clusterName string } -func (opts *GetLegacyBackupCheckpointOpts) initClient() func() error { +func (opts *getLegacyBackupCheckpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetLegacyBackupCheckpointOpts) Run(ctx context.Context) error { +func (opts *getLegacyBackupCheckpointOpts) Run(ctx context.Context) error { params := &admin.GetLegacyBackupCheckpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, CheckpointId: opts.checkpointId, - ClusterName: opts.clusterName, + ClusterName: opts.clusterName, } resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params).Execute() if err != nil { @@ -117,15 +118,15 @@ func (opts *GetLegacyBackupCheckpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetLegacyBackupCheckpointBuilder() *cobra.Command { +func getLegacyBackupCheckpointBuilder() *cobra.Command { const template = "<>" - opts := GetLegacyBackupCheckpointOpts{} + opts := getLegacyBackupCheckpointOpts{} cmd := &cobra.Command{ - Use: "getLegacyBackupCheckpoint", + Use: "getLegacyBackupCheckpoint", Short: "Return One Legacy Backup Checkpoint", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -137,37 +138,40 @@ func GetLegacyBackupCheckpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", "Unique 24-hexadecimal digit string that identifies the checkpoint.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the checkpoint.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("checkpointId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type GetLegacyBackupRestoreJobOpts struct { + +type getLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - jobId string + jobId string } -func (opts *GetLegacyBackupRestoreJobOpts) initClient() func() error { +func (opts *getLegacyBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *getLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.GetLegacyBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - JobId: opts.jobId, + JobId: opts.jobId, } resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -177,15 +181,15 @@ func (opts *GetLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetLegacyBackupRestoreJobBuilder() *cobra.Command { +func getLegacyBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := GetLegacyBackupRestoreJobOpts{} + opts := getLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getLegacyBackupRestoreJob", + Use: "getLegacyBackupRestoreJob", Short: "Return One Legacy Backup Restore Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -197,37 +201,40 @@ func GetLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") - cmd.Flags().StringVar(&opts.jobId, "jobId", "", "Unique 24-hexadecimal digit string that identifies the restore job.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + cmd.Flags().StringVar(&opts.jobId, "jobId", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("jobId") return cmd } -type GetLegacySnapshotOpts struct { + +type getLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } -func (opts *GetLegacySnapshotOpts) initClient() func() error { +func (opts *getLegacySnapshotOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetLegacySnapshotOpts) Run(ctx context.Context) error { +func (opts *getLegacySnapshotOpts) Run(ctx context.Context) error { params := &admin.GetLegacySnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params).Execute() if err != nil { @@ -237,15 +244,15 @@ func (opts *GetLegacySnapshotOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetLegacySnapshotBuilder() *cobra.Command { +func getLegacySnapshotBuilder() *cobra.Command { const template = "<>" - opts := GetLegacySnapshotOpts{} + opts := getLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "getLegacySnapshot", + Use: "getLegacySnapshot", Short: "Return One Legacy Backup Snapshot", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -257,34 +264,37 @@ func GetLegacySnapshotBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type GetLegacySnapshotScheduleOpts struct { + +type getLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *GetLegacySnapshotScheduleOpts) initClient() func() error { +func (opts *getLegacySnapshotScheduleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetLegacySnapshotScheduleOpts) Run(ctx context.Context) error { +func (opts *getLegacySnapshotScheduleOpts) Run(ctx context.Context) error { params := &admin.GetLegacySnapshotScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params).Execute() @@ -295,15 +305,15 @@ func (opts *GetLegacySnapshotScheduleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetLegacySnapshotScheduleBuilder() *cobra.Command { +func getLegacySnapshotScheduleBuilder() *cobra.Command { const template = "<>" - opts := GetLegacySnapshotScheduleOpts{} + opts := getLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "getLegacySnapshotSchedule", + Use: "getLegacySnapshotSchedule", Short: "Return One Snapshot Schedule", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -315,39 +325,42 @@ func GetLegacySnapshotScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListLegacyBackupCheckpointsOpts struct { + +type listLegacyBackupCheckpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListLegacyBackupCheckpointsOpts) initClient() func() error { +func (opts *listLegacyBackupCheckpointsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { +func (opts *listLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { params := &admin.ListLegacyBackupCheckpointsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params).Execute() if err != nil { @@ -357,15 +370,15 @@ func (opts *ListLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListLegacyBackupCheckpointsBuilder() *cobra.Command { +func listLegacyBackupCheckpointsBuilder() *cobra.Command { const template = "<>" - opts := ListLegacyBackupCheckpointsOpts{} + opts := listLegacyBackupCheckpointsOpts{} cmd := &cobra.Command{ - Use: "listLegacyBackupCheckpoints", + Use: "listLegacyBackupCheckpoints", Short: "Return All Legacy Backup Checkpoints", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -377,44 +390,47 @@ func ListLegacyBackupCheckpointsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the checkpoints that you want to return.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListLegacyBackupRestoreJobsOpts struct { + +type listLegacyBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int - batchId string + pageNum int + batchId string } -func (opts *ListLegacyBackupRestoreJobsOpts) initClient() func() error { +func (opts *listLegacyBackupRestoreJobsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { +func (opts *listLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListLegacyBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - BatchId: &opts.batchId, + PageNum: &opts.pageNum, + BatchId: &opts.batchId, } resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -424,15 +440,15 @@ func (opts *ListLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { +func listLegacyBackupRestoreJobsBuilder() *cobra.Command { const template = "<>" - opts := ListLegacyBackupRestoreJobsOpts{} + opts := listLegacyBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listLegacyBackupRestoreJobs", + Use: "listLegacyBackupRestoreJobs", Short: "Return All Legacy Backup Restore Jobs", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -444,45 +460,48 @@ func ListLegacyBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.batchId, "batchId", "", "Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListLegacySnapshotsOpts struct { + +type listLegacySnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int - completed string + pageNum int + completed string } -func (opts *ListLegacySnapshotsOpts) initClient() func() error { +func (opts *listLegacySnapshotsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListLegacySnapshotsOpts) Run(ctx context.Context) error { +func (opts *listLegacySnapshotsOpts) Run(ctx context.Context) error { params := &admin.ListLegacySnapshotsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Completed: &opts.completed, + PageNum: &opts.pageNum, + Completed: &opts.completed, } resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params).Execute() if err != nil { @@ -492,15 +511,15 @@ func (opts *ListLegacySnapshotsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListLegacySnapshotsBuilder() *cobra.Command { +func listLegacySnapshotsBuilder() *cobra.Command { const template = "<>" - opts := ListLegacySnapshotsOpts{} + opts := listLegacySnapshotsOpts{} cmd := &cobra.Command{ - Use: "listLegacySnapshots", + Use: "listLegacySnapshots", Short: "Return All Legacy Backup Snapshots", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -512,41 +531,42 @@ func ListLegacySnapshotsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.completed, "completed", ""true"", "Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.completed, "completed", ""true"", `Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type UpdateLegacySnapshotRetentionOpts struct { + +type updateLegacySnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string - + snapshotId string } -func (opts *UpdateLegacySnapshotRetentionOpts) initClient() func() error { +func (opts *updateLegacySnapshotRetentionOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { +func (opts *updateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { params := &admin.UpdateLegacySnapshotRetentionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, - + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() if err != nil { @@ -556,15 +576,15 @@ func (opts *UpdateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { +func updateLegacySnapshotRetentionBuilder() *cobra.Command { const template = "<>" - opts := UpdateLegacySnapshotRetentionOpts{} + opts := updateLegacySnapshotRetentionOpts{} cmd := &cobra.Command{ - Use: "updateLegacySnapshotRetention", + Use: "updateLegacySnapshotRetention", Short: "Change One Legacy Backup Snapshot Expiration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -576,38 +596,38 @@ func UpdateLegacySnapshotRetentionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type UpdateLegacySnapshotScheduleOpts struct { + +type updateLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *UpdateLegacySnapshotScheduleOpts) initClient() func() error { +func (opts *updateLegacySnapshotScheduleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { +func (opts *updateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { params := &admin.UpdateLegacySnapshotScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { @@ -617,15 +637,15 @@ func (opts *UpdateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { +func updateLegacySnapshotScheduleBuilder() *cobra.Command { const template = "<>" - opts := UpdateLegacySnapshotScheduleOpts{} + opts := updateLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "updateLegacySnapshotSchedule", + Use: "updateLegacySnapshotSchedule", Short: "Update Snapshot Schedule for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -637,32 +657,32 @@ func UpdateLegacySnapshotScheduleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -func LegacyBackupBuilder() *cobra.Command { +func legacyBackupBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "legacyBackup", - Short: "Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.", + Use: "legacyBackup", + Short: `Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.`, } cmd.AddCommand( - DeleteLegacySnapshotBuilder(), - GetLegacyBackupCheckpointBuilder(), - GetLegacyBackupRestoreJobBuilder(), - GetLegacySnapshotBuilder(), - GetLegacySnapshotScheduleBuilder(), - ListLegacyBackupCheckpointsBuilder(), - ListLegacyBackupRestoreJobsBuilder(), - ListLegacySnapshotsBuilder(), - UpdateLegacySnapshotRetentionBuilder(), - UpdateLegacySnapshotScheduleBuilder(), + deleteLegacySnapshotBuilder(), + getLegacyBackupCheckpointBuilder(), + getLegacyBackupRestoreJobBuilder(), + getLegacySnapshotBuilder(), + getLegacySnapshotScheduleBuilder(), + listLegacyBackupCheckpointsBuilder(), + listLegacyBackupRestoreJobsBuilder(), + listLegacySnapshotsBuilder(), + updateLegacySnapshotRetentionBuilder(), + updateLegacySnapshotScheduleBuilder(), ) return cmd } - diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index e8ffa021f2..4ebe32ca18 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateLegacyBackupRestoreJobOpts struct { +type createLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateLegacyBackupRestoreJobOpts) initClient() func() error { +func (opts *createLegacyBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *createLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateLegacyBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { +func createLegacyBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := CreateLegacyBackupRestoreJobOpts{} + opts := createLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createLegacyBackupRestoreJob", + Use: "createLegacyBackupRestoreJob", Short: "Create One Legacy Backup Restore Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,23 +73,23 @@ func CreateLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster with the snapshot you want to return.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -func LegacyBackupRestoreJobsBuilder() *cobra.Command { +func legacyBackupRestoreJobsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "legacyBackupRestoreJobs", - Short: "", + Use: "legacyBackupRestoreJobs", + Short: ``, } cmd.AddCommand( - CreateLegacyBackupRestoreJobBuilder(), + createLegacyBackupRestoreJobBuilder(), ) return cmd } - diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index 31478fe202..ee1fc3d798 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -18,30 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type DeferMaintenanceWindowOpts struct { +type deferMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *DeferMaintenanceWindowOpts) initClient() func() error { +func (opts *deferMaintenanceWindowOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeferMaintenanceWindowOpts) Run(ctx context.Context) error { +func (opts *deferMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, } @@ -53,15 +51,15 @@ func (opts *DeferMaintenanceWindowOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func DeferMaintenanceWindowBuilder() *cobra.Command { +func deferMaintenanceWindowBuilder() *cobra.Command { const template = "<>" - opts := DeferMaintenanceWindowOpts{} + opts := deferMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "deferMaintenanceWindow", + Use: "deferMaintenanceWindow", Short: "Defer One Maintenance Window for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,27 +71,30 @@ func DeferMaintenanceWindowBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetMaintenanceWindowOpts struct { + +type getMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetMaintenanceWindowOpts) initClient() func() error { +func (opts *getMaintenanceWindowOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetMaintenanceWindowOpts) Run(ctx context.Context) error { +func (opts *getMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, } @@ -105,15 +106,15 @@ func (opts *GetMaintenanceWindowOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetMaintenanceWindowBuilder() *cobra.Command { +func getMaintenanceWindowBuilder() *cobra.Command { const template = "<>" - opts := GetMaintenanceWindowOpts{} + opts := getMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "getMaintenanceWindow", + Use: "getMaintenanceWindow", Short: "Return One Maintenance Window for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -125,27 +126,30 @@ func GetMaintenanceWindowBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ResetMaintenanceWindowOpts struct { + +type resetMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *ResetMaintenanceWindowOpts) initClient() func() error { +func (opts *resetMaintenanceWindowOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ResetMaintenanceWindowOpts) Run(ctx context.Context) error { +func (opts *resetMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, } @@ -157,15 +161,15 @@ func (opts *ResetMaintenanceWindowOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ResetMaintenanceWindowBuilder() *cobra.Command { +func resetMaintenanceWindowBuilder() *cobra.Command { const template = "<>" - opts := ResetMaintenanceWindowOpts{} + opts := resetMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "resetMaintenanceWindow", + Use: "resetMaintenanceWindow", Short: "Reset One Maintenance Window for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -177,27 +181,30 @@ func ResetMaintenanceWindowBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ToggleMaintenanceAutoDeferOpts struct { + +type toggleMaintenanceAutoDeferOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *ToggleMaintenanceAutoDeferOpts) initClient() func() error { +func (opts *toggleMaintenanceAutoDeferOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ToggleMaintenanceAutoDeferOpts) Run(ctx context.Context) error { +func (opts *toggleMaintenanceAutoDeferOpts) Run(ctx context.Context) error { params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, } @@ -209,15 +216,15 @@ func (opts *ToggleMaintenanceAutoDeferOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { +func toggleMaintenanceAutoDeferBuilder() *cobra.Command { const template = "<>" - opts := ToggleMaintenanceAutoDeferOpts{} + opts := toggleMaintenanceAutoDeferOpts{} cmd := &cobra.Command{ - Use: "toggleMaintenanceAutoDefer", + Use: "toggleMaintenanceAutoDefer", Short: "Toggle Automatic Deferral of Maintenance for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -229,31 +236,32 @@ func ToggleMaintenanceAutoDeferBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateMaintenanceWindowOpts struct { + +type updateMaintenanceWindowOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpdateMaintenanceWindowOpts) initClient() func() error { +func (opts *updateMaintenanceWindowOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateMaintenanceWindowOpts) Run(ctx context.Context) error { +func (opts *updateMaintenanceWindowOpts) Run(ctx context.Context) error { params := &admin.UpdateMaintenanceWindowApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { @@ -263,15 +271,15 @@ func (opts *UpdateMaintenanceWindowOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateMaintenanceWindowBuilder() *cobra.Command { +func updateMaintenanceWindowBuilder() *cobra.Command { const template = "<>" - opts := UpdateMaintenanceWindowOpts{} + opts := updateMaintenanceWindowOpts{} cmd := &cobra.Command{ - Use: "updateMaintenanceWindow", + Use: "updateMaintenanceWindow", Short: "Update Maintenance Window for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -283,25 +291,25 @@ func UpdateMaintenanceWindowBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func MaintenanceWindowsBuilder() *cobra.Command { +func maintenanceWindowsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "maintenanceWindows", - Short: "Returns, edits, and removes maintenance windows. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. You can defer a scheduled maintenance event for a project up to two times. Deferred maintenance events occur during your preferred maintenance window exactly one week after the previously scheduled date and time.", + Use: "maintenanceWindows", + Short: `Returns, edits, and removes maintenance windows. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. You can defer a scheduled maintenance event for a project up to two times. Deferred maintenance events occur during your preferred maintenance window exactly one week after the previously scheduled date and time.`, } cmd.AddCommand( - DeferMaintenanceWindowBuilder(), - GetMaintenanceWindowBuilder(), - ResetMaintenanceWindowBuilder(), - ToggleMaintenanceAutoDeferBuilder(), - UpdateMaintenanceWindowBuilder(), + deferMaintenanceWindowBuilder(), + getMaintenanceWindowBuilder(), + resetMaintenanceWindowBuilder(), + toggleMaintenanceAutoDeferBuilder(), + updateMaintenanceWindowBuilder(), ) return cmd } - diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index e599174d3d..d9cf6842bd 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -18,33 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateUserOpts struct { +type createUserOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - } -func (opts *CreateUserOpts) initClient() func() error { +func (opts *createUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateUserOpts) Run(ctx context.Context) error { - params := &admin.CreateUserApiParams{ - - } +func (opts *createUserOpts) Run(ctx context.Context) error { + params := &admin.CreateUserApiParams{} resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params).Execute() if err != nil { return err @@ -53,15 +48,15 @@ func (opts *CreateUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateUserBuilder() *cobra.Command { +func createUserBuilder() *cobra.Command { const template = "<>" - opts := CreateUserOpts{} + opts := createUserOpts{} cmd := &cobra.Command{ - Use: "createUser", + Use: "createUser", Short: "Create One MongoDB Cloud User", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,26 +68,26 @@ func CreateUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - return cmd } -type GetUserOpts struct { + +type getUserOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient userId string } -func (opts *GetUserOpts) initClient() func() error { +func (opts *getUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetUserOpts) Run(ctx context.Context) error { +func (opts *getUserOpts) Run(ctx context.Context) error { params := &admin.GetUserApiParams{ UserId: opts.userId, } @@ -104,15 +99,15 @@ func (opts *GetUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetUserBuilder() *cobra.Command { +func getUserBuilder() *cobra.Command { const template = "<>" - opts := GetUserOpts{} + opts := getUserOpts{} cmd := &cobra.Command{ - Use: "getUser", + Use: "getUser", Short: "Return One MongoDB Cloud User using Its ID", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -124,27 +119,28 @@ func GetUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.userId, "userId", "", "Unique 24-hexadecimal digit string that identifies this user.") + cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies this user.`) _ = cmd.MarkFlagRequired("userId") return cmd } -type GetUserByUsernameOpts struct { + +type getUserByUsernameOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient userName string } -func (opts *GetUserByUsernameOpts) initClient() func() error { +func (opts *getUserByUsernameOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetUserByUsernameOpts) Run(ctx context.Context) error { +func (opts *getUserByUsernameOpts) Run(ctx context.Context) error { params := &admin.GetUserByUsernameApiParams{ UserName: opts.userName, } @@ -156,15 +152,15 @@ func (opts *GetUserByUsernameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetUserByUsernameBuilder() *cobra.Command { +func getUserByUsernameBuilder() *cobra.Command { const template = "<>" - opts := GetUserByUsernameOpts{} + opts := getUserByUsernameOpts{} cmd := &cobra.Command{ - Use: "getUserByUsername", + Use: "getUserByUsername", Short: "Return One MongoDB Cloud User using Their Username", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -176,22 +172,21 @@ func GetUserByUsernameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.userName, "userName", "", "Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.") + cmd.Flags().StringVar(&opts.userName, "userName", "", `Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.`) _ = cmd.MarkFlagRequired("userName") return cmd } -func MongoDBCloudUsersBuilder() *cobra.Command { +func mongoDBCloudUsersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "mongoDBCloudUsers", - Short: "Returns, adds, and edits MongoDB Cloud users.", + Use: "mongoDBCloudUsers", + Short: `Returns, adds, and edits MongoDB Cloud users.`, } cmd.AddCommand( - CreateUserBuilder(), - GetUserBuilder(), - GetUserByUsernameBuilder(), + createUserBuilder(), + getUserBuilder(), + getUserByUsernameBuilder(), ) return cmd } - diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index ad7977c04b..915d0c6c69 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -18,33 +18,31 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type GetAtlasProcessOpts struct { +type getAtlasProcessOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string processId string } -func (opts *GetAtlasProcessOpts) initClient() func() error { +func (opts *getAtlasProcessOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetAtlasProcessOpts) Run(ctx context.Context) error { +func (opts *getAtlasProcessOpts) Run(ctx context.Context) error { params := &admin.GetAtlasProcessApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ProcessId: opts.processId, } resp, _, err := opts.client.MonitoringAndLogsApi.GetAtlasProcessWithParams(ctx, params).Execute() @@ -55,15 +53,15 @@ func (opts *GetAtlasProcessOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetAtlasProcessBuilder() *cobra.Command { +func getAtlasProcessBuilder() *cobra.Command { const template = "<>" - opts := GetAtlasProcessOpts{} + opts := getAtlasProcessOpts{} cmd := &cobra.Command{ - Use: "getAtlasProcess", + Use: "getAtlasProcess", Short: "Return One MongoDB Process by ID", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,35 +73,38 @@ func GetAtlasProcessBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } -type GetDatabaseOpts struct { + +type getDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string databaseName string - processId string + processId string } -func (opts *GetDatabaseOpts) initClient() func() error { +func (opts *getDatabaseOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetDatabaseOpts) Run(ctx context.Context) error { +func (opts *getDatabaseOpts) Run(ctx context.Context) error { params := &admin.GetDatabaseApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, DatabaseName: opts.databaseName, - ProcessId: opts.processId, + ProcessId: opts.processId, } resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseWithParams(ctx, params).Execute() if err != nil { @@ -113,15 +114,15 @@ func (opts *GetDatabaseOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetDatabaseBuilder() *cobra.Command { +func getDatabaseBuilder() *cobra.Command { const template = "<>" - opts := GetDatabaseOpts{} + opts := getDatabaseOpts{} cmd := &cobra.Command{ - Use: "getDatabase", + Use: "getDatabase", Short: "Return One Database for a MongoDB Process", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -133,47 +134,50 @@ func GetDatabaseBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database that the specified MongoDB process serves.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") return cmd } -type GetDatabaseMeasurementsOpts struct { + +type getDatabaseMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string databaseName string - processId string - granularity string - m []string - period string - start string - end string + processId string + granularity string + m []string + period string + start string + end string } -func (opts *GetDatabaseMeasurementsOpts) initClient() func() error { +func (opts *getDatabaseMeasurementsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetDatabaseMeasurementsOpts) Run(ctx context.Context) error { +func (opts *getDatabaseMeasurementsOpts) Run(ctx context.Context) error { params := &admin.GetDatabaseMeasurementsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, DatabaseName: opts.databaseName, - ProcessId: opts.processId, - Granularity: opts.granularity, - M: &opts.m, - Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + ProcessId: opts.processId, + Granularity: &opts.granularity, + M: &opts.m, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -183,15 +187,15 @@ func (opts *GetDatabaseMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetDatabaseMeasurementsBuilder() *cobra.Command { +func getDatabaseMeasurementsBuilder() *cobra.Command { const template = "<>" - opts := GetDatabaseMeasurementsOpts{} + opts := getDatabaseMeasurementsOpts{} cmd := &cobra.Command{ - Use: "getDatabaseMeasurements", + Use: "getDatabaseMeasurements", Short: "Return Measurements of One Database for One MongoDB Process", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -203,14 +207,16 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database that the specified MongoDB process serves.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") - cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) + cmd.Flags().StringSliceVar(&opts.m, "m", nil, `One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") @@ -218,38 +224,39 @@ func GetDatabaseMeasurementsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("granularity") return cmd } -type GetDiskMeasurementsOpts struct { + +type getDiskMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string partitionName string - processId string - granularity string - m []string - period string - start string - end string + processId string + granularity string + m []string + period string + start string + end string } -func (opts *GetDiskMeasurementsOpts) initClient() func() error { +func (opts *getDiskMeasurementsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetDiskMeasurementsOpts) Run(ctx context.Context) error { +func (opts *getDiskMeasurementsOpts) Run(ctx context.Context) error { params := &admin.GetDiskMeasurementsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PartitionName: opts.partitionName, - ProcessId: opts.processId, - Granularity: opts.granularity, - M: &opts.m, - Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + ProcessId: opts.processId, + Granularity: &opts.granularity, + M: &opts.m, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -259,15 +266,15 @@ func (opts *GetDiskMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetDiskMeasurementsBuilder() *cobra.Command { +func getDiskMeasurementsBuilder() *cobra.Command { const template = "<>" - opts := GetDiskMeasurementsOpts{} + opts := getDiskMeasurementsOpts{} cmd := &cobra.Command{ - Use: "getDiskMeasurements", + Use: "getDiskMeasurements", Short: "Return Measurements of One Disk for One MongoDB Process", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -279,14 +286,16 @@ func GetDiskMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "Human-readable label of the disk or partition to which the measurements apply.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") - cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) + cmd.Flags().StringSliceVar(&opts.m, "m", nil, `One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("partitionName") @@ -294,31 +303,32 @@ func GetDiskMeasurementsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("granularity") return cmd } -type GetHostLogsOpts struct { + +type getHostLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - hostName string - logName string - endDate int64 + client *admin.APIClient + groupId string + hostName string + logName string + endDate int64 startDate int64 } -func (opts *GetHostLogsOpts) initClient() func() error { +func (opts *getHostLogsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetHostLogsOpts) Run(ctx context.Context) error { +func (opts *getHostLogsOpts) Run(ctx context.Context) error { params := &admin.GetHostLogsApiParams{ - GroupId: opts.groupId, - HostName: opts.hostName, - LogName: opts.logName, - EndDate: &opts.endDate, + GroupId: opts.groupId, + HostName: opts.hostName, + LogName: opts.logName, + EndDate: &opts.endDate, StartDate: &opts.startDate, } resp, _, err := opts.client.MonitoringAndLogsApi.GetHostLogsWithParams(ctx, params).Execute() @@ -329,15 +339,15 @@ func (opts *GetHostLogsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetHostLogsBuilder() *cobra.Command { +func getHostLogsBuilder() *cobra.Command { const template = "<>" - opts := GetHostLogsOpts{} + opts := getHostLogsOpts{} cmd := &cobra.Command{ - Use: "getHostLogs", + Use: "getHostLogs", Short: "Download Logs for One Multi-Cloud Cluster Host in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -349,47 +359,50 @@ func GetHostLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.hostName, "hostName", "", "Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.") - cmd.Flags().StringVar(&opts.logName, "logName", "", "Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.") - cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, "Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") - cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, "Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.hostName, "hostName", "", `Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.`) + cmd.Flags().StringVar(&opts.logName, "logName", "", `Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.`) + cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) + cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostName") _ = cmd.MarkFlagRequired("logName") return cmd } -type GetHostMeasurementsOpts struct { + +type getHostMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - processId string + client *admin.APIClient + groupId string + processId string granularity string - m []string - period string - start string - end string + m []string + period string + start string + end string } -func (opts *GetHostMeasurementsOpts) initClient() func() error { +func (opts *getHostMeasurementsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetHostMeasurementsOpts) Run(ctx context.Context) error { +func (opts *getHostMeasurementsOpts) Run(ctx context.Context) error { params := &admin.GetHostMeasurementsApiParams{ - GroupId: opts.groupId, - ProcessId: opts.processId, - Granularity: opts.granularity, - M: &opts.m, - Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + GroupId: opts.groupId, + ProcessId: opts.processId, + Granularity: &opts.granularity, + M: &opts.m, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetHostMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -399,15 +412,15 @@ func (opts *GetHostMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetHostMeasurementsBuilder() *cobra.Command { +func getHostMeasurementsBuilder() *cobra.Command { const template = "<>" - opts := GetHostMeasurementsOpts{} + opts := getHostMeasurementsOpts{} cmd := &cobra.Command{ - Use: "getHostMeasurements", + Use: "getHostMeasurements", Short: "Return Measurements for One MongoDB Process", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -419,55 +432,58 @@ func GetHostMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringSliceVar(&opts.m, "m", nil, "One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.") - cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) + cmd.Flags().StringSliceVar(&opts.m, "m", nil, `One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") return cmd } -type GetIndexMetricsOpts struct { + +type getIndexMetricsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - processId string - indexName string - databaseName string + client *admin.APIClient + processId string + indexName string + databaseName string collectionName string - groupId string - granularity string - metrics []string - period string - start string - end string + groupId string + granularity string + metrics []string + period string + start string + end string } -func (opts *GetIndexMetricsOpts) initClient() func() error { +func (opts *getIndexMetricsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetIndexMetricsOpts) Run(ctx context.Context) error { +func (opts *getIndexMetricsOpts) Run(ctx context.Context) error { params := &admin.GetIndexMetricsApiParams{ - ProcessId: opts.processId, - IndexName: opts.indexName, - DatabaseName: opts.databaseName, + ProcessId: opts.processId, + IndexName: opts.indexName, + DatabaseName: opts.databaseName, CollectionName: opts.collectionName, - GroupId: opts.groupId, - Granularity: opts.granularity, - Metrics: opts.metrics, - Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + GroupId: opts.groupId, + Granularity: &opts.granularity, + Metrics: &opts.metrics, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params).Execute() if err != nil { @@ -477,15 +493,15 @@ func (opts *GetIndexMetricsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetIndexMetricsBuilder() *cobra.Command { +func getIndexMetricsBuilder() *cobra.Command { const template = "<>" - opts := GetIndexMetricsOpts{} + opts := getIndexMetricsOpts{} cmd := &cobra.Command{ - Use: "getIndexMetrics", + Use: "getIndexMetrics", Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -497,16 +513,18 @@ func GetIndexMetricsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.indexName, "indexName", "", "Human-readable label that identifies the index.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database.") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "Human-readable label that identifies the collection.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the measurements that MongoDB Atlas reports for the associated data series.") - cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.indexName, "indexName", "", `Human-readable label that identifies the index.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database.`) + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) + cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the measurements that MongoDB Atlas reports for the associated data series.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("indexName") @@ -517,36 +535,37 @@ func GetIndexMetricsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("metrics") return cmd } -type GetMeasurementsOpts struct { + +type getMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - processId string - groupId string + client *admin.APIClient + processId string + groupId string granularity string - metrics []string - period string - start string - end string + metrics []string + period string + start string + end string } -func (opts *GetMeasurementsOpts) initClient() func() error { +func (opts *getMeasurementsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetMeasurementsOpts) Run(ctx context.Context) error { +func (opts *getMeasurementsOpts) Run(ctx context.Context) error { params := &admin.GetMeasurementsApiParams{ - ProcessId: opts.processId, - GroupId: opts.groupId, - Granularity: opts.granularity, - Metrics: opts.metrics, - Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + ProcessId: opts.processId, + GroupId: opts.groupId, + Granularity: &opts.granularity, + Metrics: &opts.metrics, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -556,15 +575,15 @@ func (opts *GetMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetMeasurementsBuilder() *cobra.Command { +func getMeasurementsBuilder() *cobra.Command { const template = "<>" - opts := GetMeasurementsOpts{} + opts := getMeasurementsOpts{} cmd := &cobra.Command{ - Use: "getMeasurements", + Use: "getMeasurements", Short: "Return Atlas Search Hardware and Status Metrics", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -576,13 +595,15 @@ func GetMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.") - cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) + cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") @@ -590,30 +611,31 @@ func GetMeasurementsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("metrics") return cmd } -type ListAtlasProcessesOpts struct { + +type listAtlasProcessesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListAtlasProcessesOpts) initClient() func() error { +func (opts *listAtlasProcessesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListAtlasProcessesOpts) Run(ctx context.Context) error { +func (opts *listAtlasProcessesOpts) Run(ctx context.Context) error { params := &admin.ListAtlasProcessesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MonitoringAndLogsApi.ListAtlasProcessesWithParams(ctx, params).Execute() if err != nil { @@ -623,15 +645,15 @@ func (opts *ListAtlasProcessesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListAtlasProcessesBuilder() *cobra.Command { +func listAtlasProcessesBuilder() *cobra.Command { const template = "<>" - opts := ListAtlasProcessesOpts{} + opts := listAtlasProcessesOpts{} cmd := &cobra.Command{ - Use: "listAtlasProcesses", + Use: "listAtlasProcesses", Short: "Return All MongoDB Processes in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -643,40 +665,43 @@ func ListAtlasProcessesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListDatabasesOpts struct { + +type listDatabasesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - processId string + client *admin.APIClient + groupId string + processId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListDatabasesOpts) initClient() func() error { +func (opts *listDatabasesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListDatabasesOpts) Run(ctx context.Context) error { +func (opts *listDatabasesOpts) Run(ctx context.Context) error { params := &admin.ListDatabasesApiParams{ - GroupId: opts.groupId, - ProcessId: opts.processId, + GroupId: opts.groupId, + ProcessId: opts.processId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MonitoringAndLogsApi.ListDatabasesWithParams(ctx, params).Execute() if err != nil { @@ -686,15 +711,15 @@ func (opts *ListDatabasesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListDatabasesBuilder() *cobra.Command { +func listDatabasesBuilder() *cobra.Command { const template = "<>" - opts := ListDatabasesOpts{} + opts := listDatabasesOpts{} cmd := &cobra.Command{ - Use: "listDatabases", + Use: "listDatabases", Short: "Return Available Databases for One MongoDB Process", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -706,38 +731,41 @@ func ListDatabasesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } -type ListDiskMeasurementsOpts struct { + +type listDiskMeasurementsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient partitionName string - groupId string - processId string + groupId string + processId string } -func (opts *ListDiskMeasurementsOpts) initClient() func() error { +func (opts *listDiskMeasurementsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListDiskMeasurementsOpts) Run(ctx context.Context) error { +func (opts *listDiskMeasurementsOpts) Run(ctx context.Context) error { params := &admin.ListDiskMeasurementsApiParams{ PartitionName: opts.partitionName, - GroupId: opts.groupId, - ProcessId: opts.processId, + GroupId: opts.groupId, + ProcessId: opts.processId, } resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(ctx, params).Execute() if err != nil { @@ -747,15 +775,15 @@ func (opts *ListDiskMeasurementsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListDiskMeasurementsBuilder() *cobra.Command { +func listDiskMeasurementsBuilder() *cobra.Command { const template = "<>" - opts := ListDiskMeasurementsOpts{} + opts := listDiskMeasurementsOpts{} cmd := &cobra.Command{ - Use: "listDiskMeasurements", + Use: "listDiskMeasurements", Short: "Return Measurements of One Disk", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -767,41 +795,44 @@ func ListDiskMeasurementsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", "Human-readable label of the disk or partition to which the measurements apply.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") + cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } -type ListDiskPartitionsOpts struct { + +type listDiskPartitionsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - processId string + client *admin.APIClient + groupId string + processId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListDiskPartitionsOpts) initClient() func() error { +func (opts *listDiskPartitionsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListDiskPartitionsOpts) Run(ctx context.Context) error { +func (opts *listDiskPartitionsOpts) Run(ctx context.Context) error { params := &admin.ListDiskPartitionsApiParams{ - GroupId: opts.groupId, - ProcessId: opts.processId, + GroupId: opts.groupId, + ProcessId: opts.processId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskPartitionsWithParams(ctx, params).Execute() if err != nil { @@ -811,15 +842,15 @@ func (opts *ListDiskPartitionsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListDiskPartitionsBuilder() *cobra.Command { +func listDiskPartitionsBuilder() *cobra.Command { const template = "<>" - opts := ListDiskPartitionsOpts{} + opts := listDiskPartitionsOpts{} cmd := &cobra.Command{ - Use: "listDiskPartitions", + Use: "listDiskPartitions", Short: "Return Available Disks for One MongoDB Process", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -831,50 +862,53 @@ func ListDiskPartitionsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } -type ListIndexMetricsOpts struct { + +type listIndexMetricsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - processId string - databaseName string + client *admin.APIClient + processId string + databaseName string collectionName string - groupId string - granularity string - metrics []string - period string - start string - end string + groupId string + granularity string + metrics []string + period string + start string + end string } -func (opts *ListIndexMetricsOpts) initClient() func() error { +func (opts *listIndexMetricsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListIndexMetricsOpts) Run(ctx context.Context) error { +func (opts *listIndexMetricsOpts) Run(ctx context.Context) error { params := &admin.ListIndexMetricsApiParams{ - ProcessId: opts.processId, - DatabaseName: opts.databaseName, + ProcessId: opts.processId, + DatabaseName: opts.databaseName, CollectionName: opts.collectionName, - GroupId: opts.groupId, - Granularity: opts.granularity, - Metrics: opts.metrics, - Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + GroupId: opts.groupId, + Granularity: &opts.granularity, + Metrics: &opts.metrics, + Period: &opts.period, + Start: convertTime(&opts.start), + End: convertTime(&opts.end), } resp, _, err := opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params).Execute() if err != nil { @@ -884,15 +918,15 @@ func (opts *ListIndexMetricsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListIndexMetricsBuilder() *cobra.Command { +func listIndexMetricsBuilder() *cobra.Command { const template = "<>" - opts := ListIndexMetricsOpts{} + opts := listIndexMetricsOpts{} cmd := &cobra.Command{ - Use: "listIndexMetrics", + Use: "listIndexMetrics", Short: "Return All Atlas Search Index Metrics for One Namespace", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -904,15 +938,17 @@ func ListIndexMetricsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", "Human-readable label that identifies the database.") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", "Human-readable label that identifies the collection.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.granularity, "granularity", "", "Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.") - cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, "List that contains the measurements that MongoDB Atlas reports for the associated data series.") - cmd.Flags().StringVar(&opts.period, "period", "", "Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.") - cmd.Flags().StringVar(&opts.start, "start", "", "Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") - cmd.Flags().StringVar(&opts.end, "end", "", "Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.") + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database.`) + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) + cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the measurements that MongoDB Atlas reports for the associated data series.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("databaseName") @@ -922,26 +958,27 @@ func ListIndexMetricsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("metrics") return cmd } -type ListMetricTypesOpts struct { + +type listMetricTypesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient processId string - groupId string + groupId string } -func (opts *ListMetricTypesOpts) initClient() func() error { +func (opts *listMetricTypesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListMetricTypesOpts) Run(ctx context.Context) error { +func (opts *listMetricTypesOpts) Run(ctx context.Context) error { params := &admin.ListMetricTypesApiParams{ ProcessId: opts.processId, - GroupId: opts.groupId, + GroupId: opts.groupId, } resp, _, err := opts.client.MonitoringAndLogsApi.ListMetricTypesWithParams(ctx, params).Execute() if err != nil { @@ -951,15 +988,15 @@ func (opts *ListMetricTypesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListMetricTypesBuilder() *cobra.Command { +func listMetricTypesBuilder() *cobra.Command { const template = "<>" - opts := ListMetricTypesOpts{} + opts := listMetricTypesOpts{} cmd := &cobra.Command{ - Use: "listMetricTypes", + Use: "listMetricTypes", Short: "Return All Atlas Search Metric Types for One Process", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -971,35 +1008,36 @@ func ListMetricTypesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") return cmd } -func MonitoringAndLogsBuilder() *cobra.Command { +func monitoringAndLogsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "monitoringAndLogs", - Short: "Returns database deployment monitoring and logging data.", + Use: "monitoringAndLogs", + Short: `Returns database deployment monitoring and logging data.`, } cmd.AddCommand( - GetAtlasProcessBuilder(), - GetDatabaseBuilder(), - GetDatabaseMeasurementsBuilder(), - GetDiskMeasurementsBuilder(), - GetHostLogsBuilder(), - GetHostMeasurementsBuilder(), - GetIndexMetricsBuilder(), - GetMeasurementsBuilder(), - ListAtlasProcessesBuilder(), - ListDatabasesBuilder(), - ListDiskMeasurementsBuilder(), - ListDiskPartitionsBuilder(), - ListIndexMetricsBuilder(), - ListMetricTypesBuilder(), + getAtlasProcessBuilder(), + getDatabaseBuilder(), + getDatabaseMeasurementsBuilder(), + getDiskMeasurementsBuilder(), + getHostLogsBuilder(), + getHostMeasurementsBuilder(), + getIndexMetricsBuilder(), + getMeasurementsBuilder(), + listAtlasProcessesBuilder(), + listDatabasesBuilder(), + listDiskMeasurementsBuilder(), + listDiskPartitionsBuilder(), + listIndexMetricsBuilder(), + listMetricTypesBuilder(), ) return cmd } - diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index a0dcb34695..f7be539c2c 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateClusterOpts struct { +type createClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateClusterOpts) initClient() func() error { +func (opts *createClusterOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateClusterOpts) Run(ctx context.Context) error { +func (opts *createClusterOpts) Run(ctx context.Context) error { params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.MultiCloudClustersApi.CreateClusterWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreateClusterOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateClusterBuilder() *cobra.Command { +func createClusterBuilder() *cobra.Command { const template = "<>" - opts := CreateClusterOpts{} + opts := createClusterOpts{} cmd := &cobra.Command{ - Use: "createCluster", + Use: "createCluster", Short: "Create One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,33 +71,35 @@ func CreateClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteClusterOpts struct { + +type deleteClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string retainBackups bool } -func (opts *DeleteClusterOpts) initClient() func() error { +func (opts *deleteClusterOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteClusterOpts) Run(ctx context.Context) error { +func (opts *deleteClusterOpts) Run(ctx context.Context) error { params := &admin.DeleteClusterApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RetainBackups: &opts.retainBackups, } _, err := opts.client.MultiCloudClustersApi.DeleteClusterWithParams(ctx, params).Execute() @@ -112,15 +110,15 @@ func (opts *DeleteClusterOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func DeleteClusterBuilder() *cobra.Command { +func deleteClusterBuilder() *cobra.Command { const template = "<>" - opts := DeleteClusterOpts{} + opts := deleteClusterOpts{} cmd := &cobra.Command{ - Use: "deleteCluster", + Use: "deleteCluster", Short: "Remove One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -132,33 +130,36 @@ func DeleteClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, "Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type GetClusterOpts struct { + +type getClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *GetClusterOpts) initClient() func() error { +func (opts *getClusterOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetClusterOpts) Run(ctx context.Context) error { +func (opts *getClusterOpts) Run(ctx context.Context) error { params := &admin.GetClusterApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.MultiCloudClustersApi.GetClusterWithParams(ctx, params).Execute() @@ -169,15 +170,15 @@ func (opts *GetClusterOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetClusterBuilder() *cobra.Command { +func getClusterBuilder() *cobra.Command { const template = "<>" - opts := GetClusterOpts{} + opts := getClusterOpts{} cmd := &cobra.Command{ - Use: "getCluster", + Use: "getCluster", Short: "Return One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -189,37 +190,40 @@ func GetClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies this advanced cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListClustersOpts struct { + +type listClustersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListClustersOpts) initClient() func() error { +func (opts *listClustersOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListClustersOpts) Run(ctx context.Context) error { +func (opts *listClustersOpts) Run(ctx context.Context) error { params := &admin.ListClustersApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MultiCloudClustersApi.ListClustersWithParams(ctx, params).Execute() if err != nil { @@ -229,15 +233,15 @@ func (opts *ListClustersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListClustersBuilder() *cobra.Command { +func listClustersBuilder() *cobra.Command { const template = "<>" - opts := ListClustersOpts{} + opts := listClustersOpts{} cmd := &cobra.Command{ - Use: "listClusters", + Use: "listClusters", Short: "Return All Multi-Cloud Clusters from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -249,33 +253,36 @@ func ListClustersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type TestFailoverOpts struct { + +type testFailoverOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *TestFailoverOpts) initClient() func() error { +func (opts *testFailoverOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *TestFailoverOpts) Run(ctx context.Context) error { +func (opts *testFailoverOpts) Run(ctx context.Context) error { params := &admin.TestFailoverApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } _, err := opts.client.MultiCloudClustersApi.TestFailoverWithParams(ctx, params).Execute() @@ -286,15 +293,15 @@ func (opts *TestFailoverOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func TestFailoverBuilder() *cobra.Command { +func testFailoverBuilder() *cobra.Command { const template = "<>" - opts := TestFailoverOpts{} + opts := testFailoverOpts{} cmd := &cobra.Command{ - Use: "testFailover", + Use: "testFailover", Short: "Test Failover for One Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -306,35 +313,36 @@ func TestFailoverBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type UpdateClusterOpts struct { + +type updateClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *UpdateClusterOpts) initClient() func() error { +func (opts *updateClusterOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateClusterOpts) Run(ctx context.Context) error { +func (opts *updateClusterOpts) Run(ctx context.Context) error { params := &admin.UpdateClusterApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.MultiCloudClustersApi.UpdateClusterWithParams(ctx, params).Execute() if err != nil { @@ -344,15 +352,15 @@ func (opts *UpdateClusterOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateClusterBuilder() *cobra.Command { +func updateClusterBuilder() *cobra.Command { const template = "<>" - opts := UpdateClusterOpts{} + opts := updateClusterOpts{} cmd := &cobra.Command{ - Use: "updateCluster", + Use: "updateCluster", Short: "Modify One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -364,32 +372,32 @@ func UpdateClusterBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the advanced cluster to modify.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the advanced cluster to modify.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -func MultiCloudClustersBuilder() *cobra.Command { +func multiCloudClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "multiCloudClusters", - Short: "Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. + Use: "multiCloudClusters", + Short: `Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. The total number of nodes in clusters spanning across regions has a specific constraint on a per-project basis. MongoDB Cloud limits the total number of nodes in other regions in one project to a total of 40. This total excludes Google Cloud regions communicating with each other, shared-tier clusters, or serverless clusters. The total number of nodes between any two regions must meet this constraint. For example, if a project has nodes in clusters spread across three regions: 30 nodes in Region A, 10 nodes in Region B, and 5 nodes in Region C, you can add only 5 more nodes to Region C because if you exclude Region C, Region A + Region B = 40. If you exclude Region B, Region A + Region C = 35, <= 40. If you exclude Region A, Region B + Region C = 15, <= 40. Each combination of regions with the added 5 nodes still meets the per-project constraint. Region A + B = 40. Region A + C = 40. Region B + C = 20. You can't create a multi-region cluster in a project if it has one or more clusters spanning 40 or more nodes in other regions. Each project supports up to 25 database deployments. -If your MongoDB Cloud project contains a custom role that uses actions introduced in a specific MongoDB version, you must delete that role before you create clusters with an earlier MongoDB version. MongoDB Cloud clusters created after July 2020 use TLS version 1.2 by default. When you create a cluster, MongoDB Cloud creates a network container in the project for the cloud provider to which you deploy the cluster if one doesn't already exist.", +If your MongoDB Cloud project contains a custom role that uses actions introduced in a specific MongoDB version, you must delete that role before you create clusters with an earlier MongoDB version. MongoDB Cloud clusters created after July 2020 use TLS version 1.2 by default. When you create a cluster, MongoDB Cloud creates a network container in the project for the cloud provider to which you deploy the cluster if one doesn't already exist.`, } cmd.AddCommand( - CreateClusterBuilder(), - DeleteClusterBuilder(), - GetClusterBuilder(), - ListClustersBuilder(), - TestFailoverBuilder(), - UpdateClusterBuilder(), + createClusterBuilder(), + deleteClusterBuilder(), + getClusterBuilder(), + listClustersBuilder(), + testFailoverBuilder(), + updateClusterBuilder(), ) return cmd } - diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 1d2e5daa6d..629dd2df0c 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreatePeeringConnectionOpts struct { +type createPeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreatePeeringConnectionOpts) initClient() func() error { +func (opts *createPeeringConnectionOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreatePeeringConnectionOpts) Run(ctx context.Context) error { +func (opts *createPeeringConnectionOpts) Run(ctx context.Context) error { params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreatePeeringConnectionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreatePeeringConnectionBuilder() *cobra.Command { +func createPeeringConnectionBuilder() *cobra.Command { const template = "<>" - opts := CreatePeeringConnectionOpts{} + opts := createPeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "createPeeringConnection", + Use: "createPeeringConnection", Short: "Create One New Network Peering Connection", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,32 +71,32 @@ func CreatePeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type CreatePeeringContainerOpts struct { + +type createPeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreatePeeringContainerOpts) initClient() func() error { +func (opts *createPeeringContainerOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreatePeeringContainerOpts) Run(ctx context.Context) error { +func (opts *createPeeringContainerOpts) Run(ctx context.Context) error { params := &admin.CreatePeeringContainerApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params).Execute() if err != nil { @@ -110,15 +106,15 @@ func (opts *CreatePeeringContainerOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreatePeeringContainerBuilder() *cobra.Command { +func createPeeringContainerBuilder() *cobra.Command { const template = "<>" - opts := CreatePeeringContainerOpts{} + opts := createPeeringContainerOpts{} cmd := &cobra.Command{ - Use: "createPeeringContainer", + Use: "createPeeringContainer", Short: "Create One New Network Peering Container", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -130,32 +126,34 @@ func CreatePeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeletePeeringConnectionOpts struct { + +type deletePeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - peerId string + peerId string } -func (opts *DeletePeeringConnectionOpts) initClient() func() error { +func (opts *deletePeeringConnectionOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeletePeeringConnectionOpts) Run(ctx context.Context) error { +func (opts *deletePeeringConnectionOpts) Run(ctx context.Context) error { params := &admin.DeletePeeringConnectionApiParams{ GroupId: opts.groupId, - PeerId: opts.peerId, + PeerId: opts.peerId, } resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringConnectionWithParams(ctx, params).Execute() if err != nil { @@ -165,15 +163,15 @@ func (opts *DeletePeeringConnectionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeletePeeringConnectionBuilder() *cobra.Command { +func deletePeeringConnectionBuilder() *cobra.Command { const template = "<>" - opts := DeletePeeringConnectionOpts{} + opts := deletePeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "deletePeeringConnection", + Use: "deletePeeringConnection", Short: "Remove One Existing Network Peering Connection", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -185,32 +183,35 @@ func DeletePeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.peerId, "peerId", "", "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd } -type DeletePeeringContainerOpts struct { + +type deletePeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string containerId string } -func (opts *DeletePeeringContainerOpts) initClient() func() error { +func (opts *deletePeeringContainerOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeletePeeringContainerOpts) Run(ctx context.Context) error { +func (opts *deletePeeringContainerOpts) Run(ctx context.Context) error { params := &admin.DeletePeeringContainerApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ContainerId: opts.containerId, } resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringContainerWithParams(ctx, params).Execute() @@ -221,15 +222,15 @@ func (opts *DeletePeeringContainerOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeletePeeringContainerBuilder() *cobra.Command { +func deletePeeringContainerBuilder() *cobra.Command { const template = "<>" - opts := DeletePeeringContainerOpts{} + opts := deletePeeringContainerOpts{} cmd := &cobra.Command{ - Use: "deletePeeringContainer", + Use: "deletePeeringContainer", Short: "Remove One Network Peering Container", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -241,33 +242,34 @@ func DeletePeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.containerId, "containerId", "", "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd } -type DisablePeeringOpts struct { + +type disablePeeringOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *DisablePeeringOpts) initClient() func() error { +func (opts *disablePeeringOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DisablePeeringOpts) Run(ctx context.Context) error { +func (opts *disablePeeringOpts) Run(ctx context.Context) error { params := &admin.DisablePeeringApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params).Execute() if err != nil { @@ -277,15 +279,15 @@ func (opts *DisablePeeringOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DisablePeeringBuilder() *cobra.Command { +func disablePeeringBuilder() *cobra.Command { const template = "<>" - opts := DisablePeeringOpts{} + opts := disablePeeringOpts{} cmd := &cobra.Command{ - Use: "disablePeering", + Use: "disablePeering", Short: "Disable Connect via Peering Only Mode for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -297,32 +299,34 @@ func DisablePeeringBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetPeeringConnectionOpts struct { + +type getPeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - peerId string + peerId string } -func (opts *GetPeeringConnectionOpts) initClient() func() error { +func (opts *getPeeringConnectionOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetPeeringConnectionOpts) Run(ctx context.Context) error { +func (opts *getPeeringConnectionOpts) Run(ctx context.Context) error { params := &admin.GetPeeringConnectionApiParams{ GroupId: opts.groupId, - PeerId: opts.peerId, + PeerId: opts.peerId, } resp, _, err := opts.client.NetworkPeeringApi.GetPeeringConnectionWithParams(ctx, params).Execute() if err != nil { @@ -332,15 +336,15 @@ func (opts *GetPeeringConnectionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetPeeringConnectionBuilder() *cobra.Command { +func getPeeringConnectionBuilder() *cobra.Command { const template = "<>" - opts := GetPeeringConnectionOpts{} + opts := getPeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "getPeeringConnection", + Use: "getPeeringConnection", Short: "Return One Network Peering Connection in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -352,32 +356,35 @@ func GetPeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.peerId, "peerId", "", "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd } -type GetPeeringContainerOpts struct { + +type getPeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string containerId string } -func (opts *GetPeeringContainerOpts) initClient() func() error { +func (opts *getPeeringContainerOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetPeeringContainerOpts) Run(ctx context.Context) error { +func (opts *getPeeringContainerOpts) Run(ctx context.Context) error { params := &admin.GetPeeringContainerApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ContainerId: opts.containerId, } resp, _, err := opts.client.NetworkPeeringApi.GetPeeringContainerWithParams(ctx, params).Execute() @@ -388,15 +395,15 @@ func (opts *GetPeeringContainerOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetPeeringContainerBuilder() *cobra.Command { +func getPeeringContainerBuilder() *cobra.Command { const template = "<>" - opts := GetPeeringContainerOpts{} + opts := getPeeringContainerOpts{} cmd := &cobra.Command{ - Use: "getPeeringContainer", + Use: "getPeeringContainer", Short: "Return One Network Peering Container", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -408,38 +415,41 @@ func GetPeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.containerId, "containerId", "", "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd } -type ListPeeringConnectionsOpts struct { + +type listPeeringConnectionsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int providerName string } -func (opts *ListPeeringConnectionsOpts) initClient() func() error { +func (opts *listPeeringConnectionsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPeeringConnectionsOpts) Run(ctx context.Context) error { +func (opts *listPeeringConnectionsOpts) Run(ctx context.Context) error { params := &admin.ListPeeringConnectionsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, ProviderName: &opts.providerName, } resp, _, err := opts.client.NetworkPeeringApi.ListPeeringConnectionsWithParams(ctx, params).Execute() @@ -450,15 +460,15 @@ func (opts *ListPeeringConnectionsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListPeeringConnectionsBuilder() *cobra.Command { +func listPeeringConnectionsBuilder() *cobra.Command { const template = "<>" - opts := ListPeeringConnectionsOpts{} + opts := listPeeringConnectionsOpts{} cmd := &cobra.Command{ - Use: "listPeeringConnections", + Use: "listPeeringConnections", Short: "Return All Network Peering Connections in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -470,41 +480,44 @@ func ListPeeringConnectionsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", "Cloud service provider to use for this VPC peering connection.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider to use for this VPC peering connection.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListPeeringContainerByCloudProviderOpts struct { + +type listPeeringContainerByCloudProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string providerName string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListPeeringContainerByCloudProviderOpts) initClient() func() error { +func (opts *listPeeringContainerByCloudProviderOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPeeringContainerByCloudProviderOpts) Run(ctx context.Context) error { +func (opts *listPeeringContainerByCloudProviderOpts) Run(ctx context.Context) error { params := &admin.ListPeeringContainerByCloudProviderApiParams{ - GroupId: opts.groupId, - ProviderName: opts.providerName, + GroupId: opts.groupId, + ProviderName: &opts.providerName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params).Execute() if err != nil { @@ -514,15 +527,15 @@ func (opts *ListPeeringContainerByCloudProviderOpts) Run(ctx context.Context) er return opts.Print(resp) } -func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { +func listPeeringContainerByCloudProviderBuilder() *cobra.Command { const template = "<>" - opts := ListPeeringContainerByCloudProviderOpts{} + opts := listPeeringContainerByCloudProviderOpts{} cmd := &cobra.Command{ - Use: "listPeeringContainerByCloudProvider", + Use: "listPeeringContainerByCloudProvider", Short: "Return All Network Peering Containers in One Project for One Cloud Provider", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -534,40 +547,43 @@ func ListPeeringContainerByCloudProviderBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", "Cloud service provider that serves the desired network peering containers.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider that serves the desired network peering containers.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("providerName") return cmd } -type ListPeeringContainersOpts struct { + +type listPeeringContainersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListPeeringContainersOpts) initClient() func() error { +func (opts *listPeeringContainersOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPeeringContainersOpts) Run(ctx context.Context) error { +func (opts *listPeeringContainersOpts) Run(ctx context.Context) error { params := &admin.ListPeeringContainersApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainersWithParams(ctx, params).Execute() if err != nil { @@ -577,15 +593,15 @@ func (opts *ListPeeringContainersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListPeeringContainersBuilder() *cobra.Command { +func listPeeringContainersBuilder() *cobra.Command { const template = "<>" - opts := ListPeeringContainersOpts{} + opts := listPeeringContainersOpts{} cmd := &cobra.Command{ - Use: "listPeeringContainers", + Use: "listPeeringContainers", Short: "Return All Network Peering Containers in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -597,36 +613,37 @@ func ListPeeringContainersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdatePeeringConnectionOpts struct { + +type updatePeeringConnectionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - peerId string - + peerId string } -func (opts *UpdatePeeringConnectionOpts) initClient() func() error { +func (opts *updatePeeringConnectionOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdatePeeringConnectionOpts) Run(ctx context.Context) error { +func (opts *updatePeeringConnectionOpts) Run(ctx context.Context) error { params := &admin.UpdatePeeringConnectionApiParams{ GroupId: opts.groupId, - PeerId: opts.peerId, - + PeerId: opts.peerId, } resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { @@ -636,15 +653,15 @@ func (opts *UpdatePeeringConnectionOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdatePeeringConnectionBuilder() *cobra.Command { +func updatePeeringConnectionBuilder() *cobra.Command { const template = "<>" - opts := UpdatePeeringConnectionOpts{} + opts := updatePeeringConnectionOpts{} cmd := &cobra.Command{ - Use: "updatePeeringConnection", + Use: "updatePeeringConnection", Short: "Update One New Network Peering Connection", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -656,36 +673,36 @@ func UpdatePeeringConnectionBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.peerId, "peerId", "", "Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd } -type UpdatePeeringContainerOpts struct { + +type updatePeeringContainerOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string containerId string - } -func (opts *UpdatePeeringContainerOpts) initClient() func() error { +func (opts *updatePeeringContainerOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdatePeeringContainerOpts) Run(ctx context.Context) error { +func (opts *updatePeeringContainerOpts) Run(ctx context.Context) error { params := &admin.UpdatePeeringContainerApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ContainerId: opts.containerId, - } resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params).Execute() if err != nil { @@ -695,15 +712,15 @@ func (opts *UpdatePeeringContainerOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdatePeeringContainerBuilder() *cobra.Command { +func updatePeeringContainerBuilder() *cobra.Command { const template = "<>" - opts := UpdatePeeringContainerOpts{} + opts := updatePeeringContainerOpts{} cmd := &cobra.Command{ - Use: "updatePeeringContainer", + Use: "updatePeeringContainer", Short: "Update One Network Peering Container", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -715,30 +732,32 @@ func UpdatePeeringContainerBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.containerId, "containerId", "", "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd } -type VerifyConnectViaPeeringOnlyModeForOneProjectOpts struct { + +type verifyConnectViaPeeringOnlyModeForOneProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) initClient() func() error { +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Context) error { +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Context) error { params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, } @@ -750,15 +769,15 @@ func (opts *VerifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Co return opts.Print(resp) } -func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { +func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { const template = "<>" - opts := VerifyConnectViaPeeringOnlyModeForOneProjectOpts{} + opts := verifyConnectViaPeeringOnlyModeForOneProjectOpts{} cmd := &cobra.Command{ - Use: "verifyConnectViaPeeringOnlyModeForOneProject", + Use: "verifyConnectViaPeeringOnlyModeForOneProject", Short: "Verify Connect via Peering Only Mode for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -770,33 +789,34 @@ func VerifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func NetworkPeeringBuilder() *cobra.Command { +func networkPeeringBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "networkPeering", - Short: "Returns, adds, edits, and removes network peering containers and peering connections. -When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block.", + Use: "networkPeering", + Short: `Returns, adds, edits, and removes network peering containers and peering connections. +When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block.`, } cmd.AddCommand( - CreatePeeringConnectionBuilder(), - CreatePeeringContainerBuilder(), - DeletePeeringConnectionBuilder(), - DeletePeeringContainerBuilder(), - DisablePeeringBuilder(), - GetPeeringConnectionBuilder(), - GetPeeringContainerBuilder(), - ListPeeringConnectionsBuilder(), - ListPeeringContainerByCloudProviderBuilder(), - ListPeeringContainersBuilder(), - UpdatePeeringConnectionBuilder(), - UpdatePeeringContainerBuilder(), - VerifyConnectViaPeeringOnlyModeForOneProjectBuilder(), + createPeeringConnectionBuilder(), + createPeeringContainerBuilder(), + deletePeeringConnectionBuilder(), + deletePeeringContainerBuilder(), + disablePeeringBuilder(), + getPeeringConnectionBuilder(), + getPeeringContainerBuilder(), + listPeeringConnectionsBuilder(), + listPeeringContainerByCloudProviderBuilder(), + listPeeringContainersBuilder(), + updatePeeringConnectionBuilder(), + updatePeeringContainerBuilder(), + verifyConnectViaPeeringOnlyModeForOneProjectBuilder(), ) return cmd } - diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index 257186b473..e76eef5589 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateOnlineArchiveOpts struct { +type createOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateOnlineArchiveOpts) initClient() func() error { +func (opts *createOnlineArchiveOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateOnlineArchiveOpts) Run(ctx context.Context) error { +func (opts *createOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.CreateOnlineArchiveApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateOnlineArchiveOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateOnlineArchiveBuilder() *cobra.Command { +func createOnlineArchiveBuilder() *cobra.Command { const template = "<>" - opts := CreateOnlineArchiveOpts{} + opts := createOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "createOnlineArchive", + Use: "createOnlineArchive", Short: "Create One Online Archive", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,35 +73,37 @@ func CreateOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type DeleteOnlineArchiveOpts struct { + +type deleteOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string } -func (opts *DeleteOnlineArchiveOpts) initClient() func() error { +func (opts *deleteOnlineArchiveOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteOnlineArchiveOpts) Run(ctx context.Context) error { +func (opts *deleteOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.DeleteOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } resp, _, err := opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params).Execute() @@ -116,15 +114,15 @@ func (opts *DeleteOnlineArchiveOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteOnlineArchiveBuilder() *cobra.Command { +func deleteOnlineArchiveBuilder() *cobra.Command { const template = "<>" - opts := DeleteOnlineArchiveOpts{} + opts := deleteOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "deleteOnlineArchive", + Use: "deleteOnlineArchive", Short: "Remove One Online Archive", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,40 +134,43 @@ func DeleteOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "Unique 24-hexadecimal digit string that identifies the online archive to delete.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to delete.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type DownloadOnlineArchiveQueryLogsOpts struct { + +type downloadOnlineArchiveQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - startDate int64 - endDate int64 + startDate int64 + endDate int64 archiveOnly bool } -func (opts *DownloadOnlineArchiveQueryLogsOpts) initClient() func() error { +func (opts *downloadOnlineArchiveQueryLogsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DownloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { +func (opts *downloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - StartDate: &opts.startDate, - EndDate: &opts.endDate, + StartDate: &opts.startDate, + EndDate: &opts.endDate, ArchiveOnly: &opts.archiveOnly, } resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params).Execute() @@ -180,15 +181,15 @@ func (opts *DownloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { +func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { const template = "<>" - opts := DownloadOnlineArchiveQueryLogsOpts{} + opts := downloadOnlineArchiveQueryLogsOpts{} cmd := &cobra.Command{ - Use: "downloadOnlineArchiveQueryLogs", + Use: "downloadOnlineArchiveQueryLogs", Short: "Download Online Archive Query Logs", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -200,37 +201,40 @@ func DownloadOnlineArchiveQueryLogsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.") - cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, "Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") - cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, "Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).") - cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, "Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.`) + cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) + cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) + cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, `Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type GetOnlineArchiveOpts struct { + +type getOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string } -func (opts *GetOnlineArchiveOpts) initClient() func() error { +func (opts *getOnlineArchiveOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetOnlineArchiveOpts) Run(ctx context.Context) error { +func (opts *getOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.GetOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } resp, _, err := opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params).Execute() @@ -241,15 +245,15 @@ func (opts *GetOnlineArchiveOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetOnlineArchiveBuilder() *cobra.Command { +func getOnlineArchiveBuilder() *cobra.Command { const template = "<>" - opts := GetOnlineArchiveOpts{} + opts := getOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "getOnlineArchive", + Use: "getOnlineArchive", Short: "Return One Online Archive", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -261,41 +265,44 @@ func GetOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "Unique 24-hexadecimal digit string that identifies the online archive to return.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to return.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type ListOnlineArchivesOpts struct { + +type listOnlineArchivesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListOnlineArchivesOpts) initClient() func() error { +func (opts *listOnlineArchivesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListOnlineArchivesOpts) Run(ctx context.Context) error { +func (opts *listOnlineArchivesOpts) Run(ctx context.Context) error { params := &admin.ListOnlineArchivesApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params).Execute() if err != nil { @@ -305,15 +312,15 @@ func (opts *ListOnlineArchivesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListOnlineArchivesBuilder() *cobra.Command { +func listOnlineArchivesBuilder() *cobra.Command { const template = "<>" - opts := ListOnlineArchivesOpts{} + opts := listOnlineArchivesOpts{} cmd := &cobra.Command{ - Use: "listOnlineArchives", + Use: "listOnlineArchives", Short: "Return All Online Archives for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -325,40 +332,41 @@ func ListOnlineArchivesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -type UpdateOnlineArchiveOpts struct { + +type updateOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string - } -func (opts *UpdateOnlineArchiveOpts) initClient() func() error { +func (opts *updateOnlineArchiveOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateOnlineArchiveOpts) Run(ctx context.Context) error { +func (opts *updateOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.UpdateOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, - } resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { @@ -368,15 +376,15 @@ func (opts *UpdateOnlineArchiveOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateOnlineArchiveBuilder() *cobra.Command { +func updateOnlineArchiveBuilder() *cobra.Command { const template = "<>" - opts := UpdateOnlineArchiveOpts{} + opts := updateOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "updateOnlineArchive", + Use: "updateOnlineArchive", Short: "Update One Online Archive", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -388,10 +396,11 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", "Unique 24-hexadecimal digit string that identifies the online archive to update.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to update.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") @@ -399,19 +408,18 @@ func UpdateOnlineArchiveBuilder() *cobra.Command { return cmd } -func OnlineArchiveBuilder() *cobra.Command { +func onlineArchiveBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "onlineArchive", - Short: "Returns, adds, edits, or removes an online archive.", + Use: "onlineArchive", + Short: `Returns, adds, edits, or removes an online archive.`, } cmd.AddCommand( - CreateOnlineArchiveBuilder(), - DeleteOnlineArchiveBuilder(), - DownloadOnlineArchiveQueryLogsBuilder(), - GetOnlineArchiveBuilder(), - ListOnlineArchivesBuilder(), - UpdateOnlineArchiveBuilder(), + createOnlineArchiveBuilder(), + deleteOnlineArchiveBuilder(), + downloadOnlineArchiveQueryLogsBuilder(), + getOnlineArchiveBuilder(), + listOnlineArchivesBuilder(), + updateOnlineArchiveBuilder(), ) return cmd } - diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 4f829fd713..440eee0d7f 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -18,33 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateOrganizationOpts struct { +type createOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - } -func (opts *CreateOrganizationOpts) initClient() func() error { +func (opts *createOrganizationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateOrganizationOpts) Run(ctx context.Context) error { - params := &admin.CreateOrganizationApiParams{ - - } +func (opts *createOrganizationOpts) Run(ctx context.Context) error { + params := &admin.CreateOrganizationApiParams{} resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params).Execute() if err != nil { return err @@ -53,15 +48,15 @@ func (opts *CreateOrganizationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateOrganizationBuilder() *cobra.Command { +func createOrganizationBuilder() *cobra.Command { const template = "<>" - opts := CreateOrganizationOpts{} + opts := createOrganizationOpts{} cmd := &cobra.Command{ - Use: "createOrganization", + Use: "createOrganization", Short: "Create One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,30 +68,28 @@ func CreateOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - return cmd } -type CreateOrganizationInvitationOpts struct { + +type createOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string } -func (opts *CreateOrganizationInvitationOpts) initClient() func() error { +func (opts *createOrganizationInvitationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateOrganizationInvitationOpts) Run(ctx context.Context) error { +func (opts *createOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, - } resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { @@ -106,15 +99,15 @@ func (opts *CreateOrganizationInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateOrganizationInvitationBuilder() *cobra.Command { +func createOrganizationInvitationBuilder() *cobra.Command { const template = "<>" - opts := CreateOrganizationInvitationOpts{} + opts := createOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "createOrganizationInvitation", + Use: "createOrganizationInvitation", Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -126,28 +119,28 @@ func CreateOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type DeleteOrganizationOpts struct { + +type deleteOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } -func (opts *DeleteOrganizationOpts) initClient() func() error { +func (opts *deleteOrganizationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteOrganizationOpts) Run(ctx context.Context) error { +func (opts *deleteOrganizationOpts) Run(ctx context.Context) error { params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, } @@ -159,15 +152,15 @@ func (opts *DeleteOrganizationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteOrganizationBuilder() *cobra.Command { +func deleteOrganizationBuilder() *cobra.Command { const template = "<>" - opts := DeleteOrganizationOpts{} + opts := deleteOrganizationOpts{} cmd := &cobra.Command{ - Use: "deleteOrganization", + Use: "deleteOrganization", Short: "Remove One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -179,30 +172,31 @@ func DeleteOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type DeleteOrganizationInvitationOpts struct { + +type deleteOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string } -func (opts *DeleteOrganizationInvitationOpts) initClient() func() error { +func (opts *deleteOrganizationInvitationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteOrganizationInvitationOpts) Run(ctx context.Context) error { +func (opts *deleteOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.DeleteOrganizationInvitationApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, } resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params).Execute() @@ -213,15 +207,15 @@ func (opts *DeleteOrganizationInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteOrganizationInvitationBuilder() *cobra.Command { +func deleteOrganizationInvitationBuilder() *cobra.Command { const template = "<>" - opts := DeleteOrganizationInvitationOpts{} + opts := deleteOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "deleteOrganizationInvitation", + Use: "deleteOrganizationInvitation", Short: "Cancel One Organization Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -233,29 +227,30 @@ func DeleteOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } -type GetOrganizationOpts struct { + +type getOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } -func (opts *GetOrganizationOpts) initClient() func() error { +func (opts *getOrganizationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetOrganizationOpts) Run(ctx context.Context) error { +func (opts *getOrganizationOpts) Run(ctx context.Context) error { params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, } @@ -267,15 +262,15 @@ func (opts *GetOrganizationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetOrganizationBuilder() *cobra.Command { +func getOrganizationBuilder() *cobra.Command { const template = "<>" - opts := GetOrganizationOpts{} + opts := getOrganizationOpts{} cmd := &cobra.Command{ - Use: "getOrganization", + Use: "getOrganization", Short: "Return One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -287,30 +282,31 @@ func GetOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type GetOrganizationInvitationOpts struct { + +type getOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string } -func (opts *GetOrganizationInvitationOpts) initClient() func() error { +func (opts *getOrganizationInvitationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetOrganizationInvitationOpts) Run(ctx context.Context) error { +func (opts *getOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.GetOrganizationInvitationApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, } resp, _, err := opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params).Execute() @@ -321,15 +317,15 @@ func (opts *GetOrganizationInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetOrganizationInvitationBuilder() *cobra.Command { +func getOrganizationInvitationBuilder() *cobra.Command { const template = "<>" - opts := GetOrganizationInvitationOpts{} + opts := getOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "getOrganizationInvitation", + Use: "getOrganizationInvitation", Short: "Return One Organization Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -341,29 +337,30 @@ func GetOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } -type GetOrganizationSettingsOpts struct { + +type getOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } -func (opts *GetOrganizationSettingsOpts) initClient() func() error { +func (opts *getOrganizationSettingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetOrganizationSettingsOpts) Run(ctx context.Context) error { +func (opts *getOrganizationSettingsOpts) Run(ctx context.Context) error { params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, } @@ -375,15 +372,15 @@ func (opts *GetOrganizationSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetOrganizationSettingsBuilder() *cobra.Command { +func getOrganizationSettingsBuilder() *cobra.Command { const template = "<>" - opts := GetOrganizationSettingsOpts{} + opts := getOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "getOrganizationSettings", + Use: "getOrganizationSettings", Short: "Return Settings for One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -395,30 +392,31 @@ func GetOrganizationSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListOrganizationInvitationsOpts struct { + +type listOrganizationInvitationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string username string } -func (opts *ListOrganizationInvitationsOpts) initClient() func() error { +func (opts *listOrganizationInvitationsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListOrganizationInvitationsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationInvitationsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationInvitationsApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, Username: &opts.username, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params).Execute() @@ -429,15 +427,15 @@ func (opts *ListOrganizationInvitationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListOrganizationInvitationsBuilder() *cobra.Command { +func listOrganizationInvitationsBuilder() *cobra.Command { const template = "<>" - opts := ListOrganizationInvitationsOpts{} + opts := listOrganizationInvitationsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationInvitations", + Use: "listOrganizationInvitations", Short: "Return All Organization Invitations", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -449,38 +447,39 @@ func ListOrganizationInvitationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.username, "username", "", "Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListOrganizationProjectsOpts struct { + +type listOrganizationProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int - name string + pageNum int + name string } -func (opts *ListOrganizationProjectsOpts) initClient() func() error { +func (opts *listOrganizationProjectsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListOrganizationProjectsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationProjectsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationProjectsApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Name: &opts.name, + PageNum: &opts.pageNum, + Name: &opts.name, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params).Execute() if err != nil { @@ -490,15 +489,15 @@ func (opts *ListOrganizationProjectsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListOrganizationProjectsBuilder() *cobra.Command { +func listOrganizationProjectsBuilder() *cobra.Command { const template = "<>" - opts := ListOrganizationProjectsOpts{} + opts := listOrganizationProjectsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationProjects", + Use: "listOrganizationProjects", Short: "Return One or More Projects in One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -510,39 +509,40 @@ func ListOrganizationProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListOrganizationUsersOpts struct { + +type listOrganizationUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListOrganizationUsersOpts) initClient() func() error { +func (opts *listOrganizationUsersOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListOrganizationUsersOpts) Run(ctx context.Context) error { +func (opts *listOrganizationUsersOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationUsersApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params).Execute() if err != nil { @@ -552,15 +552,15 @@ func (opts *ListOrganizationUsersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListOrganizationUsersBuilder() *cobra.Command { +func listOrganizationUsersBuilder() *cobra.Command { const template = "<>" - opts := ListOrganizationUsersOpts{} + opts := listOrganizationUsersOpts{} cmd := &cobra.Command{ - Use: "listOrganizationUsers", + Use: "listOrganizationUsers", Short: "Return All MongoDB Cloud Users in One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -572,38 +572,39 @@ func ListOrganizationUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListOrganizationsOpts struct { + +type listOrganizationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int - pageNum int - name string + pageNum int + name string } -func (opts *ListOrganizationsOpts) initClient() func() error { +func (opts *listOrganizationsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListOrganizationsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Name: &opts.name, + PageNum: &opts.pageNum, + Name: &opts.name, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params).Execute() if err != nil { @@ -613,15 +614,15 @@ func (opts *ListOrganizationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListOrganizationsBuilder() *cobra.Command { +func listOrganizationsBuilder() *cobra.Command { const template = "<>" - opts := ListOrganizationsOpts{} + opts := listOrganizationsOpts{} cmd := &cobra.Command{ - Use: "listOrganizations", + Use: "listOrganizations", Short: "Return All Organizations", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -633,33 +634,32 @@ func ListOrganizationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.`) return cmd } -type RenameOrganizationOpts struct { + +type renameOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string } -func (opts *RenameOrganizationOpts) initClient() func() error { +func (opts *renameOrganizationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *RenameOrganizationOpts) Run(ctx context.Context) error { +func (opts *renameOrganizationOpts) Run(ctx context.Context) error { params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, - } resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() if err != nil { @@ -669,15 +669,15 @@ func (opts *RenameOrganizationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func RenameOrganizationBuilder() *cobra.Command { +func renameOrganizationBuilder() *cobra.Command { const template = "<>" - opts := RenameOrganizationOpts{} + opts := renameOrganizationOpts{} cmd := &cobra.Command{ - Use: "renameOrganization", + Use: "renameOrganization", Short: "Rename One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -689,32 +689,30 @@ func RenameOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type UpdateOrganizationInvitationOpts struct { + +type updateOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string } -func (opts *UpdateOrganizationInvitationOpts) initClient() func() error { +func (opts *updateOrganizationInvitationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateOrganizationInvitationOpts) Run(ctx context.Context) error { +func (opts *updateOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, - } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { @@ -724,15 +722,15 @@ func (opts *UpdateOrganizationInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateOrganizationInvitationBuilder() *cobra.Command { +func updateOrganizationInvitationBuilder() *cobra.Command { const template = "<>" - opts := UpdateOrganizationInvitationOpts{} + opts := updateOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationInvitation", + Use: "updateOrganizationInvitation", Short: "Update One Organization Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -744,34 +742,32 @@ func UpdateOrganizationInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type UpdateOrganizationInvitationByIdOpts struct { + +type updateOrganizationInvitationByIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string - } -func (opts *UpdateOrganizationInvitationByIdOpts) initClient() func() error { +func (opts *updateOrganizationInvitationByIdOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateOrganizationInvitationByIdOpts) Run(ctx context.Context) error { +func (opts *updateOrganizationInvitationByIdOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationInvitationByIdApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, - } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params).Execute() if err != nil { @@ -781,15 +777,15 @@ func (opts *UpdateOrganizationInvitationByIdOpts) Run(ctx context.Context) error return opts.Print(resp) } -func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { +func updateOrganizationInvitationByIdBuilder() *cobra.Command { const template = "<>" - opts := UpdateOrganizationInvitationByIdOpts{} + opts := updateOrganizationInvitationByIdOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationInvitationById", + Use: "updateOrganizationInvitationById", Short: "Update One Organization Invitation by Invitation ID", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -801,34 +797,32 @@ func UpdateOrganizationInvitationByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } -type UpdateOrganizationSettingsOpts struct { + +type updateOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string } -func (opts *UpdateOrganizationSettingsOpts) initClient() func() error { +func (opts *updateOrganizationSettingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateOrganizationSettingsOpts) Run(ctx context.Context) error { +func (opts *updateOrganizationSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, - } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params).Execute() if err != nil { @@ -838,15 +832,15 @@ func (opts *UpdateOrganizationSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateOrganizationSettingsBuilder() *cobra.Command { +func updateOrganizationSettingsBuilder() *cobra.Command { const template = "<>" - opts := UpdateOrganizationSettingsOpts{} + opts := updateOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationSettings", + Use: "updateOrganizationSettings", Short: "Update Settings for One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -858,35 +852,33 @@ func UpdateOrganizationSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -func OrganizationsBuilder() *cobra.Command { +func organizationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "organizations", - Short: "Returns, adds, and edits organizational units in MongoDB Cloud.", + Use: "organizations", + Short: `Returns, adds, and edits organizational units in MongoDB Cloud.`, } cmd.AddCommand( - CreateOrganizationBuilder(), - CreateOrganizationInvitationBuilder(), - DeleteOrganizationBuilder(), - DeleteOrganizationInvitationBuilder(), - GetOrganizationBuilder(), - GetOrganizationInvitationBuilder(), - GetOrganizationSettingsBuilder(), - ListOrganizationInvitationsBuilder(), - ListOrganizationProjectsBuilder(), - ListOrganizationUsersBuilder(), - ListOrganizationsBuilder(), - RenameOrganizationBuilder(), - UpdateOrganizationInvitationBuilder(), - UpdateOrganizationInvitationByIdBuilder(), - UpdateOrganizationSettingsBuilder(), + createOrganizationBuilder(), + createOrganizationInvitationBuilder(), + deleteOrganizationBuilder(), + deleteOrganizationInvitationBuilder(), + getOrganizationBuilder(), + getOrganizationInvitationBuilder(), + getOrganizationSettingsBuilder(), + listOrganizationInvitationsBuilder(), + listOrganizationProjectsBuilder(), + listOrganizationUsersBuilder(), + listOrganizationsBuilder(), + renameOrganizationBuilder(), + updateOrganizationInvitationBuilder(), + updateOrganizationInvitationByIdBuilder(), + updateOrganizationSettingsBuilder(), ) return cmd } - diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index 149c16bc64..db15db24f0 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -18,30 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type DisableSlowOperationThresholdingOpts struct { +type disableSlowOperationThresholdingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *DisableSlowOperationThresholdingOpts) initClient() func() error { +func (opts *disableSlowOperationThresholdingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DisableSlowOperationThresholdingOpts) Run(ctx context.Context) error { +func (opts *disableSlowOperationThresholdingOpts) Run(ctx context.Context) error { params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } @@ -53,15 +51,15 @@ func (opts *DisableSlowOperationThresholdingOpts) Run(ctx context.Context) error return opts.Print(nil) } -func DisableSlowOperationThresholdingBuilder() *cobra.Command { +func disableSlowOperationThresholdingBuilder() *cobra.Command { const template = "<>" - opts := DisableSlowOperationThresholdingOpts{} + opts := disableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ - Use: "disableSlowOperationThresholding", + Use: "disableSlowOperationThresholding", Short: "Disable Managed Slow Operation Threshold", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,27 +71,30 @@ func DisableSlowOperationThresholdingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type EnableSlowOperationThresholdingOpts struct { + +type enableSlowOperationThresholdingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *EnableSlowOperationThresholdingOpts) initClient() func() error { +func (opts *enableSlowOperationThresholdingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *EnableSlowOperationThresholdingOpts) Run(ctx context.Context) error { +func (opts *enableSlowOperationThresholdingOpts) Run(ctx context.Context) error { params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } @@ -105,15 +106,15 @@ func (opts *EnableSlowOperationThresholdingOpts) Run(ctx context.Context) error return opts.Print(nil) } -func EnableSlowOperationThresholdingBuilder() *cobra.Command { +func enableSlowOperationThresholdingBuilder() *cobra.Command { const template = "<>" - opts := EnableSlowOperationThresholdingOpts{} + opts := enableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ - Use: "enableSlowOperationThresholding", + Use: "enableSlowOperationThresholding", Short: "Enable Managed Slow Operation Threshold", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -125,39 +126,42 @@ func EnableSlowOperationThresholdingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListSlowQueriesOpts struct { + +type listSlowQueriesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - processId string - duration int64 + client *admin.APIClient + groupId string + processId string + duration int64 namespaces []string - nLogs int64 - since int64 + nLogs int64 + since int64 } -func (opts *ListSlowQueriesOpts) initClient() func() error { +func (opts *listSlowQueriesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListSlowQueriesOpts) Run(ctx context.Context) error { +func (opts *listSlowQueriesOpts) Run(ctx context.Context) error { params := &admin.ListSlowQueriesApiParams{ - GroupId: opts.groupId, - ProcessId: opts.processId, - Duration: &opts.duration, + GroupId: opts.groupId, + ProcessId: opts.processId, + Duration: &opts.duration, Namespaces: &opts.namespaces, - NLogs: &opts.nLogs, - Since: &opts.since, + NLogs: &opts.nLogs, + Since: &opts.since, } resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueriesWithParams(ctx, params).Execute() if err != nil { @@ -167,15 +171,15 @@ func (opts *ListSlowQueriesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListSlowQueriesBuilder() *cobra.Command { +func listSlowQueriesBuilder() *cobra.Command { const template = "<>" - opts := ListSlowQueriesOpts{} + opts := listSlowQueriesOpts{} cmd := &cobra.Command{ - Use: "listSlowQueries", + Use: "listSlowQueries", Short: "Return Slow Queries", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -187,41 +191,50 @@ func ListSlowQueriesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().Int64Var(&opts.duration, "duration", 0, "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") - cmd.Flags().Int64Var(&opts.nLogs, "nLogs", 20000, "Maximum number of lines from the log to return.") - cmd.Flags().Int64Var(&opts.since, "since", 0, "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. + +- If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. +- If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.`) + cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, `Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.`) + cmd.Flags().Int64Var(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) + cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + +- If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. +- If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } -type ListSlowQueryNamespacesOpts struct { + +type listSlowQueryNamespacesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string processId string - duration int64 - since int64 + duration int64 + since int64 } -func (opts *ListSlowQueryNamespacesOpts) initClient() func() error { +func (opts *listSlowQueryNamespacesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListSlowQueryNamespacesOpts) Run(ctx context.Context) error { +func (opts *listSlowQueryNamespacesOpts) Run(ctx context.Context) error { params := &admin.ListSlowQueryNamespacesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ProcessId: opts.processId, - Duration: &opts.duration, - Since: &opts.since, + Duration: &opts.duration, + Since: &opts.since, } resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(ctx, params).Execute() if err != nil { @@ -231,15 +244,15 @@ func (opts *ListSlowQueryNamespacesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListSlowQueryNamespacesBuilder() *cobra.Command { +func listSlowQueryNamespacesBuilder() *cobra.Command { const template = "<>" - opts := ListSlowQueryNamespacesOpts{} + opts := listSlowQueryNamespacesOpts{} cmd := &cobra.Command{ - Use: "listSlowQueryNamespaces", + Use: "listSlowQueryNamespaces", Short: "Return All Namespaces for One Host", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -251,51 +264,60 @@ func ListSlowQueryNamespacesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().Int64Var(&opts.duration, "duration", 0, "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().Int64Var(&opts.since, "since", 0, "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. + +- If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. +- If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.`) + cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + +- If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. +- If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } -type ListSuggestedIndexesOpts struct { + +type listSuggestedIndexesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - processId string + client *admin.APIClient + groupId string + processId string includeCount bool itemsPerPage int - pageNum int - duration int64 - namespaces []string - nExamples int64 - nIndexes int64 - since int64 + pageNum int + duration int64 + namespaces []string + nExamples int64 + nIndexes int64 + since int64 } -func (opts *ListSuggestedIndexesOpts) initClient() func() error { +func (opts *listSuggestedIndexesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListSuggestedIndexesOpts) Run(ctx context.Context) error { +func (opts *listSuggestedIndexesOpts) Run(ctx context.Context) error { params := &admin.ListSuggestedIndexesApiParams{ - GroupId: opts.groupId, - ProcessId: opts.processId, + GroupId: opts.groupId, + ProcessId: opts.processId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Duration: &opts.duration, - Namespaces: &opts.namespaces, - NExamples: &opts.nExamples, - NIndexes: &opts.nIndexes, - Since: &opts.since, + PageNum: &opts.pageNum, + Duration: &opts.duration, + Namespaces: &opts.namespaces, + NExamples: &opts.nExamples, + NIndexes: &opts.nIndexes, + Since: &opts.since, } resp, _, err := opts.client.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(ctx, params).Execute() if err != nil { @@ -305,15 +327,15 @@ func (opts *ListSuggestedIndexesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListSuggestedIndexesBuilder() *cobra.Command { +func listSuggestedIndexesBuilder() *cobra.Command { const template = "<>" - opts := ListSuggestedIndexesOpts{} + opts := listSuggestedIndexesOpts{} cmd := &cobra.Command{ - Use: "listSuggestedIndexes", + Use: "listSuggestedIndexes", Short: "Return Suggested Indexes", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -325,34 +347,41 @@ func ListSuggestedIndexesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.processId, "processId", "", "Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().Int64Var(&opts.duration, "duration", 0, "Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.") - cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.") - cmd.Flags().Int64Var(&opts.nExamples, "nExamples", 5, "Maximum number of example queries that benefit from the suggested index.") - cmd.Flags().Int64Var(&opts.nIndexes, "nIndexes", 0, "Number that indicates the maximum indexes to suggest.") - cmd.Flags().Int64Var(&opts.since, "since", 0, "Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. + +- If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. +- If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.`) + cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, `Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.`) + cmd.Flags().Int64Var(&opts.nExamples, "nExamples", 5, `Maximum number of example queries that benefit from the suggested index.`) + cmd.Flags().Int64Var(&opts.nIndexes, "nIndexes", 0, `Number that indicates the maximum indexes to suggest.`) + cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + +- If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. +- If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } -func PerformanceAdvisorBuilder() *cobra.Command { +func performanceAdvisorBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "performanceAdvisor", - Short: "Returns suggested indexes and slow query data for a database deployment. Also enables or disables MongoDB Cloud-managed slow operation thresholds. To view field values in a sample query, you must have the Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted data rather than the field values.", + Use: "performanceAdvisor", + Short: `Returns suggested indexes and slow query data for a database deployment. Also enables or disables MongoDB Cloud-managed slow operation thresholds. To view field values in a sample query, you must have the Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted data rather than the field values.`, } cmd.AddCommand( - DisableSlowOperationThresholdingBuilder(), - EnableSlowOperationThresholdingBuilder(), - ListSlowQueriesBuilder(), - ListSlowQueryNamespacesBuilder(), - ListSuggestedIndexesBuilder(), + disableSlowOperationThresholdingBuilder(), + enableSlowOperationThresholdingBuilder(), + listSlowQueriesBuilder(), + listSlowQueryNamespacesBuilder(), + listSuggestedIndexesBuilder(), ) return cmd } - diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index 9fcef2c9c4..f8ef4e78ae 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -18,38 +18,34 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreatePrivateEndpointOpts struct { +type createPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - cloudProvider string + client *admin.APIClient + groupId string + cloudProvider string endpointServiceId string - } -func (opts *CreatePrivateEndpointOpts) initClient() func() error { +func (opts *createPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreatePrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *createPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.CreatePrivateEndpointApiParams{ - GroupId: opts.groupId, - CloudProvider: opts.cloudProvider, + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, - } resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -59,15 +55,15 @@ func (opts *CreatePrivateEndpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreatePrivateEndpointBuilder() *cobra.Command { +func createPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := CreatePrivateEndpointOpts{} + opts := createPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "createPrivateEndpoint", + Use: "createPrivateEndpoint", Short: "Create One Private Endpoint for One Provider", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -79,36 +75,36 @@ func CreatePrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } -type CreatePrivateEndpointServiceOpts struct { + +type createPrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreatePrivateEndpointServiceOpts) initClient() func() error { +func (opts *createPrivateEndpointServiceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreatePrivateEndpointServiceOpts) Run(ctx context.Context) error { +func (opts *createPrivateEndpointServiceOpts) Run(ctx context.Context) error { params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { @@ -118,15 +114,15 @@ func (opts *CreatePrivateEndpointServiceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreatePrivateEndpointServiceBuilder() *cobra.Command { +func createPrivateEndpointServiceBuilder() *cobra.Command { const template = "<>" - opts := CreatePrivateEndpointServiceOpts{} + opts := createPrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "createPrivateEndpointService", + Use: "createPrivateEndpointService", Short: "Create One Private Endpoint Service for One Provider", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -138,35 +134,37 @@ func CreatePrivateEndpointServiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeletePrivateEndpointOpts struct { + +type deletePrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - cloudProvider string - endpointId string + client *admin.APIClient + groupId string + cloudProvider string + endpointId string endpointServiceId string } -func (opts *DeletePrivateEndpointOpts) initClient() func() error { +func (opts *deletePrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeletePrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *deletePrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.DeletePrivateEndpointApiParams{ - GroupId: opts.groupId, - CloudProvider: opts.cloudProvider, - EndpointId: opts.endpointId, + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + EndpointId: opts.endpointId, EndpointServiceId: opts.endpointServiceId, } resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(ctx, params).Execute() @@ -177,15 +175,15 @@ func (opts *DeletePrivateEndpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeletePrivateEndpointBuilder() *cobra.Command { +func deletePrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := DeletePrivateEndpointOpts{} + opts := deletePrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "deletePrivateEndpoint", + Use: "deletePrivateEndpoint", Short: "Remove One Private Endpoint for One Provider", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -197,10 +195,12 @@ func DeletePrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -208,27 +208,28 @@ func DeletePrivateEndpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } -type DeletePrivateEndpointServiceOpts struct { + +type deletePrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - cloudProvider string + client *admin.APIClient + groupId string + cloudProvider string endpointServiceId string } -func (opts *DeletePrivateEndpointServiceOpts) initClient() func() error { +func (opts *deletePrivateEndpointServiceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeletePrivateEndpointServiceOpts) Run(ctx context.Context) error { +func (opts *deletePrivateEndpointServiceOpts) Run(ctx context.Context) error { params := &admin.DeletePrivateEndpointServiceApiParams{ - GroupId: opts.groupId, - CloudProvider: opts.cloudProvider, + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(ctx, params).Execute() @@ -239,15 +240,15 @@ func (opts *DeletePrivateEndpointServiceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeletePrivateEndpointServiceBuilder() *cobra.Command { +func deletePrivateEndpointServiceBuilder() *cobra.Command { const template = "<>" - opts := DeletePrivateEndpointServiceOpts{} + opts := deletePrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "deletePrivateEndpointService", + Use: "deletePrivateEndpointService", Short: "Remove One Private Endpoint Service for One Provider", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -259,38 +260,41 @@ func DeletePrivateEndpointServiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint service.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } -type GetPrivateEndpointOpts struct { + +type getPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - cloudProvider string - endpointId string + client *admin.APIClient + groupId string + cloudProvider string + endpointId string endpointServiceId string } -func (opts *GetPrivateEndpointOpts) initClient() func() error { +func (opts *getPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *getPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.GetPrivateEndpointApiParams{ - GroupId: opts.groupId, - CloudProvider: opts.cloudProvider, - EndpointId: opts.endpointId, + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, + EndpointId: opts.endpointId, EndpointServiceId: opts.endpointServiceId, } resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(ctx, params).Execute() @@ -301,15 +305,15 @@ func (opts *GetPrivateEndpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetPrivateEndpointBuilder() *cobra.Command { +func getPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := GetPrivateEndpointOpts{} + opts := getPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "getPrivateEndpoint", + Use: "getPrivateEndpoint", Short: "Return One Private Endpoint for One Provider", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -321,10 +325,12 @@ func GetPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -332,27 +338,28 @@ func GetPrivateEndpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } -type GetPrivateEndpointServiceOpts struct { + +type getPrivateEndpointServiceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - cloudProvider string + client *admin.APIClient + groupId string + cloudProvider string endpointServiceId string } -func (opts *GetPrivateEndpointServiceOpts) initClient() func() error { +func (opts *getPrivateEndpointServiceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetPrivateEndpointServiceOpts) Run(ctx context.Context) error { +func (opts *getPrivateEndpointServiceOpts) Run(ctx context.Context) error { params := &admin.GetPrivateEndpointServiceApiParams{ - GroupId: opts.groupId, - CloudProvider: opts.cloudProvider, + GroupId: opts.groupId, + CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(ctx, params).Execute() @@ -363,15 +370,15 @@ func (opts *GetPrivateEndpointServiceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetPrivateEndpointServiceBuilder() *cobra.Command { +func getPrivateEndpointServiceBuilder() *cobra.Command { const template = "<>" - opts := GetPrivateEndpointServiceOpts{} + opts := getPrivateEndpointServiceOpts{} cmd := &cobra.Command{ - Use: "getPrivateEndpointService", + Use: "getPrivateEndpointService", Short: "Return One Private Endpoint Service for One Provider", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -383,31 +390,34 @@ func GetPrivateEndpointServiceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint service.") - cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", "Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) + cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd } -type GetRegionalizedPrivateEndpointSettingOpts struct { + +type getRegionalizedPrivateEndpointSettingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetRegionalizedPrivateEndpointSettingOpts) initClient() func() error { +func (opts *getRegionalizedPrivateEndpointSettingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { +func (opts *getRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, } @@ -419,15 +429,15 @@ func (opts *GetRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) return opts.Print(resp) } -func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { +func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { const template = "<>" - opts := GetRegionalizedPrivateEndpointSettingOpts{} + opts := getRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ - Use: "getRegionalizedPrivateEndpointSetting", + Use: "getRegionalizedPrivateEndpointSetting", Short: "Return Regionalized Private Endpoint Status", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -439,30 +449,33 @@ func GetRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListPrivateEndpointServicesOpts struct { + +type listPrivateEndpointServicesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string cloudProvider string } -func (opts *ListPrivateEndpointServicesOpts) initClient() func() error { +func (opts *listPrivateEndpointServicesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListPrivateEndpointServicesOpts) Run(ctx context.Context) error { +func (opts *listPrivateEndpointServicesOpts) Run(ctx context.Context) error { params := &admin.ListPrivateEndpointServicesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, CloudProvider: opts.cloudProvider, } resp, _, err := opts.client.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(ctx, params).Execute() @@ -473,15 +486,15 @@ func (opts *ListPrivateEndpointServicesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListPrivateEndpointServicesBuilder() *cobra.Command { +func listPrivateEndpointServicesBuilder() *cobra.Command { const template = "<>" - opts := ListPrivateEndpointServicesOpts{} + opts := listPrivateEndpointServicesOpts{} cmd := &cobra.Command{ - Use: "listPrivateEndpointServices", + Use: "listPrivateEndpointServices", Short: "Return All Private Endpoint Services for One Provider", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -493,33 +506,34 @@ func ListPrivateEndpointServicesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", "Cloud service provider that manages this private endpoint service.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") return cmd } -type ToggleRegionalizedPrivateEndpointSettingOpts struct { + +type toggleRegionalizedPrivateEndpointSettingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) initClient() func() error { +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { params := &admin.ToggleRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() if err != nil { @@ -529,15 +543,15 @@ func (opts *ToggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Contex return opts.Print(resp) } -func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { +func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { const template = "<>" - opts := ToggleRegionalizedPrivateEndpointSettingOpts{} + opts := toggleRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ - Use: "toggleRegionalizedPrivateEndpointSetting", + Use: "toggleRegionalizedPrivateEndpointSetting", Short: "Toggle Regionalized Private Endpoint Status", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -549,29 +563,29 @@ func ToggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func PrivateEndpointServicesBuilder() *cobra.Command { +func privateEndpointServicesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "privateEndpointServices", - Short: "Returns, adds, edits, and removes private endpoint services.", + Use: "privateEndpointServices", + Short: `Returns, adds, edits, and removes private endpoint services.`, } cmd.AddCommand( - CreatePrivateEndpointBuilder(), - CreatePrivateEndpointServiceBuilder(), - DeletePrivateEndpointBuilder(), - DeletePrivateEndpointServiceBuilder(), - GetPrivateEndpointBuilder(), - GetPrivateEndpointServiceBuilder(), - GetRegionalizedPrivateEndpointSettingBuilder(), - ListPrivateEndpointServicesBuilder(), - ToggleRegionalizedPrivateEndpointSettingBuilder(), + createPrivateEndpointBuilder(), + createPrivateEndpointServiceBuilder(), + deletePrivateEndpointBuilder(), + deletePrivateEndpointServiceBuilder(), + getPrivateEndpointBuilder(), + getPrivateEndpointServiceBuilder(), + getRegionalizedPrivateEndpointSettingBuilder(), + listPrivateEndpointServicesBuilder(), + toggleRegionalizedPrivateEndpointSettingBuilder(), ) return cmd } - diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index ca36612e57..2cb819bb19 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type AddProjectApiKeyOpts struct { +type addProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string apiUserId string - } -func (opts *AddProjectApiKeyOpts) initClient() func() error { +func (opts *addProjectApiKeyOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *AddProjectApiKeyOpts) Run(ctx context.Context) error { +func (opts *addProjectApiKeyOpts) Run(ctx context.Context) error { params := &admin.AddProjectApiKeyApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ApiUserId: opts.apiUserId, - } resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *AddProjectApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func AddProjectApiKeyBuilder() *cobra.Command { +func addProjectApiKeyBuilder() *cobra.Command { const template = "<>" - opts := AddProjectApiKeyOpts{} + opts := addProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "addProjectApiKey", + Use: "addProjectApiKey", Short: "Assign One Organization API Key to One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,34 +73,34 @@ func AddProjectApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -type CreateApiKeyOpts struct { + +type createApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string } -func (opts *CreateApiKeyOpts) initClient() func() error { +func (opts *createApiKeyOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateApiKeyOpts) Run(ctx context.Context) error { +func (opts *createApiKeyOpts) Run(ctx context.Context) error { params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, - } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -114,15 +110,15 @@ func (opts *CreateApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateApiKeyBuilder() *cobra.Command { +func createApiKeyBuilder() *cobra.Command { const template = "<>" - opts := CreateApiKeyOpts{} + opts := createApiKeyOpts{} cmd := &cobra.Command{ - Use: "createApiKey", + Use: "createApiKey", Short: "Create One Organization API Key", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -134,40 +130,40 @@ func CreateApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type CreateApiKeyAccessListOpts struct { + +type createApiKeyAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string apiUserId string - + includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *CreateApiKeyAccessListOpts) initClient() func() error { +func (opts *createApiKeyAccessListOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateApiKeyAccessListOpts) Run(ctx context.Context) error { +func (opts *createApiKeyAccessListOpts) Run(ctx context.Context) error { params := &admin.CreateApiKeyAccessListApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, ApiUserId: opts.apiUserId, - + IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params).Execute() if err != nil { @@ -177,15 +173,15 @@ func (opts *CreateApiKeyAccessListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateApiKeyAccessListBuilder() *cobra.Command { +func createApiKeyAccessListBuilder() *cobra.Command { const template = "<>" - opts := CreateApiKeyAccessListOpts{} + opts := createApiKeyAccessListOpts{} cmd := &cobra.Command{ - Use: "createApiKeyAccessList", + Use: "createApiKeyAccessList", Short: "Create Access List Entries for One Organization API Key", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -197,37 +193,36 @@ func CreateApiKeyAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.") - - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.`) + + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -type CreateProjectApiKeyOpts struct { + +type createProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateProjectApiKeyOpts) initClient() func() error { +func (opts *createProjectApiKeyOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateProjectApiKeyOpts) Run(ctx context.Context) error { +func (opts *createProjectApiKeyOpts) Run(ctx context.Context) error { params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -237,15 +232,15 @@ func (opts *CreateProjectApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateProjectApiKeyBuilder() *cobra.Command { +func createProjectApiKeyBuilder() *cobra.Command { const template = "<>" - opts := CreateProjectApiKeyOpts{} + opts := createProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "createProjectApiKey", + Use: "createProjectApiKey", Short: "Create and Assign One Organization API Key to One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -257,31 +252,33 @@ func CreateProjectApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteApiKeyOpts struct { + +type deleteApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string apiUserId string } -func (opts *DeleteApiKeyOpts) initClient() func() error { +func (opts *deleteApiKeyOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteApiKeyOpts) Run(ctx context.Context) error { +func (opts *deleteApiKeyOpts) Run(ctx context.Context) error { params := &admin.DeleteApiKeyApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, ApiUserId: opts.apiUserId, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(ctx, params).Execute() @@ -292,15 +289,15 @@ func (opts *DeleteApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteApiKeyBuilder() *cobra.Command { +func deleteApiKeyBuilder() *cobra.Command { const template = "<>" - opts := DeleteApiKeyOpts{} + opts := deleteApiKeyOpts{} cmd := &cobra.Command{ - Use: "deleteApiKey", + Use: "deleteApiKey", Short: "Remove One Organization API Key", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -312,33 +309,34 @@ func DeleteApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -type DeleteApiKeyAccessListEntryOpts struct { + +type deleteApiKeyAccessListEntryOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string apiUserId string ipAddress string } -func (opts *DeleteApiKeyAccessListEntryOpts) initClient() func() error { +func (opts *deleteApiKeyAccessListEntryOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteApiKeyAccessListEntryOpts) Run(ctx context.Context) error { +func (opts *deleteApiKeyAccessListEntryOpts) Run(ctx context.Context) error { params := &admin.DeleteApiKeyAccessListEntryApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, ApiUserId: opts.apiUserId, IpAddress: opts.ipAddress, } @@ -350,15 +348,15 @@ func (opts *DeleteApiKeyAccessListEntryOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { +func deleteApiKeyAccessListEntryBuilder() *cobra.Command { const template = "<>" - opts := DeleteApiKeyAccessListEntryOpts{} + opts := deleteApiKeyAccessListEntryOpts{} cmd := &cobra.Command{ - Use: "deleteApiKeyAccessListEntry", + Use: "deleteApiKeyAccessListEntry", Short: "Remove One Access List Entry for One Organization API Key", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -370,34 +368,35 @@ func DeleteApiKeyAccessListEntryBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.`) + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") _ = cmd.MarkFlagRequired("ipAddress") return cmd } -type GetApiKeyOpts struct { + +type getApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string apiUserId string } -func (opts *GetApiKeyOpts) initClient() func() error { +func (opts *getApiKeyOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetApiKeyOpts) Run(ctx context.Context) error { +func (opts *getApiKeyOpts) Run(ctx context.Context) error { params := &admin.GetApiKeyApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, ApiUserId: opts.apiUserId, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyWithParams(ctx, params).Execute() @@ -408,15 +407,15 @@ func (opts *GetApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetApiKeyBuilder() *cobra.Command { +func getApiKeyBuilder() *cobra.Command { const template = "<>" - opts := GetApiKeyOpts{} + opts := getApiKeyOpts{} cmd := &cobra.Command{ - Use: "getApiKey", + Use: "getApiKey", Short: "Return One Organization API Key", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -428,33 +427,34 @@ func GetApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -type GetApiKeyAccessListOpts struct { + +type getApiKeyAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string ipAddress string apiUserId string } -func (opts *GetApiKeyAccessListOpts) initClient() func() error { +func (opts *getApiKeyAccessListOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetApiKeyAccessListOpts) Run(ctx context.Context) error { +func (opts *getApiKeyAccessListOpts) Run(ctx context.Context) error { params := &admin.GetApiKeyAccessListApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IpAddress: opts.ipAddress, ApiUserId: opts.apiUserId, } @@ -466,15 +466,15 @@ func (opts *GetApiKeyAccessListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetApiKeyAccessListBuilder() *cobra.Command { +func getApiKeyAccessListBuilder() *cobra.Command { const template = "<>" - opts := GetApiKeyAccessListOpts{} + opts := getApiKeyAccessListOpts{} cmd := &cobra.Command{ - Use: "getApiKeyAccessList", + Use: "getApiKeyAccessList", Short: "Return One Access List Entry for One Organization API Key", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -486,41 +486,42 @@ func GetApiKeyAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", "One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("ipAddress") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -type ListApiKeyAccessListsEntriesOpts struct { + +type listApiKeyAccessListsEntriesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string - apiUserId string + client *admin.APIClient + orgId string + apiUserId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListApiKeyAccessListsEntriesOpts) initClient() func() error { +func (opts *listApiKeyAccessListsEntriesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { +func (opts *listApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { params := &admin.ListApiKeyAccessListsEntriesApiParams{ - OrgId: opts.orgId, - ApiUserId: opts.apiUserId, + OrgId: opts.orgId, + ApiUserId: opts.apiUserId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(ctx, params).Execute() if err != nil { @@ -530,15 +531,15 @@ func (opts *ListApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { +func listApiKeyAccessListsEntriesBuilder() *cobra.Command { const template = "<>" - opts := ListApiKeyAccessListsEntriesOpts{} + opts := listApiKeyAccessListsEntriesOpts{} cmd := &cobra.Command{ - Use: "listApiKeyAccessListsEntries", + Use: "listApiKeyAccessListsEntries", Short: "Return All Access List Entries for One Organization API Key", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -550,40 +551,41 @@ func ListApiKeyAccessListsEntriesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -type ListApiKeysOpts struct { + +type listApiKeysOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListApiKeysOpts) initClient() func() error { +func (opts *listApiKeysOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListApiKeysOpts) Run(ctx context.Context) error { +func (opts *listApiKeysOpts) Run(ctx context.Context) error { params := &admin.ListApiKeysApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeysWithParams(ctx, params).Execute() if err != nil { @@ -593,15 +595,15 @@ func (opts *ListApiKeysOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListApiKeysBuilder() *cobra.Command { +func listApiKeysBuilder() *cobra.Command { const template = "<>" - opts := ListApiKeysOpts{} + opts := listApiKeysOpts{} cmd := &cobra.Command{ - Use: "listApiKeys", + Use: "listApiKeys", Short: "Return All Organization API Keys", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -613,38 +615,39 @@ func ListApiKeysBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListProjectApiKeysOpts struct { + +type listProjectApiKeysOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListProjectApiKeysOpts) initClient() func() error { +func (opts *listProjectApiKeysOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListProjectApiKeysOpts) Run(ctx context.Context) error { +func (opts *listProjectApiKeysOpts) Run(ctx context.Context) error { params := &admin.ListProjectApiKeysApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(ctx, params).Execute() if err != nil { @@ -654,15 +657,15 @@ func (opts *ListProjectApiKeysOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListProjectApiKeysBuilder() *cobra.Command { +func listProjectApiKeysBuilder() *cobra.Command { const template = "<>" - opts := ListProjectApiKeysOpts{} + opts := listProjectApiKeysOpts{} cmd := &cobra.Command{ - Use: "listProjectApiKeys", + Use: "listProjectApiKeys", Short: "Return All Organization API Keys Assigned to One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -674,33 +677,36 @@ func ListProjectApiKeysBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type RemoveProjectApiKeyOpts struct { + +type removeProjectApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string apiUserId string } -func (opts *RemoveProjectApiKeyOpts) initClient() func() error { +func (opts *removeProjectApiKeyOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *RemoveProjectApiKeyOpts) Run(ctx context.Context) error { +func (opts *removeProjectApiKeyOpts) Run(ctx context.Context) error { params := &admin.RemoveProjectApiKeyApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ApiUserId: opts.apiUserId, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(ctx, params).Execute() @@ -711,15 +717,15 @@ func (opts *RemoveProjectApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func RemoveProjectApiKeyBuilder() *cobra.Command { +func removeProjectApiKeyBuilder() *cobra.Command { const template = "<>" - opts := RemoveProjectApiKeyOpts{} + opts := removeProjectApiKeyOpts{} cmd := &cobra.Command{ - Use: "removeProjectApiKey", + Use: "removeProjectApiKey", Short: "Unassign One Organization API Key from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -731,35 +737,36 @@ func RemoveProjectApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -type UpdateApiKeyOpts struct { + +type updateApiKeyOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string apiUserId string - } -func (opts *UpdateApiKeyOpts) initClient() func() error { +func (opts *updateApiKeyOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateApiKeyOpts) Run(ctx context.Context) error { +func (opts *updateApiKeyOpts) Run(ctx context.Context) error { params := &admin.UpdateApiKeyApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, ApiUserId: opts.apiUserId, - } resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -769,15 +776,15 @@ func (opts *UpdateApiKeyOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateApiKeyBuilder() *cobra.Command { +func updateApiKeyBuilder() *cobra.Command { const template = "<>" - opts := UpdateApiKeyOpts{} + opts := updateApiKeyOpts{} cmd := &cobra.Command{ - Use: "updateApiKey", + Use: "updateApiKey", Short: "Update One Organization API Key", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -789,40 +796,40 @@ func UpdateApiKeyBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key you want to update.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key you want to update.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -type UpdateApiKeyRolesOpts struct { + +type updateApiKeyRolesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string apiUserId string - - pageNum int + + pageNum int itemsPerPage int includeCount bool } -func (opts *UpdateApiKeyRolesOpts) initClient() func() error { +func (opts *updateApiKeyRolesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateApiKeyRolesOpts) Run(ctx context.Context) error { +func (opts *updateApiKeyRolesOpts) Run(ctx context.Context) error { params := &admin.UpdateApiKeyRolesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ApiUserId: opts.apiUserId, - - PageNum: &opts.pageNum, + + PageNum: &opts.pageNum, ItemsPerPage: &opts.itemsPerPage, IncludeCount: &opts.includeCount, } @@ -834,15 +841,15 @@ func (opts *UpdateApiKeyRolesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateApiKeyRolesBuilder() *cobra.Command { +func updateApiKeyRolesBuilder() *cobra.Command { const template = "<>" - opts := UpdateApiKeyRolesOpts{} + opts := updateApiKeyRolesOpts{} cmd := &cobra.Command{ - Use: "updateApiKeyRoles", + Use: "updateApiKeyRoles", Short: "Update Roles of One Organization API Key to One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -854,39 +861,40 @@ func UpdateApiKeyRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", "Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.") - - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) + + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } -func ProgrammaticAPIKeysBuilder() *cobra.Command { +func programmaticAPIKeysBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "programmaticAPIKeys", - Short: "Returns, adds, edits, and removes access tokens to use the MongoDB Cloud API. MongoDB Cloud applies these keys to organizations. These resources can return, assign, or revoke use of these keys within a specified project.", + Use: "programmaticAPIKeys", + Short: `Returns, adds, edits, and removes access tokens to use the MongoDB Cloud API. MongoDB Cloud applies these keys to organizations. These resources can return, assign, or revoke use of these keys within a specified project.`, } cmd.AddCommand( - AddProjectApiKeyBuilder(), - CreateApiKeyBuilder(), - CreateApiKeyAccessListBuilder(), - CreateProjectApiKeyBuilder(), - DeleteApiKeyBuilder(), - DeleteApiKeyAccessListEntryBuilder(), - GetApiKeyBuilder(), - GetApiKeyAccessListBuilder(), - ListApiKeyAccessListsEntriesBuilder(), - ListApiKeysBuilder(), - ListProjectApiKeysBuilder(), - RemoveProjectApiKeyBuilder(), - UpdateApiKeyBuilder(), - UpdateApiKeyRolesBuilder(), + addProjectApiKeyBuilder(), + createApiKeyBuilder(), + createApiKeyAccessListBuilder(), + createProjectApiKeyBuilder(), + deleteApiKeyBuilder(), + deleteApiKeyAccessListEntryBuilder(), + getApiKeyBuilder(), + getApiKeyAccessListBuilder(), + listApiKeyAccessListsEntriesBuilder(), + listApiKeysBuilder(), + listProjectApiKeysBuilder(), + removeProjectApiKeyBuilder(), + updateApiKeyBuilder(), + updateApiKeyRolesBuilder(), ) return cmd } - diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index 7738032cb3..36c044a94b 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -18,40 +18,38 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateProjectIpAccessListOpts struct { +type createProjectIpAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *CreateProjectIpAccessListOpts) initClient() func() error { +func (opts *createProjectIpAccessListOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateProjectIpAccessListOpts) Run(ctx context.Context) error { +func (opts *createProjectIpAccessListOpts) Run(ctx context.Context) error { params := &admin.CreateProjectIpAccessListApiParams{ GroupId: opts.groupId, - + IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params).Execute() if err != nil { @@ -61,15 +59,15 @@ func (opts *CreateProjectIpAccessListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateProjectIpAccessListBuilder() *cobra.Command { +func createProjectIpAccessListBuilder() *cobra.Command { const template = "<>" - opts := CreateProjectIpAccessListOpts{} + opts := createProjectIpAccessListOpts{} cmd := &cobra.Command{ - Use: "createProjectIpAccessList", + Use: "createProjectIpAccessList", Short: "Add Entries to Project IP Access List", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -81,34 +79,37 @@ func CreateProjectIpAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteProjectIpAccessListOpts struct { + +type deleteProjectIpAccessListOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string entryValue string } -func (opts *DeleteProjectIpAccessListOpts) initClient() func() error { +func (opts *deleteProjectIpAccessListOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteProjectIpAccessListOpts) Run(ctx context.Context) error { +func (opts *deleteProjectIpAccessListOpts) Run(ctx context.Context) error { params := &admin.DeleteProjectIpAccessListApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EntryValue: opts.entryValue, } resp, _, err := opts.client.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(ctx, params).Execute() @@ -119,15 +120,15 @@ func (opts *DeleteProjectIpAccessListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteProjectIpAccessListBuilder() *cobra.Command { +func deleteProjectIpAccessListBuilder() *cobra.Command { const template = "<>" - opts := DeleteProjectIpAccessListOpts{} + opts := deleteProjectIpAccessListOpts{} cmd := &cobra.Command{ - Use: "deleteProjectIpAccessList", + Use: "deleteProjectIpAccessList", Short: "Remove One Entry from One Project IP Access List", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -139,32 +140,39 @@ func DeleteProjectIpAccessListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: - how your application established the connection, - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: + +- how your application established the connection, +- how MongoDB Cloud or the driver using the address behaves, and +- which protocol (like TCP or UDP) the connection uses.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd } -type GetProjectIpAccessListStatusOpts struct { + +type getProjectIpAccessListStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string entryValue string } -func (opts *GetProjectIpAccessListStatusOpts) initClient() func() error { +func (opts *getProjectIpAccessListStatusOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetProjectIpAccessListStatusOpts) Run(ctx context.Context) error { +func (opts *getProjectIpAccessListStatusOpts) Run(ctx context.Context) error { params := &admin.GetProjectIpAccessListStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EntryValue: opts.entryValue, } resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(ctx, params).Execute() @@ -175,15 +183,15 @@ func (opts *GetProjectIpAccessListStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetProjectIpAccessListStatusBuilder() *cobra.Command { +func getProjectIpAccessListStatusBuilder() *cobra.Command { const template = "<>" - opts := GetProjectIpAccessListStatusOpts{} + opts := getProjectIpAccessListStatusOpts{} cmd := &cobra.Command{ - Use: "getProjectIpAccessListStatus", + Use: "getProjectIpAccessListStatus", Short: "Return Status of One Project IP Access List Entry", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -195,32 +203,35 @@ func GetProjectIpAccessListStatusBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "Network address or cloud provider security construct that identifies which project access list entry to be verified.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Network address or cloud provider security construct that identifies which project access list entry to be verified.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd } -type GetProjectIpListOpts struct { + +type getProjectIpListOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string entryValue string } -func (opts *GetProjectIpListOpts) initClient() func() error { +func (opts *getProjectIpListOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetProjectIpListOpts) Run(ctx context.Context) error { +func (opts *getProjectIpListOpts) Run(ctx context.Context) error { params := &admin.GetProjectIpListApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EntryValue: opts.entryValue, } resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpListWithParams(ctx, params).Execute() @@ -231,15 +242,15 @@ func (opts *GetProjectIpListOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetProjectIpListBuilder() *cobra.Command { +func getProjectIpListBuilder() *cobra.Command { const template = "<>" - opts := GetProjectIpListOpts{} + opts := getProjectIpListOpts{} cmd := &cobra.Command{ - Use: "getProjectIpList", + Use: "getProjectIpList", Short: "Return One Project IP Access List Entry", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -251,37 +262,40 @@ func GetProjectIpListBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", "Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd } -type ListProjectIpAccessListsOpts struct { + +type listProjectIpAccessListsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListProjectIpAccessListsOpts) initClient() func() error { +func (opts *listProjectIpAccessListsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListProjectIpAccessListsOpts) Run(ctx context.Context) error { +func (opts *listProjectIpAccessListsOpts) Run(ctx context.Context) error { params := &admin.ListProjectIpAccessListsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(ctx, params).Execute() if err != nil { @@ -291,15 +305,15 @@ func (opts *ListProjectIpAccessListsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListProjectIpAccessListsBuilder() *cobra.Command { +func listProjectIpAccessListsBuilder() *cobra.Command { const template = "<>" - opts := ListProjectIpAccessListsOpts{} + opts := listProjectIpAccessListsOpts{} cmd := &cobra.Command{ - Use: "listProjectIpAccessLists", + Use: "listProjectIpAccessLists", Short: "Return Project IP Access List", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -311,27 +325,28 @@ func ListProjectIpAccessListsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func ProjectIPAccessListBuilder() *cobra.Command { +func projectIPAccessListBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "projectIPAccessList", - Short: "Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period.", + Use: "projectIPAccessList", + Short: `Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period.`, } cmd.AddCommand( - CreateProjectIpAccessListBuilder(), - DeleteProjectIpAccessListBuilder(), - GetProjectIpAccessListStatusBuilder(), - GetProjectIpListBuilder(), - ListProjectIpAccessListsBuilder(), + createProjectIpAccessListBuilder(), + deleteProjectIpAccessListBuilder(), + getProjectIpAccessListStatusBuilder(), + getProjectIpListBuilder(), + listProjectIpAccessListsBuilder(), ) return cmd } - diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 7706f9bac5..389efa5c42 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -18,33 +18,31 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateProjectOpts struct { +type createProjectOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - + projectOwnerId string } -func (opts *CreateProjectOpts) initClient() func() error { +func (opts *createProjectOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateProjectOpts) Run(ctx context.Context) error { +func (opts *createProjectOpts) Run(ctx context.Context) error { params := &admin.CreateProjectApiParams{ - + ProjectOwnerId: &opts.projectOwnerId, } resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params).Execute() @@ -55,15 +53,15 @@ func (opts *CreateProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateProjectBuilder() *cobra.Command { +func createProjectBuilder() *cobra.Command { const template = "<>" - opts := CreateProjectOpts{} + opts := createProjectOpts{} cmd := &cobra.Command{ - Use: "createProject", + Use: "createProject", Short: "Create One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,31 +73,30 @@ func CreateProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - - cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", "Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. ") + + cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. `) return cmd } -type CreateProjectInvitationOpts struct { + +type createProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateProjectInvitationOpts) initClient() func() error { +func (opts *createProjectInvitationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateProjectInvitationOpts) Run(ctx context.Context) error { +func (opts *createProjectInvitationOpts) Run(ctx context.Context) error { params := &admin.CreateProjectInvitationApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params).Execute() if err != nil { @@ -109,15 +106,15 @@ func (opts *CreateProjectInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateProjectInvitationBuilder() *cobra.Command { +func createProjectInvitationBuilder() *cobra.Command { const template = "<>" - opts := CreateProjectInvitationOpts{} + opts := createProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "createProjectInvitation", + Use: "createProjectInvitation", Short: "Invite One MongoDB Cloud User to Join One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -129,28 +126,30 @@ func CreateProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteProjectOpts struct { + +type deleteProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *DeleteProjectOpts) initClient() func() error { +func (opts *deleteProjectOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteProjectOpts) Run(ctx context.Context) error { +func (opts *deleteProjectOpts) Run(ctx context.Context) error { params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, } @@ -162,15 +161,15 @@ func (opts *DeleteProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteProjectBuilder() *cobra.Command { +func deleteProjectBuilder() *cobra.Command { const template = "<>" - opts := DeleteProjectOpts{} + opts := deleteProjectOpts{} cmd := &cobra.Command{ - Use: "deleteProject", + Use: "deleteProject", Short: "Remove One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -182,30 +181,33 @@ func DeleteProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteProjectInvitationOpts struct { + +type deleteProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string invitationId string } -func (opts *DeleteProjectInvitationOpts) initClient() func() error { +func (opts *deleteProjectInvitationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteProjectInvitationOpts) Run(ctx context.Context) error { +func (opts *deleteProjectInvitationOpts) Run(ctx context.Context) error { params := &admin.DeleteProjectInvitationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, InvitationId: opts.invitationId, } resp, _, err := opts.client.ProjectsApi.DeleteProjectInvitationWithParams(ctx, params).Execute() @@ -216,15 +218,15 @@ func (opts *DeleteProjectInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteProjectInvitationBuilder() *cobra.Command { +func deleteProjectInvitationBuilder() *cobra.Command { const template = "<>" - opts := DeleteProjectInvitationOpts{} + opts := deleteProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "deleteProjectInvitation", + Use: "deleteProjectInvitation", Short: "Cancel One Project Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -236,33 +238,36 @@ func DeleteProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd } -type DeleteProjectLimitOpts struct { + +type deleteProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient limitName string - groupId string + groupId string } -func (opts *DeleteProjectLimitOpts) initClient() func() error { +func (opts *deleteProjectLimitOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteProjectLimitOpts) Run(ctx context.Context) error { +func (opts *deleteProjectLimitOpts) Run(ctx context.Context) error { params := &admin.DeleteProjectLimitApiParams{ LimitName: opts.limitName, - GroupId: opts.groupId, + GroupId: opts.groupId, } resp, _, err := opts.client.ProjectsApi.DeleteProjectLimitWithParams(ctx, params).Execute() if err != nil { @@ -272,15 +277,15 @@ func (opts *DeleteProjectLimitOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteProjectLimitBuilder() *cobra.Command { +func deleteProjectLimitBuilder() *cobra.Command { const template = "<>" - opts := DeleteProjectLimitOpts{} + opts := deleteProjectLimitOpts{} cmd := &cobra.Command{ - Use: "deleteProjectLimit", + Use: "deleteProjectLimit", Short: "Remove One Project Limit", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -292,29 +297,46 @@ func DeleteProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. + +| Limit Name | Description | Default | API Override Limit | +| --- | --- | --- | --- | +| atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | +| atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | +| atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | +| atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | +| atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | +| atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | +| dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | +| dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | +| dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | +| dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | +`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetProjectOpts struct { + +type getProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetProjectOpts) initClient() func() error { +func (opts *getProjectOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetProjectOpts) Run(ctx context.Context) error { +func (opts *getProjectOpts) Run(ctx context.Context) error { params := &admin.GetProjectApiParams{ GroupId: opts.groupId, } @@ -326,15 +348,15 @@ func (opts *GetProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetProjectBuilder() *cobra.Command { +func getProjectBuilder() *cobra.Command { const template = "<>" - opts := GetProjectOpts{} + opts := getProjectOpts{} cmd := &cobra.Command{ - Use: "getProject", + Use: "getProject", Short: "Return One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -346,27 +368,30 @@ func GetProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetProjectByNameOpts struct { + +type getProjectByNameOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupName string } -func (opts *GetProjectByNameOpts) initClient() func() error { +func (opts *getProjectByNameOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetProjectByNameOpts) Run(ctx context.Context) error { +func (opts *getProjectByNameOpts) Run(ctx context.Context) error { params := &admin.GetProjectByNameApiParams{ GroupName: opts.groupName, } @@ -378,15 +403,15 @@ func (opts *GetProjectByNameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetProjectByNameBuilder() *cobra.Command { +func getProjectByNameBuilder() *cobra.Command { const template = "<>" - opts := GetProjectByNameOpts{} + opts := getProjectByNameOpts{} cmd := &cobra.Command{ - Use: "getProjectByName", + Use: "getProjectByName", Short: "Return One Project using Its Name", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -398,30 +423,31 @@ func GetProjectByNameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupName, "groupName", "", "Human-readable label that identifies this project.") + cmd.Flags().StringVar(&opts.groupName, "groupName", "", `Human-readable label that identifies this project.`) _ = cmd.MarkFlagRequired("groupName") return cmd } -type GetProjectInvitationOpts struct { + +type getProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string invitationId string } -func (opts *GetProjectInvitationOpts) initClient() func() error { +func (opts *getProjectInvitationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetProjectInvitationOpts) Run(ctx context.Context) error { +func (opts *getProjectInvitationOpts) Run(ctx context.Context) error { params := &admin.GetProjectInvitationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, InvitationId: opts.invitationId, } resp, _, err := opts.client.ProjectsApi.GetProjectInvitationWithParams(ctx, params).Execute() @@ -432,15 +458,15 @@ func (opts *GetProjectInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetProjectInvitationBuilder() *cobra.Command { +func getProjectInvitationBuilder() *cobra.Command { const template = "<>" - opts := GetProjectInvitationOpts{} + opts := getProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "getProjectInvitation", + Use: "getProjectInvitation", Short: "Return One Project Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -452,33 +478,36 @@ func GetProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd } -type GetProjectLimitOpts struct { + +type getProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient limitName string - groupId string + groupId string } -func (opts *GetProjectLimitOpts) initClient() func() error { +func (opts *getProjectLimitOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetProjectLimitOpts) Run(ctx context.Context) error { +func (opts *getProjectLimitOpts) Run(ctx context.Context) error { params := &admin.GetProjectLimitApiParams{ LimitName: opts.limitName, - GroupId: opts.groupId, + GroupId: opts.groupId, } resp, _, err := opts.client.ProjectsApi.GetProjectLimitWithParams(ctx, params).Execute() if err != nil { @@ -488,15 +517,15 @@ func (opts *GetProjectLimitOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetProjectLimitBuilder() *cobra.Command { +func getProjectLimitBuilder() *cobra.Command { const template = "<>" - opts := GetProjectLimitOpts{} + opts := getProjectLimitOpts{} cmd := &cobra.Command{ - Use: "getProjectLimit", + Use: "getProjectLimit", Short: "Return One Limit for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -508,29 +537,46 @@ func GetProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. + +| Limit Name | Description | Default | API Override Limit | +| --- | --- | --- | --- | +| atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | +| atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | +| atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | +| atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | +| atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | +| atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | +| dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | +| dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | +| dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | +| dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | +`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetProjectSettingsOpts struct { + +type getProjectSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *GetProjectSettingsOpts) initClient() func() error { +func (opts *getProjectSettingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetProjectSettingsOpts) Run(ctx context.Context) error { +func (opts *getProjectSettingsOpts) Run(ctx context.Context) error { params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, } @@ -542,15 +588,15 @@ func (opts *GetProjectSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetProjectSettingsBuilder() *cobra.Command { +func getProjectSettingsBuilder() *cobra.Command { const template = "<>" - opts := GetProjectSettingsOpts{} + opts := getProjectSettingsOpts{} cmd := &cobra.Command{ - Use: "getProjectSettings", + Use: "getProjectSettings", Short: "Return One Project Settings", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -562,30 +608,33 @@ func GetProjectSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListProjectInvitationsOpts struct { + +type listProjectInvitationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string username string } -func (opts *ListProjectInvitationsOpts) initClient() func() error { +func (opts *listProjectInvitationsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListProjectInvitationsOpts) Run(ctx context.Context) error { +func (opts *listProjectInvitationsOpts) Run(ctx context.Context) error { params := &admin.ListProjectInvitationsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, Username: &opts.username, } resp, _, err := opts.client.ProjectsApi.ListProjectInvitationsWithParams(ctx, params).Execute() @@ -596,15 +645,15 @@ func (opts *ListProjectInvitationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListProjectInvitationsBuilder() *cobra.Command { +func listProjectInvitationsBuilder() *cobra.Command { const template = "<>" - opts := ListProjectInvitationsOpts{} + opts := listProjectInvitationsOpts{} cmd := &cobra.Command{ - Use: "listProjectInvitations", + Use: "listProjectInvitations", Short: "Return All Project Invitations", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -616,28 +665,31 @@ func ListProjectInvitationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.username, "username", "", "Email address of the user account invited to this project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this project.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListProjectLimitsOpts struct { + +type listProjectLimitsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *ListProjectLimitsOpts) initClient() func() error { +func (opts *listProjectLimitsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListProjectLimitsOpts) Run(ctx context.Context) error { +func (opts *listProjectLimitsOpts) Run(ctx context.Context) error { params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, } @@ -649,15 +701,15 @@ func (opts *ListProjectLimitsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListProjectLimitsBuilder() *cobra.Command { +func listProjectLimitsBuilder() *cobra.Command { const template = "<>" - opts := ListProjectLimitsOpts{} + opts := listProjectLimitsOpts{} cmd := &cobra.Command{ - Use: "listProjectLimits", + Use: "listProjectLimits", Short: "Return All Limits for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -669,38 +721,41 @@ func ListProjectLimitsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListProjectUsersOpts struct { + +type listProjectUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - includeCount bool - itemsPerPage int - pageNum int - flattenTeams bool + client *admin.APIClient + groupId string + includeCount bool + itemsPerPage int + pageNum int + flattenTeams bool includeOrgUsers bool } -func (opts *ListProjectUsersOpts) initClient() func() error { +func (opts *listProjectUsersOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListProjectUsersOpts) Run(ctx context.Context) error { +func (opts *listProjectUsersOpts) Run(ctx context.Context) error { params := &admin.ListProjectUsersApiParams{ - GroupId: opts.groupId, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - FlattenTeams: &opts.flattenTeams, + GroupId: opts.groupId, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + FlattenTeams: &opts.flattenTeams, IncludeOrgUsers: &opts.includeOrgUsers, } resp, _, err := opts.client.ProjectsApi.ListProjectUsersWithParams(ctx, params).Execute() @@ -711,15 +766,15 @@ func (opts *ListProjectUsersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListProjectUsersBuilder() *cobra.Command { +func listProjectUsersBuilder() *cobra.Command { const template = "<>" - opts := ListProjectUsersOpts{} + opts := listProjectUsersOpts{} cmd := &cobra.Command{ - Use: "listProjectUsers", + Use: "listProjectUsers", Short: "Return All Users in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -731,38 +786,41 @@ func ListProjectUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") - cmd.Flags().BoolVar(&opts.flattenTeams, "flattenTeams", false, "Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `\"flattenTeams\" : false`, this resource returns only users with a role in the project. If `\"flattenTeams\" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.") - cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, "Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `\"includeOrgUsers\": false`, this resource returns only users with a role in the project. If `\"includeOrgUsers\": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().BoolVar(&opts.flattenTeams, "flattenTeams", false, `Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `"flattenTeams" : false`, this resource returns only users with a role in the project. If `"flattenTeams" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.`) + cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, `Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `"includeOrgUsers": false`, this resource returns only users with a role in the project. If `"includeOrgUsers": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListProjectsOpts struct { + +type listProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListProjectsOpts) initClient() func() error { +func (opts *listProjectsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListProjectsOpts) Run(ctx context.Context) error { +func (opts *listProjectsOpts) Run(ctx context.Context) error { params := &admin.ListProjectsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ProjectsApi.ListProjectsWithParams(ctx, params).Execute() if err != nil { @@ -772,15 +830,15 @@ func (opts *ListProjectsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListProjectsBuilder() *cobra.Command { +func listProjectsBuilder() *cobra.Command { const template = "<>" - opts := ListProjectsOpts{} + opts := listProjectsOpts{} cmd := &cobra.Command{ - Use: "listProjects", + Use: "listProjects", Short: "Return All Projects", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -792,32 +850,33 @@ func ListProjectsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) return cmd } -type RemoveProjectUserOpts struct { + +type removeProjectUserOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - userId string + userId string } -func (opts *RemoveProjectUserOpts) initClient() func() error { +func (opts *removeProjectUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *RemoveProjectUserOpts) Run(ctx context.Context) error { +func (opts *removeProjectUserOpts) Run(ctx context.Context) error { params := &admin.RemoveProjectUserApiParams{ GroupId: opts.groupId, - UserId: opts.userId, + UserId: opts.userId, } _, err := opts.client.ProjectsApi.RemoveProjectUserWithParams(ctx, params).Execute() if err != nil { @@ -827,15 +886,15 @@ func (opts *RemoveProjectUserOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func RemoveProjectUserBuilder() *cobra.Command { +func removeProjectUserBuilder() *cobra.Command { const template = "<>" - opts := RemoveProjectUserOpts{} + opts := removeProjectUserOpts{} cmd := &cobra.Command{ - Use: "removeProjectUser", + Use: "removeProjectUser", Short: "Remove One User from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -847,35 +906,36 @@ func RemoveProjectUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.userId, "userId", "", "Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("userId") return cmd } -type SetProjectLimitOpts struct { + +type setProjectLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient limitName string - groupId string - + groupId string } -func (opts *SetProjectLimitOpts) initClient() func() error { +func (opts *setProjectLimitOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *SetProjectLimitOpts) Run(ctx context.Context) error { +func (opts *setProjectLimitOpts) Run(ctx context.Context) error { params := &admin.SetProjectLimitApiParams{ LimitName: opts.limitName, - GroupId: opts.groupId, - + GroupId: opts.groupId, } resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params).Execute() if err != nil { @@ -885,15 +945,15 @@ func (opts *SetProjectLimitOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func SetProjectLimitBuilder() *cobra.Command { +func setProjectLimitBuilder() *cobra.Command { const template = "<>" - opts := SetProjectLimitOpts{} + opts := setProjectLimitOpts{} cmd := &cobra.Command{ - Use: "setProjectLimit", + Use: "setProjectLimit", Short: "Set One Project Limit", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -905,34 +965,48 @@ func SetProjectLimitBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.limitName, "limitName", "", "Human-readable label that identifies this project limit. | Limit Name | Description | Default | API Override Limit | | --- | --- | --- | --- | | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | ") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. + +| Limit Name | Description | Default | API Override Limit | +| --- | --- | --- | --- | +| atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | +| atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | +| atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | +| atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | +| atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | +| atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | +| dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | +| dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | +| dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | +| dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | +`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateProjectOpts struct { + +type updateProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpdateProjectOpts) initClient() func() error { +func (opts *updateProjectOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateProjectOpts) Run(ctx context.Context) error { +func (opts *updateProjectOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params).Execute() if err != nil { @@ -942,15 +1016,15 @@ func (opts *UpdateProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateProjectBuilder() *cobra.Command { +func updateProjectBuilder() *cobra.Command { const template = "<>" - opts := UpdateProjectOpts{} + opts := updateProjectOpts{} cmd := &cobra.Command{ - Use: "updateProject", + Use: "updateProject", Short: "Update One Project Name", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -962,32 +1036,32 @@ func UpdateProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateProjectInvitationOpts struct { + +type updateProjectInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpdateProjectInvitationOpts) initClient() func() error { +func (opts *updateProjectInvitationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateProjectInvitationOpts) Run(ctx context.Context) error { +func (opts *updateProjectInvitationOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectInvitationApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params).Execute() if err != nil { @@ -997,15 +1071,15 @@ func (opts *UpdateProjectInvitationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateProjectInvitationBuilder() *cobra.Command { +func updateProjectInvitationBuilder() *cobra.Command { const template = "<>" - opts := UpdateProjectInvitationOpts{} + opts := updateProjectInvitationOpts{} cmd := &cobra.Command{ - Use: "updateProjectInvitation", + Use: "updateProjectInvitation", Short: "Update One Project Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1017,34 +1091,34 @@ func UpdateProjectInvitationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateProjectInvitationByIdOpts struct { + +type updateProjectInvitationByIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string invitationId string - } -func (opts *UpdateProjectInvitationByIdOpts) initClient() func() error { +func (opts *updateProjectInvitationByIdOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateProjectInvitationByIdOpts) Run(ctx context.Context) error { +func (opts *updateProjectInvitationByIdOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectInvitationByIdApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, InvitationId: opts.invitationId, - } resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params).Execute() if err != nil { @@ -1054,15 +1128,15 @@ func (opts *UpdateProjectInvitationByIdOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateProjectInvitationByIdBuilder() *cobra.Command { +func updateProjectInvitationByIdBuilder() *cobra.Command { const template = "<>" - opts := UpdateProjectInvitationByIdOpts{} + opts := updateProjectInvitationByIdOpts{} cmd := &cobra.Command{ - Use: "updateProjectInvitationById", + Use: "updateProjectInvitationById", Short: "Update One Project Invitation by Invitation ID", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1074,34 +1148,34 @@ func UpdateProjectInvitationByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", "Unique 24-hexadecimal digit string that identifies the invitation.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd } -type UpdateProjectSettingsOpts struct { + +type updateProjectSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *UpdateProjectSettingsOpts) initClient() func() error { +func (opts *updateProjectSettingsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateProjectSettingsOpts) Run(ctx context.Context) error { +func (opts *updateProjectSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateProjectSettingsApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params).Execute() if err != nil { @@ -1111,15 +1185,15 @@ func (opts *UpdateProjectSettingsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateProjectSettingsBuilder() *cobra.Command { +func updateProjectSettingsBuilder() *cobra.Command { const template = "<>" - opts := UpdateProjectSettingsOpts{} + opts := updateProjectSettingsOpts{} cmd := &cobra.Command{ - Use: "updateProjectSettings", + Use: "updateProjectSettings", Short: "Update One Project Settings", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1131,40 +1205,40 @@ func UpdateProjectSettingsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -func ProjectsBuilder() *cobra.Command { +func projectsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "projects", - Short: "Returns, adds, and edits collections of clusters and users in MongoDB Cloud.", + Use: "projects", + Short: `Returns, adds, and edits collections of clusters and users in MongoDB Cloud.`, } cmd.AddCommand( - CreateProjectBuilder(), - CreateProjectInvitationBuilder(), - DeleteProjectBuilder(), - DeleteProjectInvitationBuilder(), - DeleteProjectLimitBuilder(), - GetProjectBuilder(), - GetProjectByNameBuilder(), - GetProjectInvitationBuilder(), - GetProjectLimitBuilder(), - GetProjectSettingsBuilder(), - ListProjectInvitationsBuilder(), - ListProjectLimitsBuilder(), - ListProjectUsersBuilder(), - ListProjectsBuilder(), - RemoveProjectUserBuilder(), - SetProjectLimitBuilder(), - UpdateProjectBuilder(), - UpdateProjectInvitationBuilder(), - UpdateProjectInvitationByIdBuilder(), - UpdateProjectSettingsBuilder(), + createProjectBuilder(), + createProjectInvitationBuilder(), + deleteProjectBuilder(), + deleteProjectInvitationBuilder(), + deleteProjectLimitBuilder(), + getProjectBuilder(), + getProjectByNameBuilder(), + getProjectInvitationBuilder(), + getProjectLimitBuilder(), + getProjectSettingsBuilder(), + listProjectInvitationsBuilder(), + listProjectLimitsBuilder(), + listProjectUsersBuilder(), + listProjectsBuilder(), + removeProjectUserBuilder(), + setProjectLimitBuilder(), + updateProjectBuilder(), + updateProjectInvitationBuilder(), + updateProjectInvitationByIdBuilder(), + updateProjectSettingsBuilder(), ) return cmd } - diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index 7a241db3c9..aefdb791cc 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateRollingIndexOpts struct { +type createRollingIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - } -func (opts *CreateRollingIndexOpts) initClient() func() error { +func (opts *createRollingIndexOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateRollingIndexOpts) Run(ctx context.Context) error { +func (opts *createRollingIndexOpts) Run(ctx context.Context) error { params := &admin.CreateRollingIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - } _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateRollingIndexOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func CreateRollingIndexBuilder() *cobra.Command { +func createRollingIndexBuilder() *cobra.Command { const template = "<>" - opts := CreateRollingIndexOpts{} + opts := createRollingIndexOpts{} cmd := &cobra.Command{ - Use: "createRollingIndex", + Use: "createRollingIndex", Short: "Create One Rolling Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,23 +73,23 @@ func CreateRollingIndexBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -func RollingIndexBuilder() *cobra.Command { +func rollingIndexBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "rollingIndex", - Short: "Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.", + Use: "rollingIndex", + Short: `Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.`, } cmd.AddCommand( - CreateRollingIndexBuilder(), + createRollingIndexBuilder(), ) return cmd } - diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index 07d1d8c545..ccad983c9f 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -18,31 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type GetSystemStatusOpts struct { +type getSystemStatusOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient } -func (opts *GetSystemStatusOpts) initClient() func() error { +func (opts *getSystemStatusOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetSystemStatusOpts) Run(ctx context.Context) error { - params := &admin.GetSystemStatusApiParams{ - } +func (opts *getSystemStatusOpts) Run(ctx context.Context) error { + params := &admin.GetSystemStatusApiParams{} resp, _, err := opts.client.RootApi.GetSystemStatusWithParams(ctx, params).Execute() if err != nil { return err @@ -51,15 +48,15 @@ func (opts *GetSystemStatusOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetSystemStatusBuilder() *cobra.Command { +func getSystemStatusBuilder() *cobra.Command { const template = "<>" - opts := GetSystemStatusOpts{} + opts := getSystemStatusOpts{} cmd := &cobra.Command{ - Use: "getSystemStatus", + Use: "getSystemStatus", Short: "Return the status of this MongoDB application", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,14 +72,13 @@ func GetSystemStatusBuilder() *cobra.Command { return cmd } -func RootBuilder() *cobra.Command { +func rootBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "root", - Short: "Returns details that describe the MongoDB Cloud build and the access token that requests this resource. This starts the MongoDB Cloud API.", + Use: "root", + Short: `Returns details that describe the MongoDB Cloud build and the access token that requests this resource. This starts the MongoDB Cloud API.`, } cmd.AddCommand( - GetSystemStatusBuilder(), + getSystemStatusBuilder(), ) return cmd } - diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index 06a761be33..f05091d1ad 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateServerlessInstanceOpts struct { +type createServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *CreateServerlessInstanceOpts) initClient() func() error { +func (opts *createServerlessInstanceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateServerlessInstanceOpts) Run(ctx context.Context) error { +func (opts *createServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *CreateServerlessInstanceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateServerlessInstanceBuilder() *cobra.Command { +func createServerlessInstanceBuilder() *cobra.Command { const template = "<>" - opts := CreateServerlessInstanceOpts{} + opts := createServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "createServerlessInstance", + Use: "createServerlessInstance", Short: "Create One Serverless Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,32 +71,34 @@ func CreateServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteServerlessInstanceOpts struct { + +type deleteServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } -func (opts *DeleteServerlessInstanceOpts) initClient() func() error { +func (opts *deleteServerlessInstanceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteServerlessInstanceOpts) Run(ctx context.Context) error { +func (opts *deleteServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -110,15 +108,15 @@ func (opts *DeleteServerlessInstanceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteServerlessInstanceBuilder() *cobra.Command { +func deleteServerlessInstanceBuilder() *cobra.Command { const template = "<>" - opts := DeleteServerlessInstanceOpts{} + opts := deleteServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "deleteServerlessInstance", + Use: "deleteServerlessInstance", Short: "Remove One Serverless Instance from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -130,33 +128,36 @@ func DeleteServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } -type GetServerlessInstanceOpts struct { + +type getServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } -func (opts *GetServerlessInstanceOpts) initClient() func() error { +func (opts *getServerlessInstanceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetServerlessInstanceOpts) Run(ctx context.Context) error { +func (opts *getServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -166,15 +167,15 @@ func (opts *GetServerlessInstanceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetServerlessInstanceBuilder() *cobra.Command { +func getServerlessInstanceBuilder() *cobra.Command { const template = "<>" - opts := GetServerlessInstanceOpts{} + opts := getServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "getServerlessInstance", + Use: "getServerlessInstance", Short: "Return One Serverless Instance from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -186,37 +187,40 @@ func GetServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label that identifies the serverless instance.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } -type ListServerlessInstancesOpts struct { + +type listServerlessInstancesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListServerlessInstancesOpts) initClient() func() error { +func (opts *listServerlessInstancesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListServerlessInstancesOpts) Run(ctx context.Context) error { +func (opts *listServerlessInstancesOpts) Run(ctx context.Context) error { params := &admin.ListServerlessInstancesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params).Execute() if err != nil { @@ -226,15 +230,15 @@ func (opts *ListServerlessInstancesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListServerlessInstancesBuilder() *cobra.Command { +func listServerlessInstancesBuilder() *cobra.Command { const template = "<>" - opts := ListServerlessInstancesOpts{} + opts := listServerlessInstancesOpts{} cmd := &cobra.Command{ - Use: "listServerlessInstances", + Use: "listServerlessInstances", Short: "Return All Serverless Instances from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -246,36 +250,37 @@ func ListServerlessInstancesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateServerlessInstanceOpts struct { + +type updateServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string - + name string } -func (opts *UpdateServerlessInstanceOpts) initClient() func() error { +func (opts *updateServerlessInstanceOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateServerlessInstanceOpts) Run(ctx context.Context) error { +func (opts *updateServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.UpdateServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, - + Name: opts.name, } resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -285,15 +290,15 @@ func (opts *UpdateServerlessInstanceOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateServerlessInstanceBuilder() *cobra.Command { +func updateServerlessInstanceBuilder() *cobra.Command { const template = "<>" - opts := UpdateServerlessInstanceOpts{} + opts := updateServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "updateServerlessInstance", + Use: "updateServerlessInstance", Short: "Update One Serverless Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -305,27 +310,27 @@ func UpdateServerlessInstanceBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.name, "name", "", "Human-readable label that identifies the serverless instance.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } -func ServerlessInstancesBuilder() *cobra.Command { +func serverlessInstancesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "serverlessInstances", - Short: "Returns, adds, edits, and removes serverless instances.", + Use: "serverlessInstances", + Short: `Returns, adds, edits, and removes serverless instances.`, } cmd.AddCommand( - CreateServerlessInstanceBuilder(), - DeleteServerlessInstanceBuilder(), - GetServerlessInstanceBuilder(), - ListServerlessInstancesBuilder(), - UpdateServerlessInstanceBuilder(), + createServerlessInstanceBuilder(), + deleteServerlessInstanceBuilder(), + getServerlessInstanceBuilder(), + listServerlessInstancesBuilder(), + updateServerlessInstanceBuilder(), ) return cmd } - diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index 2554f45d4c..21aaa0b03f 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateServerlessPrivateEndpointOpts struct { +type createServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string instanceName string - } -func (opts *CreateServerlessPrivateEndpointOpts) initClient() func() error { +func (opts *createServerlessPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateServerlessPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *createServerlessPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.CreateServerlessPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, InstanceName: opts.instanceName, - } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateServerlessPrivateEndpointOpts) Run(ctx context.Context) error return opts.Print(resp) } -func CreateServerlessPrivateEndpointBuilder() *cobra.Command { +func createServerlessPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := CreateServerlessPrivateEndpointOpts{} + opts := createServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "createServerlessPrivateEndpoint", + Use: "createServerlessPrivateEndpoint", Short: "Create One Private Endpoint for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,36 +73,38 @@ func CreateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") return cmd } -type DeleteServerlessPrivateEndpointOpts struct { + +type deleteServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string instanceName string - endpointId string + endpointId string } -func (opts *DeleteServerlessPrivateEndpointOpts) initClient() func() error { +func (opts *deleteServerlessPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteServerlessPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *deleteServerlessPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.DeleteServerlessPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, InstanceName: opts.instanceName, - EndpointId: opts.endpointId, + EndpointId: opts.endpointId, } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -116,15 +114,15 @@ func (opts *DeleteServerlessPrivateEndpointOpts) Run(ctx context.Context) error return opts.Print(resp) } -func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { +func deleteServerlessPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := DeleteServerlessPrivateEndpointOpts{} + opts := deleteServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "deleteServerlessPrivateEndpoint", + Use: "deleteServerlessPrivateEndpoint", Short: "Remove One Private Endpoint for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,37 +134,40 @@ func DeleteServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.`) + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") return cmd } -type GetServerlessPrivateEndpointOpts struct { + +type getServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string instanceName string - endpointId string + endpointId string } -func (opts *GetServerlessPrivateEndpointOpts) initClient() func() error { +func (opts *getServerlessPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetServerlessPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *getServerlessPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.GetServerlessPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, InstanceName: opts.instanceName, - EndpointId: opts.endpointId, + EndpointId: opts.endpointId, } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -176,15 +177,15 @@ func (opts *GetServerlessPrivateEndpointOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetServerlessPrivateEndpointBuilder() *cobra.Command { +func getServerlessPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := GetServerlessPrivateEndpointOpts{} + opts := getServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "getServerlessPrivateEndpoint", + Use: "getServerlessPrivateEndpoint", Short: "Return One Private Endpoint for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -196,34 +197,37 @@ func GetServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 24-hexadecimal digit string that identifies the tenant endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") return cmd } -type ListServerlessPrivateEndpointsOpts struct { + +type listServerlessPrivateEndpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string instanceName string } -func (opts *ListServerlessPrivateEndpointsOpts) initClient() func() error { +func (opts *listServerlessPrivateEndpointsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListServerlessPrivateEndpointsOpts) Run(ctx context.Context) error { +func (opts *listServerlessPrivateEndpointsOpts) Run(ctx context.Context) error { params := &admin.ListServerlessPrivateEndpointsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, InstanceName: opts.instanceName, } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(ctx, params).Execute() @@ -234,15 +238,15 @@ func (opts *ListServerlessPrivateEndpointsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListServerlessPrivateEndpointsBuilder() *cobra.Command { +func listServerlessPrivateEndpointsBuilder() *cobra.Command { const template = "<>" - opts := ListServerlessPrivateEndpointsOpts{} + opts := listServerlessPrivateEndpointsOpts{} cmd := &cobra.Command{ - Use: "listServerlessPrivateEndpoints", + Use: "listServerlessPrivateEndpoints", Short: "Return All Private Endpoints for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -254,37 +258,38 @@ func ListServerlessPrivateEndpointsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance associated with the tenant endpoint.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") return cmd } -type UpdateServerlessPrivateEndpointOpts struct { + +type updateServerlessPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string instanceName string - endpointId string - + endpointId string } -func (opts *UpdateServerlessPrivateEndpointOpts) initClient() func() error { +func (opts *updateServerlessPrivateEndpointOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateServerlessPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *updateServerlessPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.UpdateServerlessPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, InstanceName: opts.instanceName, - EndpointId: opts.endpointId, - + EndpointId: opts.endpointId, } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -294,15 +299,15 @@ func (opts *UpdateServerlessPrivateEndpointOpts) Run(ctx context.Context) error return opts.Print(resp) } -func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { +func updateServerlessPrivateEndpointBuilder() *cobra.Command { const template = "<>" - opts := UpdateServerlessPrivateEndpointOpts{} + opts := updateServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "updateServerlessPrivateEndpoint", + Use: "updateServerlessPrivateEndpoint", Short: "Update One Private Endpoint for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -314,10 +319,11 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", "Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", "Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.`) + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") @@ -325,18 +331,17 @@ func UpdateServerlessPrivateEndpointBuilder() *cobra.Command { return cmd } -func ServerlessPrivateEndpointsBuilder() *cobra.Command { +func serverlessPrivateEndpointsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "serverlessPrivateEndpoints", - Short: "Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial.", + Use: "serverlessPrivateEndpoints", + Short: `Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial.`, } cmd.AddCommand( - CreateServerlessPrivateEndpointBuilder(), - DeleteServerlessPrivateEndpointBuilder(), - GetServerlessPrivateEndpointBuilder(), - ListServerlessPrivateEndpointsBuilder(), - UpdateServerlessPrivateEndpointBuilder(), + createServerlessPrivateEndpointBuilder(), + deleteServerlessPrivateEndpointBuilder(), + getServerlessPrivateEndpointBuilder(), + listServerlessPrivateEndpointsBuilder(), + updateServerlessPrivateEndpointBuilder(), ) return cmd } - diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index 0b13bf95a3..a0a1e62fc3 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateSharedClusterBackupRestoreJobOpts struct { +type createSharedClusterBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient clusterName string - groupId string - + groupId string } -func (opts *CreateSharedClusterBackupRestoreJobOpts) initClient() func() error { +func (opts *createSharedClusterBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *createSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, - GroupId: opts.groupId, - + GroupId: opts.groupId, } resp, _, err := opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) er return opts.Print(resp) } -func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { +func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := CreateSharedClusterBackupRestoreJobOpts{} + opts := createSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createSharedClusterBackupRestoreJob", + Use: "createSharedClusterBackupRestoreJob", Short: "Create One Restore Job from One M2 or M5 Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,36 +73,38 @@ func CreateSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetSharedClusterBackupRestoreJobOpts struct { + +type getSharedClusterBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient clusterName string - groupId string - restoreId string + groupId string + restoreId string } -func (opts *GetSharedClusterBackupRestoreJobOpts) initClient() func() error { +func (opts *getSharedClusterBackupRestoreJobOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *getSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.GetSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, - GroupId: opts.groupId, - RestoreId: opts.restoreId, + GroupId: opts.groupId, + RestoreId: opts.restoreId, } resp, _, err := opts.client.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -116,15 +114,15 @@ func (opts *GetSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error return opts.Print(resp) } -func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { +func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { const template = "<>" - opts := GetSharedClusterBackupRestoreJobOpts{} + opts := getSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getSharedClusterBackupRestoreJob", + Use: "getSharedClusterBackupRestoreJob", Short: "Return One Restore Job for One M2 or M5 Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,35 +134,38 @@ func GetSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", "Unique 24-hexadecimal digit string that identifies the restore job to return.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("restoreId") return cmd } -type ListSharedClusterBackupRestoreJobsOpts struct { + +type listSharedClusterBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient clusterName string - groupId string + groupId string } -func (opts *ListSharedClusterBackupRestoreJobsOpts) initClient() func() error { +func (opts *listSharedClusterBackupRestoreJobsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context) error { +func (opts *listSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListSharedClusterBackupRestoreJobsApiParams{ ClusterName: opts.clusterName, - GroupId: opts.groupId, + GroupId: opts.groupId, } resp, _, err := opts.client.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -174,15 +175,15 @@ func (opts *ListSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context) err return opts.Print(resp) } -func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { +func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { const template = "<>" - opts := ListSharedClusterBackupRestoreJobsOpts{} + opts := listSharedClusterBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listSharedClusterBackupRestoreJobs", + Use: "listSharedClusterBackupRestoreJobs", Short: "Return All Restore Jobs for One M2 or M5 Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -194,24 +195,25 @@ func ListSharedClusterBackupRestoreJobsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd } -func SharedTierRestoreJobsBuilder() *cobra.Command { +func sharedTierRestoreJobsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "sharedTierRestoreJobs", - Short: "Returns and adds restore jobs for shared-tier database deployments.", + Use: "sharedTierRestoreJobs", + Short: `Returns and adds restore jobs for shared-tier database deployments.`, } cmd.AddCommand( - CreateSharedClusterBackupRestoreJobBuilder(), - GetSharedClusterBackupRestoreJobBuilder(), - ListSharedClusterBackupRestoreJobsBuilder(), + createSharedClusterBackupRestoreJobBuilder(), + getSharedClusterBackupRestoreJobBuilder(), + listSharedClusterBackupRestoreJobsBuilder(), ) return cmd } - diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index 68a0f20447..1b0e535bb5 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type DownloadSharedClusterBackupOpts struct { +type downloadSharedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient clusterName string - groupId string - + groupId string } -func (opts *DownloadSharedClusterBackupOpts) initClient() func() error { +func (opts *downloadSharedClusterBackupOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DownloadSharedClusterBackupOpts) Run(ctx context.Context) error { +func (opts *downloadSharedClusterBackupOpts) Run(ctx context.Context) error { params := &admin.DownloadSharedClusterBackupApiParams{ ClusterName: opts.clusterName, - GroupId: opts.groupId, - + GroupId: opts.groupId, } resp, _, err := opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *DownloadSharedClusterBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DownloadSharedClusterBackupBuilder() *cobra.Command { +func downloadSharedClusterBackupBuilder() *cobra.Command { const template = "<>" - opts := DownloadSharedClusterBackupOpts{} + opts := downloadSharedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "downloadSharedClusterBackup", + Use: "downloadSharedClusterBackup", Short: "Download One M2 or M5 Cluster Snapshot", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,36 +73,38 @@ func DownloadSharedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetSharedClusterBackupOpts struct { + +type getSharedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } -func (opts *GetSharedClusterBackupOpts) initClient() func() error { +func (opts *getSharedClusterBackupOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetSharedClusterBackupOpts) Run(ctx context.Context) error { +func (opts *getSharedClusterBackupOpts) Run(ctx context.Context) error { params := &admin.GetSharedClusterBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(ctx, params).Execute() if err != nil { @@ -116,15 +114,15 @@ func (opts *GetSharedClusterBackupOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetSharedClusterBackupBuilder() *cobra.Command { +func getSharedClusterBackupBuilder() *cobra.Command { const template = "<>" - opts := GetSharedClusterBackupOpts{} + opts := getSharedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "getSharedClusterBackup", + Use: "getSharedClusterBackup", Short: "Return One Snapshot for One M2 or M5 Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,34 +134,37 @@ func GetSharedClusterBackupBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", "Unique 24-hexadecimal digit string that identifies the desired snapshot.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } -type ListSharedClusterBackupsOpts struct { + +type listSharedClusterBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } -func (opts *ListSharedClusterBackupsOpts) initClient() func() error { +func (opts *listSharedClusterBackupsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListSharedClusterBackupsOpts) Run(ctx context.Context) error { +func (opts *listSharedClusterBackupsOpts) Run(ctx context.Context) error { params := &admin.ListSharedClusterBackupsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(ctx, params).Execute() @@ -174,15 +175,15 @@ func (opts *ListSharedClusterBackupsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListSharedClusterBackupsBuilder() *cobra.Command { +func listSharedClusterBackupsBuilder() *cobra.Command { const template = "<>" - opts := ListSharedClusterBackupsOpts{} + opts := listSharedClusterBackupsOpts{} cmd := &cobra.Command{ - Use: "listSharedClusterBackups", + Use: "listSharedClusterBackups", Short: "Return All Snapshots for One M2 or M5 Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -194,24 +195,25 @@ func ListSharedClusterBackupsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", "Human-readable label that identifies the cluster.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } -func SharedTierSnapshotsBuilder() *cobra.Command { +func sharedTierSnapshotsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "sharedTierSnapshots", - Short: "Returns and requests to download shared-tier database deployment snapshots.", + Use: "sharedTierSnapshots", + Short: `Returns and requests to download shared-tier database deployment snapshots.`, } cmd.AddCommand( - DownloadSharedClusterBackupBuilder(), - GetSharedClusterBackupBuilder(), - ListSharedClusterBackupsBuilder(), + downloadSharedClusterBackupBuilder(), + getSharedClusterBackupBuilder(), + listSharedClusterBackupsBuilder(), ) return cmd } - diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 9810f583b2..d230858f50 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -18,34 +18,30 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type AddAllTeamsToProjectOpts struct { +type addAllTeamsToProjectOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - } -func (opts *AddAllTeamsToProjectOpts) initClient() func() error { +func (opts *addAllTeamsToProjectOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *AddAllTeamsToProjectOpts) Run(ctx context.Context) error { +func (opts *addAllTeamsToProjectOpts) Run(ctx context.Context) error { params := &admin.AddAllTeamsToProjectApiParams{ GroupId: opts.groupId, - } resp, _, err := opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params).Execute() if err != nil { @@ -55,15 +51,15 @@ func (opts *AddAllTeamsToProjectOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func AddAllTeamsToProjectBuilder() *cobra.Command { +func addAllTeamsToProjectBuilder() *cobra.Command { const template = "<>" - opts := AddAllTeamsToProjectOpts{} + opts := addAllTeamsToProjectOpts{} cmd := &cobra.Command{ - Use: "addAllTeamsToProject", + Use: "addAllTeamsToProject", Short: "Add One or More Teams to One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,34 +71,34 @@ func AddAllTeamsToProjectBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type AddTeamUserOpts struct { + +type addTeamUserOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string teamId string - } -func (opts *AddTeamUserOpts) initClient() func() error { +func (opts *addTeamUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *AddTeamUserOpts) Run(ctx context.Context) error { +func (opts *addTeamUserOpts) Run(ctx context.Context) error { params := &admin.AddTeamUserApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, TeamId: opts.teamId, - } resp, _, err := opts.client.TeamsApi.AddTeamUserWithParams(ctx, params).Execute() if err != nil { @@ -112,15 +108,15 @@ func (opts *AddTeamUserOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func AddTeamUserBuilder() *cobra.Command { +func addTeamUserBuilder() *cobra.Command { const template = "<>" - opts := AddTeamUserOpts{} + opts := addTeamUserOpts{} cmd := &cobra.Command{ - Use: "addTeamUser", + Use: "addTeamUser", Short: "Assign MongoDB Cloud Users from One Organization to One Team", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -132,34 +128,32 @@ func AddTeamUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } -type CreateTeamOpts struct { + +type createTeamOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string } -func (opts *CreateTeamOpts) initClient() func() error { +func (opts *createTeamOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateTeamOpts) Run(ctx context.Context) error { +func (opts *createTeamOpts) Run(ctx context.Context) error { params := &admin.CreateTeamApiParams{ OrgId: opts.orgId, - } resp, _, err := opts.client.TeamsApi.CreateTeamWithParams(ctx, params).Execute() if err != nil { @@ -169,15 +163,15 @@ func (opts *CreateTeamOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateTeamBuilder() *cobra.Command { +func createTeamBuilder() *cobra.Command { const template = "<>" - opts := CreateTeamOpts{} + opts := createTeamOpts{} cmd := &cobra.Command{ - Use: "createTeam", + Use: "createTeam", Short: "Create One Team in One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -189,31 +183,31 @@ func CreateTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type DeleteTeamOpts struct { + +type deleteTeamOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string teamId string } -func (opts *DeleteTeamOpts) initClient() func() error { +func (opts *deleteTeamOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteTeamOpts) Run(ctx context.Context) error { +func (opts *deleteTeamOpts) Run(ctx context.Context) error { params := &admin.DeleteTeamApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, TeamId: opts.teamId, } resp, _, err := opts.client.TeamsApi.DeleteTeamWithParams(ctx, params).Execute() @@ -224,15 +218,15 @@ func (opts *DeleteTeamOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteTeamBuilder() *cobra.Command { +func deleteTeamBuilder() *cobra.Command { const template = "<>" - opts := DeleteTeamOpts{} + opts := deleteTeamOpts{} cmd := &cobra.Command{ - Use: "deleteTeam", + Use: "deleteTeam", Short: "Remove One Team from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -244,32 +238,33 @@ func DeleteTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team that you want to delete.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to delete.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } -type GetTeamByIdOpts struct { + +type getTeamByIdOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string teamId string } -func (opts *GetTeamByIdOpts) initClient() func() error { +func (opts *getTeamByIdOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetTeamByIdOpts) Run(ctx context.Context) error { +func (opts *getTeamByIdOpts) Run(ctx context.Context) error { params := &admin.GetTeamByIdApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, TeamId: opts.teamId, } resp, _, err := opts.client.TeamsApi.GetTeamByIdWithParams(ctx, params).Execute() @@ -280,15 +275,15 @@ func (opts *GetTeamByIdOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetTeamByIdBuilder() *cobra.Command { +func getTeamByIdBuilder() *cobra.Command { const template = "<>" - opts := GetTeamByIdOpts{} + opts := getTeamByIdOpts{} cmd := &cobra.Command{ - Use: "getTeamById", + Use: "getTeamById", Short: "Return One Team using its ID", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -300,32 +295,33 @@ func GetTeamByIdBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team whose information you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose information you want to return.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } -type GetTeamByNameOpts struct { + +type getTeamByNameOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string teamName string } -func (opts *GetTeamByNameOpts) initClient() func() error { +func (opts *getTeamByNameOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetTeamByNameOpts) Run(ctx context.Context) error { +func (opts *getTeamByNameOpts) Run(ctx context.Context) error { params := &admin.GetTeamByNameApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, TeamName: opts.teamName, } resp, _, err := opts.client.TeamsApi.GetTeamByNameWithParams(ctx, params).Execute() @@ -336,15 +332,15 @@ func (opts *GetTeamByNameOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetTeamByNameBuilder() *cobra.Command { +func getTeamByNameBuilder() *cobra.Command { const template = "<>" - opts := GetTeamByNameOpts{} + opts := getTeamByNameOpts{} cmd := &cobra.Command{ - Use: "getTeamByName", + Use: "getTeamByName", Short: "Return One Team using its Name", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -356,37 +352,38 @@ func GetTeamByNameBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamName, "teamName", "", "Name of the team whose information you want to return.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.teamName, "teamName", "", `Name of the team whose information you want to return.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamName") return cmd } -type ListOrganizationTeamsOpts struct { + +type listOrganizationTeamsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string itemsPerPage int includeCount bool - pageNum int + pageNum int } -func (opts *ListOrganizationTeamsOpts) initClient() func() error { +func (opts *listOrganizationTeamsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListOrganizationTeamsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationTeamsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationTeamsApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, ItemsPerPage: &opts.itemsPerPage, IncludeCount: &opts.includeCount, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.TeamsApi.ListOrganizationTeamsWithParams(ctx, params).Execute() if err != nil { @@ -396,15 +393,15 @@ func (opts *ListOrganizationTeamsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListOrganizationTeamsBuilder() *cobra.Command { +func listOrganizationTeamsBuilder() *cobra.Command { const template = "<>" - opts := ListOrganizationTeamsOpts{} + opts := listOrganizationTeamsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationTeams", + Use: "listOrganizationTeams", Short: "Return All Teams in One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -416,38 +413,39 @@ func ListOrganizationTeamsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("orgId") return cmd } -type ListProjectTeamsOpts struct { + +type listProjectTeamsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListProjectTeamsOpts) initClient() func() error { +func (opts *listProjectTeamsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListProjectTeamsOpts) Run(ctx context.Context) error { +func (opts *listProjectTeamsOpts) Run(ctx context.Context) error { params := &admin.ListProjectTeamsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.TeamsApi.ListProjectTeamsWithParams(ctx, params).Execute() if err != nil { @@ -457,15 +455,15 @@ func (opts *ListProjectTeamsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListProjectTeamsBuilder() *cobra.Command { +func listProjectTeamsBuilder() *cobra.Command { const template = "<>" - opts := ListProjectTeamsOpts{} + opts := listProjectTeamsOpts{} cmd := &cobra.Command{ - Use: "listProjectTeams", + Use: "listProjectTeams", Short: "Return All Teams in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -477,38 +475,41 @@ func ListProjectTeamsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListTeamUsersOpts struct { + +type listTeamUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string - teamId string + client *admin.APIClient + orgId string + teamId string itemsPerPage int - pageNum int + pageNum int } -func (opts *ListTeamUsersOpts) initClient() func() error { +func (opts *listTeamUsersOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListTeamUsersOpts) Run(ctx context.Context) error { +func (opts *listTeamUsersOpts) Run(ctx context.Context) error { params := &admin.ListTeamUsersApiParams{ - OrgId: opts.orgId, - TeamId: opts.teamId, + OrgId: opts.orgId, + TeamId: opts.teamId, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.TeamsApi.ListTeamUsersWithParams(ctx, params).Execute() if err != nil { @@ -518,15 +519,15 @@ func (opts *ListTeamUsersOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListTeamUsersBuilder() *cobra.Command { +func listTeamUsersBuilder() *cobra.Command { const template = "<>" - opts := ListTeamUsersOpts{} + opts := listTeamUsersOpts{} cmd := &cobra.Command{ - Use: "listTeamUsers", + Use: "listTeamUsers", Short: "Return All MongoDB Cloud Users Assigned to One Team", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -538,35 +539,36 @@ func ListTeamUsersBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } -type RemoveProjectTeamOpts struct { + +type removeProjectTeamOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - teamId string + teamId string } -func (opts *RemoveProjectTeamOpts) initClient() func() error { +func (opts *removeProjectTeamOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *RemoveProjectTeamOpts) Run(ctx context.Context) error { +func (opts *removeProjectTeamOpts) Run(ctx context.Context) error { params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, - TeamId: opts.teamId, + TeamId: opts.teamId, } resp, _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params).Execute() if err != nil { @@ -576,15 +578,15 @@ func (opts *RemoveProjectTeamOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func RemoveProjectTeamBuilder() *cobra.Command { +func removeProjectTeamBuilder() *cobra.Command { const template = "<>" - opts := RemoveProjectTeamOpts{} + opts := removeProjectTeamOpts{} cmd := &cobra.Command{ - Use: "removeProjectTeam", + Use: "removeProjectTeam", Short: "Remove One Team from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -596,33 +598,36 @@ func RemoveProjectTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") return cmd } -type RemoveTeamUserOpts struct { + +type removeTeamUserOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string teamId string userId string } -func (opts *RemoveTeamUserOpts) initClient() func() error { +func (opts *removeTeamUserOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *RemoveTeamUserOpts) Run(ctx context.Context) error { +func (opts *removeTeamUserOpts) Run(ctx context.Context) error { params := &admin.RemoveTeamUserApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, TeamId: opts.teamId, UserId: opts.userId, } @@ -634,15 +639,15 @@ func (opts *RemoveTeamUserOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func RemoveTeamUserBuilder() *cobra.Command { +func removeTeamUserBuilder() *cobra.Command { const template = "<>" - opts := RemoveTeamUserOpts{} + opts := removeTeamUserOpts{} cmd := &cobra.Command{ - Use: "removeTeamUser", + Use: "removeTeamUser", Short: "Remove One MongoDB Cloud User from One Team", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -654,37 +659,36 @@ func RemoveTeamUserBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.") - cmd.Flags().StringVar(&opts.userId, "userId", "", "Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.") + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.`) + cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") _ = cmd.MarkFlagRequired("userId") return cmd } -type RenameTeamOpts struct { + +type renameTeamOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string teamId string - } -func (opts *RenameTeamOpts) initClient() func() error { +func (opts *renameTeamOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *RenameTeamOpts) Run(ctx context.Context) error { +func (opts *renameTeamOpts) Run(ctx context.Context) error { params := &admin.RenameTeamApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, TeamId: opts.teamId, - } resp, _, err := opts.client.TeamsApi.RenameTeamWithParams(ctx, params).Execute() if err != nil { @@ -694,15 +698,15 @@ func (opts *RenameTeamOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func RenameTeamBuilder() *cobra.Command { +func renameTeamBuilder() *cobra.Command { const template = "<>" - opts := RenameTeamOpts{} + opts := renameTeamOpts{} cmd := &cobra.Command{ - Use: "renameTeam", + Use: "renameTeam", Short: "Rename One Team", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -714,36 +718,34 @@ func RenameTeamBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", "Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team that you want to rename.") - + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to rename.`) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } -type UpdateTeamRolesOpts struct { + +type updateTeamRolesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - teamId string - + teamId string } -func (opts *UpdateTeamRolesOpts) initClient() func() error { +func (opts *updateTeamRolesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateTeamRolesOpts) Run(ctx context.Context) error { +func (opts *updateTeamRolesOpts) Run(ctx context.Context) error { params := &admin.UpdateTeamRolesApiParams{ GroupId: opts.groupId, - TeamId: opts.teamId, - + TeamId: opts.teamId, } resp, _, err := opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params).Execute() if err != nil { @@ -753,15 +755,15 @@ func (opts *UpdateTeamRolesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateTeamRolesBuilder() *cobra.Command { +func updateTeamRolesBuilder() *cobra.Command { const template = "<>" - opts := UpdateTeamRolesOpts{} + opts := updateTeamRolesOpts{} cmd := &cobra.Command{ - Use: "updateTeamRoles", + Use: "updateTeamRoles", Short: "Update Team Roles in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -773,35 +775,35 @@ func UpdateTeamRolesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", "Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") return cmd } -func TeamsBuilder() *cobra.Command { +func teamsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "teams", - Short: "Returns, adds, edits, or removes teams.", + Use: "teams", + Short: `Returns, adds, edits, or removes teams.`, } cmd.AddCommand( - AddAllTeamsToProjectBuilder(), - AddTeamUserBuilder(), - CreateTeamBuilder(), - DeleteTeamBuilder(), - GetTeamByIdBuilder(), - GetTeamByNameBuilder(), - ListOrganizationTeamsBuilder(), - ListProjectTeamsBuilder(), - ListTeamUsersBuilder(), - RemoveProjectTeamBuilder(), - RemoveTeamUserBuilder(), - RenameTeamBuilder(), - UpdateTeamRolesBuilder(), + addAllTeamsToProjectBuilder(), + addTeamUserBuilder(), + createTeamBuilder(), + deleteTeamBuilder(), + getTeamByIdBuilder(), + getTeamByNameBuilder(), + listOrganizationTeamsBuilder(), + listProjectTeamsBuilder(), + listTeamUsersBuilder(), + removeProjectTeamBuilder(), + removeTeamUserBuilder(), + renameTeamBuilder(), + updateTeamRolesBuilder(), ) return cmd } - diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index a2151cb3a2..5215f69c8d 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -18,30 +18,28 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type VersionedExampleOpts struct { +type versionedExampleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient additionalInfo bool } -func (opts *VersionedExampleOpts) initClient() func() error { +func (opts *versionedExampleOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *VersionedExampleOpts) Run(ctx context.Context) error { +func (opts *versionedExampleOpts) Run(ctx context.Context) error { params := &admin.VersionedExampleApiParams{ AdditionalInfo: &opts.additionalInfo, } @@ -53,15 +51,15 @@ func (opts *VersionedExampleOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func VersionedExampleBuilder() *cobra.Command { +func versionedExampleBuilder() *cobra.Command { const template = "<>" - opts := VersionedExampleOpts{} + opts := versionedExampleOpts{} cmd := &cobra.Command{ - Use: "versionedExample", + Use: "versionedExample", Short: "Example resource info for versioning of the Atlas API", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -73,19 +71,18 @@ func VersionedExampleBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().BoolVar(&opts.additionalInfo, "additionalInfo", false, "") + cmd.Flags().BoolVar(&opts.additionalInfo, "additionalInfo", false, ``) return cmd } -func TestBuilder() *cobra.Command { +func testBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "test", - Short: "Atlas test endpoints.", + Use: "test", + Short: `Atlas test endpoints.`, } cmd.AddCommand( - VersionedExampleBuilder(), + versionedExampleBuilder(), ) return cmd } - diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index ae593e3c5e..80a86c60c0 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -18,42 +18,40 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateThirdPartyIntegrationOpts struct { +type createThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient integrationType string - groupId string - + groupId string + includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *CreateThirdPartyIntegrationOpts) initClient() func() error { +func (opts *createThirdPartyIntegrationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateThirdPartyIntegrationOpts) Run(ctx context.Context) error { +func (opts *createThirdPartyIntegrationOpts) Run(ctx context.Context) error { params := &admin.CreateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, - GroupId: opts.groupId, - + GroupId: opts.groupId, + IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { @@ -63,15 +61,15 @@ func (opts *CreateThirdPartyIntegrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func CreateThirdPartyIntegrationBuilder() *cobra.Command { +func createThirdPartyIntegrationBuilder() *cobra.Command { const template = "<>" - opts := CreateThirdPartyIntegrationOpts{} + opts := createThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "createThirdPartyIntegration", + Use: "createThirdPartyIntegration", Short: "Configure One Third-Party Service Integration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -83,37 +81,40 @@ func CreateThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") return cmd } -type DeleteThirdPartyIntegrationOpts struct { + +type deleteThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient integrationType string - groupId string + groupId string } -func (opts *DeleteThirdPartyIntegrationOpts) initClient() func() error { +func (opts *deleteThirdPartyIntegrationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DeleteThirdPartyIntegrationOpts) Run(ctx context.Context) error { +func (opts *deleteThirdPartyIntegrationOpts) Run(ctx context.Context) error { params := &admin.DeleteThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, - GroupId: opts.groupId, + GroupId: opts.groupId, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { @@ -123,15 +124,15 @@ func (opts *DeleteThirdPartyIntegrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func DeleteThirdPartyIntegrationBuilder() *cobra.Command { +func deleteThirdPartyIntegrationBuilder() *cobra.Command { const template = "<>" - opts := DeleteThirdPartyIntegrationOpts{} + opts := deleteThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "deleteThirdPartyIntegration", + Use: "deleteThirdPartyIntegration", Short: "Remove One Third-Party Service Integration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -143,32 +144,35 @@ func DeleteThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") return cmd } -type GetThirdPartyIntegrationOpts struct { + +type getThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string integrationType string } -func (opts *GetThirdPartyIntegrationOpts) initClient() func() error { +func (opts *getThirdPartyIntegrationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *GetThirdPartyIntegrationOpts) Run(ctx context.Context) error { +func (opts *getThirdPartyIntegrationOpts) Run(ctx context.Context) error { params := &admin.GetThirdPartyIntegrationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IntegrationType: opts.integrationType, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(ctx, params).Execute() @@ -179,15 +183,15 @@ func (opts *GetThirdPartyIntegrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func GetThirdPartyIntegrationBuilder() *cobra.Command { +func getThirdPartyIntegrationBuilder() *cobra.Command { const template = "<>" - opts := GetThirdPartyIntegrationOpts{} + opts := getThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "getThirdPartyIntegration", + Use: "getThirdPartyIntegration", Short: "Return One Third-Party Service Integration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -199,37 +203,40 @@ func GetThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("integrationType") return cmd } -type ListThirdPartyIntegrationsOpts struct { + +type listThirdPartyIntegrationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListThirdPartyIntegrationsOpts) initClient() func() error { +func (opts *listThirdPartyIntegrationsOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListThirdPartyIntegrationsOpts) Run(ctx context.Context) error { +func (opts *listThirdPartyIntegrationsOpts) Run(ctx context.Context) error { params := &admin.ListThirdPartyIntegrationsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(ctx, params).Execute() if err != nil { @@ -239,15 +246,15 @@ func (opts *ListThirdPartyIntegrationsOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListThirdPartyIntegrationsBuilder() *cobra.Command { +func listThirdPartyIntegrationsBuilder() *cobra.Command { const template = "<>" - opts := ListThirdPartyIntegrationsOpts{} + opts := listThirdPartyIntegrationsOpts{} cmd := &cobra.Command{ - Use: "listThirdPartyIntegrations", + Use: "listThirdPartyIntegrations", Short: "Return All Active Third-Party Service Integrations", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -259,42 +266,45 @@ func ListThirdPartyIntegrationsBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type UpdateThirdPartyIntegrationOpts struct { + +type updateThirdPartyIntegrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient integrationType string - groupId string - + groupId string + includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *UpdateThirdPartyIntegrationOpts) initClient() func() error { +func (opts *updateThirdPartyIntegrationOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *UpdateThirdPartyIntegrationOpts) Run(ctx context.Context) error { +func (opts *updateThirdPartyIntegrationOpts) Run(ctx context.Context) error { params := &admin.UpdateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, - GroupId: opts.groupId, - + GroupId: opts.groupId, + IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { @@ -304,15 +314,15 @@ func (opts *UpdateThirdPartyIntegrationOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func UpdateThirdPartyIntegrationBuilder() *cobra.Command { +func updateThirdPartyIntegrationBuilder() *cobra.Command { const template = "<>" - opts := UpdateThirdPartyIntegrationOpts{} + opts := updateThirdPartyIntegrationOpts{} cmd := &cobra.Command{ - Use: "updateThirdPartyIntegration", + Use: "updateThirdPartyIntegration", Short: "Update One Third-Party Service Integration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -324,32 +334,33 @@ func UpdateThirdPartyIntegrationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", "Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") return cmd } -func ThirdPartyIntegrationsBuilder() *cobra.Command { +func thirdPartyIntegrationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "thirdPartyIntegrations", - Short: "Returns, adds, edits, and removes third-party service integration configurations. MongoDB Cloud sends alerts to each third-party service that you configure. + Use: "thirdPartyIntegrations", + Short: `Returns, adds, edits, and removes third-party service integration configurations. MongoDB Cloud sends alerts to each third-party service that you configure. -**IMPORTANT**: Each project can only have one configuration per integrationType.", +**IMPORTANT**: Each project can only have one configuration per integrationType.`, } cmd.AddCommand( - CreateThirdPartyIntegrationBuilder(), - DeleteThirdPartyIntegrationBuilder(), - GetThirdPartyIntegrationBuilder(), - ListThirdPartyIntegrationsBuilder(), - UpdateThirdPartyIntegrationBuilder(), + createThirdPartyIntegrationBuilder(), + deleteThirdPartyIntegrationBuilder(), + getThirdPartyIntegrationBuilder(), + listThirdPartyIntegrationsBuilder(), + updateThirdPartyIntegrationBuilder(), ) return cmd } - diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 5602ec0d22..7d163835ba 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -18,36 +18,32 @@ package generated import ( "context" - "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) -type CreateDatabaseUserCertificateOpts struct { +type createDatabaseUserCertificateOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string username string - } -func (opts *CreateDatabaseUserCertificateOpts) initClient() func() error { +func (opts *createDatabaseUserCertificateOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *CreateDatabaseUserCertificateOpts) Run(ctx context.Context) error { +func (opts *createDatabaseUserCertificateOpts) Run(ctx context.Context) error { params := &admin.CreateDatabaseUserCertificateApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, Username: opts.username, - } _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() if err != nil { @@ -57,15 +53,15 @@ func (opts *CreateDatabaseUserCertificateOpts) Run(ctx context.Context) error { return opts.Print(nil) } -func CreateDatabaseUserCertificateBuilder() *cobra.Command { +func createDatabaseUserCertificateBuilder() *cobra.Command { const template = "<>" - opts := CreateDatabaseUserCertificateOpts{} + opts := createDatabaseUserCertificateOpts{} cmd := &cobra.Command{ - Use: "createDatabaseUserCertificate", + Use: "createDatabaseUserCertificate", Short: "Create One X.509 Certificate for One MongoDB User", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,30 +73,32 @@ func CreateDatabaseUserCertificateBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the MongoDB database user account for whom to create a certificate.") - + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account for whom to create a certificate.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") return cmd } -type DisableCustomerManagedX509Opts struct { + +type disableCustomerManagedX509Opts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } -func (opts *DisableCustomerManagedX509Opts) initClient() func() error { +func (opts *disableCustomerManagedX509Opts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *DisableCustomerManagedX509Opts) Run(ctx context.Context) error { +func (opts *disableCustomerManagedX509Opts) Run(ctx context.Context) error { params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, } @@ -112,15 +110,15 @@ func (opts *DisableCustomerManagedX509Opts) Run(ctx context.Context) error { return opts.Print(resp) } -func DisableCustomerManagedX509Builder() *cobra.Command { +func disableCustomerManagedX509Builder() *cobra.Command { const template = "<>" - opts := DisableCustomerManagedX509Opts{} + opts := disableCustomerManagedX509Opts{} cmd := &cobra.Command{ - Use: "disableCustomerManagedX509", + Use: "disableCustomerManagedX509", Short: "Disable Customer-Managed X.509", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -132,37 +130,40 @@ func DisableCustomerManagedX509Builder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) _ = cmd.MarkFlagRequired("groupId") return cmd } -type ListDatabaseUserCertificatesOpts struct { + +type listDatabaseUserCertificatesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - username string + client *admin.APIClient + groupId string + username string includeCount bool itemsPerPage int - pageNum int + pageNum int } -func (opts *ListDatabaseUserCertificatesOpts) initClient() func() error { +func (opts *listDatabaseUserCertificatesOpts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *ListDatabaseUserCertificatesOpts) Run(ctx context.Context) error { +func (opts *listDatabaseUserCertificatesOpts) Run(ctx context.Context) error { params := &admin.ListDatabaseUserCertificatesApiParams{ - GroupId: opts.groupId, - Username: opts.username, + GroupId: opts.groupId, + Username: opts.username, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(ctx, params).Execute() if err != nil { @@ -172,15 +173,15 @@ func (opts *ListDatabaseUserCertificatesOpts) Run(ctx context.Context) error { return opts.Print(resp) } -func ListDatabaseUserCertificatesBuilder() *cobra.Command { +func listDatabaseUserCertificatesBuilder() *cobra.Command { const template = "<>" - opts := ListDatabaseUserCertificatesOpts{} + opts := listDatabaseUserCertificatesOpts{} cmd := &cobra.Command{ - Use: "listDatabaseUserCertificates", + Use: "listDatabaseUserCertificates", Short: "Return All X.509 Certificates Assigned to One MongoDB User", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -192,27 +193,28 @@ func ListDatabaseUserCertificatesBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", "Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.") - cmd.Flags().StringVar(&opts.username, "username", "", "Human-readable label that represents the MongoDB database user account whose certificates you want to return.") - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, "Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.") - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, "Number of items that the response returns per page.") - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, "Number of the page that displays the current set of the total objects that the response returns.") + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account whose certificates you want to return.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") return cmd } -func X509AuthenticationBuilder() *cobra.Command { +func x509AuthenticationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "x509Authentication", - Short: "Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages your certificates, it also manages your Certificate Authority and can generate certificates for your database users. No additional X.509 configuration is required. If you manage your certificates, you must provide a Certificate Authority and generate certificates for your database users.", + Use: "x509Authentication", + Short: `Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages your certificates, it also manages your Certificate Authority and can generate certificates for your database users. No additional X.509 configuration is required. If you manage your certificates, you must provide a Certificate Authority and generate certificates for your database users.`, } cmd.AddCommand( - CreateDatabaseUserCertificateBuilder(), - DisableCustomerManagedX509Builder(), - ListDatabaseUserCertificatesBuilder(), + createDatabaseUserCertificateBuilder(), + disableCustomerManagedX509Builder(), + listDatabaseUserCertificatesBuilder(), ) return cmd } - diff --git a/internal/generated/generated.go b/internal/generated/generated.go index 5cb152cc9c..3714e96ecd 100644 --- a/internal/generated/generated.go +++ b/internal/generated/generated.go @@ -71,7 +71,7 @@ func httpClient(username, password string, accessToken *auth.Token) (*http.Clien return &http.Client{Transport: tr}, nil } -func NewClientWithAuth() (*admin.APIClient, error) { +func newClientWithAuth() (*admin.APIClient, error) { profile := config.Default() var authToken *auth.Token @@ -127,59 +127,59 @@ func convertTime(s *string) *time.Time { return nil } - r, err := time.Parse(time.RFC3339, s) + r, err := time.Parse(time.RFC3339, *s) if err != nil { return nil } - return r + return &r } func Commands() []*cobra.Command { return []*cobra.Command { - AWSClustersDNSBuilder(), - AccessTrackingBuilder(), - AlertConfigurationsBuilder(), - AlertsBuilder(), - AtlasSearchBuilder(), - AuditingBuilder(), - CloudBackupsBuilder(), - CloudMigrationServiceBuilder(), - CloudProviderAccessBuilder(), - ClusterOutageSimulationBuilder(), - ClustersBuilder(), - CustomDatabaseRolesBuilder(), - DataFederationBuilder(), - DataLakePipelinesBuilder(), - DatabaseUsersBuilder(), - EncryptionAtRestUsingCustomerKeyManagementBuilder(), - EventsBuilder(), - FederatedAuthenticationBuilder(), - GlobalClustersBuilder(), - InvoicesBuilder(), - LDAPConfigurationBuilder(), - LegacyBackupBuilder(), - LegacyBackupRestoreJobsBuilder(), - MaintenanceWindowsBuilder(), - MongoDBCloudUsersBuilder(), - MonitoringAndLogsBuilder(), - MultiCloudClustersBuilder(), - NetworkPeeringBuilder(), - OnlineArchiveBuilder(), - OrganizationsBuilder(), - PerformanceAdvisorBuilder(), - PrivateEndpointServicesBuilder(), - ProgrammaticAPIKeysBuilder(), - ProjectIPAccessListBuilder(), - ProjectsBuilder(), - RollingIndexBuilder(), - RootBuilder(), - ServerlessInstancesBuilder(), - ServerlessPrivateEndpointsBuilder(), - SharedTierRestoreJobsBuilder(), - SharedTierSnapshotsBuilder(), - TeamsBuilder(), - TestBuilder(), - ThirdPartyIntegrationsBuilder(), - X509AuthenticationBuilder(), + aWSClustersDNSBuilder(), + accessTrackingBuilder(), + alertConfigurationsBuilder(), + alertsBuilder(), + atlasSearchBuilder(), + auditingBuilder(), + cloudBackupsBuilder(), + cloudMigrationServiceBuilder(), + cloudProviderAccessBuilder(), + clusterOutageSimulationBuilder(), + clustersBuilder(), + customDatabaseRolesBuilder(), + dataFederationBuilder(), + dataLakePipelinesBuilder(), + databaseUsersBuilder(), + encryptionAtRestUsingCustomerKeyManagementBuilder(), + eventsBuilder(), + federatedAuthenticationBuilder(), + globalClustersBuilder(), + invoicesBuilder(), + lDAPConfigurationBuilder(), + legacyBackupBuilder(), + legacyBackupRestoreJobsBuilder(), + maintenanceWindowsBuilder(), + mongoDBCloudUsersBuilder(), + monitoringAndLogsBuilder(), + multiCloudClustersBuilder(), + networkPeeringBuilder(), + onlineArchiveBuilder(), + organizationsBuilder(), + performanceAdvisorBuilder(), + privateEndpointServicesBuilder(), + programmaticAPIKeysBuilder(), + projectIPAccessListBuilder(), + projectsBuilder(), + rollingIndexBuilder(), + rootBuilder(), + serverlessInstancesBuilder(), + serverlessPrivateEndpointsBuilder(), + sharedTierRestoreJobsBuilder(), + sharedTierSnapshotsBuilder(), + teamsBuilder(), + testBuilder(), + thirdPartyIntegrationsBuilder(), + x509AuthenticationBuilder(), } } diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 7fe223ff81..11ab5f82b5 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -13,7 +13,7 @@ import ( {{#operations}} {{#operation}} -type {{operationId}}Opts struct { +type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient @@ -22,18 +22,18 @@ type {{operationId}}Opts struct { {{/allParams}} } -func (opts *{{operationId}}Opts) initClient() func() error { +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) initClient() func() error { return func() error { var err error - opts.client, err = NewClientWithAuth() + opts.client, err = newClientWithAuth() return err } } -func (opts *{{operationId}}Opts) Run(ctx context.Context) error { +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) Run(ctx context.Context) error { params := &admin.{{operationId}}ApiParams{ {{#allParams}} - {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: {{#isDateTime}}convertTime({{/isDateTime}}{{^required}}&{{/required}}opts.{{paramName}}{{#isDateTime}}){{/isDateTime}},{{/isBodyParam}} + {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: {{#isDateTime}}convertTime({{/isDateTime}}{{^isPathParam}}&{{/isPathParam}}opts.{{paramName}}{{#isDateTime}}){{/isDateTime}},{{/isBodyParam}} {{/allParams}} } {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params).Execute() @@ -44,10 +44,10 @@ func (opts *{{operationId}}Opts) Run(ctx context.Context) error { return opts.Print({{#returnType}}resp{{/returnType}}{{^returnType}}nil{{/returnType}}) } -func {{operationId}}Builder() *cobra.Command { +func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.Command { const template = "<>" - opts := {{operationId}}Opts{} + opts := {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts{} cmd := &cobra.Command{ Use: "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}", Short: "{{ summary }}", @@ -65,7 +65,7 @@ func {{operationId}}Builder() *cobra.Command { }, } {{#allParams}} - {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, "{{description}}"){{/isBodyParam}} + {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, `{{unescapedDescription}}`){{/isBodyParam}} {{/allParams}} {{#allParams}}{{^isBodyParam}}{{#required}} _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/isBodyParam}}{{/allParams}} @@ -74,17 +74,17 @@ func {{operationId}}Builder() *cobra.Command { {{/operation}} {{/operations}} -func {{baseName}}Builder() *cobra.Command { +func {{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}Builder() *cobra.Command { {{#operations}} {{#operation}} {{#-first}} cmd := &cobra.Command{ Use: "{{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}", - Short: "{{#tags}}{{#-first}}{{description}}{{/-first}}{{/tags}}", + Short: `{{#tags}}{{#-first}}{{description}}{{/-first}}{{/tags}}`, } cmd.AddCommand( {{/-first}} - {{operationId}}Builder(), + {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder(), {{/operation}} {{/operations}} ) diff --git a/tools/openapi-generator/config/go-templates/generated.mustache b/tools/openapi-generator/config/go-templates/generated.mustache index d9fbf6ac85..fe27c85f79 100644 --- a/tools/openapi-generator/config/go-templates/generated.mustache +++ b/tools/openapi-generator/config/go-templates/generated.mustache @@ -56,7 +56,7 @@ func httpClient(username, password string, accessToken *auth.Token) (*http.Clien return &http.Client{Transport: tr}, nil } -func NewClientWithAuth() (*admin.APIClient, error) { +func newClientWithAuth() (*admin.APIClient, error) { profile := config.Default() var authToken *auth.Token @@ -112,18 +112,18 @@ func convertTime(s *string) *time.Time { return nil } - r, err := time.Parse(time.RFC3339, s) + r, err := time.Parse(time.RFC3339, *s) if err != nil { return nil } - return r + return &r } func Commands() []*cobra.Command { return []*cobra.Command { {{#apiInfo}} {{#apis}} - {{baseName}}Builder(), + {{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}Builder(), {{/apis}} {{/apiInfo}} } diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index fe2625eb94..d1b1493f73 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -5,7 +5,7 @@ "scripts": { "generate:clear": "rm -rf ../../internal/generated", "generate:init": "mkdir -p ../../internal/generated && cp ./config/.openapi-generator-ignore ../../internal/generated/.openapi-generator-ignore", - "generate:run": "openapi-generator-cli generate -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/generated", + "generate:run": "GO_POST_PROCESS_FILE='goimports -w' openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/generated", "generate": "npm run generate:clear && npm run generate:init && npm run generate:run" }, "repository": { From 1cf05b9a460ef697ea5b4c5fcf121b1a329384d7 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 2 Jun 2023 17:59:59 +0100 Subject: [PATCH 18/44] pin version in config --- test/e2e/atlas/alerts_test.go | 2 +- tools/openapi-generator/config/config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/atlas/alerts_test.go b/test/e2e/atlas/alerts_test.go index 2f837bb104..ccef9edc9d 100644 --- a/test/e2e/atlas/alerts_test.go +++ b/test/e2e/atlas/alerts_test.go @@ -24,7 +24,7 @@ import ( "github.com/mongodb/mongodb-atlas-cli/test/e2e" "github.com/stretchr/testify/assert" - atlasv2 "go.mongodb.org/atlas/mongodbatlasv2" + atlasv2 "go.mongodb.org/atlas-sdk/admin" ) const ( diff --git a/tools/openapi-generator/config/config.yaml b/tools/openapi-generator/config/config.yaml index 5088df4b30..33b0e190fb 100644 --- a/tools/openapi-generator/config/config.yaml +++ b/tools/openapi-generator/config/config.yaml @@ -5,7 +5,7 @@ gitHost: github.com templateDir: config/go-templates isGoSubmodule: true packageName: generated -inputSpec: https://github.com/mongodb/atlas-sdk-go/raw/main/openapi/atlas-api-transformed.yaml +inputSpec: https://github.com/mongodb/atlas-sdk-go/raw/v0.7.0/openapi/atlas-api-transformed.yaml files: cmd.mustache: templateType: API From 544f43e256a2ffadf02a6d32e9680e0432829da1 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Tue, 6 Jun 2023 15:44:25 +0100 Subject: [PATCH 19/44] requestbody wip --- .../generated/api_alert_configurations_cmd.go | 164 +++-- internal/generated/api_alerts_cmd.go | 121 +++- internal/generated/api_atlas_search_cmd.go | 170 +++-- internal/generated/api_auditing_cmd.go | 8 + .../generated/api_aws_clusters_dns_cmd.go | 3 + internal/generated/api_cloud_backups_cmd.go | 602 ++++++++++++------ .../api_cloud_migration_service_cmd.go | 115 ++-- .../api_cluster_outage_simulation_cmd.go | 21 + internal/generated/api_clusters_cmd.go | 244 +++++-- .../api_custom_database_roles_cmd.go | 10 + internal/generated/api_data_federation_cmd.go | 263 +++++--- .../generated/api_data_lake_pipelines_cmd.go | 243 ++++--- internal/generated/api_database_users_cmd.go | 80 +++ ..._rest_using_customer_key_management_cmd.go | 33 +- .../api_federated_authentication_cmd.go | 246 ++++--- internal/generated/api_global_clusters_cmd.go | 102 +-- .../generated/api_ldap_configuration_cmd.go | 80 ++- internal/generated/api_legacy_backup_cmd.go | 231 ++++--- .../api_legacy_backup_restore_jobs_cmd.go | 71 ++- .../generated/api_maintenance_windows__cmd.go | 19 + .../generated/api_mongo_db_cloud_users_cmd.go | 26 + .../generated/api_multi_cloud_clusters_cmd.go | 178 ++++-- internal/generated/api_network_peering_cmd.go | 2 + internal/generated/api_online_archive_cmd.go | 182 ++++-- internal/generated/api_organizations_cmd.go | 227 ++++--- .../api_private_endpoint_services_cmd.go | 16 + .../api_programmatic_api_keys_cmd.go | 16 + internal/generated/api_projects_cmd.go | 40 ++ internal/generated/api_rolling_index_cmd.go | 33 +- .../generated/api_serverless_instances_cmd.go | 88 ++- .../api_serverless_private_endpoints_cmd.go | 2 + .../api_shared_tier_restore_jobs_cmd.go | 28 + .../api_shared_tier_snapshots_cmd.go | 28 + internal/generated/api_teams_cmd.go | 22 + .../generated/api_x509_authentication_cmd.go | 14 + .../config/go-templates/cmd.mustache | 3 + 36 files changed, 2628 insertions(+), 1103 deletions(-) diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index 10c666fed5..43cd214852 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -18,17 +18,20 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *createAlertConfigurationOpts) initClient() func() error { @@ -42,6 +45,7 @@ func (opts *createAlertConfigurationOpts) initClient() func() error { func (opts *createAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -56,10 +60,10 @@ func createAlertConfigurationBuilder() *cobra.Command { opts := createAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "createAlertConfiguration", + Use: "createAlertConfiguration", Short: "Create One Alert Configuration in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -74,16 +78,39 @@ func createAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when MongoDB Cloud created the alert configuration. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + + cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled this alert configuration for the specified project.`) + + cmd.Flags().StringVar(&opts.eventTypeName, "eventTypeName", "", `Event type that triggers an alert.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns this alert configuration.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this alert configuration.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().ArraySliceVar(&opts.matchers, "matchers", nil, `No matchers are available for these alert types. The list is always empty.`) + + cmd.Flags().ArraySliceVar(&opts.notifications, "notifications", nil, `List that contains the targets that MongoDB Cloud sends notifications.`) + + cmd.Flags().StringVar(&opts.updated, "updated", "", `Date and time when someone last updated this alert configuration. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + + cmd.Flags().ServerlessMetricThresholdVar(&opts.metricThreshold, "metricThreshold", , ``) + + cmd.Flags().ThresholdViewIntegerVar(&opts.threshold, "threshold", , ``) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type deleteAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string } @@ -97,7 +124,7 @@ func (opts *deleteAlertConfigurationOpts) initClient() func() error { func (opts *deleteAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.DeleteAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params).Execute() @@ -113,10 +140,10 @@ func deleteAlertConfigurationBuilder() *cobra.Command { opts := deleteAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "deleteAlertConfiguration", + Use: "deleteAlertConfiguration", Short: "Remove One Alert Configuration from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -133,16 +160,16 @@ func deleteAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } - type getAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string } @@ -156,7 +183,7 @@ func (opts *getAlertConfigurationOpts) initClient() func() error { func (opts *getAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.GetAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } resp, _, err := opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params).Execute() @@ -172,10 +199,10 @@ func getAlertConfigurationBuilder() *cobra.Command { opts := getAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "getAlertConfiguration", + Use: "getAlertConfiguration", Short: "Return One Alert Configuration from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -192,11 +219,11 @@ func getAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } - type listAlertConfigurationMatchersFieldNamesOpts struct { cli.GlobalOpts cli.OutputOpts @@ -212,7 +239,8 @@ func (opts *listAlertConfigurationMatchersFieldNamesOpts) initClient() func() er } func (opts *listAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Context) error { - params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{} + params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{ + } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params).Execute() if err != nil { return err @@ -226,10 +254,10 @@ func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { opts := listAlertConfigurationMatchersFieldNamesOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurationMatchersFieldNames", + Use: "listAlertConfigurationMatchersFieldNames", Short: "Get All Alert Configuration Matchers Field Names", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -242,17 +270,17 @@ func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { }, } + return cmd } - type listAlertConfigurationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listAlertConfigurationsOpts) initClient() func() error { @@ -265,10 +293,10 @@ func (opts *listAlertConfigurationsOpts) initClient() func() error { func (opts *listAlertConfigurationsOpts) Run(ctx context.Context) error { params := &admin.ListAlertConfigurationsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params).Execute() if err != nil { @@ -283,10 +311,10 @@ func listAlertConfigurationsBuilder() *cobra.Command { opts := listAlertConfigurationsOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurations", + Use: "listAlertConfigurations", Short: "Return All Alert Configurations for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -305,19 +333,19 @@ func listAlertConfigurationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type listAlertConfigurationsByAlertIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - alertId string + client *admin.APIClient + groupId string + alertId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listAlertConfigurationsByAlertIdOpts) initClient() func() error { @@ -330,11 +358,11 @@ func (opts *listAlertConfigurationsByAlertIdOpts) initClient() func() error { func (opts *listAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error { params := &admin.ListAlertConfigurationsByAlertIdApiParams{ - GroupId: opts.groupId, - AlertId: opts.alertId, + GroupId: opts.groupId, + AlertId: opts.alertId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params).Execute() if err != nil { @@ -349,10 +377,10 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { opts := listAlertConfigurationsByAlertIdOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurationsByAlertId", + Use: "listAlertConfigurationsByAlertId", Short: "Return All Alert Configurations Set for One Alert", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -372,17 +400,18 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } - type toggleAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string + } func (opts *toggleAlertConfigurationOpts) initClient() func() error { @@ -395,8 +424,9 @@ func (opts *toggleAlertConfigurationOpts) initClient() func() error { func (opts *toggleAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.ToggleAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, + } resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -411,10 +441,10 @@ func toggleAlertConfigurationBuilder() *cobra.Command { opts := toggleAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "toggleAlertConfiguration", + Use: "toggleAlertConfiguration", Short: "Toggle One State of One Alert Configuration in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -430,18 +460,22 @@ func toggleAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) + + + cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether to enable or disable the specified alert configuration in the specified project.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } - type updateAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string + } func (opts *updateAlertConfigurationOpts) initClient() func() error { @@ -454,8 +488,9 @@ func (opts *updateAlertConfigurationOpts) initClient() func() error { func (opts *updateAlertConfigurationOpts) Run(ctx context.Context) error { params := &admin.UpdateAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, + } resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -470,10 +505,10 @@ func updateAlertConfigurationBuilder() *cobra.Command { opts := updateAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "updateAlertConfiguration", + Use: "updateAlertConfiguration", Short: "Update One Alert Configuration for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -489,6 +524,30 @@ func updateAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) + + + cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when MongoDB Cloud created the alert configuration. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + + cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled this alert configuration for the specified project.`) + + cmd.Flags().StringVar(&opts.eventTypeName, "eventTypeName", "", `Event type that triggers an alert.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns this alert configuration.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this alert configuration.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().ArraySliceVar(&opts.matchers, "matchers", nil, `No matchers are available for these alert types. The list is always empty.`) + + cmd.Flags().ArraySliceVar(&opts.notifications, "notifications", nil, `List that contains the targets that MongoDB Cloud sends notifications.`) + + cmd.Flags().StringVar(&opts.updated, "updated", "", `Date and time when someone last updated this alert configuration. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + + cmd.Flags().ServerlessMetricThresholdVar(&opts.metricThreshold, "metricThreshold", , ``) + + cmd.Flags().ThresholdViewIntegerVar(&opts.threshold, "threshold", , ``) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -497,8 +556,8 @@ func updateAlertConfigurationBuilder() *cobra.Command { func alertConfigurationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "alertConfigurations", - Short: `Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.`, + Use: "alertConfigurations", + Short: `Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.`, } cmd.AddCommand( createAlertConfigurationBuilder(), @@ -512,3 +571,4 @@ func alertConfigurationsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 9aa72e7f53..7d44bd110e 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -18,18 +18,21 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type acknowledgeAlertOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string alertId string + } func (opts *acknowledgeAlertOpts) initClient() func() error { @@ -44,6 +47,7 @@ func (opts *acknowledgeAlertOpts) Run(ctx context.Context) error { params := &admin.AcknowledgeAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, + } resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params).Execute() if err != nil { @@ -58,10 +62,10 @@ func acknowledgeAlertBuilder() *cobra.Command { opts := acknowledgeAlertOpts{} cmd := &cobra.Command{ - Use: "acknowledgeAlert", + Use: "acknowledgeAlert", Short: "Acknowledge One Alert from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,16 +81,67 @@ func acknowledgeAlertBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) + + + cmd.Flags().StringVar(&opts.acknowledgedUntil, "acknowledgedUntil", "", `Date and time until which this alert has been acknowledged. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. The resource returns this parameter if a MongoDB User previously acknowledged this alert. + +- To acknowledge this alert forever, set the parameter value to 100 years in the future. + +- To unacknowledge a previously acknowledged alert, set the parameter value to a date in the past.`) + + cmd.Flags().StringVar(&opts.acknowledgementComment, "acknowledgementComment", "", `Comment that a MongoDB Cloud user submitted when acknowledging the alert.`) + + cmd.Flags().StringVar(&opts.acknowledgingUsername, "acknowledgingUsername", "", `MongoDB Cloud username of the person who acknowledged the alert. The response returns this parameter if a MongoDB Cloud user previously acknowledged this alert.`) + + cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that sets this alert.`) + + cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when MongoDB Cloud created this alert. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.eventTypeName, "eventTypeName", "", `Incident that triggered this alert.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns this alert.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this alert.`) + + cmd.Flags().StringVar(&opts.lastNotified, "lastNotified", "", `Date and time that any notifications were last sent for this alert. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. The resource returns this parameter if MongoDB Cloud has sent notifications for this alert.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal character string that identifies the organization that owns the project to which this alert applies.`) + + cmd.Flags().StringVar(&opts.resolved, "resolved", "", `Date and time that this alert changed to `"status" : "CLOSED"`. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. The resource returns this parameter once `"status" : "CLOSED"`.`) + + cmd.Flags().StringVar(&opts.status, "status", "", `State of this alert at the time you requested its details.`) + + cmd.Flags().StringVar(&opts.updated, "updated", "", `Date and time when someone last updated this alert. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to which this alert applies. This resource returns this parameter for alerts of events impacting backups, replica sets, or sharded clusters.`) + + cmd.Flags().StringVar(&opts.hostnameAndPort, "hostnameAndPort", "", `Hostname and port of the host to which this alert applies. The resource returns this parameter for alerts of events impacting hosts or replica sets.`) + + cmd.Flags().StringVar(&opts.replicaSetName, "replicaSetName", "", `Name of the replica set to which this alert applies. The response returns this parameter for alerts of events impacting backups, hosts, or replica sets.`) + + cmd.Flags().HostMetricValueVar(&opts.currentValue, "currentValue", , ``) + + cmd.Flags().StringVar(&opts.metricName, "metricName", "", `Name of the metric against which Atlas checks the configured `metricThreshold.threshold`. + +To learn more about the available metrics, see <a href="https://www.mongodb.com/docs/atlas/reference/alert-host-metrics/#std-label-measurement-types" target="_blank">Host Metrics</a>. + +**NOTE**: If you set eventTypeName to OUTSIDE_SERVERLESS_METRIC_THRESHOLD, you can specify only metrics available for serverless. To learn more, see <a href="https://dochub.mongodb.org/core/alert-config-serverless-measurements" target="_blank">Serverless Measurements</a>.`) + + cmd.Flags().ArraySliceVar(&opts.nonRunningHostIds, "nonRunningHostIds", nil, ``) + + cmd.Flags().StringVar(&opts.parentClusterId, "parentClusterId", "", `Unique 24-hexadecimal character string that identifies the parent cluster to which this alert applies. The parent cluster contains the sharded nodes. MongoDB Cloud returns this parameter only for alerts of events impacting sharded clusters.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } - type getAlertOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string alertId string } @@ -117,10 +172,10 @@ func getAlertBuilder() *cobra.Command { opts := getAlertOpts{} cmd := &cobra.Command{ - Use: "getAlert", + Use: "getAlert", Short: "Return One Alert from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -137,20 +192,20 @@ func getAlertBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } - type listAlertsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int - status string + pageNum int + status string } func (opts *listAlertsOpts) initClient() func() error { @@ -163,11 +218,11 @@ func (opts *listAlertsOpts) initClient() func() error { func (opts *listAlertsOpts) Run(ctx context.Context) error { params := &admin.ListAlertsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Status: &opts.status, + PageNum: &opts.pageNum, + Status: &opts.status, } resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params).Execute() if err != nil { @@ -182,10 +237,10 @@ func listAlertsBuilder() *cobra.Command { opts := listAlertsOpts{} cmd := &cobra.Command{ - Use: "listAlerts", + Use: "listAlerts", Short: "Return All Alerts from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -205,19 +260,19 @@ func listAlertsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.status, "status", "", `Status of the alerts to return. Omit to return all alerts in all statuses.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type listAlertsByAlertConfigurationIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string - includeCount bool - itemsPerPage int - pageNum int + includeCount bool + itemsPerPage int + pageNum int } func (opts *listAlertsByAlertConfigurationIdOpts) initClient() func() error { @@ -230,11 +285,11 @@ func (opts *listAlertsByAlertConfigurationIdOpts) initClient() func() error { func (opts *listAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error { params := &admin.ListAlertsByAlertConfigurationIdApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params).Execute() if err != nil { @@ -249,10 +304,10 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { opts := listAlertsByAlertConfigurationIdOpts{} cmd := &cobra.Command{ - Use: "listAlertsByAlertConfigurationId", + Use: "listAlertsByAlertConfigurationId", Short: "Return All Open Alerts for Alert Configuration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -272,6 +327,7 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd @@ -279,8 +335,8 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { func alertsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "alerts", - Short: `Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.`, + Use: "alerts", + Short: `Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.`, } cmd.AddCommand( acknowledgeAlertBuilder(), @@ -290,3 +346,4 @@ func alertsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index 73d425eefb..6f8c07f761 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -18,18 +18,21 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createAtlasSearchIndexOpts) initClient() func() error { @@ -42,8 +45,9 @@ func (opts *createAtlasSearchIndexOpts) initClient() func() error { func (opts *createAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.CreateAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -58,10 +62,10 @@ func createAtlasSearchIndexBuilder() *cobra.Command { opts := createAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "createAtlasSearchIndex", + Use: "createAtlasSearchIndex", Short: "Create One Atlas Search Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,19 +81,58 @@ func createAtlasSearchIndexBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection on which to create an Atlas Search index.`) + + + cmd.Flags().StringVar(&opts.analyzer, "analyzer", ""lucene.standard"", `Specific pre-defined method chosen to convert database field text into searchable words. This conversion reduces the text of fields into the smallest units of text. These units are called a **term** or **token**. This process, known as tokenization, involves a variety of changes made to the text in fields: + +- extracting words +- removing punctuation +- removing accents +- changing to lowercase +- removing common words +- reducing words to their root form (stemming) +- changing words to their base form (lemmatization) + MongoDB Cloud uses the selected process to build the Atlas Search index.`) + + cmd.Flags().ArraySliceVar(&opts.analyzers, "analyzers", nil, `List of user-defined methods to convert database field text into searchable words.`) + + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection that contains one or more Atlas Search indexes.`) + + cmd.Flags().StringVar(&opts.database, "database", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) + + cmd.Flags().StringVar(&opts.indexID, "indexID", "", `Unique 24-hexadecimal digit string that identifies this Atlas Search index.`) + + cmd.Flags().FTSMappingsVar(&opts.mappings, "mappings", , ``) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies this index. Within each namespace, names of all indexes in the namespace must be unique.`) + + cmd.Flags().StringVar(&opts.searchAnalyzer, "searchAnalyzer", ""lucene.standard"", `Method applied to identify words when searching this index.`) + + cmd.Flags().StringVar(&opts.status, "status", "", `Condition of the search index when you made this request. + +| Status | Index Condition | + |---|---| + | IN_PROGRESS | Atlas is building or re-building the index after an edit. | + | STEADY | You can use this search index. | + | FAILED | Atlas could not build the index. | + | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | + | PAUSED | The cluster is paused. | +`) + + cmd.Flags().ArraySliceVar(&opts.synonyms, "synonyms", nil, `Rule sets that map words to their synonyms in this index.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type deleteAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string + indexId string } func (opts *deleteAtlasSearchIndexOpts) initClient() func() error { @@ -102,9 +145,9 @@ func (opts *deleteAtlasSearchIndexOpts) initClient() func() error { func (opts *deleteAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.DeleteAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, + IndexId: opts.indexId, } resp, _, err := opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -119,10 +162,10 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { opts := deleteAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "deleteAtlasSearchIndex", + Use: "deleteAtlasSearchIndex", Short: "Remove One Atlas Search Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -140,19 +183,19 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the database and collection with one or more Application Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd } - type getAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string + indexId string } func (opts *getAtlasSearchIndexOpts) initClient() func() error { @@ -165,9 +208,9 @@ func (opts *getAtlasSearchIndexOpts) initClient() func() error { func (opts *getAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.GetAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, + IndexId: opts.indexId, } resp, _, err := opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -182,10 +225,10 @@ func getAtlasSearchIndexBuilder() *cobra.Command { opts := getAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "getAtlasSearchIndex", + Use: "getAtlasSearchIndex", Short: "Return One Atlas Search Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -203,20 +246,20 @@ func getAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd } - type listAtlasSearchIndexesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string collectionName string - databaseName string + databaseName string } func (opts *listAtlasSearchIndexesOpts) initClient() func() error { @@ -229,10 +272,10 @@ func (opts *listAtlasSearchIndexesOpts) initClient() func() error { func (opts *listAtlasSearchIndexesOpts) Run(ctx context.Context) error { params := &admin.ListAtlasSearchIndexesApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, CollectionName: opts.collectionName, - DatabaseName: opts.databaseName, + DatabaseName: opts.databaseName, } resp, _, err := opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params).Execute() if err != nil { @@ -247,10 +290,10 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { opts := listAtlasSearchIndexesOpts{} cmd := &cobra.Command{ - Use: "listAtlasSearchIndexes", + Use: "listAtlasSearchIndexes", Short: "Return All Atlas Search Indexes for One Collection", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -269,20 +312,21 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Name of the collection that contains one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("databaseName") return cmd } - type updateAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string + indexId string + } func (opts *updateAtlasSearchIndexOpts) initClient() func() error { @@ -295,9 +339,10 @@ func (opts *updateAtlasSearchIndexOpts) initClient() func() error { func (opts *updateAtlasSearchIndexOpts) Run(ctx context.Context) error { params := &admin.UpdateAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, + IndexId: opts.indexId, + } resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -312,10 +357,10 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { opts := updateAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "updateAtlasSearchIndex", + Use: "updateAtlasSearchIndex", Short: "Update One Atlas Search Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -332,6 +377,46 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection whose Atlas Search index to update.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) + + + cmd.Flags().StringVar(&opts.analyzer, "analyzer", ""lucene.standard"", `Specific pre-defined method chosen to convert database field text into searchable words. This conversion reduces the text of fields into the smallest units of text. These units are called a **term** or **token**. This process, known as tokenization, involves a variety of changes made to the text in fields: + +- extracting words +- removing punctuation +- removing accents +- changing to lowercase +- removing common words +- reducing words to their root form (stemming) +- changing words to their base form (lemmatization) + MongoDB Cloud uses the selected process to build the Atlas Search index.`) + + cmd.Flags().ArraySliceVar(&opts.analyzers, "analyzers", nil, `List of user-defined methods to convert database field text into searchable words.`) + + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection that contains one or more Atlas Search indexes.`) + + cmd.Flags().StringVar(&opts.database, "database", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) + + cmd.Flags().StringVar(&opts.indexID, "indexID", "", `Unique 24-hexadecimal digit string that identifies this Atlas Search index.`) + + cmd.Flags().FTSMappingsVar(&opts.mappings, "mappings", , ``) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies this index. Within each namespace, names of all indexes in the namespace must be unique.`) + + cmd.Flags().StringVar(&opts.searchAnalyzer, "searchAnalyzer", ""lucene.standard"", `Method applied to identify words when searching this index.`) + + cmd.Flags().StringVar(&opts.status, "status", "", `Condition of the search index when you made this request. + +| Status | Index Condition | + |---|---| + | IN_PROGRESS | Atlas is building or re-building the index after an edit. | + | STEADY | You can use this search index. | + | FAILED | Atlas could not build the index. | + | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | + | PAUSED | The cluster is paused. | +`) + + cmd.Flags().ArraySliceVar(&opts.synonyms, "synonyms", nil, `Rule sets that map words to their synonyms in this index.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -341,8 +426,8 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { func atlasSearchBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "atlasSearch", - Short: `Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.`, + Use: "atlasSearch", + Short: `Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.`, } cmd.AddCommand( createAtlasSearchIndexBuilder(), @@ -353,3 +438,4 @@ func atlasSearchBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index 59230993e4..9d34b0d49a 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -130,6 +130,14 @@ func updateAuditingConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.auditAuthorizationSuccess, "auditAuthorizationSuccess", false, `Flag that indicates whether someone set auditing to track successful authentications. This only applies to the `"atype" : "authCheck"` audit filter. Setting this parameter to `true` degrades cluster performance.`) + + cmd.Flags().StringVar(&opts.auditFilter, "auditFilter", "", `JSON document that specifies which events to record. Escape any characters that may prevent parsing, such as single or double quotes, using a backslash (`\`).`) + + cmd.Flags().StringVar(&opts.configurationType, "configurationType", "", `Human-readable label that displays how to configure the audit filter.`) + + cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled database auditing for the specified project.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index d8a2e4b6ed..125643f5cc 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -130,6 +130,9 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether the project's clusters deployed to Amazon Web Services (AWS) use a custom Domain Name System (DNS). +When `"enabled": true`, connect to your cluster using Private IP for Peering connection strings.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index d349b7c911..5b7a8ab490 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -18,18 +18,20 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type cancelBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } @@ -43,8 +45,8 @@ func (opts *cancelBackupRestoreJobOpts) initClient() func() error { func (opts *cancelBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CancelBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params).Execute() @@ -60,10 +62,10 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { opts := cancelBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "cancelBackupRestoreJob", + Use: "cancelBackupRestoreJob", Short: "Cancel One Restore Job of One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -81,18 +83,19 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to remove.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } - type createBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createBackupExportJobOpts) initClient() func() error { @@ -105,8 +108,9 @@ func (opts *createBackupExportJobOpts) initClient() func() error { func (opts *createBackupExportJobOpts) Run(ctx context.Context) error { params := &admin.CreateBackupExportJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params).Execute() if err != nil { @@ -121,10 +125,10 @@ func createBackupExportJobBuilder() *cobra.Command { opts := createBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "createBackupExportJob", + Use: "createBackupExportJob", Short: "Create One Cloud Backup Snapshot Export Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -140,18 +144,28 @@ func createBackupExportJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + + + cmd.Flags().ArraySliceVar(&opts.customData, "customData", nil, `Collection of key-value pairs that represent custom data to add to the metadata file that MongoDB Cloud uploads to the bucket when the export job finishes.`) + + cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique 24-hexadecimal character string that identifies the AWS bucket to which MongoDB Cloud exports the Cloud Backup snapshot.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal character string that identifies the Cloud Backup snasphot to export.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type createBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createBackupRestoreJobOpts) initClient() func() error { @@ -164,8 +178,9 @@ func (opts *createBackupRestoreJobOpts) initClient() func() error { func (opts *createBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -180,10 +195,10 @@ func createBackupRestoreJobBuilder() *cobra.Command { opts := createBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createBackupRestoreJob", + Use: "createBackupRestoreJob", Short: "Restore One Snapshot of One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -199,17 +214,55 @@ func createBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + + + cmd.Flags().BoolVar(&opts.cancelled, "cancelled", false, `Flag that indicates whether someone canceled this restore job.`) + + cmd.Flags().ArraySliceVar(&opts.components, "components", nil, `Information on the restore job for each replica set in the sharded cluster.`) + + cmd.Flags().StringVar(&opts.deliveryType, "deliveryType", "", `Human-readable label that categorizes the restore job to create.`) + + cmd.Flags().ArraySliceVar(&opts.deliveryUrl, "deliveryUrl", nil, `One or more Uniform Resource Locators (URLs) that point to the compressed snapshot files for manual download. MongoDB Cloud returns this parameter when `"deliveryType" : "download"`.`) + + cmd.Flags().BSONTimestampVar(&opts.desiredTimestamp, "desiredTimestamp", , ``) + + cmd.Flags().BoolVar(&opts.expired, "expired", false, `Flag that indicates whether the restore job expired.`) + + cmd.Flags().StringVar(&opts.expiresAt, "expiresAt", "", `Date and time when the restore job expires. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().BoolVar(&opts.failed, "failed", false, `Flag that indicates whether the restore job failed.`) + + cmd.Flags().StringVar(&opts.finishedAt, "finishedAt", "", `Date and time when the restore job completed. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal character string that identifies the restore job.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().IntVar(&opts.oplogInc, "oplogInc", 000, `Oplog operation number from which you want to restore this snapshot. This number represents the second part of an Oplog timestamp. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.`) + + cmd.Flags().IntVar(&opts.oplogTs, "oplogTs", 000, `Date and time from which you want to restore this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. This number represents the first part of an Oplog timestamp. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.`) + + cmd.Flags().IntVar(&opts.pointInTimeUTCSeconds, "pointInTimeUTCSeconds", 000, `Date and time from which MongoDB Cloud restored this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **pointInTimeUTCSeconds** exceeds `0`.`) + + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal character string that identifies the snapshot.`) + + cmd.Flags().StringVar(&opts.targetClusterName, "targetClusterName", "", `Human-readable label that identifies the target cluster to which the restore job restores the snapshot. The resource returns this parameter when `"deliveryType":` `"automated"`.`) + + cmd.Flags().StringVar(&opts.targetGroupId, "targetGroupId", "", `Unique 24-hexadecimal digit string that identifies the target project for the specified **targetClusterName**.`) + + cmd.Flags().StringVar(&opts.timestamp, "timestamp", "", `Date and time when MongoDB Cloud took the snapshot associated with **snapshotId**. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type createExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *createExportBucketOpts) initClient() func() error { @@ -223,6 +276,7 @@ func (opts *createExportBucketOpts) initClient() func() error { func (opts *createExportBucketOpts) Run(ctx context.Context) error { params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params).Execute() if err != nil { @@ -237,10 +291,10 @@ func createExportBucketBuilder() *cobra.Command { opts := createExportBucketOpts{} cmd := &cobra.Command{ - Use: "createExportBucket", + Use: "createExportBucket", Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -255,17 +309,29 @@ func createExportBucketBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal character string that identifies the Amazon Web Services (AWS) Simple Storage Service (S3) export bucket.`) + + cmd.Flags().StringVar(&opts.bucketName, "bucketName", "", `Human-readable label that identifies the AWS bucket that the role is authorized to access.`) + + cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider that stores this snapshot.`) + + cmd.Flags().StringVar(&opts.iamRoleId, "iamRoleId", "", `Unique 24-hexadecimal character string that identifies the AWS IAM role that MongoDB Cloud uses to access the AWS S3 bucket.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type createServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createServerlessBackupRestoreJobOpts) initClient() func() error { @@ -278,8 +344,9 @@ func (opts *createServerlessBackupRestoreJobOpts) initClient() func() error { func (opts *createServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateServerlessBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -294,10 +361,10 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { opts := createServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createServerlessBackupRestoreJob", + Use: "createServerlessBackupRestoreJob", Short: "Restore One Snapshot of One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -313,17 +380,52 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance whose snapshot you want to restore.`) + + + cmd.Flags().BoolVar(&opts.cancelled, "cancelled", false, `Flag that indicates whether someone canceled this restore job.`) + + cmd.Flags().StringVar(&opts.deliveryType, "deliveryType", "", `Human-readable label that categorizes the restore job to create.`) + + cmd.Flags().ArraySliceVar(&opts.deliveryUrl, "deliveryUrl", nil, `One or more Uniform Resource Locators (URLs) that point to the compressed snapshot files for manual download. MongoDB Cloud returns this parameter when `"deliveryType" : "download"`.`) + + cmd.Flags().BSONTimestampVar(&opts.desiredTimestamp, "desiredTimestamp", , ``) + + cmd.Flags().BoolVar(&opts.expired, "expired", false, `Flag that indicates whether the restore job expired.`) + + cmd.Flags().StringVar(&opts.expiresAt, "expiresAt", "", `Date and time when the restore job expires. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().BoolVar(&opts.failed, "failed", false, `Flag that indicates whether the restore job failed.`) + + cmd.Flags().StringVar(&opts.finishedAt, "finishedAt", "", `Date and time when the restore job completed. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal character string that identifies the restore job.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().IntVar(&opts.oplogInc, "oplogInc", 000, `Oplog operation number from which you want to restore this snapshot. This number represents the second part of an Oplog timestamp. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.`) + + cmd.Flags().IntVar(&opts.oplogTs, "oplogTs", 000, `Date and time from which you want to restore this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. This number represents the first part of an Oplog timestamp. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.`) + + cmd.Flags().IntVar(&opts.pointInTimeUTCSeconds, "pointInTimeUTCSeconds", 000, `Date and time from which MongoDB Cloud restored this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **pointInTimeUTCSeconds** exceeds `0`.`) + + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal character string that identifies the snapshot.`) + + cmd.Flags().StringVar(&opts.targetClusterName, "targetClusterName", "", `Human-readable label that identifies the target cluster to which the restore job restores the snapshot. The resource returns this parameter when `"deliveryType":` `"automated"`.`) + + cmd.Flags().StringVar(&opts.targetGroupId, "targetGroupId", "", `Unique 24-hexadecimal digit string that identifies the target project for the specified **targetClusterName**.`) + + cmd.Flags().StringVar(&opts.timestamp, "timestamp", "", `Date and time when MongoDB Cloud took the snapshot associated with **snapshotId**. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type deleteAllBackupSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -337,7 +439,7 @@ func (opts *deleteAllBackupSchedulesOpts) initClient() func() error { func (opts *deleteAllBackupSchedulesOpts) Run(ctx context.Context) error { params := &admin.DeleteAllBackupSchedulesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params).Execute() @@ -353,10 +455,10 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { opts := deleteAllBackupSchedulesOpts{} cmd := &cobra.Command{ - Use: "deleteAllBackupSchedules", + Use: "deleteAllBackupSchedules", Short: "Remove All Cloud Backup Schedules", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -373,16 +475,16 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type deleteExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string exportBucketId string } @@ -396,7 +498,7 @@ func (opts *deleteExportBucketOpts) initClient() func() error { func (opts *deleteExportBucketOpts) Run(ctx context.Context) error { params := &admin.DeleteExportBucketApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } resp, _, err := opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params).Execute() @@ -412,10 +514,10 @@ func deleteExportBucketBuilder() *cobra.Command { opts := deleteExportBucketOpts{} cmd := &cobra.Command{ - Use: "deleteExportBucket", + Use: "deleteExportBucket", Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -432,18 +534,18 @@ func deleteExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") return cmd } - type deleteReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *deleteReplicaSetBackupOpts) initClient() func() error { @@ -456,9 +558,9 @@ func (opts *deleteReplicaSetBackupOpts) initClient() func() error { func (opts *deleteReplicaSetBackupOpts) Run(ctx context.Context) error { params := &admin.DeleteReplicaSetBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { @@ -473,10 +575,10 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { opts := deleteReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "deleteReplicaSetBackup", + Use: "deleteReplicaSetBackup", Short: "Remove One Replica Set Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -494,19 +596,19 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } - type deleteShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *deleteShardedClusterBackupOpts) initClient() func() error { @@ -519,9 +621,9 @@ func (opts *deleteShardedClusterBackupOpts) initClient() func() error { func (opts *deleteShardedClusterBackupOpts) Run(ctx context.Context) error { params := &admin.DeleteShardedClusterBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { @@ -536,10 +638,10 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { opts := deleteShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "deleteShardedClusterBackup", + Use: "deleteShardedClusterBackup", Short: "Remove One Sharded Cluster Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -557,19 +659,19 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } - type getBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - exportId string + exportId string } func (opts *getBackupExportJobOpts) initClient() func() error { @@ -582,9 +684,9 @@ func (opts *getBackupExportJobOpts) initClient() func() error { func (opts *getBackupExportJobOpts) Run(ctx context.Context) error { params := &admin.GetBackupExportJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - ExportId: opts.exportId, + ExportId: opts.exportId, } resp, _, err := opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params).Execute() if err != nil { @@ -599,10 +701,10 @@ func getBackupExportJobBuilder() *cobra.Command { opts := getBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "getBackupExportJob", + Use: "getBackupExportJob", Short: "Return One Cloud Backup Snapshot Export Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -620,18 +722,18 @@ func getBackupExportJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.exportId, "exportId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("exportId") return cmd } - type getBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } @@ -645,8 +747,8 @@ func (opts *getBackupRestoreJobOpts) initClient() func() error { func (opts *getBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.GetBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params).Execute() @@ -662,10 +764,10 @@ func getBackupRestoreJobBuilder() *cobra.Command { opts := getBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getBackupRestoreJob", + Use: "getBackupRestoreJob", Short: "Return One Restore Job of One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -683,17 +785,17 @@ func getBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } - type getBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -707,7 +809,7 @@ func (opts *getBackupScheduleOpts) initClient() func() error { func (opts *getBackupScheduleOpts) Run(ctx context.Context) error { params := &admin.GetBackupScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params).Execute() @@ -723,10 +825,10 @@ func getBackupScheduleBuilder() *cobra.Command { opts := getBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "getBackupSchedule", + Use: "getBackupSchedule", Short: "Return One Cloud Backup Schedule", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -743,15 +845,15 @@ func getBackupScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type getDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -780,10 +882,10 @@ func getDataProtectionSettingsBuilder() *cobra.Command { opts := getDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "getDataProtectionSettings", + Use: "getDataProtectionSettings", Short: "Return the Backup Compliance Policy settings", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -799,15 +901,15 @@ func getDataProtectionSettingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type getExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string exportBucketId string } @@ -821,7 +923,7 @@ func (opts *getExportBucketOpts) initClient() func() error { func (opts *getExportBucketOpts) Run(ctx context.Context) error { params := &admin.GetExportBucketApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } resp, _, err := opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params).Execute() @@ -837,10 +939,10 @@ func getExportBucketBuilder() *cobra.Command { opts := getExportBucketOpts{} cmd := &cobra.Command{ - Use: "getExportBucket", + Use: "getExportBucket", Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -857,18 +959,18 @@ func getExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") return cmd } - type getReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *getReplicaSetBackupOpts) initClient() func() error { @@ -881,9 +983,9 @@ func (opts *getReplicaSetBackupOpts) initClient() func() error { func (opts *getReplicaSetBackupOpts) Run(ctx context.Context) error { params := &admin.GetReplicaSetBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { @@ -898,10 +1000,10 @@ func getReplicaSetBackupBuilder() *cobra.Command { opts := getReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "getReplicaSetBackup", + Use: "getReplicaSetBackup", Short: "Return One Replica Set Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -919,19 +1021,19 @@ func getReplicaSetBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } - type getServerlessBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *getServerlessBackupOpts) initClient() func() error { @@ -944,9 +1046,9 @@ func (opts *getServerlessBackupOpts) initClient() func() error { func (opts *getServerlessBackupOpts) Run(ctx context.Context) error { params := &admin.GetServerlessBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params).Execute() if err != nil { @@ -961,10 +1063,10 @@ func getServerlessBackupBuilder() *cobra.Command { opts := getServerlessBackupOpts{} cmd := &cobra.Command{ - Use: "getServerlessBackup", + Use: "getServerlessBackup", Short: "Return One Snapshot of One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -982,18 +1084,18 @@ func getServerlessBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } - type getServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } @@ -1007,8 +1109,8 @@ func (opts *getServerlessBackupRestoreJobOpts) initClient() func() error { func (opts *getServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.GetServerlessBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params).Execute() @@ -1024,10 +1126,10 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { opts := getServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getServerlessBackupRestoreJob", + Use: "getServerlessBackupRestoreJob", Short: "Return One Restore Job for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1045,19 +1147,19 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } - type getShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *getShardedClusterBackupOpts) initClient() func() error { @@ -1070,9 +1172,9 @@ func (opts *getShardedClusterBackupOpts) initClient() func() error { func (opts *getShardedClusterBackupOpts) Run(ctx context.Context) error { params := &admin.GetShardedClusterBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { @@ -1087,10 +1189,10 @@ func getShardedClusterBackupBuilder() *cobra.Command { opts := getShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "getShardedClusterBackup", + Use: "getShardedClusterBackup", Short: "Return One Sharded Cluster Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1108,21 +1210,21 @@ func getShardedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } - type listBackupExportJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listBackupExportJobsOpts) initClient() func() error { @@ -1135,11 +1237,11 @@ func (opts *listBackupExportJobsOpts) initClient() func() error { func (opts *listBackupExportJobsOpts) Run(ctx context.Context) error { params := &admin.ListBackupExportJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params).Execute() if err != nil { @@ -1154,10 +1256,10 @@ func listBackupExportJobsBuilder() *cobra.Command { opts := listBackupExportJobsOpts{} cmd := &cobra.Command{ - Use: "listBackupExportJobs", + Use: "listBackupExportJobs", Short: "Return All Cloud Backup Snapshot Export Jobs", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1177,20 +1279,20 @@ func listBackupExportJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listBackupRestoreJobsOpts) initClient() func() error { @@ -1203,11 +1305,11 @@ func (opts *listBackupRestoreJobsOpts) initClient() func() error { func (opts *listBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -1222,10 +1324,10 @@ func listBackupRestoreJobsBuilder() *cobra.Command { opts := listBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listBackupRestoreJobs", + Use: "listBackupRestoreJobs", Short: "Return All Restore Jobs for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1245,19 +1347,19 @@ func listBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listExportBucketsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listExportBucketsOpts) initClient() func() error { @@ -1270,10 +1372,10 @@ func (opts *listExportBucketsOpts) initClient() func() error { func (opts *listExportBucketsOpts) Run(ctx context.Context) error { params := &admin.ListExportBucketsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params).Execute() if err != nil { @@ -1288,10 +1390,10 @@ func listExportBucketsBuilder() *cobra.Command { opts := listExportBucketsOpts{} cmd := &cobra.Command{ - Use: "listExportBuckets", + Use: "listExportBuckets", Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1310,19 +1412,19 @@ func listExportBucketsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type listReplicaSetBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listReplicaSetBackupsOpts) initClient() func() error { @@ -1335,11 +1437,11 @@ func (opts *listReplicaSetBackupsOpts) initClient() func() error { func (opts *listReplicaSetBackupsOpts) Run(ctx context.Context) error { params := &admin.ListReplicaSetBackupsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params).Execute() if err != nil { @@ -1354,10 +1456,10 @@ func listReplicaSetBackupsBuilder() *cobra.Command { opts := listReplicaSetBackupsOpts{} cmd := &cobra.Command{ - Use: "listReplicaSetBackups", + Use: "listReplicaSetBackups", Short: "Return All Replica Set Cloud Backups", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1377,20 +1479,20 @@ func listReplicaSetBackupsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listServerlessBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listServerlessBackupRestoreJobsOpts) initClient() func() error { @@ -1403,11 +1505,11 @@ func (opts *listServerlessBackupRestoreJobsOpts) initClient() func() error { func (opts *listServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListServerlessBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -1422,10 +1524,10 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { opts := listServerlessBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listServerlessBackupRestoreJobs", + Use: "listServerlessBackupRestoreJobs", Short: "Return All Restore Jobs for One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1445,20 +1547,20 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listServerlessBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listServerlessBackupsOpts) initClient() func() error { @@ -1471,11 +1573,11 @@ func (opts *listServerlessBackupsOpts) initClient() func() error { func (opts *listServerlessBackupsOpts) Run(ctx context.Context) error { params := &admin.ListServerlessBackupsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params).Execute() if err != nil { @@ -1490,10 +1592,10 @@ func listServerlessBackupsBuilder() *cobra.Command { opts := listServerlessBackupsOpts{} cmd := &cobra.Command{ - Use: "listServerlessBackups", + Use: "listServerlessBackups", Short: "Return All Snapshots of One Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1513,16 +1615,16 @@ func listServerlessBackupsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listShardedClusterBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -1536,7 +1638,7 @@ func (opts *listShardedClusterBackupsOpts) initClient() func() error { func (opts *listShardedClusterBackupsOpts) Run(ctx context.Context) error { params := &admin.ListShardedClusterBackupsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params).Execute() @@ -1552,10 +1654,10 @@ func listShardedClusterBackupsBuilder() *cobra.Command { opts := listShardedClusterBackupsOpts{} cmd := &cobra.Command{ - Use: "listShardedClusterBackups", + Use: "listShardedClusterBackups", Short: "Return All Sharded Cluster Cloud Backups", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1572,17 +1674,18 @@ func listShardedClusterBackupsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type takeSnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *takeSnapshotOpts) initClient() func() error { @@ -1595,8 +1698,9 @@ func (opts *takeSnapshotOpts) initClient() func() error { func (opts *takeSnapshotOpts) Run(ctx context.Context) error { params := &admin.TakeSnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params).Execute() if err != nil { @@ -1611,10 +1715,10 @@ func takeSnapshotBuilder() *cobra.Command { opts := takeSnapshotOpts{} cmd := &cobra.Command{ - Use: "takeSnapshot", + Use: "takeSnapshot", Short: "Take One On-Demand Snapshot", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1630,18 +1734,26 @@ func takeSnapshotBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + + + cmd.Flags().StringVar(&opts.description, "description", "", `Human-readable phrase or sentence that explains the purpose of the snapshot. The resource returns this parameter when `"status" : "onDemand"`.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().IntVar(&opts.retentionInDays, "retentionInDays", 000, `Number of days that MongoDB Cloud should retain the on-demand snapshot. Must be at least **1**.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type updateBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *updateBackupScheduleOpts) initClient() func() error { @@ -1654,8 +1766,9 @@ func (opts *updateBackupScheduleOpts) initClient() func() error { func (opts *updateBackupScheduleOpts) Run(ctx context.Context) error { params := &admin.UpdateBackupScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params).Execute() if err != nil { @@ -1670,10 +1783,10 @@ func updateBackupScheduleBuilder() *cobra.Command { opts := updateBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "updateBackupSchedule", + Use: "updateBackupSchedule", Short: "Update Cloud Backup Schedule for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1689,17 +1802,47 @@ func updateBackupScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + + + cmd.Flags().BoolVar(&opts.autoExportEnabled, "autoExportEnabled", false, `Flag that indicates whether MongoDB Cloud automatically exports cloud backup snapshots to the AWS bucket.`) + + cmd.Flags().StringVar(&opts.clusterId, "clusterId", "", `Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return.`) + + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + + cmd.Flags().ArraySliceVar(&opts.copySettings, "copySettings", nil, `List that contains a document for each copy setting item in the desired backup policy.`) + + cmd.Flags().ArraySliceVar(&opts.deleteCopiedBackups, "deleteCopiedBackups", nil, `List that contains a document for each deleted copy setting whose backup copies you want to delete.`) + + cmd.Flags().AutoExportPolicyVar(&opts.export, "export", , ``) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.nextSnapshot, "nextSnapshot", "", `Date and time when MongoDB Cloud takes the next snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().ArraySliceVar(&opts.policies, "policies", nil, `Rules set for this backup schedule.`) + + cmd.Flags().IntVar(&opts.referenceHourOfDay, "referenceHourOfDay", 000, `Hour of day in Coordinated Universal Time (UTC) that represents when MongoDB Cloud takes the snapshot.`) + + cmd.Flags().IntVar(&opts.referenceMinuteOfHour, "referenceMinuteOfHour", 000, `Minute of the **referenceHourOfDay** that represents when MongoDB Cloud takes the snapshot.`) + + cmd.Flags().IntVar(&opts.restoreWindowDays, "restoreWindowDays", 000, `Number of previous days that you can restore back to with Continuous Cloud Backup accuracy. You must specify a positive, non-zero integer. This parameter applies to continuous cloud backups only.`) + + cmd.Flags().BoolVar(&opts.updateSnapshots, "updateSnapshots", false, `Flag that indicates whether to apply the retention changes in the updated backup policy to snapshots that MongoDB Cloud took previously.`) + + cmd.Flags().BoolVar(&opts.useOrgAndGroupNamesInExportPrefix, "useOrgAndGroupNamesInExportPrefix", false, `Flag that indicates whether to use organization and project names instead of organization and project UUIDs in the path to the metadata files that MongoDB Cloud uploads to your AWS bucket.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type updateDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *updateDataProtectionSettingsOpts) initClient() func() error { @@ -1713,6 +1856,7 @@ func (opts *updateDataProtectionSettingsOpts) initClient() func() error { func (opts *updateDataProtectionSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params).Execute() if err != nil { @@ -1727,10 +1871,10 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { opts := updateDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "updateDataProtectionSettings", + Use: "updateDataProtectionSettings", Short: "Update or enable the Backup Compliance Policy settings", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1745,18 +1889,42 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts.authorizedEmail, "authorizedEmail", "", `Email address of the user who authorized to updated the Backup Compliance Policy settings.`) + + cmd.Flags().BoolVar(&opts.copyProtectionEnabled, "copyProtectionEnabled", false, `Flag that indicates whether to enable additional backup copies for the cluster. If unspecified, this value defaults to false.`) + + cmd.Flags().BoolVar(&opts.encryptionAtRestEnabled, "encryptionAtRestEnabled", false, `Flag that indicates whether Encryption at Rest using Customer Key Management is required for all clusters with a Backup Compliance Policy. If unspecified, this value defaults to false.`) + + cmd.Flags().PolicyItemVar(&opts.onDemandPolicyItem, "onDemandPolicyItem", , ``) + + cmd.Flags().BoolVar(&opts.pitEnabled, "pitEnabled", false, `Flag that indicates whether the cluster uses Continuous Cloud Backups with a Backup Compliance Policy. If unspecified, this value defaults to false.`) + + cmd.Flags().StringVar(&opts.projectId, "projectId", "", `Unique 24-hexadecimal digit string that identifies the project for the Backup Compliance Policy.`) + + cmd.Flags().IntVar(&opts.restoreWindowDays, "restoreWindowDays", 000, `Number of previous days that you can restore back to with Continuous Cloud Backup with a Backup Compliance Policy. You must specify a positive, non-zero integer, and the maximum retention window can't exceed the hourly retention time. This parameter applies only to Continuous Cloud Backups with a Backup Compliance Policy.`) + + cmd.Flags().ArraySliceVar(&opts.scheduledPolicyItems, "scheduledPolicyItems", nil, `List that contains the specifications for one scheduled policy.`) + + cmd.Flags().StringVar(&opts.state, "state", "", `Label that indicates the state of the Backup Compliance Policy settings. MongoDB Cloud ignores this setting when you enable or update the Backup Compliance Policy settings.`) + + cmd.Flags().StringVar(&opts.updatedDate, "updatedDate", "", `ISO 8601 timestamp format in UTC that indicates when the user updated the Data Protection Policy settings. MongoDB Cloud ignores this setting when you enable or update the Backup Compliance Policy settings.`) + + cmd.Flags().StringVar(&opts.updatedUser, "updatedUser", "", `Email address that identifies the user who updated the Backup Compliance Policy settings. MongoDB Cloud ignores this email setting when you enable or update the Backup Compliance Policy settings.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type updateSnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string + } func (opts *updateSnapshotRetentionOpts) initClient() func() error { @@ -1769,9 +1937,10 @@ func (opts *updateSnapshotRetentionOpts) initClient() func() error { func (opts *updateSnapshotRetentionOpts) Run(ctx context.Context) error { params := &admin.UpdateSnapshotRetentionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, + } resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() if err != nil { @@ -1786,10 +1955,10 @@ func updateSnapshotRetentionBuilder() *cobra.Command { opts := updateSnapshotRetentionOpts{} cmd := &cobra.Command{ - Use: "updateSnapshotRetention", + Use: "updateSnapshotRetention", Short: "Change Expiration Date for One Cloud Backup", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -1806,6 +1975,14 @@ func updateSnapshotRetentionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.retentionUnit, "retentionUnit", "", `Quantity of time in which MongoDB Cloud measures snapshot retention.`) + + cmd.Flags().IntVar(&opts.retentionValue, "retentionValue", 000, `Number that indicates the amount of days, weeks, or months that MongoDB Cloud retains the snapshot. For less frequent policy items, MongoDB Cloud requires that you specify a value greater than or equal to the value specified for more frequent policy items. If the hourly policy item specifies a retention of two days, specify two days or greater for the retention of the weekly policy item.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1815,8 +1992,8 @@ func updateSnapshotRetentionBuilder() *cobra.Command { func cloudBackupsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "cloudBackups", - Short: `Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.`, + Use: "cloudBackups", + Short: `Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.`, } cmd.AddCommand( cancelBackupRestoreJobBuilder(), @@ -1851,3 +2028,4 @@ func cloudBackupsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index f934f95165..3e2a70ea9f 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -18,17 +18,20 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string + } func (opts *createLinkTokenOpts) initClient() func() error { @@ -42,6 +45,7 @@ func (opts *createLinkTokenOpts) initClient() func() error { func (opts *createLinkTokenOpts) Run(ctx context.Context) error { params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params).Execute() if err != nil { @@ -56,10 +60,10 @@ func createLinkTokenBuilder() *cobra.Command { opts := createLinkTokenOpts{} cmd := &cobra.Command{ - Use: "createLinkToken", + Use: "createLinkToken", Short: "Create One Link-Token", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -72,16 +76,20 @@ func createLinkTokenBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + + + cmd.Flags().ArraySliceVar(&opts.accessListIps, "accessListIps", nil, `IP address access list entries associated with the API key.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type createPushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *createPushMigrationOpts) initClient() func() error { @@ -95,6 +103,7 @@ func (opts *createPushMigrationOpts) initClient() func() error { func (opts *createPushMigrationOpts) Run(ctx context.Context) error { params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params).Execute() if err != nil { @@ -109,10 +118,10 @@ func createPushMigrationBuilder() *cobra.Command { opts := createPushMigrationOpts{} cmd := &cobra.Command{ - Use: "createPushMigration", + Use: "createPushMigration", Short: "Migrate One Local Managed Cluster to MongoDB Atlas", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -127,16 +136,27 @@ func createPushMigrationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the migration request.`) + + cmd.Flags().DestinationVar(&opts.destination, "destination", , ``) + + cmd.Flags().BoolVar(&opts.dropEnabled, "dropEnabled", false, `Flag that indicates whether the migration process drops all collections from the destination cluster before the migration starts.`) + + cmd.Flags().ArraySliceVar(&opts.migrationHosts, "migrationHosts", nil, `List of migration hosts used for this migration.`) + + cmd.Flags().SourceVar(&opts.source, "source", , ``) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type cutoverMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string liveMigrationId string } @@ -150,7 +170,7 @@ func (opts *cutoverMigrationOpts) initClient() func() error { func (opts *cutoverMigrationOpts) Run(ctx context.Context) error { params := &admin.CutoverMigrationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params).Execute() @@ -166,10 +186,10 @@ func cutoverMigrationBuilder() *cobra.Command { opts := cutoverMigrationOpts{} cmd := &cobra.Command{ - Use: "cutoverMigration", + Use: "cutoverMigration", Short: "Cut Over the Migrated Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -186,16 +206,16 @@ func cutoverMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } - type deleteLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *deleteLinkTokenOpts) initClient() func() error { @@ -223,10 +243,10 @@ func deleteLinkTokenBuilder() *cobra.Command { opts := deleteLinkTokenOpts{} cmd := &cobra.Command{ - Use: "deleteLinkToken", + Use: "deleteLinkToken", Short: "Remove One Link-Token", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -240,15 +260,15 @@ func deleteLinkTokenBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type getPushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string liveMigrationId string } @@ -262,7 +282,7 @@ func (opts *getPushMigrationOpts) initClient() func() error { func (opts *getPushMigrationOpts) Run(ctx context.Context) error { params := &admin.GetPushMigrationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } resp, _, err := opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params).Execute() @@ -278,10 +298,10 @@ func getPushMigrationBuilder() *cobra.Command { opts := getPushMigrationOpts{} cmd := &cobra.Command{ - Use: "getPushMigration", + Use: "getPushMigration", Short: "Return One Migration Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -298,16 +318,16 @@ func getPushMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } - type getValidationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string validationId string } @@ -321,7 +341,7 @@ func (opts *getValidationStatusOpts) initClient() func() error { func (opts *getValidationStatusOpts) Run(ctx context.Context) error { params := &admin.GetValidationStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ValidationId: opts.validationId, } resp, _, err := opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params).Execute() @@ -337,10 +357,10 @@ func getValidationStatusBuilder() *cobra.Command { opts := getValidationStatusOpts{} cmd := &cobra.Command{ - Use: "getValidationStatus", + Use: "getValidationStatus", Short: "Return One Migration Validation Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -357,16 +377,16 @@ func getValidationStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("validationId") return cmd } - type listSourceProjectsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *listSourceProjectsOpts) initClient() func() error { @@ -394,10 +414,10 @@ func listSourceProjectsBuilder() *cobra.Command { opts := listSourceProjectsOpts{} cmd := &cobra.Command{ - Use: "listSourceProjects", + Use: "listSourceProjects", Short: "Return All Projects Available for Migration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -411,15 +431,16 @@ func listSourceProjectsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type validateMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *validateMigrationOpts) initClient() func() error { @@ -433,6 +454,7 @@ func (opts *validateMigrationOpts) initClient() func() error { func (opts *validateMigrationOpts) Run(ctx context.Context) error { params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params).Execute() if err != nil { @@ -447,10 +469,10 @@ func validateMigrationBuilder() *cobra.Command { opts := validateMigrationOpts{} cmd := &cobra.Command{ - Use: "validateMigration", + Use: "validateMigration", Short: "Validate One Migration Request", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -465,6 +487,18 @@ func validateMigrationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the migration request.`) + + cmd.Flags().DestinationVar(&opts.destination, "destination", , ``) + + cmd.Flags().BoolVar(&opts.dropEnabled, "dropEnabled", false, `Flag that indicates whether the migration process drops all collections from the destination cluster before the migration starts.`) + + cmd.Flags().ArraySliceVar(&opts.migrationHosts, "migrationHosts", nil, `List of migration hosts used for this migration.`) + + cmd.Flags().SourceVar(&opts.source, "source", , ``) + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -472,8 +506,8 @@ func validateMigrationBuilder() *cobra.Command { func cloudMigrationServiceBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "cloudMigrationService", - Short: `Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.`, + Use: "cloudMigrationService", + Short: `Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.`, } cmd.AddCommand( createLinkTokenBuilder(), @@ -487,3 +521,4 @@ func cloudMigrationServiceBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index f830abc067..64d56fc8bc 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -196,6 +196,27 @@ func startOutageSimulationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to undergo an outage simulation.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that undergoes outage simulation.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project that contains the cluster to undergo outage simulation.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal character string that identifies the outage simulation.`) + + cmd.Flags().ArraySliceVar(&opts.outageFilters, "outageFilters", nil, `List of settings that specify the type of cluster outage simulation.`) + + cmd.Flags().StringVar(&opts.startRequestDate, "startRequestDate", "", `Date and time when MongoDB Cloud started the regional outage simulation.`) + + cmd.Flags().StringVar(&opts.state, "state", "", `Phase of the outage simulation. + +| State | Indication | +|-------------|------------| +| `START_REQUESTED` | User has requested cluster outage simulation.| +| `STARTING` | MongoDB Cloud is starting cluster outage simulation.| +| `SIMULATING` | MongoDB Cloud is simulating cluster outage.| +| `RECOVERY_REQUESTED` | User has requested recovery from the simulated outage.| +| `RECOVERING` | MongoDB Cloud is recovering the cluster from the simulated outage.| +| `COMPLETE` | MongoDB Cloud has completed the cluster outage simulation.|`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index a0733ca828..ac517325f1 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -18,17 +18,19 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type getClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -42,7 +44,7 @@ func (opts *getClusterAdvancedConfigurationOpts) initClient() func() error { func (opts *getClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { params := &admin.GetClusterAdvancedConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params).Execute() @@ -58,10 +60,10 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { opts := getClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "getClusterAdvancedConfiguration", + Use: "getClusterAdvancedConfiguration", Short: "Return One Advanced Configuration Options for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -78,16 +80,16 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type getClusterStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -101,7 +103,7 @@ func (opts *getClusterStatusOpts) initClient() func() error { func (opts *getClusterStatusOpts) Run(ctx context.Context) error { params := &admin.GetClusterStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params).Execute() @@ -117,10 +119,10 @@ func getClusterStatusBuilder() *cobra.Command { opts := getClusterStatusOpts{} cmd := &cobra.Command{ - Use: "getClusterStatus", + Use: "getClusterStatus", Short: "Return Status of All Cluster Operations", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -137,16 +139,16 @@ func getClusterStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type getSampleDatasetLoadStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string sampleDatasetId string } @@ -160,7 +162,7 @@ func (opts *getSampleDatasetLoadStatusOpts) initClient() func() error { func (opts *getSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { params := &admin.GetSampleDatasetLoadStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, SampleDatasetId: opts.sampleDatasetId, } resp, _, err := opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params).Execute() @@ -176,10 +178,10 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { opts := getSampleDatasetLoadStatusOpts{} cmd := &cobra.Command{ - Use: "getSampleDatasetLoadStatus", + Use: "getSampleDatasetLoadStatus", Short: "Check Status of Cluster Sample Dataset Request", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -196,21 +198,21 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("sampleDatasetId") return cmd } - type listCloudProviderRegionsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int - providers []string - tier string + pageNum int + providers []string + tier string } func (opts *listCloudProviderRegionsOpts) initClient() func() error { @@ -223,12 +225,12 @@ func (opts *listCloudProviderRegionsOpts) initClient() func() error { func (opts *listCloudProviderRegionsOpts) Run(ctx context.Context) error { params := &admin.ListCloudProviderRegionsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Providers: &opts.providers, - Tier: &opts.tier, + PageNum: &opts.pageNum, + Providers: &opts.providers, + Tier: &opts.tier, } resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params).Execute() if err != nil { @@ -243,10 +245,10 @@ func listCloudProviderRegionsBuilder() *cobra.Command { opts := listCloudProviderRegionsOpts{} cmd := &cobra.Command{ - Use: "listCloudProviderRegions", + Use: "listCloudProviderRegions", Short: "Return All Cloud Provider Regions", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -267,17 +269,17 @@ func listCloudProviderRegionsBuilder() *cobra.Command { cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, `Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.`) cmd.Flags().StringVar(&opts.tier, "tier", "", `Cluster tier for which to retrieve the regions.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type listClustersForAllProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listClustersForAllProjectsOpts) initClient() func() error { @@ -292,7 +294,7 @@ func (opts *listClustersForAllProjectsOpts) Run(ctx context.Context) error { params := &admin.ListClustersForAllProjectsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params).Execute() if err != nil { @@ -307,10 +309,10 @@ func listClustersForAllProjectsBuilder() *cobra.Command { opts := listClustersForAllProjectsOpts{} cmd := &cobra.Command{ - Use: "listClustersForAllProjects", + Use: "listClustersForAllProjects", Short: "Return All Authorized Clusters in All Projects", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -326,15 +328,15 @@ func listClustersForAllProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + return cmd } - type loadSampleDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } func (opts *loadSampleDatasetOpts) initClient() func() error { @@ -348,7 +350,7 @@ func (opts *loadSampleDatasetOpts) initClient() func() error { func (opts *loadSampleDatasetOpts) Run(ctx context.Context) error { params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params).Execute() if err != nil { @@ -363,10 +365,10 @@ func loadSampleDatasetBuilder() *cobra.Command { opts := loadSampleDatasetOpts{} cmd := &cobra.Command{ - Use: "loadSampleDataset", + Use: "loadSampleDataset", Short: "Load Sample Dataset Request into Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -383,17 +385,18 @@ func loadSampleDatasetBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } - type updateClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *updateClusterAdvancedConfigurationOpts) initClient() func() error { @@ -406,8 +409,9 @@ func (opts *updateClusterAdvancedConfigurationOpts) initClient() func() error { func (opts *updateClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { params := &admin.UpdateClusterAdvancedConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -422,10 +426,10 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { opts := updateClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "updateClusterAdvancedConfiguration", + Use: "updateClusterAdvancedConfiguration", Short: "Update Advanced Configuration Options for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -441,17 +445,43 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + + + cmd.Flags().StringVar(&opts.defaultReadConcern, "defaultReadConcern", ""available"", `[Default level of acknowledgment requested from MongoDB for read operations](https://docs.mongodb.com/manual/reference/read-concern/) set for this cluster. + +MongoDB 4.4 clusters default to `available`. MongoDB 5.0 and later clusters default to `local`.`) + + cmd.Flags().StringVar(&opts.defaultWriteConcern, "defaultWriteConcern", ""1"", `[Default level of acknowledgment requested from MongoDB for write operations](https://docs.mongodb.com/manual/reference/write-concern/) set for this cluster. + +MongoDB 4.4 clusters default to `1`. MongoDB 5.0 and later clusters default to `majority`.`) + + cmd.Flags().BoolVar(&opts.failIndexKeyTooLong, "failIndexKeyTooLong", true, `Flag that indicates whether you can insert or update documents where all indexed entries don't exceed 1024 bytes. If you set this to false, [mongod](https://docs.mongodb.com/upcoming/reference/program/mongod/#mongodb-binary-bin.mongod) writes documents that exceed this limit but doesn't index them.`) + + cmd.Flags().BoolVar(&opts.javascriptEnabled, "javascriptEnabled", true, `Flag that indicates whether the cluster allows execution of operations that perform server-side executions of JavaScript.`) + + cmd.Flags().StringVar(&opts.minimumEnabledTlsProtocol, "minimumEnabledTlsProtocol", "", `Minimum Transport Layer Security (TLS) version that the cluster accepts for incoming connections. Clusters using TLS 1.0 or 1.1 should consider setting TLS 1.2 as the minimum TLS protocol version.`) + + cmd.Flags().BoolVar(&opts.noTableScan, "noTableScan", false, `Flag that indicates whether the cluster disables executing any query that requires a collection scan to return results.`) + + cmd.Flags().Float64Var(&opts.oplogMinRetentionHours, "oplogMinRetentionHours", 00, `Minimum retention window for cluster's oplog expressed in hours. A value of null indicates that the cluster uses the default minimum oplog window that MongoDB Cloud calculates.`) + + cmd.Flags().IntVar(&opts.oplogSizeMB, "oplogSizeMB", 000, `Storage limit of cluster's oplog expressed in megabytes. A value of null indicates that the cluster uses the default oplog size that MongoDB Cloud calculates.`) + + cmd.Flags().IntVar(&opts.sampleRefreshIntervalBIConnector, "sampleRefreshIntervalBIConnector", 0, `Interval in seconds at which the mongosqld process re-samples data to create its relational schema.`) + + cmd.Flags().IntVar(&opts.sampleSizeBIConnector, "sampleSizeBIConnector", 1000, `Number of documents per database to sample when gathering schema information.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type upgradeSharedClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *upgradeSharedClusterOpts) initClient() func() error { @@ -465,6 +495,7 @@ func (opts *upgradeSharedClusterOpts) initClient() func() error { func (opts *upgradeSharedClusterOpts) Run(ctx context.Context) error { params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() if err != nil { @@ -479,10 +510,10 @@ func upgradeSharedClusterBuilder() *cobra.Command { opts := upgradeSharedClusterOpts{} cmd := &cobra.Command{ - Use: "upgradeSharedCluster", + Use: "upgradeSharedCluster", Short: "Upgrade One Shared-tier Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -497,16 +528,85 @@ func upgradeSharedClusterBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().AutoScalingVar(&opts.autoScaling, "autoScaling", , ``) + + cmd.Flags().BoolVar(&opts.backupEnabled, "backupEnabled", false, `Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated clusters and Shared Cluster Backups for tenant clusters. If set to `false`, the cluster doesn't use MongoDB Cloud backups.`) + + cmd.Flags().BiConnectorVar(&opts.biConnector, "biConnector", , ``) + + cmd.Flags().StringVar(&opts.clusterType, "clusterType", "", `Configuration of nodes that comprise the cluster.`) + + cmd.Flags().ClusterDescriptionConnectionStringsVar(&opts.connectionStrings, "connectionStrings", , ``) + + cmd.Flags().StringVar(&opts.createDate, "createDate", "", `Date and time when MongoDB Cloud created this serverless instance. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC.`) + + cmd.Flags().Float64Var(&opts.diskSizeGB, "diskSizeGB", 00, `Storage capacity that the host's root volume possesses expressed in gigabytes. Increase this number to add capacity. MongoDB Cloud requires this parameter if you set **replicationSpecs**. If you specify a disk size below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations depend on whether you choose the default value or a custom value. The maximum value for disk storage cannot exceed 50 times the maximum RAM for the selected cluster. If you require more storage space, consider upgrading your cluster to a higher tier.`) + + cmd.Flags().StringVar(&opts.encryptionAtRestProvider, "encryptionAtRestProvider", "", `Cloud service provider that manages your customer keys to provide an additional layer of Encryption at Rest for the cluster.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the cluster.`) + + cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.mongoDBMajorVersion, "mongoDBMajorVersion", ""6.0"", `Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version.`) + + cmd.Flags().StringVar(&opts.mongoDBVersion, "mongoDBVersion", "", `Version of MongoDB that the cluster runs.`) + + cmd.Flags().StringVar(&opts.mongoURI, "mongoURI", "", `Base connection string that you can use to connect to the cluster. MongoDB Cloud displays the string only after the cluster starts, not while it builds the cluster.`) + + cmd.Flags().StringVar(&opts.mongoURIUpdated, "mongoURIUpdated", "", `Date and time when someone last updated the connection string. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC.`) + + cmd.Flags().StringVar(&opts.mongoURIWithOptions, "mongoURIWithOptions", "", `Connection string that you can use to connect to the cluster including the `replicaSet`, `ssl`, and `authSource` query parameters with values appropriate for the cluster. You may need to add MongoDB database users. The response returns this parameter once the cluster can receive requests, not while it builds the cluster.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster.`) + + cmd.Flags().IntVar(&opts.numShards, "numShards", 1, `Number of shards up to 50 to deploy for a sharded cluster. The resource returns `1` to indicate a replica set and values of `2` and higher to indicate a sharded cluster. The returned value equals the number of shards in the cluster.`) + + cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether the cluster is paused.`) + + cmd.Flags().BoolVar(&opts.pitEnabled, "pitEnabled", false, `Flag that indicates whether the cluster uses continuous cloud backups.`) + + cmd.Flags().BoolVar(&opts.providerBackupEnabled, "providerBackupEnabled", false, `Flag that indicates whether the M10 or higher cluster can perform Cloud Backups. If set to `true`, the cluster can perform backups. If this and **backupEnabled** are set to `false`, the cluster doesn't use MongoDB Cloud backups.`) + + cmd.Flags().ClusterProviderSettingsVar(&opts.providerSettings, "providerSettings", , ``) + + cmd.Flags().IntVar(&opts.replicationFactor, "replicationFactor", 3, `Number of members that belong to the replica set. Each member retains a copy of your databases, providing high availability and data redundancy. Use **replicationSpecs** instead.`) + + cmd.Flags().Map[string]RegionSpecVar(&opts.replicationSpec, "replicationSpec", , `Physical location where MongoDB Cloud provisions cluster nodes.`) + + cmd.Flags().ArraySliceVar(&opts.replicationSpecs, "replicationSpecs", nil, `List of settings that configure your cluster regions. + +- For Global Clusters, each object in the array represents one zone where MongoDB Cloud deploys your clusters nodes. +- For non-Global sharded clusters and replica sets, the single object represents where MongoDB Cloud deploys your clusters nodes.`) + + cmd.Flags().StringVar(&opts.rootCertType, "rootCertType", ""ISRGROOTX1"", `Root Certificate Authority that MongoDB Atlas clusters uses. MongoDB Cloud supports Internet Security Research Group.`) + + cmd.Flags().StringVar(&opts.srvAddress, "srvAddress", "", `Connection string that you can use to connect to the cluster. The `+srv` modifier forces the connection to use Transport Layer Security (TLS). The `mongoURI` parameter lists additional options.`) + + cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of the cluster.`) + + cmd.Flags().ArraySliceVar(&opts.tags, "tags", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster.`) + + cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the cluster. If set to `true`, MongoDB Cloud won't delete the cluster. If set to `false`, MongoDB Cloud will delete the cluster.`) + + cmd.Flags().StringVar(&opts.versionReleaseSystem, "versionReleaseSystem", ""LTS"", `Method by which the cluster maintains the MongoDB versions. If value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type upgradeSharedClusterToServerlessOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *upgradeSharedClusterToServerlessOpts) initClient() func() error { @@ -520,6 +620,7 @@ func (opts *upgradeSharedClusterToServerlessOpts) initClient() func() error { func (opts *upgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error { params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params).Execute() if err != nil { @@ -534,10 +635,10 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { opts := upgradeSharedClusterToServerlessOpts{} cmd := &cobra.Command{ - Use: "upgradeSharedClusterToServerless", + Use: "upgradeSharedClusterToServerless", Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -552,6 +653,32 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().ServerlessInstanceDescriptionConnectionStringsVar(&opts.connectionStrings, "connectionStrings", , ``) + + cmd.Flags().StringVar(&opts.createDate, "createDate", "", `Date and time when MongoDB Cloud created this serverless instance. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the serverless instance.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.mongoDBVersion, "mongoDBVersion", "", `Version of MongoDB that the serverless instance runs.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + + cmd.Flags().ServerlessProviderSettingsVar(&opts.providerSettings, "providerSettings", , ``) + + cmd.Flags().ServerlessBackupOptionsVar(&opts.serverlessBackupOptions, "serverlessBackupOptions", , ``) + + cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of the serverless instance.`) + + cmd.Flags().ArraySliceVar(&opts.tags, "tags", nil, ``) + + cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the serverless instance. If set to `true`, MongoDB Cloud won't delete the serverless instance. If set to `false`, MongoDB Cloud will delete the serverless instance.`) + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -559,8 +686,8 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { func clustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "clusters", - Short: `Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.`, + Use: "clusters", + Short: `Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.`, } cmd.AddCommand( getClusterAdvancedConfigurationBuilder(), @@ -575,3 +702,4 @@ func clustersBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index 7dcb12a113..4f8e06fcf7 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -75,6 +75,12 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().ArraySliceVar(&opts.actions, "actions", nil, `List of the individual privilege actions that the role grants.`) + + cmd.Flags().SetSliceVar(&opts.inheritedRoles, "inheritedRoles", nil, `List of the built-in roles that this custom role inherits.`) + + cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -306,6 +312,10 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.`) + cmd.Flags().ArraySliceVar(&opts.actions, "actions", nil, `List of the individual privilege actions that the role grants.`) + + cmd.Flags().SetSliceVar(&opts.inheritedRoles, "inheritedRoles", nil, `List of the built-in roles that this custom role inherits.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index 553bcaf717..6ee2bdcab5 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -18,17 +18,20 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *createDataFederationPrivateEndpointOpts) initClient() func() error { @@ -42,6 +45,7 @@ func (opts *createDataFederationPrivateEndpointOpts) initClient() func() error { func (opts *createDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -56,10 +60,10 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { opts := createDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "createDataFederationPrivateEndpoint", + Use: "createDataFederationPrivateEndpoint", Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -74,17 +78,26 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts.comment, "comment", "", `Human-readable string to associate with this private endpoint.`) + + cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint.`) + + cmd.Flags().StringVar(&opts.provider, "provider", ""AWS"", `Human-readable label that identifies the cloud service provider. Atlas Data Lake supports Amazon Web Services only.`) + + cmd.Flags().StringVar(&opts.type, "type", ""DATA_LAKE"", `Human-readable label that identifies the resource type associated with this private endpoint.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type createFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + skipRoleValidation bool } @@ -99,7 +112,7 @@ func (opts *createFederatedDatabaseOpts) initClient() func() error { func (opts *createFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, - + SkipRoleValidation: &opts.skipRoleValidation, } resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() @@ -115,10 +128,10 @@ func createFederatedDatabaseBuilder() *cobra.Command { opts := createFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "createFederatedDatabase", + Use: "createFederatedDatabase", Short: "Create One Federated Database Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -133,20 +146,35 @@ func createFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - + cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) + cmd.Flags().DataLakeCloudProviderConfigVar(&opts.cloudProviderConfig, "cloudProviderConfig", , ``) + + cmd.Flags().DataLakeDataProcessRegionVar(&opts.dataProcessRegion, "dataProcessRegion", , ``) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + + cmd.Flags().ArraySliceVar(&opts.hostnames, "hostnames", nil, `List that contains the hostnames assigned to the Data Lake instance.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the data lake.`) + + cmd.Flags().StringVar(&opts.state, "state", "", `Label that indicates the status of the Data Lake instance.`) + + cmd.Flags().DataLakeStorageVar(&opts.storage, "storage", , ``) + + _ = cmd.MarkFlagRequired("groupId") return cmd } - type createOneDataFederationQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string + limitName string + } func (opts *createOneDataFederationQueryLimitOpts) initClient() func() error { @@ -159,9 +187,10 @@ func (opts *createOneDataFederationQueryLimitOpts) initClient() func() error { func (opts *createOneDataFederationQueryLimitOpts) Run(ctx context.Context) error { params := &admin.CreateOneDataFederationQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, + LimitName: opts.limitName, + } resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params).Execute() if err != nil { @@ -176,10 +205,10 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { opts := createOneDataFederationQueryLimitOpts{} cmd := &cobra.Command{ - Use: "createOneDataFederationQueryLimit", + Use: "createOneDataFederationQueryLimit", Short: "Configure One Query Limit for One Federated Database Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -204,18 +233,35 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) + + + cmd.Flags().Int64Var(&opts.currentUsage, "currentUsage", 00, `Amount that indicates the current usage of the limit.`) + + cmd.Flags().Int64Var(&opts.defaultLimit, "defaultLimit", 00, `Default value of the limit.`) + + cmd.Flags().StringVar(&opts.lastModifiedDate, "lastModifiedDate", "", `Only used for Data Federation limits. Timestamp that indicates when this usage limit was last modified. This field uses the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().Int64Var(&opts.maximumLimit, "maximumLimit", 00, `Maximum value of the limit.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the user-managed limit to modify.`) + + cmd.Flags().StringVar(&opts.overrunPolicy, "overrunPolicy", "", `Only used for Data Federation limits. Action to take when the usage limit is exceeded. If limit span is set to QUERY, this is ignored because MongoDB Cloud stops the query when it exceeds the usage limit.`) + + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database Instance. If specified, the usage limit is for the specified federated database instance only. If omitted, the usage limit is for all federated database instances in the project.`) + + cmd.Flags().Int64Var(&opts.value, "value", 00, `Amount to set the limit to.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } - type deleteDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string endpointId string } @@ -229,7 +275,7 @@ func (opts *deleteDataFederationPrivateEndpointOpts) initClient() func() error { func (opts *deleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.DeleteDataFederationPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EndpointId: opts.endpointId, } resp, _, err := opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params).Execute() @@ -245,10 +291,10 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { opts := deleteDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "deleteDataFederationPrivateEndpoint", + Use: "deleteDataFederationPrivateEndpoint", Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -265,16 +311,16 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") return cmd } - type deleteFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } @@ -288,7 +334,7 @@ func (opts *deleteFederatedDatabaseOpts) initClient() func() error { func (opts *deleteFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.DeleteFederatedDatabaseApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params).Execute() @@ -304,10 +350,10 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { opts := deleteFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "deleteFederatedDatabase", + Use: "deleteFederatedDatabase", Short: "Remove One Federated Database Instance from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -324,18 +370,18 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } - type deleteOneDataFederationInstanceQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string + limitName string } func (opts *deleteOneDataFederationInstanceQueryLimitOpts) initClient() func() error { @@ -348,9 +394,9 @@ func (opts *deleteOneDataFederationInstanceQueryLimitOpts) initClient() func() e func (opts *deleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Context) error { params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, + LimitName: opts.limitName, } resp, _, err := opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params).Execute() if err != nil { @@ -365,10 +411,10 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { opts := deleteOneDataFederationInstanceQueryLimitOpts{} cmd := &cobra.Command{ - Use: "deleteOneDataFederationInstanceQueryLimit", + Use: "deleteOneDataFederationInstanceQueryLimit", Short: "Delete One Query Limit For One Federated Database Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -394,20 +440,20 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } - type downloadFederatedDatabaseQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - endDate int64 - startDate int64 + endDate int64 + startDate int64 } func (opts *downloadFederatedDatabaseQueryLogsOpts) initClient() func() error { @@ -420,10 +466,10 @@ func (opts *downloadFederatedDatabaseQueryLogsOpts) initClient() func() error { func (opts *downloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) error { params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - EndDate: &opts.endDate, - StartDate: &opts.startDate, + EndDate: &opts.endDate, + StartDate: &opts.startDate, } resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params).Execute() if err != nil { @@ -438,10 +484,10 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { opts := downloadFederatedDatabaseQueryLogsOpts{} cmd := &cobra.Command{ - Use: "downloadFederatedDatabaseQueryLogs", + Use: "downloadFederatedDatabaseQueryLogs", Short: "Download Query Logs for One Federated Database Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -460,16 +506,16 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } - type getDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string endpointId string } @@ -483,7 +529,7 @@ func (opts *getDataFederationPrivateEndpointOpts) initClient() func() error { func (opts *getDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { params := &admin.GetDataFederationPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EndpointId: opts.endpointId, } resp, _, err := opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params).Execute() @@ -499,10 +545,10 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { opts := getDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "getDataFederationPrivateEndpoint", + Use: "getDataFederationPrivateEndpoint", Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -519,16 +565,16 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") return cmd } - type getFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } @@ -542,7 +588,7 @@ func (opts *getFederatedDatabaseOpts) initClient() func() error { func (opts *getFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.GetFederatedDatabaseApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params).Execute() @@ -558,10 +604,10 @@ func getFederatedDatabaseBuilder() *cobra.Command { opts := getFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "getFederatedDatabase", + Use: "getFederatedDatabase", Short: "Return One Federated Database Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -578,19 +624,19 @@ func getFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } - type listDataFederationPrivateEndpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listDataFederationPrivateEndpointsOpts) initClient() func() error { @@ -603,10 +649,10 @@ func (opts *listDataFederationPrivateEndpointsOpts) initClient() func() error { func (opts *listDataFederationPrivateEndpointsOpts) Run(ctx context.Context) error { params := &admin.ListDataFederationPrivateEndpointsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params).Execute() if err != nil { @@ -621,10 +667,10 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { opts := listDataFederationPrivateEndpointsOpts{} cmd := &cobra.Command{ - Use: "listDataFederationPrivateEndpoints", + Use: "listDataFederationPrivateEndpoints", Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -643,16 +689,16 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type listFederatedDatabasesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - type_ string + type_ string } func (opts *listFederatedDatabasesOpts) initClient() func() error { @@ -666,7 +712,7 @@ func (opts *listFederatedDatabasesOpts) initClient() func() error { func (opts *listFederatedDatabasesOpts) Run(ctx context.Context) error { params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, - Type_: &opts.type_, + Type_: &opts.type_, } resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params).Execute() if err != nil { @@ -681,10 +727,10 @@ func listFederatedDatabasesBuilder() *cobra.Command { opts := listFederatedDatabasesOpts{} cmd := &cobra.Command{ - Use: "listFederatedDatabases", + Use: "listFederatedDatabases", Short: "Return All Federated Database Instances in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -701,17 +747,17 @@ func listFederatedDatabasesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type returnFederatedDatabaseQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string + limitName string } func (opts *returnFederatedDatabaseQueryLimitOpts) initClient() func() error { @@ -724,9 +770,9 @@ func (opts *returnFederatedDatabaseQueryLimitOpts) initClient() func() error { func (opts *returnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context) error { params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, + LimitName: opts.limitName, } resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params).Execute() if err != nil { @@ -741,10 +787,10 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { opts := returnFederatedDatabaseQueryLimitOpts{} cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimit", + Use: "returnFederatedDatabaseQueryLimit", Short: "Return One Federated Database Instance Query Limit for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -770,17 +816,17 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } - type returnFederatedDatabaseQueryLimitsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } @@ -794,7 +840,7 @@ func (opts *returnFederatedDatabaseQueryLimitsOpts) initClient() func() error { func (opts *returnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) error { params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params).Execute() @@ -810,10 +856,10 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { opts := returnFederatedDatabaseQueryLimitsOpts{} cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimits", + Use: "returnFederatedDatabaseQueryLimits", Short: "Return All Query Limits for One Federated Database Instance", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -830,18 +876,19 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } - type updateFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - tenantName string + client *admin.APIClient + groupId string + tenantName string skipRoleValidation bool + } func (opts *updateFederatedDatabaseOpts) initClient() func() error { @@ -854,9 +901,10 @@ func (opts *updateFederatedDatabaseOpts) initClient() func() error { func (opts *updateFederatedDatabaseOpts) Run(ctx context.Context) error { params := &admin.UpdateFederatedDatabaseApiParams{ - GroupId: opts.groupId, - TenantName: opts.tenantName, + GroupId: opts.groupId, + TenantName: opts.tenantName, SkipRoleValidation: &opts.skipRoleValidation, + } resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { @@ -871,10 +919,10 @@ func updateFederatedDatabaseBuilder() *cobra.Command { opts := updateFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "updateFederatedDatabase", + Use: "updateFederatedDatabase", Short: "Update One Federated Database Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -891,6 +939,22 @@ func updateFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to update.`) cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) + + + cmd.Flags().DataLakeCloudProviderConfigVar(&opts.cloudProviderConfig, "cloudProviderConfig", , ``) + + cmd.Flags().DataLakeDataProcessRegionVar(&opts.dataProcessRegion, "dataProcessRegion", , ``) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + + cmd.Flags().ArraySliceVar(&opts.hostnames, "hostnames", nil, `List that contains the hostnames assigned to the Data Lake instance.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the data lake.`) + + cmd.Flags().StringVar(&opts.state, "state", "", `Label that indicates the status of the Data Lake instance.`) + + cmd.Flags().DataLakeStorageVar(&opts.storage, "storage", , ``) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -900,8 +964,8 @@ func updateFederatedDatabaseBuilder() *cobra.Command { func dataFederationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "dataFederation", - Short: `Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.`, + Use: "dataFederation", + Short: `Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.`, } cmd.AddCommand( createDataFederationPrivateEndpointBuilder(), @@ -921,3 +985,4 @@ func dataFederationBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 342ed41148..194fd2d25b 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -18,17 +18,20 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createPipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *createPipelineOpts) initClient() func() error { @@ -42,6 +45,7 @@ func (opts *createPipelineOpts) initClient() func() error { func (opts *createPipelineOpts) Run(ctx context.Context) error { params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() if err != nil { @@ -56,10 +60,10 @@ func createPipelineBuilder() *cobra.Command { opts := createPipelineOpts{} cmd := &cobra.Command{ - Use: "createPipeline", + Use: "createPipeline", Short: "Create One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -74,16 +78,35 @@ func createPipelineBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the Data Lake Pipeline.`) + + cmd.Flags().StringVar(&opts.createdDate, "createdDate", "", `Timestamp that indicates when the Data Lake Pipeline was created.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the group.`) + + cmd.Flags().StringVar(&opts.lastUpdatedDate, "lastUpdatedDate", "", `Timestamp that indicates the last time that the Data Lake Pipeline was updated.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Name of this Data Lake Pipeline.`) + + cmd.Flags().IngestionSinkVar(&opts.sink, "sink", , ``) + + cmd.Flags().IngestionSourceVar(&opts.source, "source", , ``) + + cmd.Flags().StringVar(&opts.state, "state", "", `State of this Data Lake Pipeline.`) + + cmd.Flags().ArraySliceVar(&opts.transformations, "transformations", nil, `Fields to be excluded for this Data Lake Pipeline.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type deletePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -97,7 +120,7 @@ func (opts *deletePipelineOpts) initClient() func() error { func (opts *deletePipelineOpts) Run(ctx context.Context) error { params := &admin.DeletePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params).Execute() @@ -113,10 +136,10 @@ func deletePipelineBuilder() *cobra.Command { opts := deletePipelineOpts{} cmd := &cobra.Command{ - Use: "deletePipeline", + Use: "deletePipeline", Short: "Remove One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -133,17 +156,17 @@ func deletePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } - type deletePipelineRunDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string + client *admin.APIClient + groupId string + pipelineName string pipelineRunId string } @@ -157,8 +180,8 @@ func (opts *deletePipelineRunDatasetOpts) initClient() func() error { func (opts *deletePipelineRunDatasetOpts) Run(ctx context.Context) error { params := &admin.DeletePipelineRunDatasetApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params).Execute() @@ -174,10 +197,10 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { opts := deletePipelineRunDatasetOpts{} cmd := &cobra.Command{ - Use: "deletePipelineRunDataset", + Use: "deletePipelineRunDataset", Short: "Delete Pipeline Run Dataset", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -195,17 +218,17 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd } - type getPipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -219,7 +242,7 @@ func (opts *getPipelineOpts) initClient() func() error { func (opts *getPipelineOpts) Run(ctx context.Context) error { params := &admin.GetPipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params).Execute() @@ -235,10 +258,10 @@ func getPipelineBuilder() *cobra.Command { opts := getPipelineOpts{} cmd := &cobra.Command{ - Use: "getPipeline", + Use: "getPipeline", Short: "Return One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -255,17 +278,17 @@ func getPipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } - type getPipelineRunOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string + client *admin.APIClient + groupId string + pipelineName string pipelineRunId string } @@ -279,8 +302,8 @@ func (opts *getPipelineRunOpts) initClient() func() error { func (opts *getPipelineRunOpts) Run(ctx context.Context) error { params := &admin.GetPipelineRunApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params).Execute() @@ -296,10 +319,10 @@ func getPipelineRunBuilder() *cobra.Command { opts := getPipelineRunOpts{} cmd := &cobra.Command{ - Use: "getPipelineRun", + Use: "getPipelineRun", Short: "Return One Data Lake Pipeline Run", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -317,21 +340,21 @@ func getPipelineRunBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd } - type listPipelineRunsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string - includeCount bool - itemsPerPage int - pageNum int + client *admin.APIClient + groupId string + pipelineName string + includeCount bool + itemsPerPage int + pageNum int createdBefore string } @@ -345,11 +368,11 @@ func (opts *listPipelineRunsOpts) initClient() func() error { func (opts *listPipelineRunsOpts) Run(ctx context.Context) error { params := &admin.ListPipelineRunsApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, CreatedBefore: convertTime(&opts.createdBefore), } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params).Execute() @@ -365,10 +388,10 @@ func listPipelineRunsBuilder() *cobra.Command { opts := listPipelineRunsOpts{} cmd := &cobra.Command{ - Use: "listPipelineRuns", + Use: "listPipelineRuns", Short: "Return All Data Lake Pipeline Runs from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -389,16 +412,16 @@ func listPipelineRunsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", `If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } - type listPipelineSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -412,7 +435,7 @@ func (opts *listPipelineSchedulesOpts) initClient() func() error { func (opts *listPipelineSchedulesOpts) Run(ctx context.Context) error { params := &admin.ListPipelineSchedulesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params).Execute() @@ -428,10 +451,10 @@ func listPipelineSchedulesBuilder() *cobra.Command { opts := listPipelineSchedulesOpts{} cmd := &cobra.Command{ - Use: "listPipelineSchedules", + Use: "listPipelineSchedules", Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -448,20 +471,20 @@ func listPipelineSchedulesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } - type listPipelineSnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string - includeCount bool - itemsPerPage int - pageNum int + client *admin.APIClient + groupId string + pipelineName string + includeCount bool + itemsPerPage int + pageNum int completedAfter string } @@ -475,11 +498,11 @@ func (opts *listPipelineSnapshotsOpts) initClient() func() error { func (opts *listPipelineSnapshotsOpts) Run(ctx context.Context) error { params := &admin.ListPipelineSnapshotsApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, CompletedAfter: convertTime(&opts.completedAfter), } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params).Execute() @@ -495,10 +518,10 @@ func listPipelineSnapshotsBuilder() *cobra.Command { opts := listPipelineSnapshotsOpts{} cmd := &cobra.Command{ - Use: "listPipelineSnapshots", + Use: "listPipelineSnapshots", Short: "Return Available Backup Snapshots for One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -519,15 +542,15 @@ func listPipelineSnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", `Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } - type listPipelinesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -556,10 +579,10 @@ func listPipelinesBuilder() *cobra.Command { opts := listPipelinesOpts{} cmd := &cobra.Command{ - Use: "listPipelines", + Use: "listPipelines", Short: "Return All Data Lake Pipelines from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -575,15 +598,15 @@ func listPipelinesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type pausePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -597,7 +620,7 @@ func (opts *pausePipelineOpts) initClient() func() error { func (opts *pausePipelineOpts) Run(ctx context.Context) error { params := &admin.PausePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params).Execute() @@ -613,10 +636,10 @@ func pausePipelineBuilder() *cobra.Command { opts := pausePipelineOpts{} cmd := &cobra.Command{ - Use: "pausePipeline", + Use: "pausePipeline", Short: "Pause One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -633,16 +656,16 @@ func pausePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } - type resumePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -656,7 +679,7 @@ func (opts *resumePipelineOpts) initClient() func() error { func (opts *resumePipelineOpts) Run(ctx context.Context) error { params := &admin.ResumePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params).Execute() @@ -672,10 +695,10 @@ func resumePipelineBuilder() *cobra.Command { opts := resumePipelineOpts{} cmd := &cobra.Command{ - Use: "resumePipeline", + Use: "resumePipeline", Short: "Resume One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -692,17 +715,18 @@ func resumePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } - type triggerSnapshotIngestionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string + } func (opts *triggerSnapshotIngestionOpts) initClient() func() error { @@ -715,8 +739,9 @@ func (opts *triggerSnapshotIngestionOpts) initClient() func() error { func (opts *triggerSnapshotIngestionOpts) Run(ctx context.Context) error { params := &admin.TriggerSnapshotIngestionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, + } resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() if err != nil { @@ -731,10 +756,10 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { opts := triggerSnapshotIngestionOpts{} cmd := &cobra.Command{ - Use: "triggerSnapshotIngestion", + Use: "triggerSnapshotIngestion", Short: "Trigger on demand snapshot ingestion", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -750,18 +775,22 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + + + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal character string that identifies the snapshot.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } - type updatePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string + } func (opts *updatePipelineOpts) initClient() func() error { @@ -774,8 +803,9 @@ func (opts *updatePipelineOpts) initClient() func() error { func (opts *updatePipelineOpts) Run(ctx context.Context) error { params := &admin.UpdatePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, + } resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() if err != nil { @@ -790,10 +820,10 @@ func updatePipelineBuilder() *cobra.Command { opts := updatePipelineOpts{} cmd := &cobra.Command{ - Use: "updatePipeline", + Use: "updatePipeline", Short: "Update One Data Lake Pipeline", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -809,6 +839,26 @@ func updatePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + + + cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the Data Lake Pipeline.`) + + cmd.Flags().StringVar(&opts.createdDate, "createdDate", "", `Timestamp that indicates when the Data Lake Pipeline was created.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the group.`) + + cmd.Flags().StringVar(&opts.lastUpdatedDate, "lastUpdatedDate", "", `Timestamp that indicates the last time that the Data Lake Pipeline was updated.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Name of this Data Lake Pipeline.`) + + cmd.Flags().IngestionSinkVar(&opts.sink, "sink", , ``) + + cmd.Flags().IngestionSourceVar(&opts.source, "source", , ``) + + cmd.Flags().StringVar(&opts.state, "state", "", `State of this Data Lake Pipeline.`) + + cmd.Flags().ArraySliceVar(&opts.transformations, "transformations", nil, `Fields to be excluded for this Data Lake Pipeline.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -817,8 +867,8 @@ func updatePipelineBuilder() *cobra.Command { func dataLakePipelinesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "dataLakePipelines", - Short: `Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.`, + Use: "dataLakePipelines", + Short: `Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.`, } cmd.AddCommand( createPipelineBuilder(), @@ -837,3 +887,4 @@ func dataLakePipelinesBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index c0e405a7f5..ce388e1938 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -75,6 +75,46 @@ func createDatabaseUserBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.awsIAMType, "awsIAMType", ""NONE"", `Human-readable label that indicates whether the new database user authenticates with the Amazon Web Services (AWS) Identity and Access Management (IAM) credentials associated with the user or the user's role.`) + + cmd.Flags().StringVar(&opts.databaseName, "databaseName", ""admin"", `Database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB.`) + + cmd.Flags().StringVar(&opts.deleteAfterDate, "deleteAfterDate", "", `Date and time when MongoDB Cloud deletes the user. This parameter expresses its value in the ISO 8601 timestamp format in UTC and can include the time zone designation. You must specify a future date that falls within one week of making the Application Programming Interface (API) request.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project.`) + + cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `List that contains the key-value pairs for tagging and categorizing the MongoDB database user. The labels that you define do not appear in the console.`) + + cmd.Flags().StringVar(&opts.ldapAuthType, "ldapAuthType", ""NONE"", `Part of the Lightweight Directory Access Protocol (LDAP) record that the database uses to authenticate this database user on the LDAP host.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.password, "password", "", `Alphanumeric string that authenticates this database user against the database specified in `databaseName`. To authenticate with SCRAM-SHA, you must specify this parameter. This parameter doesn't appear in this response.`) + + cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List that provides the pairings of one role with one applicable database.`) + + cmd.Flags().ArraySliceVar(&opts.scopes, "scopes", nil, `List that contains clusters and MongoDB Atlas Data Lakes that this database user can access. If omitted, MongoDB Cloud grants the database user access to all the clusters and MongoDB Atlas Data Lakes in the project.`) + + cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + +| Authentication Method | Parameter Needed | Parameter Value | username Format | +|---|---|---|---| +| AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | +| AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | +| x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | +`) + + cmd.Flags().StringVar(&opts.x509Type, "x509Type", ""NONE"", `X.509 method that MongoDB Cloud uses to authenticate the database user. + +- For application-managed X.509, specify `MANAGED`. +- For self-managed X.509, specify `CUSTOMER`. + +Users created with the `CUSTOMER` method require a Common Name (CN) in the **username** parameter. You must create externally authenticated users on the `$external` database.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -359,6 +399,46 @@ func updateDatabaseUserBuilder() *cobra.Command { | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | `) + cmd.Flags().StringVar(&opts.awsIAMType, "awsIAMType", ""NONE"", `Human-readable label that indicates whether the new database user authenticates with the Amazon Web Services (AWS) Identity and Access Management (IAM) credentials associated with the user or the user's role.`) + + cmd.Flags().StringVar(&opts.databaseName, "databaseName", ""admin"", `Database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB.`) + + cmd.Flags().StringVar(&opts.deleteAfterDate, "deleteAfterDate", "", `Date and time when MongoDB Cloud deletes the user. This parameter expresses its value in the ISO 8601 timestamp format in UTC and can include the time zone designation. You must specify a future date that falls within one week of making the Application Programming Interface (API) request.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project.`) + + cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `List that contains the key-value pairs for tagging and categorizing the MongoDB database user. The labels that you define do not appear in the console.`) + + cmd.Flags().StringVar(&opts.ldapAuthType, "ldapAuthType", ""NONE"", `Part of the Lightweight Directory Access Protocol (LDAP) record that the database uses to authenticate this database user on the LDAP host.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.password, "password", "", `Alphanumeric string that authenticates this database user against the database specified in `databaseName`. To authenticate with SCRAM-SHA, you must specify this parameter. This parameter doesn't appear in this response.`) + + cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List that provides the pairings of one role with one applicable database.`) + + cmd.Flags().ArraySliceVar(&opts.scopes, "scopes", nil, `List that contains clusters and MongoDB Atlas Data Lakes that this database user can access. If omitted, MongoDB Cloud grants the database user access to all the clusters and MongoDB Atlas Data Lakes in the project.`) + + cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + +| Authentication Method | Parameter Needed | Parameter Value | username Format | +|---|---|---|---| +| AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | +| AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | +| x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | +| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | +`) + + cmd.Flags().StringVar(&opts.x509Type, "x509Type", ""NONE"", `X.509 method that MongoDB Cloud uses to authenticate the database user. + +- For application-managed X.509, specify `MANAGED`. +- For self-managed X.509, specify `CUSTOMER`. + +Users created with the `CUSTOMER` method require a Common Name (CN) in the **username** parameter. You must create externally authenticated users on the `$external` database.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index f1d27b3add..bf44409f48 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -18,16 +18,18 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type getEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -56,10 +58,10 @@ func getEncryptionAtRestBuilder() *cobra.Command { opts := getEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "getEncryptionAtRest", + Use: "getEncryptionAtRest", Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,15 +77,16 @@ func getEncryptionAtRestBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type updateEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *updateEncryptionAtRestOpts) initClient() func() error { @@ -97,6 +100,7 @@ func (opts *updateEncryptionAtRestOpts) initClient() func() error { func (opts *updateEncryptionAtRestOpts) Run(ctx context.Context) error { params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params).Execute() if err != nil { @@ -111,10 +115,10 @@ func updateEncryptionAtRestBuilder() *cobra.Command { opts := updateEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "updateEncryptionAtRest", + Use: "updateEncryptionAtRest", Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -129,6 +133,14 @@ func updateEncryptionAtRestBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().AWSKMSVar(&opts.awsKms, "awsKms", , ``) + + cmd.Flags().AzureKeyVaultVar(&opts.azureKeyVault, "azureKeyVault", , ``) + + cmd.Flags().GoogleCloudKMSVar(&opts.googleCloudKms, "googleCloudKms", , ``) + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,8 +148,8 @@ func updateEncryptionAtRestBuilder() *cobra.Command { func encryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "encryptionAtRestUsingCustomerKeyManagement", - Short: `Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.`, + Use: "encryptionAtRestUsingCustomerKeyManagement", + Short: `Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.`, } cmd.AddCommand( getEncryptionAtRestBuilder(), @@ -145,3 +157,4 @@ func encryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index 1ba8859c28..853dfbf669 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -18,18 +18,21 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string + } func (opts *createRoleMappingOpts) initClient() func() error { @@ -43,7 +46,8 @@ func (opts *createRoleMappingOpts) initClient() func() error { func (opts *createRoleMappingOpts) Run(ctx context.Context) error { params := &admin.CreateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, + } resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -58,10 +62,10 @@ func createRoleMappingBuilder() *cobra.Command { opts := createRoleMappingOpts{} cmd := &cobra.Command{ - Use: "createRoleMapping", + Use: "createRoleMapping", Short: "Add One Role Mapping to One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,16 +79,23 @@ func createRoleMappingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + + + cmd.Flags().StringVar(&opts.externalGroupName, "externalGroupName", "", `Unique human-readable label that identifies the identity provider group to whichthis role mapping applies.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this role mapping.`) + + cmd.Flags().SetSliceVar(&opts.roleAssignments, "roleAssignments", nil, `Atlas roles and the unique identifiers of the groups and organizations associated with each role.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } - type deleteFederationAppOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -113,10 +124,10 @@ func deleteFederationAppBuilder() *cobra.Command { opts := deleteFederationAppOpts{} cmd := &cobra.Command{ - Use: "deleteFederationApp", + Use: "deleteFederationApp", Short: "Delete the federation settings instance.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -130,17 +141,17 @@ func deleteFederationAppBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } - type deleteRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string + id string + orgId string } func (opts *deleteRoleMappingOpts) initClient() func() error { @@ -154,8 +165,8 @@ func (opts *deleteRoleMappingOpts) initClient() func() error { func (opts *deleteRoleMappingOpts) Run(ctx context.Context) error { params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, + Id: opts.id, + OrgId: opts.orgId, } _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -170,10 +181,10 @@ func deleteRoleMappingBuilder() *cobra.Command { opts := deleteRoleMappingOpts{} cmd := &cobra.Command{ - Use: "deleteRoleMapping", + Use: "deleteRoleMapping", Short: "Remove One Role Mapping from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -189,18 +200,18 @@ func deleteRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") return cmd } - type getConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } func (opts *getConnectedOrgConfigOpts) initClient() func() error { @@ -214,7 +225,7 @@ func (opts *getConnectedOrgConfigOpts) initClient() func() error { func (opts *getConnectedOrgConfigOpts) Run(ctx context.Context) error { params := &admin.GetConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { @@ -229,10 +240,10 @@ func getConnectedOrgConfigBuilder() *cobra.Command { opts := getConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "getConnectedOrgConfig", + Use: "getConnectedOrgConfig", Short: "Return One Org Config Connected to One Federation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -247,16 +258,16 @@ func getConnectedOrgConfigBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } - type getFederationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *getFederationSettingsOpts) initClient() func() error { @@ -284,10 +295,10 @@ func getFederationSettingsBuilder() *cobra.Command { opts := getFederationSettingsOpts{} cmd := &cobra.Command{ - Use: "getFederationSettings", + Use: "getFederationSettings", Short: "Return Federation Settings for One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -301,16 +312,16 @@ func getFederationSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type getIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string + identityProviderId string } func (opts *getIdentityProviderOpts) initClient() func() error { @@ -324,7 +335,7 @@ func (opts *getIdentityProviderOpts) initClient() func() error { func (opts *getIdentityProviderOpts) Run(ctx context.Context) error { params := &admin.GetIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, + IdentityProviderId: opts.identityProviderId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params).Execute() if err != nil { @@ -339,10 +350,10 @@ func getIdentityProviderBuilder() *cobra.Command { opts := getIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "getIdentityProvider", + Use: "getIdentityProvider", Short: "Return one identity provider from the specified federation.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -357,17 +368,17 @@ func getIdentityProviderBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } - type getIdentityProviderMetadataOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string + identityProviderId string } func (opts *getIdentityProviderMetadataOpts) initClient() func() error { @@ -381,7 +392,7 @@ func (opts *getIdentityProviderMetadataOpts) initClient() func() error { func (opts *getIdentityProviderMetadataOpts) Run(ctx context.Context) error { params := &admin.GetIdentityProviderMetadataApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, + IdentityProviderId: opts.identityProviderId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params).Execute() if err != nil { @@ -396,10 +407,10 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { opts := getIdentityProviderMetadataOpts{} cmd := &cobra.Command{ - Use: "getIdentityProviderMetadata", + Use: "getIdentityProviderMetadata", Short: "Return the metadata of one identity provider in the specified federation.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -414,18 +425,18 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } - type getRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string + id string + orgId string } func (opts *getRoleMappingOpts) initClient() func() error { @@ -439,8 +450,8 @@ func (opts *getRoleMappingOpts) initClient() func() error { func (opts *getRoleMappingOpts) Run(ctx context.Context) error { params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, + Id: opts.id, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -455,10 +466,10 @@ func getRoleMappingBuilder() *cobra.Command { opts := getRoleMappingOpts{} cmd := &cobra.Command{ - Use: "getRoleMapping", + Use: "getRoleMapping", Short: "Return One Role Mapping from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -474,16 +485,16 @@ func getRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") return cmd } - type listConnectedOrgConfigsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -512,10 +523,10 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { opts := listConnectedOrgConfigsOpts{} cmd := &cobra.Command{ - Use: "listConnectedOrgConfigs", + Use: "listConnectedOrgConfigs", Short: "Return All Connected Org Configs from the Federation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -529,14 +540,14 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } - type listIdentityProvidersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -565,10 +576,10 @@ func listIdentityProvidersBuilder() *cobra.Command { opts := listIdentityProvidersOpts{} cmd := &cobra.Command{ - Use: "listIdentityProviders", + Use: "listIdentityProviders", Short: "Return all identity providers from the specified federation.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -582,16 +593,16 @@ func listIdentityProvidersBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } - type listRoleMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } func (opts *listRoleMappingsOpts) initClient() func() error { @@ -605,7 +616,7 @@ func (opts *listRoleMappingsOpts) initClient() func() error { func (opts *listRoleMappingsOpts) Run(ctx context.Context) error { params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params).Execute() if err != nil { @@ -620,10 +631,10 @@ func listRoleMappingsBuilder() *cobra.Command { opts := listRoleMappingsOpts{} cmd := &cobra.Command{ - Use: "listRoleMappings", + Use: "listRoleMappings", Short: "Return All Role Mappings from One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -638,17 +649,17 @@ func listRoleMappingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } - type removeConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } func (opts *removeConnectedOrgConfigOpts) initClient() func() error { @@ -662,7 +673,7 @@ func (opts *removeConnectedOrgConfigOpts) initClient() func() error { func (opts *removeConnectedOrgConfigOpts) Run(ctx context.Context) error { params := &admin.RemoveConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { @@ -677,10 +688,10 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { opts := removeConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "removeConnectedOrgConfig", + Use: "removeConnectedOrgConfig", Short: "Remove One Org Config Connected to One Federation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -695,17 +706,18 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } - type updateConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string + } func (opts *updateConnectedOrgConfigOpts) initClient() func() error { @@ -719,7 +731,8 @@ func (opts *updateConnectedOrgConfigOpts) initClient() func() error { func (opts *updateConnectedOrgConfigOpts) Run(ctx context.Context) error { params := &admin.UpdateConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, + } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { @@ -734,10 +747,10 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { opts := updateConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "updateConnectedOrgConfig", + Use: "updateConnectedOrgConfig", Short: "Update One Org Config Connected to One Federation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -751,18 +764,36 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.`) + + + cmd.Flags().SetSliceVar(&opts.dataAccessIdentityProviderIds, "dataAccessIdentityProviderIds", nil, `The collection of unique ids of the identity providers for org's data access.`) + + cmd.Flags().SetSliceVar(&opts.domainAllowList, "domainAllowList", nil, `Approved domains that restrict users who can join the organization based on their email address.`) + + cmd.Flags().BoolVar(&opts.domainRestrictionEnabled, "domainRestrictionEnabled", false, `Value that indicates whether domain restriction is enabled for this connected org.`) + + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider that this connected org config is associated with.`) + + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration.`) + + cmd.Flags().SetSliceVar(&opts.postAuthRoleGrants, "postAuthRoleGrants", nil, `Atlas roles that are granted to a user in this organization after authenticating.`) + + cmd.Flags().SetSliceVar(&opts.roleMappings, "roleMappings", nil, `Role mappings that are configured in this organization.`) + + cmd.Flags().ArraySliceVar(&opts.userConflicts, "userConflicts", nil, `List that contains the users who have an email address that doesn't match any domain on the allowed list.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } - type updateIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string + identityProviderId string + } func (opts *updateIdentityProviderOpts) initClient() func() error { @@ -776,7 +807,8 @@ func (opts *updateIdentityProviderOpts) initClient() func() error { func (opts *updateIdentityProviderOpts) Run(ctx context.Context) error { params := &admin.UpdateIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, + IdentityProviderId: opts.identityProviderId, + } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params).Execute() if err != nil { @@ -791,10 +823,10 @@ func updateIdentityProviderBuilder() *cobra.Command { opts := updateIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "updateIdentityProvider", + Use: "updateIdentityProvider", Short: "Update the identity provider.", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -808,19 +840,43 @@ func updateIdentityProviderBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) + + + cmd.Flags().SetSliceVar(&opts.associatedDomains, "associatedDomains", nil, `List that contains the domains associated with the identity provider.`) + + cmd.Flags().StringVar(&opts.description, "description", "", `The description for the identity provider.`) + + cmd.Flags().StringVar(&opts.displayName, "displayName", "", `Human-readable label that identifies the identity provider.`) + + cmd.Flags().StringVar(&opts.issuerUri, "issuerUri", "", `Unique string that identifies the issuer of the SAML Assertion.`) + + cmd.Flags().PemFileInfoVar(&opts.pemFileInfo, "pemFileInfo", , ``) + + cmd.Flags().StringVar(&opts.protocol, "protocol", "", `The protocol for the identity provider.`) + + cmd.Flags().StringVar(&opts.requestBinding, "requestBinding", "", `SAML Authentication Request Protocol HTTP method binding (POST or REDIRECT) that Federated Authentication uses to send the authentication request.`) + + cmd.Flags().StringVar(&opts.responseSignatureAlgorithm, "responseSignatureAlgorithm", "", `Signature algorithm that Federated Authentication uses to encrypt the identity provider signature.`) + + cmd.Flags().BoolVar(&opts.ssoDebugEnabled, "ssoDebugEnabled", false, `Flag that indicates whether the identity provider has SSO debug enabled.`) + + cmd.Flags().StringVar(&opts.ssoUrl, "ssoUrl", "", `Unique string that identifies the intended audience of the SAML assertion.`) + + cmd.Flags().StringVar(&opts.status, "status", "", `String enum that indicates whether the identity provider is active.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } - type updateRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string + id string + orgId string + } func (opts *updateRoleMappingOpts) initClient() func() error { @@ -834,8 +890,9 @@ func (opts *updateRoleMappingOpts) initClient() func() error { func (opts *updateRoleMappingOpts) Run(ctx context.Context) error { params := &admin.UpdateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, + Id: opts.id, + OrgId: opts.orgId, + } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -850,10 +907,10 @@ func updateRoleMappingBuilder() *cobra.Command { opts := updateRoleMappingOpts{} cmd := &cobra.Command{ - Use: "updateRoleMapping", + Use: "updateRoleMapping", Short: "Update One Role Mapping in One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -868,6 +925,14 @@ func updateRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + + + cmd.Flags().StringVar(&opts.externalGroupName, "externalGroupName", "", `Unique human-readable label that identifies the identity provider group to whichthis role mapping applies.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this role mapping.`) + + cmd.Flags().SetSliceVar(&opts.roleAssignments, "roleAssignments", nil, `Atlas roles and the unique identifiers of the groups and organizations associated with each role.`) + _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") @@ -877,8 +942,8 @@ func updateRoleMappingBuilder() *cobra.Command { func federatedAuthenticationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "federatedAuthentication", - Short: `Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.`, + Use: "federatedAuthentication", + Short: `Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.`, } cmd.AddCommand( createRoleMappingBuilder(), @@ -899,3 +964,4 @@ func federatedAuthenticationBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index 54ccaa18a1..47a227f76d 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -18,18 +18,21 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createCustomZoneMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createCustomZoneMappingOpts) initClient() func() error { @@ -42,8 +45,9 @@ func (opts *createCustomZoneMappingOpts) initClient() func() error { func (opts *createCustomZoneMappingOpts) Run(ctx context.Context) error { params := &admin.CreateCustomZoneMappingApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params).Execute() if err != nil { @@ -58,10 +62,10 @@ func createCustomZoneMappingBuilder() *cobra.Command { opts := createCustomZoneMappingOpts{} cmd := &cobra.Command{ - Use: "createCustomZoneMapping", + Use: "createCustomZoneMapping", Short: "Add One Entry to One Custom Zone Mapping", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,18 +81,26 @@ func createCustomZoneMappingBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + + + cmd.Flags().Map[string]stringVar(&opts.customZoneMapping, "customZoneMapping", , `List that contains comma-separated key value pairs to map zones to geographic regions. These pairs map an ISO 3166-1a2 location code, with an ISO 3166-2 subdivision code when possible, to a unique 24-hexadecimal string that identifies the custom zone. + +This parameter returns an empty object if no custom zones exist.`) + + cmd.Flags().ArraySliceVar(&opts.managedNamespaces, "managedNamespaces", nil, `List that contains a namespace for a Global Cluster. MongoDB Cloud manages this cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type createManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createManagedNamespaceOpts) initClient() func() error { @@ -101,8 +113,9 @@ func (opts *createManagedNamespaceOpts) initClient() func() error { func (opts *createManagedNamespaceOpts) Run(ctx context.Context) error { params := &admin.CreateManagedNamespaceApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params).Execute() if err != nil { @@ -117,10 +130,10 @@ func createManagedNamespaceBuilder() *cobra.Command { opts := createManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "createManagedNamespace", + Use: "createManagedNamespace", Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,17 +149,32 @@ func createManagedNamespaceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + + + cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label of the collection to manage for this Global Cluster.`) + + cmd.Flags().StringVar(&opts.customShardKey, "customShardKey", "", `Database parameter used to divide the *collection* into shards. Global clusters require a compound shard key. This compound shard key combines the location parameter and the user-selected custom key.`) + + cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label of the database to manage for this Global Cluster.`) + + cmd.Flags().BoolVar(&opts.isCustomShardKeyHashed, "isCustomShardKeyHashed", false, `Flag that indicates whether someone hashed the custom shard key. If this parameter returns `false`, this cluster uses ranged sharding.`) + + cmd.Flags().BoolVar(&opts.isShardKeyUnique, "isShardKeyUnique", false, `Flag that indicates whether the underlying index enforces unique values.`) + + cmd.Flags().Int64Var(&opts.numInitialChunks, "numInitialChunks", 00, `Minimum number of chunks to create initially when sharding an empty collection with a hashed shard key.`) + + cmd.Flags().BoolVar(&opts.presplitHashedZones, "presplitHashedZones", false, `Flag that indicates whether MongoDB Cloud should create and distribute initial chunks for an empty or non-existing collection. MongoDB Cloud distributes data based on the defined zones and zone ranges for the collection.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type deleteAllCustomZoneMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -160,7 +188,7 @@ func (opts *deleteAllCustomZoneMappingsOpts) initClient() func() error { func (opts *deleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { params := &admin.DeleteAllCustomZoneMappingsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params).Execute() @@ -176,10 +204,10 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { opts := deleteAllCustomZoneMappingsOpts{} cmd := &cobra.Command{ - Use: "deleteAllCustomZoneMappings", + Use: "deleteAllCustomZoneMappings", Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -196,19 +224,19 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type deleteManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient clusterName string - groupId string - db string - collection string + groupId string + db string + collection string } func (opts *deleteManagedNamespaceOpts) initClient() func() error { @@ -222,9 +250,9 @@ func (opts *deleteManagedNamespaceOpts) initClient() func() error { func (opts *deleteManagedNamespaceOpts) Run(ctx context.Context) error { params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, - GroupId: opts.groupId, - Db: &opts.db, - Collection: &opts.collection, + GroupId: opts.groupId, + Db: &opts.db, + Collection: &opts.collection, } resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params).Execute() if err != nil { @@ -239,10 +267,10 @@ func deleteManagedNamespaceBuilder() *cobra.Command { opts := deleteManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "deleteManagedNamespace", + Use: "deleteManagedNamespace", Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -261,16 +289,16 @@ func deleteManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label that identifies the database that contains the collection.`) cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) + _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd } - type getManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -284,7 +312,7 @@ func (opts *getManagedNamespaceOpts) initClient() func() error { func (opts *getManagedNamespaceOpts) Run(ctx context.Context) error { params := &admin.GetManagedNamespaceApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params).Execute() @@ -300,10 +328,10 @@ func getManagedNamespaceBuilder() *cobra.Command { opts := getManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "getManagedNamespace", + Use: "getManagedNamespace", Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -320,6 +348,7 @@ func getManagedNamespaceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -327,8 +356,8 @@ func getManagedNamespaceBuilder() *cobra.Command { func globalClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "globalClusters", - Short: `Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. + Use: "globalClusters", + Short: `Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster.`, } cmd.AddCommand( @@ -340,3 +369,4 @@ MongoDB Cloud shards the empty collection using the required location field and ) return cmd } + diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 2b7e45df2e..04de7e5615 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -18,16 +18,18 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type deleteLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -56,10 +58,10 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { opts := deleteLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "deleteLDAPConfiguration", + Use: "deleteLDAPConfiguration", Short: "Remove the Current LDAP User to DN Mapping", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -75,14 +77,14 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type getLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -111,10 +113,10 @@ func getLDAPConfigurationBuilder() *cobra.Command { opts := getLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "getLDAPConfiguration", + Use: "getLDAPConfiguration", Short: "Return the Current LDAP or X.509 Configuration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -130,15 +132,15 @@ func getLDAPConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type getLDAPConfigurationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string requestId string } @@ -152,7 +154,7 @@ func (opts *getLDAPConfigurationStatusOpts) initClient() func() error { func (opts *getLDAPConfigurationStatusOpts) Run(ctx context.Context) error { params := &admin.GetLDAPConfigurationStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, RequestId: opts.requestId, } resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params).Execute() @@ -168,10 +170,10 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { opts := getLDAPConfigurationStatusOpts{} cmd := &cobra.Command{ - Use: "getLDAPConfigurationStatus", + Use: "getLDAPConfigurationStatus", Short: "Return the Status of One Verify LDAP Configuration Request", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -188,16 +190,17 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("requestId") return cmd } - type saveLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *saveLDAPConfigurationOpts) initClient() func() error { @@ -211,6 +214,7 @@ func (opts *saveLDAPConfigurationOpts) initClient() func() error { func (opts *saveLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -225,10 +229,10 @@ func saveLDAPConfigurationBuilder() *cobra.Command { opts := saveLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "saveLDAPConfiguration", + Use: "saveLDAPConfiguration", Short: "Edit the LDAP or X.509 Configuration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -243,16 +247,24 @@ func saveLDAPConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().CustomerX509Var(&opts.customerX509, "customerX509", , ``) + + cmd.Flags().NDSLDAPVar(&opts.ldap, "ldap", , ``) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type verifyLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *verifyLDAPConfigurationOpts) initClient() func() error { @@ -266,6 +278,7 @@ func (opts *verifyLDAPConfigurationOpts) initClient() func() error { func (opts *verifyLDAPConfigurationOpts) Run(ctx context.Context) error { params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -280,10 +293,10 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { opts := verifyLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "verifyLDAPConfiguration", + Use: "verifyLDAPConfiguration", Short: "Verify the LDAP Configuration in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -298,6 +311,24 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts.authzQueryTemplate, "authzQueryTemplate", ""{USER}?memberOf?base"", `Lightweight Directory Access Protocol (LDAP) query template that MongoDB Cloud applies to create an LDAP query to return the LDAP groups associated with the authenticated MongoDB user. MongoDB Cloud uses this parameter only for user authorization. + +Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query per [RFC 4515](https://tools.ietf.org/search/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516).`) + + cmd.Flags().StringVar(&opts.bindPassword, "bindPassword", "", `Password that MongoDB Cloud uses to authenticate the **bindUsername**.`) + + cmd.Flags().StringVar(&opts.bindUsername, "bindUsername", "", `Full Distinguished Name (DN) of the Lightweight Directory Access Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP host. LDAP distinguished names must be formatted according to RFC 2253.`) + + cmd.Flags().StringVar(&opts.caCertificate, "caCertificate", "", `Certificate Authority (CA) certificate that MongoDB Cloud uses to verify the identity of the Lightweight Directory Access Protocol (LDAP) host. MongoDB Cloud allows self-signed certificates. To delete an assigned value, pass an empty string: `"caCertificate": ""`.`) + + cmd.Flags().StringVar(&opts.hostname, "hostname", "", `Human-readable label that identifies the hostname or Internet Protocol (IP) address of the Lightweight Directory Access Protocol (LDAP) host. This host must have access to the internet or have a Virtual Private Cloud (VPC) peering connection to your cluster.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().IntVar(&opts.port, "port", 636, `IANA port to which the Lightweight Directory Access Protocol (LDAP) host listens for client connections.`) + _ = cmd.MarkFlagRequired("groupId") return cmd @@ -305,8 +336,8 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { func lDAPConfigurationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "lDAPConfiguration", - Short: `Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.`, + Use: "lDAPConfiguration", + Short: `Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.`, } cmd.AddCommand( deleteLDAPConfigurationBuilder(), @@ -317,3 +348,4 @@ func lDAPConfigurationBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index f121f5e8d3..b060a3823a 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -18,19 +18,21 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type deleteLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *deleteLegacySnapshotOpts) initClient() func() error { @@ -43,9 +45,9 @@ func (opts *deleteLegacySnapshotOpts) initClient() func() error { func (opts *deleteLegacySnapshotOpts) Run(ctx context.Context) error { params := &admin.DeleteLegacySnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params).Execute() if err != nil { @@ -60,10 +62,10 @@ func deleteLegacySnapshotBuilder() *cobra.Command { opts := deleteLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "deleteLegacySnapshot", + Use: "deleteLegacySnapshot", Short: "Remove One Legacy Backup Snapshot", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -81,19 +83,19 @@ func deleteLegacySnapshotBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } - type getLegacyBackupCheckpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string checkpointId string - clusterName string + clusterName string } func (opts *getLegacyBackupCheckpointOpts) initClient() func() error { @@ -106,9 +108,9 @@ func (opts *getLegacyBackupCheckpointOpts) initClient() func() error { func (opts *getLegacyBackupCheckpointOpts) Run(ctx context.Context) error { params := &admin.GetLegacyBackupCheckpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, CheckpointId: opts.checkpointId, - ClusterName: opts.clusterName, + ClusterName: opts.clusterName, } resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params).Execute() if err != nil { @@ -123,10 +125,10 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { opts := getLegacyBackupCheckpointOpts{} cmd := &cobra.Command{ - Use: "getLegacyBackupCheckpoint", + Use: "getLegacyBackupCheckpoint", Short: "Return One Legacy Backup Checkpoint", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -144,19 +146,19 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the checkpoint.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("checkpointId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type getLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - jobId string + jobId string } func (opts *getLegacyBackupRestoreJobOpts) initClient() func() error { @@ -169,9 +171,9 @@ func (opts *getLegacyBackupRestoreJobOpts) initClient() func() error { func (opts *getLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.GetLegacyBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - JobId: opts.jobId, + JobId: opts.jobId, } resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -186,10 +188,10 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { opts := getLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getLegacyBackupRestoreJob", + Use: "getLegacyBackupRestoreJob", Short: "Return One Legacy Backup Restore Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -207,19 +209,19 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVar(&opts.jobId, "jobId", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("jobId") return cmd } - type getLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *getLegacySnapshotOpts) initClient() func() error { @@ -232,9 +234,9 @@ func (opts *getLegacySnapshotOpts) initClient() func() error { func (opts *getLegacySnapshotOpts) Run(ctx context.Context) error { params := &admin.GetLegacySnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params).Execute() if err != nil { @@ -249,10 +251,10 @@ func getLegacySnapshotBuilder() *cobra.Command { opts := getLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "getLegacySnapshot", + Use: "getLegacySnapshot", Short: "Return One Legacy Backup Snapshot", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -270,17 +272,17 @@ func getLegacySnapshotBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } - type getLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -294,7 +296,7 @@ func (opts *getLegacySnapshotScheduleOpts) initClient() func() error { func (opts *getLegacySnapshotScheduleOpts) Run(ctx context.Context) error { params := &admin.GetLegacySnapshotScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params).Execute() @@ -310,10 +312,10 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { opts := getLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "getLegacySnapshotSchedule", + Use: "getLegacySnapshotSchedule", Short: "Return One Snapshot Schedule", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -330,20 +332,20 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listLegacyBackupCheckpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listLegacyBackupCheckpointsOpts) initClient() func() error { @@ -356,11 +358,11 @@ func (opts *listLegacyBackupCheckpointsOpts) initClient() func() error { func (opts *listLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { params := &admin.ListLegacyBackupCheckpointsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params).Execute() if err != nil { @@ -375,10 +377,10 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { opts := listLegacyBackupCheckpointsOpts{} cmd := &cobra.Command{ - Use: "listLegacyBackupCheckpoints", + Use: "listLegacyBackupCheckpoints", Short: "Return All Legacy Backup Checkpoints", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -398,21 +400,21 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listLegacyBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int - batchId string + pageNum int + batchId string } func (opts *listLegacyBackupRestoreJobsOpts) initClient() func() error { @@ -425,12 +427,12 @@ func (opts *listLegacyBackupRestoreJobsOpts) initClient() func() error { func (opts *listLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { params := &admin.ListLegacyBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - BatchId: &opts.batchId, + PageNum: &opts.pageNum, + BatchId: &opts.batchId, } resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { @@ -445,10 +447,10 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { opts := listLegacyBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listLegacyBackupRestoreJobs", + Use: "listLegacyBackupRestoreJobs", Short: "Return All Legacy Backup Restore Jobs", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -469,21 +471,21 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listLegacySnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int - completed string + pageNum int + completed string } func (opts *listLegacySnapshotsOpts) initClient() func() error { @@ -496,12 +498,12 @@ func (opts *listLegacySnapshotsOpts) initClient() func() error { func (opts *listLegacySnapshotsOpts) Run(ctx context.Context) error { params := &admin.ListLegacySnapshotsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Completed: &opts.completed, + PageNum: &opts.pageNum, + Completed: &opts.completed, } resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params).Execute() if err != nil { @@ -516,10 +518,10 @@ func listLegacySnapshotsBuilder() *cobra.Command { opts := listLegacySnapshotsOpts{} cmd := &cobra.Command{ - Use: "listLegacySnapshots", + Use: "listLegacySnapshots", Short: "Return All Legacy Backup Snapshots", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -540,18 +542,19 @@ func listLegacySnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completed, "completed", ""true"", `Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type updateLegacySnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string + } func (opts *updateLegacySnapshotRetentionOpts) initClient() func() error { @@ -564,9 +567,10 @@ func (opts *updateLegacySnapshotRetentionOpts) initClient() func() error { func (opts *updateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { params := &admin.UpdateLegacySnapshotRetentionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, + } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() if err != nil { @@ -581,10 +585,10 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { opts := updateLegacySnapshotRetentionOpts{} cmd := &cobra.Command{ - Use: "updateLegacySnapshotRetention", + Use: "updateLegacySnapshotRetention", Short: "Change One Legacy Backup Snapshot Expiration", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -601,19 +605,46 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + + + cmd.Flags().StringVar(&opts.clusterId, "clusterId", "", `Unique 24-hexadecimal digit string that identifies the cluster with the snapshots you want to return.`) + + cmd.Flags().BoolVar(&opts.complete, "complete", false, `Flag that indicates whether the snapshot exists. This flag returns `false` while MongoDB Cloud creates the snapshot.`) + + cmd.Flags().BSONTimestampVar(&opts.created, "created", , ``) + + cmd.Flags().BoolVar(&opts.doNotDelete, "doNotDelete", false, `Flag that indicates whether someone can delete this snapshot. You can't set `"doNotDelete" : true` and set a timestamp for **expires** in the same request.`) + + cmd.Flags().StringVar(&opts.expires, "expires", "", `Date and time when MongoDB Cloud deletes the snapshot. If `"doNotDelete" : true`, MongoDB Cloud removes any value set for this parameter.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns the snapshots.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the snapshot.`) + + cmd.Flags().BoolVar(&opts.incremental, "incremental", false, `Flag indicating if this is an incremental or a full snapshot.`) + + cmd.Flags().BSONTimestampVar(&opts.lastOplogAppliedTimestamp, "lastOplogAppliedTimestamp", , ``) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().ArraySliceVar(&opts.parts, "parts", nil, `Metadata that describes the complete snapshot. + +- For a replica set, this array contains a single document. +- For a sharded cluster, this array contains one document for each shard plus one document for the config host.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } - type updateLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *updateLegacySnapshotScheduleOpts) initClient() func() error { @@ -626,8 +657,9 @@ func (opts *updateLegacySnapshotScheduleOpts) initClient() func() error { func (opts *updateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { params := &admin.UpdateLegacySnapshotScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { @@ -642,10 +674,10 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { opts := updateLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "updateLegacySnapshotSchedule", + Use: "updateLegacySnapshotSchedule", Short: "Update Snapshot Schedule for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -661,6 +693,28 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + + + cmd.Flags().IntVar(&opts.clusterCheckpointIntervalMin, "clusterCheckpointIntervalMin", 000, `Quantity of time expressed in minutes between successive cluster checkpoints. This parameter applies only to sharded clusters. This number determines the granularity of continuous cloud backups for sharded clusters.`) + + cmd.Flags().StringVar(&opts.clusterId, "clusterId", "", `Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return.`) + + cmd.Flags().IntVar(&opts.dailySnapshotRetentionDays, "dailySnapshotRetentionDays", 000, `Quantity of time to keep daily snapshots. MongoDB Cloud expresses this value in days. Set this value to `0` to disable daily snapshot retention.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the cluster.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().IntVar(&opts.monthlySnapshotRetentionMonths, "monthlySnapshotRetentionMonths", 000, `Number of months that MongoDB Cloud must keep monthly snapshots. Set this value to `0` to disable monthly snapshot retention.`) + + cmd.Flags().IntVar(&opts.pointInTimeWindowHours, "pointInTimeWindowHours", 000, `Number of hours before the current time from which MongoDB Cloud can create a Continuous Cloud Backup snapshot.`) + + cmd.Flags().IntVar(&opts.snapshotIntervalHours, "snapshotIntervalHours", 000, `Number of hours that must elapse before taking another snapshot.`) + + cmd.Flags().IntVar(&opts.snapshotRetentionDays, "snapshotRetentionDays", 000, `Number of days that MongoDB Cloud must keep recent snapshots.`) + + cmd.Flags().IntVar(&opts.weeklySnapshotRetentionWeeks, "weeklySnapshotRetentionWeeks", 000, `Number of weeks that MongoDB Cloud must keep weekly snapshots. Set this value to `0` to disable weekly snapshot retention.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -669,8 +723,8 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { func legacyBackupBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "legacyBackup", - Short: `Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.`, + Use: "legacyBackup", + Short: `Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.`, } cmd.AddCommand( deleteLegacySnapshotBuilder(), @@ -686,3 +740,4 @@ func legacyBackupBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 4ebe32ca18..b572e26f55 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -18,18 +18,21 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createLegacyBackupRestoreJobOpts) initClient() func() error { @@ -42,8 +45,9 @@ func (opts *createLegacyBackupRestoreJobOpts) initClient() func() error { func (opts *createLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { params := &admin.CreateLegacyBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -58,10 +62,10 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { opts := createLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "createLegacyBackupRestoreJob", + Use: "createLegacyBackupRestoreJob", Short: "Create One Legacy Backup Restore Job", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,6 +81,56 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + + + cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch to which this restore job belongs. This parameter exists only for a sharded cluster restore.`) + + cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the sharded cluster checkpoint. The checkpoint represents the point in time back to which you want to restore you data. This parameter applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. Use this parameter with sharded clusters only. + +- If you set **checkpointId**, you can't set **oplogInc**, **oplogTs**, **snapshotId**, or **pointInTimeUTCMillis**. +- If you provide this parameter, this endpoint restores all data up to this checkpoint to the database you specify in the **delivery** object.`) + + cmd.Flags().StringVar(&opts.clusterId, "clusterId", "", `Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return. This parameter returns for restore clusters.`) + + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster containing the snapshots you want to retrieve.`) + + cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when someone requested this restore job. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().RestoreJobDeliveryVar(&opts.delivery, "delivery", , ``) + + cmd.Flags().BoolVar(&opts.encryptionEnabled, "encryptionEnabled", false, `Flag that indicates whether someone encrypted the data in the restored snapshot.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns the snapshots.`) + + cmd.Flags().ArraySliceVar(&opts.hashes, "hashes", nil, `List that contains documents mapping each restore file to a hashed checksum. This parameter applies after you download the corresponding **delivery.url**. If `"methodName" : "HTTP"`, this list contains one object that represents the hash of the **.tar.gz** file.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.masterKeyUUID, "masterKeyUUID", "", `Universally Unique Identifier (UUID) that identifies the Key Management Interoperability (KMIP) master key used to encrypt the snapshot data. This parameter applies only when `"encryptionEnabled" : "true"`.`) + + cmd.Flags().IntVar(&opts.oplogInc, "oplogInc", 000, `Thirty-two-bit incrementing ordinal that represents operations within a given second. When paired with **oplogTs**, this represents the point in time to which MongoDB Cloud restores your data. This parameter applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. + +- If you set **oplogInc**, you must set **oplogTs**, and can't set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. +- If you provide this parameter, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the **delivery** object.`) + + cmd.Flags().StringVar(&opts.oplogTs, "oplogTs", "", `Date and time from which you want to restore this snapshot. This parameter expresses its value in ISO 8601 format in UTC. This represents the first part of an Oplog timestamp. When paired with **oplogInc**, they represent the last database operation to which you want to restore your data. This parameter applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. Run a query against **local.oplog.rs** on your replica set to find the desired timestamp. + +- If you set **oplogTs**, you must set **oplogInc**, and you can't set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. +- If you provide this parameter, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the **delivery** object.`) + + cmd.Flags().Int64Var(&opts.pointInTimeUTCMillis, "pointInTimeUTCMillis", 00, `Timestamp from which you want to restore this snapshot. This parameter expresses its value in the number of milliseconds elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). This timestamp must fall within the last 24 hours of the current time. This parameter applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. + +- If you provide this parameter, this endpoint restores all data up to this point in time to the database you specified in the **delivery** object. +- If you set **pointInTimeUTCMillis**, you can't set **oplogInc**, **oplogTs**, **snapshotId**, or **checkpointId**.`) + + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the snapshot to restore. If you set **snapshotId**, you can't set **oplogInc**, **oplogTs**, **pointInTimeUTCMillis**, or **checkpointId**.`) + + cmd.Flags().StringVar(&opts.statusName, "statusName", "", `Human-readable label that identifies the status of the downloadable file at the time of the request.`) + + cmd.Flags().BSONTimestampVar(&opts.timestamp, "timestamp", , ``) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -85,11 +139,12 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { func legacyBackupRestoreJobsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "legacyBackupRestoreJobs", - Short: ``, + Use: "legacyBackupRestoreJobs", + Short: ``, } cmd.AddCommand( createLegacyBackupRestoreJobBuilder(), ) return cmd } + diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index ee1fc3d798..92095454c5 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -295,6 +295,25 @@ func updateMaintenanceWindowBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.autoDeferOnceEnabled, "autoDeferOnceEnabled", false, `Flag that indicates whether MongoDB Cloud should defer all maintenance windows for one week after you enable them.`) + + cmd.Flags().IntVar(&opts.dayOfWeek, "dayOfWeek", 000, `One-based integer that represents the day of the week that the maintenance window starts. + +| Value | Day of Week | +|---|---| +| `1` | Sunday | +| `2` | Monday | +| `3` | Tuesday | +| `4` | Wednesday | +| `5` | Thursday | +| `6` | Friday | +| `7` | Saturday | +`) + + cmd.Flags().IntVar(&opts.hourOfDay, "hourOfDay", 000, `Zero-based integer that represents the hour of the of the day that the maintenance window starts according to a 24-hour clock. Use `0` for midnight and `12` for noon.`) + + cmd.Flags().BoolVar(&opts.startASAP, "startASAP", false, `Flag that indicates whether MongoDB Cloud starts the maintenance window immediately upon receiving this request. To start the maintenance window immediately for your project, MongoDB Cloud must have maintenance scheduled and you must set a maintenance window. This flag resets to `false` after MongoDB Cloud completes maintenance.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index d9cf6842bd..343f982757 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -69,6 +69,32 @@ func createUserBuilder() *cobra.Command { }, } + cmd.Flags().StringVar(&opts.country, "country", "", `Two alphabet characters that identifies MongoDB Cloud user's geographic location. This parameter uses the ISO 3166-1a2 code format.`) + + cmd.Flags().StringVar(&opts.createdAt, "createdAt", "", `Date and time when the current account is created. This value is in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.emailAddress, "emailAddress", "", `Email address that belongs to the MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.firstName, "firstName", "", `First or given name that belongs to the MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.lastAuth, "lastAuth", "", `Date and time when the current account last authenticated. This value is in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.lastName, "lastName", "", `Last name, family name, or surname that belongs to the MongoDB Cloud user.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.mobileNumber, "mobileNumber", "", `Mobile phone number that belongs to the MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.password, "password", "", `Password applied with the username to log in to MongoDB Cloud. MongoDB Cloud does not return this parameter except in response to creating a new MongoDB Cloud user. Only the MongoDB Cloud user can update their password after it has been set from the MongoDB Cloud console.`) + + cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of objects that display the MongoDB Cloud user's roles and the corresponding organization or project to which that role applies. A role can apply to one organization or one project but not both.`) + + cmd.Flags().SetSliceVar(&opts.teamIds, "teamIds", nil, `List of unique 24-hexadecimal digit strings that identifies the teams to which this MongoDB Cloud user belongs.`) + + cmd.Flags().StringVar(&opts.username, "username", "", `Email address that represents the username of the MongoDB Cloud user.`) + return cmd } diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index f7be539c2c..4bf9d376f7 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -18,17 +18,20 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *createClusterOpts) initClient() func() error { @@ -42,6 +45,7 @@ func (opts *createClusterOpts) initClient() func() error { func (opts *createClusterOpts) Run(ctx context.Context) error { params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.MultiCloudClustersApi.CreateClusterWithParams(ctx, params).Execute() if err != nil { @@ -56,10 +60,10 @@ func createClusterBuilder() *cobra.Command { opts := createClusterOpts{} cmd := &cobra.Command{ - Use: "createCluster", + Use: "createCluster", Short: "Create One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -74,17 +78,62 @@ func createClusterBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().BoolVar(&opts.backupEnabled, "backupEnabled", false, `Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses [Cloud Backups](https://docs.atlas.mongodb.com/backup/cloud-backup/overview/) for dedicated clusters and [Shared Cluster Backups](https://docs.atlas.mongodb.com/backup/shared-tier/overview/) for tenant clusters. If set to `false`, the cluster doesn't use backups.`) + + cmd.Flags().BiConnectorVar(&opts.biConnector, "biConnector", , ``) + + cmd.Flags().StringVar(&opts.clusterType, "clusterType", "", `Configuration of nodes that comprise the cluster.`) + + cmd.Flags().ClusterDescriptionConnectionStringsVar(&opts.connectionStrings, "connectionStrings", , ``) + + cmd.Flags().StringVar(&opts.createDate, "createDate", "", `Date and time when MongoDB Cloud created this cluster. This parameter expresses its value in ISO 8601 format in UTC.`) + + cmd.Flags().Float64Var(&opts.diskSizeGB, "diskSizeGB", 00, `Storage capacity that the host's root volume possesses expressed in gigabytes. Increase this number to add capacity. MongoDB Cloud requires this parameter if you set **replicationSpecs**. If you specify a disk size below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations depend on whether you choose the default value or a custom value. The maximum value for disk storage cannot exceed 50 times the maximum RAM for the selected cluster. If you require more storage space, consider upgrading your cluster to a higher tier.`) + + cmd.Flags().StringVar(&opts.encryptionAtRestProvider, "encryptionAtRestProvider", "", `Cloud service provider that manages your customer keys to provide an additional layer of encryption at rest for the cluster. To enable customer key management for encryption at rest, the cluster **replicationSpecs[n].regionConfigs[m].{type}Specs.instanceSize** setting must be `M10` or higher and `"backupEnabled" : false` or omitted entirely.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the replication object for a zone in a Global Cluster. If you include existing zones in the request, you must specify this parameter. If you add a new zone to an existing Global Cluster, you may specify this parameter. The request deletes any existing zones in a Global Cluster that you exclude from the request.`) + + cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.mongoDBMajorVersion, "mongoDBMajorVersion", ""6.0"", `Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version.`) + + cmd.Flags().StringVar(&opts.mongoDBVersion, "mongoDBVersion", "", `Version of MongoDB that the cluster runs.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the advanced cluster.`) + + cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether the cluster is paused.`) + + cmd.Flags().BoolVar(&opts.pitEnabled, "pitEnabled", false, `Flag that indicates whether the cluster uses continuous cloud backups.`) + + cmd.Flags().ArraySliceVar(&opts.replicationSpecs, "replicationSpecs", nil, `List of settings that configure your cluster regions. For Global Clusters, each object in the array represents a zone where your clusters nodes deploy. For non-Global sharded clusters and replica sets, this array has one object representing where your clusters nodes deploy.`) + + cmd.Flags().StringVar(&opts.rootCertType, "rootCertType", ""ISRGROOTX1"", `Root Certificate Authority that MongoDB Cloud cluster uses. MongoDB Cloud supports Internet Security Research Group.`) + + cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of this cluster.`) + + cmd.Flags().ArraySliceVar(&opts.tags, "tags", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster.`) + + cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the cluster. If set to `true`, MongoDB Cloud won't delete the cluster. If set to `false`, MongoDB Cloud will delete the cluster.`) + + cmd.Flags().StringVar(&opts.versionReleaseSystem, "versionReleaseSystem", ""LTS"", `Method by which the cluster maintains the MongoDB versions. If value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type deleteClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string retainBackups bool } @@ -98,8 +147,8 @@ func (opts *deleteClusterOpts) initClient() func() error { func (opts *deleteClusterOpts) Run(ctx context.Context) error { params := &admin.DeleteClusterApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RetainBackups: &opts.retainBackups, } _, err := opts.client.MultiCloudClustersApi.DeleteClusterWithParams(ctx, params).Execute() @@ -115,10 +164,10 @@ func deleteClusterBuilder() *cobra.Command { opts := deleteClusterOpts{} cmd := &cobra.Command{ - Use: "deleteCluster", + Use: "deleteCluster", Short: "Remove One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -136,16 +185,16 @@ func deleteClusterBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type getClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -159,7 +208,7 @@ func (opts *getClusterOpts) initClient() func() error { func (opts *getClusterOpts) Run(ctx context.Context) error { params := &admin.GetClusterApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.MultiCloudClustersApi.GetClusterWithParams(ctx, params).Execute() @@ -175,10 +224,10 @@ func getClusterBuilder() *cobra.Command { opts := getClusterOpts{} cmd := &cobra.Command{ - Use: "getCluster", + Use: "getCluster", Short: "Return One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -195,19 +244,19 @@ func getClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listClustersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listClustersOpts) initClient() func() error { @@ -220,10 +269,10 @@ func (opts *listClustersOpts) initClient() func() error { func (opts *listClustersOpts) Run(ctx context.Context) error { params := &admin.ListClustersApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MultiCloudClustersApi.ListClustersWithParams(ctx, params).Execute() if err != nil { @@ -238,10 +287,10 @@ func listClustersBuilder() *cobra.Command { opts := listClustersOpts{} cmd := &cobra.Command{ - Use: "listClusters", + Use: "listClusters", Short: "Return All Multi-Cloud Clusters from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -260,15 +309,15 @@ func listClustersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type testFailoverOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -282,7 +331,7 @@ func (opts *testFailoverOpts) initClient() func() error { func (opts *testFailoverOpts) Run(ctx context.Context) error { params := &admin.TestFailoverApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } _, err := opts.client.MultiCloudClustersApi.TestFailoverWithParams(ctx, params).Execute() @@ -298,10 +347,10 @@ func testFailoverBuilder() *cobra.Command { opts := testFailoverOpts{} cmd := &cobra.Command{ - Use: "testFailover", + Use: "testFailover", Short: "Test Failover for One Multi-Cloud Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -318,17 +367,18 @@ func testFailoverBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type updateClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *updateClusterOpts) initClient() func() error { @@ -341,8 +391,9 @@ func (opts *updateClusterOpts) initClient() func() error { func (opts *updateClusterOpts) Run(ctx context.Context) error { params := &admin.UpdateClusterApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.MultiCloudClustersApi.UpdateClusterWithParams(ctx, params).Execute() if err != nil { @@ -357,10 +408,10 @@ func updateClusterBuilder() *cobra.Command { opts := updateClusterOpts{} cmd := &cobra.Command{ - Use: "updateCluster", + Use: "updateCluster", Short: "Modify One Multi-Cloud Cluster from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -376,6 +427,52 @@ func updateClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the advanced cluster to modify.`) + + + cmd.Flags().BoolVar(&opts.backupEnabled, "backupEnabled", false, `Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses [Cloud Backups](https://docs.atlas.mongodb.com/backup/cloud-backup/overview/) for dedicated clusters and [Shared Cluster Backups](https://docs.atlas.mongodb.com/backup/shared-tier/overview/) for tenant clusters. If set to `false`, the cluster doesn't use backups.`) + + cmd.Flags().BiConnectorVar(&opts.biConnector, "biConnector", , ``) + + cmd.Flags().StringVar(&opts.clusterType, "clusterType", "", `Configuration of nodes that comprise the cluster.`) + + cmd.Flags().ClusterDescriptionConnectionStringsVar(&opts.connectionStrings, "connectionStrings", , ``) + + cmd.Flags().StringVar(&opts.createDate, "createDate", "", `Date and time when MongoDB Cloud created this cluster. This parameter expresses its value in ISO 8601 format in UTC.`) + + cmd.Flags().Float64Var(&opts.diskSizeGB, "diskSizeGB", 00, `Storage capacity that the host's root volume possesses expressed in gigabytes. Increase this number to add capacity. MongoDB Cloud requires this parameter if you set **replicationSpecs**. If you specify a disk size below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations depend on whether you choose the default value or a custom value. The maximum value for disk storage cannot exceed 50 times the maximum RAM for the selected cluster. If you require more storage space, consider upgrading your cluster to a higher tier.`) + + cmd.Flags().StringVar(&opts.encryptionAtRestProvider, "encryptionAtRestProvider", "", `Cloud service provider that manages your customer keys to provide an additional layer of encryption at rest for the cluster. To enable customer key management for encryption at rest, the cluster **replicationSpecs[n].regionConfigs[m].{type}Specs.instanceSize** setting must be `M10` or higher and `"backupEnabled" : false` or omitted entirely.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the replication object for a zone in a Global Cluster. If you include existing zones in the request, you must specify this parameter. If you add a new zone to an existing Global Cluster, you may specify this parameter. The request deletes any existing zones in a Global Cluster that you exclude from the request.`) + + cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.mongoDBMajorVersion, "mongoDBMajorVersion", ""6.0"", `Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version.`) + + cmd.Flags().StringVar(&opts.mongoDBVersion, "mongoDBVersion", "", `Version of MongoDB that the cluster runs.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the advanced cluster.`) + + cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether the cluster is paused.`) + + cmd.Flags().BoolVar(&opts.pitEnabled, "pitEnabled", false, `Flag that indicates whether the cluster uses continuous cloud backups.`) + + cmd.Flags().ArraySliceVar(&opts.replicationSpecs, "replicationSpecs", nil, `List of settings that configure your cluster regions. For Global Clusters, each object in the array represents a zone where your clusters nodes deploy. For non-Global sharded clusters and replica sets, this array has one object representing where your clusters nodes deploy.`) + + cmd.Flags().StringVar(&opts.rootCertType, "rootCertType", ""ISRGROOTX1"", `Root Certificate Authority that MongoDB Cloud cluster uses. MongoDB Cloud supports Internet Security Research Group.`) + + cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of this cluster.`) + + cmd.Flags().ArraySliceVar(&opts.tags, "tags", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster.`) + + cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the cluster. If set to `true`, MongoDB Cloud won't delete the cluster. If set to `false`, MongoDB Cloud will delete the cluster.`) + + cmd.Flags().StringVar(&opts.versionReleaseSystem, "versionReleaseSystem", ""LTS"", `Method by which the cluster maintains the MongoDB versions. If value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -384,8 +481,8 @@ func updateClusterBuilder() *cobra.Command { func multiCloudClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "multiCloudClusters", - Short: `Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. + Use: "multiCloudClusters", + Short: `Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. The total number of nodes in clusters spanning across regions has a specific constraint on a per-project basis. MongoDB Cloud limits the total number of nodes in other regions in one project to a total of 40. This total excludes Google Cloud regions communicating with each other, shared-tier clusters, or serverless clusters. The total number of nodes between any two regions must meet this constraint. For example, if a project has nodes in clusters spread across three regions: 30 nodes in Region A, 10 nodes in Region B, and 5 nodes in Region C, you can add only 5 more nodes to Region C because if you exclude Region C, Region A + Region B = 40. If you exclude Region B, Region A + Region C = 35, <= 40. If you exclude Region A, Region B + Region C = 15, <= 40. Each combination of regions with the added 5 nodes still meets the per-project constraint. Region A + B = 40. Region A + C = 40. Region B + C = 20. You can't create a multi-region cluster in a project if it has one or more clusters spanning 40 or more nodes in other regions. Each project supports up to 25 database deployments. @@ -401,3 +498,4 @@ If your MongoDB Cloud project contains a custom role that uses actions introduce ) return cmd } + diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 629dd2df0c..d084ca9d29 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -303,6 +303,8 @@ func disablePeeringBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled **Connect via Peering Only** mode for the specified project.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index e76eef5589..49de27160f 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -18,18 +18,21 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createOnlineArchiveOpts) initClient() func() error { @@ -42,8 +45,9 @@ func (opts *createOnlineArchiveOpts) initClient() func() error { func (opts *createOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.CreateOnlineArchiveApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { @@ -58,10 +62,10 @@ func createOnlineArchiveBuilder() *cobra.Command { opts := createOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "createOnlineArchive", + Use: "createOnlineArchive", Short: "Create One Online Archive", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,18 +81,53 @@ func createOnlineArchiveBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.`) + + + cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the online archive.`) + + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create an online archive.`) + + cmd.Flags().StringVar(&opts.collName, "collName", "", `Human-readable label that identifies the collection for which you created the online archive.`) + + cmd.Flags().StringVar(&opts.collectionType, "collectionType", ""STANDARD"", `Classification of MongoDB database collection that you want to return. + +If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`.`) + + cmd.Flags().CriteriaVar(&opts.criteria, "criteria", , ``) + + cmd.Flags().StringVar(&opts.dbName, "dbName", "", `Human-readable label of the database that contains the collection that contains the online archive.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the specified cluster. The specified cluster contains the collection for which to create the online archive.`) + + cmd.Flags().ArraySliceVar(&opts.partitionFields, "partitionFields", nil, `List that contains document parameters to use to logically divide data within a collection. Partitions provide a coarse level of filtering of the underlying collection data. To divide your data, specify up to two parameters that you frequently query. Any queries that don't use these parameters result in a full collection scan of all archived documents. This takes more time and increase your costs.`) + + cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether this online archive exists in the paused state. A request to resume fails if the collection has another active online archive. To pause an active online archive or resume a paused online archive, you must include this parameter. To pause an active archive, set this to **true**. To resume a paused archive, set this to **false**.`) + + cmd.Flags().OnlineArchiveScheduleVar(&opts.schedule, "schedule", , ``) + + cmd.Flags().StringVar(&opts.state, "state", "", `Phase of the process to create this online archive when you made this request. + +| State | Indication | +|-------------|------------| +| `PENDING` | MongoDB Cloud has queued documents for archive. Archiving hasn't started. | +| `ARCHIVING` | MongoDB Cloud started archiving documents that meet the archival criteria. | +| `IDLE` | MongoDB Cloud waits to start the next archival job. | +| `PAUSING` | Someone chose to stop archiving. MongoDB Cloud finishes the running archival job then changes the state to `PAUSED` when that job completes. | +| `PAUSED` | MongoDB Cloud has stopped archiving. Archived documents can be queried. The specified archiving operation on the active cluster cannot archive additional documents. You can resume archiving for paused archives at any time. | +| `ORPHANED` | Someone has deleted the collection associated with an active or paused archive. MongoDB Cloud doesn't delete the archived data. You must manually delete the online archives associated with the deleted collection. | +| `DELETED` | Someone has deleted the archive was deleted. When someone deletes an online archive, MongoDB Cloud removes all associated archived documents from the cloud object storage. |`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type deleteOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string } @@ -102,8 +141,8 @@ func (opts *deleteOnlineArchiveOpts) initClient() func() error { func (opts *deleteOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.DeleteOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } resp, _, err := opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params).Execute() @@ -119,10 +158,10 @@ func deleteOnlineArchiveBuilder() *cobra.Command { opts := deleteOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "deleteOnlineArchive", + Use: "deleteOnlineArchive", Short: "Remove One Online Archive", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -140,20 +179,20 @@ func deleteOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to delete.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type downloadOnlineArchiveQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - startDate int64 - endDate int64 + startDate int64 + endDate int64 archiveOnly bool } @@ -167,10 +206,10 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) initClient() func() error { func (opts *downloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - StartDate: &opts.startDate, - EndDate: &opts.endDate, + StartDate: &opts.startDate, + EndDate: &opts.endDate, ArchiveOnly: &opts.archiveOnly, } resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params).Execute() @@ -186,10 +225,10 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { opts := downloadOnlineArchiveQueryLogsOpts{} cmd := &cobra.Command{ - Use: "downloadOnlineArchiveQueryLogs", + Use: "downloadOnlineArchiveQueryLogs", Short: "Download Online Archive Query Logs", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -209,17 +248,17 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, `Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type getOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string } @@ -233,8 +272,8 @@ func (opts *getOnlineArchiveOpts) initClient() func() error { func (opts *getOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.GetOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } resp, _, err := opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params).Execute() @@ -250,10 +289,10 @@ func getOnlineArchiveBuilder() *cobra.Command { opts := getOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "getOnlineArchive", + Use: "getOnlineArchive", Short: "Return One Online Archive", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -271,21 +310,21 @@ func getOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to return.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type listOnlineArchivesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listOnlineArchivesOpts) initClient() func() error { @@ -298,11 +337,11 @@ func (opts *listOnlineArchivesOpts) initClient() func() error { func (opts *listOnlineArchivesOpts) Run(ctx context.Context) error { params := &admin.ListOnlineArchivesApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params).Execute() if err != nil { @@ -317,10 +356,10 @@ func listOnlineArchivesBuilder() *cobra.Command { opts := listOnlineArchivesOpts{} cmd := &cobra.Command{ - Use: "listOnlineArchives", + Use: "listOnlineArchives", Short: "Return All Online Archives for One Cluster", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -340,18 +379,19 @@ func listOnlineArchivesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } - type updateOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string + } func (opts *updateOnlineArchiveOpts) initClient() func() error { @@ -364,9 +404,10 @@ func (opts *updateOnlineArchiveOpts) initClient() func() error { func (opts *updateOnlineArchiveOpts) Run(ctx context.Context) error { params := &admin.UpdateOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, + } resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { @@ -381,10 +422,10 @@ func updateOnlineArchiveBuilder() *cobra.Command { opts := updateOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "updateOnlineArchive", + Use: "updateOnlineArchive", Short: "Update One Online Archive", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -401,6 +442,42 @@ func updateOnlineArchiveBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to update.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) + + + cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the online archive.`) + + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create an online archive.`) + + cmd.Flags().StringVar(&opts.collName, "collName", "", `Human-readable label that identifies the collection for which you created the online archive.`) + + cmd.Flags().StringVar(&opts.collectionType, "collectionType", ""STANDARD"", `Classification of MongoDB database collection that you want to return. + +If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`.`) + + cmd.Flags().CriteriaVar(&opts.criteria, "criteria", , ``) + + cmd.Flags().StringVar(&opts.dbName, "dbName", "", `Human-readable label of the database that contains the collection that contains the online archive.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the specified cluster. The specified cluster contains the collection for which to create the online archive.`) + + cmd.Flags().ArraySliceVar(&opts.partitionFields, "partitionFields", nil, `List that contains document parameters to use to logically divide data within a collection. Partitions provide a coarse level of filtering of the underlying collection data. To divide your data, specify up to two parameters that you frequently query. Any queries that don't use these parameters result in a full collection scan of all archived documents. This takes more time and increase your costs.`) + + cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether this online archive exists in the paused state. A request to resume fails if the collection has another active online archive. To pause an active online archive or resume a paused online archive, you must include this parameter. To pause an active archive, set this to **true**. To resume a paused archive, set this to **false**.`) + + cmd.Flags().OnlineArchiveScheduleVar(&opts.schedule, "schedule", , ``) + + cmd.Flags().StringVar(&opts.state, "state", "", `Phase of the process to create this online archive when you made this request. + +| State | Indication | +|-------------|------------| +| `PENDING` | MongoDB Cloud has queued documents for archive. Archiving hasn't started. | +| `ARCHIVING` | MongoDB Cloud started archiving documents that meet the archival criteria. | +| `IDLE` | MongoDB Cloud waits to start the next archival job. | +| `PAUSING` | Someone chose to stop archiving. MongoDB Cloud finishes the running archival job then changes the state to `PAUSED` when that job completes. | +| `PAUSED` | MongoDB Cloud has stopped archiving. Archived documents can be queried. The specified archiving operation on the active cluster cannot archive additional documents. You can resume archiving for paused archives at any time. | +| `ORPHANED` | Someone has deleted the collection associated with an active or paused archive. MongoDB Cloud doesn't delete the archived data. You must manually delete the online archives associated with the deleted collection. | +| `DELETED` | Someone has deleted the archive was deleted. When someone deletes an online archive, MongoDB Cloud removes all associated archived documents from the cloud object storage. |`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") @@ -410,8 +487,8 @@ func updateOnlineArchiveBuilder() *cobra.Command { func onlineArchiveBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "onlineArchive", - Short: `Returns, adds, edits, or removes an online archive.`, + Use: "onlineArchive", + Short: `Returns, adds, edits, or removes an online archive.`, } cmd.AddCommand( createOnlineArchiveBuilder(), @@ -423,3 +500,4 @@ func onlineArchiveBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 440eee0d7f..a9f84a49fd 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -18,16 +18,19 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient + } func (opts *createOrganizationOpts) initClient() func() error { @@ -39,7 +42,9 @@ func (opts *createOrganizationOpts) initClient() func() error { } func (opts *createOrganizationOpts) Run(ctx context.Context) error { - params := &admin.CreateOrganizationApiParams{} + params := &admin.CreateOrganizationApiParams{ + + } resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params).Execute() if err != nil { return err @@ -53,10 +58,10 @@ func createOrganizationBuilder() *cobra.Command { opts := createOrganizationOpts{} cmd := &cobra.Command{ - Use: "createOrganization", + Use: "createOrganization", Short: "Create One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -68,15 +73,23 @@ func createOrganizationBuilder() *cobra.Command { return opts.Run(cmd.Context()) }, } + + + cmd.Flags().CreateApiKeyVar(&opts.apiKey, "apiKey", , ``) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the organization.`) + + cmd.Flags().StringVar(&opts.orgOwnerId, "orgOwnerId", "", `Unique 24-hexadecimal digit string that identifies the Atlas user that you want to assign the Organization Owner role. This user must be a member of the same organization as the calling API key. This is only required when authenticating with Programmatic API Keys.`) + return cmd } - type createOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string + } func (opts *createOrganizationInvitationOpts) initClient() func() error { @@ -90,6 +103,7 @@ func (opts *createOrganizationInvitationOpts) initClient() func() error { func (opts *createOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { @@ -104,10 +118,10 @@ func createOrganizationInvitationBuilder() *cobra.Command { opts := createOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "createOrganizationInvitation", + Use: "createOrganizationInvitation", Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -120,16 +134,23 @@ func createOrganizationInvitationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + + + cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + + cmd.Flags().SetSliceVar(&opts.teamIds, "teamIds", nil, `List of teams to which you want to invite the desired MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.username, "username", "", `Email address that belongs to the desired MongoDB Cloud user.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type deleteOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *deleteOrganizationOpts) initClient() func() error { @@ -157,10 +178,10 @@ func deleteOrganizationBuilder() *cobra.Command { opts := deleteOrganizationOpts{} cmd := &cobra.Command{ - Use: "deleteOrganization", + Use: "deleteOrganization", Short: "Remove One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -174,15 +195,15 @@ func deleteOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type deleteOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string } @@ -196,7 +217,7 @@ func (opts *deleteOrganizationInvitationOpts) initClient() func() error { func (opts *deleteOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.DeleteOrganizationInvitationApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, } resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params).Execute() @@ -212,10 +233,10 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { opts := deleteOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "deleteOrganizationInvitation", + Use: "deleteOrganizationInvitation", Short: "Cancel One Organization Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -230,16 +251,16 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } - type getOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *getOrganizationOpts) initClient() func() error { @@ -267,10 +288,10 @@ func getOrganizationBuilder() *cobra.Command { opts := getOrganizationOpts{} cmd := &cobra.Command{ - Use: "getOrganization", + Use: "getOrganization", Short: "Return One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -284,15 +305,15 @@ func getOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type getOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string } @@ -306,7 +327,7 @@ func (opts *getOrganizationInvitationOpts) initClient() func() error { func (opts *getOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.GetOrganizationInvitationApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, } resp, _, err := opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params).Execute() @@ -322,10 +343,10 @@ func getOrganizationInvitationBuilder() *cobra.Command { opts := getOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "getOrganizationInvitation", + Use: "getOrganizationInvitation", Short: "Return One Organization Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -340,16 +361,16 @@ func getOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } - type getOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *getOrganizationSettingsOpts) initClient() func() error { @@ -377,10 +398,10 @@ func getOrganizationSettingsBuilder() *cobra.Command { opts := getOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "getOrganizationSettings", + Use: "getOrganizationSettings", Short: "Return Settings for One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -394,15 +415,15 @@ func getOrganizationSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type listOrganizationInvitationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string username string } @@ -416,7 +437,7 @@ func (opts *listOrganizationInvitationsOpts) initClient() func() error { func (opts *listOrganizationInvitationsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationInvitationsApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, Username: &opts.username, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params).Execute() @@ -432,10 +453,10 @@ func listOrganizationInvitationsBuilder() *cobra.Command { opts := listOrganizationInvitationsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationInvitations", + Use: "listOrganizationInvitations", Short: "Return All Organization Invitations", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -450,19 +471,19 @@ func listOrganizationInvitationsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type listOrganizationProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int - name string + pageNum int + name string } func (opts *listOrganizationProjectsOpts) initClient() func() error { @@ -475,11 +496,11 @@ func (opts *listOrganizationProjectsOpts) initClient() func() error { func (opts *listOrganizationProjectsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationProjectsApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Name: &opts.name, + PageNum: &opts.pageNum, + Name: &opts.name, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params).Execute() if err != nil { @@ -494,10 +515,10 @@ func listOrganizationProjectsBuilder() *cobra.Command { opts := listOrganizationProjectsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationProjects", + Use: "listOrganizationProjects", Short: "Return One or More Projects in One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -515,18 +536,18 @@ func listOrganizationProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type listOrganizationUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listOrganizationUsersOpts) initClient() func() error { @@ -539,10 +560,10 @@ func (opts *listOrganizationUsersOpts) initClient() func() error { func (opts *listOrganizationUsersOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationUsersApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params).Execute() if err != nil { @@ -557,10 +578,10 @@ func listOrganizationUsersBuilder() *cobra.Command { opts := listOrganizationUsersOpts{} cmd := &cobra.Command{ - Use: "listOrganizationUsers", + Use: "listOrganizationUsers", Short: "Return All MongoDB Cloud Users in One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -577,18 +598,18 @@ func listOrganizationUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type listOrganizationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int - pageNum int - name string + pageNum int + name string } func (opts *listOrganizationsOpts) initClient() func() error { @@ -603,8 +624,8 @@ func (opts *listOrganizationsOpts) Run(ctx context.Context) error { params := &admin.ListOrganizationsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Name: &opts.name, + PageNum: &opts.pageNum, + Name: &opts.name, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params).Execute() if err != nil { @@ -619,10 +640,10 @@ func listOrganizationsBuilder() *cobra.Command { opts := listOrganizationsOpts{} cmd := &cobra.Command{ - Use: "listOrganizations", + Use: "listOrganizations", Short: "Return All Organizations", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -639,14 +660,15 @@ func listOrganizationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.`) + return cmd } - type renameOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string + } func (opts *renameOrganizationOpts) initClient() func() error { @@ -660,6 +682,7 @@ func (opts *renameOrganizationOpts) initClient() func() error { func (opts *renameOrganizationOpts) Run(ctx context.Context) error { params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() if err != nil { @@ -674,10 +697,10 @@ func renameOrganizationBuilder() *cobra.Command { opts := renameOrganizationOpts{} cmd := &cobra.Command{ - Use: "renameOrganization", + Use: "renameOrganization", Short: "Rename One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -690,16 +713,26 @@ func renameOrganizationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the organization.`) + + cmd.Flags().BoolVar(&opts.isDeleted, "isDeleted", false, `Flag that indicates whether this organization has been deleted.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the organization.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type updateOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string + } func (opts *updateOrganizationInvitationOpts) initClient() func() error { @@ -713,6 +746,7 @@ func (opts *updateOrganizationInvitationOpts) initClient() func() error { func (opts *updateOrganizationInvitationOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { @@ -727,10 +761,10 @@ func updateOrganizationInvitationBuilder() *cobra.Command { opts := updateOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationInvitation", + Use: "updateOrganizationInvitation", Short: "Update One Organization Invitation", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -743,17 +777,25 @@ func updateOrganizationInvitationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + + + cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + + cmd.Flags().SetSliceVar(&opts.teamIds, "teamIds", nil, `List of teams to which you want to invite the desired MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.username, "username", "", `Email address that belongs to the desired MongoDB Cloud user.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } - type updateOrganizationInvitationByIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string + } func (opts *updateOrganizationInvitationByIdOpts) initClient() func() error { @@ -766,8 +808,9 @@ func (opts *updateOrganizationInvitationByIdOpts) initClient() func() error { func (opts *updateOrganizationInvitationByIdOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationInvitationByIdApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, + } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params).Execute() if err != nil { @@ -782,10 +825,10 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { opts := updateOrganizationInvitationByIdOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationInvitationById", + Use: "updateOrganizationInvitationById", Short: "Update One Organization Invitation by Invitation ID", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -799,17 +842,23 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) + + + cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + + cmd.Flags().SetSliceVar(&opts.teamIds, "teamIds", nil, `List of teams to which you want to invite the desired MongoDB Cloud user.`) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } - type updateOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string + } func (opts *updateOrganizationSettingsOpts) initClient() func() error { @@ -823,6 +872,7 @@ func (opts *updateOrganizationSettingsOpts) initClient() func() error { func (opts *updateOrganizationSettingsOpts) Run(ctx context.Context) error { params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, + } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params).Execute() if err != nil { @@ -837,10 +887,10 @@ func updateOrganizationSettingsBuilder() *cobra.Command { opts := updateOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "updateOrganizationSettings", + Use: "updateOrganizationSettings", Short: "Update Settings for One Organization", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -853,6 +903,14 @@ func updateOrganizationSettingsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + + + cmd.Flags().BoolVar(&opts.apiAccessListRequired, "apiAccessListRequired", false, `Flag that indicates whether to require API operations to originate from an IP Address added to the API access list for the specified organization.`) + + cmd.Flags().BoolVar(&opts.multiFactorAuthRequired, "multiFactorAuthRequired", false, `Flag that indicates whether to require users to set up Multi-Factor Authentication (MFA) before accessing the specified organization. To learn more, see: https://www.mongodb.com/docs/atlas/security-multi-factor-authentication/.`) + + cmd.Flags().BoolVar(&opts.restrictEmployeeAccess, "restrictEmployeeAccess", false, `Flag that indicates whether to block MongoDB Support from accessing Atlas infrastructure for any deployment in the specified organization without explicit permission. Once this setting is turned on, you can grant MongoDB Support a 24-hour bypass access to the Atlas deployment to resolve support issues. To learn more, see: https://www.mongodb.com/docs/atlas/security-restrict-support-access/.`) + _ = cmd.MarkFlagRequired("orgId") return cmd @@ -860,8 +918,8 @@ func updateOrganizationSettingsBuilder() *cobra.Command { func organizationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "organizations", - Short: `Returns, adds, and edits organizational units in MongoDB Cloud.`, + Use: "organizations", + Short: `Returns, adds, and edits organizational units in MongoDB Cloud.`, } cmd.AddCommand( createOrganizationBuilder(), @@ -882,3 +940,4 @@ func organizationsBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index f8ef4e78ae..b4daa96bfd 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -138,6 +138,10 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.providerName, "providerName", "", `Human-readable label that identifies the cloud service provider for which you want to create the private endpoint service.`) + + cmd.Flags().StringVar(&opts.region, "region", "", `Cloud provider region in which you want to create the private endpoint service. Regions accepted as values differ for [Amazon Web Services](https://docs.atlas.mongodb.com/reference/amazon-aws/), [Google Cloud Platform](https://docs.atlas.mongodb.com/reference/google-gcp/), and [Microsoft Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/).`) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -567,6 +571,18 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled the regionalized private endpoint setting for the specified project. + +- Set this value to `true` to enable regionalized private endpoints. This allows you to create more than one private endpoint in a cloud provider region. You need to enable this setting to connect to multi-region and global MongoDB Cloud sharded clusters. Enabling regionalized private endpoints introduces the following limitations: + - Your applications must use the new connection strings for existing multi-region and global sharded clusters. This might cause downtime. + - Your MongoDB Cloud project can't contain replica sets nor can you create new replica sets in this project. + + - You can't disable this setting if you have: + - more than one private endpoint in more than one region + - more than one private endpoint in one region and one private endpoint in one or more regions. + +- Set this value to `false` to disable regionalized private endpoints.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 2cb819bb19..49a3c98b30 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -132,6 +132,10 @@ func createApiKeyBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.desc, "desc", "", `Purpose or explanation provided when someone created this organization API key.`) + + cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization or project.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -256,6 +260,10 @@ func createProjectApiKeyBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.desc, "desc", "", `Purpose or explanation provided when someone created this organization API key.`) + + cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization or project.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -799,6 +807,10 @@ func updateApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key you want to update.`) + cmd.Flags().StringVar(&opts.desc, "desc", "", `Purpose or explanation provided when someone created this organization API key.`) + + cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization or project.`) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -870,6 +882,10 @@ func updateApiKeyRolesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().StringVar(&opts.desc, "desc", "", `Purpose or explanation provided when someone created this organization API key.`) + + cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization or project.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 389efa5c42..6fb2a0e40d 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -76,6 +76,22 @@ func createProjectBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. `) + cmd.Flags().Int64Var(&opts.clusterCount, "clusterCount", 00, `Quantity of MongoDB Cloud clusters deployed in this project.`) + + cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when MongoDB Cloud created this project. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud project.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the project included in the MongoDB Cloud organization.`) + + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud organization to which the project belongs.`) + + cmd.Flags().StringVar(&opts.regionUsageRestrictions, "regionUsageRestrictions", ""NONE"", `Region usage restrictions that designate the project's AWS region.`) + + cmd.Flags().BoolVar(&opts.withDefaultAlertsSettings, "withDefaultAlertsSettings", false, `Flag that indicates whether to create the project with default alert settings.`) + return cmd } @@ -130,6 +146,10 @@ func createProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the MongoDB Cloud user invited to the specified project.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -1040,6 +1060,8 @@ func updateProjectBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the project included in the MongoDB Cloud organization.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -1095,6 +1117,10 @@ func updateProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the MongoDB Cloud user invited to the specified project.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -1153,6 +1179,8 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) + cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -1209,6 +1237,18 @@ func updateProjectSettingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.isCollectDatabaseSpecificsStatisticsEnabled, "isCollectDatabaseSpecificsStatisticsEnabled", false, `Flag that indicates whether to collect database-specific metrics for the specified project.`) + + cmd.Flags().BoolVar(&opts.isDataExplorerEnabled, "isDataExplorerEnabled", false, `Flag that indicates whether to enable the Data Explorer for the specified project.`) + + cmd.Flags().BoolVar(&opts.isExtendedStorageSizesEnabled, "isExtendedStorageSizesEnabled", false, `Flag that indicates whether to enable extended storage sizes for the specified project.`) + + cmd.Flags().BoolVar(&opts.isPerformanceAdvisorEnabled, "isPerformanceAdvisorEnabled", false, `Flag that indicates whether to enable the Performance Advisor and Profiler for the specified project.`) + + cmd.Flags().BoolVar(&opts.isRealtimePerformancePanelEnabled, "isRealtimePerformancePanelEnabled", false, `Flag that indicates whether to enable the Real Time Performance Panel for the specified project.`) + + cmd.Flags().BoolVar(&opts.isSchemaAdvisorEnabled, "isSchemaAdvisorEnabled", false, `Flag that indicates whether to enable the Schema Advisor for the specified project.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index aefdb791cc..9e472894cf 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -18,18 +18,21 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createRollingIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string + } func (opts *createRollingIndexOpts) initClient() func() error { @@ -42,8 +45,9 @@ func (opts *createRollingIndexOpts) initClient() func() error { func (opts *createRollingIndexOpts) Run(ctx context.Context) error { params := &admin.CreateRollingIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, + } _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() if err != nil { @@ -58,10 +62,10 @@ func createRollingIndexBuilder() *cobra.Command { opts := createRollingIndexOpts{} cmd := &cobra.Command{ - Use: "createRollingIndex", + Use: "createRollingIndex", Short: "Create One Rolling Index", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -77,6 +81,18 @@ func createRollingIndexBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.`) + + + cmd.Flags().CollationVar(&opts.collation, "collation", , ``) + + cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label of the collection for which MongoDB Cloud creates an index.`) + + cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label of the database that holds the collection on which MongoDB Cloud creates an index.`) + + cmd.Flags().ArraySliceVar(&opts.keys, "keys", nil, `List that contains one or more objects that describe the parameters that you want to index.`) + + cmd.Flags().IndexOptionsVar(&opts.options, "options", , ``) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -85,11 +101,12 @@ func createRollingIndexBuilder() *cobra.Command { func rollingIndexBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "rollingIndex", - Short: `Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.`, + Use: "rollingIndex", + Short: `Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.`, } cmd.AddCommand( createRollingIndexBuilder(), ) return cmd } + diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index f05091d1ad..582abf329a 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -18,17 +18,20 @@ package generated import ( "context" + "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/admin" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string + } func (opts *createServerlessInstanceOpts) initClient() func() error { @@ -42,6 +45,7 @@ func (opts *createServerlessInstanceOpts) initClient() func() error { func (opts *createServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, + } resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -56,10 +60,10 @@ func createServerlessInstanceBuilder() *cobra.Command { opts := createServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "createServerlessInstance", + Use: "createServerlessInstance", Short: "Create One Serverless Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -74,17 +78,28 @@ func createServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + + cmd.Flags().ServerlessProviderSettingsVar(&opts.providerSettings, "providerSettings", , ``) + + cmd.Flags().ServerlessBackupOptionsVar(&opts.serverlessBackupOptions, "serverlessBackupOptions", , ``) + + cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of the serverless instance.`) + + cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the serverless instance. If set to `true`, MongoDB Cloud won't delete the serverless instance. If set to `false`, MongoDB Cloud will delete the serverless instance.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type deleteServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } func (opts *deleteServerlessInstanceOpts) initClient() func() error { @@ -98,7 +113,7 @@ func (opts *deleteServerlessInstanceOpts) initClient() func() error { func (opts *deleteServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -113,10 +128,10 @@ func deleteServerlessInstanceBuilder() *cobra.Command { opts := deleteServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "deleteServerlessInstance", + Use: "deleteServerlessInstance", Short: "Remove One Serverless Instance from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -133,17 +148,17 @@ func deleteServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } - type getServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } func (opts *getServerlessInstanceOpts) initClient() func() error { @@ -157,7 +172,7 @@ func (opts *getServerlessInstanceOpts) initClient() func() error { func (opts *getServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -172,10 +187,10 @@ func getServerlessInstanceBuilder() *cobra.Command { opts := getServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "getServerlessInstance", + Use: "getServerlessInstance", Short: "Return One Serverless Instance from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -192,19 +207,19 @@ func getServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } - type listServerlessInstancesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listServerlessInstancesOpts) initClient() func() error { @@ -217,10 +232,10 @@ func (opts *listServerlessInstancesOpts) initClient() func() error { func (opts *listServerlessInstancesOpts) Run(ctx context.Context) error { params := &admin.ListServerlessInstancesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params).Execute() if err != nil { @@ -235,10 +250,10 @@ func listServerlessInstancesBuilder() *cobra.Command { opts := listServerlessInstancesOpts{} cmd := &cobra.Command{ - Use: "listServerlessInstances", + Use: "listServerlessInstances", Short: "Return All Serverless Instances from One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -257,16 +272,17 @@ func listServerlessInstancesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + _ = cmd.MarkFlagRequired("groupId") return cmd } - type updateServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string + } func (opts *updateServerlessInstanceOpts) initClient() func() error { @@ -280,7 +296,8 @@ func (opts *updateServerlessInstanceOpts) initClient() func() error { func (opts *updateServerlessInstanceOpts) Run(ctx context.Context) error { params := &admin.UpdateServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, + } resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { @@ -295,10 +312,10 @@ func updateServerlessInstanceBuilder() *cobra.Command { opts := updateServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "updateServerlessInstance", + Use: "updateServerlessInstance", Short: "Update One Serverless Instance in One Project", Annotations: map[string]string{ - "output": template, + "output": template, }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( @@ -314,6 +331,12 @@ func updateServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + + + cmd.Flags().ServerlessBackupOptionsVar(&opts.serverlessBackupOptions, "serverlessBackupOptions", , ``) + + cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the serverless instance. If set to `true`, MongoDB Cloud won't delete the serverless instance. If set to `false`, MongoDB Cloud will delete the serverless instance.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") @@ -322,8 +345,8 @@ func updateServerlessInstanceBuilder() *cobra.Command { func serverlessInstancesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "serverlessInstances", - Short: `Returns, adds, edits, and removes serverless instances.`, + Use: "serverlessInstances", + Short: `Returns, adds, edits, and removes serverless instances.`, } cmd.AddCommand( createServerlessInstanceBuilder(), @@ -334,3 +357,4 @@ func serverlessInstancesBuilder() *cobra.Command { ) return cmd } + diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index 21aaa0b03f..6ce9b6017c 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -78,6 +78,8 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.`) + cmd.Flags().StringVar(&opts.comment, "comment", "", `Human-readable comment associated with the private endpoint.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") return cmd diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index a0a1e62fc3..349c3a424c 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -78,6 +78,34 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the source cluster.`) + + cmd.Flags().StringVar(&opts.deliveryType, "deliveryType", "", `Means by which this resource returns the snapshot to the requesting MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.expirationDate, "expirationDate", "", `Date and time when the download link no longer works. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.projectId, "projectId", "", `Unique 24-hexadecimal digit string that identifies the project from which the restore job originated.`) + + cmd.Flags().StringVar(&opts.restoreFinishedDate, "restoreFinishedDate", "", `Date and time when MongoDB Cloud completed writing this snapshot. MongoDB Cloud changes the status of the restore job to `CLOSED`. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.restoreScheduledDate, "restoreScheduledDate", "", `Date and time when MongoDB Cloud will restore this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.snapshotFinishedDate, "snapshotFinishedDate", "", `Date and time when MongoDB Cloud completed writing this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the snapshot to restore.`) + + cmd.Flags().StringVar(&opts.snapshotUrl, "snapshotUrl", "", `Internet address from which you can download the compressed snapshot files. The resource returns this parameter when `"deliveryType" : "DOWNLOAD"`.`) + + cmd.Flags().StringVar(&opts.status, "status", "", `Phase of the restore workflow for this job at the time this resource made this request.`) + + cmd.Flags().StringVar(&opts.targetDeploymentItemName, "targetDeploymentItemName", "", `Human-readable label that identifies the cluster on the target project to which you want to restore the snapshot. You can restore the snapshot to a cluster tier *M2* or greater.`) + + cmd.Flags().StringVar(&opts.targetProjectId, "targetProjectId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the cluster to which you want to restore the snapshot.`) + _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index 1b0e535bb5..ccde81a870 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -78,6 +78,34 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the source cluster.`) + + cmd.Flags().StringVar(&opts.deliveryType, "deliveryType", "", `Means by which this resource returns the snapshot to the requesting MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.expirationDate, "expirationDate", "", `Date and time when the download link no longer works. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.projectId, "projectId", "", `Unique 24-hexadecimal digit string that identifies the project from which the restore job originated.`) + + cmd.Flags().StringVar(&opts.restoreFinishedDate, "restoreFinishedDate", "", `Date and time when MongoDB Cloud completed writing this snapshot. MongoDB Cloud changes the status of the restore job to `CLOSED`. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.restoreScheduledDate, "restoreScheduledDate", "", `Date and time when MongoDB Cloud will restore this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.snapshotFinishedDate, "snapshotFinishedDate", "", `Date and time when MongoDB Cloud completed writing this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the snapshot to restore.`) + + cmd.Flags().StringVar(&opts.snapshotUrl, "snapshotUrl", "", `Internet address from which you can download the compressed snapshot files. The resource returns this parameter when `"deliveryType" : "DOWNLOAD"`.`) + + cmd.Flags().StringVar(&opts.status, "status", "", `Phase of the restore workflow for this job at the time this resource made this request.`) + + cmd.Flags().StringVar(&opts.targetDeploymentItemName, "targetDeploymentItemName", "", `Human-readable label that identifies the cluster on the target project to which you want to restore the snapshot. You can restore the snapshot to a cluster tier *M2* or greater.`) + + cmd.Flags().StringVar(&opts.targetProjectId, "targetProjectId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the cluster to which you want to restore the snapshot.`) + _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index d230858f50..0db9894b35 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -185,6 +185,14 @@ func createTeamBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this team.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the team.`) + + cmd.Flags().SetSliceVar(&opts.usernames, "usernames", nil, `List that contains the MongoDB Cloud users in this team.`) + _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -721,6 +729,14 @@ func renameTeamBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to rename.`) + cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this team.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the team.`) + + cmd.Flags().SetSliceVar(&opts.usernames, "usernames", nil, `List that contains the MongoDB Cloud users in this team.`) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -780,6 +796,12 @@ func updateTeamRolesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.`) + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().SetSliceVar(&opts.roleNames, "roleNames", nil, `One or more organization- or project-level roles to assign to the MongoDB Cloud user.`) + + cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal character string that identifies the team.`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") return cmd diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 7d163835ba..977e9f04e2 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -78,6 +78,20 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account for whom to create a certificate.`) + cmd.Flags().Int64Var(&opts._id, "_id", 00, `Unique 24-hexadecimal character string that identifies this certificate.`) + + cmd.Flags().StringVar(&opts.createdAt, "createdAt", "", `Date and time when MongoDB Cloud created this certificate. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + + cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + + cmd.Flags().IntVar(&opts.monthsUntilExpiration, "monthsUntilExpiration", 3, `Number of months that the certificate remains valid until it expires.`) + + cmd.Flags().StringVar(&opts.notAfter, "notAfter", "", `Date and time when this certificate expires. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + + cmd.Flags().StringVar(&opts.subject, "subject", "", `Subject Alternative Name associated with this certificate. This parameter expresses its value as a distinguished name as defined in [RFC 2253](https://tools.ietf.org/html/2253).`) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") return cmd diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 11ab5f82b5..3c74b08f5d 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -67,6 +67,9 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C {{#allParams}} {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, `{{unescapedDescription}}`){{/isBodyParam}} {{/allParams}} +{{#bodyParam}}{{#vars}} + cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{baseName}}, "{{baseName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, `{{unescapedDescription}}`) +{{/vars}}{{/bodyParam}} {{#allParams}}{{^isBodyParam}}{{#required}} _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/isBodyParam}}{{/allParams}} return cmd From fae62ece812705b03646510bfff17567e2a29003 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 20 Sep 2023 16:22:03 +0100 Subject: [PATCH 20/44] body should always be json and output as well --- internal/generated/api_access_tracking_cmd.go | 34 +- .../generated/api_alert_configurations_cmd.go | 363 +++-- internal/generated/api_alerts_cmd.go | 206 +-- internal/generated/api_atlas_search_cmd.go | 301 ++-- internal/generated/api_auditing_cmd.go | 81 +- .../generated/api_aws_clusters_dns_cmd.go | 76 +- internal/generated/api_cloud_backups_cmd.go | 1207 ++++++++++------- .../api_cloud_migration_service_cmd.go | 314 +++-- .../api_cloud_provider_access_cmd.go | 153 ++- .../api_cluster_outage_simulation_cmd.go | 107 +- internal/generated/api_clusters_cmd.go | 454 ++++--- .../api_custom_database_roles_cmd.go | 163 ++- internal/generated/api_data_federation_cmd.go | 562 ++++---- .../generated/api_data_lake_pipelines_cmd.go | 497 ++++--- internal/generated/api_database_users_cmd.go | 229 ++-- ..._rest_using_customer_key_management_cmd.go | 96 +- internal/generated/api_events_cmd.go | 64 +- .../api_federated_authentication_cmd.go | 557 ++++---- internal/generated/api_global_clusters_cmd.go | 233 ++-- internal/generated/api_invoices_cmd.go | 64 +- .../generated/api_ldap_configuration_cmd.go | 211 +-- internal/generated/api_legacy_backup_cmd.go | 417 +++--- .../api_legacy_backup_restore_jobs_cmd.go | 123 +- .../generated/api_maintenance_windows__cmd.go | 135 +- .../generated/api_mongo_db_cloud_users_cmd.go | 117 +- .../generated/api_monitoring_and_logs_cmd.go | 214 ++- .../generated/api_multi_cloud_clusters_cmd.go | 320 +++-- internal/generated/api_network_peering_cmd.go | 380 ++++-- internal/generated/api_online_archive_cmd.go | 324 ++--- internal/generated/api_organizations_cmd.go | 605 +++++---- .../generated/api_performance_advisor_cmd.go | 79 +- .../api_private_endpoint_services_cmd.go | 262 ++-- .../api_programmatic_api_keys_cmd.go | 442 ++++-- .../api_project_ip_access_list_cmd.go | 117 +- internal/generated/api_projects_cmd.go | 592 +++++--- internal/generated/api_rolling_index_cmd.go | 84 +- internal/generated/api_root_cmd.go | 19 +- .../generated/api_serverless_instances_cmd.go | 219 +-- .../api_serverless_private_endpoints_cmd.go | 155 ++- .../api_shared_tier_restore_jobs_cmd.go | 116 +- .../api_shared_tier_snapshots_cmd.go | 116 +- internal/generated/api_teams_cmd.go | 400 ++++-- internal/generated/api_test__cmd.go | 19 +- .../api_third_party_integrations_cmd.go | 151 ++- .../generated/api_x509_authentication_cmd.go | 102 +- .../config/go-templates/cmd.mustache | 63 +- 46 files changed, 6888 insertions(+), 4655 deletions(-) diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/generated/api_access_tracking_cmd.go index 1b428bdff4..941cb2a582 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/generated/api_access_tracking_cmd.go @@ -18,8 +18,12 @@ package generated import ( "context" + "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -45,7 +49,7 @@ func (opts *listAccessLogsByClusterNameOpts) initClient() func() error { } } -func (opts *listAccessLogsByClusterNameOpts) Run(ctx context.Context) error { +func (opts *listAccessLogsByClusterNameOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListAccessLogsByClusterNameApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -60,27 +64,21 @@ func (opts *listAccessLogsByClusterNameOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAccessLogsByClusterNameBuilder() *cobra.Command { - const template = "<>" - opts := listAccessLogsByClusterNameOpts{} cmd := &cobra.Command{ Use: "listAccessLogsByClusterName", Short: "Return Database Access History for One Cluster using Its Cluster Name", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -93,6 +91,9 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -119,7 +120,7 @@ func (opts *listAccessLogsByHostnameOpts) initClient() func() error { } } -func (opts *listAccessLogsByHostnameOpts) Run(ctx context.Context) error { +func (opts *listAccessLogsByHostnameOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListAccessLogsByHostnameApiParams{ GroupId: opts.groupId, Hostname: opts.hostname, @@ -134,27 +135,21 @@ func (opts *listAccessLogsByHostnameOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAccessLogsByHostnameBuilder() *cobra.Command { - const template = "<>" - opts := listAccessLogsByHostnameOpts{} cmd := &cobra.Command{ Use: "listAccessLogsByHostname", Short: "Return Database Access History for One Cluster using Its Hostname", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -167,6 +162,9 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostname") return cmd diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/generated/api_alert_configurations_cmd.go index cff386f04b..2930af4fbe 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/generated/api_alert_configurations_cmd.go @@ -18,20 +18,28 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *createAlertConfigurationOpts) initClient() func() error { @@ -42,75 +50,100 @@ func (opts *createAlertConfigurationOpts) initClient() func() error { } } -func (opts *createAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *createAlertConfigurationOpts) readData() (*admin.AlertConfigViewForNdsGroup, error) { + var out *admin.AlertConfigViewForNdsGroup + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, - + + AlertConfigViewForNdsGroup: data, } resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createAlertConfigurationBuilder() *cobra.Command { - const template = "<>" - - opts := createAlertConfigurationOpts{} + opts := createAlertConfigurationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createAlertConfiguration", + Use: "createAlertConfiguration", Short: "Create One Alert Configuration in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when MongoDB Cloud created the alert configuration. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled this alert configuration for the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.eventTypeName, "eventTypeName", "", `Event type that triggers an alert.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns this alert configuration.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this alert configuration.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.matchers, "matchers", nil, `No matchers are available for these alert types. The list is always empty.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.notifications, "notifications", nil, `List that contains the targets that MongoDB Cloud sends notifications.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.updated, "updated", "", `Date and time when someone last updated this alert configuration. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ServerlessMetricThresholdVar(&opts.metricThreshold, "metricThreshold", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ThresholdViewIntegerVar(&opts.threshold, "threshold", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type deleteAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string } @@ -122,9 +155,9 @@ func (opts *deleteAlertConfigurationOpts) initClient() func() error { } } -func (opts *deleteAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *deleteAlertConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params).Execute() @@ -132,27 +165,21 @@ func (opts *deleteAlertConfigurationOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func deleteAlertConfigurationBuilder() *cobra.Command { - const template = "<>" - opts := deleteAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "deleteAlertConfiguration", + Use: "deleteAlertConfiguration", Short: "Remove One Alert Configuration from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -160,16 +187,19 @@ func deleteAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } + type getAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string } @@ -181,9 +211,9 @@ func (opts *getAlertConfigurationOpts) initClient() func() error { } } -func (opts *getAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *getAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } resp, _, err := opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params).Execute() @@ -191,27 +221,21 @@ func (opts *getAlertConfigurationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getAlertConfigurationBuilder() *cobra.Command { - const template = "<>" - opts := getAlertConfigurationOpts{} cmd := &cobra.Command{ - Use: "getAlertConfiguration", + Use: "getAlertConfiguration", Short: "Return One Alert Configuration from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -219,11 +243,14 @@ func getAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } + type listAlertConfigurationMatchersFieldNamesOpts struct { cli.GlobalOpts cli.OutputOpts @@ -238,49 +265,45 @@ func (opts *listAlertConfigurationMatchersFieldNamesOpts) initClient() func() er } } -func (opts *listAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Context) error { - params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{ - } +func (opts *listAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{} resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { - const template = "<>" - opts := listAlertConfigurationMatchersFieldNamesOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurationMatchersFieldNames", + Use: "listAlertConfigurationMatchersFieldNames", Short: "Get All Alert Configuration Matchers Field Names", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } + type listAlertConfigurationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listAlertConfigurationsOpts) initClient() func() error { @@ -291,39 +314,33 @@ func (opts *listAlertConfigurationsOpts) initClient() func() error { } } -func (opts *listAlertConfigurationsOpts) Run(ctx context.Context) error { +func (opts *listAlertConfigurationsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListAlertConfigurationsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAlertConfigurationsBuilder() *cobra.Command { - const template = "<>" - opts := listAlertConfigurationsOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurations", + Use: "listAlertConfigurations", Short: "Return All Alert Configurations for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -333,19 +350,22 @@ func listAlertConfigurationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type listAlertConfigurationsByAlertIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - alertId string + client *admin.APIClient + groupId string + alertId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listAlertConfigurationsByAlertIdOpts) initClient() func() error { @@ -356,40 +376,34 @@ func (opts *listAlertConfigurationsByAlertIdOpts) initClient() func() error { } } -func (opts *listAlertConfigurationsByAlertIdOpts) Run(ctx context.Context) error { +func (opts *listAlertConfigurationsByAlertIdOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListAlertConfigurationsByAlertIdApiParams{ - GroupId: opts.groupId, - AlertId: opts.alertId, + GroupId: opts.groupId, + AlertId: opts.alertId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { - const template = "<>" - opts := listAlertConfigurationsByAlertIdOpts{} cmd := &cobra.Command{ - Use: "listAlertConfigurationsByAlertId", + Use: "listAlertConfigurationsByAlertId", Short: "Return All Alert Configurations Set for One Alert", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -400,18 +414,23 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } + type toggleAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string - + + filename string + fs afero.Fs } func (opts *toggleAlertConfigurationOpts) initClient() func() error { @@ -422,60 +441,87 @@ func (opts *toggleAlertConfigurationOpts) initClient() func() error { } } -func (opts *toggleAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *toggleAlertConfigurationOpts) readData() (*admin.Toggle, error) { + var out *admin.Toggle + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *toggleAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.ToggleAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - + + Toggle: data, } resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func toggleAlertConfigurationBuilder() *cobra.Command { - const template = "<>" - - opts := toggleAlertConfigurationOpts{} + opts := toggleAlertConfigurationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "toggleAlertConfiguration", + Use: "toggleAlertConfiguration", Short: "Toggle One State of One Alert Configuration in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) - - cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether to enable or disable the specified alert configuration in the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } + type updateAlertConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string - + + filename string + fs afero.Fs } func (opts *updateAlertConfigurationOpts) initClient() func() error { @@ -486,68 +532,92 @@ func (opts *updateAlertConfigurationOpts) initClient() func() error { } } -func (opts *updateAlertConfigurationOpts) Run(ctx context.Context) error { +func (opts *updateAlertConfigurationOpts) readData() (*admin.AlertConfigViewForNdsGroup, error) { + var out *admin.AlertConfigViewForNdsGroup + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateAlertConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - + + AlertConfigViewForNdsGroup: data, } resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateAlertConfigurationBuilder() *cobra.Command { - const template = "<>" - - opts := updateAlertConfigurationOpts{} + opts := updateAlertConfigurationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateAlertConfiguration", + Use: "updateAlertConfiguration", Short: "Update One Alert Configuration for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) - - cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when MongoDB Cloud created the alert configuration. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled this alert configuration for the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.eventTypeName, "eventTypeName", "", `Event type that triggers an alert.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns this alert configuration.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this alert configuration.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.matchers, "matchers", nil, `No matchers are available for these alert types. The list is always empty.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.notifications, "notifications", nil, `List that contains the targets that MongoDB Cloud sends notifications.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.updated, "updated", "", `Date and time when someone last updated this alert configuration. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ServerlessMetricThresholdVar(&opts.metricThreshold, "metricThreshold", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ThresholdViewIntegerVar(&opts.threshold, "threshold", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -556,8 +626,8 @@ func updateAlertConfigurationBuilder() *cobra.Command { func alertConfigurationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "alertConfigurations", - Short: `Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.`, + Use: "alertConfigurations", + Short: `Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.`, } cmd.AddCommand( createAlertConfigurationBuilder(), @@ -571,4 +641,3 @@ func alertConfigurationsBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_alerts_cmd.go b/internal/generated/api_alerts_cmd.go index 166f79e1d8..98debf0554 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/generated/api_alerts_cmd.go @@ -18,21 +18,29 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type acknowledgeAlertOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string alertId string - + + filename string + fs afero.Fs } func (opts *acknowledgeAlertOpts) initClient() func() error { @@ -43,105 +51,122 @@ func (opts *acknowledgeAlertOpts) initClient() func() error { } } -func (opts *acknowledgeAlertOpts) Run(ctx context.Context) error { +func (opts *acknowledgeAlertOpts) readData() (*admin.AlertViewForNdsGroup, error) { + var out *admin.AlertViewForNdsGroup + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *acknowledgeAlertOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.AcknowledgeAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, - + + AlertViewForNdsGroup: data, } resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func acknowledgeAlertBuilder() *cobra.Command { - const template = "<>" - - opts := acknowledgeAlertOpts{} + opts := acknowledgeAlertOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "acknowledgeAlert", + Use: "acknowledgeAlert", Short: "Acknowledge One Alert from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) - - - cmd.Flags().StringVar(&opts.acknowledgedUntil, "acknowledgedUntil", "", `Date and time until which this alert has been acknowledged. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. The resource returns this parameter if a MongoDB User previously acknowledged this alert. - -- To acknowledge this alert forever, set the parameter value to 100 years in the future. - -- To unacknowledge a previously acknowledged alert, set the parameter value to a date in the past.`) - - cmd.Flags().StringVar(&opts.acknowledgementComment, "acknowledgementComment", "", `Comment that a MongoDB Cloud user submitted when acknowledging the alert.`) - cmd.Flags().StringVar(&opts.acknowledgingUsername, "acknowledgingUsername", "", `MongoDB Cloud username of the person who acknowledged the alert. The response returns this parameter if a MongoDB Cloud user previously acknowledged this alert.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that sets this alert.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when MongoDB Cloud created this alert. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.eventTypeName, "eventTypeName", "", `Incident that triggered this alert.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns this alert.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this alert.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.lastNotified, "lastNotified", "", `Date and time that any notifications were last sent for this alert. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. The resource returns this parameter if MongoDB Cloud has sent notifications for this alert.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal character string that identifies the organization that owns the project to which this alert applies.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.resolved, "resolved", "", `Date and time that this alert changed to `"status" : "CLOSED"`. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. The resource returns this parameter once `"status" : "CLOSED"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.status, "status", "", `State of this alert at the time you requested its details.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.updated, "updated", "", `Date and time when someone last updated this alert. This parameter expresses its value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to which this alert applies. This resource returns this parameter for alerts of events impacting backups, replica sets, or sharded clusters.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.hostnameAndPort, "hostnameAndPort", "", `Hostname and port of the host to which this alert applies. The resource returns this parameter for alerts of events impacting hosts or replica sets.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.replicaSetName, "replicaSetName", "", `Name of the replica set to which this alert applies. The response returns this parameter for alerts of events impacting backups, hosts, or replica sets.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().HostMetricValueVar(&opts.currentValue, "currentValue", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.metricName, "metricName", "", `Name of the metric against which Atlas checks the configured `metricThreshold.threshold`. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -To learn more about the available metrics, see <a href="https://www.mongodb.com/docs/atlas/reference/alert-host-metrics/#std-label-measurement-types" target="_blank">Host Metrics</a>. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -**NOTE**: If you set eventTypeName to OUTSIDE_SERVERLESS_METRIC_THRESHOLD, you can specify only metrics available for serverless. To learn more, see <a href="https://dochub.mongodb.org/core/alert-config-serverless-measurements" target="_blank">Serverless Measurements</a>.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.nonRunningHostIds, "nonRunningHostIds", nil, ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.parentClusterId, "parentClusterId", "", `Unique 24-hexadecimal character string that identifies the parent cluster to which this alert applies. The parent cluster contains the sharded nodes. MongoDB Cloud returns this parameter only for alerts of events impacting sharded clusters.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } + type getAlertOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string alertId string } @@ -154,7 +179,7 @@ func (opts *getAlertOpts) initClient() func() error { } } -func (opts *getAlertOpts) Run(ctx context.Context) error { +func (opts *getAlertOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, @@ -164,27 +189,21 @@ func (opts *getAlertOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getAlertBuilder() *cobra.Command { - const template = "<>" - opts := getAlertOpts{} cmd := &cobra.Command{ - Use: "getAlert", + Use: "getAlert", Short: "Return One Alert from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -192,20 +211,23 @@ func getAlertBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } + type listAlertsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int - status string + pageNum int + status string } func (opts *listAlertsOpts) initClient() func() error { @@ -216,40 +238,34 @@ func (opts *listAlertsOpts) initClient() func() error { } } -func (opts *listAlertsOpts) Run(ctx context.Context) error { +func (opts *listAlertsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListAlertsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Status: &opts.status, + PageNum: &opts.pageNum, + Status: &opts.status, } resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAlertsBuilder() *cobra.Command { - const template = "<>" - opts := listAlertsOpts{} cmd := &cobra.Command{ - Use: "listAlerts", + Use: "listAlerts", Short: "Return All Alerts from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -260,19 +276,22 @@ func listAlertsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.status, "status", "", `Status of the alerts to return. Omit to return all alerts in all statuses.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type listAlertsByAlertConfigurationIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string alertConfigId string - includeCount bool - itemsPerPage int - pageNum int + includeCount bool + itemsPerPage int + pageNum int } func (opts *listAlertsByAlertConfigurationIdOpts) initClient() func() error { @@ -283,40 +302,34 @@ func (opts *listAlertsByAlertConfigurationIdOpts) initClient() func() error { } } -func (opts *listAlertsByAlertConfigurationIdOpts) Run(ctx context.Context) error { +func (opts *listAlertsByAlertConfigurationIdOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListAlertsByAlertConfigurationIdApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, } resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { - const template = "<>" - opts := listAlertsByAlertConfigurationIdOpts{} cmd := &cobra.Command{ - Use: "listAlertsByAlertConfigurationId", + Use: "listAlertsByAlertConfigurationId", Short: "Return All Open Alerts for Alert Configuration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -327,6 +340,8 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -335,8 +350,8 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { func alertsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "alerts", - Short: `Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.`, + Use: "alerts", + Short: `Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.`, } cmd.AddCommand( acknowledgeAlertBuilder(), @@ -346,4 +361,3 @@ func alertsBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/generated/api_atlas_search_cmd.go index f8c838a4f3..1d4af99fd0 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/generated/api_atlas_search_cmd.go @@ -18,21 +18,29 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createAtlasSearchIndexOpts) initClient() func() error { @@ -43,96 +51,103 @@ func (opts *createAtlasSearchIndexOpts) initClient() func() error { } } -func (opts *createAtlasSearchIndexOpts) Run(ctx context.Context) error { +func (opts *createAtlasSearchIndexOpts) readData() (*admin.FTSIndex, error) { + var out *admin.FTSIndex + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + FTSIndex: data, } resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createAtlasSearchIndexBuilder() *cobra.Command { - const template = "<>" - - opts := createAtlasSearchIndexOpts{} + opts := createAtlasSearchIndexOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createAtlasSearchIndex", + Use: "createAtlasSearchIndex", Short: "Create One Atlas Search Index", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection on which to create an Atlas Search index.`) - - cmd.Flags().StringVar(&opts.analyzer, "analyzer", ""lucene.standard"", `Specific pre-defined method chosen to convert database field text into searchable words. This conversion reduces the text of fields into the smallest units of text. These units are called a **term** or **token**. This process, known as tokenization, involves a variety of changes made to the text in fields: + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- extracting words -- removing punctuation -- removing accents -- changing to lowercase -- removing common words -- reducing words to their root form (stemming) -- changing words to their base form (lemmatization) - MongoDB Cloud uses the selected process to build the Atlas Search index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.analyzers, "analyzers", nil, `List of user-defined methods to convert database field text into searchable words.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection that contains one or more Atlas Search indexes.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.database, "database", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.indexID, "indexID", "", `Unique 24-hexadecimal digit string that identifies this Atlas Search index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().FTSMappingsVar(&opts.mappings, "mappings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies this index. Within each namespace, names of all indexes in the namespace must be unique.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.searchAnalyzer, "searchAnalyzer", ""lucene.standard"", `Method applied to identify words when searching this index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.status, "status", "", `Condition of the search index when you made this request. - -| Status | Index Condition | - |---|---| - | IN_PROGRESS | Atlas is building or re-building the index after an edit. | - | STEADY | You can use this search index. | - | FAILED | Atlas could not build the index. | - | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | - | PAUSED | The cluster is paused. | -`) - - cmd.Flags().ArraySliceVar(&opts.synonyms, "synonyms", nil, `Rule sets that map words to their synonyms in this index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type deleteAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string + indexId string } func (opts *deleteAtlasSearchIndexOpts) initClient() func() error { @@ -143,38 +158,32 @@ func (opts *deleteAtlasSearchIndexOpts) initClient() func() error { } } -func (opts *deleteAtlasSearchIndexOpts) Run(ctx context.Context) error { +func (opts *deleteAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, + IndexId: opts.indexId, } resp, _, err := opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteAtlasSearchIndexBuilder() *cobra.Command { - const template = "<>" - opts := deleteAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "deleteAtlasSearchIndex", + Use: "deleteAtlasSearchIndex", Short: "Remove One Atlas Search Index", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -183,19 +192,22 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the database and collection with one or more Application Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd } + type getAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string + indexId string } func (opts *getAtlasSearchIndexOpts) initClient() func() error { @@ -206,38 +218,32 @@ func (opts *getAtlasSearchIndexOpts) initClient() func() error { } } -func (opts *getAtlasSearchIndexOpts) Run(ctx context.Context) error { +func (opts *getAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, + IndexId: opts.indexId, } resp, _, err := opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getAtlasSearchIndexBuilder() *cobra.Command { - const template = "<>" - opts := getAtlasSearchIndexOpts{} cmd := &cobra.Command{ - Use: "getAtlasSearchIndex", + Use: "getAtlasSearchIndex", Short: "Return One Atlas Search Index", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -246,20 +252,23 @@ func getAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd } + type listAtlasSearchIndexesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string collectionName string - databaseName string + databaseName string } func (opts *listAtlasSearchIndexesOpts) initClient() func() error { @@ -270,39 +279,33 @@ func (opts *listAtlasSearchIndexesOpts) initClient() func() error { } } -func (opts *listAtlasSearchIndexesOpts) Run(ctx context.Context) error { +func (opts *listAtlasSearchIndexesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListAtlasSearchIndexesApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, CollectionName: opts.collectionName, - DatabaseName: opts.databaseName, + DatabaseName: opts.databaseName, } resp, _, err := opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAtlasSearchIndexesBuilder() *cobra.Command { - const template = "<>" - opts := listAtlasSearchIndexesOpts{} cmd := &cobra.Command{ - Use: "listAtlasSearchIndexes", + Use: "listAtlasSearchIndexes", Short: "Return All Atlas Search Indexes for One Collection", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -312,6 +315,8 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Name of the collection that contains one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -319,14 +324,17 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("databaseName") return cmd } + type updateAtlasSearchIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - indexId string - + indexId string + + filename string + fs afero.Fs } func (opts *updateAtlasSearchIndexOpts) initClient() func() error { @@ -337,39 +345,62 @@ func (opts *updateAtlasSearchIndexOpts) initClient() func() error { } } -func (opts *updateAtlasSearchIndexOpts) Run(ctx context.Context) error { +func (opts *updateAtlasSearchIndexOpts) readData() (*admin.FTSIndex, error) { + var out *admin.FTSIndex + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateAtlasSearchIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexId: opts.indexId, - + IndexId: opts.indexId, + + FTSIndex: data, } resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateAtlasSearchIndexBuilder() *cobra.Command { - const template = "<>" - - opts := updateAtlasSearchIndexOpts{} + opts := updateAtlasSearchIndexOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateAtlasSearchIndex", + Use: "updateAtlasSearchIndex", Short: "Update One Atlas Search Index", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -377,46 +408,29 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection whose Atlas Search index to update.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) - - - cmd.Flags().StringVar(&opts.analyzer, "analyzer", ""lucene.standard"", `Specific pre-defined method chosen to convert database field text into searchable words. This conversion reduces the text of fields into the smallest units of text. These units are called a **term** or **token**. This process, known as tokenization, involves a variety of changes made to the text in fields: -- extracting words -- removing punctuation -- removing accents -- changing to lowercase -- removing common words -- reducing words to their root form (stemming) -- changing words to their base form (lemmatization) - MongoDB Cloud uses the selected process to build the Atlas Search index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.analyzers, "analyzers", nil, `List of user-defined methods to convert database field text into searchable words.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection that contains one or more Atlas Search indexes.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.database, "database", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.indexID, "indexID", "", `Unique 24-hexadecimal digit string that identifies this Atlas Search index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().FTSMappingsVar(&opts.mappings, "mappings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies this index. Within each namespace, names of all indexes in the namespace must be unique.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.searchAnalyzer, "searchAnalyzer", ""lucene.standard"", `Method applied to identify words when searching this index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.status, "status", "", `Condition of the search index when you made this request. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -| Status | Index Condition | - |---|---| - | IN_PROGRESS | Atlas is building or re-building the index after an edit. | - | STEADY | You can use this search index. | - | FAILED | Atlas could not build the index. | - | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | - | PAUSED | The cluster is paused. | -`) - - cmd.Flags().ArraySliceVar(&opts.synonyms, "synonyms", nil, `Rule sets that map words to their synonyms in this index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -426,8 +440,8 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { func atlasSearchBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "atlasSearch", - Short: `Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.`, + Use: "atlasSearch", + Short: `Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.`, } cmd.AddCommand( createAtlasSearchIndexBuilder(), @@ -438,4 +452,3 @@ func atlasSearchBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_auditing_cmd.go b/internal/generated/api_auditing_cmd.go index c6afde4de3..6baca329d1 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/generated/api_auditing_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -39,7 +47,7 @@ func (opts *getAuditingConfigurationOpts) initClient() func() error { } } -func (opts *getAuditingConfigurationOpts) Run(ctx context.Context) error { +func (opts *getAuditingConfigurationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, } @@ -48,33 +56,30 @@ func (opts *getAuditingConfigurationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getAuditingConfigurationBuilder() *cobra.Command { - const template = "<>" - opts := getAuditingConfigurationOpts{} cmd := &cobra.Command{ Use: "getAuditingConfiguration", Short: "Return the Auditing Configuration for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -84,6 +89,9 @@ type updateAuditingConfigurationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *updateAuditingConfigurationOpts) initClient() func() error { @@ -94,49 +102,76 @@ func (opts *updateAuditingConfigurationOpts) initClient() func() error { } } -func (opts *updateAuditingConfigurationOpts) Run(ctx context.Context) error { +func (opts *updateAuditingConfigurationOpts) readData() (*admin.AuditLog, error) { + var out *admin.AuditLog + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateAuditingConfigurationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateAuditingConfigurationApiParams{ GroupId: opts.groupId, + + AuditLog: data, } resp, _, err := opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateAuditingConfigurationBuilder() *cobra.Command { - const template = "<>" - - opts := updateAuditingConfigurationOpts{} + opts := updateAuditingConfigurationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateAuditingConfiguration", Short: "Update Auditing Configuration for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().BoolVar(&opts.auditAuthorizationSuccess, "auditAuthorizationSuccess", false, `Flag that indicates whether someone set auditing to track successful authentications. This only applies to the `"atype" : "authCheck"` audit filter. Setting this parameter to `true` degrades cluster performance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.auditFilter, "auditFilter", "", `JSON document that specifies which events to record. Escape any characters that may prevent parsing, such as single or double quotes, using a backslash (`\`).`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.configurationType, "configurationType", "", `Human-readable label that displays how to configure the audit filter.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled database auditing for the specified project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/generated/api_aws_clusters_dns_cmd.go index 3994c04d74..2dbcceb50b 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/generated/api_aws_clusters_dns_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -39,7 +47,7 @@ func (opts *getAWSCustomDNSOpts) initClient() func() error { } } -func (opts *getAWSCustomDNSOpts) Run(ctx context.Context) error { +func (opts *getAWSCustomDNSOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, } @@ -48,33 +56,30 @@ func (opts *getAWSCustomDNSOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getAWSCustomDNSBuilder() *cobra.Command { - const template = "<>" - opts := getAWSCustomDNSOpts{} cmd := &cobra.Command{ Use: "getAWSCustomDNS", Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -84,6 +89,9 @@ type toggleAWSCustomDNSOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *toggleAWSCustomDNSOpts) initClient() func() error { @@ -94,44 +102,70 @@ func (opts *toggleAWSCustomDNSOpts) initClient() func() error { } } -func (opts *toggleAWSCustomDNSOpts) Run(ctx context.Context) error { +func (opts *toggleAWSCustomDNSOpts) readData() (*admin.AWSCustomDNSEnabled, error) { + var out *admin.AWSCustomDNSEnabled + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *toggleAWSCustomDNSOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.ToggleAWSCustomDNSApiParams{ GroupId: opts.groupId, + + AWSCustomDNSEnabled: data, } resp, _, err := opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func toggleAWSCustomDNSBuilder() *cobra.Command { - const template = "<>" - - opts := toggleAWSCustomDNSOpts{} + opts := toggleAWSCustomDNSOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "toggleAWSCustomDNS", Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether the project's clusters deployed to Amazon Web Services (AWS) use a custom Domain Name System (DNS). -When `"enabled": true`, connect to your cluster using Private IP for Peering connection strings.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/generated/api_cloud_backups_cmd.go index cc9d4cd8b3..67736f7c28 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/generated/api_cloud_backups_cmd.go @@ -18,20 +18,26 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type cancelBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } @@ -43,10 +49,10 @@ func (opts *cancelBackupRestoreJobOpts) initClient() func() error { } } -func (opts *cancelBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *cancelBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.CancelBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params).Execute() @@ -54,27 +60,21 @@ func (opts *cancelBackupRestoreJobOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func cancelBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - opts := cancelBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "cancelBackupRestoreJob", + Use: "cancelBackupRestoreJob", Short: "Cancel One Restore Job of One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -83,19 +83,24 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to remove.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } + type createBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createBackupExportJobOpts) initClient() func() error { @@ -106,66 +111,93 @@ func (opts *createBackupExportJobOpts) initClient() func() error { } } -func (opts *createBackupExportJobOpts) Run(ctx context.Context) error { +func (opts *createBackupExportJobOpts) readData() (*admin.DiskBackupExportJobRequest, error) { + var out *admin.DiskBackupExportJobRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createBackupExportJobOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateBackupExportJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + DiskBackupExportJobRequest: data, } resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createBackupExportJobBuilder() *cobra.Command { - const template = "<>" - - opts := createBackupExportJobOpts{} + opts := createBackupExportJobOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createBackupExportJob", + Use: "createBackupExportJob", Short: "Create One Cloud Backup Snapshot Export Job", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - - cmd.Flags().ArraySliceVar(&opts.customData, "customData", nil, `Collection of key-value pairs that represent custom data to add to the metadata file that MongoDB Cloud uploads to the bucket when the export job finishes.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique 24-hexadecimal character string that identifies the AWS bucket to which MongoDB Cloud exports the Cloud Backup snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal character string that identifies the Cloud Backup snasphot to export.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type createBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createBackupRestoreJobOpts) initClient() func() error { @@ -176,93 +208,120 @@ func (opts *createBackupRestoreJobOpts) initClient() func() error { } } -func (opts *createBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *createBackupRestoreJobOpts) readData() (*admin.DiskBackupRestoreJob, error) { + var out *admin.DiskBackupRestoreJob + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + DiskBackupRestoreJob: data, } resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - - opts := createBackupRestoreJobOpts{} + opts := createBackupRestoreJobOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createBackupRestoreJob", + Use: "createBackupRestoreJob", Short: "Restore One Snapshot of One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - - cmd.Flags().BoolVar(&opts.cancelled, "cancelled", false, `Flag that indicates whether someone canceled this restore job.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.components, "components", nil, `Information on the restore job for each replica set in the sharded cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.deliveryType, "deliveryType", "", `Human-readable label that categorizes the restore job to create.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.deliveryUrl, "deliveryUrl", nil, `One or more Uniform Resource Locators (URLs) that point to the compressed snapshot files for manual download. MongoDB Cloud returns this parameter when `"deliveryType" : "download"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BSONTimestampVar(&opts.desiredTimestamp, "desiredTimestamp", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.expired, "expired", false, `Flag that indicates whether the restore job expired.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.expiresAt, "expiresAt", "", `Date and time when the restore job expires. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.failed, "failed", false, `Flag that indicates whether the restore job failed.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.finishedAt, "finishedAt", "", `Date and time when the restore job completed. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal character string that identifies the restore job.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.oplogInc, "oplogInc", 000, `Oplog operation number from which you want to restore this snapshot. This number represents the second part of an Oplog timestamp. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.oplogTs, "oplogTs", 000, `Date and time from which you want to restore this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. This number represents the first part of an Oplog timestamp. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.pointInTimeUTCSeconds, "pointInTimeUTCSeconds", 000, `Date and time from which MongoDB Cloud restored this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **pointInTimeUTCSeconds** exceeds `0`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal character string that identifies the snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.targetClusterName, "targetClusterName", "", `Human-readable label that identifies the target cluster to which the restore job restores the snapshot. The resource returns this parameter when `"deliveryType":` `"automated"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.targetGroupId, "targetGroupId", "", `Unique 24-hexadecimal digit string that identifies the target project for the specified **targetClusterName**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.timestamp, "timestamp", "", `Date and time when MongoDB Cloud took the snapshot associated with **snapshotId**. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type createExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *createExportBucketOpts) initClient() func() error { @@ -273,65 +332,92 @@ func (opts *createExportBucketOpts) initClient() func() error { } } -func (opts *createExportBucketOpts) Run(ctx context.Context) error { +func (opts *createExportBucketOpts) readData() (*admin.DiskBackupSnapshotAWSExportBucket, error) { + var out *admin.DiskBackupSnapshotAWSExportBucket + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createExportBucketOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, - + + DiskBackupSnapshotAWSExportBucket: data, } resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createExportBucketBuilder() *cobra.Command { - const template = "<>" - - opts := createExportBucketOpts{} + opts := createExportBucketOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createExportBucket", + Use: "createExportBucket", Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal character string that identifies the Amazon Web Services (AWS) Simple Storage Service (S3) export bucket.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.bucketName, "bucketName", "", `Human-readable label that identifies the AWS bucket that the role is authorized to access.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider that stores this snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.iamRoleId, "iamRoleId", "", `Unique 24-hexadecimal character string that identifies the AWS IAM role that MongoDB Cloud uses to access the AWS S3 bucket.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type createServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createServerlessBackupRestoreJobOpts) initClient() func() error { @@ -342,90 +428,115 @@ func (opts *createServerlessBackupRestoreJobOpts) initClient() func() error { } } -func (opts *createServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *createServerlessBackupRestoreJobOpts) readData() (*admin.ServerlessBackupRestoreJob, error) { + var out *admin.ServerlessBackupRestoreJob + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createServerlessBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateServerlessBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + ServerlessBackupRestoreJob: data, } resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createServerlessBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - - opts := createServerlessBackupRestoreJobOpts{} + opts := createServerlessBackupRestoreJobOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createServerlessBackupRestoreJob", + Use: "createServerlessBackupRestoreJob", Short: "Restore One Snapshot of One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance whose snapshot you want to restore.`) - - cmd.Flags().BoolVar(&opts.cancelled, "cancelled", false, `Flag that indicates whether someone canceled this restore job.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.deliveryType, "deliveryType", "", `Human-readable label that categorizes the restore job to create.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.deliveryUrl, "deliveryUrl", nil, `One or more Uniform Resource Locators (URLs) that point to the compressed snapshot files for manual download. MongoDB Cloud returns this parameter when `"deliveryType" : "download"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BSONTimestampVar(&opts.desiredTimestamp, "desiredTimestamp", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.expired, "expired", false, `Flag that indicates whether the restore job expired.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.expiresAt, "expiresAt", "", `Date and time when the restore job expires. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.failed, "failed", false, `Flag that indicates whether the restore job failed.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.finishedAt, "finishedAt", "", `Date and time when the restore job completed. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal character string that identifies the restore job.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.oplogInc, "oplogInc", 000, `Oplog operation number from which you want to restore this snapshot. This number represents the second part of an Oplog timestamp. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.oplogTs, "oplogTs", 000, `Date and time from which you want to restore this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. This number represents the first part of an Oplog timestamp. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.pointInTimeUTCSeconds, "pointInTimeUTCSeconds", 000, `Date and time from which MongoDB Cloud restored this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. The resource returns this parameter when `"deliveryType" : "pointInTime"` and **pointInTimeUTCSeconds** exceeds `0`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal character string that identifies the snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.targetClusterName, "targetClusterName", "", `Human-readable label that identifies the target cluster to which the restore job restores the snapshot. The resource returns this parameter when `"deliveryType":` `"automated"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.targetGroupId, "targetGroupId", "", `Unique 24-hexadecimal digit string that identifies the target project for the specified **targetClusterName**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.timestamp, "timestamp", "", `Date and time when MongoDB Cloud took the snapshot associated with **snapshotId**. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type deleteAllBackupSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -437,9 +548,9 @@ func (opts *deleteAllBackupSchedulesOpts) initClient() func() error { } } -func (opts *deleteAllBackupSchedulesOpts) Run(ctx context.Context) error { +func (opts *deleteAllBackupSchedulesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteAllBackupSchedulesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params).Execute() @@ -447,27 +558,21 @@ func (opts *deleteAllBackupSchedulesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteAllBackupSchedulesBuilder() *cobra.Command { - const template = "<>" - opts := deleteAllBackupSchedulesOpts{} cmd := &cobra.Command{ - Use: "deleteAllBackupSchedules", + Use: "deleteAllBackupSchedules", Short: "Remove All Cloud Backup Schedules", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -475,16 +580,19 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type deleteExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string exportBucketId string } @@ -496,9 +604,9 @@ func (opts *deleteExportBucketOpts) initClient() func() error { } } -func (opts *deleteExportBucketOpts) Run(ctx context.Context) error { +func (opts *deleteExportBucketOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteExportBucketApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } resp, _, err := opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params).Execute() @@ -506,27 +614,21 @@ func (opts *deleteExportBucketOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteExportBucketBuilder() *cobra.Command { - const template = "<>" - opts := deleteExportBucketOpts{} cmd := &cobra.Command{ - Use: "deleteExportBucket", + Use: "deleteExportBucket", Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -534,18 +636,21 @@ func deleteExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") return cmd } + type deleteReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *deleteReplicaSetBackupOpts) initClient() func() error { @@ -556,38 +661,32 @@ func (opts *deleteReplicaSetBackupOpts) initClient() func() error { } } -func (opts *deleteReplicaSetBackupOpts) Run(ctx context.Context) error { +func (opts *deleteReplicaSetBackupOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteReplicaSetBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteReplicaSetBackupBuilder() *cobra.Command { - const template = "<>" - opts := deleteReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "deleteReplicaSetBackup", + Use: "deleteReplicaSetBackup", Short: "Remove One Replica Set Cloud Backup", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -596,19 +695,22 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } + type deleteShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *deleteShardedClusterBackupOpts) initClient() func() error { @@ -619,38 +721,32 @@ func (opts *deleteShardedClusterBackupOpts) initClient() func() error { } } -func (opts *deleteShardedClusterBackupOpts) Run(ctx context.Context) error { +func (opts *deleteShardedClusterBackupOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteShardedClusterBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteShardedClusterBackupBuilder() *cobra.Command { - const template = "<>" - opts := deleteShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "deleteShardedClusterBackup", + Use: "deleteShardedClusterBackup", Short: "Remove One Sharded Cluster Cloud Backup", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -659,19 +755,22 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } + type getBackupExportJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - exportId string + exportId string } func (opts *getBackupExportJobOpts) initClient() func() error { @@ -682,38 +781,32 @@ func (opts *getBackupExportJobOpts) initClient() func() error { } } -func (opts *getBackupExportJobOpts) Run(ctx context.Context) error { +func (opts *getBackupExportJobOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetBackupExportJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - ExportId: opts.exportId, + ExportId: opts.exportId, } resp, _, err := opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getBackupExportJobBuilder() *cobra.Command { - const template = "<>" - opts := getBackupExportJobOpts{} cmd := &cobra.Command{ - Use: "getBackupExportJob", + Use: "getBackupExportJob", Short: "Return One Cloud Backup Snapshot Export Job", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -722,18 +815,21 @@ func getBackupExportJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.exportId, "exportId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("exportId") return cmd } + type getBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } @@ -745,10 +841,10 @@ func (opts *getBackupRestoreJobOpts) initClient() func() error { } } -func (opts *getBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *getBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params).Execute() @@ -756,27 +852,21 @@ func (opts *getBackupRestoreJobOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - opts := getBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getBackupRestoreJob", + Use: "getBackupRestoreJob", Short: "Return One Restore Job of One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -785,17 +875,20 @@ func getBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } + type getBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -807,9 +900,9 @@ func (opts *getBackupScheduleOpts) initClient() func() error { } } -func (opts *getBackupScheduleOpts) Run(ctx context.Context) error { +func (opts *getBackupScheduleOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetBackupScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params).Execute() @@ -817,27 +910,21 @@ func (opts *getBackupScheduleOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getBackupScheduleBuilder() *cobra.Command { - const template = "<>" - opts := getBackupScheduleOpts{} cmd := &cobra.Command{ - Use: "getBackupSchedule", + Use: "getBackupSchedule", Short: "Return One Cloud Backup Schedule", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -845,15 +932,18 @@ func getBackupScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type getDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -865,7 +955,7 @@ func (opts *getDataProtectionSettingsOpts) initClient() func() error { } } -func (opts *getDataProtectionSettingsOpts) Run(ctx context.Context) error { +func (opts *getDataProtectionSettingsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, } @@ -874,42 +964,39 @@ func (opts *getDataProtectionSettingsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getDataProtectionSettingsBuilder() *cobra.Command { - const template = "<>" - opts := getDataProtectionSettingsOpts{} cmd := &cobra.Command{ - Use: "getDataProtectionSettings", + Use: "getDataProtectionSettings", Short: "Return the Backup Compliance Policy settings", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type getExportBucketOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string exportBucketId string } @@ -921,9 +1008,9 @@ func (opts *getExportBucketOpts) initClient() func() error { } } -func (opts *getExportBucketOpts) Run(ctx context.Context) error { +func (opts *getExportBucketOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetExportBucketApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } resp, _, err := opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params).Execute() @@ -931,27 +1018,21 @@ func (opts *getExportBucketOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getExportBucketBuilder() *cobra.Command { - const template = "<>" - opts := getExportBucketOpts{} cmd := &cobra.Command{ - Use: "getExportBucket", + Use: "getExportBucket", Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -959,18 +1040,21 @@ func getExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") return cmd } + type getReplicaSetBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *getReplicaSetBackupOpts) initClient() func() error { @@ -981,38 +1065,32 @@ func (opts *getReplicaSetBackupOpts) initClient() func() error { } } -func (opts *getReplicaSetBackupOpts) Run(ctx context.Context) error { +func (opts *getReplicaSetBackupOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetReplicaSetBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getReplicaSetBackupBuilder() *cobra.Command { - const template = "<>" - opts := getReplicaSetBackupOpts{} cmd := &cobra.Command{ - Use: "getReplicaSetBackup", + Use: "getReplicaSetBackup", Short: "Return One Replica Set Cloud Backup", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1021,19 +1099,22 @@ func getReplicaSetBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } + type getServerlessBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *getServerlessBackupOpts) initClient() func() error { @@ -1044,38 +1125,32 @@ func (opts *getServerlessBackupOpts) initClient() func() error { } } -func (opts *getServerlessBackupOpts) Run(ctx context.Context) error { +func (opts *getServerlessBackupOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetServerlessBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getServerlessBackupBuilder() *cobra.Command { - const template = "<>" - opts := getServerlessBackupOpts{} cmd := &cobra.Command{ - Use: "getServerlessBackup", + Use: "getServerlessBackup", Short: "Return One Snapshot of One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1084,18 +1159,21 @@ func getServerlessBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } + type getServerlessBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string restoreJobId string } @@ -1107,10 +1185,10 @@ func (opts *getServerlessBackupRestoreJobOpts) initClient() func() error { } } -func (opts *getServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *getServerlessBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetServerlessBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params).Execute() @@ -1118,27 +1196,21 @@ func (opts *getServerlessBackupRestoreJobOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getServerlessBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - opts := getServerlessBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getServerlessBackupRestoreJob", + Use: "getServerlessBackupRestoreJob", Short: "Return One Restore Job for One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1147,19 +1219,22 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd } + type getShardedClusterBackupOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *getShardedClusterBackupOpts) initClient() func() error { @@ -1170,38 +1245,32 @@ func (opts *getShardedClusterBackupOpts) initClient() func() error { } } -func (opts *getShardedClusterBackupOpts) Run(ctx context.Context) error { +func (opts *getShardedClusterBackupOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetShardedClusterBackupApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getShardedClusterBackupBuilder() *cobra.Command { - const template = "<>" - opts := getShardedClusterBackupOpts{} cmd := &cobra.Command{ - Use: "getShardedClusterBackup", + Use: "getShardedClusterBackup", Short: "Return One Sharded Cluster Cloud Backup", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1210,21 +1279,24 @@ func getShardedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } + type listBackupExportJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listBackupExportJobsOpts) initClient() func() error { @@ -1235,40 +1307,34 @@ func (opts *listBackupExportJobsOpts) initClient() func() error { } } -func (opts *listBackupExportJobsOpts) Run(ctx context.Context) error { +func (opts *listBackupExportJobsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListBackupExportJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listBackupExportJobsBuilder() *cobra.Command { - const template = "<>" - opts := listBackupExportJobsOpts{} cmd := &cobra.Command{ - Use: "listBackupExportJobs", + Use: "listBackupExportJobs", Short: "Return All Cloud Backup Snapshot Export Jobs", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1279,20 +1345,23 @@ func listBackupExportJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listBackupRestoreJobsOpts) initClient() func() error { @@ -1303,40 +1372,34 @@ func (opts *listBackupRestoreJobsOpts) initClient() func() error { } } -func (opts *listBackupRestoreJobsOpts) Run(ctx context.Context) error { +func (opts *listBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listBackupRestoreJobsBuilder() *cobra.Command { - const template = "<>" - opts := listBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listBackupRestoreJobs", + Use: "listBackupRestoreJobs", Short: "Return All Restore Jobs for One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1347,19 +1410,22 @@ func listBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listExportBucketsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listExportBucketsOpts) initClient() func() error { @@ -1370,39 +1436,33 @@ func (opts *listExportBucketsOpts) initClient() func() error { } } -func (opts *listExportBucketsOpts) Run(ctx context.Context) error { +func (opts *listExportBucketsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListExportBucketsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listExportBucketsBuilder() *cobra.Command { - const template = "<>" - opts := listExportBucketsOpts{} cmd := &cobra.Command{ - Use: "listExportBuckets", + Use: "listExportBuckets", Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1412,19 +1472,22 @@ func listExportBucketsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type listReplicaSetBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listReplicaSetBackupsOpts) initClient() func() error { @@ -1435,40 +1498,34 @@ func (opts *listReplicaSetBackupsOpts) initClient() func() error { } } -func (opts *listReplicaSetBackupsOpts) Run(ctx context.Context) error { +func (opts *listReplicaSetBackupsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListReplicaSetBackupsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listReplicaSetBackupsBuilder() *cobra.Command { - const template = "<>" - opts := listReplicaSetBackupsOpts{} cmd := &cobra.Command{ - Use: "listReplicaSetBackups", + Use: "listReplicaSetBackups", Short: "Return All Replica Set Cloud Backups", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1479,20 +1536,23 @@ func listReplicaSetBackupsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listServerlessBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listServerlessBackupRestoreJobsOpts) initClient() func() error { @@ -1503,40 +1563,34 @@ func (opts *listServerlessBackupRestoreJobsOpts) initClient() func() error { } } -func (opts *listServerlessBackupRestoreJobsOpts) Run(ctx context.Context) error { +func (opts *listServerlessBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListServerlessBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listServerlessBackupRestoreJobsBuilder() *cobra.Command { - const template = "<>" - opts := listServerlessBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listServerlessBackupRestoreJobs", + Use: "listServerlessBackupRestoreJobs", Short: "Return All Restore Jobs for One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1547,20 +1601,23 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listServerlessBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listServerlessBackupsOpts) initClient() func() error { @@ -1571,40 +1628,34 @@ func (opts *listServerlessBackupsOpts) initClient() func() error { } } -func (opts *listServerlessBackupsOpts) Run(ctx context.Context) error { +func (opts *listServerlessBackupsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListServerlessBackupsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listServerlessBackupsBuilder() *cobra.Command { - const template = "<>" - opts := listServerlessBackupsOpts{} cmd := &cobra.Command{ - Use: "listServerlessBackups", + Use: "listServerlessBackups", Short: "Return All Snapshots of One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1615,16 +1666,19 @@ func listServerlessBackupsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listShardedClusterBackupsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -1636,9 +1690,9 @@ func (opts *listShardedClusterBackupsOpts) initClient() func() error { } } -func (opts *listShardedClusterBackupsOpts) Run(ctx context.Context) error { +func (opts *listShardedClusterBackupsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListShardedClusterBackupsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params).Execute() @@ -1646,27 +1700,21 @@ func (opts *listShardedClusterBackupsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listShardedClusterBackupsBuilder() *cobra.Command { - const template = "<>" - opts := listShardedClusterBackupsOpts{} cmd := &cobra.Command{ - Use: "listShardedClusterBackups", + Use: "listShardedClusterBackups", Short: "Return All Sharded Cluster Cloud Backups", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1674,18 +1722,23 @@ func listShardedClusterBackupsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type takeSnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *takeSnapshotOpts) initClient() func() error { @@ -1696,64 +1749,91 @@ func (opts *takeSnapshotOpts) initClient() func() error { } } -func (opts *takeSnapshotOpts) Run(ctx context.Context) error { +func (opts *takeSnapshotOpts) readData() (*admin.DiskBackupOnDemandSnapshotRequest, error) { + var out *admin.DiskBackupOnDemandSnapshotRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *takeSnapshotOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.TakeSnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + DiskBackupOnDemandSnapshotRequest: data, } resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func takeSnapshotBuilder() *cobra.Command { - const template = "<>" - - opts := takeSnapshotOpts{} + opts := takeSnapshotOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "takeSnapshot", + Use: "takeSnapshot", Short: "Take One On-Demand Snapshot", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - - cmd.Flags().StringVar(&opts.description, "description", "", `Human-readable phrase or sentence that explains the purpose of the snapshot. The resource returns this parameter when `"status" : "onDemand"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.retentionInDays, "retentionInDays", 000, `Number of days that MongoDB Cloud should retain the on-demand snapshot. Must be at least **1**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type updateBackupScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *updateBackupScheduleOpts) initClient() func() error { @@ -1764,85 +1844,112 @@ func (opts *updateBackupScheduleOpts) initClient() func() error { } } -func (opts *updateBackupScheduleOpts) Run(ctx context.Context) error { +func (opts *updateBackupScheduleOpts) readData() (*admin.DiskBackupSnapshotSchedule, error) { + var out *admin.DiskBackupSnapshotSchedule + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateBackupScheduleOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateBackupScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + DiskBackupSnapshotSchedule: data, } resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateBackupScheduleBuilder() *cobra.Command { - const template = "<>" - - opts := updateBackupScheduleOpts{} + opts := updateBackupScheduleOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateBackupSchedule", + Use: "updateBackupSchedule", Short: "Update Cloud Backup Schedule for One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - - cmd.Flags().BoolVar(&opts.autoExportEnabled, "autoExportEnabled", false, `Flag that indicates whether MongoDB Cloud automatically exports cloud backup snapshots to the AWS bucket.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterId, "clusterId", "", `Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.copySettings, "copySettings", nil, `List that contains a document for each copy setting item in the desired backup policy.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.deleteCopiedBackups, "deleteCopiedBackups", nil, `List that contains a document for each deleted copy setting whose backup copies you want to delete.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().AutoExportPolicyVar(&opts.export, "export", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.nextSnapshot, "nextSnapshot", "", `Date and time when MongoDB Cloud takes the next snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.policies, "policies", nil, `Rules set for this backup schedule.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.referenceHourOfDay, "referenceHourOfDay", 000, `Hour of day in Coordinated Universal Time (UTC) that represents when MongoDB Cloud takes the snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.referenceMinuteOfHour, "referenceMinuteOfHour", 000, `Minute of the **referenceHourOfDay** that represents when MongoDB Cloud takes the snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.restoreWindowDays, "restoreWindowDays", 000, `Number of previous days that you can restore back to with Continuous Cloud Backup accuracy. You must specify a positive, non-zero integer. This parameter applies to continuous cloud backups only.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.updateSnapshots, "updateSnapshots", false, `Flag that indicates whether to apply the retention changes in the updated backup policy to snapshots that MongoDB Cloud took previously.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.useOrgAndGroupNamesInExportPrefix, "useOrgAndGroupNamesInExportPrefix", false, `Flag that indicates whether to use organization and project names instead of organization and project UUIDs in the path to the metadata files that MongoDB Cloud uploads to your AWS bucket.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type updateDataProtectionSettingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *updateDataProtectionSettingsOpts) initClient() func() error { @@ -1853,78 +1960,105 @@ func (opts *updateDataProtectionSettingsOpts) initClient() func() error { } } -func (opts *updateDataProtectionSettingsOpts) Run(ctx context.Context) error { +func (opts *updateDataProtectionSettingsOpts) readData() (*admin.DataProtectionSettings, error) { + var out *admin.DataProtectionSettings + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateDataProtectionSettingsOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, - + + DataProtectionSettings: data, } resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateDataProtectionSettingsBuilder() *cobra.Command { - const template = "<>" - - opts := updateDataProtectionSettingsOpts{} + opts := updateDataProtectionSettingsOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateDataProtectionSettings", + Use: "updateDataProtectionSettings", Short: "Update or enable the Backup Compliance Policy settings", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts.authorizedEmail, "authorizedEmail", "", `Email address of the user who authorized to updated the Backup Compliance Policy settings.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.copyProtectionEnabled, "copyProtectionEnabled", false, `Flag that indicates whether to enable additional backup copies for the cluster. If unspecified, this value defaults to false.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.encryptionAtRestEnabled, "encryptionAtRestEnabled", false, `Flag that indicates whether Encryption at Rest using Customer Key Management is required for all clusters with a Backup Compliance Policy. If unspecified, this value defaults to false.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().PolicyItemVar(&opts.onDemandPolicyItem, "onDemandPolicyItem", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.pitEnabled, "pitEnabled", false, `Flag that indicates whether the cluster uses Continuous Cloud Backups with a Backup Compliance Policy. If unspecified, this value defaults to false.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.projectId, "projectId", "", `Unique 24-hexadecimal digit string that identifies the project for the Backup Compliance Policy.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.restoreWindowDays, "restoreWindowDays", 000, `Number of previous days that you can restore back to with Continuous Cloud Backup with a Backup Compliance Policy. You must specify a positive, non-zero integer, and the maximum retention window can't exceed the hourly retention time. This parameter applies only to Continuous Cloud Backups with a Backup Compliance Policy.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.scheduledPolicyItems, "scheduledPolicyItems", nil, `List that contains the specifications for one scheduled policy.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.state, "state", "", `Label that indicates the state of the Backup Compliance Policy settings. MongoDB Cloud ignores this setting when you enable or update the Backup Compliance Policy settings.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.updatedDate, "updatedDate", "", `ISO 8601 timestamp format in UTC that indicates when the user updated the Data Protection Policy settings. MongoDB Cloud ignores this setting when you enable or update the Backup Compliance Policy settings.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.updatedUser, "updatedUser", "", `Email address that identifies the user who updated the Backup Compliance Policy settings. MongoDB Cloud ignores this email setting when you enable or update the Backup Compliance Policy settings.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type updateSnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string - + snapshotId string + + filename string + fs afero.Fs } func (opts *updateSnapshotRetentionOpts) initClient() func() error { @@ -1935,39 +2069,62 @@ func (opts *updateSnapshotRetentionOpts) initClient() func() error { } } -func (opts *updateSnapshotRetentionOpts) Run(ctx context.Context) error { +func (opts *updateSnapshotRetentionOpts) readData() (*admin.SnapshotRetention, error) { + var out *admin.SnapshotRetention + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateSnapshotRetentionOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateSnapshotRetentionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, - + SnapshotId: opts.snapshotId, + + SnapshotRetention: data, } resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateSnapshotRetentionBuilder() *cobra.Command { - const template = "<>" - - opts := updateSnapshotRetentionOpts{} + opts := updateSnapshotRetentionOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateSnapshotRetention", + Use: "updateSnapshotRetention", Short: "Change Expiration Date for One Cloud Backup", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1975,14 +2132,15 @@ func updateSnapshotRetentionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.retentionUnit, "retentionUnit", "", `Quantity of time in which MongoDB Cloud measures snapshot retention.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.retentionValue, "retentionValue", 000, `Number that indicates the amount of days, weeks, or months that MongoDB Cloud retains the snapshot. For less frequent policy items, MongoDB Cloud requires that you specify a value greater than or equal to the value specified for more frequent policy items. If the hourly policy item specifies a retention of two days, specify two days or greater for the retention of the weekly policy item.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1992,8 +2150,8 @@ func updateSnapshotRetentionBuilder() *cobra.Command { func cloudBackupsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "cloudBackups", - Short: `Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.`, + Use: "cloudBackups", + Short: `Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.`, } cmd.AddCommand( cancelBackupRestoreJobBuilder(), @@ -2028,4 +2186,3 @@ func cloudBackupsBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/generated/api_cloud_migration_service_cmd.go index 885bc47575..8399da769d 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/generated/api_cloud_migration_service_cmd.go @@ -18,20 +18,28 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string + + filename string + fs afero.Fs } func (opts *createLinkTokenOpts) initClient() func() error { @@ -42,54 +50,81 @@ func (opts *createLinkTokenOpts) initClient() func() error { } } -func (opts *createLinkTokenOpts) Run(ctx context.Context) error { +func (opts *createLinkTokenOpts) readData() (*admin.TargetOrgRequest, error) { + var out *admin.TargetOrgRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createLinkTokenOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, - + + TargetOrgRequest: data, } resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createLinkTokenBuilder() *cobra.Command { - const template = "<>" - - opts := createLinkTokenOpts{} + opts := createLinkTokenOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createLinkToken", + Use: "createLinkToken", Short: "Create One Link-Token", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - - cmd.Flags().ArraySliceVar(&opts.accessListIps, "accessListIps", nil, `IP address access list entries associated with the API key.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type createPushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *createPushMigrationOpts) initClient() func() error { @@ -100,63 +135,88 @@ func (opts *createPushMigrationOpts) initClient() func() error { } } -func (opts *createPushMigrationOpts) Run(ctx context.Context) error { +func (opts *createPushMigrationOpts) readData() (*admin.LiveMigrationRequest, error) { + var out *admin.LiveMigrationRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createPushMigrationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, - + + LiveMigrationRequest: data, } resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createPushMigrationBuilder() *cobra.Command { - const template = "<>" - - opts := createPushMigrationOpts{} + opts := createPushMigrationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createPushMigration", + Use: "createPushMigration", Short: "Migrate One Local Managed Cluster to MongoDB Atlas", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the migration request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().DestinationVar(&opts.destination, "destination", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.dropEnabled, "dropEnabled", false, `Flag that indicates whether the migration process drops all collections from the destination cluster before the migration starts.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.migrationHosts, "migrationHosts", nil, `List of migration hosts used for this migration.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SourceVar(&opts.source, "source", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type cutoverMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string liveMigrationId string } @@ -168,9 +228,9 @@ func (opts *cutoverMigrationOpts) initClient() func() error { } } -func (opts *cutoverMigrationOpts) Run(ctx context.Context) error { +func (opts *cutoverMigrationOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.CutoverMigrationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params).Execute() @@ -178,27 +238,21 @@ func (opts *cutoverMigrationOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func cutoverMigrationBuilder() *cobra.Command { - const template = "<>" - opts := cutoverMigrationOpts{} cmd := &cobra.Command{ - Use: "cutoverMigration", + Use: "cutoverMigration", Short: "Cut Over the Migrated Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -206,16 +260,19 @@ func cutoverMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } + type deleteLinkTokenOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *deleteLinkTokenOpts) initClient() func() error { @@ -226,7 +283,7 @@ func (opts *deleteLinkTokenOpts) initClient() func() error { } } -func (opts *deleteLinkTokenOpts) Run(ctx context.Context) error { +func (opts *deleteLinkTokenOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, } @@ -235,40 +292,37 @@ func (opts *deleteLinkTokenOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteLinkTokenBuilder() *cobra.Command { - const template = "<>" - opts := deleteLinkTokenOpts{} cmd := &cobra.Command{ - Use: "deleteLinkToken", + Use: "deleteLinkToken", Short: "Remove One Link-Token", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type getPushMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string liveMigrationId string } @@ -280,9 +334,9 @@ func (opts *getPushMigrationOpts) initClient() func() error { } } -func (opts *getPushMigrationOpts) Run(ctx context.Context) error { +func (opts *getPushMigrationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetPushMigrationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } resp, _, err := opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params).Execute() @@ -290,27 +344,21 @@ func (opts *getPushMigrationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getPushMigrationBuilder() *cobra.Command { - const template = "<>" - opts := getPushMigrationOpts{} cmd := &cobra.Command{ - Use: "getPushMigration", + Use: "getPushMigration", Short: "Return One Migration Job", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -318,16 +366,19 @@ func getPushMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } + type getValidationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string validationId string } @@ -339,9 +390,9 @@ func (opts *getValidationStatusOpts) initClient() func() error { } } -func (opts *getValidationStatusOpts) Run(ctx context.Context) error { +func (opts *getValidationStatusOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetValidationStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ValidationId: opts.validationId, } resp, _, err := opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params).Execute() @@ -349,27 +400,21 @@ func (opts *getValidationStatusOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getValidationStatusBuilder() *cobra.Command { - const template = "<>" - opts := getValidationStatusOpts{} cmd := &cobra.Command{ - Use: "getValidationStatus", + Use: "getValidationStatus", Short: "Return One Migration Validation Job", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -377,16 +422,19 @@ func getValidationStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("validationId") return cmd } + type listSourceProjectsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *listSourceProjectsOpts) initClient() func() error { @@ -397,7 +445,7 @@ func (opts *listSourceProjectsOpts) initClient() func() error { } } -func (opts *listSourceProjectsOpts) Run(ctx context.Context) error { +func (opts *listSourceProjectsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, } @@ -406,41 +454,40 @@ func (opts *listSourceProjectsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listSourceProjectsBuilder() *cobra.Command { - const template = "<>" - opts := listSourceProjectsOpts{} cmd := &cobra.Command{ - Use: "listSourceProjects", + Use: "listSourceProjects", Short: "Return All Projects Available for Migration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type validateMigrationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *validateMigrationOpts) initClient() func() error { @@ -451,54 +498,78 @@ func (opts *validateMigrationOpts) initClient() func() error { } } -func (opts *validateMigrationOpts) Run(ctx context.Context) error { +func (opts *validateMigrationOpts) readData() (*admin.LiveMigrationRequest, error) { + var out *admin.LiveMigrationRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *validateMigrationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, - + + LiveMigrationRequest: data, } resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func validateMigrationBuilder() *cobra.Command { - const template = "<>" - - opts := validateMigrationOpts{} + opts := validateMigrationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "validateMigration", + Use: "validateMigration", Short: "Validate One Migration Request", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the migration request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().DestinationVar(&opts.destination, "destination", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.dropEnabled, "dropEnabled", false, `Flag that indicates whether the migration process drops all collections from the destination cluster before the migration starts.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.migrationHosts, "migrationHosts", nil, `List of migration hosts used for this migration.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SourceVar(&opts.source, "source", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -506,8 +577,8 @@ func validateMigrationBuilder() *cobra.Command { func cloudMigrationServiceBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "cloudMigrationService", - Short: `Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.`, + Use: "cloudMigrationService", + Short: `Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.`, } cmd.AddCommand( createLinkTokenBuilder(), @@ -521,4 +592,3 @@ func cloudMigrationServiceBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/generated/api_cloud_provider_access_cmd.go index b39cdcbdd0..17e070b176 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/generated/api_cloud_provider_access_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -30,6 +38,9 @@ type authorizeCloudProviderAccessRoleOpts struct { client *admin.APIClient groupId string roleId string + + filename string + fs afero.Fs } func (opts *authorizeCloudProviderAccessRoleOpts) initClient() func() error { @@ -40,37 +51,61 @@ func (opts *authorizeCloudProviderAccessRoleOpts) initClient() func() error { } } -func (opts *authorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error { +func (opts *authorizeCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderAccessRole, error) { + var out *admin.CloudProviderAccessRole + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *authorizeCloudProviderAccessRoleOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.AuthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, RoleId: opts.roleId, + + CloudProviderAccessRole: data, } resp, _, err := opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { - const template = "<>" - - opts := authorizeCloudProviderAccessRoleOpts{} + opts := authorizeCloudProviderAccessRoleOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "authorizeCloudProviderAccessRole", Short: "Authorize One Cloud Provider Access Role", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -78,6 +113,9 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") return cmd @@ -88,6 +126,9 @@ type createCloudProviderAccessRoleOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *createCloudProviderAccessRoleOpts) initClient() func() error { @@ -98,42 +139,69 @@ func (opts *createCloudProviderAccessRoleOpts) initClient() func() error { } } -func (opts *createCloudProviderAccessRoleOpts) Run(ctx context.Context) error { +func (opts *createCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderAccessRole, error) { + var out *admin.CloudProviderAccessRole + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createCloudProviderAccessRoleOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, + + CloudProviderAccessRole: data, } resp, _, err := opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createCloudProviderAccessRoleBuilder() *cobra.Command { - const template = "<>" - - opts := createCloudProviderAccessRoleOpts{} + opts := createCloudProviderAccessRoleOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createCloudProviderAccessRole", Short: "Create One Cloud Provider Access Role", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -155,7 +223,7 @@ func (opts *deauthorizeCloudProviderAccessRoleOpts) initClient() func() error { } } -func (opts *deauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) error { +func (opts *deauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DeauthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, @@ -166,27 +234,21 @@ func (opts *deauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context) err return err } - return opts.Print(nil) + return nil } func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { - const template = "<>" - opts := deauthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ Use: "deauthorizeCloudProviderAccessRole", Short: "Deauthorize One Cloud Provider Access Role", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -195,6 +257,9 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider of the role to deauthorize.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("roleId") @@ -217,7 +282,7 @@ func (opts *getCloudProviderAccessRoleOpts) initClient() func() error { } } -func (opts *getCloudProviderAccessRoleOpts) Run(ctx context.Context) error { +func (opts *getCloudProviderAccessRoleOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, RoleId: opts.roleId, @@ -227,27 +292,21 @@ func (opts *getCloudProviderAccessRoleOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getCloudProviderAccessRoleBuilder() *cobra.Command { - const template = "<>" - opts := getCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ Use: "getCloudProviderAccessRole", Short: "Return specified Cloud Provider Access Role", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -255,6 +314,9 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") return cmd @@ -275,7 +337,7 @@ func (opts *listCloudProviderAccessRolesOpts) initClient() func() error { } } -func (opts *listCloudProviderAccessRolesOpts) Run(ctx context.Context) error { +func (opts *listCloudProviderAccessRolesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, } @@ -284,33 +346,30 @@ func (opts *listCloudProviderAccessRolesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listCloudProviderAccessRolesBuilder() *cobra.Command { - const template = "<>" - opts := listCloudProviderAccessRolesOpts{} cmd := &cobra.Command{ Use: "listCloudProviderAccessRoles", Short: "Return All Cloud Provider Access Roles", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/generated/api_cluster_outage_simulation_cmd.go index 602a4e47e0..23a941374d 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/generated/api_cluster_outage_simulation_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -40,7 +48,7 @@ func (opts *endOutageSimulationOpts) initClient() func() error { } } -func (opts *endOutageSimulationOpts) Run(ctx context.Context) error { +func (opts *endOutageSimulationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.EndOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -50,27 +58,21 @@ func (opts *endOutageSimulationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func endOutageSimulationBuilder() *cobra.Command { - const template = "<>" - opts := endOutageSimulationOpts{} cmd := &cobra.Command{ Use: "endOutageSimulation", Short: "End an Outage Simulation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -78,6 +80,9 @@ func endOutageSimulationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -99,7 +104,7 @@ func (opts *getOutageSimulationOpts) initClient() func() error { } } -func (opts *getOutageSimulationOpts) Run(ctx context.Context) error { +func (opts *getOutageSimulationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -109,27 +114,21 @@ func (opts *getOutageSimulationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getOutageSimulationBuilder() *cobra.Command { - const template = "<>" - opts := getOutageSimulationOpts{} cmd := &cobra.Command{ Use: "getOutageSimulation", Short: "Return One Outage Simulation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -137,6 +136,9 @@ func getOutageSimulationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -148,6 +150,9 @@ type startOutageSimulationOpts struct { client *admin.APIClient groupId string clusterName string + + filename string + fs afero.Fs } func (opts *startOutageSimulationOpts) initClient() func() error { @@ -158,37 +163,61 @@ func (opts *startOutageSimulationOpts) initClient() func() error { } } -func (opts *startOutageSimulationOpts) Run(ctx context.Context) error { +func (opts *startOutageSimulationOpts) readData() (*admin.ClusterOutageSimulation, error) { + var out *admin.ClusterOutageSimulation + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *startOutageSimulationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.StartOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, + + ClusterOutageSimulation: data, } resp, _, err := opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func startOutageSimulationBuilder() *cobra.Command { - const template = "<>" - - opts := startOutageSimulationOpts{} + opts := startOutageSimulationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "startOutageSimulation", Short: "Start an Outage Simulation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -196,26 +225,20 @@ func startOutageSimulationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to undergo an outage simulation.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that undergoes outage simulation.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project that contains the cluster to undergo outage simulation.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal character string that identifies the outage simulation.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.outageFilters, "outageFilters", nil, `List of settings that specify the type of cluster outage simulation.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.startRequestDate, "startRequestDate", "", `Date and time when MongoDB Cloud started the regional outage simulation.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.state, "state", "", `Phase of the outage simulation. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -| State | Indication | -|-------------|------------| -| `START_REQUESTED` | User has requested cluster outage simulation.| -| `STARTING` | MongoDB Cloud is starting cluster outage simulation.| -| `SIMULATING` | MongoDB Cloud is simulating cluster outage.| -| `RECOVERY_REQUESTED` | User has requested recovery from the simulated outage.| -| `RECOVERING` | MongoDB Cloud is recovering the cluster from the simulated outage.| -| `COMPLETE` | MongoDB Cloud has completed the cluster outage simulation.|`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/generated/api_clusters_cmd.go b/internal/generated/api_clusters_cmd.go index 33236bdeec..a33f3f5707 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/generated/api_clusters_cmd.go @@ -18,19 +18,25 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type getClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -42,9 +48,9 @@ func (opts *getClusterAdvancedConfigurationOpts) initClient() func() error { } } -func (opts *getClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { +func (opts *getClusterAdvancedConfigurationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetClusterAdvancedConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params).Execute() @@ -52,27 +58,21 @@ func (opts *getClusterAdvancedConfigurationOpts) Run(ctx context.Context) error return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getClusterAdvancedConfigurationBuilder() *cobra.Command { - const template = "<>" - opts := getClusterAdvancedConfigurationOpts{} cmd := &cobra.Command{ - Use: "getClusterAdvancedConfiguration", + Use: "getClusterAdvancedConfiguration", Short: "Return One Advanced Configuration Options for One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -80,16 +80,19 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type getClusterStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -101,9 +104,9 @@ func (opts *getClusterStatusOpts) initClient() func() error { } } -func (opts *getClusterStatusOpts) Run(ctx context.Context) error { +func (opts *getClusterStatusOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetClusterStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params).Execute() @@ -111,27 +114,21 @@ func (opts *getClusterStatusOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getClusterStatusBuilder() *cobra.Command { - const template = "<>" - opts := getClusterStatusOpts{} cmd := &cobra.Command{ - Use: "getClusterStatus", + Use: "getClusterStatus", Short: "Return Status of All Cluster Operations", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -139,16 +136,19 @@ func getClusterStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type getSampleDatasetLoadStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string sampleDatasetId string } @@ -160,9 +160,9 @@ func (opts *getSampleDatasetLoadStatusOpts) initClient() func() error { } } -func (opts *getSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { +func (opts *getSampleDatasetLoadStatusOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetSampleDatasetLoadStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, SampleDatasetId: opts.sampleDatasetId, } resp, _, err := opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params).Execute() @@ -170,27 +170,21 @@ func (opts *getSampleDatasetLoadStatusOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getSampleDatasetLoadStatusBuilder() *cobra.Command { - const template = "<>" - opts := getSampleDatasetLoadStatusOpts{} cmd := &cobra.Command{ - Use: "getSampleDatasetLoadStatus", + Use: "getSampleDatasetLoadStatus", Short: "Check Status of Cluster Sample Dataset Request", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -198,21 +192,24 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("sampleDatasetId") return cmd } + type listCloudProviderRegionsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int - providers []string - tier string + pageNum int + providers []string + tier string } func (opts *listCloudProviderRegionsOpts) initClient() func() error { @@ -223,41 +220,35 @@ func (opts *listCloudProviderRegionsOpts) initClient() func() error { } } -func (opts *listCloudProviderRegionsOpts) Run(ctx context.Context) error { +func (opts *listCloudProviderRegionsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListCloudProviderRegionsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Providers: &opts.providers, - Tier: &opts.tier, + PageNum: &opts.pageNum, + Providers: &opts.providers, + Tier: &opts.tier, } resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listCloudProviderRegionsBuilder() *cobra.Command { - const template = "<>" - opts := listCloudProviderRegionsOpts{} cmd := &cobra.Command{ - Use: "listCloudProviderRegions", + Use: "listCloudProviderRegions", Short: "Return All Cloud Provider Regions", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -269,17 +260,20 @@ func listCloudProviderRegionsBuilder() *cobra.Command { cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, `Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.`) cmd.Flags().StringVar(&opts.tier, "tier", "", `Cluster tier for which to retrieve the regions.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type listClustersForAllProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listClustersForAllProjectsOpts) initClient() func() error { @@ -290,53 +284,50 @@ func (opts *listClustersForAllProjectsOpts) initClient() func() error { } } -func (opts *listClustersForAllProjectsOpts) Run(ctx context.Context) error { +func (opts *listClustersForAllProjectsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListClustersForAllProjectsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listClustersForAllProjectsBuilder() *cobra.Command { - const template = "<>" - opts := listClustersForAllProjectsOpts{} cmd := &cobra.Command{ - Use: "listClustersForAllProjects", + Use: "listClustersForAllProjects", Short: "Return All Authorized Clusters in All Projects", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } + type loadSampleDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } func (opts *loadSampleDatasetOpts) initClient() func() error { @@ -347,37 +338,31 @@ func (opts *loadSampleDatasetOpts) initClient() func() error { } } -func (opts *loadSampleDatasetOpts) Run(ctx context.Context) error { +func (opts *loadSampleDatasetOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func loadSampleDatasetBuilder() *cobra.Command { - const template = "<>" - opts := loadSampleDatasetOpts{} cmd := &cobra.Command{ - Use: "loadSampleDataset", + Use: "loadSampleDataset", Short: "Load Sample Dataset Request into Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -385,18 +370,23 @@ func loadSampleDatasetBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } + type updateClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *updateClusterAdvancedConfigurationOpts) initClient() func() error { @@ -407,81 +397,104 @@ func (opts *updateClusterAdvancedConfigurationOpts) initClient() func() error { } } -func (opts *updateClusterAdvancedConfigurationOpts) Run(ctx context.Context) error { +func (opts *updateClusterAdvancedConfigurationOpts) readData() (*admin.ClusterDescriptionProcessArgs, error) { + var out *admin.ClusterDescriptionProcessArgs + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateClusterAdvancedConfigurationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateClusterAdvancedConfigurationApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + ClusterDescriptionProcessArgs: data, } resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateClusterAdvancedConfigurationBuilder() *cobra.Command { - const template = "<>" - - opts := updateClusterAdvancedConfigurationOpts{} + opts := updateClusterAdvancedConfigurationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateClusterAdvancedConfiguration", + Use: "updateClusterAdvancedConfiguration", Short: "Update Advanced Configuration Options for One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - - cmd.Flags().StringVar(&opts.defaultReadConcern, "defaultReadConcern", ""available"", `[Default level of acknowledgment requested from MongoDB for read operations](https://docs.mongodb.com/manual/reference/read-concern/) set for this cluster. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -MongoDB 4.4 clusters default to `available`. MongoDB 5.0 and later clusters default to `local`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.defaultWriteConcern, "defaultWriteConcern", ""1"", `[Default level of acknowledgment requested from MongoDB for write operations](https://docs.mongodb.com/manual/reference/write-concern/) set for this cluster. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -MongoDB 4.4 clusters default to `1`. MongoDB 5.0 and later clusters default to `majority`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.failIndexKeyTooLong, "failIndexKeyTooLong", true, `Flag that indicates whether you can insert or update documents where all indexed entries don't exceed 1024 bytes. If you set this to false, [mongod](https://docs.mongodb.com/upcoming/reference/program/mongod/#mongodb-binary-bin.mongod) writes documents that exceed this limit but doesn't index them.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.javascriptEnabled, "javascriptEnabled", true, `Flag that indicates whether the cluster allows execution of operations that perform server-side executions of JavaScript.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.minimumEnabledTlsProtocol, "minimumEnabledTlsProtocol", "", `Minimum Transport Layer Security (TLS) version that the cluster accepts for incoming connections. Clusters using TLS 1.0 or 1.1 should consider setting TLS 1.2 as the minimum TLS protocol version.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.noTableScan, "noTableScan", false, `Flag that indicates whether the cluster disables executing any query that requires a collection scan to return results.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Float64Var(&opts.oplogMinRetentionHours, "oplogMinRetentionHours", 00, `Minimum retention window for cluster's oplog expressed in hours. A value of null indicates that the cluster uses the default minimum oplog window that MongoDB Cloud calculates.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.oplogSizeMB, "oplogSizeMB", 000, `Storage limit of cluster's oplog expressed in megabytes. A value of null indicates that the cluster uses the default oplog size that MongoDB Cloud calculates.`) - - cmd.Flags().IntVar(&opts.sampleRefreshIntervalBIConnector, "sampleRefreshIntervalBIConnector", 0, `Interval in seconds at which the mongosqld process re-samples data to create its relational schema.`) - - cmd.Flags().IntVar(&opts.sampleSizeBIConnector, "sampleSizeBIConnector", 1000, `Number of documents per database to sample when gathering schema information.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type upgradeSharedClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *upgradeSharedClusterOpts) initClient() func() error { @@ -492,121 +505,145 @@ func (opts *upgradeSharedClusterOpts) initClient() func() error { } } -func (opts *upgradeSharedClusterOpts) Run(ctx context.Context) error { +func (opts *upgradeSharedClusterOpts) readData() (*admin.LegacyClusterDescription, error) { + var out *admin.LegacyClusterDescription + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *upgradeSharedClusterOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, - + + LegacyClusterDescription: data, } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func upgradeSharedClusterBuilder() *cobra.Command { - const template = "<>" - - opts := upgradeSharedClusterOpts{} + opts := upgradeSharedClusterOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "upgradeSharedCluster", + Use: "upgradeSharedCluster", Short: "Upgrade One Shared-tier Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - - cmd.Flags().AutoScalingVar(&opts.autoScaling, "autoScaling", , ``) - cmd.Flags().BoolVar(&opts.backupEnabled, "backupEnabled", false, `Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated clusters and Shared Cluster Backups for tenant clusters. If set to `false`, the cluster doesn't use MongoDB Cloud backups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BiConnectorVar(&opts.biConnector, "biConnector", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterType, "clusterType", "", `Configuration of nodes that comprise the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ClusterDescriptionConnectionStringsVar(&opts.connectionStrings, "connectionStrings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.createDate, "createDate", "", `Date and time when MongoDB Cloud created this serverless instance. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Float64Var(&opts.diskSizeGB, "diskSizeGB", 00, `Storage capacity that the host's root volume possesses expressed in gigabytes. Increase this number to add capacity. MongoDB Cloud requires this parameter if you set **replicationSpecs**. If you specify a disk size below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations depend on whether you choose the default value or a custom value. The maximum value for disk storage cannot exceed 50 times the maximum RAM for the selected cluster. If you require more storage space, consider upgrading your cluster to a higher tier.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.encryptionAtRestProvider, "encryptionAtRestProvider", "", `Cloud service provider that manages your customer keys to provide an additional layer of Encryption at Rest for the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoDBMajorVersion, "mongoDBMajorVersion", ""6.0"", `Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoDBVersion, "mongoDBVersion", "", `Version of MongoDB that the cluster runs.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoURI, "mongoURI", "", `Base connection string that you can use to connect to the cluster. MongoDB Cloud displays the string only after the cluster starts, not while it builds the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoURIUpdated, "mongoURIUpdated", "", `Date and time when someone last updated the connection string. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoURIWithOptions, "mongoURIWithOptions", "", `Connection string that you can use to connect to the cluster including the `replicaSet`, `ssl`, and `authSource` query parameters with values appropriate for the cluster. You may need to add MongoDB database users. The response returns this parameter once the cluster can receive requests, not while it builds the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.numShards, "numShards", 1, `Number of shards up to 50 to deploy for a sharded cluster. The resource returns `1` to indicate a replica set and values of `2` and higher to indicate a sharded cluster. The returned value equals the number of shards in the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether the cluster is paused.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.pitEnabled, "pitEnabled", false, `Flag that indicates whether the cluster uses continuous cloud backups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.providerBackupEnabled, "providerBackupEnabled", false, `Flag that indicates whether the M10 or higher cluster can perform Cloud Backups. If set to `true`, the cluster can perform backups. If this and **backupEnabled** are set to `false`, the cluster doesn't use MongoDB Cloud backups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ClusterProviderSettingsVar(&opts.providerSettings, "providerSettings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.replicationFactor, "replicationFactor", 3, `Number of members that belong to the replica set. Each member retains a copy of your databases, providing high availability and data redundancy. Use **replicationSpecs** instead.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Map[string]RegionSpecVar(&opts.replicationSpec, "replicationSpec", , `Physical location where MongoDB Cloud provisions cluster nodes.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.replicationSpecs, "replicationSpecs", nil, `List of settings that configure your cluster regions. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- For Global Clusters, each object in the array represents one zone where MongoDB Cloud deploys your clusters nodes. -- For non-Global sharded clusters and replica sets, the single object represents where MongoDB Cloud deploys your clusters nodes.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.rootCertType, "rootCertType", ""ISRGROOTX1"", `Root Certificate Authority that MongoDB Atlas clusters uses. MongoDB Cloud supports Internet Security Research Group.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.srvAddress, "srvAddress", "", `Connection string that you can use to connect to the cluster. The `+srv` modifier forces the connection to use Transport Layer Security (TLS). The `mongoURI` parameter lists additional options.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.tags, "tags", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the cluster. If set to `true`, MongoDB Cloud won't delete the cluster. If set to `false`, MongoDB Cloud will delete the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.versionReleaseSystem, "versionReleaseSystem", ""LTS"", `Method by which the cluster maintains the MongoDB versions. If value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type upgradeSharedClusterToServerlessOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *upgradeSharedClusterToServerlessOpts) initClient() func() error { @@ -617,68 +654,92 @@ func (opts *upgradeSharedClusterToServerlessOpts) initClient() func() error { } } -func (opts *upgradeSharedClusterToServerlessOpts) Run(ctx context.Context) error { +func (opts *upgradeSharedClusterToServerlessOpts) readData() (*admin.ServerlessInstanceDescription, error) { + var out *admin.ServerlessInstanceDescription + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *upgradeSharedClusterToServerlessOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, - + + ServerlessInstanceDescription: data, } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func upgradeSharedClusterToServerlessBuilder() *cobra.Command { - const template = "<>" - - opts := upgradeSharedClusterToServerlessOpts{} + opts := upgradeSharedClusterToServerlessOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "upgradeSharedClusterToServerless", + Use: "upgradeSharedClusterToServerless", Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().ServerlessInstanceDescriptionConnectionStringsVar(&opts.connectionStrings, "connectionStrings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.createDate, "createDate", "", `Date and time when MongoDB Cloud created this serverless instance. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the serverless instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoDBVersion, "mongoDBVersion", "", `Version of MongoDB that the serverless instance runs.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ServerlessProviderSettingsVar(&opts.providerSettings, "providerSettings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ServerlessBackupOptionsVar(&opts.serverlessBackupOptions, "serverlessBackupOptions", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of the serverless instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.tags, "tags", nil, ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the serverless instance. If set to `true`, MongoDB Cloud won't delete the serverless instance. If set to `false`, MongoDB Cloud will delete the serverless instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -686,8 +747,8 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { func clustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "clusters", - Short: `Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.`, + Use: "clusters", + Short: `Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.`, } cmd.AddCommand( getClusterAdvancedConfigurationBuilder(), @@ -702,4 +763,3 @@ func clustersBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/generated/api_custom_database_roles_cmd.go index 7cfcb3604a..51975adb70 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/generated/api_custom_database_roles_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -29,6 +37,9 @@ type createCustomDatabaseRoleOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *createCustomDatabaseRoleOpts) initClient() func() error { @@ -39,47 +50,74 @@ func (opts *createCustomDatabaseRoleOpts) initClient() func() error { } } -func (opts *createCustomDatabaseRoleOpts) Run(ctx context.Context) error { +func (opts *createCustomDatabaseRoleOpts) readData() (*admin.CustomDBRole, error) { + var out *admin.CustomDBRole + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createCustomDatabaseRoleOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, + + CustomDBRole: data, } resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createCustomDatabaseRoleBuilder() *cobra.Command { - const template = "<>" - - opts := createCustomDatabaseRoleOpts{} + opts := createCustomDatabaseRoleOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createCustomDatabaseRole", Short: "Create One Custom Role", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().ArraySliceVar(&opts.actions, "actions", nil, `List of the individual privilege actions that the role grants.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.inheritedRoles, "inheritedRoles", nil, `List of the built-in roles that this custom role inherits.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -101,7 +139,7 @@ func (opts *deleteCustomDatabaseRoleOpts) initClient() func() error { } } -func (opts *deleteCustomDatabaseRoleOpts) Run(ctx context.Context) error { +func (opts *deleteCustomDatabaseRoleOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, @@ -111,27 +149,21 @@ func (opts *deleteCustomDatabaseRoleOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func deleteCustomDatabaseRoleBuilder() *cobra.Command { - const template = "<>" - opts := deleteCustomDatabaseRoleOpts{} cmd := &cobra.Command{ Use: "deleteCustomDatabaseRole", Short: "Remove One Custom Role from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -139,6 +171,9 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd @@ -160,7 +195,7 @@ func (opts *getCustomDatabaseRoleOpts) initClient() func() error { } } -func (opts *getCustomDatabaseRoleOpts) Run(ctx context.Context) error { +func (opts *getCustomDatabaseRoleOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, @@ -170,27 +205,21 @@ func (opts *getCustomDatabaseRoleOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getCustomDatabaseRoleBuilder() *cobra.Command { - const template = "<>" - opts := getCustomDatabaseRoleOpts{} cmd := &cobra.Command{ Use: "getCustomDatabaseRole", Short: "Return One Custom Role in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -198,6 +227,9 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd @@ -218,7 +250,7 @@ func (opts *listCustomDatabaseRolesOpts) initClient() func() error { } } -func (opts *listCustomDatabaseRolesOpts) Run(ctx context.Context) error { +func (opts *listCustomDatabaseRolesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, } @@ -227,33 +259,30 @@ func (opts *listCustomDatabaseRolesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listCustomDatabaseRolesBuilder() *cobra.Command { - const template = "<>" - opts := listCustomDatabaseRolesOpts{} cmd := &cobra.Command{ Use: "listCustomDatabaseRoles", Short: "Return All Custom Roles in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -264,6 +293,9 @@ type updateCustomDatabaseRoleOpts struct { client *admin.APIClient groupId string roleName string + + filename string + fs afero.Fs } func (opts *updateCustomDatabaseRoleOpts) initClient() func() error { @@ -274,37 +306,61 @@ func (opts *updateCustomDatabaseRoleOpts) initClient() func() error { } } -func (opts *updateCustomDatabaseRoleOpts) Run(ctx context.Context) error { +func (opts *updateCustomDatabaseRoleOpts) readData() (*admin.UpdateCustomDBRole, error) { + var out *admin.UpdateCustomDBRole + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateCustomDatabaseRoleOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, + + UpdateCustomDBRole: data, } resp, _, err := opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateCustomDatabaseRoleBuilder() *cobra.Command { - const template = "<>" - - opts := updateCustomDatabaseRoleOpts{} + opts := updateCustomDatabaseRoleOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateCustomDatabaseRole", Short: "Update One Custom Role in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -312,9 +368,12 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.`) - cmd.Flags().ArraySliceVar(&opts.actions, "actions", nil, `List of the individual privilege actions that the role grants.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.inheritedRoles, "inheritedRoles", nil, `List of the built-in roles that this custom role inherits.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") diff --git a/internal/generated/api_data_federation_cmd.go b/internal/generated/api_data_federation_cmd.go index 90b8bcab07..ce293b9030 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/generated/api_data_federation_cmd.go @@ -18,20 +18,28 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *createDataFederationPrivateEndpointOpts) initClient() func() error { @@ -42,63 +50,90 @@ func (opts *createDataFederationPrivateEndpointOpts) initClient() func() error { } } -func (opts *createDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *createDataFederationPrivateEndpointOpts) readData() (*admin.PrivateNetworkEndpointIdEntry, error) { + var out *admin.PrivateNetworkEndpointIdEntry + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createDataFederationPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, - + + PrivateNetworkEndpointIdEntry: data, } resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createDataFederationPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - - opts := createDataFederationPrivateEndpointOpts{} + opts := createDataFederationPrivateEndpointOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createDataFederationPrivateEndpoint", + Use: "createDataFederationPrivateEndpoint", Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts.comment, "comment", "", `Human-readable string to associate with this private endpoint.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.provider, "provider", ""AWS"", `Human-readable label that identifies the cloud service provider. Atlas Data Lake supports Amazon Web Services only.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.type, "type", ""DATA_LAKE"", `Human-readable label that identifies the resource type associated with this private endpoint.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type createFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + skipRoleValidation bool + filename string + fs afero.Fs } func (opts *createFederatedDatabaseOpts) initClient() func() error { @@ -109,72 +144,101 @@ func (opts *createFederatedDatabaseOpts) initClient() func() error { } } -func (opts *createFederatedDatabaseOpts) Run(ctx context.Context) error { +func (opts *createFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, error) { + var out *admin.DataLakeTenant + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, - + SkipRoleValidation: &opts.skipRoleValidation, + + DataLakeTenant: data, } resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createFederatedDatabaseBuilder() *cobra.Command { - const template = "<>" - - opts := createFederatedDatabaseOpts{} + opts := createFederatedDatabaseOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createFederatedDatabase", + Use: "createFederatedDatabase", Short: "Create One Federated Database Instance in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - + cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) - cmd.Flags().DataLakeCloudProviderConfigVar(&opts.cloudProviderConfig, "cloudProviderConfig", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().DataLakeDataProcessRegionVar(&opts.dataProcessRegion, "dataProcessRegion", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.hostnames, "hostnames", nil, `List that contains the hostnames assigned to the Data Lake instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the data lake.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.state, "state", "", `Label that indicates the status of the Data Lake instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().DataLakeStorageVar(&opts.storage, "storage", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type createOneDataFederationQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string - + limitName string + + filename string + fs afero.Fs } func (opts *createOneDataFederationQueryLimitOpts) initClient() func() error { @@ -185,39 +249,62 @@ func (opts *createOneDataFederationQueryLimitOpts) initClient() func() error { } } -func (opts *createOneDataFederationQueryLimitOpts) Run(ctx context.Context) error { +func (opts *createOneDataFederationQueryLimitOpts) readData() (*admin.DataFederationTenantQueryLimit, error) { + var out *admin.DataFederationTenantQueryLimit + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createOneDataFederationQueryLimitOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateOneDataFederationQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, - + LimitName: opts.limitName, + + DataFederationTenantQueryLimit: data, } resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createOneDataFederationQueryLimitBuilder() *cobra.Command { - const template = "<>" - - opts := createOneDataFederationQueryLimitOpts{} + opts := createOneDataFederationQueryLimitOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createOneDataFederationQueryLimit", + Use: "createOneDataFederationQueryLimit", Short: "Configure One Query Limit for One Federated Database Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -233,35 +320,37 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) - - cmd.Flags().Int64Var(&opts.currentUsage, "currentUsage", 00, `Amount that indicates the current usage of the limit.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Int64Var(&opts.defaultLimit, "defaultLimit", 00, `Default value of the limit.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.lastModifiedDate, "lastModifiedDate", "", `Only used for Data Federation limits. Timestamp that indicates when this usage limit was last modified. This field uses the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Int64Var(&opts.maximumLimit, "maximumLimit", 00, `Maximum value of the limit.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the user-managed limit to modify.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.overrunPolicy, "overrunPolicy", "", `Only used for Data Federation limits. Action to take when the usage limit is exceeded. If limit span is set to QUERY, this is ignored because MongoDB Cloud stops the query when it exceeds the usage limit.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database Instance. If specified, the usage limit is for the specified federated database instance only. If omitted, the usage limit is for all federated database instances in the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Int64Var(&opts.value, "value", 00, `Amount to set the limit to.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } + type deleteDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string endpointId string } @@ -273,9 +362,9 @@ func (opts *deleteDataFederationPrivateEndpointOpts) initClient() func() error { } } -func (opts *deleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *deleteDataFederationPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteDataFederationPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EndpointId: opts.endpointId, } resp, _, err := opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params).Execute() @@ -283,27 +372,21 @@ func (opts *deleteDataFederationPrivateEndpointOpts) Run(ctx context.Context) er return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - opts := deleteDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "deleteDataFederationPrivateEndpoint", + Use: "deleteDataFederationPrivateEndpoint", Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -311,16 +394,19 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") return cmd } + type deleteFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } @@ -332,9 +418,9 @@ func (opts *deleteFederatedDatabaseOpts) initClient() func() error { } } -func (opts *deleteFederatedDatabaseOpts) Run(ctx context.Context) error { +func (opts *deleteFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteFederatedDatabaseApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params).Execute() @@ -342,27 +428,21 @@ func (opts *deleteFederatedDatabaseOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteFederatedDatabaseBuilder() *cobra.Command { - const template = "<>" - opts := deleteFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "deleteFederatedDatabase", + Use: "deleteFederatedDatabase", Short: "Remove One Federated Database Instance from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -370,18 +450,21 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } + type deleteOneDataFederationInstanceQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string + limitName string } func (opts *deleteOneDataFederationInstanceQueryLimitOpts) initClient() func() error { @@ -392,38 +475,32 @@ func (opts *deleteOneDataFederationInstanceQueryLimitOpts) initClient() func() e } } -func (opts *deleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Context) error { +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, + LimitName: opts.limitName, } resp, _, err := opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { - const template = "<>" - opts := deleteOneDataFederationInstanceQueryLimitOpts{} cmd := &cobra.Command{ - Use: "deleteOneDataFederationInstanceQueryLimit", + Use: "deleteOneDataFederationInstanceQueryLimit", Short: "Delete One Query Limit For One Federated Database Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -440,20 +517,23 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } + type downloadFederatedDatabaseQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - endDate int64 - startDate int64 + endDate int64 + startDate int64 } func (opts *downloadFederatedDatabaseQueryLogsOpts) initClient() func() error { @@ -464,39 +544,33 @@ func (opts *downloadFederatedDatabaseQueryLogsOpts) initClient() func() error { } } -func (opts *downloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context) error { +func (opts *downloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - EndDate: &opts.endDate, - StartDate: &opts.startDate, + EndDate: &opts.endDate, + StartDate: &opts.startDate, } resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { - const template = "<>" - opts := downloadFederatedDatabaseQueryLogsOpts{} cmd := &cobra.Command{ - Use: "downloadFederatedDatabaseQueryLogs", + Use: "downloadFederatedDatabaseQueryLogs", Short: "Download Query Logs for One Federated Database Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -506,16 +580,19 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } + type getDataFederationPrivateEndpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string endpointId string } @@ -527,9 +604,9 @@ func (opts *getDataFederationPrivateEndpointOpts) initClient() func() error { } } -func (opts *getDataFederationPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *getDataFederationPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetDataFederationPrivateEndpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, EndpointId: opts.endpointId, } resp, _, err := opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params).Execute() @@ -537,27 +614,21 @@ func (opts *getDataFederationPrivateEndpointOpts) Run(ctx context.Context) error return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getDataFederationPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - opts := getDataFederationPrivateEndpointOpts{} cmd := &cobra.Command{ - Use: "getDataFederationPrivateEndpoint", + Use: "getDataFederationPrivateEndpoint", Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -565,16 +636,19 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") return cmd } + type getFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } @@ -586,9 +660,9 @@ func (opts *getFederatedDatabaseOpts) initClient() func() error { } } -func (opts *getFederatedDatabaseOpts) Run(ctx context.Context) error { +func (opts *getFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetFederatedDatabaseApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params).Execute() @@ -596,27 +670,21 @@ func (opts *getFederatedDatabaseOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getFederatedDatabaseBuilder() *cobra.Command { - const template = "<>" - opts := getFederatedDatabaseOpts{} cmd := &cobra.Command{ - Use: "getFederatedDatabase", + Use: "getFederatedDatabase", Short: "Return One Federated Database Instance in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -624,19 +692,22 @@ func getFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } + type listDataFederationPrivateEndpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listDataFederationPrivateEndpointsOpts) initClient() func() error { @@ -647,39 +718,33 @@ func (opts *listDataFederationPrivateEndpointsOpts) initClient() func() error { } } -func (opts *listDataFederationPrivateEndpointsOpts) Run(ctx context.Context) error { +func (opts *listDataFederationPrivateEndpointsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListDataFederationPrivateEndpointsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listDataFederationPrivateEndpointsBuilder() *cobra.Command { - const template = "<>" - opts := listDataFederationPrivateEndpointsOpts{} cmd := &cobra.Command{ - Use: "listDataFederationPrivateEndpoints", + Use: "listDataFederationPrivateEndpoints", Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -689,16 +754,19 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type listFederatedDatabasesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - type_ string + type_ string } func (opts *listFederatedDatabasesOpts) initClient() func() error { @@ -709,37 +777,31 @@ func (opts *listFederatedDatabasesOpts) initClient() func() error { } } -func (opts *listFederatedDatabasesOpts) Run(ctx context.Context) error { +func (opts *listFederatedDatabasesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, - Type_: &opts.type_, + Type_: &opts.type_, } resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listFederatedDatabasesBuilder() *cobra.Command { - const template = "<>" - opts := listFederatedDatabasesOpts{} cmd := &cobra.Command{ - Use: "listFederatedDatabases", + Use: "listFederatedDatabases", Short: "Return All Federated Database Instances in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -747,17 +809,20 @@ func listFederatedDatabasesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type returnFederatedDatabaseQueryLimitOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string - limitName string + limitName string } func (opts *returnFederatedDatabaseQueryLimitOpts) initClient() func() error { @@ -768,38 +833,32 @@ func (opts *returnFederatedDatabaseQueryLimitOpts) initClient() func() error { } } -func (opts *returnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context) error { +func (opts *returnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, - LimitName: opts.limitName, + LimitName: opts.limitName, } resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { - const template = "<>" - opts := returnFederatedDatabaseQueryLimitOpts{} cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimit", + Use: "returnFederatedDatabaseQueryLimit", Short: "Return One Federated Database Instance Query Limit for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -816,17 +875,20 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd } + type returnFederatedDatabaseQueryLimitsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string tenantName string } @@ -838,9 +900,9 @@ func (opts *returnFederatedDatabaseQueryLimitsOpts) initClient() func() error { } } -func (opts *returnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) error { +func (opts *returnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, TenantName: opts.tenantName, } resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params).Execute() @@ -848,27 +910,21 @@ func (opts *returnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context) err return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { - const template = "<>" - opts := returnFederatedDatabaseQueryLimitsOpts{} cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimits", + Use: "returnFederatedDatabaseQueryLimits", Short: "Return All Query Limits for One Federated Database Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -876,19 +932,24 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } + type updateFederatedDatabaseOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - tenantName string + client *admin.APIClient + groupId string + tenantName string skipRoleValidation bool - + + filename string + fs afero.Fs } func (opts *updateFederatedDatabaseOpts) initClient() func() error { @@ -899,39 +960,62 @@ func (opts *updateFederatedDatabaseOpts) initClient() func() error { } } -func (opts *updateFederatedDatabaseOpts) Run(ctx context.Context) error { +func (opts *updateFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, error) { + var out *admin.DataLakeTenant + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateFederatedDatabaseApiParams{ - GroupId: opts.groupId, - TenantName: opts.tenantName, + GroupId: opts.groupId, + TenantName: opts.tenantName, SkipRoleValidation: &opts.skipRoleValidation, - + + DataLakeTenant: data, } resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateFederatedDatabaseBuilder() *cobra.Command { - const template = "<>" - - opts := updateFederatedDatabaseOpts{} + opts := updateFederatedDatabaseOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateFederatedDatabase", + Use: "updateFederatedDatabase", Short: "Update One Federated Database Instance in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -939,22 +1023,23 @@ func updateFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to update.`) cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) - - cmd.Flags().DataLakeCloudProviderConfigVar(&opts.cloudProviderConfig, "cloudProviderConfig", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().DataLakeDataProcessRegionVar(&opts.dataProcessRegion, "dataProcessRegion", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.hostnames, "hostnames", nil, `List that contains the hostnames assigned to the Data Lake instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the data lake.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.state, "state", "", `Label that indicates the status of the Data Lake instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().DataLakeStorageVar(&opts.storage, "storage", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -964,8 +1049,8 @@ func updateFederatedDatabaseBuilder() *cobra.Command { func dataFederationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "dataFederation", - Short: `Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.`, + Use: "dataFederation", + Short: `Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.`, } cmd.AddCommand( createDataFederationPrivateEndpointBuilder(), @@ -985,4 +1070,3 @@ func dataFederationBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/generated/api_data_lake_pipelines_cmd.go index 77fb99b84a..52ed321c5d 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/generated/api_data_lake_pipelines_cmd.go @@ -18,20 +18,28 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createPipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *createPipelineOpts) initClient() func() error { @@ -42,71 +50,96 @@ func (opts *createPipelineOpts) initClient() func() error { } } -func (opts *createPipelineOpts) Run(ctx context.Context) error { +func (opts *createPipelineOpts) readData() (*admin.IngestionPipeline, error) { + var out *admin.IngestionPipeline + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createPipelineOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, - + + IngestionPipeline: data, } resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createPipelineBuilder() *cobra.Command { - const template = "<>" - - opts := createPipelineOpts{} + opts := createPipelineOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createPipeline", + Use: "createPipeline", Short: "Create One Data Lake Pipeline", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.createdDate, "createdDate", "", `Timestamp that indicates when the Data Lake Pipeline was created.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the group.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.lastUpdatedDate, "lastUpdatedDate", "", `Timestamp that indicates the last time that the Data Lake Pipeline was updated.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Name of this Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IngestionSinkVar(&opts.sink, "sink", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IngestionSourceVar(&opts.source, "source", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.state, "state", "", `State of this Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.transformations, "transformations", nil, `Fields to be excluded for this Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type deletePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -118,9 +151,9 @@ func (opts *deletePipelineOpts) initClient() func() error { } } -func (opts *deletePipelineOpts) Run(ctx context.Context) error { +func (opts *deletePipelineOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeletePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params).Execute() @@ -128,27 +161,21 @@ func (opts *deletePipelineOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deletePipelineBuilder() *cobra.Command { - const template = "<>" - opts := deletePipelineOpts{} cmd := &cobra.Command{ - Use: "deletePipeline", + Use: "deletePipeline", Short: "Remove One Data Lake Pipeline", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -156,17 +183,20 @@ func deletePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } + type deletePipelineRunDatasetOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string + client *admin.APIClient + groupId string + pipelineName string pipelineRunId string } @@ -178,10 +208,10 @@ func (opts *deletePipelineRunDatasetOpts) initClient() func() error { } } -func (opts *deletePipelineRunDatasetOpts) Run(ctx context.Context) error { +func (opts *deletePipelineRunDatasetOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeletePipelineRunDatasetApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params).Execute() @@ -189,27 +219,21 @@ func (opts *deletePipelineRunDatasetOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deletePipelineRunDatasetBuilder() *cobra.Command { - const template = "<>" - opts := deletePipelineRunDatasetOpts{} cmd := &cobra.Command{ - Use: "deletePipelineRunDataset", + Use: "deletePipelineRunDataset", Short: "Delete Pipeline Run Dataset", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -218,17 +242,20 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd } + type getPipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -240,9 +267,9 @@ func (opts *getPipelineOpts) initClient() func() error { } } -func (opts *getPipelineOpts) Run(ctx context.Context) error { +func (opts *getPipelineOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetPipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params).Execute() @@ -250,27 +277,21 @@ func (opts *getPipelineOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getPipelineBuilder() *cobra.Command { - const template = "<>" - opts := getPipelineOpts{} cmd := &cobra.Command{ - Use: "getPipeline", + Use: "getPipeline", Short: "Return One Data Lake Pipeline", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -278,17 +299,20 @@ func getPipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } + type getPipelineRunOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string + client *admin.APIClient + groupId string + pipelineName string pipelineRunId string } @@ -300,10 +324,10 @@ func (opts *getPipelineRunOpts) initClient() func() error { } } -func (opts *getPipelineRunOpts) Run(ctx context.Context) error { +func (opts *getPipelineRunOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetPipelineRunApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params).Execute() @@ -311,27 +335,21 @@ func (opts *getPipelineRunOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getPipelineRunBuilder() *cobra.Command { - const template = "<>" - opts := getPipelineRunOpts{} cmd := &cobra.Command{ - Use: "getPipelineRun", + Use: "getPipelineRun", Short: "Return One Data Lake Pipeline Run", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -340,21 +358,24 @@ func getPipelineRunBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd } + type listPipelineRunsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string - includeCount bool - itemsPerPage int - pageNum int + client *admin.APIClient + groupId string + pipelineName string + includeCount bool + itemsPerPage int + pageNum int createdBefore string } @@ -366,13 +387,13 @@ func (opts *listPipelineRunsOpts) initClient() func() error { } } -func (opts *listPipelineRunsOpts) Run(ctx context.Context) error { +func (opts *listPipelineRunsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPipelineRunsApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, CreatedBefore: convertTime(&opts.createdBefore), } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params).Execute() @@ -380,27 +401,21 @@ func (opts *listPipelineRunsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPipelineRunsBuilder() *cobra.Command { - const template = "<>" - opts := listPipelineRunsOpts{} cmd := &cobra.Command{ - Use: "listPipelineRuns", + Use: "listPipelineRuns", Short: "Return All Data Lake Pipeline Runs from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -412,16 +427,19 @@ func listPipelineRunsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", `If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } + type listPipelineSchedulesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -433,9 +451,9 @@ func (opts *listPipelineSchedulesOpts) initClient() func() error { } } -func (opts *listPipelineSchedulesOpts) Run(ctx context.Context) error { +func (opts *listPipelineSchedulesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPipelineSchedulesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params).Execute() @@ -443,27 +461,21 @@ func (opts *listPipelineSchedulesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPipelineSchedulesBuilder() *cobra.Command { - const template = "<>" - opts := listPipelineSchedulesOpts{} cmd := &cobra.Command{ - Use: "listPipelineSchedules", + Use: "listPipelineSchedules", Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -471,20 +483,23 @@ func listPipelineSchedulesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } + type listPipelineSnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - pipelineName string - includeCount bool - itemsPerPage int - pageNum int + client *admin.APIClient + groupId string + pipelineName string + includeCount bool + itemsPerPage int + pageNum int completedAfter string } @@ -496,13 +511,13 @@ func (opts *listPipelineSnapshotsOpts) initClient() func() error { } } -func (opts *listPipelineSnapshotsOpts) Run(ctx context.Context) error { +func (opts *listPipelineSnapshotsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPipelineSnapshotsApiParams{ - GroupId: opts.groupId, - PipelineName: opts.pipelineName, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + GroupId: opts.groupId, + PipelineName: opts.pipelineName, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, CompletedAfter: convertTime(&opts.completedAfter), } resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params).Execute() @@ -510,27 +525,21 @@ func (opts *listPipelineSnapshotsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPipelineSnapshotsBuilder() *cobra.Command { - const template = "<>" - opts := listPipelineSnapshotsOpts{} cmd := &cobra.Command{ - Use: "listPipelineSnapshots", + Use: "listPipelineSnapshots", Short: "Return Available Backup Snapshots for One Data Lake Pipeline", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -542,15 +551,18 @@ func listPipelineSnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", `Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } + type listPipelinesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -562,7 +574,7 @@ func (opts *listPipelinesOpts) initClient() func() error { } } -func (opts *listPipelinesOpts) Run(ctx context.Context) error { +func (opts *listPipelinesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, } @@ -571,42 +583,39 @@ func (opts *listPipelinesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPipelinesBuilder() *cobra.Command { - const template = "<>" - opts := listPipelinesOpts{} cmd := &cobra.Command{ - Use: "listPipelines", + Use: "listPipelines", Short: "Return All Data Lake Pipelines from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type pausePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -618,9 +627,9 @@ func (opts *pausePipelineOpts) initClient() func() error { } } -func (opts *pausePipelineOpts) Run(ctx context.Context) error { +func (opts *pausePipelineOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.PausePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params).Execute() @@ -628,27 +637,21 @@ func (opts *pausePipelineOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func pausePipelineBuilder() *cobra.Command { - const template = "<>" - opts := pausePipelineOpts{} cmd := &cobra.Command{ - Use: "pausePipeline", + Use: "pausePipeline", Short: "Pause One Data Lake Pipeline", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -656,16 +659,19 @@ func pausePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } + type resumePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string } @@ -677,9 +683,9 @@ func (opts *resumePipelineOpts) initClient() func() error { } } -func (opts *resumePipelineOpts) Run(ctx context.Context) error { +func (opts *resumePipelineOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ResumePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, } resp, _, err := opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params).Execute() @@ -687,27 +693,21 @@ func (opts *resumePipelineOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func resumePipelineBuilder() *cobra.Command { - const template = "<>" - opts := resumePipelineOpts{} cmd := &cobra.Command{ - Use: "resumePipeline", + Use: "resumePipeline", Short: "Resume One Data Lake Pipeline", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -715,18 +715,23 @@ func resumePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } + type triggerSnapshotIngestionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string - + + filename string + fs afero.Fs } func (opts *triggerSnapshotIngestionOpts) initClient() func() error { @@ -737,60 +742,87 @@ func (opts *triggerSnapshotIngestionOpts) initClient() func() error { } } -func (opts *triggerSnapshotIngestionOpts) Run(ctx context.Context) error { +func (opts *triggerSnapshotIngestionOpts) readData() (*admin.TriggerIngestionRequest, error) { + var out *admin.TriggerIngestionRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *triggerSnapshotIngestionOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.TriggerSnapshotIngestionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, - + + TriggerIngestionRequest: data, } resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func triggerSnapshotIngestionBuilder() *cobra.Command { - const template = "<>" - - opts := triggerSnapshotIngestionOpts{} + opts := triggerSnapshotIngestionOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "triggerSnapshotIngestion", + Use: "triggerSnapshotIngestion", Short: "Trigger on demand snapshot ingestion", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal character string that identifies the snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } + type updatePipelineOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string pipelineName string - + + filename string + fs afero.Fs } func (opts *updatePipelineOpts) initClient() func() error { @@ -801,64 +833,88 @@ func (opts *updatePipelineOpts) initClient() func() error { } } -func (opts *updatePipelineOpts) Run(ctx context.Context) error { +func (opts *updatePipelineOpts) readData() (*admin.IngestionPipeline, error) { + var out *admin.IngestionPipeline + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updatePipelineOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdatePipelineApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, PipelineName: opts.pipelineName, - + + IngestionPipeline: data, } resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updatePipelineBuilder() *cobra.Command { - const template = "<>" - - opts := updatePipelineOpts{} + opts := updatePipelineOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updatePipeline", + Use: "updatePipeline", Short: "Update One Data Lake Pipeline", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - - cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.createdDate, "createdDate", "", `Timestamp that indicates when the Data Lake Pipeline was created.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the group.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.lastUpdatedDate, "lastUpdatedDate", "", `Timestamp that indicates the last time that the Data Lake Pipeline was updated.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Name of this Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IngestionSinkVar(&opts.sink, "sink", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IngestionSourceVar(&opts.source, "source", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.state, "state", "", `State of this Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.transformations, "transformations", nil, `Fields to be excluded for this Data Lake Pipeline.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -867,8 +923,8 @@ func updatePipelineBuilder() *cobra.Command { func dataLakePipelinesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "dataLakePipelines", - Short: `Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.`, + Use: "dataLakePipelines", + Short: `Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.`, } cmd.AddCommand( createPipelineBuilder(), @@ -887,4 +943,3 @@ func dataLakePipelinesBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_database_users_cmd.go b/internal/generated/api_database_users_cmd.go index 7ae111b008..ec84fa7675 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/generated/api_database_users_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -29,6 +37,9 @@ type createDatabaseUserOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *createDatabaseUserOpts) initClient() func() error { @@ -39,81 +50,92 @@ func (opts *createDatabaseUserOpts) initClient() func() error { } } -func (opts *createDatabaseUserOpts) Run(ctx context.Context) error { +func (opts *createDatabaseUserOpts) readData() (*admin.DatabaseUser, error) { + var out *admin.DatabaseUser + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, + + DatabaseUser: data, } resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createDatabaseUserBuilder() *cobra.Command { - const template = "<>" - - opts := createDatabaseUserOpts{} + opts := createDatabaseUserOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createDatabaseUser", Short: "Create One Database User in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.awsIAMType, "awsIAMType", ""NONE"", `Human-readable label that indicates whether the new database user authenticates with the Amazon Web Services (AWS) Identity and Access Management (IAM) credentials associated with the user or the user's role.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.databaseName, "databaseName", ""admin"", `Database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.deleteAfterDate, "deleteAfterDate", "", `Date and time when MongoDB Cloud deletes the user. This parameter expresses its value in the ISO 8601 timestamp format in UTC and can include the time zone designation. You must specify a future date that falls within one week of making the Application Programming Interface (API) request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `List that contains the key-value pairs for tagging and categorizing the MongoDB database user. The labels that you define do not appear in the console.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.ldapAuthType, "ldapAuthType", ""NONE"", `Part of the Lightweight Directory Access Protocol (LDAP) record that the database uses to authenticate this database user on the LDAP host.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.password, "password", "", `Alphanumeric string that authenticates this database user against the database specified in `databaseName`. To authenticate with SCRAM-SHA, you must specify this parameter. This parameter doesn't appear in this response.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List that provides the pairings of one role with one applicable database.`) - - cmd.Flags().ArraySliceVar(&opts.scopes, "scopes", nil, `List that contains clusters and MongoDB Atlas Data Lakes that this database user can access. If omitted, MongoDB Cloud grants the database user access to all the clusters and MongoDB Atlas Data Lakes in the project.`) - - cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -| Authentication Method | Parameter Needed | Parameter Value | username Format | -|---|---|---|---| -| AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | -| AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | -| x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | -`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.x509Type, "x509Type", ""NONE"", `X.509 method that MongoDB Cloud uses to authenticate the database user. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- For application-managed X.509, specify `MANAGED`. -- For self-managed X.509, specify `CUSTOMER`. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -Users created with the `CUSTOMER` method require a Common Name (CN) in the **username** parameter. You must create externally authenticated users on the `$external` database.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,7 +158,7 @@ func (opts *deleteDatabaseUserOpts) initClient() func() error { } } -func (opts *deleteDatabaseUserOpts) Run(ctx context.Context) error { +func (opts *deleteDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, @@ -147,27 +169,21 @@ func (opts *deleteDatabaseUserOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteDatabaseUserBuilder() *cobra.Command { - const template = "<>" - opts := deleteDatabaseUserOpts{} cmd := &cobra.Command{ Use: "deleteDatabaseUser", Short: "Remove One Database User from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -187,6 +203,9 @@ func deleteDatabaseUserBuilder() *cobra.Command { | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | `) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") @@ -210,7 +229,7 @@ func (opts *getDatabaseUserOpts) initClient() func() error { } } -func (opts *getDatabaseUserOpts) Run(ctx context.Context) error { +func (opts *getDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, @@ -221,27 +240,21 @@ func (opts *getDatabaseUserOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getDatabaseUserBuilder() *cobra.Command { - const template = "<>" - opts := getDatabaseUserOpts{} cmd := &cobra.Command{ Use: "getDatabaseUser", Short: "Return One Database User from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -261,6 +274,9 @@ func getDatabaseUserBuilder() *cobra.Command { | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | `) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") @@ -285,7 +301,7 @@ func (opts *listDatabaseUsersOpts) initClient() func() error { } } -func (opts *listDatabaseUsersOpts) Run(ctx context.Context) error { +func (opts *listDatabaseUsersOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListDatabaseUsersApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -297,27 +313,21 @@ func (opts *listDatabaseUsersOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listDatabaseUsersBuilder() *cobra.Command { - const template = "<>" - opts := listDatabaseUsersOpts{} cmd := &cobra.Command{ Use: "listDatabaseUsers", Short: "Return All Database Users from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -327,6 +337,9 @@ func listDatabaseUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -338,6 +351,9 @@ type updateDatabaseUserOpts struct { groupId string databaseName string username string + + filename string + fs afero.Fs } func (opts *updateDatabaseUserOpts) initClient() func() error { @@ -348,38 +364,62 @@ func (opts *updateDatabaseUserOpts) initClient() func() error { } } -func (opts *updateDatabaseUserOpts) Run(ctx context.Context) error { +func (opts *updateDatabaseUserOpts) readData() (*admin.DatabaseUser, error) { + var out *admin.DatabaseUser + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, Username: opts.username, + + DatabaseUser: data, } resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateDatabaseUserBuilder() *cobra.Command { - const template = "<>" - - opts := updateDatabaseUserOpts{} + opts := updateDatabaseUserOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateDatabaseUser", Short: "Update One Database User in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -399,45 +439,32 @@ func updateDatabaseUserBuilder() *cobra.Command { | SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | `) - cmd.Flags().StringVar(&opts.awsIAMType, "awsIAMType", ""NONE"", `Human-readable label that indicates whether the new database user authenticates with the Amazon Web Services (AWS) Identity and Access Management (IAM) credentials associated with the user or the user's role.`) - - cmd.Flags().StringVar(&opts.databaseName, "databaseName", ""admin"", `Database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.deleteAfterDate, "deleteAfterDate", "", `Date and time when MongoDB Cloud deletes the user. This parameter expresses its value in the ISO 8601 timestamp format in UTC and can include the time zone designation. You must specify a future date that falls within one week of making the Application Programming Interface (API) request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `List that contains the key-value pairs for tagging and categorizing the MongoDB database user. The labels that you define do not appear in the console.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.ldapAuthType, "ldapAuthType", ""NONE"", `Part of the Lightweight Directory Access Protocol (LDAP) record that the database uses to authenticate this database user on the LDAP host.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.password, "password", "", `Alphanumeric string that authenticates this database user against the database specified in `databaseName`. To authenticate with SCRAM-SHA, you must specify this parameter. This parameter doesn't appear in this response.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List that provides the pairings of one role with one applicable database.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.scopes, "scopes", nil, `List that contains clusters and MongoDB Atlas Data Lakes that this database user can access. If omitted, MongoDB Cloud grants the database user access to all the clusters and MongoDB Atlas Data Lakes in the project.`) - - cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -| Authentication Method | Parameter Needed | Parameter Value | username Format | -|---|---|---|---| -| AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | -| AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | -| x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | -`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.x509Type, "x509Type", ""NONE"", `X.509 method that MongoDB Cloud uses to authenticate the database user. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- For application-managed X.509, specify `MANAGED`. -- For self-managed X.509, specify `CUSTOMER`. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -Users created with the `CUSTOMER` method require a Common Name (CN) in the **username** parameter. You must create externally authenticated users on the `$external` database.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go index 6f2f58cb5f..ca54f7fd8c 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -18,18 +18,24 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type getEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -41,7 +47,7 @@ func (opts *getEncryptionAtRestOpts) initClient() func() error { } } -func (opts *getEncryptionAtRestOpts) Run(ctx context.Context) error { +func (opts *getEncryptionAtRestOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, } @@ -50,43 +56,42 @@ func (opts *getEncryptionAtRestOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getEncryptionAtRestBuilder() *cobra.Command { - const template = "<>" - opts := getEncryptionAtRestOpts{} cmd := &cobra.Command{ - Use: "getEncryptionAtRest", + Use: "getEncryptionAtRest", Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type updateEncryptionAtRestOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *updateEncryptionAtRestOpts) initClient() func() error { @@ -97,50 +102,74 @@ func (opts *updateEncryptionAtRestOpts) initClient() func() error { } } -func (opts *updateEncryptionAtRestOpts) Run(ctx context.Context) error { +func (opts *updateEncryptionAtRestOpts) readData() (*admin.EncryptionAtRest, error) { + var out *admin.EncryptionAtRest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateEncryptionAtRestOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, - + + EncryptionAtRest: data, } resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateEncryptionAtRestBuilder() *cobra.Command { - const template = "<>" - - opts := updateEncryptionAtRestOpts{} + opts := updateEncryptionAtRestOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateEncryptionAtRest", + Use: "updateEncryptionAtRest", Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().AWSKMSVar(&opts.awsKms, "awsKms", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().AzureKeyVaultVar(&opts.azureKeyVault, "azureKeyVault", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().GoogleCloudKMSVar(&opts.googleCloudKms, "googleCloudKms", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -148,8 +177,8 @@ func updateEncryptionAtRestBuilder() *cobra.Command { func encryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "encryptionAtRestUsingCustomerKeyManagement", - Short: `Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.`, + Use: "encryptionAtRestUsingCustomerKeyManagement", + Short: `Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.`, } cmd.AddCommand( getEncryptionAtRestBuilder(), @@ -157,4 +186,3 @@ func encryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_events_cmd.go b/internal/generated/api_events_cmd.go index 0a097b3e60..7318f3c063 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/generated/api_events_cmd.go @@ -18,8 +18,12 @@ package generated import ( "context" + "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -41,7 +45,7 @@ func (opts *getOrganizationEventOpts) initClient() func() error { } } -func (opts *getOrganizationEventOpts) Run(ctx context.Context) error { +func (opts *getOrganizationEventOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetOrganizationEventApiParams{ OrgId: opts.orgId, EventId: opts.eventId, @@ -52,33 +56,30 @@ func (opts *getOrganizationEventOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getOrganizationEventBuilder() *cobra.Command { - const template = "<>" - opts := getOrganizationEventOpts{} cmd := &cobra.Command{ Use: "getOrganizationEvent", Short: "Return One Event from One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("eventId") return cmd @@ -101,7 +102,7 @@ func (opts *getProjectEventOpts) initClient() func() error { } } -func (opts *getProjectEventOpts) Run(ctx context.Context) error { +func (opts *getProjectEventOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectEventApiParams{ GroupId: opts.groupId, EventId: opts.eventId, @@ -112,27 +113,21 @@ func (opts *getProjectEventOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getProjectEventBuilder() *cobra.Command { - const template = "<>" - opts := getProjectEventOpts{} cmd := &cobra.Command{ Use: "getProjectEvent", Short: "Return One Event from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -141,6 +136,9 @@ func getProjectEventBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("eventId") return cmd @@ -168,7 +166,7 @@ func (opts *listOrganizationEventsOpts) initClient() func() error { } } -func (opts *listOrganizationEventsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationEventsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationEventsApiParams{ OrgId: opts.orgId, IncludeCount: &opts.includeCount, @@ -184,27 +182,21 @@ func (opts *listOrganizationEventsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listOrganizationEventsBuilder() *cobra.Command { - const template = "<>" - opts := listOrganizationEventsOpts{} cmd := &cobra.Command{ Use: "listOrganizationEvents", Short: "Return All Events from One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -218,6 +210,9 @@ func listOrganizationEventsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -245,7 +240,7 @@ func (opts *listProjectEventsOpts) initClient() func() error { } } -func (opts *listProjectEventsOpts) Run(ctx context.Context) error { +func (opts *listProjectEventsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectEventsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -262,27 +257,21 @@ func (opts *listProjectEventsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listProjectEventsBuilder() *cobra.Command { - const template = "<>" - opts := listProjectEventsOpts{} cmd := &cobra.Command{ Use: "listProjectEvents", Short: "Return All Events from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -299,6 +288,9 @@ func listProjectEventsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/generated/api_federated_authentication_cmd.go index ee5fa4178e..bda56e3643 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/generated/api_federated_authentication_cmd.go @@ -18,21 +18,29 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string - + orgId string + + filename string + fs afero.Fs } func (opts *createRoleMappingOpts) initClient() func() error { @@ -43,59 +51,84 @@ func (opts *createRoleMappingOpts) initClient() func() error { } } -func (opts *createRoleMappingOpts) Run(ctx context.Context) error { +func (opts *createRoleMappingOpts) readData() (*admin.RoleMapping, error) { + var out *admin.RoleMapping + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, - + OrgId: opts.orgId, + + RoleMapping: data, } resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createRoleMappingBuilder() *cobra.Command { - const template = "<>" - - opts := createRoleMappingOpts{} + opts := createRoleMappingOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createRoleMapping", + Use: "createRoleMapping", Short: "Add One Role Mapping to One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - - cmd.Flags().StringVar(&opts.externalGroupName, "externalGroupName", "", `Unique human-readable label that identifies the identity provider group to whichthis role mapping applies.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this role mapping.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.roleAssignments, "roleAssignments", nil, `Atlas roles and the unique identifiers of the groups and organizations associated with each role.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } + type deleteFederationAppOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -107,7 +140,7 @@ func (opts *deleteFederationAppOpts) initClient() func() error { } } -func (opts *deleteFederationAppOpts) Run(ctx context.Context) error { +func (opts *deleteFederationAppOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteFederationAppApiParams{ FederationSettingsId: opts.federationSettingsId, } @@ -116,42 +149,39 @@ func (opts *deleteFederationAppOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func deleteFederationAppBuilder() *cobra.Command { - const template = "<>" - opts := deleteFederationAppOpts{} cmd := &cobra.Command{ - Use: "deleteFederationApp", + Use: "deleteFederationApp", Short: "Delete the federation settings instance.", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } + type deleteRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string + id string + orgId string } func (opts *deleteRoleMappingOpts) initClient() func() error { @@ -162,56 +192,53 @@ func (opts *deleteRoleMappingOpts) initClient() func() error { } } -func (opts *deleteRoleMappingOpts) Run(ctx context.Context) error { +func (opts *deleteRoleMappingOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, + Id: opts.id, + OrgId: opts.orgId, } _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(nil) + return nil } func deleteRoleMappingBuilder() *cobra.Command { - const template = "<>" - opts := deleteRoleMappingOpts{} cmd := &cobra.Command{ - Use: "deleteRoleMapping", + Use: "deleteRoleMapping", Short: "Remove One Role Mapping from One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") return cmd } + type getConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } func (opts *getConnectedOrgConfigOpts) initClient() func() error { @@ -222,52 +249,49 @@ func (opts *getConnectedOrgConfigOpts) initClient() func() error { } } -func (opts *getConnectedOrgConfigOpts) Run(ctx context.Context) error { +func (opts *getConnectedOrgConfigOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getConnectedOrgConfigBuilder() *cobra.Command { - const template = "<>" - opts := getConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "getConnectedOrgConfig", + Use: "getConnectedOrgConfig", Short: "Return One Org Config Connected to One Federation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } + type getFederationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *getFederationSettingsOpts) initClient() func() error { @@ -278,7 +302,7 @@ func (opts *getFederationSettingsOpts) initClient() func() error { } } -func (opts *getFederationSettingsOpts) Run(ctx context.Context) error { +func (opts *getFederationSettingsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, } @@ -287,41 +311,38 @@ func (opts *getFederationSettingsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getFederationSettingsBuilder() *cobra.Command { - const template = "<>" - opts := getFederationSettingsOpts{} cmd := &cobra.Command{ - Use: "getFederationSettings", + Use: "getFederationSettings", Short: "Return Federation Settings for One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type getIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string + identityProviderId string } func (opts *getIdentityProviderOpts) initClient() func() error { @@ -332,53 +353,50 @@ func (opts *getIdentityProviderOpts) initClient() func() error { } } -func (opts *getIdentityProviderOpts) Run(ctx context.Context) error { +func (opts *getIdentityProviderOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, + IdentityProviderId: opts.identityProviderId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getIdentityProviderBuilder() *cobra.Command { - const template = "<>" - opts := getIdentityProviderOpts{} cmd := &cobra.Command{ - Use: "getIdentityProvider", + Use: "getIdentityProvider", Short: "Return one identity provider from the specified federation.", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } + type getIdentityProviderMetadataOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string + identityProviderId string } func (opts *getIdentityProviderMetadataOpts) initClient() func() error { @@ -389,54 +407,51 @@ func (opts *getIdentityProviderMetadataOpts) initClient() func() error { } } -func (opts *getIdentityProviderMetadataOpts) Run(ctx context.Context) error { +func (opts *getIdentityProviderMetadataOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetIdentityProviderMetadataApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, + IdentityProviderId: opts.identityProviderId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getIdentityProviderMetadataBuilder() *cobra.Command { - const template = "<>" - opts := getIdentityProviderMetadataOpts{} cmd := &cobra.Command{ - Use: "getIdentityProviderMetadata", + Use: "getIdentityProviderMetadata", Short: "Return the metadata of one identity provider in the specified federation.", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } + type getRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string + id string + orgId string } func (opts *getRoleMappingOpts) initClient() func() error { @@ -447,54 +462,51 @@ func (opts *getRoleMappingOpts) initClient() func() error { } } -func (opts *getRoleMappingOpts) Run(ctx context.Context) error { +func (opts *getRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, + Id: opts.id, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getRoleMappingBuilder() *cobra.Command { - const template = "<>" - opts := getRoleMappingOpts{} cmd := &cobra.Command{ - Use: "getRoleMapping", + Use: "getRoleMapping", Short: "Return One Role Mapping from One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") _ = cmd.MarkFlagRequired("orgId") return cmd } + type listConnectedOrgConfigsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -506,7 +518,7 @@ func (opts *listConnectedOrgConfigsOpts) initClient() func() error { } } -func (opts *listConnectedOrgConfigsOpts) Run(ctx context.Context) error { +func (opts *listConnectedOrgConfigsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListConnectedOrgConfigsApiParams{ FederationSettingsId: opts.federationSettingsId, } @@ -515,39 +527,36 @@ func (opts *listConnectedOrgConfigsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listConnectedOrgConfigsBuilder() *cobra.Command { - const template = "<>" - opts := listConnectedOrgConfigsOpts{} cmd := &cobra.Command{ - Use: "listConnectedOrgConfigs", + Use: "listConnectedOrgConfigs", Short: "Return All Connected Org Configs from the Federation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } + type listIdentityProvidersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string } @@ -559,7 +568,7 @@ func (opts *listIdentityProvidersOpts) initClient() func() error { } } -func (opts *listIdentityProvidersOpts) Run(ctx context.Context) error { +func (opts *listIdentityProvidersOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListIdentityProvidersApiParams{ FederationSettingsId: opts.federationSettingsId, } @@ -568,41 +577,38 @@ func (opts *listIdentityProvidersOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listIdentityProvidersBuilder() *cobra.Command { - const template = "<>" - opts := listIdentityProvidersOpts{} cmd := &cobra.Command{ - Use: "listIdentityProviders", + Use: "listIdentityProviders", Short: "Return all identity providers from the specified federation.", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd } + type listRoleMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } func (opts *listRoleMappingsOpts) initClient() func() error { @@ -613,53 +619,50 @@ func (opts *listRoleMappingsOpts) initClient() func() error { } } -func (opts *listRoleMappingsOpts) Run(ctx context.Context) error { +func (opts *listRoleMappingsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listRoleMappingsBuilder() *cobra.Command { - const template = "<>" - opts := listRoleMappingsOpts{} cmd := &cobra.Command{ - Use: "listRoleMappings", + Use: "listRoleMappings", Short: "Return All Role Mappings from One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } + type removeConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string + orgId string } func (opts *removeConnectedOrgConfigOpts) initClient() func() error { @@ -670,54 +673,53 @@ func (opts *removeConnectedOrgConfigOpts) initClient() func() error { } } -func (opts *removeConnectedOrgConfigOpts) Run(ctx context.Context) error { +func (opts *removeConnectedOrgConfigOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.RemoveConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, + OrgId: opts.orgId, } resp, _, err := opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func removeConnectedOrgConfigBuilder() *cobra.Command { - const template = "<>" - opts := removeConnectedOrgConfigOpts{} cmd := &cobra.Command{ - Use: "removeConnectedOrgConfig", + Use: "removeConnectedOrgConfig", Short: "Remove One Org Config Connected to One Federation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } + type updateConnectedOrgConfigOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - orgId string - + orgId string + + filename string + fs afero.Fs } func (opts *updateConnectedOrgConfigOpts) initClient() func() error { @@ -728,72 +730,99 @@ func (opts *updateConnectedOrgConfigOpts) initClient() func() error { } } -func (opts *updateConnectedOrgConfigOpts) Run(ctx context.Context) error { +func (opts *updateConnectedOrgConfigOpts) readData() (*admin.ConnectedOrgConfig, error) { + var out *admin.ConnectedOrgConfig + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateConnectedOrgConfigOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, - OrgId: opts.orgId, - + OrgId: opts.orgId, + + ConnectedOrgConfig: data, } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateConnectedOrgConfigBuilder() *cobra.Command { - const template = "<>" - - opts := updateConnectedOrgConfigOpts{} + opts := updateConnectedOrgConfigOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateConnectedOrgConfig", + Use: "updateConnectedOrgConfig", Short: "Update One Org Config Connected to One Federation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.`) - - cmd.Flags().SetSliceVar(&opts.dataAccessIdentityProviderIds, "dataAccessIdentityProviderIds", nil, `The collection of unique ids of the identity providers for org's data access.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.domainAllowList, "domainAllowList", nil, `Approved domains that restrict users who can join the organization based on their email address.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.domainRestrictionEnabled, "domainRestrictionEnabled", false, `Value that indicates whether domain restriction is enabled for this connected org.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider that this connected org config is associated with.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.postAuthRoleGrants, "postAuthRoleGrants", nil, `Atlas roles that are granted to a user in this organization after authenticating.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.roleMappings, "roleMappings", nil, `Role mappings that are configured in this organization.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.userConflicts, "userConflicts", nil, `List that contains the users who have an email address that doesn't match any domain on the allowed list.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") return cmd } + type updateIdentityProviderOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - identityProviderId string - + identityProviderId string + + filename string + fs afero.Fs } func (opts *updateIdentityProviderOpts) initClient() func() error { @@ -804,79 +833,106 @@ func (opts *updateIdentityProviderOpts) initClient() func() error { } } -func (opts *updateIdentityProviderOpts) Run(ctx context.Context) error { +func (opts *updateIdentityProviderOpts) readData() (*admin.SamlIdentityProviderUpdate, error) { + var out *admin.SamlIdentityProviderUpdate + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateIdentityProviderOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, - IdentityProviderId: opts.identityProviderId, - + IdentityProviderId: opts.identityProviderId, + + SamlIdentityProviderUpdate: data, } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateIdentityProviderBuilder() *cobra.Command { - const template = "<>" - - opts := updateIdentityProviderOpts{} + opts := updateIdentityProviderOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateIdentityProvider", + Use: "updateIdentityProvider", Short: "Update the identity provider.", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) - - cmd.Flags().SetSliceVar(&opts.associatedDomains, "associatedDomains", nil, `List that contains the domains associated with the identity provider.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.description, "description", "", `The description for the identity provider.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.displayName, "displayName", "", `Human-readable label that identifies the identity provider.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.issuerUri, "issuerUri", "", `Unique string that identifies the issuer of the SAML Assertion.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().PemFileInfoVar(&opts.pemFileInfo, "pemFileInfo", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.protocol, "protocol", "", `The protocol for the identity provider.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.requestBinding, "requestBinding", "", `SAML Authentication Request Protocol HTTP method binding (POST or REDIRECT) that Federated Authentication uses to send the authentication request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.responseSignatureAlgorithm, "responseSignatureAlgorithm", "", `Signature algorithm that Federated Authentication uses to encrypt the identity provider signature.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.ssoDebugEnabled, "ssoDebugEnabled", false, `Flag that indicates whether the identity provider has SSO debug enabled.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.ssoUrl, "ssoUrl", "", `Unique string that identifies the intended audience of the SAML assertion.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.status, "status", "", `String enum that indicates whether the identity provider is active.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") return cmd } + type updateRoleMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient federationSettingsId string - id string - orgId string - + id string + orgId string + + filename string + fs afero.Fs } func (opts *updateRoleMappingOpts) initClient() func() error { @@ -887,52 +943,76 @@ func (opts *updateRoleMappingOpts) initClient() func() error { } } -func (opts *updateRoleMappingOpts) Run(ctx context.Context) error { +func (opts *updateRoleMappingOpts) readData() (*admin.RoleMapping, error) { + var out *admin.RoleMapping + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, - Id: opts.id, - OrgId: opts.orgId, - + Id: opts.id, + OrgId: opts.orgId, + + RoleMapping: data, } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateRoleMappingBuilder() *cobra.Command { - const template = "<>" - - opts := updateRoleMappingOpts{} + opts := updateRoleMappingOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateRoleMapping", + Use: "updateRoleMapping", Short: "Update One Role Mapping in One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - - cmd.Flags().StringVar(&opts.externalGroupName, "externalGroupName", "", `Unique human-readable label that identifies the identity provider group to whichthis role mapping applies.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this role mapping.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.roleAssignments, "roleAssignments", nil, `Atlas roles and the unique identifiers of the groups and organizations associated with each role.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") @@ -942,8 +1022,8 @@ func updateRoleMappingBuilder() *cobra.Command { func federatedAuthenticationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "federatedAuthentication", - Short: `Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.`, + Use: "federatedAuthentication", + Short: `Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.`, } cmd.AddCommand( createRoleMappingBuilder(), @@ -964,4 +1044,3 @@ func federatedAuthenticationBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/generated/api_global_clusters_cmd.go index 3454cc71dc..50137ca5e4 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/generated/api_global_clusters_cmd.go @@ -18,21 +18,29 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createCustomZoneMappingOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createCustomZoneMappingOpts) initClient() func() error { @@ -43,64 +51,89 @@ func (opts *createCustomZoneMappingOpts) initClient() func() error { } } -func (opts *createCustomZoneMappingOpts) Run(ctx context.Context) error { +func (opts *createCustomZoneMappingOpts) readData() (*admin.GeoSharding, error) { + var out *admin.GeoSharding + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createCustomZoneMappingOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateCustomZoneMappingApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + GeoSharding: data, } resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createCustomZoneMappingBuilder() *cobra.Command { - const template = "<>" - - opts := createCustomZoneMappingOpts{} + opts := createCustomZoneMappingOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createCustomZoneMapping", + Use: "createCustomZoneMapping", Short: "Add One Entry to One Custom Zone Mapping", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - - - cmd.Flags().Map[string]stringVar(&opts.customZoneMapping, "customZoneMapping", , `List that contains comma-separated key value pairs to map zones to geographic regions. These pairs map an ISO 3166-1a2 location code, with an ISO 3166-2 subdivision code when possible, to a unique 24-hexadecimal string that identifies the custom zone. -This parameter returns an empty object if no custom zones exist.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.managedNamespaces, "managedNamespaces", nil, `List that contains a namespace for a Global Cluster. MongoDB Cloud manages this cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type createManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createManagedNamespaceOpts) initClient() func() error { @@ -111,70 +144,95 @@ func (opts *createManagedNamespaceOpts) initClient() func() error { } } -func (opts *createManagedNamespaceOpts) Run(ctx context.Context) error { +func (opts *createManagedNamespaceOpts) readData() (*admin.ManagedNamespace, error) { + var out *admin.ManagedNamespace + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createManagedNamespaceOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateManagedNamespaceApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + ManagedNamespace: data, } resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createManagedNamespaceBuilder() *cobra.Command { - const template = "<>" - - opts := createManagedNamespaceOpts{} + opts := createManagedNamespaceOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createManagedNamespace", + Use: "createManagedNamespace", Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - - cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label of the collection to manage for this Global Cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.customShardKey, "customShardKey", "", `Database parameter used to divide the *collection* into shards. Global clusters require a compound shard key. This compound shard key combines the location parameter and the user-selected custom key.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label of the database to manage for this Global Cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.isCustomShardKeyHashed, "isCustomShardKeyHashed", false, `Flag that indicates whether someone hashed the custom shard key. If this parameter returns `false`, this cluster uses ranged sharding.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.isShardKeyUnique, "isShardKeyUnique", false, `Flag that indicates whether the underlying index enforces unique values.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Int64Var(&opts.numInitialChunks, "numInitialChunks", 00, `Minimum number of chunks to create initially when sharding an empty collection with a hashed shard key.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.presplitHashedZones, "presplitHashedZones", false, `Flag that indicates whether MongoDB Cloud should create and distribute initial chunks for an empty or non-existing collection. MongoDB Cloud distributes data based on the defined zones and zone ranges for the collection.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type deleteAllCustomZoneMappingsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -186,9 +244,9 @@ func (opts *deleteAllCustomZoneMappingsOpts) initClient() func() error { } } -func (opts *deleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { +func (opts *deleteAllCustomZoneMappingsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteAllCustomZoneMappingsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params).Execute() @@ -196,27 +254,21 @@ func (opts *deleteAllCustomZoneMappingsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteAllCustomZoneMappingsBuilder() *cobra.Command { - const template = "<>" - opts := deleteAllCustomZoneMappingsOpts{} cmd := &cobra.Command{ - Use: "deleteAllCustomZoneMappings", + Use: "deleteAllCustomZoneMappings", Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -224,19 +276,22 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type deleteManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient clusterName string - groupId string - db string - collection string + groupId string + db string + collection string } func (opts *deleteManagedNamespaceOpts) initClient() func() error { @@ -247,39 +302,33 @@ func (opts *deleteManagedNamespaceOpts) initClient() func() error { } } -func (opts *deleteManagedNamespaceOpts) Run(ctx context.Context) error { +func (opts *deleteManagedNamespaceOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, - GroupId: opts.groupId, - Db: &opts.db, - Collection: &opts.collection, + GroupId: opts.groupId, + Db: &opts.db, + Collection: &opts.collection, } resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteManagedNamespaceBuilder() *cobra.Command { - const template = "<>" - opts := deleteManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "deleteManagedNamespace", + Use: "deleteManagedNamespace", Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) @@ -289,16 +338,19 @@ func deleteManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label that identifies the database that contains the collection.`) cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd } + type getManagedNamespaceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -310,9 +362,9 @@ func (opts *getManagedNamespaceOpts) initClient() func() error { } } -func (opts *getManagedNamespaceOpts) Run(ctx context.Context) error { +func (opts *getManagedNamespaceOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetManagedNamespaceApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params).Execute() @@ -320,27 +372,21 @@ func (opts *getManagedNamespaceOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getManagedNamespaceBuilder() *cobra.Command { - const template = "<>" - opts := getManagedNamespaceOpts{} cmd := &cobra.Command{ - Use: "getManagedNamespace", + Use: "getManagedNamespace", Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -348,6 +394,8 @@ func getManagedNamespaceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -356,8 +404,8 @@ func getManagedNamespaceBuilder() *cobra.Command { func globalClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "globalClusters", - Short: `Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. + Use: "globalClusters", + Short: `Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster.`, } cmd.AddCommand( @@ -369,4 +417,3 @@ MongoDB Cloud shards the empty collection using the required location field and ) return cmd } - diff --git a/internal/generated/api_invoices_cmd.go b/internal/generated/api_invoices_cmd.go index 28512de697..eba76cbd52 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/generated/api_invoices_cmd.go @@ -18,8 +18,12 @@ package generated import ( "context" + "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -40,7 +44,7 @@ func (opts *downloadInvoiceCSVOpts) initClient() func() error { } } -func (opts *downloadInvoiceCSVOpts) Run(ctx context.Context) error { +func (opts *downloadInvoiceCSVOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DownloadInvoiceCSVApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, @@ -50,32 +54,29 @@ func (opts *downloadInvoiceCSVOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func downloadInvoiceCSVBuilder() *cobra.Command { - const template = "<>" - opts := downloadInvoiceCSVOpts{} cmd := &cobra.Command{ Use: "downloadInvoiceCSV", Short: "Return One Organization Invoice as CSV", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") return cmd @@ -97,7 +98,7 @@ func (opts *getInvoiceOpts) initClient() func() error { } } -func (opts *getInvoiceOpts) Run(ctx context.Context) error { +func (opts *getInvoiceOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetInvoiceApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, @@ -107,32 +108,29 @@ func (opts *getInvoiceOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getInvoiceBuilder() *cobra.Command { - const template = "<>" - opts := getInvoiceOpts{} cmd := &cobra.Command{ Use: "getInvoice", Short: "Return One Organization Invoice", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") return cmd @@ -156,7 +154,7 @@ func (opts *listInvoicesOpts) initClient() func() error { } } -func (opts *listInvoicesOpts) Run(ctx context.Context) error { +func (opts *listInvoicesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListInvoicesApiParams{ OrgId: opts.orgId, IncludeCount: &opts.includeCount, @@ -168,27 +166,21 @@ func (opts *listInvoicesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listInvoicesBuilder() *cobra.Command { - const template = "<>" - opts := listInvoicesOpts{} cmd := &cobra.Command{ Use: "listInvoices", Short: "Return All Invoices for One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -196,6 +188,9 @@ func listInvoicesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -215,7 +210,7 @@ func (opts *listPendingInvoicesOpts) initClient() func() error { } } -func (opts *listPendingInvoicesOpts) Run(ctx context.Context) error { +func (opts *listPendingInvoicesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, } @@ -224,31 +219,28 @@ func (opts *listPendingInvoicesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPendingInvoicesBuilder() *cobra.Command { - const template = "<>" - opts := listPendingInvoicesOpts{} cmd := &cobra.Command{ Use: "listPendingInvoices", Short: "Return All Pending Invoices for One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") return cmd } diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/generated/api_ldap_configuration_cmd.go index 57d49402d0..48fdb824d4 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/generated/api_ldap_configuration_cmd.go @@ -18,18 +18,24 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type deleteLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -41,7 +47,7 @@ func (opts *deleteLDAPConfigurationOpts) initClient() func() error { } } -func (opts *deleteLDAPConfigurationOpts) Run(ctx context.Context) error { +func (opts *deleteLDAPConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, } @@ -50,41 +56,38 @@ func (opts *deleteLDAPConfigurationOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func deleteLDAPConfigurationBuilder() *cobra.Command { - const template = "<>" - opts := deleteLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "deleteLDAPConfiguration", + Use: "deleteLDAPConfiguration", Short: "Remove the Current LDAP User to DN Mapping", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type getLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string } @@ -96,7 +99,7 @@ func (opts *getLDAPConfigurationOpts) initClient() func() error { } } -func (opts *getLDAPConfigurationOpts) Run(ctx context.Context) error { +func (opts *getLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, } @@ -105,42 +108,39 @@ func (opts *getLDAPConfigurationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getLDAPConfigurationBuilder() *cobra.Command { - const template = "<>" - opts := getLDAPConfigurationOpts{} cmd := &cobra.Command{ - Use: "getLDAPConfiguration", + Use: "getLDAPConfiguration", Short: "Return the Current LDAP or X.509 Configuration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type getLDAPConfigurationStatusOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string requestId string } @@ -152,9 +152,9 @@ func (opts *getLDAPConfigurationStatusOpts) initClient() func() error { } } -func (opts *getLDAPConfigurationStatusOpts) Run(ctx context.Context) error { +func (opts *getLDAPConfigurationStatusOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetLDAPConfigurationStatusApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, RequestId: opts.requestId, } resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params).Execute() @@ -162,27 +162,21 @@ func (opts *getLDAPConfigurationStatusOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getLDAPConfigurationStatusBuilder() *cobra.Command { - const template = "<>" - opts := getLDAPConfigurationStatusOpts{} cmd := &cobra.Command{ - Use: "getLDAPConfigurationStatus", + Use: "getLDAPConfigurationStatus", Short: "Return the Status of One Verify LDAP Configuration Request", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -190,17 +184,22 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("requestId") return cmd } + type saveLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *saveLDAPConfigurationOpts) initClient() func() error { @@ -211,60 +210,87 @@ func (opts *saveLDAPConfigurationOpts) initClient() func() error { } } -func (opts *saveLDAPConfigurationOpts) Run(ctx context.Context) error { +func (opts *saveLDAPConfigurationOpts) readData() (*admin.UserSecurity, error) { + var out *admin.UserSecurity + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *saveLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, - + + UserSecurity: data, } resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func saveLDAPConfigurationBuilder() *cobra.Command { - const template = "<>" - - opts := saveLDAPConfigurationOpts{} + opts := saveLDAPConfigurationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "saveLDAPConfiguration", + Use: "saveLDAPConfiguration", Short: "Edit the LDAP or X.509 Configuration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().CustomerX509Var(&opts.customerX509, "customerX509", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().NDSLDAPVar(&opts.ldap, "ldap", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type verifyLDAPConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *verifyLDAPConfigurationOpts) initClient() func() error { @@ -275,60 +301,82 @@ func (opts *verifyLDAPConfigurationOpts) initClient() func() error { } } -func (opts *verifyLDAPConfigurationOpts) Run(ctx context.Context) error { +func (opts *verifyLDAPConfigurationOpts) readData() (*admin.NDSLDAPVerifyConnectivityJobRequestParams, error) { + var out *admin.NDSLDAPVerifyConnectivityJobRequestParams + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *verifyLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, - + + NDSLDAPVerifyConnectivityJobRequestParams: data, } resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func verifyLDAPConfigurationBuilder() *cobra.Command { - const template = "<>" - - opts := verifyLDAPConfigurationOpts{} + opts := verifyLDAPConfigurationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "verifyLDAPConfiguration", + Use: "verifyLDAPConfiguration", Short: "Verify the LDAP Configuration in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts.authzQueryTemplate, "authzQueryTemplate", ""{USER}?memberOf?base"", `Lightweight Directory Access Protocol (LDAP) query template that MongoDB Cloud applies to create an LDAP query to return the LDAP groups associated with the authenticated MongoDB user. MongoDB Cloud uses this parameter only for user authorization. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query per [RFC 4515](https://tools.ietf.org/search/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516).`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.bindPassword, "bindPassword", "", `Password that MongoDB Cloud uses to authenticate the **bindUsername**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.bindUsername, "bindUsername", "", `Full Distinguished Name (DN) of the Lightweight Directory Access Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP host. LDAP distinguished names must be formatted according to RFC 2253.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.caCertificate, "caCertificate", "", `Certificate Authority (CA) certificate that MongoDB Cloud uses to verify the identity of the Lightweight Directory Access Protocol (LDAP) host. MongoDB Cloud allows self-signed certificates. To delete an assigned value, pass an empty string: `"caCertificate": ""`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.hostname, "hostname", "", `Human-readable label that identifies the hostname or Internet Protocol (IP) address of the Lightweight Directory Access Protocol (LDAP) host. This host must have access to the internet or have a Virtual Private Cloud (VPC) peering connection to your cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) - - cmd.Flags().IntVar(&opts.port, "port", 636, `IANA port to which the Lightweight Directory Access Protocol (LDAP) host listens for client connections.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -336,8 +384,8 @@ Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to func lDAPConfigurationBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "lDAPConfiguration", - Short: `Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.`, + Use: "lDAPConfiguration", + Short: `Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.`, } cmd.AddCommand( deleteLDAPConfigurationBuilder(), @@ -348,4 +396,3 @@ func lDAPConfigurationBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/generated/api_legacy_backup_cmd.go index c24f726f29..fa7d21098b 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/generated/api_legacy_backup_cmd.go @@ -18,21 +18,27 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type deleteLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *deleteLegacySnapshotOpts) initClient() func() error { @@ -43,38 +49,32 @@ func (opts *deleteLegacySnapshotOpts) initClient() func() error { } } -func (opts *deleteLegacySnapshotOpts) Run(ctx context.Context) error { +func (opts *deleteLegacySnapshotOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteLegacySnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteLegacySnapshotBuilder() *cobra.Command { - const template = "<>" - opts := deleteLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "deleteLegacySnapshot", + Use: "deleteLegacySnapshot", Short: "Remove One Legacy Backup Snapshot", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -83,19 +83,22 @@ func deleteLegacySnapshotBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } + type getLegacyBackupCheckpointOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string checkpointId string - clusterName string + clusterName string } func (opts *getLegacyBackupCheckpointOpts) initClient() func() error { @@ -106,38 +109,32 @@ func (opts *getLegacyBackupCheckpointOpts) initClient() func() error { } } -func (opts *getLegacyBackupCheckpointOpts) Run(ctx context.Context) error { +func (opts *getLegacyBackupCheckpointOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetLegacyBackupCheckpointApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, CheckpointId: opts.checkpointId, - ClusterName: opts.clusterName, + ClusterName: opts.clusterName, } resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getLegacyBackupCheckpointBuilder() *cobra.Command { - const template = "<>" - opts := getLegacyBackupCheckpointOpts{} cmd := &cobra.Command{ - Use: "getLegacyBackupCheckpoint", + Use: "getLegacyBackupCheckpoint", Short: "Return One Legacy Backup Checkpoint", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -146,19 +143,22 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the checkpoint.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("checkpointId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type getLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - jobId string + jobId string } func (opts *getLegacyBackupRestoreJobOpts) initClient() func() error { @@ -169,38 +169,32 @@ func (opts *getLegacyBackupRestoreJobOpts) initClient() func() error { } } -func (opts *getLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *getLegacyBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetLegacyBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - JobId: opts.jobId, + JobId: opts.jobId, } resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getLegacyBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - opts := getLegacyBackupRestoreJobOpts{} cmd := &cobra.Command{ - Use: "getLegacyBackupRestoreJob", + Use: "getLegacyBackupRestoreJob", Short: "Return One Legacy Backup Restore Job", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -209,19 +203,22 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVar(&opts.jobId, "jobId", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("jobId") return cmd } + type getLegacySnapshotOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string + snapshotId string } func (opts *getLegacySnapshotOpts) initClient() func() error { @@ -232,38 +229,32 @@ func (opts *getLegacySnapshotOpts) initClient() func() error { } } -func (opts *getLegacySnapshotOpts) Run(ctx context.Context) error { +func (opts *getLegacySnapshotOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetLegacySnapshotApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, + SnapshotId: opts.snapshotId, } resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getLegacySnapshotBuilder() *cobra.Command { - const template = "<>" - opts := getLegacySnapshotOpts{} cmd := &cobra.Command{ - Use: "getLegacySnapshot", + Use: "getLegacySnapshot", Short: "Return One Legacy Backup Snapshot", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -272,17 +263,20 @@ func getLegacySnapshotBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } + type getLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -294,9 +288,9 @@ func (opts *getLegacySnapshotScheduleOpts) initClient() func() error { } } -func (opts *getLegacySnapshotScheduleOpts) Run(ctx context.Context) error { +func (opts *getLegacySnapshotScheduleOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetLegacySnapshotScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params).Execute() @@ -304,27 +298,21 @@ func (opts *getLegacySnapshotScheduleOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getLegacySnapshotScheduleBuilder() *cobra.Command { - const template = "<>" - opts := getLegacySnapshotScheduleOpts{} cmd := &cobra.Command{ - Use: "getLegacySnapshotSchedule", + Use: "getLegacySnapshotSchedule", Short: "Return One Snapshot Schedule", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -332,20 +320,23 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listLegacyBackupCheckpointsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listLegacyBackupCheckpointsOpts) initClient() func() error { @@ -356,40 +347,34 @@ func (opts *listLegacyBackupCheckpointsOpts) initClient() func() error { } } -func (opts *listLegacyBackupCheckpointsOpts) Run(ctx context.Context) error { +func (opts *listLegacyBackupCheckpointsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListLegacyBackupCheckpointsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listLegacyBackupCheckpointsBuilder() *cobra.Command { - const template = "<>" - opts := listLegacyBackupCheckpointsOpts{} cmd := &cobra.Command{ - Use: "listLegacyBackupCheckpoints", + Use: "listLegacyBackupCheckpoints", Short: "Return All Legacy Backup Checkpoints", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -400,21 +385,24 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listLegacyBackupRestoreJobsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int - batchId string + pageNum int + batchId string } func (opts *listLegacyBackupRestoreJobsOpts) initClient() func() error { @@ -425,41 +413,35 @@ func (opts *listLegacyBackupRestoreJobsOpts) initClient() func() error { } } -func (opts *listLegacyBackupRestoreJobsOpts) Run(ctx context.Context) error { +func (opts *listLegacyBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListLegacyBackupRestoreJobsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - BatchId: &opts.batchId, + PageNum: &opts.pageNum, + BatchId: &opts.batchId, } resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listLegacyBackupRestoreJobsBuilder() *cobra.Command { - const template = "<>" - opts := listLegacyBackupRestoreJobsOpts{} cmd := &cobra.Command{ - Use: "listLegacyBackupRestoreJobs", + Use: "listLegacyBackupRestoreJobs", Short: "Return All Legacy Backup Restore Jobs", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -471,21 +453,24 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listLegacySnapshotsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int - completed string + pageNum int + completed string } func (opts *listLegacySnapshotsOpts) initClient() func() error { @@ -496,41 +481,35 @@ func (opts *listLegacySnapshotsOpts) initClient() func() error { } } -func (opts *listLegacySnapshotsOpts) Run(ctx context.Context) error { +func (opts *listLegacySnapshotsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListLegacySnapshotsApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Completed: &opts.completed, + PageNum: &opts.pageNum, + Completed: &opts.completed, } resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listLegacySnapshotsBuilder() *cobra.Command { - const template = "<>" - opts := listLegacySnapshotsOpts{} cmd := &cobra.Command{ - Use: "listLegacySnapshots", + Use: "listLegacySnapshots", Short: "Return All Legacy Backup Snapshots", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -542,19 +521,24 @@ func listLegacySnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completed, "completed", ""true"", `Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type updateLegacySnapshotRetentionOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - snapshotId string - + snapshotId string + + filename string + fs afero.Fs } func (opts *updateLegacySnapshotRetentionOpts) initClient() func() error { @@ -565,39 +549,62 @@ func (opts *updateLegacySnapshotRetentionOpts) initClient() func() error { } } -func (opts *updateLegacySnapshotRetentionOpts) Run(ctx context.Context) error { +func (opts *updateLegacySnapshotRetentionOpts) readData() (*admin.Snapshot, error) { + var out *admin.Snapshot + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateLegacySnapshotRetentionOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateLegacySnapshotRetentionApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotId: opts.snapshotId, - + SnapshotId: opts.snapshotId, + + Snapshot: data, } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateLegacySnapshotRetentionBuilder() *cobra.Command { - const template = "<>" - - opts := updateLegacySnapshotRetentionOpts{} + opts := updateLegacySnapshotRetentionOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateLegacySnapshotRetention", + Use: "updateLegacySnapshotRetention", Short: "Change One Legacy Backup Snapshot Expiration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -605,46 +612,47 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - - - cmd.Flags().StringVar(&opts.clusterId, "clusterId", "", `Unique 24-hexadecimal digit string that identifies the cluster with the snapshots you want to return.`) - cmd.Flags().BoolVar(&opts.complete, "complete", false, `Flag that indicates whether the snapshot exists. This flag returns `false` while MongoDB Cloud creates the snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BSONTimestampVar(&opts.created, "created", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.doNotDelete, "doNotDelete", false, `Flag that indicates whether someone can delete this snapshot. You can't set `"doNotDelete" : true` and set a timestamp for **expires** in the same request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.expires, "expires", "", `Date and time when MongoDB Cloud deletes the snapshot. If `"doNotDelete" : true`, MongoDB Cloud removes any value set for this parameter.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns the snapshots.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.incremental, "incremental", false, `Flag indicating if this is an incremental or a full snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BSONTimestampVar(&opts.lastOplogAppliedTimestamp, "lastOplogAppliedTimestamp", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.parts, "parts", nil, `Metadata that describes the complete snapshot. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- For a replica set, this array contains a single document. -- For a sharded cluster, this array contains one document for each shard plus one document for the config host.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd } + type updateLegacySnapshotScheduleOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *updateLegacySnapshotScheduleOpts) initClient() func() error { @@ -655,66 +663,90 @@ func (opts *updateLegacySnapshotScheduleOpts) initClient() func() error { } } -func (opts *updateLegacySnapshotScheduleOpts) Run(ctx context.Context) error { +func (opts *updateLegacySnapshotScheduleOpts) readData() (*admin.SnapshotSchedule, error) { + var out *admin.SnapshotSchedule + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateLegacySnapshotScheduleOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateLegacySnapshotScheduleApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + SnapshotSchedule: data, } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateLegacySnapshotScheduleBuilder() *cobra.Command { - const template = "<>" - - opts := updateLegacySnapshotScheduleOpts{} + opts := updateLegacySnapshotScheduleOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateLegacySnapshotSchedule", + Use: "updateLegacySnapshotSchedule", Short: "Update Snapshot Schedule for One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) - - cmd.Flags().IntVar(&opts.clusterCheckpointIntervalMin, "clusterCheckpointIntervalMin", 000, `Quantity of time expressed in minutes between successive cluster checkpoints. This parameter applies only to sharded clusters. This number determines the granularity of continuous cloud backups for sharded clusters.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterId, "clusterId", "", `Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.dailySnapshotRetentionDays, "dailySnapshotRetentionDays", 000, `Quantity of time to keep daily snapshots. MongoDB Cloud expresses this value in days. Set this value to `0` to disable daily snapshot retention.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.monthlySnapshotRetentionMonths, "monthlySnapshotRetentionMonths", 000, `Number of months that MongoDB Cloud must keep monthly snapshots. Set this value to `0` to disable monthly snapshot retention.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.pointInTimeWindowHours, "pointInTimeWindowHours", 000, `Number of hours before the current time from which MongoDB Cloud can create a Continuous Cloud Backup snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.snapshotIntervalHours, "snapshotIntervalHours", 000, `Number of hours that must elapse before taking another snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.snapshotRetentionDays, "snapshotRetentionDays", 000, `Number of days that MongoDB Cloud must keep recent snapshots.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.weeklySnapshotRetentionWeeks, "weeklySnapshotRetentionWeeks", 000, `Number of weeks that MongoDB Cloud must keep weekly snapshots. Set this value to `0` to disable weekly snapshot retention.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -723,8 +755,8 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { func legacyBackupBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "legacyBackup", - Short: `Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.`, + Use: "legacyBackup", + Short: `Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.`, } cmd.AddCommand( deleteLegacySnapshotBuilder(), @@ -740,4 +772,3 @@ func legacyBackupBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/generated/api_legacy_backup_restore_jobs_cmd.go index 966cf96e2d..c268300323 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/generated/api_legacy_backup_restore_jobs_cmd.go @@ -18,21 +18,29 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createLegacyBackupRestoreJobOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createLegacyBackupRestoreJobOpts) initClient() func() error { @@ -43,94 +51,106 @@ func (opts *createLegacyBackupRestoreJobOpts) initClient() func() error { } } -func (opts *createLegacyBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *createLegacyBackupRestoreJobOpts) readData() (*admin.RestoreJob, error) { + var out *admin.RestoreJob + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createLegacyBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateLegacyBackupRestoreJobApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + RestoreJob: data, } resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createLegacyBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - - opts := createLegacyBackupRestoreJobOpts{} + opts := createLegacyBackupRestoreJobOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createLegacyBackupRestoreJob", + Use: "createLegacyBackupRestoreJob", Short: "Create One Legacy Backup Restore Job", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) - - - cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch to which this restore job belongs. This parameter exists only for a sharded cluster restore.`) - cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the sharded cluster checkpoint. The checkpoint represents the point in time back to which you want to restore you data. This parameter applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. Use this parameter with sharded clusters only. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- If you set **checkpointId**, you can't set **oplogInc**, **oplogTs**, **snapshotId**, or **pointInTimeUTCMillis**. -- If you provide this parameter, this endpoint restores all data up to this checkpoint to the database you specify in the **delivery** object.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterId, "clusterId", "", `Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return. This parameter returns for restore clusters.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster containing the snapshots you want to retrieve.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when someone requested this restore job. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().RestoreJobDeliveryVar(&opts.delivery, "delivery", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.encryptionEnabled, "encryptionEnabled", false, `Flag that indicates whether someone encrypted the data in the restored snapshot.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that owns the snapshots.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.hashes, "hashes", nil, `List that contains documents mapping each restore file to a hashed checksum. This parameter applies after you download the corresponding **delivery.url**. If `"methodName" : "HTTP"`, this list contains one object that represents the hash of the **.tar.gz** file.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.masterKeyUUID, "masterKeyUUID", "", `Universally Unique Identifier (UUID) that identifies the Key Management Interoperability (KMIP) master key used to encrypt the snapshot data. This parameter applies only when `"encryptionEnabled" : "true"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.oplogInc, "oplogInc", 000, `Thirty-two-bit incrementing ordinal that represents operations within a given second. When paired with **oplogTs**, this represents the point in time to which MongoDB Cloud restores your data. This parameter applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- If you set **oplogInc**, you must set **oplogTs**, and can't set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. -- If you provide this parameter, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the **delivery** object.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.oplogTs, "oplogTs", "", `Date and time from which you want to restore this snapshot. This parameter expresses its value in ISO 8601 format in UTC. This represents the first part of an Oplog timestamp. When paired with **oplogInc**, they represent the last database operation to which you want to restore your data. This parameter applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. Run a query against **local.oplog.rs** on your replica set to find the desired timestamp. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- If you set **oplogTs**, you must set **oplogInc**, and you can't set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. -- If you provide this parameter, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the **delivery** object.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Int64Var(&opts.pointInTimeUTCMillis, "pointInTimeUTCMillis", 00, `Timestamp from which you want to restore this snapshot. This parameter expresses its value in the number of milliseconds elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). This timestamp must fall within the last 24 hours of the current time. This parameter applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- If you provide this parameter, this endpoint restores all data up to this point in time to the database you specified in the **delivery** object. -- If you set **pointInTimeUTCMillis**, you can't set **oplogInc**, **oplogTs**, **snapshotId**, or **checkpointId**.`) - - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the snapshot to restore. If you set **snapshotId**, you can't set **oplogInc**, **oplogTs**, **pointInTimeUTCMillis**, or **checkpointId**.`) - - cmd.Flags().StringVar(&opts.statusName, "statusName", "", `Human-readable label that identifies the status of the downloadable file at the time of the request.`) - - cmd.Flags().BSONTimestampVar(&opts.timestamp, "timestamp", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -139,12 +159,11 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { func legacyBackupRestoreJobsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "legacyBackupRestoreJobs", - Short: ``, + Use: "legacyBackupRestoreJobs", + Short: ``, } cmd.AddCommand( createLegacyBackupRestoreJobBuilder(), ) return cmd } - diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/generated/api_maintenance_windows__cmd.go index 774c532425..2634411af3 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/generated/api_maintenance_windows__cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -39,7 +47,7 @@ func (opts *deferMaintenanceWindowOpts) initClient() func() error { } } -func (opts *deferMaintenanceWindowOpts) Run(ctx context.Context) error { +func (opts *deferMaintenanceWindowOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, } @@ -48,33 +56,30 @@ func (opts *deferMaintenanceWindowOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func deferMaintenanceWindowBuilder() *cobra.Command { - const template = "<>" - opts := deferMaintenanceWindowOpts{} cmd := &cobra.Command{ Use: "deferMaintenanceWindow", Short: "Defer One Maintenance Window for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -94,7 +99,7 @@ func (opts *getMaintenanceWindowOpts) initClient() func() error { } } -func (opts *getMaintenanceWindowOpts) Run(ctx context.Context) error { +func (opts *getMaintenanceWindowOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, } @@ -103,33 +108,30 @@ func (opts *getMaintenanceWindowOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getMaintenanceWindowBuilder() *cobra.Command { - const template = "<>" - opts := getMaintenanceWindowOpts{} cmd := &cobra.Command{ Use: "getMaintenanceWindow", Short: "Return One Maintenance Window for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -149,7 +151,7 @@ func (opts *resetMaintenanceWindowOpts) initClient() func() error { } } -func (opts *resetMaintenanceWindowOpts) Run(ctx context.Context) error { +func (opts *resetMaintenanceWindowOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, } @@ -158,33 +160,30 @@ func (opts *resetMaintenanceWindowOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func resetMaintenanceWindowBuilder() *cobra.Command { - const template = "<>" - opts := resetMaintenanceWindowOpts{} cmd := &cobra.Command{ Use: "resetMaintenanceWindow", Short: "Reset One Maintenance Window for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -204,7 +203,7 @@ func (opts *toggleMaintenanceAutoDeferOpts) initClient() func() error { } } -func (opts *toggleMaintenanceAutoDeferOpts) Run(ctx context.Context) error { +func (opts *toggleMaintenanceAutoDeferOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, } @@ -213,33 +212,30 @@ func (opts *toggleMaintenanceAutoDeferOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func toggleMaintenanceAutoDeferBuilder() *cobra.Command { - const template = "<>" - opts := toggleMaintenanceAutoDeferOpts{} cmd := &cobra.Command{ Use: "toggleMaintenanceAutoDefer", Short: "Toggle Automatic Deferral of Maintenance for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -249,6 +245,9 @@ type updateMaintenanceWindowOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *updateMaintenanceWindowOpts) initClient() func() error { @@ -259,60 +258,76 @@ func (opts *updateMaintenanceWindowOpts) initClient() func() error { } } -func (opts *updateMaintenanceWindowOpts) Run(ctx context.Context) error { +func (opts *updateMaintenanceWindowOpts) readData() (*admin.GroupMaintenanceWindow, error) { + var out *admin.GroupMaintenanceWindow + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateMaintenanceWindowOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateMaintenanceWindowApiParams{ GroupId: opts.groupId, + + GroupMaintenanceWindow: data, } resp, _, err := opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateMaintenanceWindowBuilder() *cobra.Command { - const template = "<>" - - opts := updateMaintenanceWindowOpts{} + opts := updateMaintenanceWindowOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateMaintenanceWindow", Short: "Update Maintenance Window for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().BoolVar(&opts.autoDeferOnceEnabled, "autoDeferOnceEnabled", false, `Flag that indicates whether MongoDB Cloud should defer all maintenance windows for one week after you enable them.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.dayOfWeek, "dayOfWeek", 000, `One-based integer that represents the day of the week that the maintenance window starts. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -| Value | Day of Week | -|---|---| -| `1` | Sunday | -| `2` | Monday | -| `3` | Tuesday | -| `4` | Wednesday | -| `5` | Thursday | -| `6` | Friday | -| `7` | Saturday | -`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.hourOfDay, "hourOfDay", 000, `Zero-based integer that represents the hour of the of the day that the maintenance window starts according to a 24-hour clock. Use `0` for midnight and `12` for noon.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.startASAP, "startASAP", false, `Flag that indicates whether MongoDB Cloud starts the maintenance window immediately upon receiving this request. To start the maintenance window immediately for your project, MongoDB Cloud must have maintenance scheduled and you must set a maintenance window. This flag resets to `false` after MongoDB Cloud completes maintenance.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/generated/api_mongo_db_cloud_users_cmd.go index d9a0c55bbe..db500f9e72 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/generated/api_mongo_db_cloud_users_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -28,6 +36,9 @@ type createUserOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient + + filename string + fs afero.Fs } func (opts *createUserOpts) initClient() func() error { @@ -38,62 +49,90 @@ func (opts *createUserOpts) initClient() func() error { } } -func (opts *createUserOpts) Run(ctx context.Context) error { - params := &admin.CreateUserApiParams{} +func (opts *createUserOpts) readData() (*admin.AppUser, error) { + var out *admin.AppUser + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createUserOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.CreateUserApiParams{ + + AppUser: data, + } resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createUserBuilder() *cobra.Command { - const template = "<>" - - opts := createUserOpts{} + opts := createUserOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createUser", Short: "Create One MongoDB Cloud User", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.country, "country", "", `Two alphabet characters that identifies MongoDB Cloud user's geographic location. This parameter uses the ISO 3166-1a2 code format.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.createdAt, "createdAt", "", `Date and time when the current account is created. This value is in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.emailAddress, "emailAddress", "", `Email address that belongs to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.firstName, "firstName", "", `First or given name that belongs to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.lastAuth, "lastAuth", "", `Date and time when the current account last authenticated. This value is in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.lastName, "lastName", "", `Last name, family name, or surname that belongs to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mobileNumber, "mobileNumber", "", `Mobile phone number that belongs to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.password, "password", "", `Password applied with the username to log in to MongoDB Cloud. MongoDB Cloud does not return this parameter except in response to creating a new MongoDB Cloud user. Only the MongoDB Cloud user can update their password after it has been set from the MongoDB Cloud console.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of objects that display the MongoDB Cloud user's roles and the corresponding organization or project to which that role applies. A role can apply to one organization or one project but not both.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.teamIds, "teamIds", nil, `List of unique 24-hexadecimal digit strings that identifies the teams to which this MongoDB Cloud user belongs.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.username, "username", "", `Email address that represents the username of the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } @@ -113,7 +152,7 @@ func (opts *getUserOpts) initClient() func() error { } } -func (opts *getUserOpts) Run(ctx context.Context) error { +func (opts *getUserOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetUserApiParams{ UserId: opts.userId, } @@ -122,31 +161,28 @@ func (opts *getUserOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getUserBuilder() *cobra.Command { - const template = "<>" - opts := getUserOpts{} cmd := &cobra.Command{ Use: "getUser", Short: "Return One MongoDB Cloud User using Its ID", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies this user.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("userId") return cmd } @@ -166,7 +202,7 @@ func (opts *getUserByUsernameOpts) initClient() func() error { } } -func (opts *getUserByUsernameOpts) Run(ctx context.Context) error { +func (opts *getUserByUsernameOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetUserByUsernameApiParams{ UserName: opts.userName, } @@ -175,31 +211,28 @@ func (opts *getUserByUsernameOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getUserByUsernameBuilder() *cobra.Command { - const template = "<>" - opts := getUserByUsernameOpts{} cmd := &cobra.Command{ Use: "getUserByUsername", Short: "Return One MongoDB Cloud User using Their Username", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.userName, "userName", "", `Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("userName") return cmd } diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/generated/api_monitoring_and_logs_cmd.go index f38fa8b0b4..3066ca351e 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/generated/api_monitoring_and_logs_cmd.go @@ -18,8 +18,12 @@ package generated import ( "context" + "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -40,7 +44,7 @@ func (opts *getAtlasProcessOpts) initClient() func() error { } } -func (opts *getAtlasProcessOpts) Run(ctx context.Context) error { +func (opts *getAtlasProcessOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetAtlasProcessApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -50,27 +54,21 @@ func (opts *getAtlasProcessOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getAtlasProcessBuilder() *cobra.Command { - const template = "<>" - opts := getAtlasProcessOpts{} cmd := &cobra.Command{ Use: "getAtlasProcess", Short: "Return One MongoDB Process by ID", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -78,6 +76,9 @@ func getAtlasProcessBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd @@ -100,7 +101,7 @@ func (opts *getDatabaseOpts) initClient() func() error { } } -func (opts *getDatabaseOpts) Run(ctx context.Context) error { +func (opts *getDatabaseOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetDatabaseApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, @@ -111,27 +112,21 @@ func (opts *getDatabaseOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getDatabaseBuilder() *cobra.Command { - const template = "<>" - opts := getDatabaseOpts{} cmd := &cobra.Command{ Use: "getDatabase", Short: "Return One Database for a MongoDB Process", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -140,6 +135,9 @@ func getDatabaseBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") @@ -168,7 +166,7 @@ func (opts *getDatabaseMeasurementsOpts) initClient() func() error { } } -func (opts *getDatabaseMeasurementsOpts) Run(ctx context.Context) error { +func (opts *getDatabaseMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetDatabaseMeasurementsApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, @@ -184,27 +182,21 @@ func (opts *getDatabaseMeasurementsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getDatabaseMeasurementsBuilder() *cobra.Command { - const template = "<>" - opts := getDatabaseMeasurementsOpts{} cmd := &cobra.Command{ Use: "getDatabaseMeasurements", Short: "Return Measurements of One Database for One MongoDB Process", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -218,6 +210,9 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") @@ -247,7 +242,7 @@ func (opts *getDiskMeasurementsOpts) initClient() func() error { } } -func (opts *getDiskMeasurementsOpts) Run(ctx context.Context) error { +func (opts *getDiskMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetDiskMeasurementsApiParams{ GroupId: opts.groupId, PartitionName: opts.partitionName, @@ -263,27 +258,21 @@ func (opts *getDiskMeasurementsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getDiskMeasurementsBuilder() *cobra.Command { - const template = "<>" - opts := getDiskMeasurementsOpts{} cmd := &cobra.Command{ Use: "getDiskMeasurements", Short: "Return Measurements of One Disk for One MongoDB Process", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -297,6 +286,9 @@ func getDiskMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("processId") @@ -323,7 +315,7 @@ func (opts *getHostLogsOpts) initClient() func() error { } } -func (opts *getHostLogsOpts) Run(ctx context.Context) error { +func (opts *getHostLogsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetHostLogsApiParams{ GroupId: opts.groupId, HostName: opts.hostName, @@ -336,27 +328,21 @@ func (opts *getHostLogsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getHostLogsBuilder() *cobra.Command { - const template = "<>" - opts := getHostLogsOpts{} cmd := &cobra.Command{ Use: "getHostLogs", Short: "Download Logs for One Multi-Cloud Cluster Host in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -367,6 +353,9 @@ func getHostLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostName") _ = cmd.MarkFlagRequired("logName") @@ -394,7 +383,7 @@ func (opts *getHostMeasurementsOpts) initClient() func() error { } } -func (opts *getHostMeasurementsOpts) Run(ctx context.Context) error { +func (opts *getHostMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetHostMeasurementsApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -409,27 +398,21 @@ func (opts *getHostMeasurementsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getHostMeasurementsBuilder() *cobra.Command { - const template = "<>" - opts := getHostMeasurementsOpts{} cmd := &cobra.Command{ Use: "getHostMeasurements", Short: "Return Measurements for One MongoDB Process", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -442,6 +425,9 @@ func getHostMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") @@ -472,7 +458,7 @@ func (opts *getIndexMetricsOpts) initClient() func() error { } } -func (opts *getIndexMetricsOpts) Run(ctx context.Context) error { +func (opts *getIndexMetricsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetIndexMetricsApiParams{ ProcessId: opts.processId, IndexName: opts.indexName, @@ -490,27 +476,21 @@ func (opts *getIndexMetricsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getIndexMetricsBuilder() *cobra.Command { - const template = "<>" - opts := getIndexMetricsOpts{} cmd := &cobra.Command{ Use: "getIndexMetrics", Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -526,6 +506,9 @@ func getIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("indexName") _ = cmd.MarkFlagRequired("databaseName") @@ -557,7 +540,7 @@ func (opts *getMeasurementsOpts) initClient() func() error { } } -func (opts *getMeasurementsOpts) Run(ctx context.Context) error { +func (opts *getMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetMeasurementsApiParams{ ProcessId: opts.processId, GroupId: opts.groupId, @@ -572,27 +555,21 @@ func (opts *getMeasurementsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getMeasurementsBuilder() *cobra.Command { - const template = "<>" - opts := getMeasurementsOpts{} cmd := &cobra.Command{ Use: "getMeasurements", Short: "Return Atlas Search Hardware and Status Metrics", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -605,6 +582,9 @@ func getMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("granularity") @@ -630,7 +610,7 @@ func (opts *listAtlasProcessesOpts) initClient() func() error { } } -func (opts *listAtlasProcessesOpts) Run(ctx context.Context) error { +func (opts *listAtlasProcessesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListAtlasProcessesApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -642,27 +622,21 @@ func (opts *listAtlasProcessesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listAtlasProcessesBuilder() *cobra.Command { - const template = "<>" - opts := listAtlasProcessesOpts{} cmd := &cobra.Command{ Use: "listAtlasProcesses", Short: "Return All MongoDB Processes in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -672,6 +646,9 @@ func listAtlasProcessesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -695,7 +672,7 @@ func (opts *listDatabasesOpts) initClient() func() error { } } -func (opts *listDatabasesOpts) Run(ctx context.Context) error { +func (opts *listDatabasesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListDatabasesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -708,27 +685,21 @@ func (opts *listDatabasesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listDatabasesBuilder() *cobra.Command { - const template = "<>" - opts := listDatabasesOpts{} cmd := &cobra.Command{ Use: "listDatabases", Short: "Return Available Databases for One MongoDB Process", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -739,6 +710,9 @@ func listDatabasesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd @@ -761,7 +735,7 @@ func (opts *listDiskMeasurementsOpts) initClient() func() error { } } -func (opts *listDiskMeasurementsOpts) Run(ctx context.Context) error { +func (opts *listDiskMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListDiskMeasurementsApiParams{ PartitionName: opts.partitionName, GroupId: opts.groupId, @@ -772,27 +746,21 @@ func (opts *listDiskMeasurementsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listDiskMeasurementsBuilder() *cobra.Command { - const template = "<>" - opts := listDiskMeasurementsOpts{} cmd := &cobra.Command{ Use: "listDiskMeasurements", Short: "Return Measurements of One Disk", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) @@ -801,6 +769,9 @@ func listDiskMeasurementsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -826,7 +797,7 @@ func (opts *listDiskPartitionsOpts) initClient() func() error { } } -func (opts *listDiskPartitionsOpts) Run(ctx context.Context) error { +func (opts *listDiskPartitionsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListDiskPartitionsApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -839,27 +810,21 @@ func (opts *listDiskPartitionsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listDiskPartitionsBuilder() *cobra.Command { - const template = "<>" - opts := listDiskPartitionsOpts{} cmd := &cobra.Command{ Use: "listDiskPartitions", Short: "Return Available Disks for One MongoDB Process", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -870,6 +835,9 @@ func listDiskPartitionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd @@ -898,7 +866,7 @@ func (opts *listIndexMetricsOpts) initClient() func() error { } } -func (opts *listIndexMetricsOpts) Run(ctx context.Context) error { +func (opts *listIndexMetricsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListIndexMetricsApiParams{ ProcessId: opts.processId, DatabaseName: opts.databaseName, @@ -915,27 +883,21 @@ func (opts *listIndexMetricsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listIndexMetricsBuilder() *cobra.Command { - const template = "<>" - opts := listIndexMetricsOpts{} cmd := &cobra.Command{ Use: "listIndexMetrics", Short: "Return All Atlas Search Index Metrics for One Namespace", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -950,6 +912,9 @@ func listIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("collectionName") @@ -975,7 +940,7 @@ func (opts *listMetricTypesOpts) initClient() func() error { } } -func (opts *listMetricTypesOpts) Run(ctx context.Context) error { +func (opts *listMetricTypesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListMetricTypesApiParams{ ProcessId: opts.processId, GroupId: opts.groupId, @@ -985,27 +950,21 @@ func (opts *listMetricTypesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listMetricTypesBuilder() *cobra.Command { - const template = "<>" - opts := listMetricTypesOpts{} cmd := &cobra.Command{ Use: "listMetricTypes", Short: "Return All Atlas Search Metric Types for One Process", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -1013,6 +972,9 @@ func listMetricTypesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/generated/api_multi_cloud_clusters_cmd.go index f2e86e4700..3bb7db106a 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/generated/api_multi_cloud_clusters_cmd.go @@ -18,20 +18,28 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *createClusterOpts) initClient() func() error { @@ -42,98 +50,123 @@ func (opts *createClusterOpts) initClient() func() error { } } -func (opts *createClusterOpts) Run(ctx context.Context) error { +func (opts *createClusterOpts) readData() (*admin.ClusterDescriptionV15, error) { + var out *admin.ClusterDescriptionV15 + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createClusterOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, - + + ClusterDescriptionV15: data, } resp, _, err := opts.client.MultiCloudClustersApi.CreateClusterWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createClusterBuilder() *cobra.Command { - const template = "<>" - - opts := createClusterOpts{} + opts := createClusterOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createCluster", + Use: "createCluster", Short: "Create One Multi-Cloud Cluster from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().BoolVar(&opts.backupEnabled, "backupEnabled", false, `Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses [Cloud Backups](https://docs.atlas.mongodb.com/backup/cloud-backup/overview/) for dedicated clusters and [Shared Cluster Backups](https://docs.atlas.mongodb.com/backup/shared-tier/overview/) for tenant clusters. If set to `false`, the cluster doesn't use backups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BiConnectorVar(&opts.biConnector, "biConnector", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterType, "clusterType", "", `Configuration of nodes that comprise the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ClusterDescriptionConnectionStringsVar(&opts.connectionStrings, "connectionStrings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.createDate, "createDate", "", `Date and time when MongoDB Cloud created this cluster. This parameter expresses its value in ISO 8601 format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Float64Var(&opts.diskSizeGB, "diskSizeGB", 00, `Storage capacity that the host's root volume possesses expressed in gigabytes. Increase this number to add capacity. MongoDB Cloud requires this parameter if you set **replicationSpecs**. If you specify a disk size below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations depend on whether you choose the default value or a custom value. The maximum value for disk storage cannot exceed 50 times the maximum RAM for the selected cluster. If you require more storage space, consider upgrading your cluster to a higher tier.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.encryptionAtRestProvider, "encryptionAtRestProvider", "", `Cloud service provider that manages your customer keys to provide an additional layer of encryption at rest for the cluster. To enable customer key management for encryption at rest, the cluster **replicationSpecs[n].regionConfigs[m].{type}Specs.instanceSize** setting must be `M10` or higher and `"backupEnabled" : false` or omitted entirely.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the replication object for a zone in a Global Cluster. If you include existing zones in the request, you must specify this parameter. If you add a new zone to an existing Global Cluster, you may specify this parameter. The request deletes any existing zones in a Global Cluster that you exclude from the request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoDBMajorVersion, "mongoDBMajorVersion", ""6.0"", `Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoDBVersion, "mongoDBVersion", "", `Version of MongoDB that the cluster runs.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the advanced cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether the cluster is paused.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.pitEnabled, "pitEnabled", false, `Flag that indicates whether the cluster uses continuous cloud backups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.replicationSpecs, "replicationSpecs", nil, `List of settings that configure your cluster regions. For Global Clusters, each object in the array represents a zone where your clusters nodes deploy. For non-Global sharded clusters and replica sets, this array has one object representing where your clusters nodes deploy.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.rootCertType, "rootCertType", ""ISRGROOTX1"", `Root Certificate Authority that MongoDB Cloud cluster uses. MongoDB Cloud supports Internet Security Research Group.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of this cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.tags, "tags", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the cluster. If set to `true`, MongoDB Cloud won't delete the cluster. If set to `false`, MongoDB Cloud will delete the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.versionReleaseSystem, "versionReleaseSystem", ""LTS"", `Method by which the cluster maintains the MongoDB versions. If value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type deleteClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string retainBackups bool } @@ -145,10 +178,10 @@ func (opts *deleteClusterOpts) initClient() func() error { } } -func (opts *deleteClusterOpts) Run(ctx context.Context) error { +func (opts *deleteClusterOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteClusterApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, RetainBackups: &opts.retainBackups, } _, err := opts.client.MultiCloudClustersApi.DeleteClusterWithParams(ctx, params).Execute() @@ -156,27 +189,21 @@ func (opts *deleteClusterOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func deleteClusterBuilder() *cobra.Command { - const template = "<>" - opts := deleteClusterOpts{} cmd := &cobra.Command{ - Use: "deleteCluster", + Use: "deleteCluster", Short: "Remove One Multi-Cloud Cluster from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -185,16 +212,19 @@ func deleteClusterBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type getClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -206,9 +236,9 @@ func (opts *getClusterOpts) initClient() func() error { } } -func (opts *getClusterOpts) Run(ctx context.Context) error { +func (opts *getClusterOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetClusterApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } resp, _, err := opts.client.MultiCloudClustersApi.GetClusterWithParams(ctx, params).Execute() @@ -216,27 +246,21 @@ func (opts *getClusterOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getClusterBuilder() *cobra.Command { - const template = "<>" - opts := getClusterOpts{} cmd := &cobra.Command{ - Use: "getCluster", + Use: "getCluster", Short: "Return One Multi-Cloud Cluster from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -244,19 +268,22 @@ func getClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listClustersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listClustersOpts) initClient() func() error { @@ -267,39 +294,33 @@ func (opts *listClustersOpts) initClient() func() error { } } -func (opts *listClustersOpts) Run(ctx context.Context) error { +func (opts *listClustersOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListClustersApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.MultiCloudClustersApi.ListClustersWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listClustersBuilder() *cobra.Command { - const template = "<>" - opts := listClustersOpts{} cmd := &cobra.Command{ - Use: "listClusters", + Use: "listClusters", Short: "Return All Multi-Cloud Clusters from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -309,15 +330,18 @@ func listClustersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type testFailoverOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string } @@ -329,9 +353,9 @@ func (opts *testFailoverOpts) initClient() func() error { } } -func (opts *testFailoverOpts) Run(ctx context.Context) error { +func (opts *testFailoverOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.TestFailoverApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, } _, err := opts.client.MultiCloudClustersApi.TestFailoverWithParams(ctx, params).Execute() @@ -339,27 +363,21 @@ func (opts *testFailoverOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func testFailoverBuilder() *cobra.Command { - const template = "<>" - opts := testFailoverOpts{} cmd := &cobra.Command{ - Use: "testFailover", + Use: "testFailover", Short: "Test Failover for One Multi-Cloud Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -367,18 +385,23 @@ func testFailoverBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type updateClusterOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *updateClusterOpts) initClient() func() error { @@ -389,90 +412,114 @@ func (opts *updateClusterOpts) initClient() func() error { } } -func (opts *updateClusterOpts) Run(ctx context.Context) error { +func (opts *updateClusterOpts) readData() (*admin.ClusterDescriptionV15, error) { + var out *admin.ClusterDescriptionV15 + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateClusterOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateClusterApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + ClusterDescriptionV15: data, } resp, _, err := opts.client.MultiCloudClustersApi.UpdateClusterWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateClusterBuilder() *cobra.Command { - const template = "<>" - - opts := updateClusterOpts{} + opts := updateClusterOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateCluster", + Use: "updateCluster", Short: "Modify One Multi-Cloud Cluster from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the advanced cluster to modify.`) - - cmd.Flags().BoolVar(&opts.backupEnabled, "backupEnabled", false, `Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses [Cloud Backups](https://docs.atlas.mongodb.com/backup/cloud-backup/overview/) for dedicated clusters and [Shared Cluster Backups](https://docs.atlas.mongodb.com/backup/shared-tier/overview/) for tenant clusters. If set to `false`, the cluster doesn't use backups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BiConnectorVar(&opts.biConnector, "biConnector", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.clusterType, "clusterType", "", `Configuration of nodes that comprise the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ClusterDescriptionConnectionStringsVar(&opts.connectionStrings, "connectionStrings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.createDate, "createDate", "", `Date and time when MongoDB Cloud created this cluster. This parameter expresses its value in ISO 8601 format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().Float64Var(&opts.diskSizeGB, "diskSizeGB", 00, `Storage capacity that the host's root volume possesses expressed in gigabytes. Increase this number to add capacity. MongoDB Cloud requires this parameter if you set **replicationSpecs**. If you specify a disk size below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations depend on whether you choose the default value or a custom value. The maximum value for disk storage cannot exceed 50 times the maximum RAM for the selected cluster. If you require more storage space, consider upgrading your cluster to a higher tier.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.encryptionAtRestProvider, "encryptionAtRestProvider", "", `Cloud service provider that manages your customer keys to provide an additional layer of encryption at rest for the cluster. To enable customer key management for encryption at rest, the cluster **replicationSpecs[n].regionConfigs[m].{type}Specs.instanceSize** setting must be `M10` or higher and `"backupEnabled" : false` or omitted entirely.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the replication object for a zone in a Global Cluster. If you include existing zones in the request, you must specify this parameter. If you add a new zone to an existing Global Cluster, you may specify this parameter. The request deletes any existing zones in a Global Cluster that you exclude from the request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.labels, "labels", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoDBMajorVersion, "mongoDBMajorVersion", ""6.0"", `Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.mongoDBVersion, "mongoDBVersion", "", `Version of MongoDB that the cluster runs.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the advanced cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether the cluster is paused.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.pitEnabled, "pitEnabled", false, `Flag that indicates whether the cluster uses continuous cloud backups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.replicationSpecs, "replicationSpecs", nil, `List of settings that configure your cluster regions. For Global Clusters, each object in the array represents a zone where your clusters nodes deploy. For non-Global sharded clusters and replica sets, this array has one object representing where your clusters nodes deploy.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.rootCertType, "rootCertType", ""ISRGROOTX1"", `Root Certificate Authority that MongoDB Cloud cluster uses. MongoDB Cloud supports Internet Security Research Group.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of this cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.tags, "tags", nil, `Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the cluster. If set to `true`, MongoDB Cloud won't delete the cluster. If set to `false`, MongoDB Cloud will delete the cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.versionReleaseSystem, "versionReleaseSystem", ""LTS"", `Method by which the cluster maintains the MongoDB versions. If value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -481,8 +528,8 @@ func updateClusterBuilder() *cobra.Command { func multiCloudClustersBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "multiCloudClusters", - Short: `Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. + Use: "multiCloudClusters", + Short: `Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. The total number of nodes in clusters spanning across regions has a specific constraint on a per-project basis. MongoDB Cloud limits the total number of nodes in other regions in one project to a total of 40. This total excludes Google Cloud regions communicating with each other, shared-tier clusters, or serverless clusters. The total number of nodes between any two regions must meet this constraint. For example, if a project has nodes in clusters spread across three regions: 30 nodes in Region A, 10 nodes in Region B, and 5 nodes in Region C, you can add only 5 more nodes to Region C because if you exclude Region C, Region A + Region B = 40. If you exclude Region B, Region A + Region C = 35, <= 40. If you exclude Region A, Region B + Region C = 15, <= 40. Each combination of regions with the added 5 nodes still meets the per-project constraint. Region A + B = 40. Region A + C = 40. Region B + C = 20. You can't create a multi-region cluster in a project if it has one or more clusters spanning 40 or more nodes in other regions. Each project supports up to 25 database deployments. @@ -498,4 +545,3 @@ If your MongoDB Cloud project contains a custom role that uses actions introduce ) return cmd } - diff --git a/internal/generated/api_network_peering_cmd.go b/internal/generated/api_network_peering_cmd.go index 29d2ad8831..b3f8dd06d6 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/generated/api_network_peering_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -29,6 +37,9 @@ type createPeeringConnectionOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *createPeeringConnectionOpts) initClient() func() error { @@ -39,42 +50,69 @@ func (opts *createPeeringConnectionOpts) initClient() func() error { } } -func (opts *createPeeringConnectionOpts) Run(ctx context.Context) error { +func (opts *createPeeringConnectionOpts) readData() (*admin.ContainerPeer, error) { + var out *admin.ContainerPeer + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createPeeringConnectionOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, + + ContainerPeer: data, } resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createPeeringConnectionBuilder() *cobra.Command { - const template = "<>" - - opts := createPeeringConnectionOpts{} + opts := createPeeringConnectionOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createPeeringConnection", Short: "Create One New Network Peering Connection", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -84,6 +122,9 @@ type createPeeringContainerOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *createPeeringContainerOpts) initClient() func() error { @@ -94,42 +135,69 @@ func (opts *createPeeringContainerOpts) initClient() func() error { } } -func (opts *createPeeringContainerOpts) Run(ctx context.Context) error { +func (opts *createPeeringContainerOpts) readData() (*admin.CloudProviderContainer, error) { + var out *admin.CloudProviderContainer + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createPeeringContainerOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreatePeeringContainerApiParams{ GroupId: opts.groupId, + + CloudProviderContainer: data, } resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createPeeringContainerBuilder() *cobra.Command { - const template = "<>" - - opts := createPeeringContainerOpts{} + opts := createPeeringContainerOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createPeeringContainer", Short: "Create One New Network Peering Container", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -150,7 +218,7 @@ func (opts *deletePeeringConnectionOpts) initClient() func() error { } } -func (opts *deletePeeringConnectionOpts) Run(ctx context.Context) error { +func (opts *deletePeeringConnectionOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeletePeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, @@ -160,27 +228,21 @@ func (opts *deletePeeringConnectionOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deletePeeringConnectionBuilder() *cobra.Command { - const template = "<>" - opts := deletePeeringConnectionOpts{} cmd := &cobra.Command{ Use: "deletePeeringConnection", Short: "Remove One Existing Network Peering Connection", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -188,6 +250,9 @@ func deletePeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd @@ -209,7 +274,7 @@ func (opts *deletePeeringContainerOpts) initClient() func() error { } } -func (opts *deletePeeringContainerOpts) Run(ctx context.Context) error { +func (opts *deletePeeringContainerOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeletePeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, @@ -219,27 +284,21 @@ func (opts *deletePeeringContainerOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deletePeeringContainerBuilder() *cobra.Command { - const template = "<>" - opts := deletePeeringContainerOpts{} cmd := &cobra.Command{ Use: "deletePeeringContainer", Short: "Remove One Network Peering Container", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -247,6 +306,9 @@ func deletePeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd @@ -257,6 +319,9 @@ type disablePeeringOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *disablePeeringOpts) initClient() func() error { @@ -267,43 +332,70 @@ func (opts *disablePeeringOpts) initClient() func() error { } } -func (opts *disablePeeringOpts) Run(ctx context.Context) error { +func (opts *disablePeeringOpts) readData() (*admin.PrivateIPMode, error) { + var out *admin.PrivateIPMode + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *disablePeeringOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.DisablePeeringApiParams{ GroupId: opts.groupId, + + PrivateIPMode: data, } resp, _, err := opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func disablePeeringBuilder() *cobra.Command { - const template = "<>" - - opts := disablePeeringOpts{} + opts := disablePeeringOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "disablePeering", Short: "Disable Connect via Peering Only Mode for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled **Connect via Peering Only** mode for the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -325,7 +417,7 @@ func (opts *getPeeringConnectionOpts) initClient() func() error { } } -func (opts *getPeeringConnectionOpts) Run(ctx context.Context) error { +func (opts *getPeeringConnectionOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetPeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, @@ -335,27 +427,21 @@ func (opts *getPeeringConnectionOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getPeeringConnectionBuilder() *cobra.Command { - const template = "<>" - opts := getPeeringConnectionOpts{} cmd := &cobra.Command{ Use: "getPeeringConnection", Short: "Return One Network Peering Connection in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -363,6 +449,9 @@ func getPeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd @@ -384,7 +473,7 @@ func (opts *getPeeringContainerOpts) initClient() func() error { } } -func (opts *getPeeringContainerOpts) Run(ctx context.Context) error { +func (opts *getPeeringContainerOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetPeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, @@ -394,27 +483,21 @@ func (opts *getPeeringContainerOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getPeeringContainerBuilder() *cobra.Command { - const template = "<>" - opts := getPeeringContainerOpts{} cmd := &cobra.Command{ Use: "getPeeringContainer", Short: "Return One Network Peering Container", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -422,6 +505,9 @@ func getPeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd @@ -446,7 +532,7 @@ func (opts *listPeeringConnectionsOpts) initClient() func() error { } } -func (opts *listPeeringConnectionsOpts) Run(ctx context.Context) error { +func (opts *listPeeringConnectionsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPeeringConnectionsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -459,27 +545,21 @@ func (opts *listPeeringConnectionsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPeeringConnectionsBuilder() *cobra.Command { - const template = "<>" - opts := listPeeringConnectionsOpts{} cmd := &cobra.Command{ Use: "listPeeringConnections", Short: "Return All Network Peering Connections in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -490,6 +570,9 @@ func listPeeringConnectionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider to use for this VPC peering connection.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -513,7 +596,7 @@ func (opts *listPeeringContainerByCloudProviderOpts) initClient() func() error { } } -func (opts *listPeeringContainerByCloudProviderOpts) Run(ctx context.Context) error { +func (opts *listPeeringContainerByCloudProviderOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, ProviderName: &opts.providerName, @@ -526,27 +609,21 @@ func (opts *listPeeringContainerByCloudProviderOpts) Run(ctx context.Context) er return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPeeringContainerByCloudProviderBuilder() *cobra.Command { - const template = "<>" - opts := listPeeringContainerByCloudProviderOpts{} cmd := &cobra.Command{ Use: "listPeeringContainerByCloudProvider", Short: "Return All Network Peering Containers in One Project for One Cloud Provider", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -557,6 +634,9 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("providerName") return cmd @@ -580,7 +660,7 @@ func (opts *listPeeringContainersOpts) initClient() func() error { } } -func (opts *listPeeringContainersOpts) Run(ctx context.Context) error { +func (opts *listPeeringContainersOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPeeringContainersApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -592,27 +672,21 @@ func (opts *listPeeringContainersOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPeeringContainersBuilder() *cobra.Command { - const template = "<>" - opts := listPeeringContainersOpts{} cmd := &cobra.Command{ Use: "listPeeringContainers", Short: "Return All Network Peering Containers in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -622,6 +696,9 @@ func listPeeringContainersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -632,6 +709,9 @@ type updatePeeringConnectionOpts struct { client *admin.APIClient groupId string peerId string + + filename string + fs afero.Fs } func (opts *updatePeeringConnectionOpts) initClient() func() error { @@ -642,37 +722,61 @@ func (opts *updatePeeringConnectionOpts) initClient() func() error { } } -func (opts *updatePeeringConnectionOpts) Run(ctx context.Context) error { +func (opts *updatePeeringConnectionOpts) readData() (*admin.ContainerPeer, error) { + var out *admin.ContainerPeer + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updatePeeringConnectionOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdatePeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, + + ContainerPeer: data, } resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updatePeeringConnectionBuilder() *cobra.Command { - const template = "<>" - - opts := updatePeeringConnectionOpts{} + opts := updatePeeringConnectionOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updatePeeringConnection", Short: "Update One New Network Peering Connection", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -680,6 +784,9 @@ func updatePeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd @@ -691,6 +798,9 @@ type updatePeeringContainerOpts struct { client *admin.APIClient groupId string containerId string + + filename string + fs afero.Fs } func (opts *updatePeeringContainerOpts) initClient() func() error { @@ -701,37 +811,61 @@ func (opts *updatePeeringContainerOpts) initClient() func() error { } } -func (opts *updatePeeringContainerOpts) Run(ctx context.Context) error { +func (opts *updatePeeringContainerOpts) readData() (*admin.CloudProviderContainer, error) { + var out *admin.CloudProviderContainer + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updatePeeringContainerOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdatePeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, + + CloudProviderContainer: data, } resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updatePeeringContainerBuilder() *cobra.Command { - const template = "<>" - - opts := updatePeeringContainerOpts{} + opts := updatePeeringContainerOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updatePeeringContainer", Short: "Update One Network Peering Container", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -739,6 +873,9 @@ func updatePeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd @@ -759,7 +896,7 @@ func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) initClient() func( } } -func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Context) error { +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, } @@ -768,33 +905,30 @@ func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Co return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { - const template = "<>" - opts := verifyConnectViaPeeringOnlyModeForOneProjectOpts{} cmd := &cobra.Command{ Use: "verifyConnectViaPeeringOnlyModeForOneProject", Short: "Verify Connect via Peering Only Mode for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_online_archive_cmd.go b/internal/generated/api_online_archive_cmd.go index 264c275fa3..7ce105f548 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/generated/api_online_archive_cmd.go @@ -18,21 +18,29 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createOnlineArchiveOpts) initClient() func() error { @@ -43,91 +51,104 @@ func (opts *createOnlineArchiveOpts) initClient() func() error { } } -func (opts *createOnlineArchiveOpts) Run(ctx context.Context) error { +func (opts *createOnlineArchiveOpts) readData() (*admin.OnlineArchive, error) { + var out *admin.OnlineArchive + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateOnlineArchiveApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + OnlineArchive: data, } resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createOnlineArchiveBuilder() *cobra.Command { - const template = "<>" - - opts := createOnlineArchiveOpts{} + opts := createOnlineArchiveOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createOnlineArchive", + Use: "createOnlineArchive", Short: "Create One Online Archive", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.`) - - - cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the online archive.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create an online archive.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.collName, "collName", "", `Human-readable label that identifies the collection for which you created the online archive.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.collectionType, "collectionType", ""STANDARD"", `Classification of MongoDB database collection that you want to return. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().CriteriaVar(&opts.criteria, "criteria", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.dbName, "dbName", "", `Human-readable label of the database that contains the collection that contains the online archive.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the specified cluster. The specified cluster contains the collection for which to create the online archive.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.partitionFields, "partitionFields", nil, `List that contains document parameters to use to logically divide data within a collection. Partitions provide a coarse level of filtering of the underlying collection data. To divide your data, specify up to two parameters that you frequently query. Any queries that don't use these parameters result in a full collection scan of all archived documents. This takes more time and increase your costs.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether this online archive exists in the paused state. A request to resume fails if the collection has another active online archive. To pause an active online archive or resume a paused online archive, you must include this parameter. To pause an active archive, set this to **true**. To resume a paused archive, set this to **false**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().OnlineArchiveScheduleVar(&opts.schedule, "schedule", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.state, "state", "", `Phase of the process to create this online archive when you made this request. - -| State | Indication | -|-------------|------------| -| `PENDING` | MongoDB Cloud has queued documents for archive. Archiving hasn't started. | -| `ARCHIVING` | MongoDB Cloud started archiving documents that meet the archival criteria. | -| `IDLE` | MongoDB Cloud waits to start the next archival job. | -| `PAUSING` | Someone chose to stop archiving. MongoDB Cloud finishes the running archival job then changes the state to `PAUSED` when that job completes. | -| `PAUSED` | MongoDB Cloud has stopped archiving. Archived documents can be queried. The specified archiving operation on the active cluster cannot archive additional documents. You can resume archiving for paused archives at any time. | -| `ORPHANED` | Someone has deleted the collection associated with an active or paused archive. MongoDB Cloud doesn't delete the archived data. You must manually delete the online archives associated with the deleted collection. | -| `DELETED` | Someone has deleted the archive was deleted. When someone deletes an online archive, MongoDB Cloud removes all associated archived documents from the cloud object storage. |`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type deleteOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string } @@ -139,10 +160,10 @@ func (opts *deleteOnlineArchiveOpts) initClient() func() error { } } -func (opts *deleteOnlineArchiveOpts) Run(ctx context.Context) error { +func (opts *deleteOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } resp, _, err := opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params).Execute() @@ -150,27 +171,21 @@ func (opts *deleteOnlineArchiveOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteOnlineArchiveBuilder() *cobra.Command { - const template = "<>" - opts := deleteOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "deleteOnlineArchive", + Use: "deleteOnlineArchive", Short: "Remove One Online Archive", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -179,20 +194,23 @@ func deleteOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to delete.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type downloadOnlineArchiveQueryLogsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - startDate int64 - endDate int64 + startDate int64 + endDate int64 archiveOnly bool } @@ -204,12 +222,12 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) initClient() func() error { } } -func (opts *downloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { +func (opts *downloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - StartDate: &opts.startDate, - EndDate: &opts.endDate, + StartDate: &opts.startDate, + EndDate: &opts.endDate, ArchiveOnly: &opts.archiveOnly, } resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params).Execute() @@ -217,27 +235,21 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { - const template = "<>" - opts := downloadOnlineArchiveQueryLogsOpts{} cmd := &cobra.Command{ - Use: "downloadOnlineArchiveQueryLogs", + Use: "downloadOnlineArchiveQueryLogs", Short: "Download Online Archive Query Logs", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -248,17 +260,20 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, `Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type getOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string } @@ -270,10 +285,10 @@ func (opts *getOnlineArchiveOpts) initClient() func() error { } } -func (opts *getOnlineArchiveOpts) Run(ctx context.Context) error { +func (opts *getOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } resp, _, err := opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params).Execute() @@ -281,27 +296,21 @@ func (opts *getOnlineArchiveOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getOnlineArchiveBuilder() *cobra.Command { - const template = "<>" - opts := getOnlineArchiveOpts{} cmd := &cobra.Command{ - Use: "getOnlineArchive", + Use: "getOnlineArchive", Short: "Return One Online Archive", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -310,21 +319,24 @@ func getOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to return.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type listOnlineArchivesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string + client *admin.APIClient + groupId string + clusterName string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listOnlineArchivesOpts) initClient() func() error { @@ -335,40 +347,34 @@ func (opts *listOnlineArchivesOpts) initClient() func() error { } } -func (opts *listOnlineArchivesOpts) Run(ctx context.Context) error { +func (opts *listOnlineArchivesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListOnlineArchivesApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, + GroupId: opts.groupId, + ClusterName: opts.clusterName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listOnlineArchivesBuilder() *cobra.Command { - const template = "<>" - opts := listOnlineArchivesOpts{} cmd := &cobra.Command{ - Use: "listOnlineArchives", + Use: "listOnlineArchives", Short: "Return All Online Archives for One Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -379,19 +385,24 @@ func listOnlineArchivesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } + type updateOnlineArchiveOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - archiveId string + client *admin.APIClient + groupId string + archiveId string clusterName string - + + filename string + fs afero.Fs } func (opts *updateOnlineArchiveOpts) initClient() func() error { @@ -402,39 +413,62 @@ func (opts *updateOnlineArchiveOpts) initClient() func() error { } } -func (opts *updateOnlineArchiveOpts) Run(ctx context.Context) error { +func (opts *updateOnlineArchiveOpts) readData() (*admin.OnlineArchive, error) { + var out *admin.OnlineArchive + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateOnlineArchiveApiParams{ - GroupId: opts.groupId, - ArchiveId: opts.archiveId, + GroupId: opts.groupId, + ArchiveId: opts.archiveId, ClusterName: opts.clusterName, - + + OnlineArchive: data, } resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateOnlineArchiveBuilder() *cobra.Command { - const template = "<>" - - opts := updateOnlineArchiveOpts{} + opts := updateOnlineArchiveOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateOnlineArchive", + Use: "updateOnlineArchive", Short: "Update One Online Archive", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -442,42 +476,31 @@ func updateOnlineArchiveBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to update.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) - - - cmd.Flags().StringVar(&opts._id, "_id", "", `Unique 24-hexadecimal digit string that identifies the online archive.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create an online archive.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.collName, "collName", "", `Human-readable label that identifies the collection for which you created the online archive.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.collectionType, "collectionType", ""STANDARD"", `Classification of MongoDB database collection that you want to return. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().CriteriaVar(&opts.criteria, "criteria", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.dbName, "dbName", "", `Human-readable label of the database that contains the collection that contains the online archive.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the specified cluster. The specified cluster contains the collection for which to create the online archive.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.partitionFields, "partitionFields", nil, `List that contains document parameters to use to logically divide data within a collection. Partitions provide a coarse level of filtering of the underlying collection data. To divide your data, specify up to two parameters that you frequently query. Any queries that don't use these parameters result in a full collection scan of all archived documents. This takes more time and increase your costs.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.paused, "paused", false, `Flag that indicates whether this online archive exists in the paused state. A request to resume fails if the collection has another active online archive. To pause an active online archive or resume a paused online archive, you must include this parameter. To pause an active archive, set this to **true**. To resume a paused archive, set this to **false**.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().OnlineArchiveScheduleVar(&opts.schedule, "schedule", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.state, "state", "", `Phase of the process to create this online archive when you made this request. - -| State | Indication | -|-------------|------------| -| `PENDING` | MongoDB Cloud has queued documents for archive. Archiving hasn't started. | -| `ARCHIVING` | MongoDB Cloud started archiving documents that meet the archival criteria. | -| `IDLE` | MongoDB Cloud waits to start the next archival job. | -| `PAUSING` | Someone chose to stop archiving. MongoDB Cloud finishes the running archival job then changes the state to `PAUSED` when that job completes. | -| `PAUSED` | MongoDB Cloud has stopped archiving. Archived documents can be queried. The specified archiving operation on the active cluster cannot archive additional documents. You can resume archiving for paused archives at any time. | -| `ORPHANED` | Someone has deleted the collection associated with an active or paused archive. MongoDB Cloud doesn't delete the archived data. You must manually delete the online archives associated with the deleted collection. | -| `DELETED` | Someone has deleted the archive was deleted. When someone deletes an online archive, MongoDB Cloud removes all associated archived documents from the cloud object storage. |`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") @@ -487,8 +510,8 @@ If you set this parameter to `TIMESERIES`, set `"criteria.ty func onlineArchiveBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "onlineArchive", - Short: `Returns, adds, edits, or removes an online archive.`, + Use: "onlineArchive", + Short: `Returns, adds, edits, or removes an online archive.`, } cmd.AddCommand( createOnlineArchiveBuilder(), @@ -500,4 +523,3 @@ func onlineArchiveBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_organizations_cmd.go b/internal/generated/api_organizations_cmd.go index 525f22b9fc..abb7991453 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/generated/api_organizations_cmd.go @@ -18,19 +18,27 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - + + filename string + fs afero.Fs } func (opts *createOrganizationOpts) initClient() func() error { @@ -41,55 +49,82 @@ func (opts *createOrganizationOpts) initClient() func() error { } } -func (opts *createOrganizationOpts) Run(ctx context.Context) error { +func (opts *createOrganizationOpts) readData() (*admin.CreateOrganizationRequest, error) { + var out *admin.CreateOrganizationRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createOrganizationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateOrganizationApiParams{ - + + CreateOrganizationRequest: data, } resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createOrganizationBuilder() *cobra.Command { - const template = "<>" - - opts := createOrganizationOpts{} + opts := createOrganizationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createOrganization", + Use: "createOrganization", Short: "Create One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } - - cmd.Flags().CreateApiKeyVar(&opts.apiKey, "apiKey", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the organization.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.orgOwnerId, "orgOwnerId", "", `Unique 24-hexadecimal digit string that identifies the Atlas user that you want to assign the Organization Owner role. This user must be a member of the same organization as the calling API key. This is only required when authenticating with Programmatic API Keys.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } + type createOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string + + filename string + fs afero.Fs } func (opts *createOrganizationInvitationOpts) initClient() func() error { @@ -100,57 +135,82 @@ func (opts *createOrganizationInvitationOpts) initClient() func() error { } } -func (opts *createOrganizationInvitationOpts) Run(ctx context.Context) error { +func (opts *createOrganizationInvitationOpts) readData() (*admin.OrganizationInvitationRequest, error) { + var out *admin.OrganizationInvitationRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createOrganizationInvitationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, - + + OrganizationInvitationRequest: data, } resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createOrganizationInvitationBuilder() *cobra.Command { - const template = "<>" - - opts := createOrganizationInvitationOpts{} + opts := createOrganizationInvitationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createOrganizationInvitation", + Use: "createOrganizationInvitation", Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - - cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.teamIds, "teamIds", nil, `List of teams to which you want to invite the desired MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.username, "username", "", `Email address that belongs to the desired MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type deleteOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *deleteOrganizationOpts) initClient() func() error { @@ -161,7 +221,7 @@ func (opts *deleteOrganizationOpts) initClient() func() error { } } -func (opts *deleteOrganizationOpts) Run(ctx context.Context) error { +func (opts *deleteOrganizationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, } @@ -170,40 +230,37 @@ func (opts *deleteOrganizationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteOrganizationBuilder() *cobra.Command { - const template = "<>" - opts := deleteOrganizationOpts{} cmd := &cobra.Command{ - Use: "deleteOrganization", + Use: "deleteOrganization", Short: "Remove One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type deleteOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string } @@ -215,9 +272,9 @@ func (opts *deleteOrganizationInvitationOpts) initClient() func() error { } } -func (opts *deleteOrganizationInvitationOpts) Run(ctx context.Context) error { +func (opts *deleteOrganizationInvitationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteOrganizationInvitationApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, } resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params).Execute() @@ -225,42 +282,39 @@ func (opts *deleteOrganizationInvitationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteOrganizationInvitationBuilder() *cobra.Command { - const template = "<>" - opts := deleteOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "deleteOrganizationInvitation", + Use: "deleteOrganizationInvitation", Short: "Cancel One Organization Invitation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } + type getOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *getOrganizationOpts) initClient() func() error { @@ -271,7 +325,7 @@ func (opts *getOrganizationOpts) initClient() func() error { } } -func (opts *getOrganizationOpts) Run(ctx context.Context) error { +func (opts *getOrganizationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, } @@ -280,40 +334,37 @@ func (opts *getOrganizationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getOrganizationBuilder() *cobra.Command { - const template = "<>" - opts := getOrganizationOpts{} cmd := &cobra.Command{ - Use: "getOrganization", + Use: "getOrganization", Short: "Return One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type getOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string } @@ -325,9 +376,9 @@ func (opts *getOrganizationInvitationOpts) initClient() func() error { } } -func (opts *getOrganizationInvitationOpts) Run(ctx context.Context) error { +func (opts *getOrganizationInvitationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetOrganizationInvitationApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, } resp, _, err := opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params).Execute() @@ -335,42 +386,39 @@ func (opts *getOrganizationInvitationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getOrganizationInvitationBuilder() *cobra.Command { - const template = "<>" - opts := getOrganizationInvitationOpts{} cmd := &cobra.Command{ - Use: "getOrganizationInvitation", + Use: "getOrganizationInvitation", Short: "Return One Organization Invitation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } + type getOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string + orgId string } func (opts *getOrganizationSettingsOpts) initClient() func() error { @@ -381,7 +429,7 @@ func (opts *getOrganizationSettingsOpts) initClient() func() error { } } -func (opts *getOrganizationSettingsOpts) Run(ctx context.Context) error { +func (opts *getOrganizationSettingsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, } @@ -390,40 +438,37 @@ func (opts *getOrganizationSettingsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getOrganizationSettingsBuilder() *cobra.Command { - const template = "<>" - opts := getOrganizationSettingsOpts{} cmd := &cobra.Command{ - Use: "getOrganizationSettings", + Use: "getOrganizationSettings", Short: "Return Settings for One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type listOrganizationInvitationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string username string } @@ -435,9 +480,9 @@ func (opts *listOrganizationInvitationsOpts) initClient() func() error { } } -func (opts *listOrganizationInvitationsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationInvitationsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationInvitationsApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, Username: &opts.username, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params).Execute() @@ -445,45 +490,42 @@ func (opts *listOrganizationInvitationsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listOrganizationInvitationsBuilder() *cobra.Command { - const template = "<>" - opts := listOrganizationInvitationsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationInvitations", + Use: "listOrganizationInvitations", Short: "Return All Organization Invitations", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type listOrganizationProjectsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int - name string + pageNum int + name string } func (opts *listOrganizationProjectsOpts) initClient() func() error { @@ -494,40 +536,34 @@ func (opts *listOrganizationProjectsOpts) initClient() func() error { } } -func (opts *listOrganizationProjectsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationProjectsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationProjectsApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Name: &opts.name, + PageNum: &opts.pageNum, + Name: &opts.name, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listOrganizationProjectsBuilder() *cobra.Command { - const template = "<>" - opts := listOrganizationProjectsOpts{} cmd := &cobra.Command{ - Use: "listOrganizationProjects", + Use: "listOrganizationProjects", Short: "Return One or More Projects in One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -536,18 +572,21 @@ func listOrganizationProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type listOrganizationUsersOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listOrganizationUsersOpts) initClient() func() error { @@ -558,39 +597,33 @@ func (opts *listOrganizationUsersOpts) initClient() func() error { } } -func (opts *listOrganizationUsersOpts) Run(ctx context.Context) error { +func (opts *listOrganizationUsersOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationUsersApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listOrganizationUsersBuilder() *cobra.Command { - const template = "<>" - opts := listOrganizationUsersOpts{} cmd := &cobra.Command{ - Use: "listOrganizationUsers", + Use: "listOrganizationUsers", Short: "Return All MongoDB Cloud Users in One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -598,18 +631,21 @@ func listOrganizationUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type listOrganizationsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient includeCount bool itemsPerPage int - pageNum int - name string + pageNum int + name string } func (opts *listOrganizationsOpts) initClient() func() error { @@ -620,39 +656,33 @@ func (opts *listOrganizationsOpts) initClient() func() error { } } -func (opts *listOrganizationsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - Name: &opts.name, + PageNum: &opts.pageNum, + Name: &opts.name, } resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listOrganizationsBuilder() *cobra.Command { - const template = "<>" - opts := listOrganizationsOpts{} cmd := &cobra.Command{ - Use: "listOrganizations", + Use: "listOrganizations", Short: "Return All Organizations", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -660,15 +690,20 @@ func listOrganizationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } + type renameOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string + + filename string + fs afero.Fs } func (opts *renameOrganizationOpts) initClient() func() error { @@ -679,60 +714,87 @@ func (opts *renameOrganizationOpts) initClient() func() error { } } -func (opts *renameOrganizationOpts) Run(ctx context.Context) error { +func (opts *renameOrganizationOpts) readData() (*admin.Organization, error) { + var out *admin.Organization + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *renameOrganizationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, - + + Organization: data, } resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func renameOrganizationBuilder() *cobra.Command { - const template = "<>" - - opts := renameOrganizationOpts{} + opts := renameOrganizationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "renameOrganization", + Use: "renameOrganization", Short: "Rename One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the organization.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.isDeleted, "isDeleted", false, `Flag that indicates whether this organization has been deleted.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the organization.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type updateOrganizationInvitationOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string + + filename string + fs afero.Fs } func (opts *updateOrganizationInvitationOpts) initClient() func() error { @@ -743,59 +805,86 @@ func (opts *updateOrganizationInvitationOpts) initClient() func() error { } } -func (opts *updateOrganizationInvitationOpts) Run(ctx context.Context) error { +func (opts *updateOrganizationInvitationOpts) readData() (*admin.OrganizationInvitationRequest, error) { + var out *admin.OrganizationInvitationRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateOrganizationInvitationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, - + + OrganizationInvitationRequest: data, } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateOrganizationInvitationBuilder() *cobra.Command { - const template = "<>" - - opts := updateOrganizationInvitationOpts{} + opts := updateOrganizationInvitationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateOrganizationInvitation", + Use: "updateOrganizationInvitation", Short: "Update One Organization Invitation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - - cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.teamIds, "teamIds", nil, `List of teams to which you want to invite the desired MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.username, "username", "", `Email address that belongs to the desired MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd } + type updateOrganizationInvitationByIdOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - orgId string + client *admin.APIClient + orgId string invitationId string - + + filename string + fs afero.Fs } func (opts *updateOrganizationInvitationByIdOpts) initClient() func() error { @@ -806,59 +895,86 @@ func (opts *updateOrganizationInvitationByIdOpts) initClient() func() error { } } -func (opts *updateOrganizationInvitationByIdOpts) Run(ctx context.Context) error { +func (opts *updateOrganizationInvitationByIdOpts) readData() (*admin.OrganizationInvitationUpdateRequest, error) { + var out *admin.OrganizationInvitationUpdateRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateOrganizationInvitationByIdOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateOrganizationInvitationByIdApiParams{ - OrgId: opts.orgId, + OrgId: opts.orgId, InvitationId: opts.invitationId, - + + OrganizationInvitationUpdateRequest: data, } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateOrganizationInvitationByIdBuilder() *cobra.Command { - const template = "<>" - - opts := updateOrganizationInvitationByIdOpts{} + opts := updateOrganizationInvitationByIdOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateOrganizationInvitationById", + Use: "updateOrganizationInvitationById", Short: "Update One Organization Invitation by Invitation ID", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - - cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.teamIds, "teamIds", nil, `List of teams to which you want to invite the desired MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } + type updateOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts client *admin.APIClient - orgId string - + orgId string + + filename string + fs afero.Fs } func (opts *updateOrganizationSettingsOpts) initClient() func() error { @@ -869,48 +985,72 @@ func (opts *updateOrganizationSettingsOpts) initClient() func() error { } } -func (opts *updateOrganizationSettingsOpts) Run(ctx context.Context) error { +func (opts *updateOrganizationSettingsOpts) readData() (*admin.OrganizationSettings, error) { + var out *admin.OrganizationSettings + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateOrganizationSettingsOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, - + + OrganizationSettings: data, } resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateOrganizationSettingsBuilder() *cobra.Command { - const template = "<>" - - opts := updateOrganizationSettingsOpts{} + opts := updateOrganizationSettingsOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateOrganizationSettings", + Use: "updateOrganizationSettings", Short: "Update Settings for One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - - cmd.Flags().BoolVar(&opts.apiAccessListRequired, "apiAccessListRequired", false, `Flag that indicates whether to require API operations to originate from an IP Address added to the API access list for the specified organization.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.multiFactorAuthRequired, "multiFactorAuthRequired", false, `Flag that indicates whether to require users to set up Multi-Factor Authentication (MFA) before accessing the specified organization. To learn more, see: https://www.mongodb.com/docs/atlas/security-multi-factor-authentication/.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.restrictEmployeeAccess, "restrictEmployeeAccess", false, `Flag that indicates whether to block MongoDB Support from accessing Atlas infrastructure for any deployment in the specified organization without explicit permission. Once this setting is turned on, you can grant MongoDB Support a 24-hour bypass access to the Atlas deployment to resolve support issues. To learn more, see: https://www.mongodb.com/docs/atlas/security-restrict-support-access/.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -918,8 +1058,8 @@ func updateOrganizationSettingsBuilder() *cobra.Command { func organizationsBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "organizations", - Short: `Returns, adds, and edits organizational units in MongoDB Cloud.`, + Use: "organizations", + Short: `Returns, adds, and edits organizational units in MongoDB Cloud.`, } cmd.AddCommand( createOrganizationBuilder(), @@ -940,4 +1080,3 @@ func organizationsBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/generated/api_performance_advisor_cmd.go index 7bb0f993a9..3cd2cbd9e0 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/generated/api_performance_advisor_cmd.go @@ -18,8 +18,12 @@ package generated import ( "context" + "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -39,7 +43,7 @@ func (opts *disableSlowOperationThresholdingOpts) initClient() func() error { } } -func (opts *disableSlowOperationThresholdingOpts) Run(ctx context.Context) error { +func (opts *disableSlowOperationThresholdingOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } @@ -48,33 +52,30 @@ func (opts *disableSlowOperationThresholdingOpts) Run(ctx context.Context) error return err } - return opts.Print(nil) + return nil } func disableSlowOperationThresholdingBuilder() *cobra.Command { - const template = "<>" - opts := disableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ Use: "disableSlowOperationThresholding", Short: "Disable Managed Slow Operation Threshold", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -94,7 +95,7 @@ func (opts *enableSlowOperationThresholdingOpts) initClient() func() error { } } -func (opts *enableSlowOperationThresholdingOpts) Run(ctx context.Context) error { +func (opts *enableSlowOperationThresholdingOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } @@ -103,33 +104,30 @@ func (opts *enableSlowOperationThresholdingOpts) Run(ctx context.Context) error return err } - return opts.Print(nil) + return nil } func enableSlowOperationThresholdingBuilder() *cobra.Command { - const template = "<>" - opts := enableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ Use: "enableSlowOperationThresholding", Short: "Enable Managed Slow Operation Threshold", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -154,7 +152,7 @@ func (opts *listSlowQueriesOpts) initClient() func() error { } } -func (opts *listSlowQueriesOpts) Run(ctx context.Context) error { +func (opts *listSlowQueriesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListSlowQueriesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -168,27 +166,21 @@ func (opts *listSlowQueriesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listSlowQueriesBuilder() *cobra.Command { - const template = "<>" - opts := listSlowQueriesOpts{} cmd := &cobra.Command{ Use: "listSlowQueries", Short: "Return Slow Queries", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -206,6 +198,9 @@ func listSlowQueriesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd @@ -229,7 +224,7 @@ func (opts *listSlowQueryNamespacesOpts) initClient() func() error { } } -func (opts *listSlowQueryNamespacesOpts) Run(ctx context.Context) error { +func (opts *listSlowQueryNamespacesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListSlowQueryNamespacesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -241,27 +236,21 @@ func (opts *listSlowQueryNamespacesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listSlowQueryNamespacesBuilder() *cobra.Command { - const template = "<>" - opts := listSlowQueryNamespacesOpts{} cmd := &cobra.Command{ Use: "listSlowQueryNamespaces", Short: "Return All Namespaces for One Host", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -277,6 +266,9 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd @@ -306,7 +298,7 @@ func (opts *listSuggestedIndexesOpts) initClient() func() error { } } -func (opts *listSuggestedIndexesOpts) Run(ctx context.Context) error { +func (opts *listSuggestedIndexesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListSuggestedIndexesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -324,27 +316,21 @@ func (opts *listSuggestedIndexesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listSuggestedIndexesBuilder() *cobra.Command { - const template = "<>" - opts := listSuggestedIndexesOpts{} cmd := &cobra.Command{ Use: "listSuggestedIndexes", Short: "Return Suggested Indexes", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -366,6 +352,9 @@ func listSuggestedIndexesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/generated/api_private_endpoint_services_cmd.go index 6a6875cffc..1de864e8cd 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/generated/api_private_endpoint_services_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -31,6 +39,9 @@ type createPrivateEndpointOpts struct { groupId string cloudProvider string endpointServiceId string + + filename string + fs afero.Fs } func (opts *createPrivateEndpointOpts) initClient() func() error { @@ -41,38 +52,62 @@ func (opts *createPrivateEndpointOpts) initClient() func() error { } } -func (opts *createPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *createPrivateEndpointOpts) readData() (*admin.CreateEndpointRequest, error) { + var out *admin.CreateEndpointRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreatePrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, + + CreateEndpointRequest: data, } resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - - opts := createPrivateEndpointOpts{} + opts := createPrivateEndpointOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createPrivateEndpoint", Short: "Create One Private Endpoint for One Provider", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -81,6 +116,9 @@ func createPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") @@ -92,6 +130,9 @@ type createPrivateEndpointServiceOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *createPrivateEndpointServiceOpts) initClient() func() error { @@ -102,45 +143,72 @@ func (opts *createPrivateEndpointServiceOpts) initClient() func() error { } } -func (opts *createPrivateEndpointServiceOpts) Run(ctx context.Context) error { +func (opts *createPrivateEndpointServiceOpts) readData() (*admin.CreateEndpointServiceRequest, error) { + var out *admin.CreateEndpointServiceRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createPrivateEndpointServiceOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, + + CreateEndpointServiceRequest: data, } resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createPrivateEndpointServiceBuilder() *cobra.Command { - const template = "<>" - - opts := createPrivateEndpointServiceOpts{} + opts := createPrivateEndpointServiceOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createPrivateEndpointService", Short: "Create One Private Endpoint Service for One Provider", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.providerName, "providerName", "", `Human-readable label that identifies the cloud service provider for which you want to create the private endpoint service.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.region, "region", "", `Cloud provider region in which you want to create the private endpoint service. Regions accepted as values differ for [Amazon Web Services](https://docs.atlas.mongodb.com/reference/amazon-aws/), [Google Cloud Platform](https://docs.atlas.mongodb.com/reference/google-gcp/), and [Microsoft Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/).`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -164,7 +232,7 @@ func (opts *deletePrivateEndpointOpts) initClient() func() error { } } -func (opts *deletePrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *deletePrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeletePrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, @@ -176,27 +244,21 @@ func (opts *deletePrivateEndpointOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deletePrivateEndpointBuilder() *cobra.Command { - const template = "<>" - opts := deletePrivateEndpointOpts{} cmd := &cobra.Command{ Use: "deletePrivateEndpoint", Short: "Remove One Private Endpoint for One Provider", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -206,6 +268,9 @@ func deletePrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") @@ -230,7 +295,7 @@ func (opts *deletePrivateEndpointServiceOpts) initClient() func() error { } } -func (opts *deletePrivateEndpointServiceOpts) Run(ctx context.Context) error { +func (opts *deletePrivateEndpointServiceOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeletePrivateEndpointServiceApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, @@ -241,27 +306,21 @@ func (opts *deletePrivateEndpointServiceOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deletePrivateEndpointServiceBuilder() *cobra.Command { - const template = "<>" - opts := deletePrivateEndpointServiceOpts{} cmd := &cobra.Command{ Use: "deletePrivateEndpointService", Short: "Remove One Private Endpoint Service for One Provider", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -270,6 +329,9 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") @@ -294,7 +356,7 @@ func (opts *getPrivateEndpointOpts) initClient() func() error { } } -func (opts *getPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *getPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetPrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, @@ -306,27 +368,21 @@ func (opts *getPrivateEndpointOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - opts := getPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "getPrivateEndpoint", Short: "Return One Private Endpoint for One Provider", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -336,6 +392,9 @@ func getPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") @@ -360,7 +419,7 @@ func (opts *getPrivateEndpointServiceOpts) initClient() func() error { } } -func (opts *getPrivateEndpointServiceOpts) Run(ctx context.Context) error { +func (opts *getPrivateEndpointServiceOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetPrivateEndpointServiceApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, @@ -371,27 +430,21 @@ func (opts *getPrivateEndpointServiceOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getPrivateEndpointServiceBuilder() *cobra.Command { - const template = "<>" - opts := getPrivateEndpointServiceOpts{} cmd := &cobra.Command{ Use: "getPrivateEndpointService", Short: "Return One Private Endpoint Service for One Provider", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -400,6 +453,9 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") @@ -421,7 +477,7 @@ func (opts *getRegionalizedPrivateEndpointSettingOpts) initClient() func() error } } -func (opts *getRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { +func (opts *getRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, } @@ -430,33 +486,30 @@ func (opts *getRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { - const template = "<>" - opts := getRegionalizedPrivateEndpointSettingOpts{} cmd := &cobra.Command{ Use: "getRegionalizedPrivateEndpointSetting", Short: "Return Regionalized Private Endpoint Status", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -477,7 +530,7 @@ func (opts *listPrivateEndpointServicesOpts) initClient() func() error { } } -func (opts *listPrivateEndpointServicesOpts) Run(ctx context.Context) error { +func (opts *listPrivateEndpointServicesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListPrivateEndpointServicesApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, @@ -487,27 +540,21 @@ func (opts *listPrivateEndpointServicesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listPrivateEndpointServicesBuilder() *cobra.Command { - const template = "<>" - opts := listPrivateEndpointServicesOpts{} cmd := &cobra.Command{ Use: "listPrivateEndpointServices", Short: "Return All Private Endpoint Services for One Provider", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -515,6 +562,9 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") return cmd @@ -525,6 +575,9 @@ type toggleRegionalizedPrivateEndpointSettingOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *toggleRegionalizedPrivateEndpointSettingOpts) initClient() func() error { @@ -535,53 +588,70 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) initClient() func() er } } -func (opts *toggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context) error { +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData() (*admin.ProjectSettingItem, error) { + var out *admin.ProjectSettingItem + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.ToggleRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, + + ProjectSettingItem: data, } resp, _, err := opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { - const template = "<>" - - opts := toggleRegionalizedPrivateEndpointSettingOpts{} + opts := toggleRegionalizedPrivateEndpointSettingOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "toggleRegionalizedPrivateEndpointSetting", Short: "Toggle Regionalized Private Endpoint Status", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().BoolVar(&opts.enabled, "enabled", false, `Flag that indicates whether someone enabled the regionalized private endpoint setting for the specified project. - -- Set this value to `true` to enable regionalized private endpoints. This allows you to create more than one private endpoint in a cloud provider region. You need to enable this setting to connect to multi-region and global MongoDB Cloud sharded clusters. Enabling regionalized private endpoints introduces the following limitations: - - Your applications must use the new connection strings for existing multi-region and global sharded clusters. This might cause downtime. - - Your MongoDB Cloud project can't contain replica sets nor can you create new replica sets in this project. - - - You can't disable this setting if you have: - - more than one private endpoint in more than one region - - more than one private endpoint in one region and one private endpoint in one or more regions. + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -- Set this value to `false` to disable regionalized private endpoints.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/generated/api_programmatic_api_keys_cmd.go index 7f8092048b..4f7f645b92 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/generated/api_programmatic_api_keys_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -30,6 +38,9 @@ type addProjectApiKeyOpts struct { client *admin.APIClient groupId string apiUserId string + + filename string + fs afero.Fs } func (opts *addProjectApiKeyOpts) initClient() func() error { @@ -40,37 +51,61 @@ func (opts *addProjectApiKeyOpts) initClient() func() error { } } -func (opts *addProjectApiKeyOpts) Run(ctx context.Context) error { +func (opts *addProjectApiKeyOpts) readData() ([]*admin.UserRoleAssignment, error) { + var out []*admin.UserRoleAssignment + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *addProjectApiKeyOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.AddProjectApiKeyApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, + + UserRoleAssignment: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func addProjectApiKeyBuilder() *cobra.Command { - const template = "<>" - - opts := addProjectApiKeyOpts{} + opts := addProjectApiKeyOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "addProjectApiKey", Short: "Assign One Organization API Key to One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -78,6 +113,9 @@ func addProjectApiKeyBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -88,6 +126,9 @@ type createApiKeyOpts struct { cli.OutputOpts client *admin.APIClient orgId string + + filename string + fs afero.Fs } func (opts *createApiKeyOpts) initClient() func() error { @@ -98,43 +139,70 @@ func (opts *createApiKeyOpts) initClient() func() error { } } -func (opts *createApiKeyOpts) Run(ctx context.Context) error { +func (opts *createApiKeyOpts) readData() (*admin.CreateApiKey, error) { + var out *admin.CreateApiKey + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createApiKeyOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, + + CreateApiKey: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createApiKeyBuilder() *cobra.Command { - const template = "<>" - - opts := createApiKeyOpts{} + opts := createApiKeyOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createApiKey", Short: "Create One Organization API Key", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVar(&opts.desc, "desc", "", `Purpose or explanation provided when someone created this organization API key.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization or project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -150,6 +218,8 @@ type createApiKeyAccessListOpts struct { includeCount bool itemsPerPage int pageNum int + filename string + fs afero.Fs } func (opts *createApiKeyAccessListOpts) initClient() func() error { @@ -160,7 +230,33 @@ func (opts *createApiKeyAccessListOpts) initClient() func() error { } } -func (opts *createApiKeyAccessListOpts) Run(ctx context.Context) error { +func (opts *createApiKeyAccessListOpts) readData() ([]*admin.UserAccessList, error) { + var out []*admin.UserAccessList + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createApiKeyAccessListOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateApiKeyAccessListApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, @@ -168,33 +264,31 @@ func (opts *createApiKeyAccessListOpts) Run(ctx context.Context) error { IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, + + UserAccessList: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createApiKeyAccessListBuilder() *cobra.Command { - const template = "<>" - - opts := createApiKeyAccessListOpts{} + opts := createApiKeyAccessListOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createApiKeyAccessList", Short: "Create Access List Entries for One Organization API Key", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -204,6 +298,9 @@ func createApiKeyAccessListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -214,6 +311,9 @@ type createProjectApiKeyOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *createProjectApiKeyOpts) initClient() func() error { @@ -224,45 +324,72 @@ func (opts *createProjectApiKeyOpts) initClient() func() error { } } -func (opts *createProjectApiKeyOpts) Run(ctx context.Context) error { +func (opts *createProjectApiKeyOpts) readData() (*admin.CreateApiKey, error) { + var out *admin.CreateApiKey + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createProjectApiKeyOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, + + CreateApiKey: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createProjectApiKeyBuilder() *cobra.Command { - const template = "<>" - - opts := createProjectApiKeyOpts{} + opts := createProjectApiKeyOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createProjectApiKey", Short: "Create and Assign One Organization API Key to One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.desc, "desc", "", `Purpose or explanation provided when someone created this organization API key.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization or project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -284,7 +411,7 @@ func (opts *deleteApiKeyOpts) initClient() func() error { } } -func (opts *deleteApiKeyOpts) Run(ctx context.Context) error { +func (opts *deleteApiKeyOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, @@ -294,32 +421,29 @@ func (opts *deleteApiKeyOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteApiKeyBuilder() *cobra.Command { - const template = "<>" - opts := deleteApiKeyOpts{} cmd := &cobra.Command{ Use: "deleteApiKey", Short: "Remove One Organization API Key", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -342,7 +466,7 @@ func (opts *deleteApiKeyAccessListEntryOpts) initClient() func() error { } } -func (opts *deleteApiKeyAccessListEntryOpts) Run(ctx context.Context) error { +func (opts *deleteApiKeyAccessListEntryOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteApiKeyAccessListEntryApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, @@ -353,33 +477,30 @@ func (opts *deleteApiKeyAccessListEntryOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteApiKeyAccessListEntryBuilder() *cobra.Command { - const template = "<>" - opts := deleteApiKeyAccessListEntryOpts{} cmd := &cobra.Command{ Use: "deleteApiKeyAccessListEntry", Short: "Remove One Access List Entry for One Organization API Key", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") _ = cmd.MarkFlagRequired("ipAddress") @@ -402,7 +523,7 @@ func (opts *getApiKeyOpts) initClient() func() error { } } -func (opts *getApiKeyOpts) Run(ctx context.Context) error { +func (opts *getApiKeyOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, @@ -412,32 +533,29 @@ func (opts *getApiKeyOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getApiKeyBuilder() *cobra.Command { - const template = "<>" - opts := getApiKeyOpts{} cmd := &cobra.Command{ Use: "getApiKey", Short: "Return One Organization API Key", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -460,7 +578,7 @@ func (opts *getApiKeyAccessListOpts) initClient() func() error { } } -func (opts *getApiKeyAccessListOpts) Run(ctx context.Context) error { +func (opts *getApiKeyAccessListOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetApiKeyAccessListApiParams{ OrgId: opts.orgId, IpAddress: opts.ipAddress, @@ -471,33 +589,30 @@ func (opts *getApiKeyAccessListOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getApiKeyAccessListBuilder() *cobra.Command { - const template = "<>" - opts := getApiKeyAccessListOpts{} cmd := &cobra.Command{ Use: "getApiKeyAccessList", Short: "Return One Access List Entry for One Organization API Key", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("ipAddress") _ = cmd.MarkFlagRequired("apiUserId") @@ -523,7 +638,7 @@ func (opts *listApiKeyAccessListsEntriesOpts) initClient() func() error { } } -func (opts *listApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { +func (opts *listApiKeyAccessListsEntriesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListApiKeyAccessListsEntriesApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, @@ -536,27 +651,21 @@ func (opts *listApiKeyAccessListsEntriesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listApiKeyAccessListsEntriesBuilder() *cobra.Command { - const template = "<>" - opts := listApiKeyAccessListsEntriesOpts{} cmd := &cobra.Command{ Use: "listApiKeyAccessListsEntries", Short: "Return All Access List Entries for One Organization API Key", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -565,6 +674,9 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -588,7 +700,7 @@ func (opts *listApiKeysOpts) initClient() func() error { } } -func (opts *listApiKeysOpts) Run(ctx context.Context) error { +func (opts *listApiKeysOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListApiKeysApiParams{ OrgId: opts.orgId, IncludeCount: &opts.includeCount, @@ -600,27 +712,21 @@ func (opts *listApiKeysOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listApiKeysBuilder() *cobra.Command { - const template = "<>" - opts := listApiKeysOpts{} cmd := &cobra.Command{ Use: "listApiKeys", Short: "Return All Organization API Keys", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -628,6 +734,9 @@ func listApiKeysBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -650,7 +759,7 @@ func (opts *listProjectApiKeysOpts) initClient() func() error { } } -func (opts *listProjectApiKeysOpts) Run(ctx context.Context) error { +func (opts *listProjectApiKeysOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectApiKeysApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -662,27 +771,21 @@ func (opts *listProjectApiKeysOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listProjectApiKeysBuilder() *cobra.Command { - const template = "<>" - opts := listProjectApiKeysOpts{} cmd := &cobra.Command{ Use: "listProjectApiKeys", Short: "Return All Organization API Keys Assigned to One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -692,6 +795,9 @@ func listProjectApiKeysBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -712,7 +818,7 @@ func (opts *removeProjectApiKeyOpts) initClient() func() error { } } -func (opts *removeProjectApiKeyOpts) Run(ctx context.Context) error { +func (opts *removeProjectApiKeyOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.RemoveProjectApiKeyApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, @@ -722,27 +828,21 @@ func (opts *removeProjectApiKeyOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func removeProjectApiKeyBuilder() *cobra.Command { - const template = "<>" - opts := removeProjectApiKeyOpts{} cmd := &cobra.Command{ Use: "removeProjectApiKey", Short: "Unassign One Organization API Key from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -750,6 +850,9 @@ func removeProjectApiKeyBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -761,6 +864,9 @@ type updateApiKeyOpts struct { client *admin.APIClient orgId string apiUserId string + + filename string + fs afero.Fs } func (opts *updateApiKeyOpts) initClient() func() error { @@ -771,45 +877,72 @@ func (opts *updateApiKeyOpts) initClient() func() error { } } -func (opts *updateApiKeyOpts) Run(ctx context.Context) error { +func (opts *updateApiKeyOpts) readData() (*admin.CreateApiKey, error) { + var out *admin.CreateApiKey + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateApiKeyOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, + + CreateApiKey: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateApiKeyBuilder() *cobra.Command { - const template = "<>" - - opts := updateApiKeyOpts{} + opts := updateApiKeyOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateApiKey", Short: "Update One Organization API Key", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key you want to update.`) - cmd.Flags().StringVar(&opts.desc, "desc", "", `Purpose or explanation provided when someone created this organization API key.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization or project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -826,6 +959,8 @@ type updateApiKeyRolesOpts struct { pageNum int itemsPerPage int includeCount bool + filename string + fs afero.Fs } func (opts *updateApiKeyRolesOpts) initClient() func() error { @@ -836,7 +971,33 @@ func (opts *updateApiKeyRolesOpts) initClient() func() error { } } -func (opts *updateApiKeyRolesOpts) Run(ctx context.Context) error { +func (opts *updateApiKeyRolesOpts) readData() (*admin.CreateApiKey, error) { + var out *admin.CreateApiKey + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateApiKeyRolesOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateApiKeyRolesApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, @@ -844,33 +1005,31 @@ func (opts *updateApiKeyRolesOpts) Run(ctx context.Context) error { PageNum: &opts.pageNum, ItemsPerPage: &opts.itemsPerPage, IncludeCount: &opts.includeCount, + + CreateApiKey: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateApiKeyRolesBuilder() *cobra.Command { - const template = "<>" - - opts := updateApiKeyRolesOpts{} + opts := updateApiKeyRolesOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateApiKeyRoles", Short: "Update Roles of One Organization API Key to One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -882,9 +1041,12 @@ func updateApiKeyRolesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) - cmd.Flags().StringVar(&opts.desc, "desc", "", `Purpose or explanation provided when someone created this organization API key.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.roles, "roles", nil, `List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization or project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/generated/api_project_ip_access_list_cmd.go index bb6edd7001..67d33608d0 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/generated/api_project_ip_access_list_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -33,6 +41,8 @@ type createProjectIpAccessListOpts struct { includeCount bool itemsPerPage int pageNum int + filename string + fs afero.Fs } func (opts *createProjectIpAccessListOpts) initClient() func() error { @@ -43,40 +53,64 @@ func (opts *createProjectIpAccessListOpts) initClient() func() error { } } -func (opts *createProjectIpAccessListOpts) Run(ctx context.Context) error { +func (opts *createProjectIpAccessListOpts) readData() ([]*admin.NetworkPermissionEntry, error) { + var out []*admin.NetworkPermissionEntry + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createProjectIpAccessListOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateProjectIpAccessListApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, + + NetworkPermissionEntry: data, } resp, _, err := opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createProjectIpAccessListBuilder() *cobra.Command { - const template = "<>" - - opts := createProjectIpAccessListOpts{} + opts := createProjectIpAccessListOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createProjectIpAccessList", Short: "Add Entries to Project IP Access List", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -87,6 +121,9 @@ func createProjectIpAccessListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -107,7 +144,7 @@ func (opts *deleteProjectIpAccessListOpts) initClient() func() error { } } -func (opts *deleteProjectIpAccessListOpts) Run(ctx context.Context) error { +func (opts *deleteProjectIpAccessListOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteProjectIpAccessListApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, @@ -117,27 +154,21 @@ func (opts *deleteProjectIpAccessListOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteProjectIpAccessListBuilder() *cobra.Command { - const template = "<>" - opts := deleteProjectIpAccessListOpts{} cmd := &cobra.Command{ Use: "deleteProjectIpAccessList", Short: "Remove One Entry from One Project IP Access List", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -149,6 +180,9 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd @@ -170,7 +204,7 @@ func (opts *getProjectIpAccessListStatusOpts) initClient() func() error { } } -func (opts *getProjectIpAccessListStatusOpts) Run(ctx context.Context) error { +func (opts *getProjectIpAccessListStatusOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectIpAccessListStatusApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, @@ -180,27 +214,21 @@ func (opts *getProjectIpAccessListStatusOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getProjectIpAccessListStatusBuilder() *cobra.Command { - const template = "<>" - opts := getProjectIpAccessListStatusOpts{} cmd := &cobra.Command{ Use: "getProjectIpAccessListStatus", Short: "Return Status of One Project IP Access List Entry", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -208,6 +236,9 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Network address or cloud provider security construct that identifies which project access list entry to be verified.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd @@ -229,7 +260,7 @@ func (opts *getProjectIpListOpts) initClient() func() error { } } -func (opts *getProjectIpListOpts) Run(ctx context.Context) error { +func (opts *getProjectIpListOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectIpListApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, @@ -239,27 +270,21 @@ func (opts *getProjectIpListOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getProjectIpListBuilder() *cobra.Command { - const template = "<>" - opts := getProjectIpListOpts{} cmd := &cobra.Command{ Use: "getProjectIpList", Short: "Return One Project IP Access List Entry", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -267,6 +292,9 @@ func getProjectIpListBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd @@ -290,7 +318,7 @@ func (opts *listProjectIpAccessListsOpts) initClient() func() error { } } -func (opts *listProjectIpAccessListsOpts) Run(ctx context.Context) error { +func (opts *listProjectIpAccessListsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectIpAccessListsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -302,27 +330,21 @@ func (opts *listProjectIpAccessListsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listProjectIpAccessListsBuilder() *cobra.Command { - const template = "<>" - opts := listProjectIpAccessListsOpts{} cmd := &cobra.Command{ Use: "listProjectIpAccessLists", Short: "Return Project IP Access List", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -332,6 +354,9 @@ func listProjectIpAccessListsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/generated/api_projects_cmd.go b/internal/generated/api_projects_cmd.go index 81cf7f43ca..b8e74b329b 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/generated/api_projects_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -30,6 +38,8 @@ type createProjectOpts struct { client *admin.APIClient projectOwnerId string + filename string + fs afero.Fs } func (opts *createProjectOpts) initClient() func() error { @@ -40,57 +50,84 @@ func (opts *createProjectOpts) initClient() func() error { } } -func (opts *createProjectOpts) Run(ctx context.Context) error { +func (opts *createProjectOpts) readData() (*admin.Group, error) { + var out *admin.Group + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createProjectOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateProjectApiParams{ ProjectOwnerId: &opts.projectOwnerId, + + Group: data, } resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createProjectBuilder() *cobra.Command { - const template = "<>" - - opts := createProjectOpts{} + opts := createProjectOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createProject", Short: "Create One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. `) - cmd.Flags().Int64Var(&opts.clusterCount, "clusterCount", 00, `Quantity of MongoDB Cloud clusters deployed in this project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.created, "created", "", `Date and time when MongoDB Cloud created this project. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the project included in the MongoDB Cloud organization.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud organization to which the project belongs.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.regionUsageRestrictions, "regionUsageRestrictions", ""NONE"", `Region usage restrictions that designate the project's AWS region.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.withDefaultAlertsSettings, "withDefaultAlertsSettings", false, `Flag that indicates whether to create the project with default alert settings.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } @@ -100,6 +137,9 @@ type createProjectInvitationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *createProjectInvitationOpts) initClient() func() error { @@ -110,45 +150,72 @@ func (opts *createProjectInvitationOpts) initClient() func() error { } } -func (opts *createProjectInvitationOpts) Run(ctx context.Context) error { +func (opts *createProjectInvitationOpts) readData() (*admin.GroupInvitationRequest, error) { + var out *admin.GroupInvitationRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createProjectInvitationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateProjectInvitationApiParams{ GroupId: opts.groupId, + + GroupInvitationRequest: data, } resp, _, err := opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createProjectInvitationBuilder() *cobra.Command { - const template = "<>" - - opts := createProjectInvitationOpts{} + opts := createProjectInvitationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createProjectInvitation", Short: "Invite One MongoDB Cloud User to Join One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the MongoDB Cloud user invited to the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -169,7 +236,7 @@ func (opts *deleteProjectOpts) initClient() func() error { } } -func (opts *deleteProjectOpts) Run(ctx context.Context) error { +func (opts *deleteProjectOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, } @@ -178,33 +245,30 @@ func (opts *deleteProjectOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteProjectBuilder() *cobra.Command { - const template = "<>" - opts := deleteProjectOpts{} cmd := &cobra.Command{ Use: "deleteProject", Short: "Remove One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -225,7 +289,7 @@ func (opts *deleteProjectInvitationOpts) initClient() func() error { } } -func (opts *deleteProjectInvitationOpts) Run(ctx context.Context) error { +func (opts *deleteProjectInvitationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteProjectInvitationApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, @@ -235,27 +299,21 @@ func (opts *deleteProjectInvitationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteProjectInvitationBuilder() *cobra.Command { - const template = "<>" - opts := deleteProjectInvitationOpts{} cmd := &cobra.Command{ Use: "deleteProjectInvitation", Short: "Cancel One Project Invitation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -263,6 +321,9 @@ func deleteProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -284,7 +345,7 @@ func (opts *deleteProjectLimitOpts) initClient() func() error { } } -func (opts *deleteProjectLimitOpts) Run(ctx context.Context) error { +func (opts *deleteProjectLimitOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, @@ -294,27 +355,21 @@ func (opts *deleteProjectLimitOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteProjectLimitBuilder() *cobra.Command { - const template = "<>" - opts := deleteProjectLimitOpts{} cmd := &cobra.Command{ Use: "deleteProjectLimit", Short: "Remove One Project Limit", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -336,6 +391,9 @@ func deleteProjectLimitBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -356,7 +414,7 @@ func (opts *getProjectOpts) initClient() func() error { } } -func (opts *getProjectOpts) Run(ctx context.Context) error { +func (opts *getProjectOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectApiParams{ GroupId: opts.groupId, } @@ -365,33 +423,30 @@ func (opts *getProjectOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getProjectBuilder() *cobra.Command { - const template = "<>" - opts := getProjectOpts{} cmd := &cobra.Command{ Use: "getProject", Short: "Return One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -411,7 +466,7 @@ func (opts *getProjectByNameOpts) initClient() func() error { } } -func (opts *getProjectByNameOpts) Run(ctx context.Context) error { +func (opts *getProjectByNameOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectByNameApiParams{ GroupName: opts.groupName, } @@ -420,31 +475,28 @@ func (opts *getProjectByNameOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getProjectByNameBuilder() *cobra.Command { - const template = "<>" - opts := getProjectByNameOpts{} cmd := &cobra.Command{ Use: "getProjectByName", Short: "Return One Project using Its Name", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupName, "groupName", "", `Human-readable label that identifies this project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupName") return cmd } @@ -465,7 +517,7 @@ func (opts *getProjectInvitationOpts) initClient() func() error { } } -func (opts *getProjectInvitationOpts) Run(ctx context.Context) error { +func (opts *getProjectInvitationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectInvitationApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, @@ -475,27 +527,21 @@ func (opts *getProjectInvitationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getProjectInvitationBuilder() *cobra.Command { - const template = "<>" - opts := getProjectInvitationOpts{} cmd := &cobra.Command{ Use: "getProjectInvitation", Short: "Return One Project Invitation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -503,6 +549,9 @@ func getProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd @@ -524,7 +573,7 @@ func (opts *getProjectLimitOpts) initClient() func() error { } } -func (opts *getProjectLimitOpts) Run(ctx context.Context) error { +func (opts *getProjectLimitOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, @@ -534,27 +583,21 @@ func (opts *getProjectLimitOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getProjectLimitBuilder() *cobra.Command { - const template = "<>" - opts := getProjectLimitOpts{} cmd := &cobra.Command{ Use: "getProjectLimit", Short: "Return One Limit for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -576,6 +619,9 @@ func getProjectLimitBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -596,7 +642,7 @@ func (opts *getProjectSettingsOpts) initClient() func() error { } } -func (opts *getProjectSettingsOpts) Run(ctx context.Context) error { +func (opts *getProjectSettingsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, } @@ -605,33 +651,30 @@ func (opts *getProjectSettingsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getProjectSettingsBuilder() *cobra.Command { - const template = "<>" - opts := getProjectSettingsOpts{} cmd := &cobra.Command{ Use: "getProjectSettings", Short: "Return One Project Settings", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -652,7 +695,7 @@ func (opts *listProjectInvitationsOpts) initClient() func() error { } } -func (opts *listProjectInvitationsOpts) Run(ctx context.Context) error { +func (opts *listProjectInvitationsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectInvitationsApiParams{ GroupId: opts.groupId, Username: &opts.username, @@ -662,27 +705,21 @@ func (opts *listProjectInvitationsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listProjectInvitationsBuilder() *cobra.Command { - const template = "<>" - opts := listProjectInvitationsOpts{} cmd := &cobra.Command{ Use: "listProjectInvitations", Short: "Return All Project Invitations", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -690,6 +727,9 @@ func listProjectInvitationsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -709,7 +749,7 @@ func (opts *listProjectLimitsOpts) initClient() func() error { } } -func (opts *listProjectLimitsOpts) Run(ctx context.Context) error { +func (opts *listProjectLimitsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, } @@ -718,33 +758,30 @@ func (opts *listProjectLimitsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listProjectLimitsBuilder() *cobra.Command { - const template = "<>" - opts := listProjectLimitsOpts{} cmd := &cobra.Command{ Use: "listProjectLimits", Short: "Return All Limits for One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -769,7 +806,7 @@ func (opts *listProjectUsersOpts) initClient() func() error { } } -func (opts *listProjectUsersOpts) Run(ctx context.Context) error { +func (opts *listProjectUsersOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectUsersApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -783,27 +820,21 @@ func (opts *listProjectUsersOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listProjectUsersBuilder() *cobra.Command { - const template = "<>" - opts := listProjectUsersOpts{} cmd := &cobra.Command{ Use: "listProjectUsers", Short: "Return All Users in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -815,6 +846,9 @@ func listProjectUsersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.flattenTeams, "flattenTeams", false, `Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `"flattenTeams" : false`, this resource returns only users with a role in the project. If `"flattenTeams" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.`) cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, `Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `"includeOrgUsers": false`, this resource returns only users with a role in the project. If `"includeOrgUsers": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -836,7 +870,7 @@ func (opts *listProjectsOpts) initClient() func() error { } } -func (opts *listProjectsOpts) Run(ctx context.Context) error { +func (opts *listProjectsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, @@ -847,33 +881,30 @@ func (opts *listProjectsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listProjectsBuilder() *cobra.Command { - const template = "<>" - opts := listProjectsOpts{} cmd := &cobra.Command{ Use: "listProjects", Short: "Return All Projects", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + return cmd } @@ -893,7 +924,7 @@ func (opts *removeProjectUserOpts) initClient() func() error { } } -func (opts *removeProjectUserOpts) Run(ctx context.Context) error { +func (opts *removeProjectUserOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.RemoveProjectUserApiParams{ GroupId: opts.groupId, UserId: opts.userId, @@ -903,27 +934,21 @@ func (opts *removeProjectUserOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func removeProjectUserBuilder() *cobra.Command { - const template = "<>" - opts := removeProjectUserOpts{} cmd := &cobra.Command{ Use: "removeProjectUser", Short: "Remove One User from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -931,6 +956,9 @@ func removeProjectUserBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("userId") return cmd @@ -942,6 +970,9 @@ type setProjectLimitOpts struct { client *admin.APIClient limitName string groupId string + + filename string + fs afero.Fs } func (opts *setProjectLimitOpts) initClient() func() error { @@ -952,37 +983,61 @@ func (opts *setProjectLimitOpts) initClient() func() error { } } -func (opts *setProjectLimitOpts) Run(ctx context.Context) error { +func (opts *setProjectLimitOpts) readData() (*admin.Limit, error) { + var out *admin.Limit + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *setProjectLimitOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.SetProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, + + Limit: data, } resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func setProjectLimitBuilder() *cobra.Command { - const template = "<>" - - opts := setProjectLimitOpts{} + opts := setProjectLimitOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "setProjectLimit", Short: "Set One Project Limit", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -1004,6 +1059,9 @@ func setProjectLimitBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1014,6 +1072,9 @@ type updateProjectOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *updateProjectOpts) initClient() func() error { @@ -1024,43 +1085,70 @@ func (opts *updateProjectOpts) initClient() func() error { } } -func (opts *updateProjectOpts) Run(ctx context.Context) error { +func (opts *updateProjectOpts) readData() (*admin.GroupName, error) { + var out *admin.GroupName + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateProjectOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, + + GroupName: data, } resp, _, err := opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateProjectBuilder() *cobra.Command { - const template = "<>" - - opts := updateProjectOpts{} + opts := updateProjectOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateProject", Short: "Update One Project Name", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the project included in the MongoDB Cloud organization.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1071,6 +1159,9 @@ type updateProjectInvitationOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *updateProjectInvitationOpts) initClient() func() error { @@ -1081,45 +1172,72 @@ func (opts *updateProjectInvitationOpts) initClient() func() error { } } -func (opts *updateProjectInvitationOpts) Run(ctx context.Context) error { +func (opts *updateProjectInvitationOpts) readData() (*admin.GroupInvitationRequest, error) { + var out *admin.GroupInvitationRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateProjectInvitationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateProjectInvitationApiParams{ GroupId: opts.groupId, + + GroupInvitationRequest: data, } resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateProjectInvitationBuilder() *cobra.Command { - const template = "<>" - - opts := updateProjectInvitationOpts{} + opts := updateProjectInvitationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateProjectInvitation", Short: "Update One Project Invitation", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the MongoDB Cloud user invited to the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1131,6 +1249,9 @@ type updateProjectInvitationByIdOpts struct { client *admin.APIClient groupId string invitationId string + + filename string + fs afero.Fs } func (opts *updateProjectInvitationByIdOpts) initClient() func() error { @@ -1141,37 +1262,61 @@ func (opts *updateProjectInvitationByIdOpts) initClient() func() error { } } -func (opts *updateProjectInvitationByIdOpts) Run(ctx context.Context) error { +func (opts *updateProjectInvitationByIdOpts) readData() (*admin.GroupInvitationUpdateRequest, error) { + var out *admin.GroupInvitationUpdateRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateProjectInvitationByIdOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateProjectInvitationByIdApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, + + GroupInvitationUpdateRequest: data, } resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateProjectInvitationByIdBuilder() *cobra.Command { - const template = "<>" - - opts := updateProjectInvitationByIdOpts{} + opts := updateProjectInvitationByIdOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateProjectInvitationById", Short: "Update One Project Invitation by Invitation ID", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1179,7 +1324,10 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().SetSliceVar(&opts.roles, "roles", nil, `One or more organization or project level roles to assign to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") @@ -1191,6 +1339,9 @@ type updateProjectSettingsOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *updateProjectSettingsOpts) initClient() func() error { @@ -1201,53 +1352,80 @@ func (opts *updateProjectSettingsOpts) initClient() func() error { } } -func (opts *updateProjectSettingsOpts) Run(ctx context.Context) error { +func (opts *updateProjectSettingsOpts) readData() (*admin.GroupSettings, error) { + var out *admin.GroupSettings + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateProjectSettingsOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateProjectSettingsApiParams{ GroupId: opts.groupId, + + GroupSettings: data, } resp, _, err := opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateProjectSettingsBuilder() *cobra.Command { - const template = "<>" - - opts := updateProjectSettingsOpts{} + opts := updateProjectSettingsOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateProjectSettings", Short: "Update One Project Settings", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().BoolVar(&opts.isCollectDatabaseSpecificsStatisticsEnabled, "isCollectDatabaseSpecificsStatisticsEnabled", false, `Flag that indicates whether to collect database-specific metrics for the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.isDataExplorerEnabled, "isDataExplorerEnabled", false, `Flag that indicates whether to enable the Data Explorer for the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.isExtendedStorageSizesEnabled, "isExtendedStorageSizesEnabled", false, `Flag that indicates whether to enable extended storage sizes for the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.isPerformanceAdvisorEnabled, "isPerformanceAdvisorEnabled", false, `Flag that indicates whether to enable the Performance Advisor and Profiler for the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.isRealtimePerformancePanelEnabled, "isRealtimePerformancePanelEnabled", false, `Flag that indicates whether to enable the Real Time Performance Panel for the specified project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.isSchemaAdvisorEnabled, "isSchemaAdvisorEnabled", false, `Flag that indicates whether to enable the Schema Advisor for the specified project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/generated/api_rolling_index_cmd.go index ce2f352797..9ab722826b 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/generated/api_rolling_index_cmd.go @@ -18,21 +18,28 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createRollingIndexOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string clusterName string - + + filename string + fs afero.Fs } func (opts *createRollingIndexOpts) initClient() func() error { @@ -43,56 +50,80 @@ func (opts *createRollingIndexOpts) initClient() func() error { } } -func (opts *createRollingIndexOpts) Run(ctx context.Context) error { +func (opts *createRollingIndexOpts) readData() (*admin.IndexRequest, error) { + var out *admin.IndexRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createRollingIndexOpts) Run(ctx context.Context, _ io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateRollingIndexApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, ClusterName: opts.clusterName, - + + IndexRequest: data, } _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(nil) + return nil } func createRollingIndexBuilder() *cobra.Command { - const template = "<>" - - opts := createRollingIndexOpts{} + opts := createRollingIndexOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createRollingIndex", + Use: "createRollingIndex", Short: "Create One Rolling Index", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.`) - - cmd.Flags().CollationVar(&opts.collation, "collation", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label of the collection for which MongoDB Cloud creates an index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label of the database that holds the collection on which MongoDB Cloud creates an index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.keys, "keys", nil, `List that contains one or more objects that describe the parameters that you want to index.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IndexOptionsVar(&opts.options, "options", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -101,12 +132,11 @@ func createRollingIndexBuilder() *cobra.Command { func rollingIndexBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "rollingIndex", - Short: `Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.`, + Use: "rollingIndex", + Short: `Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.`, } cmd.AddCommand( createRollingIndexBuilder(), ) return cmd } - diff --git a/internal/generated/api_root_cmd.go b/internal/generated/api_root_cmd.go index bcb2d441af..454c299de8 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/generated/api_root_cmd.go @@ -18,8 +18,12 @@ package generated import ( "context" + "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -38,37 +42,34 @@ func (opts *getSystemStatusOpts) initClient() func() error { } } -func (opts *getSystemStatusOpts) Run(ctx context.Context) error { +func (opts *getSystemStatusOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetSystemStatusApiParams{} resp, _, err := opts.client.RootApi.GetSystemStatusWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getSystemStatusBuilder() *cobra.Command { - const template = "<>" - opts := getSystemStatusOpts{} cmd := &cobra.Command{ Use: "getSystemStatus", Short: "Return the status of this MongoDB application", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + return cmd } diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/generated/api_serverless_instances_cmd.go index f3be4775ab..c4f03332b2 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/generated/api_serverless_instances_cmd.go @@ -18,20 +18,28 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" "os" - "time" + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" ) type createServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - + + filename string + fs afero.Fs } func (opts *createServerlessInstanceOpts) initClient() func() error { @@ -42,64 +50,89 @@ func (opts *createServerlessInstanceOpts) initClient() func() error { } } -func (opts *createServerlessInstanceOpts) Run(ctx context.Context) error { +func (opts *createServerlessInstanceOpts) readData() (*admin.ServerlessInstanceDescriptionCreate, error) { + var out *admin.ServerlessInstanceDescriptionCreate + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createServerlessInstanceOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, - + + ServerlessInstanceDescriptionCreate: data, } resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createServerlessInstanceBuilder() *cobra.Command { - const template = "<>" - - opts := createServerlessInstanceOpts{} + opts := createServerlessInstanceOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "createServerlessInstance", + Use: "createServerlessInstance", Short: "Create One Serverless Instance in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ServerlessProviderSettingsVar(&opts.providerSettings, "providerSettings", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ServerlessBackupOptionsVar(&opts.serverlessBackupOptions, "serverlessBackupOptions", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.stateName, "stateName", "", `Human-readable label that indicates the current operating condition of the serverless instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the serverless instance. If set to `true`, MongoDB Cloud won't delete the serverless instance. If set to `false`, MongoDB Cloud will delete the serverless instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type deleteServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } func (opts *deleteServerlessInstanceOpts) initClient() func() error { @@ -110,37 +143,31 @@ func (opts *deleteServerlessInstanceOpts) initClient() func() error { } } -func (opts *deleteServerlessInstanceOpts) Run(ctx context.Context) error { +func (opts *deleteServerlessInstanceOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteServerlessInstanceBuilder() *cobra.Command { - const template = "<>" - opts := deleteServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "deleteServerlessInstance", + Use: "deleteServerlessInstance", Short: "Remove One Serverless Instance from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -148,17 +175,20 @@ func deleteServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } + type getServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string + name string } func (opts *getServerlessInstanceOpts) initClient() func() error { @@ -169,37 +199,31 @@ func (opts *getServerlessInstanceOpts) initClient() func() error { } } -func (opts *getServerlessInstanceOpts) Run(ctx context.Context) error { +func (opts *getServerlessInstanceOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, + Name: opts.name, } resp, _, err := opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getServerlessInstanceBuilder() *cobra.Command { - const template = "<>" - opts := getServerlessInstanceOpts{} cmd := &cobra.Command{ - Use: "getServerlessInstance", + Use: "getServerlessInstance", Short: "Return One Serverless Instance from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -207,19 +231,22 @@ func getServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } + type listServerlessInstancesOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string + client *admin.APIClient + groupId string includeCount bool itemsPerPage int - pageNum int + pageNum int } func (opts *listServerlessInstancesOpts) initClient() func() error { @@ -230,39 +257,33 @@ func (opts *listServerlessInstancesOpts) initClient() func() error { } } -func (opts *listServerlessInstancesOpts) Run(ctx context.Context) error { +func (opts *listServerlessInstancesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListServerlessInstancesApiParams{ - GroupId: opts.groupId, + GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, + PageNum: &opts.pageNum, } resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listServerlessInstancesBuilder() *cobra.Command { - const template = "<>" - opts := listServerlessInstancesOpts{} cmd := &cobra.Command{ - Use: "listServerlessInstances", + Use: "listServerlessInstances", Short: "Return All Serverless Instances from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -272,17 +293,22 @@ func listServerlessInstancesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd } + type updateServerlessInstanceOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient + client *admin.APIClient groupId string - name string - + name string + + filename string + fs afero.Fs } func (opts *updateServerlessInstanceOpts) initClient() func() error { @@ -293,50 +319,74 @@ func (opts *updateServerlessInstanceOpts) initClient() func() error { } } -func (opts *updateServerlessInstanceOpts) Run(ctx context.Context) error { +func (opts *updateServerlessInstanceOpts) readData() (*admin.ServerlessInstanceDescriptionUpdate, error) { + var out *admin.ServerlessInstanceDescriptionUpdate + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateServerlessInstanceOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateServerlessInstanceApiParams{ GroupId: opts.groupId, - Name: opts.name, - + Name: opts.name, + + ServerlessInstanceDescriptionUpdate: data, } resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateServerlessInstanceBuilder() *cobra.Command { - const template = "<>" - - opts := updateServerlessInstanceOpts{} + opts := updateServerlessInstanceOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ - Use: "updateServerlessInstance", + Use: "updateServerlessInstance", Short: "Update One Serverless Instance in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) - - cmd.Flags().ServerlessBackupOptionsVar(&opts.serverlessBackupOptions, "serverlessBackupOptions", , ``) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().BoolVar(&opts.terminationProtectionEnabled, "terminationProtectionEnabled", false, `Flag that indicates whether termination protection is enabled on the serverless instance. If set to `true`, MongoDB Cloud won't delete the serverless instance. If set to `false`, MongoDB Cloud will delete the serverless instance.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") @@ -345,8 +395,8 @@ func updateServerlessInstanceBuilder() *cobra.Command { func serverlessInstancesBuilder() *cobra.Command { cmd := &cobra.Command{ - Use: "serverlessInstances", - Short: `Returns, adds, edits, and removes serverless instances.`, + Use: "serverlessInstances", + Short: `Returns, adds, edits, and removes serverless instances.`, } cmd.AddCommand( createServerlessInstanceBuilder(), @@ -357,4 +407,3 @@ func serverlessInstancesBuilder() *cobra.Command { ) return cmd } - diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/generated/api_serverless_private_endpoints_cmd.go index 06992c836c..6b53acc615 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/generated/api_serverless_private_endpoints_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -30,6 +38,9 @@ type createServerlessPrivateEndpointOpts struct { client *admin.APIClient groupId string instanceName string + + filename string + fs afero.Fs } func (opts *createServerlessPrivateEndpointOpts) initClient() func() error { @@ -40,37 +51,61 @@ func (opts *createServerlessPrivateEndpointOpts) initClient() func() error { } } -func (opts *createServerlessPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *createServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantEndpointCreate, error) { + var out *admin.ServerlessTenantEndpointCreate + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, + + ServerlessTenantEndpointCreate: data, } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createServerlessPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - - opts := createServerlessPrivateEndpointOpts{} + opts := createServerlessPrivateEndpointOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createServerlessPrivateEndpoint", Short: "Create One Private Endpoint for One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -78,7 +113,10 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.`) - cmd.Flags().StringVar(&opts.comment, "comment", "", `Human-readable comment associated with the private endpoint.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") @@ -102,7 +140,7 @@ func (opts *deleteServerlessPrivateEndpointOpts) initClient() func() error { } } -func (opts *deleteServerlessPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *deleteServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, @@ -113,27 +151,21 @@ func (opts *deleteServerlessPrivateEndpointOpts) Run(ctx context.Context) error return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteServerlessPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - opts := deleteServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "deleteServerlessPrivateEndpoint", Short: "Remove One Private Endpoint for One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -142,6 +174,9 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") @@ -165,7 +200,7 @@ func (opts *getServerlessPrivateEndpointOpts) initClient() func() error { } } -func (opts *getServerlessPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *getServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, @@ -176,27 +211,21 @@ func (opts *getServerlessPrivateEndpointOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getServerlessPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - opts := getServerlessPrivateEndpointOpts{} cmd := &cobra.Command{ Use: "getServerlessPrivateEndpoint", Short: "Return One Private Endpoint for One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -205,6 +234,9 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") @@ -227,7 +259,7 @@ func (opts *listServerlessPrivateEndpointsOpts) initClient() func() error { } } -func (opts *listServerlessPrivateEndpointsOpts) Run(ctx context.Context) error { +func (opts *listServerlessPrivateEndpointsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListServerlessPrivateEndpointsApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, @@ -237,27 +269,21 @@ func (opts *listServerlessPrivateEndpointsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listServerlessPrivateEndpointsBuilder() *cobra.Command { - const template = "<>" - opts := listServerlessPrivateEndpointsOpts{} cmd := &cobra.Command{ Use: "listServerlessPrivateEndpoints", Short: "Return All Private Endpoints for One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -265,6 +291,9 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") return cmd @@ -277,6 +306,9 @@ type updateServerlessPrivateEndpointOpts struct { groupId string instanceName string endpointId string + + filename string + fs afero.Fs } func (opts *updateServerlessPrivateEndpointOpts) initClient() func() error { @@ -287,38 +319,62 @@ func (opts *updateServerlessPrivateEndpointOpts) initClient() func() error { } } -func (opts *updateServerlessPrivateEndpointOpts) Run(ctx context.Context) error { +func (opts *updateServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantEndpointUpdate, error) { + var out *admin.ServerlessTenantEndpointUpdate + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, EndpointId: opts.endpointId, + + ServerlessTenantEndpointUpdate: data, } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateServerlessPrivateEndpointBuilder() *cobra.Command { - const template = "<>" - - opts := updateServerlessPrivateEndpointOpts{} + opts := updateServerlessPrivateEndpointOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateServerlessPrivateEndpoint", Short: "Update One Private Endpoint for One Serverless Instance", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -327,6 +383,9 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/generated/api_shared_tier_restore_jobs_cmd.go index a5a9404da4..4b8d4ce733 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/generated/api_shared_tier_restore_jobs_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -30,6 +38,9 @@ type createSharedClusterBackupRestoreJobOpts struct { client *admin.APIClient clusterName string groupId string + + filename string + fs afero.Fs } func (opts *createSharedClusterBackupRestoreJobOpts) initClient() func() error { @@ -40,37 +51,61 @@ func (opts *createSharedClusterBackupRestoreJobOpts) initClient() func() error { } } -func (opts *createSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *createSharedClusterBackupRestoreJobOpts) readData() (*admin.TenantRestore, error) { + var out *admin.TenantRestore + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createSharedClusterBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, + + TenantRestore: data, } resp, _, err := opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - - opts := createSharedClusterBackupRestoreJobOpts{} + opts := createSharedClusterBackupRestoreJobOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createSharedClusterBackupRestoreJob", Short: "Create One Restore Job from One M2 or M5 Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -78,33 +113,36 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the source cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.deliveryType, "deliveryType", "", `Means by which this resource returns the snapshot to the requesting MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.expirationDate, "expirationDate", "", `Date and time when the download link no longer works. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.projectId, "projectId", "", `Unique 24-hexadecimal digit string that identifies the project from which the restore job originated.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.restoreFinishedDate, "restoreFinishedDate", "", `Date and time when MongoDB Cloud completed writing this snapshot. MongoDB Cloud changes the status of the restore job to `CLOSED`. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.restoreScheduledDate, "restoreScheduledDate", "", `Date and time when MongoDB Cloud will restore this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotFinishedDate, "snapshotFinishedDate", "", `Date and time when MongoDB Cloud completed writing this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the snapshot to restore.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotUrl, "snapshotUrl", "", `Internet address from which you can download the compressed snapshot files. The resource returns this parameter when `"deliveryType" : "DOWNLOAD"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.status, "status", "", `Phase of the restore workflow for this job at the time this resource made this request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.targetDeploymentItemName, "targetDeploymentItemName", "", `Human-readable label that identifies the cluster on the target project to which you want to restore the snapshot. You can restore the snapshot to a cluster tier *M2* or greater.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.targetProjectId, "targetProjectId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the cluster to which you want to restore the snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -128,7 +166,7 @@ func (opts *getSharedClusterBackupRestoreJobOpts) initClient() func() error { } } -func (opts *getSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error { +func (opts *getSharedClusterBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, @@ -139,27 +177,21 @@ func (opts *getSharedClusterBackupRestoreJobOpts) Run(ctx context.Context) error return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { - const template = "<>" - opts := getSharedClusterBackupRestoreJobOpts{} cmd := &cobra.Command{ Use: "getSharedClusterBackupRestoreJob", Short: "Return One Restore Job for One M2 or M5 Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -168,6 +200,9 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("restoreId") @@ -190,7 +225,7 @@ func (opts *listSharedClusterBackupRestoreJobsOpts) initClient() func() error { } } -func (opts *listSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context) error { +func (opts *listSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListSharedClusterBackupRestoreJobsApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, @@ -200,27 +235,21 @@ func (opts *listSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context) err return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { - const template = "<>" - opts := listSharedClusterBackupRestoreJobsOpts{} cmd := &cobra.Command{ Use: "listSharedClusterBackupRestoreJobs", Short: "Return All Restore Jobs for One M2 or M5 Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -228,6 +257,9 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/generated/api_shared_tier_snapshots_cmd.go index e7a81fc43f..ed5cf2ef7f 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/generated/api_shared_tier_snapshots_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -30,6 +38,9 @@ type downloadSharedClusterBackupOpts struct { client *admin.APIClient clusterName string groupId string + + filename string + fs afero.Fs } func (opts *downloadSharedClusterBackupOpts) initClient() func() error { @@ -40,37 +51,61 @@ func (opts *downloadSharedClusterBackupOpts) initClient() func() error { } } -func (opts *downloadSharedClusterBackupOpts) Run(ctx context.Context) error { +func (opts *downloadSharedClusterBackupOpts) readData() (*admin.TenantRestore, error) { + var out *admin.TenantRestore + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *downloadSharedClusterBackupOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.DownloadSharedClusterBackupApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, + + TenantRestore: data, } resp, _, err := opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func downloadSharedClusterBackupBuilder() *cobra.Command { - const template = "<>" - - opts := downloadSharedClusterBackupOpts{} + opts := downloadSharedClusterBackupOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "downloadSharedClusterBackup", Short: "Download One M2 or M5 Cluster Snapshot", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -78,33 +113,36 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the source cluster.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.deliveryType, "deliveryType", "", `Means by which this resource returns the snapshot to the requesting MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.expirationDate, "expirationDate", "", `Date and time when the download link no longer works. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.projectId, "projectId", "", `Unique 24-hexadecimal digit string that identifies the project from which the restore job originated.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.restoreFinishedDate, "restoreFinishedDate", "", `Date and time when MongoDB Cloud completed writing this snapshot. MongoDB Cloud changes the status of the restore job to `CLOSED`. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.restoreScheduledDate, "restoreScheduledDate", "", `Date and time when MongoDB Cloud will restore this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotFinishedDate, "snapshotFinishedDate", "", `Date and time when MongoDB Cloud completed writing this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the snapshot to restore.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.snapshotUrl, "snapshotUrl", "", `Internet address from which you can download the compressed snapshot files. The resource returns this parameter when `"deliveryType" : "DOWNLOAD"`.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.status, "status", "", `Phase of the restore workflow for this job at the time this resource made this request.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.targetDeploymentItemName, "targetDeploymentItemName", "", `Human-readable label that identifies the cluster on the target project to which you want to restore the snapshot. You can restore the snapshot to a cluster tier *M2* or greater.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.targetProjectId, "targetProjectId", "", `Unique 24-hexadecimal digit string that identifies the project that contains the cluster to which you want to restore the snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -128,7 +166,7 @@ func (opts *getSharedClusterBackupOpts) initClient() func() error { } } -func (opts *getSharedClusterBackupOpts) Run(ctx context.Context) error { +func (opts *getSharedClusterBackupOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetSharedClusterBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -139,27 +177,21 @@ func (opts *getSharedClusterBackupOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getSharedClusterBackupBuilder() *cobra.Command { - const template = "<>" - opts := getSharedClusterBackupOpts{} cmd := &cobra.Command{ Use: "getSharedClusterBackup", Short: "Return One Snapshot for One M2 or M5 Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -168,6 +200,9 @@ func getSharedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") @@ -190,7 +225,7 @@ func (opts *listSharedClusterBackupsOpts) initClient() func() error { } } -func (opts *listSharedClusterBackupsOpts) Run(ctx context.Context) error { +func (opts *listSharedClusterBackupsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListSharedClusterBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -200,27 +235,21 @@ func (opts *listSharedClusterBackupsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listSharedClusterBackupsBuilder() *cobra.Command { - const template = "<>" - opts := listSharedClusterBackupsOpts{} cmd := &cobra.Command{ Use: "listSharedClusterBackups", Short: "Return All Snapshots for One M2 or M5 Cluster", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -228,6 +257,9 @@ func listSharedClusterBackupsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/generated/api_teams_cmd.go b/internal/generated/api_teams_cmd.go index 4bd50c4983..16c6258fbf 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/generated/api_teams_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -29,6 +37,9 @@ type addAllTeamsToProjectOpts struct { cli.OutputOpts client *admin.APIClient groupId string + + filename string + fs afero.Fs } func (opts *addAllTeamsToProjectOpts) initClient() func() error { @@ -39,42 +50,69 @@ func (opts *addAllTeamsToProjectOpts) initClient() func() error { } } -func (opts *addAllTeamsToProjectOpts) Run(ctx context.Context) error { +func (opts *addAllTeamsToProjectOpts) readData() ([]*admin.TeamRole, error) { + var out []*admin.TeamRole + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *addAllTeamsToProjectOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.AddAllTeamsToProjectApiParams{ GroupId: opts.groupId, + + TeamRole: data, } resp, _, err := opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func addAllTeamsToProjectBuilder() *cobra.Command { - const template = "<>" - - opts := addAllTeamsToProjectOpts{} + opts := addAllTeamsToProjectOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "addAllTeamsToProject", Short: "Add One or More Teams to One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -85,6 +123,9 @@ type addTeamUserOpts struct { client *admin.APIClient orgId string teamId string + + filename string + fs afero.Fs } func (opts *addTeamUserOpts) initClient() func() error { @@ -95,42 +136,69 @@ func (opts *addTeamUserOpts) initClient() func() error { } } -func (opts *addTeamUserOpts) Run(ctx context.Context) error { +func (opts *addTeamUserOpts) readData() ([]*admin.AddUserToTeam, error) { + var out []*admin.AddUserToTeam + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *addTeamUserOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.AddTeamUserApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, + + AddUserToTeam: data, } resp, _, err := opts.client.TeamsApi.AddTeamUserWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func addTeamUserBuilder() *cobra.Command { - const template = "<>" - - opts := addTeamUserOpts{} + opts := addTeamUserOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "addTeamUser", Short: "Assign MongoDB Cloud Users from One Organization to One Team", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -141,6 +209,9 @@ type createTeamOpts struct { cli.OutputOpts client *admin.APIClient orgId string + + filename string + fs afero.Fs } func (opts *createTeamOpts) initClient() func() error { @@ -151,47 +222,74 @@ func (opts *createTeamOpts) initClient() func() error { } } -func (opts *createTeamOpts) Run(ctx context.Context) error { +func (opts *createTeamOpts) readData() (*admin.Team, error) { + var out *admin.Team + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createTeamOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateTeamApiParams{ OrgId: opts.orgId, + + Team: data, } resp, _, err := opts.client.TeamsApi.CreateTeamWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createTeamBuilder() *cobra.Command { - const template = "<>" - - opts := createTeamOpts{} + opts := createTeamOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createTeam", Short: "Create One Team in One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this team.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the team.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.usernames, "usernames", nil, `List that contains the MongoDB Cloud users in this team.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -213,7 +311,7 @@ func (opts *deleteTeamOpts) initClient() func() error { } } -func (opts *deleteTeamOpts) Run(ctx context.Context) error { +func (opts *deleteTeamOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteTeamApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, @@ -223,32 +321,29 @@ func (opts *deleteTeamOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteTeamBuilder() *cobra.Command { - const template = "<>" - opts := deleteTeamOpts{} cmd := &cobra.Command{ Use: "deleteTeam", Short: "Remove One Team from One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to delete.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -270,7 +365,7 @@ func (opts *getTeamByIdOpts) initClient() func() error { } } -func (opts *getTeamByIdOpts) Run(ctx context.Context) error { +func (opts *getTeamByIdOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetTeamByIdApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, @@ -280,32 +375,29 @@ func (opts *getTeamByIdOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getTeamByIdBuilder() *cobra.Command { - const template = "<>" - opts := getTeamByIdOpts{} cmd := &cobra.Command{ Use: "getTeamById", Short: "Return One Team using its ID", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose information you want to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -327,7 +419,7 @@ func (opts *getTeamByNameOpts) initClient() func() error { } } -func (opts *getTeamByNameOpts) Run(ctx context.Context) error { +func (opts *getTeamByNameOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetTeamByNameApiParams{ OrgId: opts.orgId, TeamName: opts.teamName, @@ -337,32 +429,29 @@ func (opts *getTeamByNameOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getTeamByNameBuilder() *cobra.Command { - const template = "<>" - opts := getTeamByNameOpts{} cmd := &cobra.Command{ Use: "getTeamByName", Short: "Return One Team using its Name", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamName, "teamName", "", `Name of the team whose information you want to return.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamName") return cmd @@ -386,7 +475,7 @@ func (opts *listOrganizationTeamsOpts) initClient() func() error { } } -func (opts *listOrganizationTeamsOpts) Run(ctx context.Context) error { +func (opts *listOrganizationTeamsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationTeamsApiParams{ OrgId: opts.orgId, ItemsPerPage: &opts.itemsPerPage, @@ -398,27 +487,21 @@ func (opts *listOrganizationTeamsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listOrganizationTeamsBuilder() *cobra.Command { - const template = "<>" - opts := listOrganizationTeamsOpts{} cmd := &cobra.Command{ Use: "listOrganizationTeams", Short: "Return All Teams in One Organization", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -426,6 +509,9 @@ func listOrganizationTeamsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -448,7 +534,7 @@ func (opts *listProjectTeamsOpts) initClient() func() error { } } -func (opts *listProjectTeamsOpts) Run(ctx context.Context) error { +func (opts *listProjectTeamsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectTeamsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -460,27 +546,21 @@ func (opts *listProjectTeamsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listProjectTeamsBuilder() *cobra.Command { - const template = "<>" - opts := listProjectTeamsOpts{} cmd := &cobra.Command{ Use: "listProjectTeams", Short: "Return All Teams in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -490,6 +570,9 @@ func listProjectTeamsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -512,7 +595,7 @@ func (opts *listTeamUsersOpts) initClient() func() error { } } -func (opts *listTeamUsersOpts) Run(ctx context.Context) error { +func (opts *listTeamUsersOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListTeamUsersApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, @@ -524,27 +607,21 @@ func (opts *listTeamUsersOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listTeamUsersBuilder() *cobra.Command { - const template = "<>" - opts := listTeamUsersOpts{} cmd := &cobra.Command{ Use: "listTeamUsers", Short: "Return All MongoDB Cloud Users Assigned to One Team", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -552,6 +629,9 @@ func listTeamUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -573,7 +653,7 @@ func (opts *removeProjectTeamOpts) initClient() func() error { } } -func (opts *removeProjectTeamOpts) Run(ctx context.Context) error { +func (opts *removeProjectTeamOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, @@ -583,27 +663,21 @@ func (opts *removeProjectTeamOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func removeProjectTeamBuilder() *cobra.Command { - const template = "<>" - opts := removeProjectTeamOpts{} cmd := &cobra.Command{ Use: "removeProjectTeam", Short: "Remove One Team from One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -611,6 +685,9 @@ func removeProjectTeamBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") return cmd @@ -633,7 +710,7 @@ func (opts *removeTeamUserOpts) initClient() func() error { } } -func (opts *removeTeamUserOpts) Run(ctx context.Context) error { +func (opts *removeTeamUserOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.RemoveTeamUserApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, @@ -644,33 +721,30 @@ func (opts *removeTeamUserOpts) Run(ctx context.Context) error { return err } - return opts.Print(nil) + return nil } func removeTeamUserBuilder() *cobra.Command { - const template = "<>" - opts := removeTeamUserOpts{} cmd := &cobra.Command{ Use: "removeTeamUser", Short: "Remove One MongoDB Cloud User from One Team", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") _ = cmd.MarkFlagRequired("userId") @@ -683,6 +757,9 @@ type renameTeamOpts struct { client *admin.APIClient orgId string teamId string + + filename string + fs afero.Fs } func (opts *renameTeamOpts) initClient() func() error { @@ -693,49 +770,76 @@ func (opts *renameTeamOpts) initClient() func() error { } } -func (opts *renameTeamOpts) Run(ctx context.Context) error { +func (opts *renameTeamOpts) readData() (*admin.Team, error) { + var out *admin.Team + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *renameTeamOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.RenameTeamApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, + + Team: data, } resp, _, err := opts.client.TeamsApi.RenameTeamWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func renameTeamBuilder() *cobra.Command { - const template = "<>" - - opts := renameTeamOpts{} + opts := renameTeamOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "renameTeam", Short: "Rename One Team", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to rename.`) - cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies this team.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the team.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.usernames, "usernames", nil, `List that contains the MongoDB Cloud users in this team.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -748,6 +852,9 @@ type updateTeamRolesOpts struct { client *admin.APIClient groupId string teamId string + + filename string + fs afero.Fs } func (opts *updateTeamRolesOpts) initClient() func() error { @@ -758,37 +865,61 @@ func (opts *updateTeamRolesOpts) initClient() func() error { } } -func (opts *updateTeamRolesOpts) Run(ctx context.Context) error { +func (opts *updateTeamRolesOpts) readData() (*admin.TeamRole, error) { + var out *admin.TeamRole + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateTeamRolesOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateTeamRolesApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, + + TeamRole: data, } resp, _, err := opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateTeamRolesBuilder() *cobra.Command { - const template = "<>" - - opts := updateTeamRolesOpts{} + opts := updateTeamRolesOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateTeamRoles", Short: "Update Team Roles in One Project", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -796,11 +927,14 @@ func updateTeamRolesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.`) - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().SetSliceVar(&opts.roleNames, "roleNames", nil, `One or more organization- or project-level roles to assign to the MongoDB Cloud user.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal character string that identifies the team.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") diff --git a/internal/generated/api_test__cmd.go b/internal/generated/api_test__cmd.go index cb880af9ed..0508430661 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/generated/api_test__cmd.go @@ -18,8 +18,12 @@ package generated import ( "context" + "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -39,7 +43,7 @@ func (opts *versionedExampleOpts) initClient() func() error { } } -func (opts *versionedExampleOpts) Run(ctx context.Context) error { +func (opts *versionedExampleOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.VersionedExampleApiParams{ AdditionalInfo: &opts.additionalInfo, } @@ -48,31 +52,28 @@ func (opts *versionedExampleOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func versionedExampleBuilder() *cobra.Command { - const template = "<>" - opts := versionedExampleOpts{} cmd := &cobra.Command{ Use: "versionedExample", Short: "Example resource info for versioning of the Atlas API", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.additionalInfo, "additionalInfo", false, ``) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + return cmd } diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/generated/api_third_party_integrations_cmd.go index 3d68d949e1..73233b66fc 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/generated/api_third_party_integrations_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -34,6 +42,8 @@ type createThirdPartyIntegrationOpts struct { includeCount bool itemsPerPage int pageNum int + filename string + fs afero.Fs } func (opts *createThirdPartyIntegrationOpts) initClient() func() error { @@ -44,7 +54,33 @@ func (opts *createThirdPartyIntegrationOpts) initClient() func() error { } } -func (opts *createThirdPartyIntegrationOpts) Run(ctx context.Context) error { +func (opts *createThirdPartyIntegrationOpts) readData() (*admin.Integration, error) { + var out *admin.Integration + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, @@ -52,33 +88,31 @@ func (opts *createThirdPartyIntegrationOpts) Run(ctx context.Context) error { IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, + + Integration: data, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func createThirdPartyIntegrationBuilder() *cobra.Command { - const template = "<>" - - opts := createThirdPartyIntegrationOpts{} + opts := createThirdPartyIntegrationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createThirdPartyIntegration", Short: "Configure One Third-Party Service Integration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -90,6 +124,9 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -111,7 +148,7 @@ func (opts *deleteThirdPartyIntegrationOpts) initClient() func() error { } } -func (opts *deleteThirdPartyIntegrationOpts) Run(ctx context.Context) error { +func (opts *deleteThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, @@ -121,27 +158,21 @@ func (opts *deleteThirdPartyIntegrationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func deleteThirdPartyIntegrationBuilder() *cobra.Command { - const template = "<>" - opts := deleteThirdPartyIntegrationOpts{} cmd := &cobra.Command{ Use: "deleteThirdPartyIntegration", Short: "Remove One Third-Party Service Integration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -149,6 +180,9 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") return cmd @@ -170,7 +204,7 @@ func (opts *getThirdPartyIntegrationOpts) initClient() func() error { } } -func (opts *getThirdPartyIntegrationOpts) Run(ctx context.Context) error { +func (opts *getThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.GetThirdPartyIntegrationApiParams{ GroupId: opts.groupId, IntegrationType: opts.integrationType, @@ -180,27 +214,21 @@ func (opts *getThirdPartyIntegrationOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func getThirdPartyIntegrationBuilder() *cobra.Command { - const template = "<>" - opts := getThirdPartyIntegrationOpts{} cmd := &cobra.Command{ Use: "getThirdPartyIntegration", Short: "Return One Third-Party Service Integration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -208,6 +236,9 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("integrationType") return cmd @@ -231,7 +262,7 @@ func (opts *listThirdPartyIntegrationsOpts) initClient() func() error { } } -func (opts *listThirdPartyIntegrationsOpts) Run(ctx context.Context) error { +func (opts *listThirdPartyIntegrationsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListThirdPartyIntegrationsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -243,27 +274,21 @@ func (opts *listThirdPartyIntegrationsOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listThirdPartyIntegrationsBuilder() *cobra.Command { - const template = "<>" - opts := listThirdPartyIntegrationsOpts{} cmd := &cobra.Command{ Use: "listThirdPartyIntegrations", Short: "Return All Active Third-Party Service Integrations", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -273,6 +298,9 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -287,6 +315,8 @@ type updateThirdPartyIntegrationOpts struct { includeCount bool itemsPerPage int pageNum int + filename string + fs afero.Fs } func (opts *updateThirdPartyIntegrationOpts) initClient() func() error { @@ -297,7 +327,33 @@ func (opts *updateThirdPartyIntegrationOpts) initClient() func() error { } } -func (opts *updateThirdPartyIntegrationOpts) Run(ctx context.Context) error { +func (opts *updateThirdPartyIntegrationOpts) readData() (*admin.Integration, error) { + var out *admin.Integration + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.UpdateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, @@ -305,33 +361,31 @@ func (opts *updateThirdPartyIntegrationOpts) Run(ctx context.Context) error { IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, + + Integration: data, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func updateThirdPartyIntegrationBuilder() *cobra.Command { - const template = "<>" - - opts := updateThirdPartyIntegrationOpts{} + opts := updateThirdPartyIntegrationOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "updateThirdPartyIntegration", Short: "Update One Third-Party Service Integration", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -343,6 +397,9 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/generated/api_x509_authentication_cmd.go index 79704dd32a..67c35b5fd2 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/generated/api_x509_authentication_cmd.go @@ -18,8 +18,16 @@ package generated import ( "context" + "encoding/json" + "fmt" + "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -30,6 +38,9 @@ type createDatabaseUserCertificateOpts struct { client *admin.APIClient groupId string username string + + filename string + fs afero.Fs } func (opts *createDatabaseUserCertificateOpts) initClient() func() error { @@ -40,37 +51,61 @@ func (opts *createDatabaseUserCertificateOpts) initClient() func() error { } } -func (opts *createDatabaseUserCertificateOpts) Run(ctx context.Context) error { +func (opts *createDatabaseUserCertificateOpts) readData() (*admin.UserCert, error) { + var out *admin.UserCert + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createDatabaseUserCertificateOpts) Run(ctx context.Context, _ io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } params := &admin.CreateDatabaseUserCertificateApiParams{ GroupId: opts.groupId, Username: opts.username, + + UserCert: data, } _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print(nil) + return nil } func createDatabaseUserCertificateBuilder() *cobra.Command { - const template = "<>" - - opts := createDatabaseUserCertificateOpts{} + opts := createDatabaseUserCertificateOpts{ + fs: afero.NewOsFs(), + } cmd := &cobra.Command{ Use: "createDatabaseUserCertificate", Short: "Create One X.509 Certificate for One MongoDB User", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -78,19 +113,22 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account for whom to create a certificate.`) - cmd.Flags().Int64Var(&opts._id, "_id", 00, `Unique 24-hexadecimal character string that identifies this certificate.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.createdAt, "createdAt", "", `Date and time when MongoDB Cloud created this certificate. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal character string that identifies the project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().ArraySliceVar(&opts.links, "links", nil, `List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().IntVar(&opts.monthsUntilExpiration, "monthsUntilExpiration", 3, `Number of months that the certificate remains valid until it expires.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.notAfter, "notAfter", "", `Date and time when this certificate expires. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVar(&opts.subject, "subject", "", `Subject Alternative Name associated with this certificate. This parameter expresses its value as a distinguished name as defined in [RFC 2253](https://tools.ietf.org/html/2253).`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") @@ -112,7 +150,7 @@ func (opts *disableCustomerManagedX509Opts) initClient() func() error { } } -func (opts *disableCustomerManagedX509Opts) Run(ctx context.Context) error { +func (opts *disableCustomerManagedX509Opts) Run(ctx context.Context, w io.Writer) error { params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, } @@ -121,33 +159,30 @@ func (opts *disableCustomerManagedX509Opts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func disableCustomerManagedX509Builder() *cobra.Command { - const template = "<>" - opts := disableCustomerManagedX509Opts{} cmd := &cobra.Command{ Use: "disableCustomerManagedX509", Short: "Disable Customer-Managed X.509", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -171,7 +206,7 @@ func (opts *listDatabaseUserCertificatesOpts) initClient() func() error { } } -func (opts *listDatabaseUserCertificatesOpts) Run(ctx context.Context) error { +func (opts *listDatabaseUserCertificatesOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListDatabaseUserCertificatesApiParams{ GroupId: opts.groupId, Username: opts.username, @@ -184,27 +219,21 @@ func (opts *listDatabaseUserCertificatesOpts) Run(ctx context.Context) error { return err } - return opts.Print(resp) + return jsonwriter.Print(w, resp) } func listDatabaseUserCertificatesBuilder() *cobra.Command { - const template = "<>" - opts := listDatabaseUserCertificatesOpts{} cmd := &cobra.Command{ Use: "listDatabaseUserCertificates", Short: "Return All X.509 Certificates Assigned to One MongoDB User", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -215,6 +244,9 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") return cmd diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index c24ed803e9..d2b93c50b6 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -4,11 +4,14 @@ package {{packageName}} import ( "context" "os" + "io" "time" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/cli" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/jsonwriter" ) {{#operations}} @@ -20,6 +23,10 @@ type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { {{#allParams}} {{^isBodyParam}}{{paramName}} {{{dataType}}}{{/isBodyParam}} {{/allParams}} + {{#bodyParam}} + filename string + fs afero.Fs + {{/bodyParam}} } func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) initClient() func() error { @@ -30,46 +37,78 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) initC } } -func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) Run(ctx context.Context) error { +{{#bodyParam}} +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) readData() ({{#isArray}}[]{{/isArray}}*admin.{{baseType}}, error) { + var out {{#isArray}}[]{{/isArray}}*admin.{{baseType}} + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} +{{/bodyParam}} + +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) Run(ctx context.Context, {{^returnType}}_{{/returnType}}{{#returnType}}w{{/returnType}} io.Writer) error { + {{#bodyParam}} + data, errData := opts.readData() + if errData != nil { + return errData + } + {{/bodyParam}} params := &admin.{{operationId}}ApiParams{ {{#allParams}} {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: {{#isDateTime}}convertTime({{/isDateTime}}{{^isPathParam}}&{{/isPathParam}}opts.{{paramName}}{{#isDateTime}}){{/isDateTime}},{{/isBodyParam}} - {{/allParams}} + {{/allParams}}{{#bodyParam}} + {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: data, + {{/bodyParam}} } {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params).Execute() if err != nil { return err } - return opts.Print({{#returnType}}resp{{/returnType}}{{^returnType}}nil{{/returnType}}) + return {{^returnType}}nil{{/returnType}}{{#returnType}}jsonwriter.Print(w, resp){{/returnType}} } func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.Command { - const template = "<>" - - opts := {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts{} + opts := {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts{ + {{#bodyParam}} + fs: afero.NewOsFs(), + {{/bodyParam}} + } cmd := &cobra.Command{ Use: "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}", Short: "{{ summary }}", - Annotations: map[string]string{ - "output": template, - }, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), - opts.InitOutput(cmd.OutOrStdout(), template), ) }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context()) + return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } {{#allParams}} {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, `{{unescapedDescription}}`){{/isBodyParam}} {{/allParams}} {{#bodyParam}}{{#vars}} - cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{baseName}}, "{{baseName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, `{{unescapedDescription}}`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") {{/vars}}{{/bodyParam}} + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) {{#allParams}}{{^isBodyParam}}{{#required}} _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/isBodyParam}}{{/allParams}} return cmd From 2dc00dcc57f99e84914930a4c7ca9b3ea80278fa Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 20 Sep 2023 16:48:49 +0100 Subject: [PATCH 21/44] move to api subcommands --- .../.openapi-generator-ignore | 0 .../.openapi-generator/FILES | 1 - .../.openapi-generator/VERSION | 0 .../api_access_tracking_cmd.go | 2 +- .../api_alert_configurations_cmd.go | 2 +- internal/{generated => api}/api_alerts_cmd.go | 2 +- .../api_atlas_search_cmd.go | 2 +- .../{generated => api}/api_auditing_cmd.go | 2 +- .../api_aws_clusters_dns_cmd.go | 2 +- .../api_cloud_backups_cmd.go | 2 +- .../api_cloud_migration_service_cmd.go | 2 +- .../api_cloud_provider_access_cmd.go | 2 +- .../api_cluster_outage_simulation_cmd.go | 2 +- .../{generated => api}/api_clusters_cmd.go | 2 +- .../api_custom_database_roles_cmd.go | 2 +- .../api_data_federation_cmd.go | 2 +- .../api_data_lake_pipelines_cmd.go | 2 +- .../api_database_users_cmd.go | 2 +- ..._rest_using_customer_key_management_cmd.go | 2 +- internal/{generated => api}/api_events_cmd.go | 2 +- .../api_federated_authentication_cmd.go | 2 +- .../api_global_clusters_cmd.go | 2 +- .../{generated => api}/api_invoices_cmd.go | 2 +- .../api_ldap_configuration_cmd.go | 2 +- .../api_legacy_backup_cmd.go | 2 +- .../api_legacy_backup_restore_jobs_cmd.go | 2 +- .../api_maintenance_windows__cmd.go | 2 +- .../api_mongo_db_cloud_users_cmd.go | 2 +- .../api_monitoring_and_logs_cmd.go | 2 +- .../api_multi_cloud_clusters_cmd.go | 2 +- .../api_network_peering_cmd.go | 2 +- .../api_online_archive_cmd.go | 2 +- .../api_organizations_cmd.go | 2 +- .../api_performance_advisor_cmd.go | 2 +- .../api_private_endpoint_services_cmd.go | 2 +- .../api_programmatic_api_keys_cmd.go | 2 +- .../api_project_ip_access_list_cmd.go | 2 +- .../{generated => api}/api_projects_cmd.go | 2 +- .../api_rolling_index_cmd.go | 2 +- internal/{generated => api}/api_root_cmd.go | 2 +- .../api_serverless_instances_cmd.go | 2 +- .../api_serverless_private_endpoints_cmd.go | 2 +- .../api_shared_tier_restore_jobs_cmd.go | 2 +- .../api_shared_tier_snapshots_cmd.go | 2 +- internal/{generated => api}/api_teams_cmd.go | 2 +- internal/{generated => api}/api_test__cmd.go | 2 +- .../api_third_party_integrations_cmd.go | 2 +- .../api_x509_authentication_cmd.go | 2 +- internal/cli/root/atlas/builder.go | 77 +++----- internal/generated/generated.go | 185 ------------------ tools/openapi-generator/config/config.yaml | 4 +- .../{generated.mustache => api.mustache} | 23 ++- tools/openapi-generator/package.json | 6 +- 53 files changed, 98 insertions(+), 288 deletions(-) rename internal/{generated => api}/.openapi-generator-ignore (100%) rename internal/{generated => api}/.openapi-generator/FILES (99%) rename internal/{generated => api}/.openapi-generator/VERSION (100%) rename internal/{generated => api}/api_access_tracking_cmd.go (99%) rename internal/{generated => api}/api_alert_configurations_cmd.go (99%) rename internal/{generated => api}/api_alerts_cmd.go (99%) rename internal/{generated => api}/api_atlas_search_cmd.go (99%) rename internal/{generated => api}/api_auditing_cmd.go (99%) rename internal/{generated => api}/api_aws_clusters_dns_cmd.go (99%) rename internal/{generated => api}/api_cloud_backups_cmd.go (99%) rename internal/{generated => api}/api_cloud_migration_service_cmd.go (99%) rename internal/{generated => api}/api_cloud_provider_access_cmd.go (99%) rename internal/{generated => api}/api_cluster_outage_simulation_cmd.go (99%) rename internal/{generated => api}/api_clusters_cmd.go (99%) rename internal/{generated => api}/api_custom_database_roles_cmd.go (99%) rename internal/{generated => api}/api_data_federation_cmd.go (99%) rename internal/{generated => api}/api_data_lake_pipelines_cmd.go (99%) rename internal/{generated => api}/api_database_users_cmd.go (99%) rename internal/{generated => api}/api_encryption_at_rest_using_customer_key_management_cmd.go (99%) rename internal/{generated => api}/api_events_cmd.go (99%) rename internal/{generated => api}/api_federated_authentication_cmd.go (99%) rename internal/{generated => api}/api_global_clusters_cmd.go (99%) rename internal/{generated => api}/api_invoices_cmd.go (99%) rename internal/{generated => api}/api_ldap_configuration_cmd.go (99%) rename internal/{generated => api}/api_legacy_backup_cmd.go (99%) rename internal/{generated => api}/api_legacy_backup_restore_jobs_cmd.go (99%) rename internal/{generated => api}/api_maintenance_windows__cmd.go (99%) rename internal/{generated => api}/api_mongo_db_cloud_users_cmd.go (99%) rename internal/{generated => api}/api_monitoring_and_logs_cmd.go (99%) rename internal/{generated => api}/api_multi_cloud_clusters_cmd.go (99%) rename internal/{generated => api}/api_network_peering_cmd.go (99%) rename internal/{generated => api}/api_online_archive_cmd.go (99%) rename internal/{generated => api}/api_organizations_cmd.go (99%) rename internal/{generated => api}/api_performance_advisor_cmd.go (99%) rename internal/{generated => api}/api_private_endpoint_services_cmd.go (99%) rename internal/{generated => api}/api_programmatic_api_keys_cmd.go (99%) rename internal/{generated => api}/api_project_ip_access_list_cmd.go (99%) rename internal/{generated => api}/api_projects_cmd.go (99%) rename internal/{generated => api}/api_rolling_index_cmd.go (99%) rename internal/{generated => api}/api_root_cmd.go (99%) rename internal/{generated => api}/api_serverless_instances_cmd.go (99%) rename internal/{generated => api}/api_serverless_private_endpoints_cmd.go (99%) rename internal/{generated => api}/api_shared_tier_restore_jobs_cmd.go (99%) rename internal/{generated => api}/api_shared_tier_snapshots_cmd.go (99%) rename internal/{generated => api}/api_teams_cmd.go (99%) rename internal/{generated => api}/api_test__cmd.go (99%) rename internal/{generated => api}/api_third_party_integrations_cmd.go (99%) rename internal/{generated => api}/api_x509_authentication_cmd.go (99%) delete mode 100644 internal/generated/generated.go rename tools/openapi-generator/config/go-templates/{generated.mustache => api.mustache} (88%) diff --git a/internal/generated/.openapi-generator-ignore b/internal/api/.openapi-generator-ignore similarity index 100% rename from internal/generated/.openapi-generator-ignore rename to internal/api/.openapi-generator-ignore diff --git a/internal/generated/.openapi-generator/FILES b/internal/api/.openapi-generator/FILES similarity index 99% rename from internal/generated/.openapi-generator/FILES rename to internal/api/.openapi-generator/FILES index 436a91abb9..198f7cf73f 100644 --- a/internal/generated/.openapi-generator/FILES +++ b/internal/api/.openapi-generator/FILES @@ -43,4 +43,3 @@ api_teams_cmd.go api_test__cmd.go api_third_party_integrations_cmd.go api_x509_authentication_cmd.go -generated.go diff --git a/internal/generated/.openapi-generator/VERSION b/internal/api/.openapi-generator/VERSION similarity index 100% rename from internal/generated/.openapi-generator/VERSION rename to internal/api/.openapi-generator/VERSION diff --git a/internal/generated/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go similarity index 99% rename from internal/generated/api_access_tracking_cmd.go rename to internal/api/api_access_tracking_cmd.go index 941cb2a582..5977b8e9e1 100644 --- a/internal/generated/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go similarity index 99% rename from internal/generated/api_alert_configurations_cmd.go rename to internal/api/api_alert_configurations_cmd.go index 2930af4fbe..043712a4d0 100644 --- a/internal/generated/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go similarity index 99% rename from internal/generated/api_alerts_cmd.go rename to internal/api/api_alerts_cmd.go index 98debf0554..e6b23a75b4 100644 --- a/internal/generated/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go similarity index 99% rename from internal/generated/api_atlas_search_cmd.go rename to internal/api/api_atlas_search_cmd.go index 1d4af99fd0..a75f340637 100644 --- a/internal/generated/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go similarity index 99% rename from internal/generated/api_auditing_cmd.go rename to internal/api/api_auditing_cmd.go index 6baca329d1..746540be1d 100644 --- a/internal/generated/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go similarity index 99% rename from internal/generated/api_aws_clusters_dns_cmd.go rename to internal/api/api_aws_clusters_dns_cmd.go index 2dbcceb50b..680f528f21 100644 --- a/internal/generated/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go similarity index 99% rename from internal/generated/api_cloud_backups_cmd.go rename to internal/api/api_cloud_backups_cmd.go index 67736f7c28..60efb313f4 100644 --- a/internal/generated/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go similarity index 99% rename from internal/generated/api_cloud_migration_service_cmd.go rename to internal/api/api_cloud_migration_service_cmd.go index 8399da769d..3762a801ff 100644 --- a/internal/generated/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go similarity index 99% rename from internal/generated/api_cloud_provider_access_cmd.go rename to internal/api/api_cloud_provider_access_cmd.go index 17e070b176..4b757b5f25 100644 --- a/internal/generated/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go similarity index 99% rename from internal/generated/api_cluster_outage_simulation_cmd.go rename to internal/api/api_cluster_outage_simulation_cmd.go index 23a941374d..7354e5b06b 100644 --- a/internal/generated/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go similarity index 99% rename from internal/generated/api_clusters_cmd.go rename to internal/api/api_clusters_cmd.go index a33f3f5707..a348862860 100644 --- a/internal/generated/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go similarity index 99% rename from internal/generated/api_custom_database_roles_cmd.go rename to internal/api/api_custom_database_roles_cmd.go index 51975adb70..6adb0bf555 100644 --- a/internal/generated/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go similarity index 99% rename from internal/generated/api_data_federation_cmd.go rename to internal/api/api_data_federation_cmd.go index ce293b9030..b97958a4ff 100644 --- a/internal/generated/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go similarity index 99% rename from internal/generated/api_data_lake_pipelines_cmd.go rename to internal/api/api_data_lake_pipelines_cmd.go index 52ed321c5d..dce3e403da 100644 --- a/internal/generated/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go similarity index 99% rename from internal/generated/api_database_users_cmd.go rename to internal/api/api_database_users_cmd.go index ec84fa7675..ffd7442a09 100644 --- a/internal/generated/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go similarity index 99% rename from internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go rename to internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index ca54f7fd8c..acf4000a9a 100644 --- a/internal/generated/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_events_cmd.go b/internal/api/api_events_cmd.go similarity index 99% rename from internal/generated/api_events_cmd.go rename to internal/api/api_events_cmd.go index 7318f3c063..7b00c81a08 100644 --- a/internal/generated/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go similarity index 99% rename from internal/generated/api_federated_authentication_cmd.go rename to internal/api/api_federated_authentication_cmd.go index bda56e3643..95a8427803 100644 --- a/internal/generated/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go similarity index 99% rename from internal/generated/api_global_clusters_cmd.go rename to internal/api/api_global_clusters_cmd.go index 50137ca5e4..9dc5a11d44 100644 --- a/internal/generated/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go similarity index 99% rename from internal/generated/api_invoices_cmd.go rename to internal/api/api_invoices_cmd.go index eba76cbd52..decc5b6da8 100644 --- a/internal/generated/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go similarity index 99% rename from internal/generated/api_ldap_configuration_cmd.go rename to internal/api/api_ldap_configuration_cmd.go index 48fdb824d4..2b490820e1 100644 --- a/internal/generated/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go similarity index 99% rename from internal/generated/api_legacy_backup_cmd.go rename to internal/api/api_legacy_backup_cmd.go index fa7d21098b..17fb8d5f58 100644 --- a/internal/generated/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go similarity index 99% rename from internal/generated/api_legacy_backup_restore_jobs_cmd.go rename to internal/api/api_legacy_backup_restore_jobs_cmd.go index c268300323..95b08263d6 100644 --- a/internal/generated/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go similarity index 99% rename from internal/generated/api_maintenance_windows__cmd.go rename to internal/api/api_maintenance_windows__cmd.go index 2634411af3..dc03e7c59e 100644 --- a/internal/generated/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go similarity index 99% rename from internal/generated/api_mongo_db_cloud_users_cmd.go rename to internal/api/api_mongo_db_cloud_users_cmd.go index db500f9e72..8d1dd9984b 100644 --- a/internal/generated/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go similarity index 99% rename from internal/generated/api_monitoring_and_logs_cmd.go rename to internal/api/api_monitoring_and_logs_cmd.go index 3066ca351e..554a824978 100644 --- a/internal/generated/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_multi_cloud_clusters_cmd.go b/internal/api/api_multi_cloud_clusters_cmd.go similarity index 99% rename from internal/generated/api_multi_cloud_clusters_cmd.go rename to internal/api/api_multi_cloud_clusters_cmd.go index 3bb7db106a..eeee9b3d50 100644 --- a/internal/generated/api_multi_cloud_clusters_cmd.go +++ b/internal/api/api_multi_cloud_clusters_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go similarity index 99% rename from internal/generated/api_network_peering_cmd.go rename to internal/api/api_network_peering_cmd.go index b3f8dd06d6..fa078d0865 100644 --- a/internal/generated/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go similarity index 99% rename from internal/generated/api_online_archive_cmd.go rename to internal/api/api_online_archive_cmd.go index 7ce105f548..66df9d2531 100644 --- a/internal/generated/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go similarity index 99% rename from internal/generated/api_organizations_cmd.go rename to internal/api/api_organizations_cmd.go index abb7991453..10ad9c4585 100644 --- a/internal/generated/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go similarity index 99% rename from internal/generated/api_performance_advisor_cmd.go rename to internal/api/api_performance_advisor_cmd.go index 3cd2cbd9e0..cb110d671a 100644 --- a/internal/generated/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go similarity index 99% rename from internal/generated/api_private_endpoint_services_cmd.go rename to internal/api/api_private_endpoint_services_cmd.go index 1de864e8cd..cf02088f2f 100644 --- a/internal/generated/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go similarity index 99% rename from internal/generated/api_programmatic_api_keys_cmd.go rename to internal/api/api_programmatic_api_keys_cmd.go index 4f7f645b92..dfb1163b6a 100644 --- a/internal/generated/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go similarity index 99% rename from internal/generated/api_project_ip_access_list_cmd.go rename to internal/api/api_project_ip_access_list_cmd.go index 67d33608d0..cce64f55b2 100644 --- a/internal/generated/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_projects_cmd.go b/internal/api/api_projects_cmd.go similarity index 99% rename from internal/generated/api_projects_cmd.go rename to internal/api/api_projects_cmd.go index b8e74b329b..afe69dc337 100644 --- a/internal/generated/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go similarity index 99% rename from internal/generated/api_rolling_index_cmd.go rename to internal/api/api_rolling_index_cmd.go index 9ab722826b..78cbf928b9 100644 --- a/internal/generated/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_root_cmd.go b/internal/api/api_root_cmd.go similarity index 99% rename from internal/generated/api_root_cmd.go rename to internal/api/api_root_cmd.go index 454c299de8..8fb49b84bf 100644 --- a/internal/generated/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go similarity index 99% rename from internal/generated/api_serverless_instances_cmd.go rename to internal/api/api_serverless_instances_cmd.go index c4f03332b2..9fdb801112 100644 --- a/internal/generated/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go similarity index 99% rename from internal/generated/api_serverless_private_endpoints_cmd.go rename to internal/api/api_serverless_private_endpoints_cmd.go index 6b53acc615..e07a87d062 100644 --- a/internal/generated/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go similarity index 99% rename from internal/generated/api_shared_tier_restore_jobs_cmd.go rename to internal/api/api_shared_tier_restore_jobs_cmd.go index 4b8d4ce733..bf28d629af 100644 --- a/internal/generated/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go similarity index 99% rename from internal/generated/api_shared_tier_snapshots_cmd.go rename to internal/api/api_shared_tier_snapshots_cmd.go index ed5cf2ef7f..e7e662e4e9 100644 --- a/internal/generated/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_teams_cmd.go b/internal/api/api_teams_cmd.go similarity index 99% rename from internal/generated/api_teams_cmd.go rename to internal/api/api_teams_cmd.go index 16c6258fbf..351737b5d5 100644 --- a/internal/generated/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_test__cmd.go b/internal/api/api_test__cmd.go similarity index 99% rename from internal/generated/api_test__cmd.go rename to internal/api/api_test__cmd.go index 0508430661..a97a396266 100644 --- a/internal/generated/api_test__cmd.go +++ b/internal/api/api_test__cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go similarity index 99% rename from internal/generated/api_third_party_integrations_cmd.go rename to internal/api/api_third_party_integrations_cmd.go index 73233b66fc..b075ccc249 100644 --- a/internal/generated/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/generated/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go similarity index 99% rename from internal/generated/api_x509_authentication_cmd.go rename to internal/api/api_x509_authentication_cmd.go index 67c35b5fd2..ca8a949202 100644 --- a/internal/generated/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -14,7 +14,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package generated +package api import ( "context" diff --git a/internal/cli/root/atlas/builder.go b/internal/cli/root/atlas/builder.go index e23398bfe6..7166b2f030 100644 --- a/internal/cli/root/atlas/builder.go +++ b/internal/cli/root/atlas/builder.go @@ -24,6 +24,7 @@ import ( "syscall" "time" + "github.com/mongodb/mongodb-atlas-cli/internal/api" "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/accesslists" "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/accesslogs" @@ -58,9 +59,10 @@ import ( "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/setup" "github.com/mongodb/mongodb-atlas-cli/internal/cli/auth" "github.com/mongodb/mongodb-atlas-cli/internal/cli/figautocomplete" + "github.com/mongodb/mongodb-atlas-cli/internal/cli/iam/teams" + "github.com/mongodb/mongodb-atlas-cli/internal/cli/iam/users" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/mongodb/mongodb-atlas-cli/internal/flag" - "github.com/mongodb/mongodb-atlas-cli/internal/generated" "github.com/mongodb/mongodb-atlas-cli/internal/homebrew" "github.com/mongodb/mongodb-atlas-cli/internal/latestrelease" "github.com/mongodb/mongodb-atlas-cli/internal/log" @@ -204,62 +206,47 @@ Use the --help flag with any command for more info on that command.`, registerCmd := auth.RegisterBuilder() registerCmd.Hidden = true - cmdList := append([]*cobra.Command{ + rootCmd.AddCommand( atlasConfig.Builder(), auth.Builder(), setup.Builder(), + projects.Builder(), + organizations.Builder(), + users.Builder(), + teams.Builder(), + clusters.Builder(), + dbusers.Builder(), + customdbroles.Builder(), + accesslists.Builder(), + datalake.Builder(), + datalakepipelines.Builder(), + alerts.Builder(), + backup.Builder(), + events.Builder(), + metrics.Builder(), + performanceadvisor.Builder(), + logs.Builder(), + processes.Builder(), + privateendpoints.Builder(), + networking.Builder(), + security.Builder(), + integrations.Builder(), + maintenance.Builder(), + customdns.Builder(), + cloudproviders.Builder(), + serverless.Builder(), + livemigrations.Builder(), + accesslogs.Builder(), loginCmd, logoutCmd, whoCmd, registerCmd, -<<<<<<< HEAD - }, generated.Commands()...) - rootCmd.AddCommand( - cmdList..., - /*atlasConfig.Builder(), - auth.Builder(), - quickstart.Builder(), - setup.Builder(), - projects.Builder(), - organizations.Builder(), - users.Builder(), - teams.Builder(), - clusters.Builder(), - dbusers.Builder(), - customdbroles.Builder(), - accesslists.Builder(), - datalake.Builder(), - datalakepipelines.Builder(), - alerts.Builder(), - backup.Builder(), - events.Builder(), - metrics.Builder(), - performanceadvisor.Builder(), - logs.Builder(), - processes.Builder(), - privateendpoints.Builder(), - networking.Builder(), - security.Builder(), - integrations.Builder(), - maintenance.Builder(), - customdns.Builder(), - cloudproviders.Builder(), - serverless.Builder(), - livemigrations.Builder(), - accesslogs.Builder(), - loginCmd, - logoutCmd, - whoCmd, - registerCmd, - figautocomplete.Builder(), - kubernetes.Builder(),*/ -======= figautocomplete.Builder(), kubernetes.Builder(), datafederation.Builder(), auditing.Builder(), deployments.Builder(), ->>>>>>> master + api.Builder(), ) rootCmd.PersistentFlags().StringVarP(&profile, flag.Profile, flag.ProfileShort, "", usage.ProfileAtlasCLI) diff --git a/internal/generated/generated.go b/internal/generated/generated.go deleted file mode 100644 index 38035ec359..0000000000 --- a/internal/generated/generated.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package generated - -import ( - "time" - "net" - "net/http" - - "github.com/spf13/cobra" - "github.com/mongodb-forks/digest" - "go.mongodb.org/atlas-sdk/v20230201008/admin" - "go.mongodb.org/atlas/auth" - "github.com/mongodb/mongodb-atlas-cli/internal/config" - "github.com/mongodb/mongodb-atlas-cli/internal/log" -) - -const ( - cloudGovServiceURL = "https://cloud.mongodbgov.com/" - timeout = 5 * time.Second - keepAlive = 30 * time.Second - maxIdleConns = 5 - maxIdleConnsPerHost = 4 - idleConnTimeout = 30 * time.Second - expectContinueTimeout = 1 * time.Second -) - -func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { - httpTransport := &http.Transport{ - DialContext: (&net.Dialer{ - Timeout: timeout, - KeepAlive: keepAlive, - }).DialContext, - MaxIdleConns: maxIdleConns, - MaxIdleConnsPerHost: maxIdleConnsPerHost, - Proxy: http.ProxyFromEnvironment, - IdleConnTimeout: idleConnTimeout, - ExpectContinueTimeout: expectContinueTimeout, - } - - if username == "" && password == "" && accessToken == nil { - return &http.Client{Transport: httpTransport}, nil - } - if username != "" && password != "" { - t := &digest.Transport{ - Username: username, - Password: password, - } - t.Transport = httpTransport - return t.Client() - } - tr := &Transport{ - token: accessToken, - base: httpTransport, - } - - return &http.Client{Transport: tr}, nil -} - -func newClientWithAuth() (*admin.APIClient, error) { - profile := config.Default() - - var authToken *auth.Token - - username := profile.PublicAPIKey() - password := profile.PrivateAPIKey() - - if username == "" && password == "" { - var err error - authToken, err = profile.Token() - if err != nil { - return nil, err - } - } - - baseURL := profile.OpsManagerURL() - if baseURL == "" && profile.Service() == config.CloudGovService { - baseURL = cloudGovServiceURL - } - - client, err := httpClient(username, password, authToken) - if err != nil { - return nil, err - } - - opts := []admin.ClientModifier{ - admin.UseHTTPClient(client), - admin.UseUserAgent(config.UserAgent), - admin.UseDebug(log.IsDebugLevel())} - - if baseURL != "" { - opts = append(opts, admin.UseBaseURL(baseURL)) - } - c, err := admin.NewClient(opts...) - if err != nil { - return nil, err - } - return c, nil -} - -type Transport struct { - token *auth.Token - base http.RoundTripper -} - -func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { - tr.token.SetAuthHeader(req) - return tr.base.RoundTrip(req) -} - -func convertTime(s *string) *time.Time { - if s == nil { - return nil - } - - r, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil - } - return &r -} - -func Commands() []*cobra.Command { - return []*cobra.Command { - aWSClustersDNSBuilder(), - accessTrackingBuilder(), - alertConfigurationsBuilder(), - alertsBuilder(), - atlasSearchBuilder(), - auditingBuilder(), - cloudBackupsBuilder(), - cloudMigrationServiceBuilder(), - cloudProviderAccessBuilder(), - clusterOutageSimulationBuilder(), - clustersBuilder(), - customDatabaseRolesBuilder(), - dataFederationBuilder(), - dataLakePipelinesBuilder(), - databaseUsersBuilder(), - encryptionAtRestUsingCustomerKeyManagementBuilder(), - eventsBuilder(), - federatedAuthenticationBuilder(), - globalClustersBuilder(), - invoicesBuilder(), - lDAPConfigurationBuilder(), - legacyBackupBuilder(), - legacyBackupRestoreJobsBuilder(), - maintenanceWindowsBuilder(), - mongoDBCloudUsersBuilder(), - monitoringAndLogsBuilder(), - multiCloudClustersBuilder(), - networkPeeringBuilder(), - onlineArchiveBuilder(), - organizationsBuilder(), - performanceAdvisorBuilder(), - privateEndpointServicesBuilder(), - programmaticAPIKeysBuilder(), - projectIPAccessListBuilder(), - projectsBuilder(), - rollingIndexBuilder(), - rootBuilder(), - serverlessInstancesBuilder(), - serverlessPrivateEndpointsBuilder(), - sharedTierRestoreJobsBuilder(), - sharedTierSnapshotsBuilder(), - teamsBuilder(), - testBuilder(), - thirdPartyIntegrationsBuilder(), - x509AuthenticationBuilder(), - } -} diff --git a/tools/openapi-generator/config/config.yaml b/tools/openapi-generator/config/config.yaml index 33b0e190fb..4d7be57d96 100644 --- a/tools/openapi-generator/config/config.yaml +++ b/tools/openapi-generator/config/config.yaml @@ -4,12 +4,12 @@ gitRepoId: mongodb-atlas-cli gitHost: github.com templateDir: config/go-templates isGoSubmodule: true -packageName: generated +packageName: api inputSpec: https://github.com/mongodb/atlas-sdk-go/raw/v0.7.0/openapi/atlas-api-transformed.yaml files: cmd.mustache: templateType: API destinationFilename: _cmd.go generated.mustache: - destinationFilename: generated.go + destinationFilename: api.go templateType: SupportingFiles diff --git a/tools/openapi-generator/config/go-templates/generated.mustache b/tools/openapi-generator/config/go-templates/api.mustache similarity index 88% rename from tools/openapi-generator/config/go-templates/generated.mustache rename to tools/openapi-generator/config/go-templates/api.mustache index dda9df79b9..cc3c103854 100644 --- a/tools/openapi-generator/config/go-templates/generated.mustache +++ b/tools/openapi-generator/config/go-templates/api.mustache @@ -119,12 +119,21 @@ func convertTime(s *string) *time.Time { return &r } -func Commands() []*cobra.Command { - return []*cobra.Command { -{{#apiInfo}} -{{#apis}} - {{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}Builder(), -{{/apis}} -{{/apiInfo}} +func Builder() *cobra.Command { + const use = "api" + cmd := &cobra.Command{ + Use: "api", + Short: "Access to api resources.", + Long: `This command provides access to API resources specified in https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/.`, } + + cmd.AddCommand( + {{#apiInfo}} + {{#apis}} + {{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}Builder(), + {{/apis}} + {{/apiInfo}} + ) + + return cmd } diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index d1b1493f73..cfc48c442c 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -3,9 +3,9 @@ "version": "1.0.0", "description": "OpenAPI Generator for MongoDB Atlas CLI", "scripts": { - "generate:clear": "rm -rf ../../internal/generated", - "generate:init": "mkdir -p ../../internal/generated && cp ./config/.openapi-generator-ignore ../../internal/generated/.openapi-generator-ignore", - "generate:run": "GO_POST_PROCESS_FILE='goimports -w' openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/generated", + "generate:clear": "rm -rf ../../internal/api", + "generate:init": "mkdir -p ../../internal/api && cp ./config/.openapi-generator-ignore ../../internal/api/.openapi-generator-ignore", + "generate:run": "GO_POST_PROCESS_FILE='goimports -w' openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api", "generate": "npm run generate:clear && npm run generate:init && npm run generate:run" }, "repository": { From dcd18cdaa8c0a218cff2840fbb4c47277062d9ce Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 20 Sep 2023 16:49:56 +0100 Subject: [PATCH 22/44] fix --- internal/cli/root/atlas/builder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cli/root/atlas/builder.go b/internal/cli/root/atlas/builder.go index 7166b2f030..4964fcd33b 100644 --- a/internal/cli/root/atlas/builder.go +++ b/internal/cli/root/atlas/builder.go @@ -57,10 +57,10 @@ import ( "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/security" "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/serverless" "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/setup" + "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/teams" + "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/users" "github.com/mongodb/mongodb-atlas-cli/internal/cli/auth" "github.com/mongodb/mongodb-atlas-cli/internal/cli/figautocomplete" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/iam/teams" - "github.com/mongodb/mongodb-atlas-cli/internal/cli/iam/users" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/homebrew" From e4f3da1aafdce49e26bb80e9a2be0252ca9e42a2 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 20 Sep 2023 16:51:13 +0100 Subject: [PATCH 23/44] fix test --- internal/cli/root/atlas/builder_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cli/root/atlas/builder_test.go b/internal/cli/root/atlas/builder_test.go index b6c97a120a..ea5637d6ef 100644 --- a/internal/cli/root/atlas/builder_test.go +++ b/internal/cli/root/atlas/builder_test.go @@ -35,7 +35,7 @@ func TestBuilder(t *testing.T) { test.CmdValidator( t, Builder(), - 53, + 40, []string{}, ) } From 4d5402c765b2631fe8f0524a69438987e4c374e5 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 20 Sep 2023 17:30:11 +0100 Subject: [PATCH 24/44] fix --- internal/api/.openapi-generator-ignore | 2 +- internal/api/.openapi-generator/FILES | 5 +- internal/api/api.go | 194 +++++ internal/api/api_alert_configurations_cmd.go | 18 +- internal/api/api_atlas_search_cmd.go | 12 +- internal/api/api_cloud_backups_cmd.go | 12 +- internal/api/api_cloud_provider_access_cmd.go | 52 ++ internal/api/api_clusters_cmd.go | 519 ++++++++++- internal/api/api_custom_database_roles_cmd.go | 6 +- internal/api/api_data_lake_pipelines_cmd.go | 18 +- internal/api/api_database_users_cmd.go | 31 +- internal/api/api_events_cmd.go | 43 +- .../api/api_federated_authentication_cmd.go | 12 +- internal/api/api_invoices_cmd.go | 165 +++- internal/api/api_ldap_configuration_cmd.go | 12 +- internal/api/api_legacy_backup_cmd.go | 12 +- .../api/api_legacy_backup_restore_jobs_cmd.go | 6 +- internal/api/api_maintenance_windows__cmd.go | 6 +- internal/api/api_mongo_db_cloud_users_cmd.go | 6 +- internal/api/api_monitoring_and_logs_cmd.go | 6 +- internal/api/api_multi_cloud_clusters_cmd.go | 547 ------------ internal/api/api_network_peering_cmd.go | 136 ++- internal/api/api_online_archive_cmd.go | 20 +- internal/api/api_organizations_cmd.go | 155 +++- internal/api/api_performance_advisor_cmd.go | 6 +- .../api/api_private_endpoint_services_cmd.go | 16 +- internal/api/api_programmatic_api_keys_cmd.go | 34 +- .../api/api_project_ip_access_list_cmd.go | 4 +- internal/api/api_projects_cmd.go | 122 ++- internal/api/api_push_based_log_export_cmd.go | 345 ++++++++ internal/api/api_rolling_index_cmd.go | 6 +- internal/api/api_serverless_instances_cmd.go | 4 + .../api_serverless_private_endpoints_cmd.go | 14 +- internal/api/api_streams_cmd.go | 816 ++++++++++++++++++ internal/api/api_teams_cmd.go | 14 +- internal/api/api_test__cmd.go | 89 -- .../api/api_third_party_integrations_cmd.go | 104 ++- internal/api/api_x509_authentication_cmd.go | 6 +- .../config/.openapi-generator-ignore | 2 +- tools/openapi-generator/config/config.yaml | 4 +- .../config/go-templates/cmd.mustache | 4 +- 41 files changed, 2775 insertions(+), 810 deletions(-) create mode 100644 internal/api/api.go delete mode 100644 internal/api/api_multi_cloud_clusters_cmd.go create mode 100644 internal/api/api_push_based_log_export_cmd.go create mode 100644 internal/api/api_streams_cmd.go delete mode 100644 internal/api/api_test__cmd.go diff --git a/internal/api/.openapi-generator-ignore b/internal/api/.openapi-generator-ignore index dec4d922ad..856ce9c953 100644 --- a/internal/api/.openapi-generator-ignore +++ b/internal/api/.openapi-generator-ignore @@ -1,4 +1,4 @@ **/* *.* !*_cmd.go -!generated.go +!api.go diff --git a/internal/api/.openapi-generator/FILES b/internal/api/.openapi-generator/FILES index 198f7cf73f..a0f5a6f478 100644 --- a/internal/api/.openapi-generator/FILES +++ b/internal/api/.openapi-generator/FILES @@ -1,3 +1,4 @@ +api.go api_access_tracking_cmd.go api_alert_configurations_cmd.go api_alerts_cmd.go @@ -24,7 +25,6 @@ api_legacy_backup_restore_jobs_cmd.go api_maintenance_windows__cmd.go api_mongo_db_cloud_users_cmd.go api_monitoring_and_logs_cmd.go -api_multi_cloud_clusters_cmd.go api_network_peering_cmd.go api_online_archive_cmd.go api_organizations_cmd.go @@ -33,13 +33,14 @@ api_private_endpoint_services_cmd.go api_programmatic_api_keys_cmd.go api_project_ip_access_list_cmd.go api_projects_cmd.go +api_push_based_log_export_cmd.go api_rolling_index_cmd.go api_root_cmd.go api_serverless_instances_cmd.go api_serverless_private_endpoints_cmd.go api_shared_tier_restore_jobs_cmd.go api_shared_tier_snapshots_cmd.go +api_streams_cmd.go api_teams_cmd.go -api_test__cmd.go api_third_party_integrations_cmd.go api_x509_authentication_cmd.go diff --git a/internal/api/api.go b/internal/api/api.go new file mode 100644 index 0000000000..822ed5ff45 --- /dev/null +++ b/internal/api/api.go @@ -0,0 +1,194 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "time" + "net" + "net/http" + + "github.com/spf13/cobra" + "github.com/mongodb-forks/digest" + "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas/auth" + "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/internal/log" +) + +const ( + cloudGovServiceURL = "https://cloud.mongodbgov.com/" + timeout = 5 * time.Second + keepAlive = 30 * time.Second + maxIdleConns = 5 + maxIdleConnsPerHost = 4 + idleConnTimeout = 30 * time.Second + expectContinueTimeout = 1 * time.Second +) + +func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { + httpTransport := &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: timeout, + KeepAlive: keepAlive, + }).DialContext, + MaxIdleConns: maxIdleConns, + MaxIdleConnsPerHost: maxIdleConnsPerHost, + Proxy: http.ProxyFromEnvironment, + IdleConnTimeout: idleConnTimeout, + ExpectContinueTimeout: expectContinueTimeout, + } + + if username == "" && password == "" && accessToken == nil { + return &http.Client{Transport: httpTransport}, nil + } + if username != "" && password != "" { + t := &digest.Transport{ + Username: username, + Password: password, + } + t.Transport = httpTransport + return t.Client() + } + tr := &Transport{ + token: accessToken, + base: httpTransport, + } + + return &http.Client{Transport: tr}, nil +} + +func newClientWithAuth() (*admin.APIClient, error) { + profile := config.Default() + + var authToken *auth.Token + + username := profile.PublicAPIKey() + password := profile.PrivateAPIKey() + + if username == "" && password == "" { + var err error + authToken, err = profile.Token() + if err != nil { + return nil, err + } + } + + baseURL := profile.OpsManagerURL() + if baseURL == "" && profile.Service() == config.CloudGovService { + baseURL = cloudGovServiceURL + } + + client, err := httpClient(username, password, authToken) + if err != nil { + return nil, err + } + + opts := []admin.ClientModifier{ + admin.UseHTTPClient(client), + admin.UseUserAgent(config.UserAgent), + admin.UseDebug(log.IsDebugLevel())} + + if baseURL != "" { + opts = append(opts, admin.UseBaseURL(baseURL)) + } + c, err := admin.NewClient(opts...) + if err != nil { + return nil, err + } + return c, nil +} + +type Transport struct { + token *auth.Token + base http.RoundTripper +} + +func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { + tr.token.SetAuthHeader(req) + return tr.base.RoundTrip(req) +} + +func convertTime(s *string) *time.Time { + if s == nil { + return nil + } + + r, err := time.Parse(time.RFC3339, *s) + if err != nil { + return nil + } + return &r +} + +func Builder() *cobra.Command { + const use = "api" + cmd := &cobra.Command{ + Use: "api", + Short: "Access to api resources.", + Long: `This command provides access to API resources specified in https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/.`, + } + + cmd.AddCommand( + aWSClustersDNSBuilder(), + accessTrackingBuilder(), + alertConfigurationsBuilder(), + alertsBuilder(), + atlasSearchBuilder(), + auditingBuilder(), + cloudBackupsBuilder(), + cloudMigrationServiceBuilder(), + cloudProviderAccessBuilder(), + clusterOutageSimulationBuilder(), + clustersBuilder(), + customDatabaseRolesBuilder(), + dataFederationBuilder(), + dataLakePipelinesBuilder(), + databaseUsersBuilder(), + encryptionAtRestUsingCustomerKeyManagementBuilder(), + eventsBuilder(), + federatedAuthenticationBuilder(), + globalClustersBuilder(), + invoicesBuilder(), + lDAPConfigurationBuilder(), + legacyBackupBuilder(), + legacyBackupRestoreJobsBuilder(), + maintenanceWindowsBuilder(), + mongoDBCloudUsersBuilder(), + monitoringAndLogsBuilder(), + networkPeeringBuilder(), + onlineArchiveBuilder(), + organizationsBuilder(), + performanceAdvisorBuilder(), + privateEndpointServicesBuilder(), + programmaticAPIKeysBuilder(), + projectIPAccessListBuilder(), + projectsBuilder(), + pushBasedLogExportBuilder(), + rollingIndexBuilder(), + rootBuilder(), + serverlessInstancesBuilder(), + serverlessPrivateEndpointsBuilder(), + sharedTierRestoreJobsBuilder(), + sharedTierSnapshotsBuilder(), + streamsBuilder(), + teamsBuilder(), + thirdPartyIntegrationsBuilder(), + x509AuthenticationBuilder(), + ) + + return cmd +} diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index 043712a4d0..39d6ca11da 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -50,8 +50,8 @@ func (opts *createAlertConfigurationOpts) initClient() func() error { } } -func (opts *createAlertConfigurationOpts) readData() (*admin.AlertConfigViewForNdsGroup, error) { - var out *admin.AlertConfigViewForNdsGroup +func (opts *createAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, error) { + var out *admin.GroupAlertsConfig var buf []byte var err error @@ -80,7 +80,7 @@ func (opts *createAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, - AlertConfigViewForNdsGroup: data, + GroupAlertsConfig: data, } resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -441,8 +441,8 @@ func (opts *toggleAlertConfigurationOpts) initClient() func() error { } } -func (opts *toggleAlertConfigurationOpts) readData() (*admin.Toggle, error) { - var out *admin.Toggle +func (opts *toggleAlertConfigurationOpts) readData() (*admin.AlertsToggle, error) { + var out *admin.AlertsToggle var buf []byte var err error @@ -472,7 +472,7 @@ func (opts *toggleAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - Toggle: data, + AlertsToggle: data, } resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() if err != nil { @@ -532,8 +532,8 @@ func (opts *updateAlertConfigurationOpts) initClient() func() error { } } -func (opts *updateAlertConfigurationOpts) readData() (*admin.AlertConfigViewForNdsGroup, error) { - var out *admin.AlertConfigViewForNdsGroup +func (opts *updateAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, error) { + var out *admin.GroupAlertsConfig var buf []byte var err error @@ -563,7 +563,7 @@ func (opts *updateAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, - AlertConfigViewForNdsGroup: data, + GroupAlertsConfig: data, } resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index a75f340637..cf0cd65f01 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -51,8 +51,8 @@ func (opts *createAtlasSearchIndexOpts) initClient() func() error { } } -func (opts *createAtlasSearchIndexOpts) readData() (*admin.FTSIndex, error) { - var out *admin.FTSIndex +func (opts *createAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, error) { + var out *admin.ClusterSearchIndex var buf []byte var err error @@ -82,7 +82,7 @@ func (opts *createAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) er GroupId: opts.groupId, ClusterName: opts.clusterName, - FTSIndex: data, + ClusterSearchIndex: data, } resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { @@ -345,8 +345,8 @@ func (opts *updateAtlasSearchIndexOpts) initClient() func() error { } } -func (opts *updateAtlasSearchIndexOpts) readData() (*admin.FTSIndex, error) { - var out *admin.FTSIndex +func (opts *updateAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, error) { + var out *admin.ClusterSearchIndex var buf []byte var err error @@ -377,7 +377,7 @@ func (opts *updateAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) er ClusterName: opts.clusterName, IndexId: opts.indexId, - FTSIndex: data, + ClusterSearchIndex: data, } resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 60efb313f4..0c29587eed 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -208,8 +208,8 @@ func (opts *createBackupRestoreJobOpts) initClient() func() error { } } -func (opts *createBackupRestoreJobOpts) readData() (*admin.DiskBackupRestoreJob, error) { - var out *admin.DiskBackupRestoreJob +func (opts *createBackupRestoreJobOpts) readData() (*admin.DiskBackupSnapshotRestoreJob, error) { + var out *admin.DiskBackupSnapshotRestoreJob var buf []byte var err error @@ -239,7 +239,7 @@ func (opts *createBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) er GroupId: opts.groupId, ClusterName: opts.clusterName, - DiskBackupRestoreJob: data, + DiskBackupSnapshotRestoreJob: data, } resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { @@ -2069,8 +2069,8 @@ func (opts *updateSnapshotRetentionOpts) initClient() func() error { } } -func (opts *updateSnapshotRetentionOpts) readData() (*admin.SnapshotRetention, error) { - var out *admin.SnapshotRetention +func (opts *updateSnapshotRetentionOpts) readData() (*admin.BackupSnapshotRetention, error) { + var out *admin.BackupSnapshotRetention var buf []byte var err error @@ -2101,7 +2101,7 @@ func (opts *updateSnapshotRetentionOpts) Run(ctx context.Context, w io.Writer) e ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, - SnapshotRetention: data, + BackupSnapshotRetention: data, } resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index 4b757b5f25..f24e6323d6 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -113,6 +113,32 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -199,6 +225,32 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index a348862860..9fddeb6c22 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -32,6 +32,252 @@ import ( "go.mongodb.org/atlas-sdk/v20230201008/admin" ) +type createClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + + filename string + fs afero.Fs +} + +func (opts *createClusterOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *createClusterOpts) readData() (*admin.AdvancedClusterDescription, error) { + var out *admin.AdvancedClusterDescription + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createClusterOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.CreateClusterApiParams{ + GroupId: opts.groupId, + + AdvancedClusterDescription: data, + } + resp, _, err := opts.client.ClustersApi.CreateClusterWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func createClusterBuilder() *cobra.Command { + opts := createClusterOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "createCluster", + Short: "Create One Multi-Cloud Cluster from One Project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + return cmd +} + +type deleteClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + clusterName string + retainBackups bool +} + +func (opts *deleteClusterOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *deleteClusterOpts) Run(ctx context.Context, _ io.Writer) error { + params := &admin.DeleteClusterApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + RetainBackups: &opts.retainBackups, + } + _, err := opts.client.ClustersApi.DeleteClusterWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return nil +} + +func deleteClusterBuilder() *cobra.Command { + opts := deleteClusterOpts{} + cmd := &cobra.Command{ + Use: "deleteCluster", + Short: "Remove One Multi-Cloud Cluster from One Project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("clusterName") + return cmd +} + +type getClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + clusterName string +} + +func (opts *getClusterOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *getClusterOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.GetClusterApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + resp, _, err := opts.client.ClustersApi.GetClusterWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func getClusterBuilder() *cobra.Command { + opts := getClusterOpts{} + cmd := &cobra.Command{ + Use: "getCluster", + Short: "Return One Multi-Cloud Cluster from One Project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("clusterName") + return cmd +} + type getClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts @@ -267,6 +513,70 @@ func listCloudProviderRegionsBuilder() *cobra.Command { return cmd } +type listClustersOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + includeCount bool + itemsPerPage int + pageNum int + includeDeletedWithRetainedBackups bool +} + +func (opts *listClustersOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *listClustersOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.ListClustersApiParams{ + GroupId: opts.groupId, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + IncludeDeletedWithRetainedBackups: &opts.includeDeletedWithRetainedBackups, + } + resp, _, err := opts.client.ClustersApi.ListClustersWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func listClustersBuilder() *cobra.Command { + opts := listClustersOpts{} + cmd := &cobra.Command{ + Use: "listClusters", + Short: "Return All Clusters in One Project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().BoolVar(&opts.includeDeletedWithRetainedBackups, "includeDeletedWithRetainedBackups", false, `Flag that indicates whether to return Clusters with retain backups.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + return cmd +} + type listClustersForAllProjectsOpts struct { cli.GlobalOpts cli.OutputOpts @@ -378,6 +688,197 @@ func loadSampleDatasetBuilder() *cobra.Command { return cmd } +type testFailoverOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + clusterName string +} + +func (opts *testFailoverOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *testFailoverOpts) Run(ctx context.Context, _ io.Writer) error { + params := &admin.TestFailoverApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + _, err := opts.client.ClustersApi.TestFailoverWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return nil +} + +func testFailoverBuilder() *cobra.Command { + opts := testFailoverOpts{} + cmd := &cobra.Command{ + Use: "testFailover", + Short: "Test Failover for One Multi-Cloud Cluster", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("clusterName") + return cmd +} + +type updateClusterOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + clusterName string + + filename string + fs afero.Fs +} + +func (opts *updateClusterOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *updateClusterOpts) readData() (*admin.AdvancedClusterDescription, error) { + var out *admin.AdvancedClusterDescription + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateClusterOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.UpdateClusterApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + + AdvancedClusterDescription: data, + } + resp, _, err := opts.client.ClustersApi.UpdateClusterWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func updateClusterBuilder() *cobra.Command { + opts := updateClusterOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "updateCluster", + Short: "Modify One Multi-Cloud Cluster from One Project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("clusterName") + return cmd +} + type updateClusterAdvancedConfigurationOpts struct { cli.GlobalOpts cli.OutputOpts @@ -479,6 +980,10 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -505,8 +1010,8 @@ func (opts *upgradeSharedClusterOpts) initClient() func() error { } } -func (opts *upgradeSharedClusterOpts) readData() (*admin.LegacyClusterDescription, error) { - var out *admin.LegacyClusterDescription +func (opts *upgradeSharedClusterOpts) readData() (*admin.LegacyAtlasCluster, error) { + var out *admin.LegacyAtlasCluster var buf []byte var err error @@ -535,7 +1040,7 @@ func (opts *upgradeSharedClusterOpts) Run(ctx context.Context, w io.Writer) erro params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, - LegacyClusterDescription: data, + LegacyAtlasCluster: data, } resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() if err != nil { @@ -629,6 +1134,8 @@ func upgradeSharedClusterBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -751,12 +1258,18 @@ func clustersBuilder() *cobra.Command { Short: `Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.`, } cmd.AddCommand( + createClusterBuilder(), + deleteClusterBuilder(), + getClusterBuilder(), getClusterAdvancedConfigurationBuilder(), getClusterStatusBuilder(), getSampleDatasetLoadStatusBuilder(), listCloudProviderRegionsBuilder(), + listClustersBuilder(), listClustersForAllProjectsBuilder(), loadSampleDatasetBuilder(), + testFailoverBuilder(), + updateClusterBuilder(), updateClusterAdvancedConfigurationBuilder(), upgradeSharedClusterBuilder(), upgradeSharedClusterToServerlessBuilder(), diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 6adb0bf555..e9ecf4778f 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -50,8 +50,8 @@ func (opts *createCustomDatabaseRoleOpts) initClient() func() error { } } -func (opts *createCustomDatabaseRoleOpts) readData() (*admin.CustomDBRole, error) { - var out *admin.CustomDBRole +func (opts *createCustomDatabaseRoleOpts) readData() (*admin.UserCustomDBRole, error) { + var out *admin.UserCustomDBRole var buf []byte var err error @@ -80,7 +80,7 @@ func (opts *createCustomDatabaseRoleOpts) Run(ctx context.Context, w io.Writer) params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, - CustomDBRole: data, + UserCustomDBRole: data, } resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index dce3e403da..2f01e081d4 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -50,8 +50,8 @@ func (opts *createPipelineOpts) initClient() func() error { } } -func (opts *createPipelineOpts) readData() (*admin.IngestionPipeline, error) { - var out *admin.IngestionPipeline +func (opts *createPipelineOpts) readData() (*admin.DataLakeIngestionPipeline, error) { + var out *admin.DataLakeIngestionPipeline var buf []byte var err error @@ -80,7 +80,7 @@ func (opts *createPipelineOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, - IngestionPipeline: data, + DataLakeIngestionPipeline: data, } resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() if err != nil { @@ -742,8 +742,8 @@ func (opts *triggerSnapshotIngestionOpts) initClient() func() error { } } -func (opts *triggerSnapshotIngestionOpts) readData() (*admin.TriggerIngestionRequest, error) { - var out *admin.TriggerIngestionRequest +func (opts *triggerSnapshotIngestionOpts) readData() (*admin.TriggerIngestionPipelineRequest, error) { + var out *admin.TriggerIngestionPipelineRequest var buf []byte var err error @@ -773,7 +773,7 @@ func (opts *triggerSnapshotIngestionOpts) Run(ctx context.Context, w io.Writer) GroupId: opts.groupId, PipelineName: opts.pipelineName, - TriggerIngestionRequest: data, + TriggerIngestionPipelineRequest: data, } resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() if err != nil { @@ -833,8 +833,8 @@ func (opts *updatePipelineOpts) initClient() func() error { } } -func (opts *updatePipelineOpts) readData() (*admin.IngestionPipeline, error) { - var out *admin.IngestionPipeline +func (opts *updatePipelineOpts) readData() (*admin.DataLakeIngestionPipeline, error) { + var out *admin.DataLakeIngestionPipeline var buf []byte var err error @@ -864,7 +864,7 @@ func (opts *updatePipelineOpts) Run(ctx context.Context, w io.Writer) error { GroupId: opts.groupId, PipelineName: opts.pipelineName, - IngestionPipeline: data, + DataLakeIngestionPipeline: data, } resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index ffd7442a09..7c440a7ecb 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -50,8 +50,8 @@ func (opts *createDatabaseUserOpts) initClient() func() error { } } -func (opts *createDatabaseUserOpts) readData() (*admin.DatabaseUser, error) { - var out *admin.DatabaseUser +func (opts *createDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) { + var out *admin.CloudDatabaseUser var buf []byte var err error @@ -80,7 +80,7 @@ func (opts *createDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, - DatabaseUser: data, + CloudDatabaseUser: data, } resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params).Execute() if err != nil { @@ -134,6 +134,8 @@ func createDatabaseUserBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -189,7 +191,7 @@ func deleteDatabaseUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | @@ -200,7 +202,8 @@ func deleteDatabaseUserBuilder() *cobra.Command { | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | +| OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | +| SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) @@ -260,7 +263,7 @@ func getDatabaseUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | @@ -271,7 +274,8 @@ func getDatabaseUserBuilder() *cobra.Command { | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | +| OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | +| SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) @@ -364,8 +368,8 @@ func (opts *updateDatabaseUserOpts) initClient() func() error { } } -func (opts *updateDatabaseUserOpts) readData() (*admin.DatabaseUser, error) { - var out *admin.DatabaseUser +func (opts *updateDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) { + var out *admin.CloudDatabaseUser var buf []byte var err error @@ -396,7 +400,7 @@ func (opts *updateDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error DatabaseName: opts.databaseName, Username: opts.username, - DatabaseUser: data, + CloudDatabaseUser: data, } resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params).Execute() if err != nil { @@ -425,7 +429,7 @@ func updateDatabaseUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA, this value should be `admin`.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: | Authentication Method | Parameter Needed | Parameter Value | username Format | @@ -436,7 +440,8 @@ func updateDatabaseUserBuilder() *cobra.Command { | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | -| SCRAM-SHA | awsType, x509Type, ldapAuthType | NONE | Alphanumeric string | +| OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | +| SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -463,6 +468,8 @@ func updateDatabaseUserBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 7b00c81a08..7a4523a853 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -220,16 +220,17 @@ func listOrganizationEventsBuilder() *cobra.Command { type listProjectEventsOpts struct { cli.GlobalOpts cli.OutputOpts - client *admin.APIClient - groupId string - includeCount bool - itemsPerPage int - pageNum int - clusterNames []string - eventType []string - includeRaw bool - maxDate string - minDate string + client *admin.APIClient + groupId string + includeCount bool + itemsPerPage int + pageNum int + clusterNames []string + eventType []string + excludedEventType []string + includeRaw bool + maxDate string + minDate string } func (opts *listProjectEventsOpts) initClient() func() error { @@ -242,15 +243,16 @@ func (opts *listProjectEventsOpts) initClient() func() error { func (opts *listProjectEventsOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectEventsApiParams{ - GroupId: opts.groupId, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - ClusterNames: &opts.clusterNames, - EventType: &opts.eventType, - IncludeRaw: &opts.includeRaw, - MaxDate: convertTime(&opts.maxDate), - MinDate: convertTime(&opts.minDate), + GroupId: opts.groupId, + IncludeCount: &opts.includeCount, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + ClusterNames: &opts.clusterNames, + EventType: &opts.eventType, + ExcludedEventType: &opts.excludedEventType, + IncludeRaw: &opts.includeRaw, + MaxDate: convertTime(&opts.maxDate), + MinDate: convertTime(&opts.minDate), } resp, _, err := opts.client.EventsApi.ListProjectEventsWithParams(ctx, params).Execute() if err != nil { @@ -284,6 +286,9 @@ func listProjectEventsBuilder() *cobra.Command { cmd.Flags().StringSliceVar(&opts.eventType, "eventType", nil, `Category of incident recorded at this moment in time. **IMPORTANT**: The complete list of event type values changes frequently.`) + cmd.Flags().StringSliceVar(&opts.excludedEventType, "excludedEventType", nil, `Category of event that you would like to exclude from query results, such as CLUSTER_CREATED + +**IMPORTANT**: Event type names change frequently. Verify that you specify the event type correctly by checking the complete list of event types.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index 95a8427803..76d87ba237 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -51,8 +51,8 @@ func (opts *createRoleMappingOpts) initClient() func() error { } } -func (opts *createRoleMappingOpts) readData() (*admin.RoleMapping, error) { - var out *admin.RoleMapping +func (opts *createRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, error) { + var out *admin.AuthFederationRoleMapping var buf []byte var err error @@ -82,7 +82,7 @@ func (opts *createRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, - RoleMapping: data, + AuthFederationRoleMapping: data, } resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() if err != nil { @@ -943,8 +943,8 @@ func (opts *updateRoleMappingOpts) initClient() func() error { } } -func (opts *updateRoleMappingOpts) readData() (*admin.RoleMapping, error) { - var out *admin.RoleMapping +func (opts *updateRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, error) { + var out *admin.AuthFederationRoleMapping var buf []byte var err error @@ -975,7 +975,7 @@ func (opts *updateRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { Id: opts.id, OrgId: opts.orgId, - RoleMapping: data, + AuthFederationRoleMapping: data, } resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index decc5b6da8..24ffae687c 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -18,16 +18,173 @@ package api import ( "context" + "encoding/json" + "fmt" "io" + "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) +type createCostExplorerQueryProcessOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + orgId string + + filename string + fs afero.Fs +} + +func (opts *createCostExplorerQueryProcessOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *createCostExplorerQueryProcessOpts) readData() (*admin.CostExplorerFilterRequestBody, error) { + var out *admin.CostExplorerFilterRequestBody + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createCostExplorerQueryProcessOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.CreateCostExplorerQueryProcessApiParams{ + OrgId: opts.orgId, + + CostExplorerFilterRequestBody: data, + } + resp, _, err := opts.client.InvoicesApi.CreateCostExplorerQueryProcessWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func createCostExplorerQueryProcessBuilder() *cobra.Command { + opts := createCostExplorerQueryProcessOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "createCostExplorerQueryProcess", + Short: "Create Cost Explorer query process", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("orgId") + return cmd +} + +type createCostExplorerQueryProcess1Opts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + orgId string + token string +} + +func (opts *createCostExplorerQueryProcess1Opts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *createCostExplorerQueryProcess1Opts) Run(ctx context.Context, w io.Writer) error { + params := &admin.CreateCostExplorerQueryProcess1ApiParams{ + OrgId: opts.orgId, + Token: opts.token, + } + resp, _, err := opts.client.InvoicesApi.CreateCostExplorerQueryProcess1WithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func createCostExplorerQueryProcess1Builder() *cobra.Command { + opts := createCostExplorerQueryProcess1Opts{} + cmd := &cobra.Command{ + Use: "createCostExplorerQueryProcess1", + Short: "Return results from a given Cost Explorer query, or notify that the results are not ready yet.", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.token, "token", "", `Unique 64 digit string that identifies the Cost Explorer query.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("orgId") + _ = cmd.MarkFlagRequired("token") + return cmd +} + type downloadInvoiceCSVOpts struct { cli.GlobalOpts cli.OutputOpts @@ -44,17 +201,17 @@ func (opts *downloadInvoiceCSVOpts) initClient() func() error { } } -func (opts *downloadInvoiceCSVOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *downloadInvoiceCSVOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DownloadInvoiceCSVApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, } - _, err := opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params).Execute() + resp, _, err := opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params).Execute() if err != nil { return err } - return nil + return jsonwriter.Print(w, resp) } func downloadInvoiceCSVBuilder() *cobra.Command { @@ -251,6 +408,8 @@ func invoicesBuilder() *cobra.Command { Short: `Returns invoices.`, } cmd.AddCommand( + createCostExplorerQueryProcessBuilder(), + createCostExplorerQueryProcess1Builder(), downloadInvoiceCSVBuilder(), getInvoiceBuilder(), listInvoicesBuilder(), diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 2b490820e1..5a84c54413 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -47,16 +47,16 @@ func (opts *deleteLDAPConfigurationOpts) initClient() func() error { } } -func (opts *deleteLDAPConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deleteLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, } - _, err := opts.client.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(ctx, params).Execute() + resp, _, err := opts.client.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return nil + return jsonwriter.Print(w, resp) } func deleteLDAPConfigurationBuilder() *cobra.Command { @@ -301,8 +301,8 @@ func (opts *verifyLDAPConfigurationOpts) initClient() func() error { } } -func (opts *verifyLDAPConfigurationOpts) readData() (*admin.NDSLDAPVerifyConnectivityJobRequestParams, error) { - var out *admin.NDSLDAPVerifyConnectivityJobRequestParams +func (opts *verifyLDAPConfigurationOpts) readData() (*admin.LDAPVerifyConnectivityJobRequestParams, error) { + var out *admin.LDAPVerifyConnectivityJobRequestParams var buf []byte var err error @@ -331,7 +331,7 @@ func (opts *verifyLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) e params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, - NDSLDAPVerifyConnectivityJobRequestParams: data, + LDAPVerifyConnectivityJobRequestParams: data, } resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 17fb8d5f58..1d548dc405 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -549,8 +549,8 @@ func (opts *updateLegacySnapshotRetentionOpts) initClient() func() error { } } -func (opts *updateLegacySnapshotRetentionOpts) readData() (*admin.Snapshot, error) { - var out *admin.Snapshot +func (opts *updateLegacySnapshotRetentionOpts) readData() (*admin.BackupSnapshot, error) { + var out *admin.BackupSnapshot var buf []byte var err error @@ -581,7 +581,7 @@ func (opts *updateLegacySnapshotRetentionOpts) Run(ctx context.Context, w io.Wri ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, - Snapshot: data, + BackupSnapshot: data, } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() if err != nil { @@ -663,8 +663,8 @@ func (opts *updateLegacySnapshotScheduleOpts) initClient() func() error { } } -func (opts *updateLegacySnapshotScheduleOpts) readData() (*admin.SnapshotSchedule, error) { - var out *admin.SnapshotSchedule +func (opts *updateLegacySnapshotScheduleOpts) readData() (*admin.ApiAtlasSnapshotSchedule, error) { + var out *admin.ApiAtlasSnapshotSchedule var buf []byte var err error @@ -694,7 +694,7 @@ func (opts *updateLegacySnapshotScheduleOpts) Run(ctx context.Context, w io.Writ GroupId: opts.groupId, ClusterName: opts.clusterName, - SnapshotSchedule: data, + ApiAtlasSnapshotSchedule: data, } resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index 95b08263d6..4e89c09336 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -51,8 +51,8 @@ func (opts *createLegacyBackupRestoreJobOpts) initClient() func() error { } } -func (opts *createLegacyBackupRestoreJobOpts) readData() (*admin.RestoreJob, error) { - var out *admin.RestoreJob +func (opts *createLegacyBackupRestoreJobOpts) readData() (*admin.BackupRestoreJob, error) { + var out *admin.BackupRestoreJob var buf []byte var err error @@ -82,7 +82,7 @@ func (opts *createLegacyBackupRestoreJobOpts) Run(ctx context.Context, w io.Writ GroupId: opts.groupId, ClusterName: opts.clusterName, - RestoreJob: data, + BackupRestoreJob: data, } resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index dc03e7c59e..4f500d3724 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -151,16 +151,16 @@ func (opts *resetMaintenanceWindowOpts) initClient() func() error { } } -func (opts *resetMaintenanceWindowOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *resetMaintenanceWindowOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params).Execute() + _, err := opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + return nil } func resetMaintenanceWindowBuilder() *cobra.Command { diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index 8d1dd9984b..5c73f7c324 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -49,8 +49,8 @@ func (opts *createUserOpts) initClient() func() error { } } -func (opts *createUserOpts) readData() (*admin.AppUser, error) { - var out *admin.AppUser +func (opts *createUserOpts) readData() (*admin.CloudAppUser, error) { + var out *admin.CloudAppUser var buf []byte var err error @@ -78,7 +78,7 @@ func (opts *createUserOpts) Run(ctx context.Context, w io.Writer) error { } params := &admin.CreateUserApiParams{ - AppUser: data, + CloudAppUser: data, } resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index 554a824978..968e35a28d 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -335,7 +335,7 @@ func getHostLogsBuilder() *cobra.Command { opts := getHostLogsOpts{} cmd := &cobra.Command{ Use: "getHostLogs", - Short: "Download Logs for One Multi-Cloud Cluster Host in One Project", + Short: "Download Logs for One Cluster Host in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), @@ -348,8 +348,8 @@ func getHostLogsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.hostName, "hostName", "", `Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.`) - cmd.Flags().StringVar(&opts.logName, "logName", "", `Human-readable label of the log file that you want to return. You can return audit logs only if you enable Database Auditing for the specified project.`) + cmd.Flags().StringVar(&opts.hostName, "hostName", "", `Human-readable label that identifies the host that stores the log files that you want to download.`) + cmd.Flags().StringVar(&opts.logName, "logName", "", `Human-readable label that identifies the log file that you want to return. To return audit logs, enable *Database Auditing* for the specified project.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) diff --git a/internal/api/api_multi_cloud_clusters_cmd.go b/internal/api/api_multi_cloud_clusters_cmd.go deleted file mode 100644 index eeee9b3d50..0000000000 --- a/internal/api/api_multi_cloud_clusters_cmd.go +++ /dev/null @@ -1,547 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package api - -import ( - "context" - "encoding/json" - "fmt" - "io" - "os" - - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" - "github.com/spf13/afero" - "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" -) - -type createClusterOpts struct { - cli.GlobalOpts - cli.OutputOpts - client *admin.APIClient - groupId string - - filename string - fs afero.Fs -} - -func (opts *createClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } -} - -func (opts *createClusterOpts) readData() (*admin.ClusterDescriptionV15, error) { - var out *admin.ClusterDescriptionV15 - - var buf []byte - var err error - if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) - } else { - if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { - return nil, fmt.Errorf("file not found: %s", opts.filename) - } - buf, err = afero.ReadFile(opts.fs, opts.filename) - } - if err != nil { - return nil, err - } - if err = json.Unmarshal(buf, &out); err != nil { - return nil, err - } - return out, nil -} - -func (opts *createClusterOpts) Run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() - if errData != nil { - return errData - } - params := &admin.CreateClusterApiParams{ - GroupId: opts.groupId, - - ClusterDescriptionV15: data, - } - resp, _, err := opts.client.MultiCloudClustersApi.CreateClusterWithParams(ctx, params).Execute() - if err != nil { - return err - } - - return jsonwriter.Print(w, resp) -} - -func createClusterBuilder() *cobra.Command { - opts := createClusterOpts{ - fs: afero.NewOsFs(), - } - cmd := &cobra.Command{ - Use: "createCluster", - Short: "Create One Multi-Cloud Cluster from One Project", - PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) - }, - } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) - - _ = cmd.MarkFlagRequired("groupId") - return cmd -} - -type deleteClusterOpts struct { - cli.GlobalOpts - cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string - retainBackups bool -} - -func (opts *deleteClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } -} - -func (opts *deleteClusterOpts) Run(ctx context.Context, _ io.Writer) error { - params := &admin.DeleteClusterApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, - RetainBackups: &opts.retainBackups, - } - _, err := opts.client.MultiCloudClustersApi.DeleteClusterWithParams(ctx, params).Execute() - if err != nil { - return err - } - - return nil -} - -func deleteClusterBuilder() *cobra.Command { - opts := deleteClusterOpts{} - cmd := &cobra.Command{ - Use: "deleteCluster", - Short: "Remove One Multi-Cloud Cluster from One Project", - PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) - }, - } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) - - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) - - _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("clusterName") - return cmd -} - -type getClusterOpts struct { - cli.GlobalOpts - cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string -} - -func (opts *getClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } -} - -func (opts *getClusterOpts) Run(ctx context.Context, w io.Writer) error { - params := &admin.GetClusterApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, - } - resp, _, err := opts.client.MultiCloudClustersApi.GetClusterWithParams(ctx, params).Execute() - if err != nil { - return err - } - - return jsonwriter.Print(w, resp) -} - -func getClusterBuilder() *cobra.Command { - opts := getClusterOpts{} - cmd := &cobra.Command{ - Use: "getCluster", - Short: "Return One Multi-Cloud Cluster from One Project", - PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) - }, - } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) - - _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("clusterName") - return cmd -} - -type listClustersOpts struct { - cli.GlobalOpts - cli.OutputOpts - client *admin.APIClient - groupId string - includeCount bool - itemsPerPage int - pageNum int -} - -func (opts *listClustersOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } -} - -func (opts *listClustersOpts) Run(ctx context.Context, w io.Writer) error { - params := &admin.ListClustersApiParams{ - GroupId: opts.groupId, - IncludeCount: &opts.includeCount, - ItemsPerPage: &opts.itemsPerPage, - PageNum: &opts.pageNum, - } - resp, _, err := opts.client.MultiCloudClustersApi.ListClustersWithParams(ctx, params).Execute() - if err != nil { - return err - } - - return jsonwriter.Print(w, resp) -} - -func listClustersBuilder() *cobra.Command { - opts := listClustersOpts{} - cmd := &cobra.Command{ - Use: "listClusters", - Short: "Return All Multi-Cloud Clusters from One Project", - PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) - }, - } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) - cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) - cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) - - _ = cmd.MarkFlagRequired("groupId") - return cmd -} - -type testFailoverOpts struct { - cli.GlobalOpts - cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string -} - -func (opts *testFailoverOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } -} - -func (opts *testFailoverOpts) Run(ctx context.Context, _ io.Writer) error { - params := &admin.TestFailoverApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, - } - _, err := opts.client.MultiCloudClustersApi.TestFailoverWithParams(ctx, params).Execute() - if err != nil { - return err - } - - return nil -} - -func testFailoverBuilder() *cobra.Command { - opts := testFailoverOpts{} - cmd := &cobra.Command{ - Use: "testFailover", - Short: "Test Failover for One Multi-Cloud Cluster", - PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) - }, - } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) - - _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("clusterName") - return cmd -} - -type updateClusterOpts struct { - cli.GlobalOpts - cli.OutputOpts - client *admin.APIClient - groupId string - clusterName string - - filename string - fs afero.Fs -} - -func (opts *updateClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } -} - -func (opts *updateClusterOpts) readData() (*admin.ClusterDescriptionV15, error) { - var out *admin.ClusterDescriptionV15 - - var buf []byte - var err error - if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) - } else { - if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { - return nil, fmt.Errorf("file not found: %s", opts.filename) - } - buf, err = afero.ReadFile(opts.fs, opts.filename) - } - if err != nil { - return nil, err - } - if err = json.Unmarshal(buf, &out); err != nil { - return nil, err - } - return out, nil -} - -func (opts *updateClusterOpts) Run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() - if errData != nil { - return errData - } - params := &admin.UpdateClusterApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, - - ClusterDescriptionV15: data, - } - resp, _, err := opts.client.MultiCloudClustersApi.UpdateClusterWithParams(ctx, params).Execute() - if err != nil { - return err - } - - return jsonwriter.Print(w, resp) -} - -func updateClusterBuilder() *cobra.Command { - opts := updateClusterOpts{ - fs: afero.NewOsFs(), - } - cmd := &cobra.Command{ - Use: "updateCluster", - Short: "Modify One Multi-Cloud Cluster from One Project", - PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) - }, - } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the advanced cluster to modify.`) - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) - - _ = cmd.MarkFlagRequired("groupId") - _ = cmd.MarkFlagRequired("clusterName") - return cmd -} - -func multiCloudClustersBuilder() *cobra.Command { - cmd := &cobra.Command{ - Use: "multiCloudClusters", - Short: `Returns, adds, edits, or removes multi-cloud clusters. Changes to cluster configurations can affect costs. - -The total number of nodes in clusters spanning across regions has a specific constraint on a per-project basis. MongoDB Cloud limits the total number of nodes in other regions in one project to a total of 40. This total excludes Google Cloud regions communicating with each other, shared-tier clusters, or serverless clusters. The total number of nodes between any two regions must meet this constraint. For example, if a project has nodes in clusters spread across three regions: 30 nodes in Region A, 10 nodes in Region B, and 5 nodes in Region C, you can add only 5 more nodes to Region C because if you exclude Region C, Region A + Region B = 40. If you exclude Region B, Region A + Region C = 35, <= 40. If you exclude Region A, Region B + Region C = 15, <= 40. Each combination of regions with the added 5 nodes still meets the per-project constraint. Region A + B = 40. Region A + C = 40. Region B + C = 20. You can't create a multi-region cluster in a project if it has one or more clusters spanning 40 or more nodes in other regions. Each project supports up to 25 database deployments. - -If your MongoDB Cloud project contains a custom role that uses actions introduced in a specific MongoDB version, you must delete that role before you create clusters with an earlier MongoDB version. MongoDB Cloud clusters created after July 2020 use TLS version 1.2 by default. When you create a cluster, MongoDB Cloud creates a network container in the project for the cloud provider to which you deploy the cluster if one doesn't already exist.`, - } - cmd.AddCommand( - createClusterBuilder(), - deleteClusterBuilder(), - getClusterBuilder(), - listClustersBuilder(), - testFailoverBuilder(), - updateClusterBuilder(), - ) - return cmd -} diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index fa078d0865..c465f492c8 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -50,8 +50,8 @@ func (opts *createPeeringConnectionOpts) initClient() func() error { } } -func (opts *createPeeringConnectionOpts) readData() (*admin.ContainerPeer, error) { - var out *admin.ContainerPeer +func (opts *createPeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringConnectionSettings, error) { + var out *admin.BaseNetworkPeeringConnectionSettings var buf []byte var err error @@ -80,7 +80,7 @@ func (opts *createPeeringConnectionOpts) Run(ctx context.Context, w io.Writer) e params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, - ContainerPeer: data, + BaseNetworkPeeringConnectionSettings: data, } resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { @@ -110,6 +110,44 @@ func createPeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -195,6 +233,30 @@ func createPeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -722,8 +784,8 @@ func (opts *updatePeeringConnectionOpts) initClient() func() error { } } -func (opts *updatePeeringConnectionOpts) readData() (*admin.ContainerPeer, error) { - var out *admin.ContainerPeer +func (opts *updatePeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringConnectionSettings, error) { + var out *admin.BaseNetworkPeeringConnectionSettings var buf []byte var err error @@ -753,7 +815,7 @@ func (opts *updatePeeringConnectionOpts) Run(ctx context.Context, w io.Writer) e GroupId: opts.groupId, PeerId: opts.peerId, - ContainerPeer: data, + BaseNetworkPeeringConnectionSettings: data, } resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { @@ -784,6 +846,44 @@ func updatePeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -873,6 +973,30 @@ func updatePeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index 66df9d2531..29443ee46a 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -51,8 +51,8 @@ func (opts *createOnlineArchiveOpts) initClient() func() error { } } -func (opts *createOnlineArchiveOpts) readData() (*admin.OnlineArchive, error) { - var out *admin.OnlineArchive +func (opts *createOnlineArchiveOpts) readData() (*admin.BackupOnlineArchiveCreate, error) { + var out *admin.BackupOnlineArchiveCreate var buf []byte var err error @@ -82,7 +82,7 @@ func (opts *createOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error GroupId: opts.groupId, ClusterName: opts.clusterName, - OnlineArchive: data, + BackupOnlineArchiveCreate: data, } resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { @@ -135,6 +135,10 @@ func createOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -413,8 +417,8 @@ func (opts *updateOnlineArchiveOpts) initClient() func() error { } } -func (opts *updateOnlineArchiveOpts) readData() (*admin.OnlineArchive, error) { - var out *admin.OnlineArchive +func (opts *updateOnlineArchiveOpts) readData() (*admin.BackupOnlineArchive, error) { + var out *admin.BackupOnlineArchive var buf []byte var err error @@ -445,7 +449,7 @@ func (opts *updateOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error ArchiveId: opts.archiveId, ClusterName: opts.clusterName, - OnlineArchive: data, + BackupOnlineArchive: data, } resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { @@ -499,6 +503,10 @@ func updateOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 10ad9c4585..7030eb6270 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -111,6 +111,8 @@ func createOrganizationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -696,6 +698,60 @@ func listOrganizationsBuilder() *cobra.Command { return cmd } +type removeOrganizationUserOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + orgId string + userId string +} + +func (opts *removeOrganizationUserOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *removeOrganizationUserOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.RemoveOrganizationUserApiParams{ + OrgId: opts.orgId, + UserId: opts.userId, + } + resp, _, err := opts.client.OrganizationsApi.RemoveOrganizationUserWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func removeOrganizationUserBuilder() *cobra.Command { + opts := removeOrganizationUserOpts{} + cmd := &cobra.Command{ + Use: "removeOrganizationUser", + Short: "Remove One MongoDB Cloud User from One Organization", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to be deleted.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("orgId") + _ = cmd.MarkFlagRequired("userId") + return cmd +} + type renameOrganizationOpts struct { cli.GlobalOpts cli.OutputOpts @@ -714,8 +770,8 @@ func (opts *renameOrganizationOpts) initClient() func() error { } } -func (opts *renameOrganizationOpts) readData() (*admin.Organization, error) { - var out *admin.Organization +func (opts *renameOrganizationOpts) readData() (*admin.AtlasOrganization, error) { + var out *admin.AtlasOrganization var buf []byte var err error @@ -744,7 +800,7 @@ func (opts *renameOrganizationOpts) Run(ctx context.Context, w io.Writer) error params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, - Organization: data, + AtlasOrganization: data, } resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() if err != nil { @@ -967,6 +1023,97 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { return cmd } +type updateOrganizationRolesOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + orgId string + userId string + + filename string + fs afero.Fs +} + +func (opts *updateOrganizationRolesOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *updateOrganizationRolesOpts) readData() (*admin.UpdateOrgRolesForUser, error) { + var out *admin.UpdateOrgRolesForUser + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateOrganizationRolesOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.UpdateOrganizationRolesApiParams{ + OrgId: opts.orgId, + UserId: opts.userId, + + UpdateOrgRolesForUser: data, + } + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationRolesWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func updateOrganizationRolesBuilder() *cobra.Command { + opts := updateOrganizationRolesOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "updateOrganizationRoles", + Short: "Update Organization Roles for One MongoDB Cloud User", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("orgId") + _ = cmd.MarkFlagRequired("userId") + return cmd +} + type updateOrganizationSettingsOpts struct { cli.GlobalOpts cli.OutputOpts @@ -1073,9 +1220,11 @@ func organizationsBuilder() *cobra.Command { listOrganizationProjectsBuilder(), listOrganizationUsersBuilder(), listOrganizationsBuilder(), + removeOrganizationUserBuilder(), renameOrganizationBuilder(), updateOrganizationInvitationBuilder(), updateOrganizationInvitationByIdBuilder(), + updateOrganizationRolesBuilder(), updateOrganizationSettingsBuilder(), ) return cmd diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index cb110d671a..fc1539bf8f 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -187,13 +187,13 @@ func listSlowQueriesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. + cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds slow queries among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.`) - cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, `Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.`) + cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, `Namespaces from which to retrieve slow queries. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.`) cmd.Flags().Int64Var(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) - cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the slow queries. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index cf02088f2f..1a2270fde0 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -116,6 +116,16 @@ func createPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -143,8 +153,8 @@ func (opts *createPrivateEndpointServiceOpts) initClient() func() error { } } -func (opts *createPrivateEndpointServiceOpts) readData() (*admin.CreateEndpointServiceRequest, error) { - var out *admin.CreateEndpointServiceRequest +func (opts *createPrivateEndpointServiceOpts) readData() (*admin.CloudProviderEndpointServiceRequest, error) { + var out *admin.CloudProviderEndpointServiceRequest var buf []byte var err error @@ -173,7 +183,7 @@ func (opts *createPrivateEndpointServiceOpts) Run(ctx context.Context, w io.Writ params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, - CreateEndpointServiceRequest: data, + CloudProviderEndpointServiceRequest: data, } resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index dfb1163b6a..e2dea8cf6c 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -51,8 +51,8 @@ func (opts *addProjectApiKeyOpts) initClient() func() error { } } -func (opts *addProjectApiKeyOpts) readData() ([]*admin.UserRoleAssignment, error) { - var out []*admin.UserRoleAssignment +func (opts *addProjectApiKeyOpts) readData() (*[]admin.UserAccessRoleAssignment, error) { + var out *[]admin.UserAccessRoleAssignment var buf []byte var err error @@ -82,7 +82,7 @@ func (opts *addProjectApiKeyOpts) Run(ctx context.Context, w io.Writer) error { GroupId: opts.groupId, ApiUserId: opts.apiUserId, - UserRoleAssignment: data, + UserAccessRoleAssignment: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -139,8 +139,8 @@ func (opts *createApiKeyOpts) initClient() func() error { } } -func (opts *createApiKeyOpts) readData() (*admin.CreateApiKey, error) { - var out *admin.CreateApiKey +func (opts *createApiKeyOpts) readData() (*admin.CreateAtlasOrganizationApiKey, error) { + var out *admin.CreateAtlasOrganizationApiKey var buf []byte var err error @@ -169,7 +169,7 @@ func (opts *createApiKeyOpts) Run(ctx context.Context, w io.Writer) error { params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, - CreateApiKey: data, + CreateAtlasOrganizationApiKey: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -230,8 +230,8 @@ func (opts *createApiKeyAccessListOpts) initClient() func() error { } } -func (opts *createApiKeyAccessListOpts) readData() ([]*admin.UserAccessList, error) { - var out []*admin.UserAccessList +func (opts *createApiKeyAccessListOpts) readData() (*[]admin.UserAccessList, error) { + var out *[]admin.UserAccessList var buf []byte var err error @@ -324,8 +324,8 @@ func (opts *createProjectApiKeyOpts) initClient() func() error { } } -func (opts *createProjectApiKeyOpts) readData() (*admin.CreateApiKey, error) { - var out *admin.CreateApiKey +func (opts *createProjectApiKeyOpts) readData() (*admin.CreateAtlasProjectApiKey, error) { + var out *admin.CreateAtlasProjectApiKey var buf []byte var err error @@ -354,7 +354,7 @@ func (opts *createProjectApiKeyOpts) Run(ctx context.Context, w io.Writer) error params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, - CreateApiKey: data, + CreateAtlasProjectApiKey: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -877,8 +877,8 @@ func (opts *updateApiKeyOpts) initClient() func() error { } } -func (opts *updateApiKeyOpts) readData() (*admin.CreateApiKey, error) { - var out *admin.CreateApiKey +func (opts *updateApiKeyOpts) readData() (*admin.UpdateAtlasOrganizationApiKey, error) { + var out *admin.UpdateAtlasOrganizationApiKey var buf []byte var err error @@ -908,7 +908,7 @@ func (opts *updateApiKeyOpts) Run(ctx context.Context, w io.Writer) error { OrgId: opts.orgId, ApiUserId: opts.apiUserId, - CreateApiKey: data, + UpdateAtlasOrganizationApiKey: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params).Execute() if err != nil { @@ -971,8 +971,8 @@ func (opts *updateApiKeyRolesOpts) initClient() func() error { } } -func (opts *updateApiKeyRolesOpts) readData() (*admin.CreateApiKey, error) { - var out *admin.CreateApiKey +func (opts *updateApiKeyRolesOpts) readData() (*admin.UpdateAtlasProjectApiKey, error) { + var out *admin.UpdateAtlasProjectApiKey var buf []byte var err error @@ -1006,7 +1006,7 @@ func (opts *updateApiKeyRolesOpts) Run(ctx context.Context, w io.Writer) error { ItemsPerPage: &opts.itemsPerPage, IncludeCount: &opts.includeCount, - CreateApiKey: data, + UpdateAtlasProjectApiKey: data, } resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index cce64f55b2..3a5bae11d9 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -53,8 +53,8 @@ func (opts *createProjectIpAccessListOpts) initClient() func() error { } } -func (opts *createProjectIpAccessListOpts) readData() ([]*admin.NetworkPermissionEntry, error) { - var out []*admin.NetworkPermissionEntry +func (opts *createProjectIpAccessListOpts) readData() (*[]admin.NetworkPermissionEntry, error) { + var out *[]admin.NetworkPermissionEntry var buf []byte var err error diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index afe69dc337..daa6444eaa 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -108,7 +108,7 @@ func createProjectBuilder() *cobra.Command { }, } - cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. `) + cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -386,6 +386,8 @@ func deleteProjectLimitBuilder() *cobra.Command { | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | +| atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| +| atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -614,6 +616,8 @@ func getProjectLimitBuilder() *cobra.Command { | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | +| atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| +| atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -983,8 +987,8 @@ func (opts *setProjectLimitOpts) initClient() func() error { } } -func (opts *setProjectLimitOpts) readData() (*admin.Limit, error) { - var out *admin.Limit +func (opts *setProjectLimitOpts) readData() (*admin.DataFederationLimit, error) { + var out *admin.DataFederationLimit var buf []byte var err error @@ -1014,7 +1018,7 @@ func (opts *setProjectLimitOpts) Run(ctx context.Context, w io.Writer) error { LimitName: opts.limitName, GroupId: opts.groupId, - Limit: data, + DataFederationLimit: data, } resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params).Execute() if err != nil { @@ -1054,11 +1058,27 @@ func setProjectLimitBuilder() *cobra.Command { | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | +| atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| +| atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1334,6 +1354,99 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { return cmd } +type updateProjectRolesOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + userId string + + filename string + fs afero.Fs +} + +func (opts *updateProjectRolesOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *updateProjectRolesOpts) readData() (*admin.UpdateGroupRolesForUser, error) { + var out *admin.UpdateGroupRolesForUser + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateProjectRolesOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.UpdateProjectRolesApiParams{ + GroupId: opts.groupId, + UserId: opts.userId, + + UpdateGroupRolesForUser: data, + } + resp, _, err := opts.client.ProjectsApi.UpdateProjectRolesWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func updateProjectRolesBuilder() *cobra.Command { + opts := updateProjectRolesOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "updateProjectRoles", + Short: "Update Project Roles for One MongoDB Cloud User", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("userId") + return cmd +} + type updateProjectSettingsOpts struct { cli.GlobalOpts cli.OutputOpts @@ -1456,6 +1569,7 @@ func projectsBuilder() *cobra.Command { updateProjectBuilder(), updateProjectInvitationBuilder(), updateProjectInvitationByIdBuilder(), + updateProjectRolesBuilder(), updateProjectSettingsBuilder(), ) return cmd diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go new file mode 100644 index 0000000000..77bcc18a20 --- /dev/null +++ b/internal/api/api_push_based_log_export_cmd.go @@ -0,0 +1,345 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "context" + "encoding/json" + "fmt" + "io" + "os" + + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" + "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/v20230201008/admin" +) + +type createPushBasedLogConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + + filename string + fs afero.Fs +} + +func (opts *createPushBasedLogConfigurationOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *createPushBasedLogConfigurationOpts) readData() (*admin.PushBasedLogExportProject, error) { + var out *admin.PushBasedLogExportProject + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createPushBasedLogConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.CreatePushBasedLogConfigurationApiParams{ + GroupId: opts.groupId, + + PushBasedLogExportProject: data, + } + _, err := opts.client.PushBasedLogExportApi.CreatePushBasedLogConfigurationWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return nil +} + +func createPushBasedLogConfigurationBuilder() *cobra.Command { + opts := createPushBasedLogConfigurationOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "createPushBasedLogConfiguration", + Short: "Enable the push-based log export feature for a project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + return cmd +} + +type deletePushBasedLogConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string +} + +func (opts *deletePushBasedLogConfigurationOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *deletePushBasedLogConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { + params := &admin.DeletePushBasedLogConfigurationApiParams{ + GroupId: opts.groupId, + } + _, err := opts.client.PushBasedLogExportApi.DeletePushBasedLogConfigurationWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return nil +} + +func deletePushBasedLogConfigurationBuilder() *cobra.Command { + opts := deletePushBasedLogConfigurationOpts{} + cmd := &cobra.Command{ + Use: "deletePushBasedLogConfiguration", + Short: "Disable the push-based log export feature for a project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + return cmd +} + +type getPushBasedLogConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string +} + +func (opts *getPushBasedLogConfigurationOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *getPushBasedLogConfigurationOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.GetPushBasedLogConfigurationApiParams{ + GroupId: opts.groupId, + } + resp, _, err := opts.client.PushBasedLogExportApi.GetPushBasedLogConfigurationWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func getPushBasedLogConfigurationBuilder() *cobra.Command { + opts := getPushBasedLogConfigurationOpts{} + cmd := &cobra.Command{ + Use: "getPushBasedLogConfiguration", + Short: "Get the push-based log export configuration for a project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + return cmd +} + +type updatePushBasedLogConfigurationOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + + filename string + fs afero.Fs +} + +func (opts *updatePushBasedLogConfigurationOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *updatePushBasedLogConfigurationOpts) readData() (*admin.PushBasedLogExportProject, error) { + var out *admin.PushBasedLogExportProject + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updatePushBasedLogConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.UpdatePushBasedLogConfigurationApiParams{ + GroupId: opts.groupId, + + PushBasedLogExportProject: data, + } + _, err := opts.client.PushBasedLogExportApi.UpdatePushBasedLogConfigurationWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return nil +} + +func updatePushBasedLogConfigurationBuilder() *cobra.Command { + opts := updatePushBasedLogConfigurationOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "updatePushBasedLogConfiguration", + Short: "Update the push-based log export feature for a project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + return cmd +} + +func pushBasedLogExportBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "pushBasedLogExport", + Short: ``, + } + cmd.AddCommand( + createPushBasedLogConfigurationBuilder(), + deletePushBasedLogConfigurationBuilder(), + getPushBasedLogConfigurationBuilder(), + updatePushBasedLogConfigurationBuilder(), + ) + return cmd +} diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 78cbf928b9..ccde6f46ba 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -50,8 +50,8 @@ func (opts *createRollingIndexOpts) initClient() func() error { } } -func (opts *createRollingIndexOpts) readData() (*admin.IndexRequest, error) { - var out *admin.IndexRequest +func (opts *createRollingIndexOpts) readData() (*admin.DatabaseRollingIndexRequest, error) { + var out *admin.DatabaseRollingIndexRequest var buf []byte var err error @@ -81,7 +81,7 @@ func (opts *createRollingIndexOpts) Run(ctx context.Context, _ io.Writer) error GroupId: opts.groupId, ClusterName: opts.clusterName, - IndexRequest: data, + DatabaseRollingIndexRequest: data, } _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() if err != nil { diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index 9fdb801112..ab7c73956c 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -120,6 +120,8 @@ func createServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -385,6 +387,8 @@ func updateServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index e07a87d062..eed31956be 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -51,8 +51,8 @@ func (opts *createServerlessPrivateEndpointOpts) initClient() func() error { } } -func (opts *createServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantEndpointCreate, error) { - var out *admin.ServerlessTenantEndpointCreate +func (opts *createServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantCreateRequest, error) { + var out *admin.ServerlessTenantCreateRequest var buf []byte var err error @@ -82,7 +82,7 @@ func (opts *createServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.W GroupId: opts.groupId, InstanceName: opts.instanceName, - ServerlessTenantEndpointCreate: data, + ServerlessTenantCreateRequest: data, } resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { @@ -383,6 +383,14 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go new file mode 100644 index 0000000000..b653baf5b8 --- /dev/null +++ b/internal/api/api_streams_cmd.go @@ -0,0 +1,816 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "context" + "encoding/json" + "fmt" + "io" + "os" + + "github.com/mongodb/mongodb-atlas-cli/internal/cli" + "github.com/mongodb/mongodb-atlas-cli/internal/flag" + "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" + "github.com/mongodb/mongodb-atlas-cli/internal/usage" + "github.com/spf13/afero" + "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/v20230201008/admin" +) + +type createStreamConnectionOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + tenantName string + + filename string + fs afero.Fs +} + +func (opts *createStreamConnectionOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *createStreamConnectionOpts) readData() (*admin.StreamsConnection, error) { + var out *admin.StreamsConnection + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createStreamConnectionOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.CreateStreamConnectionApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + + StreamsConnection: data, + } + resp, _, err := opts.client.StreamsApi.CreateStreamConnectionWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func createStreamConnectionBuilder() *cobra.Command { + opts := createStreamConnectionOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "createStreamConnection", + Short: "Create One Connection", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("tenantName") + return cmd +} + +type createStreamInstanceOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + + filename string + fs afero.Fs +} + +func (opts *createStreamInstanceOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *createStreamInstanceOpts) readData() (*admin.StreamsTenant, error) { + var out *admin.StreamsTenant + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createStreamInstanceOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.CreateStreamInstanceApiParams{ + GroupId: opts.groupId, + + StreamsTenant: data, + } + resp, _, err := opts.client.StreamsApi.CreateStreamInstanceWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func createStreamInstanceBuilder() *cobra.Command { + opts := createStreamInstanceOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "createStreamInstance", + Short: "Create One Stream Instance", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + return cmd +} + +type deleteStreamConnectionOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + tenantName string + connectionName string +} + +func (opts *deleteStreamConnectionOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *deleteStreamConnectionOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteStreamConnectionApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + ConnectionName: opts.connectionName, + } + resp, _, err := opts.client.StreamsApi.DeleteStreamConnectionWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func deleteStreamConnectionBuilder() *cobra.Command { + opts := deleteStreamConnectionOpts{} + cmd := &cobra.Command{ + Use: "deleteStreamConnection", + Short: "Delete One Stream Connection", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) + cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("tenantName") + _ = cmd.MarkFlagRequired("connectionName") + return cmd +} + +type deleteStreamInstanceOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + tenantName string +} + +func (opts *deleteStreamInstanceOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *deleteStreamInstanceOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteStreamInstanceApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + } + resp, _, err := opts.client.StreamsApi.DeleteStreamInstanceWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func deleteStreamInstanceBuilder() *cobra.Command { + opts := deleteStreamInstanceOpts{} + cmd := &cobra.Command{ + Use: "deleteStreamInstance", + Short: "Delete One Stream Instance", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to delete.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("tenantName") + return cmd +} + +type getStreamConnectionOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + tenantName string + connectionName string +} + +func (opts *getStreamConnectionOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *getStreamConnectionOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.GetStreamConnectionApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + ConnectionName: opts.connectionName, + } + resp, _, err := opts.client.StreamsApi.GetStreamConnectionWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func getStreamConnectionBuilder() *cobra.Command { + opts := getStreamConnectionOpts{} + cmd := &cobra.Command{ + Use: "getStreamConnection", + Short: "Return One Stream Connection", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) + cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection to return.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("tenantName") + _ = cmd.MarkFlagRequired("connectionName") + return cmd +} + +type getStreamInstanceOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + tenantName string + includeConnections bool +} + +func (opts *getStreamInstanceOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *getStreamInstanceOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.GetStreamInstanceApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + IncludeConnections: &opts.includeConnections, + } + resp, _, err := opts.client.StreamsApi.GetStreamInstanceWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func getStreamInstanceBuilder() *cobra.Command { + opts := getStreamInstanceOpts{} + cmd := &cobra.Command{ + Use: "getStreamInstance", + Short: "Return One Stream Instance", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) + cmd.Flags().BoolVar(&opts.includeConnections, "includeConnections", false, `Flag to indicate whether connections information should be included in the stream instance.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("tenantName") + return cmd +} + +type listStreamConnectionsOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + tenantName string + itemsPerPage int + pageNum int +} + +func (opts *listStreamConnectionsOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *listStreamConnectionsOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.ListStreamConnectionsApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + } + resp, _, err := opts.client.StreamsApi.ListStreamConnectionsWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func listStreamConnectionsBuilder() *cobra.Command { + opts := listStreamConnectionsOpts{} + cmd := &cobra.Command{ + Use: "listStreamConnections", + Short: "Return All Connections Of The Stream Instances", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("tenantName") + return cmd +} + +type listStreamInstancesOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + itemsPerPage int + pageNum int +} + +func (opts *listStreamInstancesOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *listStreamInstancesOpts) Run(ctx context.Context, w io.Writer) error { + params := &admin.ListStreamInstancesApiParams{ + GroupId: opts.groupId, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + } + resp, _, err := opts.client.StreamsApi.ListStreamInstancesWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func listStreamInstancesBuilder() *cobra.Command { + opts := listStreamInstancesOpts{} + cmd := &cobra.Command{ + Use: "listStreamInstances", + Short: "Return All Project Stream Instances", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + return cmd +} + +type updateStreamConnectionOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + tenantName string + connectionName string + + filename string + fs afero.Fs +} + +func (opts *updateStreamConnectionOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *updateStreamConnectionOpts) readData() (*admin.StreamsConnection, error) { + var out *admin.StreamsConnection + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateStreamConnectionOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.UpdateStreamConnectionApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + ConnectionName: opts.connectionName, + + StreamsConnection: data, + } + resp, _, err := opts.client.StreamsApi.UpdateStreamConnectionWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func updateStreamConnectionBuilder() *cobra.Command { + opts := updateStreamConnectionOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "updateStreamConnection", + Short: "Update One Stream Connection", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) + cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("tenantName") + _ = cmd.MarkFlagRequired("connectionName") + return cmd +} + +type updateStreamInstanceOpts struct { + cli.GlobalOpts + cli.OutputOpts + client *admin.APIClient + groupId string + tenantName string + + filename string + fs afero.Fs +} + +func (opts *updateStreamInstanceOpts) initClient() func() error { + return func() error { + var err error + opts.client, err = newClientWithAuth() + return err + } +} + +func (opts *updateStreamInstanceOpts) readData() (*admin.StreamsDataProcessRegion, error) { + var out *admin.StreamsDataProcessRegion + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(os.Stdin) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateStreamInstanceOpts) Run(ctx context.Context, w io.Writer) error { + data, errData := opts.readData() + if errData != nil { + return errData + } + params := &admin.UpdateStreamInstanceApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + + StreamsDataProcessRegion: data, + } + resp, _, err := opts.client.StreamsApi.UpdateStreamInstanceWithParams(ctx, params).Execute() + if err != nil { + return err + } + + return jsonwriter.Print(w, resp) +} + +func updateStreamInstanceBuilder() *cobra.Command { + opts := updateStreamInstanceOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "updateStreamInstance", + Short: "Update One Stream Instance", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.PreRunE( + opts.initClient(), + ) + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.Run(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. + +**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to update.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) + _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) + + _ = cmd.MarkFlagRequired("groupId") + _ = cmd.MarkFlagRequired("tenantName") + return cmd +} + +func streamsBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "streams", + Short: `Returns, adds, edits, and removes Streams Instances. This resource requires your project ID.`, + } + cmd.AddCommand( + createStreamConnectionBuilder(), + createStreamInstanceBuilder(), + deleteStreamConnectionBuilder(), + deleteStreamInstanceBuilder(), + getStreamConnectionBuilder(), + getStreamInstanceBuilder(), + listStreamConnectionsBuilder(), + listStreamInstancesBuilder(), + updateStreamConnectionBuilder(), + updateStreamInstanceBuilder(), + ) + return cmd +} diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index 351737b5d5..e2eb62b042 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -50,8 +50,8 @@ func (opts *addAllTeamsToProjectOpts) initClient() func() error { } } -func (opts *addAllTeamsToProjectOpts) readData() ([]*admin.TeamRole, error) { - var out []*admin.TeamRole +func (opts *addAllTeamsToProjectOpts) readData() (*[]admin.TeamRole, error) { + var out *[]admin.TeamRole var buf []byte var err error @@ -136,8 +136,8 @@ func (opts *addTeamUserOpts) initClient() func() error { } } -func (opts *addTeamUserOpts) readData() ([]*admin.AddUserToTeam, error) { - var out []*admin.AddUserToTeam +func (opts *addTeamUserOpts) readData() (*[]admin.AddUserToTeam, error) { + var out *[]admin.AddUserToTeam var buf []byte var err error @@ -653,17 +653,17 @@ func (opts *removeProjectTeamOpts) initClient() func() error { } } -func (opts *removeProjectTeamOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *removeProjectTeamOpts) Run(ctx context.Context, _ io.Writer) error { params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params).Execute() + _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + return nil } func removeProjectTeamBuilder() *cobra.Command { diff --git a/internal/api/api_test__cmd.go b/internal/api/api_test__cmd.go deleted file mode 100644 index a97a396266..0000000000 --- a/internal/api/api_test__cmd.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package api - -import ( - "context" - "io" - - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" - "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" -) - -type versionedExampleOpts struct { - cli.GlobalOpts - cli.OutputOpts - client *admin.APIClient - additionalInfo bool -} - -func (opts *versionedExampleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } -} - -func (opts *versionedExampleOpts) Run(ctx context.Context, w io.Writer) error { - params := &admin.VersionedExampleApiParams{ - AdditionalInfo: &opts.additionalInfo, - } - resp, _, err := opts.client.TestApi.VersionedExampleWithParams(ctx, params).Execute() - if err != nil { - return err - } - - return jsonwriter.Print(w, resp) -} - -func versionedExampleBuilder() *cobra.Command { - opts := versionedExampleOpts{} - cmd := &cobra.Command{ - Use: "versionedExample", - Short: "Example resource info for versioning of the Atlas API", - PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) - }, - RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) - }, - } - cmd.Flags().BoolVar(&opts.additionalInfo, "additionalInfo", false, ``) - - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) - - return cmd -} - -func testBuilder() *cobra.Command { - cmd := &cobra.Command{ - Use: "test", - Short: `Atlas test endpoints.`, - } - cmd.AddCommand( - versionedExampleBuilder(), - ) - return cmd -} diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index b075ccc249..cebbb20154 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -54,8 +54,8 @@ func (opts *createThirdPartyIntegrationOpts) initClient() func() error { } } -func (opts *createThirdPartyIntegrationOpts) readData() (*admin.Integration, error) { - var out *admin.Integration +func (opts *createThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegration, error) { + var out *admin.ThridPartyIntegration var buf []byte var err error @@ -89,7 +89,7 @@ func (opts *createThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Write ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, - Integration: data, + ThridPartyIntegration: data, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { @@ -124,6 +124,52 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -327,8 +373,8 @@ func (opts *updateThirdPartyIntegrationOpts) initClient() func() error { } } -func (opts *updateThirdPartyIntegrationOpts) readData() (*admin.Integration, error) { - var out *admin.Integration +func (opts *updateThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegration, error) { + var out *admin.ThridPartyIntegration var buf []byte var err error @@ -362,7 +408,7 @@ func (opts *updateThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Write ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, - Integration: data, + ThridPartyIntegration: data, } resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { @@ -397,6 +443,52 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index ca8a949202..6a50da30c9 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -73,7 +73,7 @@ func (opts *createDatabaseUserCertificateOpts) readData() (*admin.UserCert, erro return out, nil } -func (opts *createDatabaseUserCertificateOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *createDatabaseUserCertificateOpts) Run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData @@ -84,12 +84,12 @@ func (opts *createDatabaseUserCertificateOpts) Run(ctx context.Context, _ io.Wri UserCert: data, } - _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() + resp, _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() if err != nil { return err } - return nil + return jsonwriter.Print(w, resp) } func createDatabaseUserCertificateBuilder() *cobra.Command { diff --git a/tools/openapi-generator/config/.openapi-generator-ignore b/tools/openapi-generator/config/.openapi-generator-ignore index dec4d922ad..856ce9c953 100644 --- a/tools/openapi-generator/config/.openapi-generator-ignore +++ b/tools/openapi-generator/config/.openapi-generator-ignore @@ -1,4 +1,4 @@ **/* *.* !*_cmd.go -!generated.go +!api.go diff --git a/tools/openapi-generator/config/config.yaml b/tools/openapi-generator/config/config.yaml index 4d7be57d96..fcfe01bee4 100644 --- a/tools/openapi-generator/config/config.yaml +++ b/tools/openapi-generator/config/config.yaml @@ -5,11 +5,11 @@ gitHost: github.com templateDir: config/go-templates isGoSubmodule: true packageName: api -inputSpec: https://github.com/mongodb/atlas-sdk-go/raw/v0.7.0/openapi/atlas-api-transformed.yaml +inputSpec: https://github.com/mongodb/atlas-sdk-go/raw/v20230201008.0.0/openapi/atlas-api-transformed.yaml files: cmd.mustache: templateType: API destinationFilename: _cmd.go - generated.mustache: + api.mustache: destinationFilename: api.go templateType: SupportingFiles diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index d2b93c50b6..2ae8b9389f 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -38,8 +38,8 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) initC } {{#bodyParam}} -func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) readData() ({{#isArray}}[]{{/isArray}}*admin.{{baseType}}, error) { - var out {{#isArray}}[]{{/isArray}}*admin.{{baseType}} +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) readData() (*{{#isArray}}[]{{/isArray}}admin.{{baseType}}, error) { + var out *{{#isArray}}[]{{/isArray}}admin.{{baseType}} var buf []byte var err error From b83e16e3d3747e4aeffdd9aec88c3542ff9ec9d0 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 20 Sep 2023 17:34:42 +0100 Subject: [PATCH 25/44] fix --- internal/api/api_access_tracking_cmd.go | 2 - internal/api/api_alert_configurations_cmd.go | 48 ---- internal/api/api_alerts_cmd.go | 44 ---- internal/api/api_atlas_search_cmd.go | 41 ---- internal/api/api_auditing_cmd.go | 8 - internal/api/api_aws_clusters_dns_cmd.go | 2 - internal/api/api_cloud_backups_cmd.go | 163 -------------- .../api/api_cloud_migration_service_cmd.go | 24 -- internal/api/api_cloud_provider_access_cmd.go | 53 ----- .../api/api_cluster_outage_simulation_cmd.go | 13 -- internal/api/api_clusters_cmd.go | 211 ------------------ internal/api/api_custom_database_roles_cmd.go | 11 - internal/api/api_data_federation_cmd.go | 59 ----- internal/api/api_data_lake_pipelines_cmd.go | 45 ---- internal/api/api_database_users_cmd.go | 53 ----- ..._rest_using_customer_key_management_cmd.go | 6 - internal/api/api_events_cmd.go | 4 - .../api/api_federated_authentication_cmd.go | 57 ----- internal/api/api_global_clusters_cmd.go | 19 -- internal/api/api_invoices_cmd.go | 20 -- internal/api/api_ldap_configuration_cmd.go | 21 -- internal/api/api_legacy_backup_cmd.go | 48 ---- .../api/api_legacy_backup_restore_jobs_cmd.go | 35 --- internal/api/api_maintenance_windows__cmd.go | 11 - internal/api/api_mongo_db_cloud_users_cmd.go | 27 --- internal/api/api_monitoring_and_logs_cmd.go | 14 -- internal/api/api_network_peering_cmd.go | 129 ----------- internal/api/api_online_archive_cmd.go | 54 ----- internal/api/api_organizations_cmd.go | 45 ---- internal/api/api_performance_advisor_cmd.go | 5 - .../api/api_private_endpoint_services_cmd.go | 19 -- internal/api/api_programmatic_api_keys_cmd.go | 24 +- .../api/api_project_ip_access_list_cmd.go | 6 +- internal/api/api_projects_cmd.go | 64 ------ internal/api/api_push_based_log_export_cmd.go | 24 -- internal/api/api_rolling_index_cmd.go | 9 - internal/api/api_root_cmd.go | 1 - internal/api/api_serverless_instances_cmd.go | 19 -- .../api_serverless_private_endpoints_cmd.go | 11 - .../api/api_shared_tier_restore_jobs_cmd.go | 29 --- internal/api/api_shared_tier_snapshots_cmd.go | 29 --- internal/api/api_streams_cmd.go | 54 ----- internal/api/api_teams_cmd.go | 29 +-- .../api/api_third_party_integrations_cmd.go | 95 -------- internal/api/api_x509_authentication_cmd.go | 15 -- .../config/go-templates/cmd.mustache | 4 +- 46 files changed, 7 insertions(+), 1697 deletions(-) diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index 5977b8e9e1..be1859a7cd 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -90,7 +90,6 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One Internet Protocol address that attempted to authenticate with the database.`) cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -161,7 +160,6 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One Internet Protocol address that attempted to authenticate with the database.`) cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index 39d6ca11da..162509d519 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -111,27 +111,6 @@ func createAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -186,7 +165,6 @@ func deleteAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -242,7 +220,6 @@ func getAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -289,7 +266,6 @@ func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -349,7 +325,6 @@ func listAlertConfigurationsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -413,7 +388,6 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -504,7 +478,6 @@ func toggleAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -595,27 +568,6 @@ func updateAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index e6b23a75b4..12611e6fae 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -114,47 +114,6 @@ func acknowledgeAlertBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -210,7 +169,6 @@ func getAlertBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -275,7 +233,6 @@ func listAlertsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.status, "status", "", `Status of the alerts to return. Omit to return all alerts in all statuses.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -339,7 +296,6 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index cf0cd65f01..0058362cfb 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -114,25 +114,6 @@ func createAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection on which to create an Atlas Search index.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -191,7 +172,6 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the database and collection with one or more Application Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -251,7 +231,6 @@ func getAtlasSearchIndexBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -314,7 +293,6 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Name of the collection that contains one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -410,25 +388,6 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 746540be1d..41b1cf9750 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -76,7 +76,6 @@ func getAuditingConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -163,13 +162,6 @@ func updateAuditingConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index 680f528f21..b14da5b7ca 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -76,7 +76,6 @@ func getAWSCustomDNSBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -163,7 +162,6 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 0c29587eed..976e7cb25d 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -82,7 +82,6 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -174,13 +173,6 @@ func createBackupExportJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -271,41 +263,6 @@ func createBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -393,15 +350,6 @@ func createExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -491,39 +439,6 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance whose snapshot you want to restore.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -579,7 +494,6 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -635,7 +549,6 @@ func deleteExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -694,7 +607,6 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -754,7 +666,6 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -814,7 +725,6 @@ func getBackupExportJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.exportId, "exportId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -874,7 +784,6 @@ func getBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -931,7 +840,6 @@ func getBackupScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -984,7 +892,6 @@ func getDataProtectionSettingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1039,7 +946,6 @@ func getExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1098,7 +1004,6 @@ func getReplicaSetBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1158,7 +1063,6 @@ func getServerlessBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1218,7 +1122,6 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1278,7 +1181,6 @@ func getShardedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1344,7 +1246,6 @@ func listBackupExportJobsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1409,7 +1310,6 @@ func listBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1471,7 +1371,6 @@ func listExportBucketsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1535,7 +1434,6 @@ func listReplicaSetBackupsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1600,7 +1498,6 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1665,7 +1562,6 @@ func listServerlessBackupsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1721,7 +1617,6 @@ func listShardedClusterBackupsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1812,11 +1707,6 @@ func takeSnapshotBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1907,33 +1797,6 @@ func updateBackupScheduleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -2021,27 +1884,6 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -2134,11 +1976,6 @@ func updateSnapshotRetentionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 3762a801ff..05d2170c30 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -109,7 +109,6 @@ func createLinkTokenBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -196,15 +195,6 @@ func createPushMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -259,7 +249,6 @@ func cutoverMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -310,7 +299,6 @@ func deleteLinkTokenBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -365,7 +353,6 @@ func getPushMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -421,7 +408,6 @@ func getValidationStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -472,7 +458,6 @@ func listSourceProjectsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -559,15 +544,6 @@ func validateMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index f24e6323d6..3f72db699c 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -114,31 +114,6 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -226,31 +201,6 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -308,7 +258,6 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider of the role to deauthorize.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -365,7 +314,6 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -418,7 +366,6 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index 7354e5b06b..2bb8d1e389 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -79,7 +79,6 @@ func endOutageSimulationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -135,7 +134,6 @@ func getOutageSimulationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -226,17 +224,6 @@ func startOutageSimulationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to undergo an outage simulation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 9fddeb6c22..42bfa2971f 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -111,51 +111,6 @@ func createClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -213,7 +168,6 @@ func deleteClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -269,7 +223,6 @@ func getClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -325,7 +278,6 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -381,7 +333,6 @@ func getClusterStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -437,7 +388,6 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -505,7 +455,6 @@ func listCloudProviderRegionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, `Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.`) cmd.Flags().StringVar(&opts.tier, "tier", "", `Cluster tier for which to retrieve the regions.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -569,7 +518,6 @@ func listClustersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().BoolVar(&opts.includeDeletedWithRetainedBackups, "includeDeletedWithRetainedBackups", false, `Flag that indicates whether to return Clusters with retain backups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -625,7 +573,6 @@ func listClustersForAllProjectsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -679,7 +626,6 @@ func loadSampleDatasetBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -735,7 +681,6 @@ func testFailoverBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -826,51 +771,6 @@ func updateClusterBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -961,29 +861,6 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1071,71 +948,6 @@ func upgradeSharedClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1222,29 +1034,6 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index e9ecf4778f..56b4d6875f 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -111,11 +111,6 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -170,7 +165,6 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -226,7 +220,6 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -279,7 +272,6 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -369,9 +361,6 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index b97958a4ff..b7ed261ee3 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -111,13 +111,6 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -207,21 +200,7 @@ func createFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -322,21 +301,6 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { `) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -393,7 +357,6 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -449,7 +412,6 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -516,7 +478,6 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -579,7 +540,6 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to download query logs.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -635,7 +595,6 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -691,7 +650,6 @@ func getFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -753,7 +711,6 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -808,7 +765,6 @@ func listFederatedDatabasesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -874,7 +830,6 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -931,7 +886,6 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1025,19 +979,6 @@ func updateFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 2f01e081d4..70e5f9a810 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -111,23 +111,6 @@ func createPipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -182,7 +165,6 @@ func deletePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -241,7 +223,6 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -298,7 +279,6 @@ func getPipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -357,7 +337,6 @@ func getPipelineRunBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -426,7 +405,6 @@ func listPipelineRunsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", `If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -482,7 +460,6 @@ func listPipelineSchedulesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -550,7 +527,6 @@ func listPipelineSnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", `Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -603,7 +579,6 @@ func listPipelinesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -658,7 +633,6 @@ func pausePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -714,7 +688,6 @@ func resumePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -805,7 +778,6 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -896,23 +868,6 @@ func updatePipelineBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index 7c440a7ecb..3d6709d793 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -111,31 +111,6 @@ func createDatabaseUserBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -205,7 +180,6 @@ func deleteDatabaseUserBuilder() *cobra.Command { | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -277,7 +251,6 @@ func getDatabaseUserBuilder() *cobra.Command { | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -340,7 +313,6 @@ func listDatabaseUsersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -445,31 +417,6 @@ func updateDatabaseUserBuilder() *cobra.Command { `) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index acf4000a9a..958a1286e0 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -76,7 +76,6 @@ func getEncryptionAtRestBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -163,11 +162,6 @@ func updateEncryptionAtRestBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 7a4523a853..0fa288af27 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -76,7 +76,6 @@ func getOrganizationEventBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -135,7 +134,6 @@ func getProjectEventBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -209,7 +207,6 @@ func listOrganizationEventsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -292,7 +289,6 @@ func listProjectEventsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index 76d87ba237..053e268285 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -112,11 +112,6 @@ func createRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -167,7 +162,6 @@ func deleteFederationAppBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -223,7 +217,6 @@ func deleteRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -278,7 +271,6 @@ func getConnectedOrgConfigBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -329,7 +321,6 @@ func getFederationSettingsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -382,7 +373,6 @@ func getIdentityProviderBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -436,7 +426,6 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -493,7 +482,6 @@ func getRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -545,7 +533,6 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -595,7 +582,6 @@ func listIdentityProvidersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -648,7 +634,6 @@ func listRoleMappingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -702,7 +687,6 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -791,21 +775,6 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -894,27 +863,6 @@ func updateIdentityProviderBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1006,11 +954,6 @@ func updateRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 9dc5a11d44..813598bafa 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -114,9 +114,6 @@ func createCustomZoneMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -207,19 +204,6 @@ func createManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -275,7 +259,6 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -337,7 +320,6 @@ func deleteManagedNamespaceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label that identifies the database that contains the collection.`) cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -393,7 +375,6 @@ func getManagedNamespaceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index 24ffae687c..bdf361f946 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -109,21 +109,6 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -176,7 +161,6 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.token, "token", "", `Unique 64 digit string that identifies the Cost Explorer query.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -230,7 +214,6 @@ func downloadInvoiceCSVBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -284,7 +267,6 @@ func getInvoiceBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -344,7 +326,6 @@ func listInvoicesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -394,7 +375,6 @@ func listPendingInvoicesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 5a84c54413..5ee232e3a0 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -76,7 +76,6 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -128,7 +127,6 @@ func getLDAPConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -183,7 +181,6 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -271,11 +268,6 @@ func saveLDAPConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -362,19 +354,6 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 1d548dc405..b83269bb83 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -82,7 +82,6 @@ func deleteLegacySnapshotBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -142,7 +141,6 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the checkpoint.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -202,7 +200,6 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVar(&opts.jobId, "jobId", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -262,7 +259,6 @@ func getLegacySnapshotBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -319,7 +315,6 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -384,7 +379,6 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -452,7 +446,6 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -520,7 +513,6 @@ func listLegacySnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completed, "completed", ""true"", `Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -614,27 +606,6 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -726,25 +697,6 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index 4e89c09336..416a403c4e 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -114,41 +114,6 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index 4f500d3724..73c2e8d43d 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -76,7 +76,6 @@ func deferMaintenanceWindowBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -128,7 +127,6 @@ func getMaintenanceWindowBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -180,7 +178,6 @@ func resetMaintenanceWindowBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -232,7 +229,6 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -319,13 +315,6 @@ func updateMaintenanceWindowBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index 5c73f7c324..0129e1102a 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -106,31 +106,6 @@ func createUserBuilder() *cobra.Command { } cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -179,7 +154,6 @@ func getUserBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies this user.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -229,7 +203,6 @@ func getUserByUsernameBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.userName, "userName", "", `Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index 968e35a28d..7dd41c27c6 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -75,7 +75,6 @@ func getAtlasProcessBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -134,7 +133,6 @@ func getDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -209,7 +207,6 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -285,7 +282,6 @@ func getDiskMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -352,7 +348,6 @@ func getHostLogsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.logName, "logName", "", `Human-readable label that identifies the log file that you want to return. To return audit logs, enable *Database Auditing* for the specified project.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -424,7 +419,6 @@ func getHostMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -505,7 +499,6 @@ func getIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -581,7 +574,6 @@ func getMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -645,7 +637,6 @@ func listAtlasProcessesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -709,7 +700,6 @@ func listDatabasesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -768,7 +758,6 @@ func listDiskMeasurementsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -834,7 +823,6 @@ func listDiskPartitionsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -911,7 +899,6 @@ func listIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -971,7 +958,6 @@ func listMetricTypesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index c465f492c8..08a973d30f 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -111,43 +111,6 @@ func createPeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -234,29 +197,6 @@ func createPeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -311,7 +251,6 @@ func deletePeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -367,7 +306,6 @@ func deletePeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -455,7 +393,6 @@ func disablePeeringBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -510,7 +447,6 @@ func getPeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -566,7 +502,6 @@ func getPeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -631,7 +566,6 @@ func listPeeringConnectionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider to use for this VPC peering connection.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -695,7 +629,6 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -757,7 +690,6 @@ func listPeeringContainersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -847,43 +779,6 @@ func updatePeeringConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -974,29 +869,6 @@ func updatePeeringContainerBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1049,7 +921,6 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index 29443ee46a..e85303f891 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -114,31 +114,6 @@ func createOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -197,7 +172,6 @@ func deleteOnlineArchiveBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to delete.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -263,7 +237,6 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, `Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -322,7 +295,6 @@ func getOnlineArchiveBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to return.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -388,7 +360,6 @@ func listOnlineArchivesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -482,31 +453,6 @@ func updateOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 7030eb6270..58ccfd684b 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -106,13 +106,6 @@ func createOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -196,11 +189,6 @@ func createOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -250,7 +238,6 @@ func deleteOrganizationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -303,7 +290,6 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -354,7 +340,6 @@ func getOrganizationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -407,7 +392,6 @@ func getOrganizationInvitationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -458,7 +442,6 @@ func getOrganizationSettingsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -511,7 +494,6 @@ func listOrganizationInvitationsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -573,7 +555,6 @@ func listOrganizationProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -632,7 +613,6 @@ func listOrganizationUsersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -691,7 +671,6 @@ func listOrganizationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -743,7 +722,6 @@ func removeOrganizationUserBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to be deleted.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -829,13 +807,6 @@ func renameOrganizationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -920,11 +891,6 @@ func updateOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1012,9 +978,6 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1103,9 +1066,6 @@ func updateOrganizationRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1191,11 +1151,6 @@ func updateOrganizationSettingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index fc1539bf8f..47c4c8efb7 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -72,7 +72,6 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -124,7 +123,6 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -197,7 +195,6 @@ func listSlowQueriesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -265,7 +262,6 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -351,7 +347,6 @@ func listSuggestedIndexesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 1a2270fde0..7e0b27ed12 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -117,15 +117,6 @@ func createPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -214,9 +205,6 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -277,7 +265,6 @@ func deletePrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -338,7 +325,6 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -401,7 +387,6 @@ func getPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -462,7 +447,6 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -516,7 +500,6 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -571,7 +554,6 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -659,7 +641,6 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index e2dea8cf6c..caf68deb1b 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -113,6 +113,7 @@ func addProjectApiKeyBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -198,9 +199,6 @@ func createApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -297,7 +295,7 @@ func createApiKeyAccessListBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -385,9 +383,6 @@ func createProjectApiKeyBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -440,7 +435,6 @@ func deleteApiKeyBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -497,7 +491,6 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -552,7 +545,6 @@ func getApiKeyBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -609,7 +601,6 @@ func getApiKeyAccessListBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -673,7 +664,6 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -733,7 +723,6 @@ func listApiKeysBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -794,7 +783,6 @@ func listProjectApiKeysBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -849,7 +837,6 @@ func removeProjectApiKeyBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -938,9 +925,6 @@ func updateApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key you want to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1040,11 +1024,7 @@ func updateApiKeyRolesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 3a5bae11d9..c36955179a 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -120,7 +120,7 @@ func createProjectIpAccessListBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -179,7 +179,6 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { - how your application established the connection, - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -235,7 +234,6 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Network address or cloud provider security construct that identifies which project access list entry to be verified.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -291,7 +289,6 @@ func getProjectIpListBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -353,7 +350,6 @@ func listProjectIpAccessListsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index daa6444eaa..6423ce7d7a 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -109,23 +109,7 @@ func createProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner.`) - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -211,9 +195,6 @@ func createProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -265,7 +246,6 @@ func deleteProjectBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -320,7 +300,6 @@ func deleteProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -392,7 +371,6 @@ func deleteProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -445,7 +423,6 @@ func getProjectBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -495,7 +472,6 @@ func getProjectByNameBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupName, "groupName", "", `Human-readable label that identifies this project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -550,7 +526,6 @@ func getProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -622,7 +597,6 @@ func getProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -675,7 +649,6 @@ func getProjectSettingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -730,7 +703,6 @@ func listProjectInvitationsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -782,7 +754,6 @@ func listProjectLimitsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -849,7 +820,6 @@ func listProjectUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().BoolVar(&opts.flattenTeams, "flattenTeams", false, `Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `"flattenTeams" : false`, this resource returns only users with a role in the project. If `"flattenTeams" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.`) cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, `Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `"includeOrgUsers": false`, this resource returns only users with a role in the project. If `"includeOrgUsers": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -905,7 +875,6 @@ func listProjectsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -959,7 +928,6 @@ func removeProjectUserBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1066,19 +1034,6 @@ func setProjectLimitBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1166,7 +1121,6 @@ func updateProjectBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1253,9 +1207,6 @@ func updateProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1345,7 +1296,6 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1436,9 +1386,6 @@ func updateProjectRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -1526,17 +1473,6 @@ func updateProjectSettingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index 77bcc18a20..c81ff50386 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -111,17 +111,6 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -173,7 +162,6 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -225,7 +213,6 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -312,17 +299,6 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index ccde6f46ba..f30e679612 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -113,15 +113,6 @@ func createRollingIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index 8fb49b84bf..691c232974 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -66,7 +66,6 @@ func getSystemStatusBuilder() *cobra.Command { return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index ab7c73956c..367b6788ad 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -111,17 +111,6 @@ func createServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -176,7 +165,6 @@ func deleteServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -232,7 +220,6 @@ func getServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -294,7 +281,6 @@ func listServerlessInstancesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -384,11 +370,6 @@ func updateServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index eed31956be..47953d6726 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -114,7 +114,6 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -173,7 +172,6 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -233,7 +231,6 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -290,7 +287,6 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -384,13 +380,6 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index bf28d629af..36e5854aab 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -114,33 +114,6 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -199,7 +172,6 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -256,7 +228,6 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index e7e662e4e9..515f7cf48d 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -114,33 +114,6 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -199,7 +172,6 @@ func getSharedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -256,7 +228,6 @@ func listSharedClusterBackupsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index b653baf5b8..f212c0d2e7 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -114,21 +114,6 @@ func createStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -216,19 +201,6 @@ func createStreamInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -286,7 +258,6 @@ func deleteStreamConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -343,7 +314,6 @@ func deleteStreamInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to delete.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -402,7 +372,6 @@ func getStreamConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -462,7 +431,6 @@ func getStreamInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().BoolVar(&opts.includeConnections, "includeConnections", false, `Flag to indicate whether connections information should be included in the stream instance.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -524,7 +492,6 @@ func listStreamConnectionsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -583,7 +550,6 @@ func listStreamInstancesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -676,21 +642,6 @@ func updateStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -782,11 +733,6 @@ func updateStreamInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index e2eb62b042..d4c36e962f 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -110,6 +110,7 @@ func addAllTeamsToProjectBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -196,6 +197,7 @@ func addTeamUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.`) + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -281,13 +283,6 @@ func createTeamBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -340,7 +335,6 @@ func deleteTeamBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to delete.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -394,7 +388,6 @@ func getTeamByIdBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose information you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -448,7 +441,6 @@ func getTeamByNameBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamName, "teamName", "", `Name of the team whose information you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -508,7 +500,6 @@ func listOrganizationTeamsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -569,7 +560,6 @@ func listProjectTeamsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -628,7 +618,6 @@ func listTeamUsersBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -684,7 +673,6 @@ func removeProjectTeamBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -741,7 +729,6 @@ func removeTeamUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -831,13 +818,6 @@ func renameTeamBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to rename.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -928,11 +908,6 @@ func updateTeamRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index cebbb20154..8c2daa3e97 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -123,53 +123,7 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -225,7 +179,6 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -281,7 +234,6 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -343,7 +295,6 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -442,53 +393,7 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index 6a50da30c9..ddf8984d49 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -114,19 +114,6 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account for whom to create a certificate.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -179,7 +166,6 @@ func disableCustomerManagedX509Builder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) @@ -243,7 +229,6 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 2ae8b9389f..cd0e72d850 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -104,9 +104,9 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C {{#allParams}} {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, `{{unescapedDescription}}`){{/isBodyParam}} {{/allParams}} -{{#bodyParam}}{{#vars}} +{{#bodyParam}} cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") -{{/vars}}{{/bodyParam}} +{{/bodyParam}} cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) {{#allParams}}{{^isBodyParam}}{{#required}} From d255a57877c989e64b93383c77fd1c7304602919 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 20 Sep 2023 17:46:23 +0100 Subject: [PATCH 26/44] fix --- internal/api/api_access_tracking_cmd.go | 8 -- internal/api/api_alert_configurations_cmd.go | 26 ------ internal/api/api_alerts_cmd.go | 14 --- internal/api/api_atlas_search_cmd.go | 17 ---- internal/api/api_auditing_cmd.go | 8 -- internal/api/api_aws_clusters_dns_cmd.go | 8 -- internal/api/api_cloud_backups_cmd.go | 89 ------------------- .../api/api_cloud_migration_service_cmd.go | 26 ------ internal/api/api_cloud_provider_access_cmd.go | 17 ---- .../api/api_cluster_outage_simulation_cmd.go | 11 --- internal/api/api_clusters_cmd.go | 47 ---------- internal/api/api_custom_database_roles_cmd.go | 17 ---- internal/api/api_data_federation_cmd.go | 44 --------- internal/api/api_data_lake_pipelines_cmd.go | 41 --------- internal/api/api_database_users_cmd.go | 17 ---- ..._rest_using_customer_key_management_cmd.go | 8 -- internal/api/api_events_cmd.go | 14 --- .../api/api_federated_authentication_cmd.go | 47 ---------- internal/api/api_global_clusters_cmd.go | 17 ---- internal/api/api_invoices_cmd.go | 20 ----- internal/api/api_ldap_configuration_cmd.go | 17 ---- internal/api/api_legacy_backup_cmd.go | 32 ------- .../api/api_legacy_backup_restore_jobs_cmd.go | 5 -- internal/api/api_maintenance_windows__cmd.go | 17 ---- internal/api/api_mongo_db_cloud_users_cmd.go | 11 --- internal/api/api_monitoring_and_logs_cmd.go | 44 --------- internal/api/api_network_peering_cmd.go | 41 --------- internal/api/api_online_archive_cmd.go | 20 ----- internal/api/api_organizations_cmd.go | 53 ----------- internal/api/api_performance_advisor_cmd.go | 17 ---- .../api/api_private_endpoint_services_cmd.go | 29 ------ internal/api/api_programmatic_api_keys_cmd.go | 44 --------- .../api/api_project_ip_access_list_cmd.go | 17 ---- internal/api/api_projects_cmd.go | 65 -------------- internal/api/api_push_based_log_export_cmd.go | 14 --- internal/api/api_rolling_index_cmd.go | 5 -- internal/api/api_root_cmd.go | 5 -- internal/api/api_serverless_instances_cmd.go | 17 ---- .../api_serverless_private_endpoints_cmd.go | 17 ---- .../api/api_shared_tier_restore_jobs_cmd.go | 11 --- internal/api/api_shared_tier_snapshots_cmd.go | 11 --- internal/api/api_streams_cmd.go | 32 ------- internal/api/api_teams_cmd.go | 41 --------- .../api/api_third_party_integrations_cmd.go | 17 ---- internal/api/api_x509_authentication_cmd.go | 11 --- .../config/go-templates/cmd.mustache | 3 - 46 files changed, 1092 deletions(-) diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index be1859a7cd..733afdc9d3 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -21,16 +21,13 @@ import ( "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type listAccessLogsByClusterNameOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -90,8 +87,6 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One Internet Protocol address that attempted to authenticate with the database.`) cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -100,7 +95,6 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { type listAccessLogsByHostnameOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string hostname string @@ -160,8 +154,6 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One Internet Protocol address that attempted to authenticate with the database.`) cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostname") diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index 162509d519..50d115a048 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createAlertConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createAlertConfigurationBuilder() *cobra.Command { type deleteAlertConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string alertConfigId string @@ -165,8 +159,6 @@ func deleteAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -175,7 +167,6 @@ func deleteAlertConfigurationBuilder() *cobra.Command { type getAlertConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string alertConfigId string @@ -220,8 +211,6 @@ func getAlertConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -230,7 +219,6 @@ func getAlertConfigurationBuilder() *cobra.Command { type listAlertConfigurationMatchersFieldNamesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient } @@ -266,15 +254,12 @@ func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } type listAlertConfigurationsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -325,8 +310,6 @@ func listAlertConfigurationsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -334,7 +317,6 @@ func listAlertConfigurationsBuilder() *cobra.Command { type listAlertConfigurationsByAlertIdOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string alertId string @@ -388,8 +370,6 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") @@ -398,7 +378,6 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { type toggleAlertConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string alertConfigId string @@ -478,8 +457,6 @@ func toggleAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") @@ -488,7 +465,6 @@ func toggleAlertConfigurationBuilder() *cobra.Command { type updateAlertConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string alertConfigId string @@ -568,8 +544,6 @@ func updateAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index 12611e6fae..6e00f66a56 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type acknowledgeAlertOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string alertId string @@ -114,8 +111,6 @@ func acknowledgeAlertBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") @@ -124,7 +119,6 @@ func acknowledgeAlertBuilder() *cobra.Command { type getAlertOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string alertId string @@ -169,8 +163,6 @@ func getAlertBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") @@ -179,7 +171,6 @@ func getAlertBuilder() *cobra.Command { type listAlertsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -233,8 +224,6 @@ func listAlertsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.status, "status", "", `Status of the alerts to return. Omit to return all alerts in all statuses.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -242,7 +231,6 @@ func listAlertsBuilder() *cobra.Command { type listAlertsByAlertConfigurationIdOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string alertConfigId string @@ -296,8 +284,6 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index 0058362cfb..5508c9fc31 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createAtlasSearchIndexOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -114,8 +111,6 @@ func createAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection on which to create an Atlas Search index.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -124,7 +119,6 @@ func createAtlasSearchIndexBuilder() *cobra.Command { type deleteAtlasSearchIndexOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -172,8 +166,6 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the database and collection with one or more Application Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -183,7 +175,6 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { type getAtlasSearchIndexOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -231,8 +222,6 @@ func getAtlasSearchIndexBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -242,7 +231,6 @@ func getAtlasSearchIndexBuilder() *cobra.Command { type listAtlasSearchIndexesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -293,8 +281,6 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Name of the collection that contains one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -305,7 +291,6 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { type updateAtlasSearchIndexOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -388,8 +373,6 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 41b1cf9750..3092847e12 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type getAuditingConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -76,8 +73,6 @@ func getAuditingConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -85,7 +80,6 @@ func getAuditingConfigurationBuilder() *cobra.Command { type updateAuditingConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -162,8 +156,6 @@ func updateAuditingConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index b14da5b7ca..da671e5780 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type getAWSCustomDNSOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -76,8 +73,6 @@ func getAWSCustomDNSBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -85,7 +80,6 @@ func getAWSCustomDNSBuilder() *cobra.Command { type toggleAWSCustomDNSOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -162,8 +156,6 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 976e7cb25d..409c7e3629 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type cancelBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -82,8 +79,6 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -93,7 +88,6 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { type createBackupExportJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -173,8 +167,6 @@ func createBackupExportJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -183,7 +175,6 @@ func createBackupExportJobBuilder() *cobra.Command { type createBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -263,8 +254,6 @@ func createBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -273,7 +262,6 @@ func createBackupRestoreJobBuilder() *cobra.Command { type createExportBucketOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -350,8 +338,6 @@ func createExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -359,7 +345,6 @@ func createExportBucketBuilder() *cobra.Command { type createServerlessBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -439,8 +424,6 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance whose snapshot you want to restore.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -449,7 +432,6 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { type deleteAllBackupSchedulesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -494,8 +476,6 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -504,7 +484,6 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { type deleteExportBucketOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string exportBucketId string @@ -549,8 +528,6 @@ func deleteExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") @@ -559,7 +536,6 @@ func deleteExportBucketBuilder() *cobra.Command { type deleteReplicaSetBackupOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -607,8 +583,6 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -618,7 +592,6 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { type deleteShardedClusterBackupOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -666,8 +639,6 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -677,7 +648,6 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { type getBackupExportJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -725,8 +695,6 @@ func getBackupExportJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.exportId, "exportId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -736,7 +704,6 @@ func getBackupExportJobBuilder() *cobra.Command { type getBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -784,8 +751,6 @@ func getBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -795,7 +760,6 @@ func getBackupRestoreJobBuilder() *cobra.Command { type getBackupScheduleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -840,8 +804,6 @@ func getBackupScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -850,7 +812,6 @@ func getBackupScheduleBuilder() *cobra.Command { type getDataProtectionSettingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -892,8 +853,6 @@ func getDataProtectionSettingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -901,7 +860,6 @@ func getDataProtectionSettingsBuilder() *cobra.Command { type getExportBucketOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string exportBucketId string @@ -946,8 +904,6 @@ func getExportBucketBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") @@ -956,7 +912,6 @@ func getExportBucketBuilder() *cobra.Command { type getReplicaSetBackupOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1004,8 +959,6 @@ func getReplicaSetBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1015,7 +968,6 @@ func getReplicaSetBackupBuilder() *cobra.Command { type getServerlessBackupOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1063,8 +1015,6 @@ func getServerlessBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1074,7 +1024,6 @@ func getServerlessBackupBuilder() *cobra.Command { type getServerlessBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1122,8 +1071,6 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1133,7 +1080,6 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { type getShardedClusterBackupOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1181,8 +1127,6 @@ func getShardedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1192,7 +1136,6 @@ func getShardedClusterBackupBuilder() *cobra.Command { type listBackupExportJobsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1246,8 +1189,6 @@ func listBackupExportJobsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1256,7 +1197,6 @@ func listBackupExportJobsBuilder() *cobra.Command { type listBackupRestoreJobsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1310,8 +1250,6 @@ func listBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1320,7 +1258,6 @@ func listBackupRestoreJobsBuilder() *cobra.Command { type listExportBucketsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -1371,8 +1308,6 @@ func listExportBucketsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1380,7 +1315,6 @@ func listExportBucketsBuilder() *cobra.Command { type listReplicaSetBackupsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1434,8 +1368,6 @@ func listReplicaSetBackupsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1444,7 +1376,6 @@ func listReplicaSetBackupsBuilder() *cobra.Command { type listServerlessBackupRestoreJobsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1498,8 +1429,6 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1508,7 +1437,6 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { type listServerlessBackupsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1562,8 +1490,6 @@ func listServerlessBackupsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1572,7 +1498,6 @@ func listServerlessBackupsBuilder() *cobra.Command { type listShardedClusterBackupsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1617,8 +1542,6 @@ func listShardedClusterBackupsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1627,7 +1550,6 @@ func listShardedClusterBackupsBuilder() *cobra.Command { type takeSnapshotOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1707,8 +1629,6 @@ func takeSnapshotBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1717,7 +1637,6 @@ func takeSnapshotBuilder() *cobra.Command { type updateBackupScheduleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1797,8 +1716,6 @@ func updateBackupScheduleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -1807,7 +1724,6 @@ func updateBackupScheduleBuilder() *cobra.Command { type updateDataProtectionSettingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -1884,8 +1800,6 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1893,7 +1807,6 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { type updateSnapshotRetentionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -1976,8 +1889,6 @@ func updateSnapshotRetentionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 05d2170c30..8241448740 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createLinkTokenOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string @@ -109,8 +106,6 @@ func createLinkTokenBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -118,7 +113,6 @@ func createLinkTokenBuilder() *cobra.Command { type createPushMigrationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -195,8 +189,6 @@ func createPushMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -204,7 +196,6 @@ func createPushMigrationBuilder() *cobra.Command { type cutoverMigrationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string liveMigrationId string @@ -249,8 +240,6 @@ func cutoverMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") @@ -259,7 +248,6 @@ func cutoverMigrationBuilder() *cobra.Command { type deleteLinkTokenOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string } @@ -299,8 +287,6 @@ func deleteLinkTokenBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -308,7 +294,6 @@ func deleteLinkTokenBuilder() *cobra.Command { type getPushMigrationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string liveMigrationId string @@ -353,8 +338,6 @@ func getPushMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") @@ -363,7 +346,6 @@ func getPushMigrationBuilder() *cobra.Command { type getValidationStatusOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string validationId string @@ -408,8 +390,6 @@ func getValidationStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("validationId") @@ -418,7 +398,6 @@ func getValidationStatusBuilder() *cobra.Command { type listSourceProjectsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string } @@ -458,8 +437,6 @@ func listSourceProjectsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -467,7 +444,6 @@ func listSourceProjectsBuilder() *cobra.Command { type validateMigrationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -544,8 +520,6 @@ func validateMigrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index 3f72db699c..74267649bd 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type authorizeCloudProviderAccessRoleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string roleId string @@ -114,8 +111,6 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") @@ -124,7 +119,6 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { type createCloudProviderAccessRoleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -201,8 +195,6 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -210,7 +202,6 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { type deauthorizeCloudProviderAccessRoleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string cloudProvider string @@ -258,8 +249,6 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider of the role to deauthorize.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -269,7 +258,6 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { type getCloudProviderAccessRoleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string roleId string @@ -314,8 +302,6 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") @@ -324,7 +310,6 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { type listCloudProviderAccessRolesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -366,8 +351,6 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index 2bb8d1e389..36bed3c9c3 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type endOutageSimulationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -79,8 +76,6 @@ func endOutageSimulationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -89,7 +84,6 @@ func endOutageSimulationBuilder() *cobra.Command { type getOutageSimulationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -134,8 +128,6 @@ func getOutageSimulationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -144,7 +136,6 @@ func getOutageSimulationBuilder() *cobra.Command { type startOutageSimulationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -224,8 +215,6 @@ func startOutageSimulationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to undergo an outage simulation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 42bfa2971f..cda3408428 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createClusterOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createClusterBuilder() *cobra.Command { type deleteClusterOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -168,8 +162,6 @@ func deleteClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -178,7 +170,6 @@ func deleteClusterBuilder() *cobra.Command { type getClusterOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -223,8 +214,6 @@ func getClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -233,7 +222,6 @@ func getClusterBuilder() *cobra.Command { type getClusterAdvancedConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -278,8 +266,6 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -288,7 +274,6 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { type getClusterStatusOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -333,8 +318,6 @@ func getClusterStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -343,7 +326,6 @@ func getClusterStatusBuilder() *cobra.Command { type getSampleDatasetLoadStatusOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string sampleDatasetId string @@ -388,8 +370,6 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("sampleDatasetId") @@ -398,7 +378,6 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { type listCloudProviderRegionsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -455,8 +434,6 @@ func listCloudProviderRegionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, `Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.`) cmd.Flags().StringVar(&opts.tier, "tier", "", `Cluster tier for which to retrieve the regions.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -464,7 +441,6 @@ func listCloudProviderRegionsBuilder() *cobra.Command { type listClustersOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -518,8 +494,6 @@ func listClustersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().BoolVar(&opts.includeDeletedWithRetainedBackups, "includeDeletedWithRetainedBackups", false, `Flag that indicates whether to return Clusters with retain backups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -527,7 +501,6 @@ func listClustersBuilder() *cobra.Command { type listClustersForAllProjectsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient includeCount bool itemsPerPage int @@ -573,15 +546,12 @@ func listClustersForAllProjectsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } type loadSampleDatasetOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string name string @@ -626,8 +596,6 @@ func loadSampleDatasetBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") @@ -636,7 +604,6 @@ func loadSampleDatasetBuilder() *cobra.Command { type testFailoverOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -681,8 +648,6 @@ func testFailoverBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -691,7 +656,6 @@ func testFailoverBuilder() *cobra.Command { type updateClusterOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -771,8 +735,6 @@ func updateClusterBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -781,7 +743,6 @@ func updateClusterBuilder() *cobra.Command { type updateClusterAdvancedConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -861,8 +822,6 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -871,7 +830,6 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { type upgradeSharedClusterOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -948,8 +906,6 @@ func upgradeSharedClusterBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -957,7 +913,6 @@ func upgradeSharedClusterBuilder() *cobra.Command { type upgradeSharedClusterToServerlessOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -1034,8 +989,6 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 56b4d6875f..99b8fc66b1 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createCustomDatabaseRoleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { type deleteCustomDatabaseRoleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string roleName string @@ -165,8 +159,6 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") @@ -175,7 +167,6 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { type getCustomDatabaseRoleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string roleName string @@ -220,8 +211,6 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") @@ -230,7 +219,6 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { type listCustomDatabaseRolesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -272,8 +260,6 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -281,7 +267,6 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { type updateCustomDatabaseRoleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string roleName string @@ -361,8 +346,6 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index b7ed261ee3..aa668ddaf5 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createDataFederationPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { type createFederatedDatabaseOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -201,8 +195,6 @@ func createFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -210,7 +202,6 @@ func createFederatedDatabaseBuilder() *cobra.Command { type createOneDataFederationQueryLimitOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -301,8 +292,6 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { `) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -312,7 +301,6 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { type deleteDataFederationPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string endpointId string @@ -357,8 +345,6 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") @@ -367,7 +353,6 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { type deleteFederatedDatabaseOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -412,8 +397,6 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -422,7 +405,6 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { type deleteOneDataFederationInstanceQueryLimitOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -478,8 +460,6 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -489,7 +469,6 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { type downloadFederatedDatabaseQueryLogsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -540,8 +519,6 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to download query logs.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -550,7 +527,6 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { type getDataFederationPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string endpointId string @@ -595,8 +571,6 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") @@ -605,7 +579,6 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { type getFederatedDatabaseOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -650,8 +623,6 @@ func getFederatedDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -660,7 +631,6 @@ func getFederatedDatabaseBuilder() *cobra.Command { type listDataFederationPrivateEndpointsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -711,8 +681,6 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -720,7 +688,6 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { type listFederatedDatabasesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string type_ string @@ -765,8 +732,6 @@ func listFederatedDatabasesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -774,7 +739,6 @@ func listFederatedDatabasesBuilder() *cobra.Command { type returnFederatedDatabaseQueryLimitOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -830,8 +794,6 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -841,7 +803,6 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { type returnFederatedDatabaseQueryLimitsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -886,8 +847,6 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -896,7 +855,6 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { type updateFederatedDatabaseOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -979,8 +937,6 @@ func updateFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 70e5f9a810..817029d07b 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createPipelineOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createPipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createPipelineBuilder() *cobra.Command { type deletePipelineOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -165,8 +159,6 @@ func deletePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -175,7 +167,6 @@ func deletePipelineBuilder() *cobra.Command { type deletePipelineRunDatasetOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -223,8 +214,6 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -234,7 +223,6 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { type getPipelineOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -279,8 +267,6 @@ func getPipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -289,7 +275,6 @@ func getPipelineBuilder() *cobra.Command { type getPipelineRunOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -337,8 +322,6 @@ func getPipelineRunBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -348,7 +331,6 @@ func getPipelineRunBuilder() *cobra.Command { type listPipelineRunsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -405,8 +387,6 @@ func listPipelineRunsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", `If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -415,7 +395,6 @@ func listPipelineRunsBuilder() *cobra.Command { type listPipelineSchedulesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -460,8 +439,6 @@ func listPipelineSchedulesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -470,7 +447,6 @@ func listPipelineSchedulesBuilder() *cobra.Command { type listPipelineSnapshotsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -527,8 +503,6 @@ func listPipelineSnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", `Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -537,7 +511,6 @@ func listPipelineSnapshotsBuilder() *cobra.Command { type listPipelinesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -579,8 +552,6 @@ func listPipelinesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -588,7 +559,6 @@ func listPipelinesBuilder() *cobra.Command { type pausePipelineOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -633,8 +603,6 @@ func pausePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -643,7 +611,6 @@ func pausePipelineBuilder() *cobra.Command { type resumePipelineOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -688,8 +655,6 @@ func resumePipelineBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -698,7 +663,6 @@ func resumePipelineBuilder() *cobra.Command { type triggerSnapshotIngestionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -778,8 +742,6 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") @@ -788,7 +750,6 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { type updatePipelineOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string pipelineName string @@ -868,8 +829,6 @@ func updatePipelineBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index 3d6709d793..4399528c3e 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createDatabaseUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createDatabaseUserBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createDatabaseUserBuilder() *cobra.Command { type deleteDatabaseUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string databaseName string @@ -180,8 +174,6 @@ func deleteDatabaseUserBuilder() *cobra.Command { | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") @@ -191,7 +183,6 @@ func deleteDatabaseUserBuilder() *cobra.Command { type getDatabaseUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string databaseName string @@ -251,8 +242,6 @@ func getDatabaseUserBuilder() *cobra.Command { | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") @@ -262,7 +251,6 @@ func getDatabaseUserBuilder() *cobra.Command { type listDatabaseUsersOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -313,8 +301,6 @@ func listDatabaseUsersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -322,7 +308,6 @@ func listDatabaseUsersBuilder() *cobra.Command { type updateDatabaseUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string databaseName string @@ -417,8 +402,6 @@ func updateDatabaseUserBuilder() *cobra.Command { `) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index 958a1286e0..a5716ed973 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type getEncryptionAtRestOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -76,8 +73,6 @@ func getEncryptionAtRestBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -85,7 +80,6 @@ func getEncryptionAtRestBuilder() *cobra.Command { type updateEncryptionAtRestOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -162,8 +156,6 @@ func updateEncryptionAtRestBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 0fa288af27..0fc40a7d6d 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -21,16 +21,13 @@ import ( "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getOrganizationEventOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string eventId string @@ -76,8 +73,6 @@ func getOrganizationEventBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("eventId") @@ -86,7 +81,6 @@ func getOrganizationEventBuilder() *cobra.Command { type getProjectEventOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string eventId string @@ -134,8 +128,6 @@ func getProjectEventBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("eventId") @@ -144,7 +136,6 @@ func getProjectEventBuilder() *cobra.Command { type listOrganizationEventsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string includeCount bool @@ -207,8 +198,6 @@ func listOrganizationEventsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -216,7 +205,6 @@ func listOrganizationEventsBuilder() *cobra.Command { type listProjectEventsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -289,8 +277,6 @@ func listProjectEventsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index 053e268285..a753e952dd 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createRoleMappingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string orgId string @@ -112,8 +109,6 @@ func createRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -122,7 +117,6 @@ func createRoleMappingBuilder() *cobra.Command { type deleteFederationAppOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string } @@ -162,8 +156,6 @@ func deleteFederationAppBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -171,7 +163,6 @@ func deleteFederationAppBuilder() *cobra.Command { type deleteRoleMappingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string id string @@ -217,8 +208,6 @@ func deleteRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") @@ -228,7 +217,6 @@ func deleteRoleMappingBuilder() *cobra.Command { type getConnectedOrgConfigOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string orgId string @@ -271,8 +259,6 @@ func getConnectedOrgConfigBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -281,7 +267,6 @@ func getConnectedOrgConfigBuilder() *cobra.Command { type getFederationSettingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string } @@ -321,8 +306,6 @@ func getFederationSettingsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -330,7 +313,6 @@ func getFederationSettingsBuilder() *cobra.Command { type getIdentityProviderOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string identityProviderId string @@ -373,8 +355,6 @@ func getIdentityProviderBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") @@ -383,7 +363,6 @@ func getIdentityProviderBuilder() *cobra.Command { type getIdentityProviderMetadataOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string identityProviderId string @@ -426,8 +405,6 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") @@ -436,7 +413,6 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { type getRoleMappingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string id string @@ -482,8 +458,6 @@ func getRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") @@ -493,7 +467,6 @@ func getRoleMappingBuilder() *cobra.Command { type listConnectedOrgConfigsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string } @@ -533,8 +506,6 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -542,7 +513,6 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { type listIdentityProvidersOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string } @@ -582,8 +552,6 @@ func listIdentityProvidersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") return cmd @@ -591,7 +559,6 @@ func listIdentityProvidersBuilder() *cobra.Command { type listRoleMappingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string orgId string @@ -634,8 +601,6 @@ func listRoleMappingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -644,7 +609,6 @@ func listRoleMappingsBuilder() *cobra.Command { type removeConnectedOrgConfigOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string orgId string @@ -687,8 +651,6 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -697,7 +659,6 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { type updateConnectedOrgConfigOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string orgId string @@ -775,8 +736,6 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the connected organization configuration to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -785,7 +744,6 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { type updateIdentityProviderOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string identityProviderId string @@ -863,8 +821,6 @@ func updateIdentityProviderBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") @@ -873,7 +829,6 @@ func updateIdentityProviderBuilder() *cobra.Command { type updateRoleMappingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient federationSettingsId string id string @@ -954,8 +909,6 @@ func updateRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 813598bafa..7adc13b4bb 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createCustomZoneMappingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -114,8 +111,6 @@ func createCustomZoneMappingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -124,7 +119,6 @@ func createCustomZoneMappingBuilder() *cobra.Command { type createManagedNamespaceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -204,8 +198,6 @@ func createManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -214,7 +206,6 @@ func createManagedNamespaceBuilder() *cobra.Command { type deleteAllCustomZoneMappingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -259,8 +250,6 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -269,7 +258,6 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { type deleteManagedNamespaceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient clusterName string groupId string @@ -320,8 +308,6 @@ func deleteManagedNamespaceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label that identifies the database that contains the collection.`) cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -330,7 +316,6 @@ func deleteManagedNamespaceBuilder() *cobra.Command { type getManagedNamespaceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -375,8 +360,6 @@ func getManagedNamespaceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index bdf361f946..38ab47c8c0 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createCostExplorerQueryProcessOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string @@ -109,8 +106,6 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -118,7 +113,6 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { type createCostExplorerQueryProcess1Opts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string token string @@ -161,8 +155,6 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.token, "token", "", `Unique 64 digit string that identifies the Cost Explorer query.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("token") @@ -171,7 +163,6 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { type downloadInvoiceCSVOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string invoiceId string @@ -214,8 +205,6 @@ func downloadInvoiceCSVBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") @@ -224,7 +213,6 @@ func downloadInvoiceCSVBuilder() *cobra.Command { type getInvoiceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string invoiceId string @@ -267,8 +255,6 @@ func getInvoiceBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") @@ -277,7 +263,6 @@ func getInvoiceBuilder() *cobra.Command { type listInvoicesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string includeCount bool @@ -326,8 +311,6 @@ func listInvoicesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -335,7 +318,6 @@ func listInvoicesBuilder() *cobra.Command { type listPendingInvoicesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string } @@ -375,8 +357,6 @@ func listPendingInvoicesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 5ee232e3a0..c5b4a9e544 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type deleteLDAPConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -76,8 +73,6 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -85,7 +80,6 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { type getLDAPConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -127,8 +121,6 @@ func getLDAPConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,7 +128,6 @@ func getLDAPConfigurationBuilder() *cobra.Command { type getLDAPConfigurationStatusOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string requestId string @@ -181,8 +172,6 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("requestId") @@ -191,7 +180,6 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { type saveLDAPConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -268,8 +256,6 @@ func saveLDAPConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -277,7 +263,6 @@ func saveLDAPConfigurationBuilder() *cobra.Command { type verifyLDAPConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -354,8 +339,6 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index b83269bb83..0a3f61c4fa 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type deleteLegacySnapshotOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -82,8 +79,6 @@ func deleteLegacySnapshotBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -93,7 +88,6 @@ func deleteLegacySnapshotBuilder() *cobra.Command { type getLegacyBackupCheckpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string checkpointId string @@ -141,8 +135,6 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the checkpoint.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("checkpointId") @@ -152,7 +144,6 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { type getLegacyBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -200,8 +191,6 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVar(&opts.jobId, "jobId", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -211,7 +200,6 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { type getLegacySnapshotOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -259,8 +247,6 @@ func getLegacySnapshotBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -270,7 +256,6 @@ func getLegacySnapshotBuilder() *cobra.Command { type getLegacySnapshotScheduleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -315,8 +300,6 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -325,7 +308,6 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { type listLegacyBackupCheckpointsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -379,8 +361,6 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -389,7 +369,6 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { type listLegacyBackupRestoreJobsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -446,8 +425,6 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -456,7 +433,6 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { type listLegacySnapshotsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -513,8 +489,6 @@ func listLegacySnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completed, "completed", ""true"", `Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -523,7 +497,6 @@ func listLegacySnapshotsBuilder() *cobra.Command { type updateLegacySnapshotRetentionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -606,8 +579,6 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -617,7 +588,6 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { type updateLegacySnapshotScheduleOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -697,8 +667,6 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index 416a403c4e..dbd5c65f08 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createLegacyBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -114,8 +111,6 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index 73c2e8d43d..4e1d8bd991 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type deferMaintenanceWindowOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -76,8 +73,6 @@ func deferMaintenanceWindowBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -85,7 +80,6 @@ func deferMaintenanceWindowBuilder() *cobra.Command { type getMaintenanceWindowOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -127,8 +121,6 @@ func getMaintenanceWindowBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -136,7 +128,6 @@ func getMaintenanceWindowBuilder() *cobra.Command { type resetMaintenanceWindowOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -178,8 +169,6 @@ func resetMaintenanceWindowBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -187,7 +176,6 @@ func resetMaintenanceWindowBuilder() *cobra.Command { type toggleMaintenanceAutoDeferOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -229,8 +217,6 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -238,7 +224,6 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { type updateMaintenanceWindowOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -315,8 +300,6 @@ func updateMaintenanceWindowBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index 0129e1102a..3bc81c87a2 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient filename string @@ -106,15 +103,12 @@ func createUserBuilder() *cobra.Command { } cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } type getUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient userId string } @@ -154,8 +148,6 @@ func getUserBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies this user.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("userId") return cmd @@ -163,7 +155,6 @@ func getUserBuilder() *cobra.Command { type getUserByUsernameOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient userName string } @@ -203,8 +194,6 @@ func getUserByUsernameBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.userName, "userName", "", `Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("userName") return cmd diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index 7dd41c27c6..6bf1d59ad0 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -21,16 +21,13 @@ import ( "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getAtlasProcessOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string processId string @@ -75,8 +72,6 @@ func getAtlasProcessBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -85,7 +80,6 @@ func getAtlasProcessBuilder() *cobra.Command { type getDatabaseOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string databaseName string @@ -133,8 +127,6 @@ func getDatabaseBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") @@ -144,7 +136,6 @@ func getDatabaseBuilder() *cobra.Command { type getDatabaseMeasurementsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string databaseName string @@ -207,8 +198,6 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") @@ -219,7 +208,6 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { type getDiskMeasurementsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string partitionName string @@ -282,8 +270,6 @@ func getDiskMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("partitionName") @@ -294,7 +280,6 @@ func getDiskMeasurementsBuilder() *cobra.Command { type getHostLogsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string hostName string @@ -348,8 +333,6 @@ func getHostLogsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.logName, "logName", "", `Human-readable label that identifies the log file that you want to return. To return audit logs, enable *Database Auditing* for the specified project.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostName") @@ -359,7 +342,6 @@ func getHostLogsBuilder() *cobra.Command { type getHostMeasurementsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string processId string @@ -419,8 +401,6 @@ func getHostMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -430,7 +410,6 @@ func getHostMeasurementsBuilder() *cobra.Command { type getIndexMetricsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient processId string indexName string @@ -499,8 +478,6 @@ func getIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("indexName") @@ -514,7 +491,6 @@ func getIndexMetricsBuilder() *cobra.Command { type getMeasurementsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient processId string groupId string @@ -574,8 +550,6 @@ func getMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") @@ -586,7 +560,6 @@ func getMeasurementsBuilder() *cobra.Command { type listAtlasProcessesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -637,8 +610,6 @@ func listAtlasProcessesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -646,7 +617,6 @@ func listAtlasProcessesBuilder() *cobra.Command { type listDatabasesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string processId string @@ -700,8 +670,6 @@ func listDatabasesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -710,7 +678,6 @@ func listDatabasesBuilder() *cobra.Command { type listDiskMeasurementsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient partitionName string groupId string @@ -758,8 +725,6 @@ func listDiskMeasurementsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("groupId") @@ -769,7 +734,6 @@ func listDiskMeasurementsBuilder() *cobra.Command { type listDiskPartitionsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string processId string @@ -823,8 +787,6 @@ func listDiskPartitionsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -833,7 +795,6 @@ func listDiskPartitionsBuilder() *cobra.Command { type listIndexMetricsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient processId string databaseName string @@ -899,8 +860,6 @@ func listIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("databaseName") @@ -913,7 +872,6 @@ func listIndexMetricsBuilder() *cobra.Command { type listMetricTypesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient processId string groupId string @@ -958,8 +916,6 @@ func listMetricTypesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index 08a973d30f..3ae68c19d2 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createPeeringConnectionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createPeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createPeeringConnectionBuilder() *cobra.Command { type createPeeringContainerOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -197,8 +191,6 @@ func createPeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -206,7 +198,6 @@ func createPeeringContainerBuilder() *cobra.Command { type deletePeeringConnectionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string peerId string @@ -251,8 +242,6 @@ func deletePeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") @@ -261,7 +250,6 @@ func deletePeeringConnectionBuilder() *cobra.Command { type deletePeeringContainerOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string containerId string @@ -306,8 +294,6 @@ func deletePeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") @@ -316,7 +302,6 @@ func deletePeeringContainerBuilder() *cobra.Command { type disablePeeringOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -393,8 +378,6 @@ func disablePeeringBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -402,7 +385,6 @@ func disablePeeringBuilder() *cobra.Command { type getPeeringConnectionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string peerId string @@ -447,8 +429,6 @@ func getPeeringConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") @@ -457,7 +437,6 @@ func getPeeringConnectionBuilder() *cobra.Command { type getPeeringContainerOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string containerId string @@ -502,8 +481,6 @@ func getPeeringContainerBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") @@ -512,7 +489,6 @@ func getPeeringContainerBuilder() *cobra.Command { type listPeeringConnectionsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -566,8 +542,6 @@ func listPeeringConnectionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider to use for this VPC peering connection.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -575,7 +549,6 @@ func listPeeringConnectionsBuilder() *cobra.Command { type listPeeringContainerByCloudProviderOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string providerName string @@ -629,8 +602,6 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("providerName") @@ -639,7 +610,6 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { type listPeeringContainersOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -690,8 +660,6 @@ func listPeeringContainersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -699,7 +667,6 @@ func listPeeringContainersBuilder() *cobra.Command { type updatePeeringConnectionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string peerId string @@ -779,8 +746,6 @@ func updatePeeringConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") @@ -789,7 +754,6 @@ func updatePeeringConnectionBuilder() *cobra.Command { type updatePeeringContainerOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string containerId string @@ -869,8 +833,6 @@ func updatePeeringContainerBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") @@ -879,7 +841,6 @@ func updatePeeringContainerBuilder() *cobra.Command { type verifyConnectViaPeeringOnlyModeForOneProjectOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -921,8 +882,6 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index e85303f891..d19ccf600b 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createOnlineArchiveOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -114,8 +111,6 @@ func createOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -124,7 +119,6 @@ func createOnlineArchiveBuilder() *cobra.Command { type deleteOnlineArchiveOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string archiveId string @@ -172,8 +166,6 @@ func deleteOnlineArchiveBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to delete.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") @@ -183,7 +175,6 @@ func deleteOnlineArchiveBuilder() *cobra.Command { type downloadOnlineArchiveQueryLogsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -237,8 +228,6 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, `Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -247,7 +236,6 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { type getOnlineArchiveOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string archiveId string @@ -295,8 +283,6 @@ func getOnlineArchiveBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to return.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") @@ -306,7 +292,6 @@ func getOnlineArchiveBuilder() *cobra.Command { type listOnlineArchivesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -360,8 +345,6 @@ func listOnlineArchivesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -370,7 +353,6 @@ func listOnlineArchivesBuilder() *cobra.Command { type updateOnlineArchiveOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string archiveId string @@ -453,8 +435,6 @@ func updateOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 58ccfd684b..52795122d4 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createOrganizationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient filename string @@ -106,15 +103,12 @@ func createOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } type createOrganizationInvitationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string @@ -189,8 +183,6 @@ func createOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -198,7 +190,6 @@ func createOrganizationInvitationBuilder() *cobra.Command { type deleteOrganizationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string } @@ -238,8 +229,6 @@ func deleteOrganizationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -247,7 +236,6 @@ func deleteOrganizationBuilder() *cobra.Command { type deleteOrganizationInvitationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string invitationId string @@ -290,8 +278,6 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") @@ -300,7 +286,6 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { type getOrganizationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string } @@ -340,8 +325,6 @@ func getOrganizationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -349,7 +332,6 @@ func getOrganizationBuilder() *cobra.Command { type getOrganizationInvitationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string invitationId string @@ -392,8 +374,6 @@ func getOrganizationInvitationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") @@ -402,7 +382,6 @@ func getOrganizationInvitationBuilder() *cobra.Command { type getOrganizationSettingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string } @@ -442,8 +421,6 @@ func getOrganizationSettingsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -451,7 +428,6 @@ func getOrganizationSettingsBuilder() *cobra.Command { type listOrganizationInvitationsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string username string @@ -494,8 +470,6 @@ func listOrganizationInvitationsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -503,7 +477,6 @@ func listOrganizationInvitationsBuilder() *cobra.Command { type listOrganizationProjectsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string includeCount bool @@ -555,8 +528,6 @@ func listOrganizationProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -564,7 +535,6 @@ func listOrganizationProjectsBuilder() *cobra.Command { type listOrganizationUsersOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string includeCount bool @@ -613,8 +583,6 @@ func listOrganizationUsersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -622,7 +590,6 @@ func listOrganizationUsersBuilder() *cobra.Command { type listOrganizationsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient includeCount bool itemsPerPage int @@ -671,15 +638,12 @@ func listOrganizationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } type removeOrganizationUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string userId string @@ -722,8 +686,6 @@ func removeOrganizationUserBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to be deleted.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("userId") @@ -732,7 +694,6 @@ func removeOrganizationUserBuilder() *cobra.Command { type renameOrganizationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string @@ -807,8 +768,6 @@ func renameOrganizationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -816,7 +775,6 @@ func renameOrganizationBuilder() *cobra.Command { type updateOrganizationInvitationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string @@ -891,8 +849,6 @@ func updateOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -900,7 +856,6 @@ func updateOrganizationInvitationBuilder() *cobra.Command { type updateOrganizationInvitationByIdOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string invitationId string @@ -978,8 +933,6 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") @@ -988,7 +941,6 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { type updateOrganizationRolesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string userId string @@ -1066,8 +1018,6 @@ func updateOrganizationRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("userId") @@ -1076,7 +1026,6 @@ func updateOrganizationRolesBuilder() *cobra.Command { type updateOrganizationSettingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string @@ -1151,8 +1100,6 @@ func updateOrganizationSettingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index 47c4c8efb7..ad9f605b7e 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -21,16 +21,13 @@ import ( "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type disableSlowOperationThresholdingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -72,8 +69,6 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -81,7 +76,6 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { type enableSlowOperationThresholdingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -123,8 +117,6 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -132,7 +124,6 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { type listSlowQueriesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string processId string @@ -195,8 +186,6 @@ func listSlowQueriesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -205,7 +194,6 @@ func listSlowQueriesBuilder() *cobra.Command { type listSlowQueryNamespacesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string processId string @@ -262,8 +250,6 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") @@ -272,7 +258,6 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { type listSuggestedIndexesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string processId string @@ -347,8 +332,6 @@ func listSuggestedIndexesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 7e0b27ed12..5ba75d8458 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string cloudProvider string @@ -117,8 +114,6 @@ func createPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -128,7 +123,6 @@ func createPrivateEndpointBuilder() *cobra.Command { type createPrivateEndpointServiceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -205,8 +199,6 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -214,7 +206,6 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { type deletePrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string cloudProvider string @@ -265,8 +256,6 @@ func deletePrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -277,7 +266,6 @@ func deletePrivateEndpointBuilder() *cobra.Command { type deletePrivateEndpointServiceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string cloudProvider string @@ -325,8 +313,6 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -336,7 +322,6 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { type getPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string cloudProvider string @@ -387,8 +372,6 @@ func getPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -399,7 +382,6 @@ func getPrivateEndpointBuilder() *cobra.Command { type getPrivateEndpointServiceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string cloudProvider string @@ -447,8 +429,6 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -458,7 +438,6 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { type getRegionalizedPrivateEndpointSettingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -500,8 +479,6 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -509,7 +486,6 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { type listPrivateEndpointServicesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string cloudProvider string @@ -554,8 +530,6 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") @@ -564,7 +538,6 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { type toggleRegionalizedPrivateEndpointSettingOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -641,8 +614,6 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index caf68deb1b..c82cc5f03f 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type addProjectApiKeyOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string apiUserId string @@ -114,8 +111,6 @@ func addProjectApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") @@ -124,7 +119,6 @@ func addProjectApiKeyBuilder() *cobra.Command { type createApiKeyOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string @@ -199,8 +193,6 @@ func createApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -208,7 +200,6 @@ func createApiKeyBuilder() *cobra.Command { type createApiKeyAccessListOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string apiUserId string @@ -296,8 +287,6 @@ func createApiKeyAccessListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -306,7 +295,6 @@ func createApiKeyAccessListBuilder() *cobra.Command { type createProjectApiKeyOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -383,8 +371,6 @@ func createProjectApiKeyBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -392,7 +378,6 @@ func createProjectApiKeyBuilder() *cobra.Command { type deleteApiKeyOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string apiUserId string @@ -435,8 +420,6 @@ func deleteApiKeyBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -445,7 +428,6 @@ func deleteApiKeyBuilder() *cobra.Command { type deleteApiKeyAccessListEntryOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string apiUserId string @@ -491,8 +473,6 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -502,7 +482,6 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { type getApiKeyOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string apiUserId string @@ -545,8 +524,6 @@ func getApiKeyBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -555,7 +532,6 @@ func getApiKeyBuilder() *cobra.Command { type getApiKeyAccessListOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string ipAddress string @@ -601,8 +577,6 @@ func getApiKeyAccessListBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("ipAddress") @@ -612,7 +586,6 @@ func getApiKeyAccessListBuilder() *cobra.Command { type listApiKeyAccessListsEntriesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string apiUserId string @@ -664,8 +637,6 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -674,7 +645,6 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { type listApiKeysOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string includeCount bool @@ -723,8 +693,6 @@ func listApiKeysBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -732,7 +700,6 @@ func listApiKeysBuilder() *cobra.Command { type listProjectApiKeysOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -783,8 +750,6 @@ func listProjectApiKeysBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -792,7 +757,6 @@ func listProjectApiKeysBuilder() *cobra.Command { type removeProjectApiKeyOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string apiUserId string @@ -837,8 +801,6 @@ func removeProjectApiKeyBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") @@ -847,7 +809,6 @@ func removeProjectApiKeyBuilder() *cobra.Command { type updateApiKeyOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string apiUserId string @@ -925,8 +886,6 @@ func updateApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key you want to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") @@ -935,7 +894,6 @@ func updateApiKeyBuilder() *cobra.Command { type updateApiKeyRolesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string apiUserId string @@ -1025,8 +983,6 @@ func updateApiKeyRolesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index c36955179a..6edb4ba59e 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createProjectIpAccessListOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -121,8 +118,6 @@ func createProjectIpAccessListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -130,7 +125,6 @@ func createProjectIpAccessListBuilder() *cobra.Command { type deleteProjectIpAccessListOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string entryValue string @@ -179,8 +173,6 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { - how your application established the connection, - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") @@ -189,7 +181,6 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { type getProjectIpAccessListStatusOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string entryValue string @@ -234,8 +225,6 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Network address or cloud provider security construct that identifies which project access list entry to be verified.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") @@ -244,7 +233,6 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { type getProjectIpListOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string entryValue string @@ -289,8 +277,6 @@ func getProjectIpListBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") @@ -299,7 +285,6 @@ func getProjectIpListBuilder() *cobra.Command { type listProjectIpAccessListsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -350,8 +335,6 @@ func listProjectIpAccessListsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 6423ce7d7a..7735f674c4 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createProjectOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient projectOwnerId string @@ -110,15 +107,12 @@ func createProjectBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } type createProjectInvitationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -195,8 +189,6 @@ func createProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -204,7 +196,6 @@ func createProjectInvitationBuilder() *cobra.Command { type deleteProjectOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -246,8 +237,6 @@ func deleteProjectBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -255,7 +244,6 @@ func deleteProjectBuilder() *cobra.Command { type deleteProjectInvitationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string invitationId string @@ -300,8 +288,6 @@ func deleteProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") @@ -310,7 +296,6 @@ func deleteProjectInvitationBuilder() *cobra.Command { type deleteProjectLimitOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient limitName string groupId string @@ -371,8 +356,6 @@ func deleteProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -381,7 +364,6 @@ func deleteProjectLimitBuilder() *cobra.Command { type getProjectOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -423,8 +405,6 @@ func getProjectBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -432,7 +412,6 @@ func getProjectBuilder() *cobra.Command { type getProjectByNameOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupName string } @@ -472,8 +451,6 @@ func getProjectByNameBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupName, "groupName", "", `Human-readable label that identifies this project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupName") return cmd @@ -481,7 +458,6 @@ func getProjectByNameBuilder() *cobra.Command { type getProjectInvitationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string invitationId string @@ -526,8 +502,6 @@ func getProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") @@ -536,7 +510,6 @@ func getProjectInvitationBuilder() *cobra.Command { type getProjectLimitOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient limitName string groupId string @@ -597,8 +570,6 @@ func getProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -607,7 +578,6 @@ func getProjectLimitBuilder() *cobra.Command { type getProjectSettingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -649,8 +619,6 @@ func getProjectSettingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -658,7 +626,6 @@ func getProjectSettingsBuilder() *cobra.Command { type listProjectInvitationsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string username string @@ -703,8 +670,6 @@ func listProjectInvitationsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -712,7 +677,6 @@ func listProjectInvitationsBuilder() *cobra.Command { type listProjectLimitsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -754,8 +718,6 @@ func listProjectLimitsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -763,7 +725,6 @@ func listProjectLimitsBuilder() *cobra.Command { type listProjectUsersOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -820,8 +781,6 @@ func listProjectUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().BoolVar(&opts.flattenTeams, "flattenTeams", false, `Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `"flattenTeams" : false`, this resource returns only users with a role in the project. If `"flattenTeams" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.`) cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, `Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `"includeOrgUsers": false`, this resource returns only users with a role in the project. If `"includeOrgUsers": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -829,7 +788,6 @@ func listProjectUsersBuilder() *cobra.Command { type listProjectsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient includeCount bool itemsPerPage int @@ -875,15 +833,12 @@ func listProjectsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } type removeProjectUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string userId string @@ -928,8 +883,6 @@ func removeProjectUserBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("userId") @@ -938,7 +891,6 @@ func removeProjectUserBuilder() *cobra.Command { type setProjectLimitOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient limitName string groupId string @@ -1034,8 +986,6 @@ func setProjectLimitBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -1044,7 +994,6 @@ func setProjectLimitBuilder() *cobra.Command { type updateProjectOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -1121,8 +1070,6 @@ func updateProjectBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1130,7 +1077,6 @@ func updateProjectBuilder() *cobra.Command { type updateProjectInvitationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -1207,8 +1153,6 @@ func updateProjectInvitationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -1216,7 +1160,6 @@ func updateProjectInvitationBuilder() *cobra.Command { type updateProjectInvitationByIdOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string invitationId string @@ -1296,8 +1239,6 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") @@ -1306,7 +1247,6 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { type updateProjectRolesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string userId string @@ -1386,8 +1326,6 @@ func updateProjectRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("userId") @@ -1396,7 +1334,6 @@ func updateProjectRolesBuilder() *cobra.Command { type updateProjectSettingsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -1473,8 +1410,6 @@ func updateProjectSettingsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index c81ff50386..c8e6df2a15 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createPushBasedLogConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { type deletePushBasedLogConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -162,8 +156,6 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -171,7 +163,6 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { type getPushBasedLogConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -213,8 +204,6 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -222,7 +211,6 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { type updatePushBasedLogConfigurationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -299,8 +287,6 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index f30e679612..80aa06330b 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -24,8 +24,6 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -33,7 +31,6 @@ import ( type createRollingIndexOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -113,8 +110,6 @@ func createRollingIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index 691c232974..e45b8e9aee 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -21,16 +21,13 @@ import ( "io" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getSystemStatusOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient } @@ -66,8 +63,6 @@ func getSystemStatusBuilder() *cobra.Command { return opts.Run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) return cmd } diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index 367b6788ad..c4c2100481 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createServerlessInstanceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func createServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func createServerlessInstanceBuilder() *cobra.Command { type deleteServerlessInstanceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string name string @@ -165,8 +159,6 @@ func deleteServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") @@ -175,7 +167,6 @@ func deleteServerlessInstanceBuilder() *cobra.Command { type getServerlessInstanceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string name string @@ -220,8 +211,6 @@ func getServerlessInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") @@ -230,7 +219,6 @@ func getServerlessInstanceBuilder() *cobra.Command { type listServerlessInstancesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -281,8 +269,6 @@ func listServerlessInstancesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -290,7 +276,6 @@ func listServerlessInstancesBuilder() *cobra.Command { type updateServerlessInstanceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string name string @@ -370,8 +355,6 @@ func updateServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index 47953d6726..1feeadec8c 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createServerlessPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string instanceName string @@ -114,8 +111,6 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") @@ -124,7 +119,6 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { type deleteServerlessPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string instanceName string @@ -172,8 +166,6 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") @@ -183,7 +175,6 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { type getServerlessPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string instanceName string @@ -231,8 +222,6 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") @@ -242,7 +231,6 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { type listServerlessPrivateEndpointsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string instanceName string @@ -287,8 +275,6 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") @@ -297,7 +283,6 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { type updateServerlessPrivateEndpointOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string instanceName string @@ -380,8 +365,6 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index 36e5854aab..49a30ba9ab 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createSharedClusterBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient clusterName string groupId string @@ -114,8 +111,6 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -124,7 +119,6 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { type getSharedClusterBackupRestoreJobOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient clusterName string groupId string @@ -172,8 +166,6 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -183,7 +175,6 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { type listSharedClusterBackupRestoreJobsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient clusterName string groupId string @@ -228,8 +219,6 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index 515f7cf48d..7ad0a01493 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type downloadSharedClusterBackupOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient clusterName string groupId string @@ -114,8 +111,6 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") @@ -124,7 +119,6 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { type getSharedClusterBackupOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -172,8 +166,6 @@ func getSharedClusterBackupBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") @@ -183,7 +175,6 @@ func getSharedClusterBackupBuilder() *cobra.Command { type listSharedClusterBackupsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string clusterName string @@ -228,8 +219,6 @@ func listSharedClusterBackupsBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index f212c0d2e7..7a72fbe19d 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createStreamConnectionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -114,8 +111,6 @@ func createStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -124,7 +119,6 @@ func createStreamConnectionBuilder() *cobra.Command { type createStreamInstanceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -201,8 +195,6 @@ func createStreamInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -210,7 +202,6 @@ func createStreamInstanceBuilder() *cobra.Command { type deleteStreamConnectionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -258,8 +249,6 @@ func deleteStreamConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -269,7 +258,6 @@ func deleteStreamConnectionBuilder() *cobra.Command { type deleteStreamInstanceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -314,8 +302,6 @@ func deleteStreamInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to delete.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -324,7 +310,6 @@ func deleteStreamInstanceBuilder() *cobra.Command { type getStreamConnectionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -372,8 +357,6 @@ func getStreamConnectionBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -383,7 +366,6 @@ func getStreamConnectionBuilder() *cobra.Command { type getStreamInstanceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -431,8 +413,6 @@ func getStreamInstanceBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().BoolVar(&opts.includeConnections, "includeConnections", false, `Flag to indicate whether connections information should be included in the stream instance.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -441,7 +421,6 @@ func getStreamInstanceBuilder() *cobra.Command { type listStreamConnectionsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -492,8 +471,6 @@ func listStreamConnectionsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -502,7 +479,6 @@ func listStreamConnectionsBuilder() *cobra.Command { type listStreamInstancesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string itemsPerPage int @@ -550,8 +526,6 @@ func listStreamInstancesBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -559,7 +533,6 @@ func listStreamInstancesBuilder() *cobra.Command { type updateStreamConnectionOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -642,8 +615,6 @@ func updateStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") @@ -653,7 +624,6 @@ func updateStreamConnectionBuilder() *cobra.Command { type updateStreamInstanceOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string tenantName string @@ -733,8 +703,6 @@ func updateStreamInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index d4c36e962f..c7a73705c2 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type addAllTeamsToProjectOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string @@ -111,8 +108,6 @@ func addAllTeamsToProjectBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -120,7 +115,6 @@ func addAllTeamsToProjectBuilder() *cobra.Command { type addTeamUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string teamId string @@ -198,8 +192,6 @@ func addTeamUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -208,7 +200,6 @@ func addTeamUserBuilder() *cobra.Command { type createTeamOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string @@ -283,8 +274,6 @@ func createTeamBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -292,7 +281,6 @@ func createTeamBuilder() *cobra.Command { type deleteTeamOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string teamId string @@ -335,8 +323,6 @@ func deleteTeamBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to delete.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -345,7 +331,6 @@ func deleteTeamBuilder() *cobra.Command { type getTeamByIdOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string teamId string @@ -388,8 +373,6 @@ func getTeamByIdBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose information you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -398,7 +381,6 @@ func getTeamByIdBuilder() *cobra.Command { type getTeamByNameOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string teamName string @@ -441,8 +423,6 @@ func getTeamByNameBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamName, "teamName", "", `Name of the team whose information you want to return.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamName") @@ -451,7 +431,6 @@ func getTeamByNameBuilder() *cobra.Command { type listOrganizationTeamsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string itemsPerPage int @@ -500,8 +479,6 @@ func listOrganizationTeamsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -509,7 +486,6 @@ func listOrganizationTeamsBuilder() *cobra.Command { type listProjectTeamsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -560,8 +536,6 @@ func listProjectTeamsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -569,7 +543,6 @@ func listProjectTeamsBuilder() *cobra.Command { type listTeamUsersOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string teamId string @@ -618,8 +591,6 @@ func listTeamUsersBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -628,7 +599,6 @@ func listTeamUsersBuilder() *cobra.Command { type removeProjectTeamOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string teamId string @@ -673,8 +643,6 @@ func removeProjectTeamBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") @@ -683,7 +651,6 @@ func removeProjectTeamBuilder() *cobra.Command { type removeTeamUserOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string teamId string @@ -729,8 +696,6 @@ func removeTeamUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -740,7 +705,6 @@ func removeTeamUserBuilder() *cobra.Command { type renameTeamOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient orgId string teamId string @@ -818,8 +782,6 @@ func renameTeamBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to rename.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") @@ -828,7 +790,6 @@ func renameTeamBuilder() *cobra.Command { type updateTeamRolesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string teamId string @@ -908,8 +869,6 @@ func updateTeamRolesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 8c2daa3e97..b7144f218b 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createThirdPartyIntegrationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient integrationType string groupId string @@ -124,8 +121,6 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") @@ -134,7 +129,6 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { type deleteThirdPartyIntegrationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient integrationType string groupId string @@ -179,8 +173,6 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") @@ -189,7 +181,6 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { type getThirdPartyIntegrationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string integrationType string @@ -234,8 +225,6 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("integrationType") @@ -244,7 +233,6 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { type listThirdPartyIntegrationsOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string includeCount bool @@ -295,8 +283,6 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -304,7 +290,6 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { type updateThirdPartyIntegrationOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient integrationType string groupId string @@ -394,8 +379,6 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index ddf8984d49..f103ee4b85 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -24,9 +24,7 @@ import ( "os" "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/flag" "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" - "github.com/mongodb/mongodb-atlas-cli/internal/usage" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -34,7 +32,6 @@ import ( type createDatabaseUserCertificateOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string username string @@ -114,8 +111,6 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account for whom to create a certificate.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") @@ -124,7 +119,6 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { type disableCustomerManagedX509Opts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string } @@ -166,8 +160,6 @@ func disableCustomerManagedX509Builder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -175,7 +167,6 @@ func disableCustomerManagedX509Builder() *cobra.Command { type listDatabaseUserCertificatesOpts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient groupId string username string @@ -229,8 +220,6 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index cd0e72d850..f177440f56 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -18,7 +18,6 @@ import ( {{#operation}} type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { cli.GlobalOpts - cli.OutputOpts client *admin.APIClient {{#allParams}} {{^isBodyParam}}{{paramName}} {{{dataType}}}{{/isBodyParam}} @@ -107,8 +106,6 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C {{#bodyParam}} cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") {{/bodyParam}} - cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) - _ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag()) {{#allParams}}{{^isBodyParam}}{{#required}} _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/isBodyParam}}{{/allParams}} return cmd From 7992bc46295bf5f52bc912b0155c85b7bef82e98 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 28 Sep 2023 18:55:25 +0100 Subject: [PATCH 27/44] demonstrate changes in openapi --- internal/cli/root/atlas/builder_test.go | 2 +- .../config/atlas-api-changes.yaml | 4 + .../config/atlas-api-transformed.yaml | 31341 ++++++++++++++++ tools/openapi-generator/config/atlas-api.yaml | 28877 ++++++++++++++ tools/openapi-generator/config/config.yaml | 2 +- tools/openapi-generator/merge.js | 56 + tools/openapi-generator/package-lock.json | 32 +- tools/openapi-generator/package.json | 7 +- 8 files changed, 60316 insertions(+), 5 deletions(-) create mode 100644 tools/openapi-generator/config/atlas-api-changes.yaml create mode 100644 tools/openapi-generator/config/atlas-api-transformed.yaml create mode 100644 tools/openapi-generator/config/atlas-api.yaml create mode 100644 tools/openapi-generator/merge.js diff --git a/internal/cli/root/atlas/builder_test.go b/internal/cli/root/atlas/builder_test.go index ea5637d6ef..af846103ae 100644 --- a/internal/cli/root/atlas/builder_test.go +++ b/internal/cli/root/atlas/builder_test.go @@ -35,7 +35,7 @@ func TestBuilder(t *testing.T) { test.CmdValidator( t, Builder(), - 40, + 41, []string{}, ) } diff --git a/tools/openapi-generator/config/atlas-api-changes.yaml b/tools/openapi-generator/config/atlas-api-changes.yaml new file mode 100644 index 0000000000..4a44c2cb0f --- /dev/null +++ b/tools/openapi-generator/config/atlas-api-changes.yaml @@ -0,0 +1,4 @@ +paths: + "/api/atlas/v2/groups/{groupId}/clusters": + post: + description: TEST DESCRIPTION diff --git a/tools/openapi-generator/config/atlas-api-transformed.yaml b/tools/openapi-generator/config/atlas-api-transformed.yaml new file mode 100644 index 0000000000..dd2d78dc1a --- /dev/null +++ b/tools/openapi-generator/config/atlas-api-transformed.yaml @@ -0,0 +1,31341 @@ +openapi: 3.0.1 +info: + description: >- + The MongoDB Atlas Administration API allows developers to manage all + components in MongoDB Atlas. + + + The Atlas Administration API uses HTTP Digest Authentication to authenticate + requests. Provide a programmatic API public key and corresponding private + key as the username and password when constructing the HTTP request. For + example, to [return database access + history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with + [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the + terminal: + + + ``` + + curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" \ + --digest \ + --header "Accept: application/vnd.atlas.2023-02-01+json" \ + GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true" + ``` + + + To learn more, see [Get Started with the Atlas Administration + API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, + see [MongoDB Support](https://www.mongodb.com/support/get-started). + license: + name: CC BY-NC-SA 3.0 US + url: https://creativecommons.org/licenses/by-nc-sa/3.0/us/ + termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions + title: MongoDB Atlas Administration API + version: 2.0~6e54278ed8 + x-xgen-sha: 6e54278ed80f8e54655f8d970425d6ee8247ae30 +servers: + - url: https://cloud.mongodb.com +tags: + - description: >- + Returns access logs for authentication attempts made to Atlas database + deployments. To view database access history, you must have either the + Project Owner or Organization Owner role. + name: Access Tracking + - description: >- + Returns and edits the conditions that trigger alerts and how MongoDB Cloud + notifies users. This collection remains under revision and may change. + name: Alert Configurations + - description: >- + Returns and acknowledges alerts that MongoDB Cloud triggers based on the + alert conditions that you define. This collection remains under revision + and may change. + name: Alerts + - description: >- + Returns, adds, edits, and removes Atlas Search indexes for the specified + cluster. Also returns and updates user-defined analyzers for the specified + cluster. + name: Atlas Search + - description: Returns and edits database auditing settings for MongoDB Cloud projects. + name: Auditing + - description: >- + Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and + schedules. This resource applies only to clusters that use Cloud Backups. + name: Cloud Backups + - description: >- + Manages the Cloud Migration Service. Source organizations, projects, and + MongoDB clusters reside on Cloud Manager or Ops Manager. Destination + organizations, projects, and MongoDB clusters reside on MongoDB Cloud. + Source databases can't use any authentication except SCRAM-SHA. + name: Cloud Migration Service + - description: Returns, adds, authorizes, and removes AWS IAM roles in Atlas. + name: Cloud Provider Access + - description: Returns, starts, or ends a cluster outage simulation. + name: Cluster Outage Simulation + - description: >- + Returns, adds, edits, and removes database deployments. Changes to cluster + configurations can affect costs. This resource requires your Project ID. + name: Clusters + - description: >- + Returns and edits custom DNS configurations for MongoDB Cloud database + deployments on AWS. The resource requires your Project ID. If you use the + VPC peering on AWS and you use your own DNS servers instead of Amazon + Route 53, enable custom DNS. Before 31 March 2020, applications deployed + within AWS using custom DNS services and VPC-peered with MongoDB Cloud + couldn't connect over private IP addresses. Custom DNS resolved to public + IP addresses. AWS internal DNS resolved to private IP addresses. + Applications deployed with custom DNS services in AWS should use Private + IP for Peering connection strings. + name: AWS Clusters DNS + - description: >- + Returns, adds, edits, and removes custom database user privilege roles. + Use custom roles to specify custom sets of actions that the MongoDB Cloud + built-in roles can't describe. You define custom roles at the project + level, for all clusters in the project. This resource supports a subset of + MongoDB privilege actions. You can create a subset of custom role actions. + To create a wider list of custom role actions, use the MongoDB Cloud user + interface. Custom roles must include actions that all project's clusters + support, and that are compatible with each MongoDB version that your + project's clusters use. For example, if your project has MongoDB 4.2 + clusters, you can't create custom roles that use actions introduced in + MongoDB 4.4. + name: Custom Database Roles + - description: Returns, adds, edits, and removes database users. + name: Database Users + - description: >- + Returns, adds, edits, and removes Federated Database Instances. This + resource requires your project ID. Changes to federated database instance + configurations can affect costs. + name: Data Federation + - description: >- + Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated + runs. + name: Data Lake Pipelines + - description: >- + Returns and edits the Encryption at Rest using Customer Key Management + configuration. MongoDB Cloud encrypts all storage whether or not you use + your own key management. + name: Encryption at Rest using Customer Key Management + - description: Returns events. This collection remains under revision and may change. + name: Events + - description: >- + Returns, adds, edits, and removes federation-related features such as role + mappings and connected organization configurations. + name: Federated Authentication + - description: >- + Returns, adds, and removes Global Cluster managed namespaces and custom + zone mappings. Each collection in a Global Cluster is associated with a + managed namespace. When you create a managed namespace for a Global + Cluster, MongoDB Cloud creates an empty collection for that namespace. + Creating a managed namespace doesn't populate a collection with data. + Similarly, deleting a managed namespace doesn't delete the associated + collection. + + MongoDB Cloud shards the empty collection using the required location + field and a custom shard key. For example, if your custom shard key is + `city`, the compound shard key is `location, city`. Each Global Cluster is + also associated with one or more Global Writes Zones. When a user creates + a Global Cluster, MongoDB Cloud automatically maps each location code to + the closest geographical zone. Custom zone mappings allow administrators + to override these automatic mappings. For example, a use case might + require mapping a location code to a geographically distant zone. + Administrators can manage custom zone mappings with the APIs below and the + **Global Cluster Configuration** pane when you create or modify your + Global Cluster. + name: Global Clusters + - description: Returns invoices. + name: Invoices + - description: >- + Returns, edits, verifies, and removes LDAP configurations. An LDAP + configuration defines settings for MongoDB Cloud to connect to your LDAP + server over TLS for user authentication and authorization. Your LDAP + server must be visible to the internet or connected to your MongoDB Cloud + cluster with VPC Peering. Also, your LDAP server must use TLS. You must + have the MongoDB Cloud admin user privilege to use these endpoints. Also, + to configure user authentication and authorization with LDAPS, your + cluster must run MongoDB 3.6 or higher. Groups for which you have + configured LDAPS can't create a cluster using a version of MongoDB 3.6 or + lower. + name: LDAP Configuration + - description: Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints. + name: Legacy Backup + - description: >- + Returns, edits, and removes maintenance windows. The maintenance procedure + that MongoDB Cloud performs requires at least one replica set election + during the maintenance window per replica set. You can defer a scheduled + maintenance event for a project up to two times. Deferred maintenance + events occur during your preferred maintenance window exactly one week + after the previously scheduled date and time. + name: Maintenance Windows + - description: Returns, adds, and edits MongoDB Cloud users. + name: MongoDB Cloud Users + - description: Returns database deployment monitoring and logging data. + name: Monitoring and Logs + - description: >- + Returns, adds, edits, and removes network peering containers and peering + connections. + + When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the + selected provider and region or regions if no existing VPC or VPC peering + connection exists for that provider and region. Atlas assigns the VPC a + Classless Inter-Domain Routing (CIDR) block. + name: Network Peering + - description: Returns, adds, edits, or removes an online archive. + name: Online Archive + - description: Returns, adds, and edits organizational units in MongoDB Cloud. + name: Organizations + - description: >- + Returns suggested indexes and slow query data for a database deployment. + Also enables or disables MongoDB Cloud-managed slow operation thresholds. + To view field values in a sample query, you must have the Project Data + Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted + data rather than the field values. + name: Performance Advisor + - description: Returns, adds, edits, and removes private endpoint services. + name: Private Endpoint Services + - description: >- + Returns, adds, edits, and removes access tokens to use the MongoDB Cloud + API. MongoDB Cloud applies these keys to organizations. These resources + can return, assign, or revoke use of these keys within a specified + project. + name: Programmatic API Keys + - description: >- + Returns, adds, edits, and removes network access limits to database + deployments in Atlas. This resource replaces the whitelist resource. Atlas + removed whitelists in July 2021. Update your applications to use this new + resource. This resource manages a project's IP Access List and supports + creating temporary Access List entries that automatically expire within a + user-configurable 7-day period. + name: Project IP Access List + - description: >- + Returns, adds, and edits collections of clusters and users in MongoDB + Cloud. + name: Projects + - description: >- + Creates one index to a database deployment in a rolling manner. You can't + create a rolling index on an `M0` free cluster or `M2/M5` shared cluster. + name: Rolling Index + - description: >- + Returns details that describe the MongoDB Cloud build and the access token + that requests this resource. This starts the MongoDB Cloud API. + name: Root + - description: Returns, adds, edits, and removes serverless instances. + name: Serverless Instances + - description: >- + Returns, adds, edits, and removes private endpoints for serverless + instances. To learn more, see the Atlas Administration API tab on the + following tutorial. + externalDocs: + description: Set Up a Private Endpoint for a Serverless Instance Tutorial + url: https://dochub.mongodb.org/core/serverless-private-endpoint + name: Serverless Private Endpoints + - description: Returns and adds restore jobs for shared-tier database deployments. + name: Shared-Tier Restore Jobs + - description: >- + Returns and requests to download shared-tier database deployment + snapshots. + name: Shared-Tier Snapshots + - description: >- + Returns, adds, edits, and removes Streams Instances. This resource + requires your project ID. + name: Streams + - description: Returns, adds, edits, or removes teams. + name: Teams + - description: >- + Returns, adds, edits, and removes third-party service integration + configurations. MongoDB Cloud sends alerts to each third-party service + that you configure. + + + **IMPORTANT**: Each project can only have one configuration per + integrationType. + name: Third-Party Integrations + - description: >- + Returns, edits, and removes user-managed X.509 configurations. Also + returns and generates MongoDB Cloud-managed X.509 certificates for + database users. The following resources help manage database users who + authenticate using X.509 certificates. You can manage these X.509 + certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages + your certificates, it also manages your Certificate Authority and can + generate certificates for your database users. No additional X.509 + configuration is required. If you manage your certificates, you must + provide a Certificate Authority and generate certificates for your + database users. + externalDocs: + description: Self-Managed X.509 Certificates + url: https://www.mongodb.com/docs/atlas/security-self-managed-x509/ + name: X.509 Authentication +paths: + /api/atlas/v2: + get: + description: >- + This resource returns information about the MongoDB application along + with API key meta data. + operationId: getSystemStatus + parameters: [] + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/SystemStatus' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + summary: Return the status of this MongoDB application + tags: + - Root + x-xgen-experimental: true + /api/atlas/v2/alertConfigs/matchers/fieldNames: + get: + description: >- + Get all field names that the `matchers.fieldName` parameter accepts when + you create or update an Alert Configuration. You can successfully call + this endpoint with any assigned role. + operationId: listAlertConfigurationMatchersFieldNames + parameters: [] + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/MatcherField' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Get All Alert Configuration Matchers Field Names + tags: + - Alert Configurations + /api/atlas/v2/clusters: + get: + description: >- + Returns the details for all clusters in all projects to which you have + access. Clusters contain a group of hosts that maintain the same data + set. The response does not include multi-cloud clusters. To use this + resource, the requesting API Key can have any cluster-level role. + operationId: listClustersForAllProjects + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedOrgGroup' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Authorized Clusters in All Projects + tags: + - Clusters + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}: + delete: + description: >- + Deletes the federation settings instance and all associated data, + including identity providers and domains. To use this resource, the + requesting API Key must have the Organization Owner role in the last + remaining connected organization. **Note**: requests to this resource + will fail if there is more than one connected organization in the + federation. + operationId: deleteFederationApp + parameters: + - $ref: '#/components/parameters/federationSettingsId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: No Content + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Delete the federation settings instance. + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs: + get: + description: >- + Returns all connected org configs in the specified federation. To use + this resource, the requesting API Key must have the Organization Owner + role in one of the connected orgs. + operationId: listConnectedOrgConfigs + parameters: + - $ref: '#/components/parameters/federationSettingsId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/ConnectedOrgConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + summary: Return All Connected Org Configs from the Federation + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}: + delete: + description: >- + Removes one connected organization configuration from the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role. Note: This request fails if only one connected + organization exists in the federation. + operationId: removeConnectedOrgConfig + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - description: >- + Unique 24-hexadecimal digit string that identifies the connected + organization configuration to remove. + in: path + name: orgId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Org Config Connected to One Federation + tags: + - Federated Authentication + x-xgen-experimental: true + get: + description: >- + Returns the specified connected org config from the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role in the connected org. + operationId: getConnectedOrgConfig + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - description: >- + Unique 24-hexadecimal digit string that identifies the connected + organization configuration to return. + in: path + name: orgId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ConnectedOrgConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Org Config Connected to One Federation + tags: + - Federated Authentication + x-xgen-experimental: true + patch: + description: >- + Updates one connected organization configuration from the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role. + + + **Note** If the organization configuration has no associated identity + provider, you can't use this resource to update role mappings or post + authorization role grants. + + + **Note**: The domainRestrictionEnabled field defaults to false if not + provided in the request. + + + **Note**: If the identityProviderId field is not provided, you will + disconnect the organization and the identity provider. + operationId: updateConnectedOrgConfig + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - description: >- + Unique 24-hexadecimal digit string that identifies the connected + organization configuration to update. + in: path + name: orgId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ConnectedOrgConfig' + description: The connected organization configuration that you want to update. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ConnectedOrgConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Org Config Connected to One Federation + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings: + get: + description: >- + Returns all role mappings from the specified organization in the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. + operationId: listRoleMappings + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - $ref: '#/components/parameters/orgId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/AuthFederationRoleMapping' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Role Mappings from One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + post: + description: >- + Adds one role mapping to the specified organization in the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role. + operationId: createRoleMapping + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AuthFederationRoleMapping' + description: The role mapping that you want to create. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AuthFederationRoleMapping' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Add One Role Mapping to One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}: + delete: + description: >- + Removes one role mapping in the specified organization from the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. + operationId: deleteRoleMapping + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - description: >- + Unique 24-hexadecimal digit string that identifies the role mapping + that you want to remove. + in: path + name: id + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - $ref: '#/components/parameters/orgId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: No Content + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Role Mapping from One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + get: + description: >- + Returns one role mapping from the specified organization in the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. + operationId: getRoleMapping + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - description: >- + Unique 24-hexadecimal digit string that identifies the role mapping + that you want to return. + in: path + name: id + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - $ref: '#/components/parameters/orgId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AuthFederationRoleMapping' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Role Mapping from One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + put: + description: >- + Updates one role mapping in the specified organization in the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role. + operationId: updateRoleMapping + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - description: >- + Unique 24-hexadecimal digit string that identifies the role mapping + that you want to update. + in: path + name: id + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AuthFederationRoleMapping' + description: The role mapping that you want to update. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AuthFederationRoleMapping' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Role Mapping in One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders: + get: + description: >- + Returns all identity providers in the specified federation. To use this + resource, the requesting API Key must have the Organization Owner role + in one of the connected organizations. + operationId: listIdentityProviders + parameters: + - $ref: '#/components/parameters/federationSettingsId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/FederationIdentityProvider' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return all identity providers from the specified federation. + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}: + get: + description: >- + Returns one identity provider from the specified federation. To use this + resource, the requesting API Key must have the Organization Owner role + in one of the connected organizations. + operationId: getIdentityProvider + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - $ref: '#/components/parameters/identityProviderId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/FederationIdentityProvider' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return one identity provider from the specified federation. + tags: + - Federated Authentication + x-xgen-experimental: true + patch: + description: >- + Updates one identity provider in the specified federation. To use this + resource, the requesting API Key must have the Organization Owner role + in one of the connected organizations. + operationId: updateIdentityProvider + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - $ref: '#/components/parameters/identityProviderId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/SamlIdentityProviderUpdate' + description: The identity provider that you want to update. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/FederationIdentityProvider' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update the identity provider. + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}/metadata.xml: + get: + description: >- + Returns the metadata of one identity provider in the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role in one of the connected organizations. + operationId: getIdentityProviderMetadata + parameters: + - $ref: '#/components/parameters/federationSettingsId' + - $ref: '#/components/parameters/identityProviderId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: string + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Return the metadata of one identity provider in the specified + federation. + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/groups: + get: + description: >- + Returns details about all projects. Projects group clusters into logical + collections that support an application environment, workload, or both. + Each project can have its own users, teams, security, and alert + settings. To use this resource, the requesting API Key must have the + Read Write role. + operationId: listProjects + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedAtlasGroup' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + summary: Return All Projects + tags: + - Projects + post: + description: >- + Creates one project. Projects group clusters into logical collections + that support an application environment, workload, or both. Each project + can have its own users, teams, security, and alert settings. To use this + resource, the requesting API Key must have the Read Write role. + operationId: createProject + parameters: + - description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + user to whom to grant the Project Owner role on the specified + project. If you set this parameter, it overrides the default value + of the oldest Organization Owner. + in: query + name: projectOwnerId + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Group' + description: Creates one project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Group' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Project + tags: + - Projects + /api/atlas/v2/groups/byName/{groupName}: + get: + description: >- + Returns details about the specified project. Projects group clusters + into logical collections that support an application environment, + workload, or both. Each project can have its own users, teams, security, + and alert settings. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: getProjectByName + parameters: + - description: Human-readable label that identifies this project. + in: path + name: groupName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Group' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + summary: Return One Project using Its Name + tags: + - Projects + /api/atlas/v2/groups/{groupId}: + delete: + description: >- + Removes the specified project. Projects group clusters into logical + collections that support an application environment, workload, or both. + Each project can have its own users, teams, security, and alert + settings. You can delete a project only if there are no Online Archives + for the clusters in the project. To use this resource, the requesting + API Key must have the Project Owner role. + operationId: deleteProject + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Project + tags: + - Projects + get: + description: >- + Returns details about the specified project. Projects group clusters + into logical collections that support an application environment, + workload, or both. Each project can have its own users, teams, security, + and alert settings. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: getProject + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Group' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Project + tags: + - Projects + patch: + description: >- + Updates the human-readable label that identifies the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: updateProject + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupName' + description: Project to update. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Group' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Project Name + tags: + - Projects + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/accessList: + get: + description: >- + Returns all access list entries from the specified project's IP access + list. Each entry in the project's IP access list contains either one IP + address or one CIDR-notated block of IP addresses. MongoDB Cloud only + allows client connections to the cluster from entries in the project's + IP access list. To use this resource, the requesting API Key must have + the Project Read Only or Project Charts Admin roles. This resource + replaces the whitelist resource. MongoDB Cloud removed whitelists in + July 2021. Update your applications to use this new resource. The + `/groups/{GROUP-ID}/accessList` endpoint manages the database IP access + list. This endpoint is distinct from the + `orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist` endpoint, which manages + the access list for MongoDB Cloud organizations. + externalDocs: + description: IP access list + url: >- + https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + operationId: listProjectIpAccessLists + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedNetworkAccess' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Project IP Access List + tags: + - Project IP Access List + post: + description: >- + Adds one or more access list entries to the specified project. MongoDB + Cloud only allows client connections to the cluster from entries in the + project's IP access list. Write each entry as either one IP address or + one CIDR-notated block of IP addresses. To use this resource, the + requesting API Key must have the Project Owner or Project Charts Admin + roles. This resource replaces the whitelist resource. MongoDB Cloud + removed whitelists in July 2021. Update your applications to use this + new resource. The `/groups/{GROUP-ID}/accessList` endpoint manages the + database IP access list. This endpoint is distinct from the + `orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist` endpoint, which manages + the access list for MongoDB Cloud organizations. This endpoint doesn't + support concurrent `POST` requests. You must submit multiple `POST` + requests synchronously. + externalDocs: + description: IP access list + url: >- + https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + operationId: createProjectIpAccessList + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/NetworkPermissionEntry' + description: One or more access list entries to add to the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedNetworkAccess' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Add Entries to Project IP Access List + tags: + - Project IP Access List + /api/atlas/v2/groups/{groupId}/accessList/{entryValue}: + delete: + description: >- + Removes one access list entry from the specified project's IP access + list. Each entry in the project's IP access list contains one IP + address, one CIDR-notated block of IP addresses, or one AWS Security + Group ID. MongoDB Cloud only allows client connections to the cluster + from entries in the project's IP access list. To use this resource, the + requesting API Key must have the Project Owner role. This resource + replaces the whitelist resource. MongoDB Cloud removed whitelists in + July 2021. Update your applications to use this new resource. The + `/groups/{GROUP-ID}/accessList` endpoint manages the database IP access + list. This endpoint is distinct from the + `orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist` endpoint, which manages + the access list for MongoDB Cloud organizations. + externalDocs: + description: IP access list + url: >- + https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + operationId: deleteProjectIpAccessList + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Access list entry that you want to remove from the project's IP + access list. This value can use one of the following: one AWS + security group ID, one IP address, or one CIDR block of addresses. + For CIDR blocks that use a subnet mask, replace the forward slash + (`/`) with its URL-encoded value (`%2F`). When you remove an entry + from the IP access list, existing connections from the removed + address or addresses may remain open for a variable amount of time. + The amount of time it takes MongoDB Cloud to close the connection + depends upon several factors, including: + + + - how your application established the connection, + + - how MongoDB Cloud or the driver using the address behaves, and + + - which protocol (like TCP or UDP) the connection uses. + in: path + name: entryValue + required: true + schema: + type: string + example: >- + IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 + or IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or + AWS SG: sg-903004f8 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Entry from One Project IP Access List + tags: + - Project IP Access List + get: + description: >- + Returns one access list entry from the specified project's IP access + list. Each entry in the project's IP access list contains either one IP + address or one CIDR-notated block of IP addresses. MongoDB Cloud only + allows client connections to the cluster from entries in the project's + IP access list. To use this resource, the requesting API Key must have + the Project Read Only or Project Charts Admin roles. This resource + replaces the whitelist resource. MongoDB Cloud removed whitelists in + July 2021. Update your applications to use this new resource. This + endpoint (`/groups/{GROUP-ID}/accessList`) manages the Project IP Access + List. It doesn't manage the access list for MongoDB Cloud organizations. + TheProgrammatic API Keys endpoint + (`/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist`) manages those access + lists. + externalDocs: + description: IP access list + url: >- + https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + operationId: getProjectIpList + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Access list entry that you want to return from the project's IP + access list. This value can use one of the following: one AWS + security group ID, one IP address, or one CIDR block of addresses. + For CIDR blocks that use a subnet mask, replace the forward slash + (`/`) with its URL-encoded value (`%2F`). + in: path + name: entryValue + required: true + schema: + type: string + example: >- + IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 + or IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or + AWS SG: sg-903004f8 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NetworkPermissionEntry' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Project IP Access List Entry + tags: + - Project IP Access List + /api/atlas/v2/groups/{groupId}/accessList/{entryValue}/status: + get: + description: >- + Returns the status of one project IP access list entry. This resource + checks if the provided project IP access list entry applies to all cloud + providers serving clusters from the specified project. + operationId: getProjectIpAccessListStatus + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Network address or cloud provider security construct that identifies + which project access list entry to be verified. + in: path + name: entryValue + required: true + schema: + type: string + example: >- + IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 + or IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or + AWS SG: sg-903004f8 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NetworkPermissionEntryStatus' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Status of One Project IP Access List Entry + tags: + - Project IP Access List + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/alertConfigs: + get: + description: >- + Returns all alert configurations for one project. These alert + configurations apply to any component in the project. Alert + configurations define the triggers and notification methods for alerts. + To use this resource, the requesting API Key must have the Project Read + Only role. + + + This resource remains under revision and may change. + operationId: listAlertConfigurations + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedAlertConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Alert Configurations for One Project + tags: + - Alert Configurations + post: + description: >- + Creates one alert configuration for the specified project. Alert + configurations define the triggers and notification methods for alerts. + To use this resource, the requesting API Key must have the Organization + Owner or Project Owner role. + + + This resource remains under revision and may change. + operationId: createAlertConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupAlertsConfig' + description: Creates one alert configuration for the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupAlertsConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Alert Configuration in One Project + tags: + - Alert Configurations + /api/atlas/v2/groups/{groupId}/alertConfigs/{alertConfigId}: + delete: + description: >- + Removes one alert configuration from the specified project. To use this + resource, the requesting API Key must have the Organization Owner or + Project Owner role. + + + This resource remains under revision and may change. + operationId: deleteAlertConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: No Content + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Alert Configuration from One Project + tags: + - Alert Configurations + get: + description: >- + Returns the specified alert configuration from the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. + + + This resource remains under revision and may change. + operationId: getAlertConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupAlertsConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Alert Configuration from One Project + tags: + - Alert Configurations + x-xgen-experimental: true + patch: + description: >- + Enables or disables the specified alert configuration in the specified + project. The resource enables the specified alert configuration if + currently enabled. The resource disables the specified alert + configuration if currently disabled. To use this resource, the + requesting API Key must have the Organization Owner or Project Owner + role. + + + **NOTE**: This endpoint updates only the enabled/disabled state for the + alert configuration. To update more than just this configuration, see + [Update One Alert + Configuration](#tag/Alert-Configurations/operation/updateAlertConfiguration). + + + This resource remains under revision and may change. + operationId: toggleAlertConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration that triggered this alert. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AlertsToggle' + description: >- + Enables or disables the specified alert configuration in the specified + project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupAlertsConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Toggle One State of One Alert Configuration in One Project + tags: + - Alert Configurations + put: + description: >- + Updates one alert configuration in the specified project. Alert + configurations define the triggers and notification methods for alerts. + To use this resource, the requesting API Key must have the Organization + Owner or Project Owner role. + + + **NOTE**: To enable or disable the alert configuration, see [Toggle One + State of One Alert Configuration in One + Project](#tag/Alert-Configurations/operation/toggleAlertConfiguration). + + + This resource remains under revision and may change. + operationId: updateAlertConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupAlertsConfig' + description: Updates one alert configuration in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupAlertsConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Alert Configuration for One Project + tags: + - Alert Configurations + /api/atlas/v2/groups/{groupId}/alertConfigs/{alertConfigId}/alerts: + get: + description: >- + Returns all open alerts that the specified alert configuration triggers. + These alert configurations apply to the specified project only. Alert + configurations define the triggers and notification methods for alerts. + Open alerts have been triggered but remain unacknowledged. To use this + resource, the requesting API Key must have the Project Read Only role. + + + This resource remains under revision and may change. + operationId: listAlertsByAlertConfigurationId + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedAlert' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Open Alerts for Alert Configuration + tags: + - Alerts + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/alerts: + get: + description: >- + Returns all alerts. These alerts apply to all components in one project. + You receive an alert when a monitored component meets or exceeds a value + you set. To use this resource, the requesting API Key must have the + Project Read Only role. + + + This resource remains under revision and may change. + operationId: listAlerts + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Status of the alerts to return. Omit to return all alerts in all + statuses. + in: query + name: status + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedAlert' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Alerts from One Project + tags: + - Alerts + /api/atlas/v2/groups/{groupId}/alerts/{alertId}: + get: + description: >- + Returns one alert. This alert applies to any component in one project. + You receive an alert when a monitored component meets or exceeds a value + you set. To use this resource, the requesting API Key must have the + Project Read Only role. + + + This resource remains under revision and may change. + operationId: getAlert + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the alert. Use + the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve + all alerts to which the authenticated user has access. + in: path + name: alertId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AlertViewForNdsGroup' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Alert from One Project + tags: + - Alerts + patch: + description: >- + Confirms receipt of one existing alert. This alert applies to any + component in one project. Acknowledging an alert prevents successive + notifications. You receive an alert when a monitored component meets or + exceeds a value you set until you acknowledge the alert. To use this + resource, the requesting API Key must have the Organization Owner or + Project Owner role. + + + This resource remains under revision and may change. + operationId: acknowledgeAlert + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the alert. Use + the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve + all alerts to which the authenticated user has access. + in: path + name: alertId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AlertViewForNdsGroup' + description: Confirm one alert. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AlertViewForNdsGroup' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Acknowledge One Alert from One Project + tags: + - Alerts + /api/atlas/v2/groups/{groupId}/alerts/{alertId}/alertConfigs: + get: + description: >- + Returns all alert configurations set for the specified alert. To use + this resource, the requesting API Key must have the Project Read Only + role. + + + This resource remains under revision and may change. + operationId: listAlertConfigurationsByAlertId + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Unique 24-hexadecimal digit string that identifies the alert. Use + the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve + all alerts to which the authenticated user has access. + in: path + name: alertId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedAlertConfig' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Alert Configurations Set for One Alert + tags: + - Alert Configurations + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/apiKeys: + get: + description: >- + Returns all organization API keys that you assigned to the specified + project. Users with the Project Owner role in the project associated + with the API key can use the organization API key to access the + resources. To use this resource, the requesting API Key must have the + Project User Admin role. + externalDocs: + description: Programmatic API Keys + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: listProjectApiKeys + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiApiUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Organization API Keys Assigned to One Project + tags: + - Programmatic API Keys + post: + description: >- + Creates and assigns the specified organization API key to the specified + project. Users with the Project Owner role in the project associated + with the API key can use the organization API key to access the + resources. To use this resource, the requesting API Key must have the + Project User Admin role. + operationId: createProjectApiKey + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CreateAtlasProjectApiKey' + description: >- + Organization API key to be created and assigned to the specified + project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiKeyUserDetails' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create and Assign One Organization API Key to One Project + tags: + - Programmatic API Keys + /api/atlas/v2/groups/{groupId}/apiKeys/{apiUserId}: + delete: + description: >- + Removes one organization API key from the specified project. To use this + resource, the requesting API Key must have the Project User Admin role. + externalDocs: + description: Programmatic API Keys + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: removeProjectApiKey + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key that you want to unassign from one project. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Unassign One Organization API Key from One Project + tags: + - Programmatic API Keys + patch: + description: >- + Updates the roles of the organization API key that you specify for the + project that you specify. You must specify at least one valid role for + the project. The application removes any roles that you do not include + in this request if they were previously set in the organization API key + that you specify for the project. + operationId: updateApiKeyRoles + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/pageNum' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/includeCount' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key that you want to unassign from one project. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UpdateAtlasProjectApiKey' + description: >- + Organization API Key to be updated. This request requires a minimum of + one of the two body parameters. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiKeyUserDetails' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Roles of One Organization API Key to One Project + tags: + - Programmatic API Keys + post: + description: >- + Assigns the specified organization API key to the specified project. + Users with the Project Owner role in the project associated with the API + key can then use the organization API key to access the resources. To + use this resource, the requesting API Key must have the Project User + Admin role. + operationId: addProjectApiKey + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key that you want to assign to one project. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/UserAccessRoleAssignment' + description: Organization API key to be assigned to the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiKeyUserDetails' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Assign One Organization API Key to One Project + tags: + - Programmatic API Keys + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/auditLog: + get: + description: >- + Returns the auditing configuration for the specified project. The + auditing configuration defines the events that MongoDB Cloud records in + the audit log. To use this resource, the requesting API Key must have + the Project Owner role. This feature isn't available for `M0`, `M2`, + `M5`, or serverless clusters. + operationId: getAuditingConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AuditLog' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return the Auditing Configuration for One Project + tags: + - Auditing + patch: + description: >- + Updates the auditing configuration for the specified project. The + auditing configuration defines the events that MongoDB Cloud records in + the audit log. To use this resource, the requesting API Key must have + the Project Owner role. This feature isn't available for `M0`, `M2`, + `M5`, or serverless clusters. + operationId: updateAuditingConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AuditLog' + description: Updated auditing configuration for the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AuditLog' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Auditing Configuration for One Project + tags: + - Auditing + /api/atlas/v2/groups/{groupId}/awsCustomDNS: + get: + description: >- + Returns the custom DNS configuration for AWS clusters in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getAWSCustomDNS + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AWSCustomDNSEnabled' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Custom DNS Configuration for Atlas Clusters on AWS + tags: + - AWS Clusters DNS + patch: + description: >- + Enables or disables the custom DNS configuration for AWS clusters in the + specified project. Enable custom DNS if you use AWS VPC peering and use + your own DNS servers. To use this resource, the requesting API Key must + have the Project Atlas Admin role. + operationId: toggleAWSCustomDNS + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AWSCustomDNSEnabled' + description: >- + Enables or disables the custom DNS configuration for AWS clusters in + the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AWSCustomDNSEnabled' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS + tags: + - AWS Clusters DNS + /api/atlas/v2/groups/{groupId}/backup/exportBuckets: + get: + description: >- + Returns all AWS S3 buckets associated with the specified project. To use + this resource, the requesting API Key must have the Project Read Only + role. + operationId: listExportBuckets + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedBackupSnapshotExportBucket' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports + tags: + - Cloud Backups + post: + description: >- + Grants MongoDB Cloud access to the specified AWS S3 bucket. This enables + this bucket to receive Atlas Cloud Backup snapshots. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: createExportBucket + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotAWSExportBucket' + description: Grants MongoDB Cloud access to the specified AWS S3 bucket. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotAWSExportBucket' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/backup/exportBuckets/{exportBucketId}: + delete: + description: >- + Revoke MongoDB Cloud access to the specified AWS S3 bucket. This + prevents this bucket to receive Atlas Cloud Backup snapshots. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: deleteExportBucket + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique string that identifies the AWS S3 bucket to which you export + your snapshots. + in: path + name: exportBucketId + required: true + schema: + type: string + maxLength: 63 + minLength: 3 + pattern: ^((?!xn--)(?!.*-s3alias)[a-z0-9][a-z0-9-]{1,61}[a-z0-9])$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports + tags: + - Cloud Backups + get: + description: >- + Returns one AWS S3 bucket associated with the specified project. To use + this resource, the requesting API Key must have the Project Read Only + role. + operationId: getExportBucket + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique string that identifies the AWS S3 bucket to which you export + your snapshots. + in: path + name: exportBucketId + required: true + schema: + type: string + maxLength: 63 + minLength: 3 + pattern: ^((?!xn--)(?!.*-s3alias)[a-z0-9][a-z0-9-]{1,61}[a-z0-9])$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotAWSExportBucket' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/backupCompliancePolicy: + get: + description: >- + Returns the Backup Compliance Policy settings with the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: getDataProtectionSettings + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataProtectionSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return the Backup Compliance Policy settings + tags: + - Cloud Backups + put: + description: >- + Updates the Backup Compliance Policy settings for the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: updateDataProtectionSettings + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataProtectionSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: The new Backup Compliance Policy settings. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataProtectionSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update or enable the Backup Compliance Policy settings + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/cloudProviderAccess: + get: + description: >- + Returns all cloud provider access roles with access to the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: listCloudProviderAccessRoles + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderAccessRoles' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Cloud Provider Access Roles + tags: + - Cloud Provider Access + post: + description: >- + Creates one access role for the specified cloud provider. Some MongoDB + Cloud features use these cloud provider access roles for authentication. + To use this resource, the requesting API Key must have the Project Owner + role. + externalDocs: + description: Set Up Access to Cloud Providers + url: https://www.mongodb.com/docs/atlas/security/cloud-provider-access/ + operationId: createCloudProviderAccessRole + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderAccessRole' + description: Creates one role for the specified cloud provider. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderAccessRole' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Cloud Provider Access Role + tags: + - Cloud Provider Access + /api/atlas/v2/groups/{groupId}/cloudProviderAccess/{cloudProvider}/{roleId}: + delete: + description: >- + Revokes access to the specified project for the specified access role. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: deauthorizeCloudProviderAccessRole + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cloud provider of the role + to deauthorize. + in: path + name: cloudProvider + required: true + schema: + type: string + - description: Unique 24-hexadecimal digit string that identifies the role. + in: path + name: roleId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: No Content + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Deauthorize One Cloud Provider Access Role + tags: + - Cloud Provider Access + /api/atlas/v2/groups/{groupId}/cloudProviderAccess/{roleId}: + get: + description: >- + Returns the access role with the specified id and with access to the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: getCloudProviderAccessRole + parameters: + - $ref: '#/components/parameters/groupId' + - description: Unique 24-hexadecimal digit string that identifies the role. + in: path + name: roleId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderAccessRole' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return specified Cloud Provider Access Role + tags: + - Cloud Provider Access + x-xgen-experimental: true + patch: + description: >- + Grants access to the specified project for the specified access role. To + use this resource, the requesting API Key must have the Project Owner + role. This API endpoint is one step in a procedure to create unified + access for MongoDB Cloud services. + externalDocs: + description: Set Up Access to Cloud Providers + url: https://www.mongodb.com/docs/atlas/security/cloud-provider-access/ + operationId: authorizeCloudProviderAccessRole + parameters: + - $ref: '#/components/parameters/groupId' + - description: Unique 24-hexadecimal digit string that identifies the role. + in: path + name: roleId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderAccessRole' + description: Grants access to the specified project for the specified access role. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderAccessRole' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Authorize One Cloud Provider Access Role + tags: + - Cloud Provider Access + /api/atlas/v2/groups/{groupId}/clusters: + get: + description: >- + Returns the details for all clusters in the specific project to which + you have access. Clusters contain a group of hosts that maintain the + same data set. The response includes multi-cloud clusters. To use this + resource, the requesting API Key must have the Project Read Only role. + This feature is not available for serverless clusters. Deprecated + versions: v2-{2023-01-01} + operationId: listClusters + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Flag that indicates whether to return Clusters with retain backups. + in: query + name: includeDeletedWithRetainedBackups + schema: + type: boolean + default: false + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/PaginatedAdvancedClusterDescription' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Clusters in One Project + tags: + - Clusters + post: + description: TEST DESCRIPTION + operationId: createCluster + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + examples: + Multi Cloud Cluster: + description: Multi Cloud Cluster + value: + clusterType: REPLICASET + links: [] + name: multiCloud + replicationSpecs: + - numShards: 1 + regionConfigs: + - analyticsAutoScaling: + autoIndexing: + enabled: false + compute: + enabled: true + maxInstanceSize: M40 + minInstanceSize: M30 + scaleDownEnabled: true + diskGB: + enabled: true + analyticsSpecs: + instanceSize: M30 + nodeCount: 0 + autoScaling: + autoIndexing: + enabled: false + compute: + enabled: true + maxInstanceSize: M40 + minInstanceSize: M30 + scaleDownEnabled: true + diskGB: + enabled: true + electableSpecs: + instanceSize: M30 + nodeCount: 3 + hiddenSecondarySpecs: + instanceSize: M30 + nodeCount: 0 + priority: 7 + providerName: AWS + readOnlySpecs: + instanceSize: M30 + nodeCount: 0 + regionName: US_EAST_1 + - analyticsAutoScaling: + autoIndexing: + enabled: false + compute: + enabled: true + maxInstanceSize: M40 + minInstanceSize: M30 + scaleDownEnabled: true + diskGB: + enabled: true + analyticsSpecs: + instanceSize: M30 + nodeCount: 0 + autoScaling: + autoIndexing: + enabled: false + compute: + enabled: true + maxInstanceSize: M40 + minInstanceSize: M30 + scaleDownEnabled: true + diskGB: + enabled: true + electableSpecs: + instanceSize: M30 + nodeCount: 2 + hiddenSecondarySpecs: + instanceSize: M30 + nodeCount: 0 + priority: 6 + providerName: GCP + readOnlySpecs: + instanceSize: M30 + nodeCount: 0 + regionName: EASTERN_US + zoneName: Zone 1 + schema: + $ref: '#/components/schemas/AdvancedClusterDescription' + description: Cluster to create in the specific project. + required: true + responses: + '201': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/AdvancedClusterDescription' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: Created + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '402': + $ref: '#/components/responses/paymentRequired' + '403': + $ref: '#/components/responses/forbidden' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Multi-Cloud Cluster from One Project + tags: + - Clusters + /api/atlas/v2/groups/{groupId}/clusters/provider/regions: + get: + description: >- + Returns the list of regions available for the specified cloud provider + at the specified tier. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: listCloudProviderRegions + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Cloud providers whose regions to retrieve. When you specify multiple + providers, the response can return only tiers and regions that + support multi-cloud clusters. + in: query + name: providers + schema: + type: array + items: + type: string + - description: Cluster tier for which to retrieve the regions. + in: query + name: tier + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiAtlasProviderRegions' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Cloud Provider Regions + tags: + - Clusters + /api/atlas/v2/groups/{groupId}/clusters/tenantUpgrade: + post: + description: >- + Upgrades a shared-tier cluster in the specified project. To use this + resource, the requesting API key must have the Project Cluster Manager + role. Each project supports up to 25 clusters. + operationId: upgradeSharedCluster + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LegacyAtlasCluster' + description: Details of the shared-tier cluster upgrade in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LegacyAtlasCluster' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '402': + $ref: '#/components/responses/paymentRequired' + '403': + $ref: '#/components/responses/forbidden' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Upgrade One Shared-tier Cluster + tags: + - Clusters + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/tenantUpgradeToServerless: + post: + description: >- + Upgrades a shared-tier cluster to a serverless instance in the specified + project. To use this resource, the requesting API key must have the + Project Cluster Manager role. + operationId: upgradeSharedClusterToServerless + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessInstanceDescription' + description: Details of the shared-tier cluster upgrade in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessInstanceDescription' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '402': + $ref: '#/components/responses/paymentRequired' + '403': + $ref: '#/components/responses/forbidden' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Upgrades One Shared-Tier Cluster to the Serverless Instance + tags: + - Clusters + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}: + delete: + description: >- + Removes one cluster with advanced features from the specified project. + The cluster must have termination protection disabled in order to be + deleted. To use this resource, the requesting API Key must have the + Project Owner role. This feature is not available for serverless + clusters. Deprecated versions: v2-{2023-01-01} + operationId: deleteCluster + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Flag that indicates whether to retain backup snapshots for the + deleted dedicated cluster. + in: query + name: retainBackups + schema: + type: boolean + responses: + '202': + content: + application/vnd.atlas.2023-02-01+json: + x-xgen-version: 2023-02-01T00:00:00.000Z + description: Accepted + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Multi-Cloud Cluster from One Project + tags: + - Clusters + get: + description: >- + Returns the details for one cluster in the specified project. Clusters + contain a group of hosts that maintain the same data set. The response + includes multi-cloud clusters. To use this resource, the requesting API + Key must have the Project Read Only role. This feature is not available + for serverless clusters. Deprecated versions: v2-{2023-01-01} + operationId: getCluster + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/AdvancedClusterDescription' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Multi-Cloud Cluster from One Project + tags: + - Clusters + patch: + description: >- + Updates the details for one cluster in the specified project. Clusters + contain a group of hosts that maintain the same data set. This resource + can update multi-cloud clusters. To update a cluster's termination + protection, the requesting API Key must have the Project Owner role. For + all other updates, the requesting API Key must have the Project Cluster + Manager role. You can't modify a paused cluster (`paused : true`). You + must call this endpoint to set `paused : false`. After this endpoint + responds with `paused : false`, you can call it again with the changes + you want to make to the cluster. This feature is not available for + serverless clusters. Deprecated versions: v2-{2023-01-01} + operationId: updateCluster + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/AdvancedClusterDescription' + description: Cluster to update in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/AdvancedClusterDescription' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Modify One Multi-Cloud Cluster from One Project + tags: + - Clusters + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/exports: + get: + description: >- + Returns all Cloud Backup snapshot export jobs associated with the + specified Atlas cluster. To use this resource, the requesting API Key + must have the Project Atlas Admin role. + operationId: listBackupExportJobs + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiAtlasDiskBackupExportJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Cloud Backup Snapshot Export Jobs + tags: + - Cloud Backups + post: + description: >- + Exports one backup snapshot for dedicated Atlas cluster using Cloud + Backups to an AWS bucket. To use this resource, the requesting API Key + must have the Project Atlas Admin role. + operationId: createBackupExportJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupExportJobRequest' + description: Information about the Cloud Backup Snapshot Export Job to create. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupExportJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Cloud Backup Snapshot Export Job + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/exports/{exportId}: + get: + description: >- + Returns one Cloud Backup snapshot export job associated with the + specified Atlas cluster. To use this resource, the requesting API Key + must have the Project Atlas Admin role. + operationId: getBackupExportJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique string that identifies the AWS S3 bucket to which you export + your snapshots. + in: path + name: exportId + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupExportJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Cloud Backup Snapshot Export Job + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/restoreJobs: + get: + description: >- + Returns all cloud backup restore jobs for one cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: listBackupRestoreJobs + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Human-readable label that identifies the cluster with the restore + jobs you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedCloudBackupRestoreJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Restore Jobs for One Cluster + tags: + - Cloud Backups + post: + description: >- + Restores one snapshot of one cluster from the specified project. Atlas + takes on-demand snapshots immediately and scheduled snapshots at regular + intervals. If an on-demand snapshot with a status of **queued** or + **inProgress** exists, before taking another snapshot, wait until Atlas + completes completes processing the previously taken on-demand snapshot. + + To use this resource, the requesting API Key must have the Project Owner role. + operationId: createBackupRestoreJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotRestoreJob' + description: Restores one snapshot of one cluster from the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotRestoreJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Restore One Snapshot of One Cluster + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/restoreJobs/{restoreJobId}: + delete: + description: >- + Cancels one cloud backup restore job of one cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: cancelBackupRestoreJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the restore job + to remove. + in: path + name: restoreJobId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '405': + $ref: '#/components/responses/methodNotAllowed' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Cancel One Restore Job of One Cluster + tags: + - Cloud Backups + x-xgen-experimental: true + get: + description: >- + Returns one cloud backup restore job for one cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: getBackupRestoreJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster with the restore + jobs you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the restore job + to return. + in: path + name: restoreJobId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotRestoreJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Restore Job of One Cluster + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/schedule: + delete: + description: >- + Removes all cloud backup schedules for the specified cluster. This + schedule defines when MongoDB Cloud takes scheduled snapshots and how + long it stores those snapshots. To use this resource, the requesting API + Key must have the Project Atlas Admin role. + operationId: deleteAllBackupSchedules + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotSchedule' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove All Cloud Backup Schedules + tags: + - Cloud Backups + get: + description: >- + Returns the cloud backup schedule for the specified cluster within the + specified project. This schedule defines when MongoDB Cloud takes + scheduled snapshots and how long it stores those snapshots. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getBackupSchedule + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotSchedule' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Cloud Backup Schedule + tags: + - Cloud Backups + patch: + description: >- + Updates the cloud backup schedule for one cluster within the specified + project. This schedule defines when MongoDB Cloud takes scheduled + snapshots and how long it stores those snapshots. To use this resource, + the requesting API Key must have the Project Owner role. + operationId: updateBackupSchedule + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotSchedule' + description: >- + Updates the cloud backup schedule for one cluster within the specified + project. + + + **Note**: In the request body, provide only the fields that you want + to update. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshotSchedule' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Cloud Backup Schedule for One Cluster + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots: + get: + description: >- + Returns all snapshots of one cluster from the specified project. To use + this resource, the requesting API Key must have the Project Read Only + role. + operationId: listReplicaSetBackups + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedCloudBackupReplicaSet' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Replica Set Cloud Backups + tags: + - Cloud Backups + post: + description: >- + Takes one on-demand snapshot for the specified cluster. Atlas takes + on-demand snapshots immediately and scheduled snapshots at regular + intervals. If an on-demand snapshot with a status of **queued** or + **inProgress** exists, before taking another snapshot, wait until Atlas + completes completes processing the previously taken on-demand snapshot. + + To use this resource, the requesting API Key must have the Project Owner role. + operationId: takeSnapshot + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupOnDemandSnapshotRequest' + description: Takes one on-demand snapshot. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Take One On-Demand Snapshot + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/shardedCluster/{snapshotId}: + delete: + description: >- + Removes one snapshot of one sharded cluster from the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: deleteShardedClusterBackup + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Sharded Cluster Cloud Backup + tags: + - Cloud Backups + x-xgen-experimental: true + get: + description: >- + Returns one snapshot of one sharded cluster from the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getShardedClusterBackup + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupShardedClusterSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Sharded Cluster Cloud Backup + tags: + - Cloud Backups + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/shardedClusters: + get: + description: >- + Returns all snapshots of one sharded cluster from the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listShardedClusterBackups + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: >- + #/components/schemas/PaginatedCloudBackupShardedClusterSnapshot + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Sharded Cluster Cloud Backups + tags: + - Cloud Backups + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/{snapshotId}: + delete: + description: >- + Removes the specified snapshot. To use this resource, the requesting API + Key must have the Project Owner role. + operationId: deleteReplicaSetBackup + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Replica Set Cloud Backup + tags: + - Cloud Backups + get: + description: >- + Returns one snapshot from the specified cluster. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: getReplicaSetBackup + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupReplicaSet' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Replica Set Cloud Backup + tags: + - Cloud Backups + patch: + description: >- + Changes the expiration date for one cloud backup snapshot for one + cluster in the specified project. + operationId: updateSnapshotRetention + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupSnapshotRetention' + description: >- + Changes the expiration date for one cloud backup snapshot for one + cluster in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DiskBackupReplicaSet' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Change Expiration Date for One Cloud Backup + tags: + - Cloud Backups + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/download: + post: + description: >- + Requests one snapshot for the specified shared cluster. This resource + returns a `snapshotURL` that you can use to download the snapshot. This + `snapshotURL` remains active for four hours after you make the request. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: downloadSharedClusterBackup + parameters: + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TenantRestore' + description: Snapshot to be downloaded. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TenantRestore' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Download One M2 or M5 Cluster Snapshot + tags: + - Shared-Tier Snapshots + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restore: + post: + description: >- + Restores the specified cluster. MongoDB Cloud limits which clusters can + be the target clusters of a restore. The target cluster can't use + encryption at rest, run a major release MongoDB version different than + the snapshot, or receive client requests during restores. MongoDB Cloud + deletes all existing data on the target cluster prior to the restore + operation. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: createSharedClusterBackupRestoreJob + parameters: + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TenantRestore' + description: The restore job details. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TenantRestore' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Restore Job from One M2 or M5 Cluster + tags: + - Shared-Tier Restore Jobs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restores: + get: + description: >- + Returns all restore jobs for the specified M2 or M5 cluster. Restore + jobs restore a cluster using a snapshot. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listSharedClusterBackupRestoreJobs + parameters: + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedTenantRestore' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Restore Jobs for One M2 or M5 Cluster + tags: + - Shared-Tier Restore Jobs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restores/{restoreId}: + get: + description: >- + Returns the specified restore job. To use this resource, the requesting + API Key must have the Project Read Only role. + operationId: getSharedClusterBackupRestoreJob + parameters: + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the restore job + to return. + in: path + name: restoreId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TenantRestore' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Restore Job for One M2 or M5 Cluster + tags: + - Shared-Tier Restore Jobs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/snapshots: + get: + description: >- + Returns details for all snapshots for the specified shared cluster. To + use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listSharedClusterBackups + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedTenantSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Snapshots for One M2 or M5 Cluster + tags: + - Shared-Tier Snapshots + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/snapshots/{snapshotId}: + get: + description: >- + Returns details for one snapshot for the specified shared cluster. To + use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getSharedClusterBackup + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupTenantSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Snapshot for One M2 or M5 Cluster + tags: + - Shared-Tier Snapshots + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backupCheckpoints: + get: + deprecated: true + description: >- + Returns all legacy backup checkpoints for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: listLegacyBackupCheckpoints + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Human-readable label that identifies the cluster that contains the + checkpoints that you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiAtlasCheckpoint' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Legacy Backup Checkpoints + tags: + - Legacy Backup + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backupCheckpoints/{checkpointId}: + get: + deprecated: true + description: >- + Returns one legacy backup checkpoint for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getLegacyBackupCheckpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: Unique 24-hexadecimal digit string that identifies the checkpoint. + in: path + name: checkpointId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + Human-readable label that identifies the cluster that contains the + checkpoints that you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiAtlasCheckpoint' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Legacy Backup Checkpoint + tags: + - Legacy Backup + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes: + post: + description: >- + Creates one Atlas Search index on the specified collection. Atlas Search + indexes define the fields on which to create the index and the analyzers + to use when creating the index. Only clusters running MongoDB v4.2 or + later can use Atlas Search. To use this resource, the requesting API Key + must have the Project Data Access Admin role. + externalDocs: + description: Atlas Search Indexes + url: >- + https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: createAtlasSearchIndex + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Name of the cluster that contains the collection on which to create + an Atlas Search index. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterSearchIndex' + description: Creates one Atlas Search index on the specified collection. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterSearchIndex' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Atlas Search Index + tags: + - Atlas Search + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{databaseName}/{collectionName}: + get: + description: >- + Returns all Atlas Search indexes on the specified collection. Atlas + Search indexes contain the indexed fields and the analyzers used to + create the indexes. To use this resource, the requesting API Key must + have the Project Data Access Read Write role. + externalDocs: + description: Atlas Search Indexes + url: >- + https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: listAtlasSearchIndexes + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Name of the cluster that contains the collection with one or more + Atlas Search indexes. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Name of the collection that contains one or more Atlas Search + indexes. + in: path + name: collectionName + required: true + schema: + type: string + - description: >- + Human-readable label that identifies the database that contains the + collection with one or more Atlas Search indexes. + in: path + name: databaseName + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/ClusterSearchIndex' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Atlas Search Indexes for One Collection + tags: + - Atlas Search + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{indexId}: + delete: + description: >- + Removes one Atlas Search index that you identified with its unique ID. + To use this resource, the requesting API Key must have the Project Data + Access Admin role. + externalDocs: + description: Atlas Search Indexes + url: >- + https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: deleteAtlasSearchIndex + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Name of the cluster that contains the database and collection with + one or more Application Search indexes. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the Atlas Search + index. Use the [Get All Atlas Search Indexes for a Collection + API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) + endpoint to find the IDs of all Atlas Search indexes. + in: path + name: indexId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Atlas Search Index + tags: + - Atlas Search + get: + description: >- + Returns one Atlas Search index in the specified project. You identify + this index using its unique ID. Atlas Search index contains the indexed + fields and the analyzers used to create the index. To use this resource, + the requesting API Key must have the Project Data Access Read Write + role. + externalDocs: + description: Atlas Search Indexes + url: >- + https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: getAtlasSearchIndex + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Name of the cluster that contains the collection with one or more + Atlas Search indexes. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the Application + Search + [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). + Use the [Get All Application Search Indexes for a Collection + API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) + endpoint to find the IDs of all Application Search indexes. + in: path + name: indexId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterSearchIndex' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Atlas Search Index + tags: + - Atlas Search + patch: + description: >- + Updates one Atlas Search index that you identified with its unique ID. + Atlas Search indexes define the fields on which to create the index and + the analyzers to use when creating the index. To use this resource, the + requesting API Key must have the Project Data Access Admin role. + externalDocs: + description: Atlas Search Indexes + url: >- + https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: updateAtlasSearchIndex + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Name of the cluster that contains the collection whose Atlas Search + index to update. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the Atlas Search + [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). + Use the [Get All Atlas Search Indexes for a Collection + API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) + endpoint to find the IDs of all Atlas Search indexes. + in: path + name: indexId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterSearchIndex' + description: Details to update on the Atlas Search index. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterSearchIndex' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Atlas Search Index + tags: + - Atlas Search + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites: + get: + description: >- + Returns one managed namespace within the specified global cluster. A + managed namespace identifies a collection using the database name, the + dot separator, and the collection name. To use this resource, the + requesting API Key must have the Project Read Only role. Deprecated + versions: v2-{2023-01-01} + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: getManagedNamespace + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/GeoSharding' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Managed Namespace in One Global Multi-Cloud Cluster + tags: + - Global Clusters + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/customZoneMapping: + delete: + description: >- + Removes all custom zone mappings for the specified global cluster. A + custom zone mapping matches one ISO 3166-2 location code to a zone in + your global cluster. Removing the custom zone mappings restores the + default mapping. By default, MongoDB Cloud maps each location code to + the closest geographical zone. To use this resource, the requesting API + Key must have the Project Owner role. Deprecated versions: + v2-{2023-01-01} + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: deleteAllCustomZoneMappings + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/GeoSharding' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster + tags: + - Global Clusters + x-xgen-experimental: true + post: + description: >- + Creates one custom zone mapping for the specified global cluster. A + custom zone mapping matches one ISO 3166-2 location code to a zone in + your global cluster. By default, MongoDB Cloud maps each location code + to the closest geographical zone. To use this resource, the requesting + API Key must have the Project Owner role. Deprecated versions: + v2-{2023-01-01} + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: createCustomZoneMapping + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/GeoSharding' + description: Custom zone mapping to add to the specified global cluster. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/GeoSharding' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Add One Entry to One Custom Zone Mapping + tags: + - Global Clusters + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/managedNamespaces: + delete: + description: >- + Removes one managed namespace within the specified global cluster. A + managed namespace identifies a collection using the database name, the + dot separator, and the collection name. Deleting a managed namespace + does not remove the associated collection or data. To use this resource, + the requesting API Key must have the Project Data Access Admin role. + Deprecated versions: v2-{2023-01-01} + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: deleteManagedNamespace + parameters: + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the database that contains the + collection. + in: query + name: db + schema: + type: string + - description: >- + Human-readable label that identifies the collection associated with + the managed namespace. + in: query + name: collection + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/GeoSharding' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Managed Namespace from One Global Multi-Cloud Cluster + tags: + - Global Clusters + x-xgen-experimental: true + post: + description: >- + Creates one managed namespace within the specified global cluster. A + managed namespace identifies a collection using the database name, the + dot separator, and the collection name. To use this resource, the + requesting API Key must have the Project Data Access Admin role. + Deprecated versions: v2-{2023-01-01} + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: createManagedNamespace + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/ManagedNamespace' + description: Managed namespace to create within the specified global cluster. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/GeoSharding' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '405': + $ref: '#/components/responses/methodNotAllowed' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Managed Namespace in One Global Multi-Cloud Cluster + tags: + - Global Clusters + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/index: + post: + description: >- + Creates an index on the cluster identified by its name in a rolling + manner. Creating the index in this way allows index builds on one + replica set member as a standalone at a time, starting with the + secondary members. Creating indexes in this way requires at least one + replica set election. To use this resource, the requesting API Key must + have the Project Data Access Admin role. + externalDocs: + description: Rolling Index Builds on Replica Sets + url: >- + https://docs.mongodb.com/manual/tutorial/build-indexes-on-replica-sets/ + operationId: createRollingIndex + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster on which MongoDB + Cloud creates an index. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DatabaseRollingIndexRequest' + description: Rolling index to create on the specified cluster. + required: true + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Rolling Index + tags: + - Rolling Index + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives: + get: + description: >- + Returns details of all online archives. This archive stores data from + one cluster within one project. To use this resource, the requesting API + Key must have the Project Read Only role. + externalDocs: + description: Online Archive + url: >- + https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: listOnlineArchives + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Human-readable label that identifies the cluster that contains the + collection for which you want to return the online archives. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedOnlineArchive' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Online Archives for One Cluster + tags: + - Online Archive + post: + description: >- + Creates one online archive. This archive stores data from one cluster + within one project. To use this resource, the requesting API Key must + have the Project Data Access Admin role. + externalDocs: + description: Online Archive + url: >- + https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: createOnlineArchive + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster that contains the + collection for which you want to create one online archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupOnlineArchiveCreate' + description: Creates one online archive. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupOnlineArchive' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Online Archive + tags: + - Online Archive + x-xgen-changelog: + Wed Aug 02 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + If 'criteria':'DATE' is specified, then you must specify 'DATE' values + in partition fields + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives/queryLogs.gz: + get: + description: >- + Downloads query logs for the specified online archive. To use this + resource, the requesting API Key must have the Project Data Access Read + Only or higher role. + externalDocs: + description: Online Archive + url: >- + https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: downloadOnlineArchiveQueryLogs + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Date and time that specifies the starting point for the range of log + messages to return. This resource expresses this value in the number + of seconds that have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + in: query + name: startDate + schema: + type: integer + format: int64 + example: 1636481348 + minimum: 1199145600 + - description: >- + Date and time that specifies the end point for the range of log + messages to return. This resource expresses this value in the number + of seconds that have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + in: query + name: endDate + schema: + type: integer + format: int64 + example: 1636481348 + minimum: 1199145600 + - description: >- + Human-readable label that identifies the cluster that contains the + collection for which you want to return the query logs from one + online archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Flag that indicates whether to download logs for queries against + your online archive only or both your online archive and cluster. + in: query + name: archiveOnly + schema: + type: boolean + default: false + responses: + '200': + content: + application/vnd.atlas.2023-01-01+gzip: + schema: + type: string + format: binary + description: >- + This resource downloads a compressed log file to your current + working directory. You can specify its name using the + `--output` option or use the default filename using the `-OJ` + option. The default filename varies based on whether you + download logs for queries of your online archive only or both + your online archive and cluster. + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Download Online Archive Query Logs + tags: + - Online Archive + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives/{archiveId}: + delete: + description: >- + Removes one online archive. This archive stores data from one cluster + within one project. To use this resource, the requesting API Key must + have the Project Data Access Admin role. + externalDocs: + description: Online Archive + url: >- + https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: deleteOnlineArchive + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the online + archive to delete. + in: path + name: archiveId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + Human-readable label that identifies the cluster that contains the + collection from which you want to remove an online archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Online Archive + tags: + - Online Archive + get: + description: >- + Returns one online archive for one cluster. This archive stores data + from one cluster within one project. To use this resource, the + requesting API Key must have the Project Read Only role. + externalDocs: + description: Online Archive + url: >- + https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: getOnlineArchive + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the online + archive to return. + in: path + name: archiveId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + Human-readable label that identifies the cluster that contains the + specified collection from which Application created the online + archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupOnlineArchive' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Online Archive + tags: + - Online Archive + patch: + description: >- + Updates, pauses, or resumes one online archive. This archive stores data + from one cluster within one project. To use this resource, the + requesting API Key must have the Project Data Access Admin role. + externalDocs: + description: Online Archive + url: >- + https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: updateOnlineArchive + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the online + archive to update. + in: path + name: archiveId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + Human-readable label that identifies the cluster that contains the + specified collection from which Application created the online + archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupOnlineArchive' + description: Updates, pauses, or resumes one online archive. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupOnlineArchive' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Online Archive + tags: + - Online Archive + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/outageSimulation: + delete: + description: Ends a cluster outage simulation. + externalDocs: + description: Cluster Outage Simulation + url: https://dochub.mongodb.org/core/test-regional-outage + operationId: endOutageSimulation + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster that is undergoing + outage simulation. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterOutageSimulation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: End an Outage Simulation + tags: + - Cluster Outage Simulation + x-xgen-experimental: true + get: + description: Returns one outage simulation for one cluster. + externalDocs: + description: Cluster Outage Simulation + url: https://dochub.mongodb.org/core/test-regional-outage + operationId: getOutageSimulation + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster that is undergoing + outage simulation. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterOutageSimulation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Outage Simulation + tags: + - Cluster Outage Simulation + x-xgen-experimental: true + post: + description: Starts a cluster outage simulation. + externalDocs: + description: Cluster Outage Simulation + url: https://dochub.mongodb.org/core/test-regional-outage + operationId: startOutageSimulation + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster to undergo an + outage simulation. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterOutageSimulation' + description: Describes the outage simulation. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterOutageSimulation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Start an Outage Simulation + tags: + - Cluster Outage Simulation + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/processArgs: + get: + description: >- + Returns the advanced configuration details for one cluster in the + specified project. Clusters contain a group of hosts that maintain the + same data set. Advanced configuration details include the read/write + concern, index and oplog limits, and other database settings. This + feature isn't available for `M0` free clusters, `M2` and `M5` + shared-tier clusters, or serverless clusters. To use this resource, the + requesting API Key must have the Project Read Only role. + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: getClusterAdvancedConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterDescriptionProcessArgs' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Advanced Configuration Options for One Cluster + tags: + - Clusters + patch: + description: >- + Updates the advanced configuration details for one cluster in the + specified project. Clusters contain a group of hosts that maintain the + same data set. Advanced configuration details include the read/write + concern, index and oplog limits, and other database settings. To use + this resource, the requesting API Key must have the Project Cluster + Manager role. This feature isn't available for `M0` free clusters, `M2` + and `M5` shared-tier clusters, or serverless clusters. + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: updateClusterAdvancedConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterDescriptionProcessArgs' + description: >- + Advanced configuration details to add for one cluster in the specified + project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterDescriptionProcessArgs' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Advanced Configuration Options for One Cluster + tags: + - Clusters + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restartPrimaries: + post: + description: >- + Starts a failover test for the specified cluster in the specified + project. Clusters contain a group of hosts that maintain the same data + set. A failover test checks how MongoDB Cloud handles the failure of the + cluster's primary node. During the test, MongoDB Cloud shuts down the + primary node and elects a new primary. To use this resource, the + requesting API Key must have the Project Cluster Manager role. + Deprecated versions: v2-{2023-01-01} + operationId: testFailover + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Test Failover for One Multi-Cloud Cluster + tags: + - Clusters + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs: + get: + deprecated: true + description: >- + Returns all legacy backup restore jobs for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). If you use the `BATCH-ID` query parameter, you can retrieve all restore jobs in the specified batch. When creating a restore job for a sharded cluster, MongoDB Cloud creates a separate job for each shard, plus another for the config server. Each of those jobs are part of a batch. However, a batch can't include a restore job for a replica set. + operationId: listLegacyBackupRestoreJobs + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Unique 24-hexadecimal digit string that identifies the batch of + restore jobs to return. Timestamp in ISO 8601 date and time format + in UTC when creating a restore job for a sharded cluster, + Application creates a separate job for each shard, plus another for + the config host. Each of these jobs comprise one batch. A restore + job for a replica set can't be part of a batch. + in: query + name: batchId + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedRestoreJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Legacy Backup Restore Jobs + tags: + - Legacy Backup + x-xgen-experimental: true + post: + deprecated: true + description: >- + Restores one legacy backup for one cluster in the specified project. To + use this resource, the requesting API Key must have the Project Owner + role. Effective 23 March 2020, all new clusters can use only Cloud + Backups. When you upgrade to 4.2, your backup system upgrades to cloud + backup if it is currently set to legacy backup. After this upgrade, all + your existing legacy backup snapshots remain available. They expire over + time in accordance with your retention policy. Your backup policy resets + to the default schedule. If you had a custom backup policy in place with + legacy backups, you must re-create it with the procedure outlined in the + [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + This endpoint doesn't support creating checkpoint restore jobs for + sharded clusters, or creating restore jobs for queryable backup + snapshots. If you create an automated restore job by specifying + `delivery.methodName` of `AUTOMATED_RESTORE` in your request body, + MongoDB Cloud removes all existing data on the target cluster prior to + the restore. + operationId: createLegacyBackupRestoreJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupRestoreJob' + description: Legacy backup to restore to one cluster in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedRestoreJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Legacy Backup Restore Job + tags: + - Legacy Backup Restore Jobs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs/{jobId}: + get: + deprecated: true + description: >- + Returns one legacy backup restore job for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: getLegacyBackupRestoreJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the restore job. + in: path + name: jobId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupRestoreJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Legacy Backup Restore Job + tags: + - Legacy Backup + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshotSchedule: + get: + deprecated: true + description: >- + Returns the snapshot schedule for one cluster in the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: getLegacySnapshotSchedule + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiAtlasSnapshotSchedule' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Snapshot Schedule + tags: + - Legacy Backup + x-xgen-experimental: true + patch: + deprecated: true + description: >- + Updates the snapshot schedule for one cluster in the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: updateLegacySnapshotSchedule + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiAtlasSnapshotSchedule' + description: Update the snapshot schedule for one cluster in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiAtlasSnapshotSchedule' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Snapshot Schedule for One Cluster + tags: + - Legacy Backup + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots: + get: + deprecated: true + description: >- + Returns all legacy backup snapshots for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. Effective 23 March 2020, all new clusters can + use only Cloud Backups. When you upgrade to 4.2, your backup system + upgrades to cloud backup if it is currently set to legacy backup. After + this upgrade, all your existing legacy backup snapshots remain + available. They expire over time in accordance with your retention + policy. Your backup policy resets to the default schedule. If you had a + custom backup policy in place with legacy backups, you must re-create it + with the procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: listLegacySnapshots + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Human-readable label that specifies whether to return only + completed, incomplete, or all snapshots. By default, MongoDB Cloud + only returns completed snapshots. + in: query + name: completed + schema: + type: string + default: 'true' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Legacy Backup Snapshots + tags: + - Legacy Backup + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots/{snapshotId}: + delete: + deprecated: true + description: >- + Removes one legacy backup snapshot for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. Effective 23 March 2020, all new clusters can use + only Cloud Backups. When you upgrade to 4.2, your backup system upgrades + to cloud backup if it is currently set to legacy backup. After this + upgrade, all your existing legacy backup snapshots remain available. + They expire over time in accordance with your retention policy. Your + backup policy resets to the default schedule. If you had a custom backup + policy in place with legacy backups, you must re-create it with the + procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: deleteLegacySnapshot + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Legacy Backup Snapshot + tags: + - Legacy Backup + x-xgen-experimental: true + get: + deprecated: true + description: >- + Returns one legacy backup snapshot for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. Effective 23 March 2020, all new clusters can + use only Cloud Backups. When you upgrade to 4.2, your backup system + upgrades to cloud backup if it is currently set to legacy backup. After + this upgrade, all your existing legacy backup snapshots remain + available. They expire over time in accordance with your retention + policy. Your backup policy resets to the default schedule. If you had a + custom backup policy in place with legacy backups, you must re-create it + with the procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: getLegacySnapshot + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Legacy Backup Snapshot + tags: + - Legacy Backup + x-xgen-experimental: true + patch: + deprecated: true + description: >- + Changes the expiration date for one legacy backup snapshot for one + cluster in the specified project. To use this resource, the requesting + API Key must have the Project Owner role. Effective 23 March 2020, all + new clusters can use only Cloud Backups. When you upgrade to 4.2, your + backup system upgrades to cloud backup if it is currently set to legacy + backup. After this upgrade, all your existing legacy backup snapshots + remain available. They expire over time in accordance with your + retention policy. Your backup policy resets to the default schedule. If + you had a custom backup policy in place with legacy backups, you must + re-create it with the procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: updateLegacySnapshotRetention + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupSnapshot' + description: Changes One Legacy Backup Snapshot Expiration. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BackupSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Change One Legacy Backup Snapshot Expiration + tags: + - Legacy Backup + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/status: + get: + description: >- + Returns the status of all changes that you made to the specified cluster + in the specified project. Use this resource to check the progress + MongoDB Cloud has made in processing your changes. The response does not + include the deployment of new dedicated clusters. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: getClusterStatus + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ClusterStatus' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Status of All Cluster Operations + tags: + - Clusters + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{hostName}/logs/{logName}.gz: + get: + description: >- + Returns a compressed (.gz) log file that contains a range of log + messages for the specified host for the specified project. MongoDB + updates process and audit logs from the cluster backend infrastructure + every five minutes and contain log data from the previous five minutes. + If you poll the API for log files, we recommend polling every five + minutes. For example, if the logs are updated at 4:00 UTC and then you + poll the API, the API returns log data from the interval between 3:55 + UTC and 4:00 UTC. This feature isn't available for `M0` free clusters, + `M2`, `M5`, or serverless clusters. To use this resource, the requesting + API Key must have the Project Data Access Read Only or higher role. + Deprecated versions: v2-{2023-01-01} + operationId: getHostLogs + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the host that stores the log + files that you want to download. + in: path + name: hostName + required: true + schema: + type: string + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + - description: >- + Human-readable label that identifies the log file that you want to + return. To return audit logs, enable *Database Auditing* for the + specified project. + in: path + name: logName + required: true + schema: + type: string + externalDocs: + description: Set up Database Auditing + url: https://docs.atlas.mongodb.com/database-auditing/ + - description: >- + Date and time when the period specifies the inclusive ending point + for the range of log messages to retrieve. This parameter expresses + its value in the number of seconds that have elapsed since the UNIX + epoch. + in: query + name: endDate + schema: + type: integer + format: int64 + minimum: 1199145600 + - description: >- + Date and time when the period specifies the inclusive starting point + for the range of log messages to retrieve. This parameter expresses + its value in the number of seconds that have elapsed since the UNIX + epoch. + in: query + name: startDate + schema: + type: integer + format: int64 + minimum: 1199145600 + responses: + '200': + content: + application/vnd.atlas.2023-02-01+gzip: + schema: + type: string + format: binary + description: >- + Compressed (.gz) log file that contains a range of log + messages for the specified host for the specified project + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Download Logs for One Cluster Host in One Project + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/containers: + get: + description: >- + Returns details about all network peering containers in the specified + project for the specified cloud provider. If you do not specify the + cloud provider, MongoDB Cloud returns details about all network peering + containers in the project for Amazon Web Services (AWS). To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: listPeeringContainerByCloudProvider + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Cloud service provider that serves the desired network peering + containers. + in: query + name: providerName + required: true + schema: + type: string + default: AWS + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedCloudProviderContainer' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Return All Network Peering Containers in One Project for One Cloud + Provider + tags: + - Network Peering + post: + description: >- + Creates one new network peering container in the specified project. + MongoDB Cloud can deploy Network Peering connections in a network + peering container. GCP can have one container per project. AWS and Azure + can have one container per cloud provider region. To use this resource, + the requesting API Key must have the Project Owner role. + operationId: createPeeringContainer + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderContainer' + description: Creates one new network peering container in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderContainer' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One New Network Peering Container + tags: + - Network Peering + /api/atlas/v2/groups/{groupId}/containers/all: + get: + description: >- + Returns details about all network peering containers in the specified + project. Network peering containers contain network peering connections. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listPeeringContainers + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedCloudProviderContainer' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Network Peering Containers in One Project + tags: + - Network Peering + /api/atlas/v2/groups/{groupId}/containers/{containerId}: + delete: + description: >- + Removes one network peering container in the specified project. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: deletePeeringContainer + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + network container that you want to remove. + in: path + name: containerId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Network Peering Container + tags: + - Network Peering + get: + description: >- + Returns details about one network peering container in one specified + project. Network peering containers contain network peering connections. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getPeeringContainer + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + network container that you want to remove. + in: path + name: containerId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderContainer' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Network Peering Container + tags: + - Network Peering + patch: + description: >- + Updates the network details and labels of one specified network peering + container in the specified project. To use this resource, the requesting + API Key must have the Project Owner role. + operationId: updatePeeringContainer + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + network container that you want to remove. + in: path + name: containerId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderContainer' + description: >- + Updates the network details and labels of one specified network + peering container in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderContainer' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Network Peering Container + tags: + - Network Peering + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/customDBRoles/roles: + get: + description: >- + Returns all custom roles for the specified project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: listCustomDatabaseRoles + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/UserCustomDBRole' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Custom Roles in One Project + tags: + - Custom Database Roles + post: + description: >- + Creates one custom role in the specified project. To use this resource, + the requesting API Key must have the Project Owner role. + operationId: createCustomDatabaseRole + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserCustomDBRole' + description: Creates one custom role in the specified project. + required: true + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserCustomDBRole' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Custom Role + tags: + - Custom Database Roles + /api/atlas/v2/groups/{groupId}/customDBRoles/roles/{roleName}: + delete: + description: >- + Removes one custom role from the specified project. You can't remove a + custom role that would leave one or more child roles with no parent + roles or actions. You also can't remove a custom role that would leave + one or more database users without roles. To use this resource, the + requesting API Key must have the Project Atlas Admin role. + operationId: deleteCustomDatabaseRole + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the role for the request. This + name must be unique for this custom role in this project. + in: path + name: roleName + required: true + schema: + type: string + pattern: >- + ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- + Returns one custom role for the specified project. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: getCustomDatabaseRole + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the role for the request. This + name must be unique for this custom role in this project. + in: path + name: roleName + required: true + schema: + type: string + pattern: >- + ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- + Updates one custom role in the specified project. To use this resource, + the requesting API Key must have the Project Owner role. + operationId: updateCustomDatabaseRole + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the role for the request. This + name must beunique for this custom role in this project. + in: path + name: roleName + required: true + schema: + type: string + pattern: >- + ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- + Returns the details of all federated database instances in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only or higher role. + operationId: listFederatedDatabases + parameters: + - $ref: '#/components/parameters/groupId' + - description: Type of Federated Database Instances to return. + in: query + name: type + schema: + type: string + default: USER + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/DataLakeTenant' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Federated Database Instances in One Project + tags: + - Data Federation + post: + description: >- + Creates one federated database instance in the specified project. To use + this resource, the requesting API Key must have the Project Owner or + Project Charts Admin roles. + operationId: createFederatedDatabase + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Flag that indicates whether this request should check if the + requesting IAM role can read from the S3 bucket. AWS checks if the + role can list the objects in the bucket before writing to it. Some + IAM roles only need write permissions. This flag allows you to skip + that check. + in: query + name: skipRoleValidation + schema: + type: boolean + default: false + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeTenant' + description: >- + Details to create one federated database instance in the specified + project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeTenant' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Federated Database Instance in One Project + tags: + - Data Federation + /api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}: + delete: + description: >- + Removes one federated database instance from the specified project. To + use this resource, the requesting API Key must have the Project Owner or + Project Charts Admin roles. + operationId: deleteFederatedDatabase + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the federated database instance + to remove. + in: path + name: tenantName + required: true + schema: + type: string + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Federated Database Instance from One Project + tags: + - Data Federation + get: + description: >- + Returns the details of one federated database instance within the + specified project. To use this resource, the requesting API Key must + have the Project Read Only or Project Charts Admin roles. + operationId: getFederatedDatabase + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the Federated Database to + return. + in: path + name: tenantName + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeTenant' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Federated Database Instance in One Project + tags: + - Data Federation + patch: + description: >- + Updates the details of one federated database instance in the specified + project. To use this resource, the requesting API Key must have the + Project Owner or higher role. + operationId: updateFederatedDatabase + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the federated database instance + to update. + in: path + name: tenantName + required: true + schema: + type: string + - description: >- + Flag that indicates whether this request should check if the + requesting IAM role can read from the S3 bucket. AWS checks if the + role can list the objects in the bucket before writing to it. Some + IAM roles only need write permissions. This flag allows you to skip + that check. + in: query + name: skipRoleValidation + required: true + schema: + type: boolean + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeTenant' + description: Details of one Federated Database to update in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeTenant' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Federated Database Instance in One Project + tags: + - Data Federation + /api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/limits: + get: + description: >- + Returns query limits for a federated databases instance in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: returnFederatedDatabaseQueryLimits + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the federated database instance + for which you want to retrieve query limits. + in: path + name: tenantName + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/DataFederationTenantQueryLimit' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Query Limits for One Federated Database Instance + tags: + - Data Federation + /api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/limits/{limitName}: + delete: + description: >- + Deletes one query limit for one federated database instance. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: deleteOneDataFederationInstanceQueryLimit + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the federated database instance + to which the query limit applies. + in: path + name: tenantName + required: true + schema: + type: string + - description: > + Human-readable label that identifies this data federation instance + limit. + + + | Limit Name | Description | Default | + + | --- | --- | --- | + + | bytesProcessed.query | Limit on the number of bytes processed + during a single data federation query | N/A | + + | bytesProcessed.daily | Limit on the number of bytes processed for + the data federation instance for the current day | N/A | + + | bytesProcessed.weekly | Limit on the number of bytes processed for + the data federation instance for the current week | N/A | + + | bytesProcessed.monthly | Limit on the number of bytes processed + for the data federation instance for the current month | N/A | + in: path + name: limitName + required: true + schema: + type: string + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Delete One Query Limit For One Federated Database Instance + tags: + - Data Federation + get: + description: >- + Returns the details of one query limit for the specified federated + database instance in the specified project. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: returnFederatedDatabaseQueryLimit + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the federated database instance + to which the query limit applies. + in: path + name: tenantName + required: true + schema: + type: string + - description: > + Human-readable label that identifies this data federation instance + limit. + + + | Limit Name | Description | Default | + + | --- | --- | --- | + + | bytesProcessed.query | Limit on the number of bytes processed + during a single data federation query | N/A | + + | bytesProcessed.daily | Limit on the number of bytes processed for + the data federation instance for the current day | N/A | + + | bytesProcessed.weekly | Limit on the number of bytes processed for + the data federation instance for the current week | N/A | + + | bytesProcessed.monthly | Limit on the number of bytes processed + for the data federation instance for the current month | N/A | + in: path + name: limitName + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataFederationTenantQueryLimit' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Federated Database Instance Query Limit for One Project + tags: + - Data Federation + patch: + description: >- + Creates or updates one query limit for one federated database instance. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: createOneDataFederationQueryLimit + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the federated database instance + to which the query limit applies. + in: path + name: tenantName + required: true + schema: + type: string + - description: > + Human-readable label that identifies this data federation instance + limit. + + + | Limit Name | Description | Default | + + | --- | --- | --- | + + | bytesProcessed.query | Limit on the number of bytes processed + during a single data federation query | N/A | + + | bytesProcessed.daily | Limit on the number of bytes processed for + the data federation instance for the current day | N/A | + + | bytesProcessed.weekly | Limit on the number of bytes processed for + the data federation instance for the current week | N/A | + + | bytesProcessed.monthly | Limit on the number of bytes processed + for the data federation instance for the current month | N/A | + in: path + name: limitName + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataFederationTenantQueryLimit' + description: >- + Creates or updates one query limit for one federated database + instance. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataFederationTenantQueryLimit' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Configure One Query Limit for One Federated Database Instance + tags: + - Data Federation + /api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/queryLogs.gz: + get: + description: >- + Downloads the query logs for the specified federated database instance. + To use this resource, the requesting API Key must have the Project Owner + or Project Data Access Read Write roles. + operationId: downloadFederatedDatabaseQueryLogs + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Timestamp that specifies the end point for the range of log messages + to download. MongoDB Cloud expresses this timestamp in the number + of seconds that have elapsed since the UNIX epoch. + in: query + name: endDate + schema: + type: integer + format: int64 + example: 1636481348 + pattern: '1199145600' + - description: >- + Timestamp that specifies the starting point for the range of log + messages to download. MongoDB Cloud expresses this timestamp in the + number of seconds that have elapsed since the UNIX epoch. + in: query + name: startDate + schema: + type: integer + format: int64 + example: 1636466948 + pattern: '1199145600' + - description: >- + Human-readable label that identifies the federated database instance + for which you want to download query logs. + in: path + name: tenantName + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+gzip: + schema: + type: string + format: binary + description: Compressed archive labeled `queryLogs.gz` downloads + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Download Query Logs for One Federated Database Instance + tags: + - Data Federation + /api/atlas/v2/groups/{groupId}/databaseUsers: + get: + description: >- + Returns all database users that belong to the specified project. To use + this resource, the requesting API Key must have the Project Read Only + role. + operationId: listDatabaseUsers + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiAtlasDatabaseUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Database Users from One Project + tags: + - Database Users + post: + description: >- + Creates one database user in the specified project. This MongoDB Cloud + supports a maximum of 100 database users per project. If you require + more than 100 database users on a project, contact + [Support](https://cloud.mongodb.com/support). To use this resource, the + requesting API Key must have the Project Owner or Project Charts Admin + roles. + operationId: createDatabaseUser + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + examples: + AWS IAM Authentication: + description: AWS IAM Authentication + value: + awsIAMType: USER + databaseName: $external + groupId: 32b6e34b3d91647abb20e7b8 + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: >- + arn:aws:iam::358363220050:user/mongodb-aws-iam-auth-test-user + Federated Authentication: + description: Federated Authentication + value: + databaseName: admin + groupId: 32b6e34b3d91647abb20e7b8 + oidcAuthType: IDP_GROUP + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: 5dd7496c7a3e5a648454341c/sales + LDAP Authentication: + description: LDAP Authentication + value: + databaseName: admin + groupId: 32b6e34b3d91647abb20e7b8 + ldapAuthType: GROUP + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: CN=marketing,OU=groups,DC=example,DC=com + SCRAM-SHA Authentication: + description: SCRAM-SHA Authentication + value: + databaseName: admin + groupId: 32b6e34b3d91647abb20e7b8 + password: changeme123 + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: david + X509 Authentication: + description: X509 Authentication + value: + databaseName: $external + groupId: 32b6e34b3d91647abb20e7b8 + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: CN=david@example.com,OU=users,DC=example,DC=com + x509Type: CUSTOMER + schema: + $ref: '#/components/schemas/CloudDatabaseUser' + description: Creates one database user in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudDatabaseUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Database User in One Project + tags: + - Database Users + /api/atlas/v2/groups/{groupId}/databaseUsers/{databaseName}/{username}: + delete: + description: >- + Removes one database user from the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: deleteDatabaseUser + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the database against which the + database user authenticates. Database users must provide both a + username and authentication database to log into MongoDB. If the + user authenticates with AWS IAM, x.509, or LDAP, this value should + be `$external`. If the user authenticates with SCRAM-SHA or OIDC, + this value should be `admin`. + in: path + name: databaseName + required: true + schema: + type: string + - description: > + Human-readable label that represents the user that authenticates to + MongoDB. The format of this label depends on the method of + authentication: + + + | Authentication Method | Parameter Needed | Parameter Value | + username Format | + + |---|---|---|---| + + | AWS IAM | awsType | ROLE | ARN | + + | AWS IAM | awsType | USER | ARN | + + | x.509 | x509Type | CUSTOMER | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | x.509 | x509Type | MANAGED | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | USER | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | GROUP | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in + federation settings), followed by a '/', followed by the IdP group + name | + + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | + Alphanumeric string | + in: path + name: username + required: true + schema: + type: string + example: >- + SCRAM-SHA: dylan or AWS IAM: + arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or + x.509/LDAP: CN=Dylan + Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: + IdPIdentifier/IdPGroupName + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Database User from One Project + tags: + - Database Users + get: + description: >- + Returns one database user that belong to the specified project. To use + this resource, the requesting API Key must have the Project Read Only + role. + operationId: getDatabaseUser + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the database against which the + database user authenticates. Database users must provide both a + username and authentication database to log into MongoDB. If the + user authenticates with AWS IAM, x.509, or LDAP, this value should + be `$external`. If the user authenticates with SCRAM-SHA or OIDC, + this value should be `admin`. + in: path + name: databaseName + required: true + schema: + type: string + - description: > + Human-readable label that represents the user that authenticates to + MongoDB. The format of this label depends on the method of + authentication: + + + | Authentication Method | Parameter Needed | Parameter Value | + username Format | + + |---|---|---|---| + + | AWS IAM | awsType | ROLE | ARN | + + | AWS IAM | awsType | USER | ARN | + + | x.509 | x509Type | CUSTOMER | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | x.509 | x509Type | MANAGED | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | USER | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | GROUP | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in + federation settings), followed by a '/', followed by the IdP group + name | + + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | + Alphanumeric string | + in: path + name: username + required: true + schema: + type: string + example: >- + SCRAM-SHA: dylan or AWS IAM: + arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or + x.509/LDAP: CN=Dylan + Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: + IdPIdentifier/IdPGroupName + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudDatabaseUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Database User from One Project + tags: + - Database Users + patch: + description: >- + Updates one database user that belongs to the specified project. To use + this resource, the requesting API Key must have the Project Owner or + Project Charts Admin roles. + operationId: updateDatabaseUser + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the database against which the + database user authenticates. Database users must provide both a + username and authentication database to log into MongoDB. If the + user authenticates with AWS IAM, x.509, or LDAP, this value should + be `$external`. If the user authenticates with SCRAM-SHA or OIDC, + this value should be `admin`. + in: path + name: databaseName + required: true + schema: + type: string + - description: > + Human-readable label that represents the user that authenticates to + MongoDB. The format of this label depends on the method of + authentication: + + + | Authentication Method | Parameter Needed | Parameter Value | + username Format | + + |---|---|---|---| + + | AWS IAM | awsType | ROLE | ARN | + + | AWS IAM | awsType | USER | ARN | + + | x.509 | x509Type | CUSTOMER | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | x.509 | x509Type | MANAGED | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | USER | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | GROUP | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in + federation settings), followed by a '/', followed by the IdP group + name | + + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | + Alphanumeric string | + in: path + name: username + required: true + schema: + type: string + example: >- + SCRAM-SHA: dylan or AWS IAM: + arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or + x.509/LDAP: CN=Dylan + Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: + IdPIdentifier/IdPGroupName + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudDatabaseUser' + description: Updates one database user that belongs to the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudDatabaseUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Database User in One Project + tags: + - Database Users + /api/atlas/v2/groups/{groupId}/databaseUsers/{username}/certs: + get: + description: >- + Returns all unexpired X.509 certificates for the specified MongoDB user. + This MongoDB user belongs to one project. Atlas manages these + certificates and the MongoDB user. To use this resource, the requesting + API Key must have the Project Read Only role. + operationId: listDatabaseUserCertificates + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Human-readable label that represents the MongoDB database user + account whose certificates you want to return. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedUserCert' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All X.509 Certificates Assigned to One MongoDB User + tags: + - X.509 Authentication + post: + description: >- + Generates one X.509 certificate for the specified MongoDB user. Atlas + manages the certificate and MongoDB user that belong to one project. To + use this resource, the requesting API Key must have the Project Owner + role. + + + To get MongoDB Cloud to generate a managed certificate for a database + user, set `"x509Type" : "MANAGED"` on the desired MongoDB Database User. + + + If you are managing your own Certificate Authority (CA) in Self-Managed + X.509 mode, you must generate certificates for database users using your + own CA. + externalDocs: + description: Self-Managed X.509 + url: >- + https://www.mongodb.com/docs/atlas/security-self-managed-x509/#std-label-self-managed-x509 + operationId: createDatabaseUserCertificate + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that represents the MongoDB database user + account for whom to create a certificate. + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserCert' + description: Generates one X.509 certificate for the specified MongoDB user. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: string + description: >- + PEM file that contains the user's X.509 certificate and + private key. + x-xgen-version: 2023-01-01T00:00:00.000Z + description: >- + This endpoint returns a PEM file with the certificate and private + key. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One X.509 Certificate for One MongoDB User + tags: + - X.509 Authentication + /api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}: + get: + description: >- + Returns the access logs of one cluster identified by the cluster's name. + Access logs contain a list of authentication requests made against your + cluster. You can't use this feature on tenant-tier clusters (M0, M2, + M5). To use this resource, the requesting API Key must have the Project + Monitoring Admin role. + externalDocs: + description: Database Access History + url: https://docs.atlas.mongodb.com/access-tracking/ + operationId: listAccessLogsByClusterName + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Flag that indicates whether the response returns the successful + authentication attempts only. + in: query + name: authResult + schema: + type: boolean + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Date and time when to stop retrieving database history. If you + specify **end**, you must also specify **start**. This parameter + uses UNIX epoch time in milliseconds. + in: query + name: end + schema: + type: integer + format: int64 + - description: >- + One Internet Protocol address that attempted to authenticate with + the database. + in: query + name: ipAddress + schema: + type: string + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + - description: Maximum number of lines from the log to return. + in: query + name: nLogs + schema: + type: integer + format: int32 + default: 20000 + maximum: 20000 + minimum: 0 + - description: >- + Date and time when MongoDB Cloud begins retrieving database history. + If you specify **start**, you must also specify **end**. This + parameter uses UNIX epoch time in milliseconds. + in: query + name: start + schema: + type: integer + format: int64 + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/MongoDBAccessLogsList' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Database Access History for One Cluster using Its Cluster Name + tags: + - Access Tracking + /api/atlas/v2/groups/{groupId}/dbAccessHistory/processes/{hostname}: + get: + description: >- + Returns the access logs of one cluster identified by the cluster's + hostname. Access logs contain a list of authentication requests made + against your clusters. You can't use this feature on tenant-tier + clusters (M0, M2, M5). To use this resource, the requesting API Key must + have the Project Monitoring Admin role. + externalDocs: + description: Database Access History + url: https://docs.atlas.mongodb.com/access-tracking/ + operationId: listAccessLogsByHostname + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Flag that indicates whether the response returns the successful + authentication attempts only. + in: query + name: authResult + schema: + type: boolean + - description: >- + Date and time when to stop retrieving database history. If you + specify **end**, you must also specify **start**. This parameter + uses UNIX epoch time in milliseconds. + in: query + name: end + schema: + type: integer + format: int64 + - description: >- + Fully qualified domain name or IP address of the MongoDB host that + stores the log files that you want to download. + in: path + name: hostname + required: true + schema: + type: string + - description: >- + One Internet Protocol address that attempted to authenticate with + the database. + in: query + name: ipAddress + schema: + type: string + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + - description: Maximum number of lines from the log to return. + in: query + name: nLogs + schema: + type: integer + format: int32 + default: 20000 + maximum: 20000 + minimum: 0 + - description: >- + Date and time when MongoDB Cloud begins retrieving database history. + If you specify **start**, you must also specify **end**. This + parameter uses UNIX epoch time in milliseconds. + in: query + name: start + schema: + type: integer + format: int64 + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/MongoDBAccessLogsList' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Database Access History for One Cluster using Its Hostname + tags: + - Access Tracking + /api/atlas/v2/groups/{groupId}/encryptionAtRest: + get: + description: >- + Returns the configuration for encryption at rest using the keys you + manage through your cloud provider. MongoDB Cloud encrypts all storage + even if you don't use your own key management. This resource requires + the requesting API Key to have the Project Owner role. + + + **LIMITED TO M10 OR GREATER:** MongoDB Cloud limits this feature to + dedicated cluster tiers of M10 and greater. + operationId: getEncryptionAtRest + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/EncryptionAtRest' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Return One Configuration for Encryption at Rest using Customer-Managed + Keys for One Project + tags: + - Encryption at Rest using Customer Key Management + patch: + description: >- + Updates the configuration for encryption at rest using the keys you + manage through your cloud provider. MongoDB Cloud encrypts all storage + even if you don't use your own key management. This resource requires + the requesting API Key to have the Project Owner role. This feature + isn't available for `M0` free clusters, `M2`, `M5`, or serverless + clusters. + + After you configure at least one Encryption at Rest using a Customer Key Management provider for the MongoDB Cloud project, Project Owners can enable Encryption at Rest using Customer Key Management for each MongoDB Cloud cluster for which they require encryption. The Encryption at Rest using Customer Key Management provider doesn't have to match the cluster cloud service provider. MongoDB Cloud doesn't automatically rotate user-managed encryption keys. Defer to your preferred Encryption at Rest using Customer Key Management provider's documentation and guidance for best practices on key rotation. MongoDB Cloud automatically creates a 90-day key rotation alert when you configure Encryption at Rest using Customer Key Management using your Key Management in an MongoDB Cloud project. MongoDB Cloud encrypts all storage whether or not you use your own key management. + operationId: updateEncryptionAtRest + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/EncryptionAtRest' + description: >- + Required parameters depend on whether someone has enabled Encryption + at Rest using Customer Key Management: + + + If you have enabled Encryption at Rest using Customer Key Management + (CMK), Atlas requires all of the parameters for the desired encryption + provider. + + + - To use AWS Key Management Service (KMS), MongoDB Cloud requires all + the fields in the **awsKms** object. + + - To use Azure Key Vault, MongoDB Cloud requires all the fields in the + **azureKeyVault** object. + + - To use Google Cloud Key Management Service (KMS), MongoDB Cloud + requires all the fields in the **googleCloudKms** object. + + + If you enabled Encryption at Rest using Customer Key Management, + administrators can pass only the changed fields for the **awsKms**, + **azureKeyVault**, or **googleCloudKms** object to update the + configuration to this endpoint. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/EncryptionAtRest' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Update Configuration for Encryption at Rest using Customer-Managed Keys + for One Project + tags: + - Encryption at Rest using Customer Key Management + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/events: + get: + description: >- + Returns one event for the specified project. Events identify significant + database, billing, or security activities or status changes. To use this + resource, the requesting API Key must have the Project Read Only role. + + + This resource remains under revision and may change. + operationId: listProjectEvents + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Human-readable label that identifies the cluster. + in: query + name: clusterNames + schema: + type: array + items: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + style: form + - description: >- + Category of incident recorded at this moment in time. + + + **IMPORTANT**: The complete list of event type values changes + frequently. + in: query + name: eventType + schema: + type: array + items: + $ref: '#/components/schemas/EventTypeForNdsGroup' + - description: >- + Category of event that you would like to exclude from query results, + such as CLUSTER_CREATED + + + **IMPORTANT**: Event type names change frequently. Verify that you + specify the event type correctly by checking the complete list of + event types. + in: query + name: excludedEventType + schema: + type: array + items: + $ref: '#/components/schemas/EventTypeForNdsGroup' + - description: >- + Flag that indicates whether to include the raw document in the + output. The raw document contains additional meta information about + the event. + in: query + name: includeRaw + schema: + type: boolean + default: false + - description: >- + Date and time from when MongoDB Cloud stops returning events. This + parameter uses the ISO 8601 timestamp + format in UTC. + in: query + name: maxDate + schema: + type: string + format: date-time + - description: >- + Date and time from when MongoDB Cloud starts returning events. This + parameter uses the ISO 8601 timestamp + format in UTC. + in: query + name: minDate + schema: + type: string + format: date-time + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupPaginatedEvent' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Events from One Project + tags: + - Events + /api/atlas/v2/groups/{groupId}/events/{eventId}: + get: + description: >- + Returns one event for the specified project. Events identify significant + database, billing, or security activities or status changes. To use this + resource, the requesting API Key must have the Project Read Only role. + + + This resource remains under revision and may change. + operationId: getProjectEvent + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the event that + you want to return. Use the + [/events](#tag/Events/operation/listProjectEvents) endpoint to + retrieve all events to which the authenticated user has access. + in: path + name: eventId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + Flag that indicates whether to include the raw document in the + output. The raw document contains additional meta information about + the event. + in: query + name: includeRaw + schema: + type: boolean + default: false + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/EventViewForNdsGroup' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Event from One Project + tags: + - Events + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics: + get: + description: >- + Returns all Atlas Search metric types available for one process in the + specified project. You must have the Project Read Only or higher role to + view the Atlas Search metric types. + operationId: listMetricTypes + parameters: + - $ref: '#/components/parameters/processId' + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudSearchMetrics' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Atlas Search Metric Types for One Process + tags: + - Monitoring and Logs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/indexes/{databaseName}/{collectionName}/measurements: + get: + description: >- + Returns the Atlas Search index metrics within the specified time range + for one namespace in the specified process. + operationId: listIndexMetrics + parameters: + - $ref: '#/components/parameters/processId' + - $ref: '#/components/parameters/databaseName' + - $ref: '#/components/parameters/collectionName' + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/granularity' + - $ref: '#/components/parameters/period' + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/end' + - description: >- + List that contains the measurements that MongoDB Atlas reports for + the associated data series. + in: query + name: metrics + required: true + schema: + type: array + description: >- + List that contains the measurements that MongoDB Atlas reports for + the associated data series. + items: + type: string + maxItems: 10 + uniqueItems: true + style: form + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/MeasurementsIndexes' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Atlas Search Index Metrics for One Namespace + tags: + - Monitoring and Logs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/indexes/{databaseName}/{collectionName}/{indexName}/measurements: + get: + description: >- + Returns the Atlas Search metrics data series within the provided time + range for one namespace and index name on the specified process. You + must have the Project Read Only or higher role to view the Atlas Search + metric types. + operationId: getIndexMetrics + parameters: + - $ref: '#/components/parameters/processId' + - $ref: '#/components/parameters/indexName' + - $ref: '#/components/parameters/databaseName' + - $ref: '#/components/parameters/collectionName' + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/granularity' + - $ref: '#/components/parameters/period' + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/end' + - description: >- + List that contains the measurements that MongoDB Atlas reports for + the associated data series. + in: query + name: metrics + required: true + schema: + type: array + description: >- + List that contains the measurements that MongoDB Atlas reports for + the associated data series. + items: + type: string + maxItems: 10 + uniqueItems: true + style: form + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/MeasurementsIndexes' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Atlas Search Metrics for One Index in One Specified Namespace + tags: + - Monitoring and Logs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/measurements: + get: + description: >- + Returns the Atlas Search hardware and status data series within the + provided time range for one process in the specified project. You must + have the Project Read Only or higher role to view the Atlas Search + metric types. + operationId: getMeasurements + parameters: + - $ref: '#/components/parameters/processId' + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/granularity' + - $ref: '#/components/parameters/period' + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/end' + - description: >- + List that contains the metrics that you want MongoDB Atlas to report + for the associated data series. If you don't set this parameter, + this resource returns all hardware and status metrics for the + associated data series. + in: query + name: metrics + required: true + schema: + type: array + description: >- + List that contains the metrics that you want MongoDB Atlas to + report for the associated data series. If you don't set this + parameter, this resource returns all hardware and status metrics + for the associated data series. + items: + type: string + maxItems: 10 + uniqueItems: true + style: form + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/MeasurementsNonIndex' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Atlas Search Hardware and Status Metrics + tags: + - Monitoring and Logs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/integrations: + get: + description: >- + Returns the settings that permit integrations with all configured + third-party services. These settings apply to all databases managed in + one MongoDB Cloud project. To use this resource, the requesting API Key + must have the Organization Owner or Project Owner role. + operationId: listThirdPartyIntegrations + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedIntegration' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Active Third-Party Service Integrations + tags: + - Third-Party Integrations + /api/atlas/v2/groups/{groupId}/integrations/{integrationType}: + delete: + description: >- + Removes the settings that permit configuring one third-party service + integration. These settings apply to all databases managed in one + MongoDB Cloud project. If you delete an integration from a project, you + remove that integration configuration only for that project. This action + doesn't affect any other project or organization's configured + `{INTEGRATION-TYPE}` integrations. To use this resource, the requesting + API Key must have the Organization Owner or Project Owner role. + operationId: deleteThirdPartyIntegration + parameters: + - description: >- + Human-readable label that identifies the service which you want to + integrate with MongoDB Cloud. + in: path + name: integrationType + required: true + schema: + type: string + title: Integration Type + - $ref: '#/components/parameters/groupId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Third-Party Service Integration + tags: + - Third-Party Integrations + get: + description: >- + Returns the settings for configuring integration with one third-party + service. These settings apply to all databases managed in one MongoDB + Cloud project. To use this resource, the requesting API Key must have + the Organization Owner or Project Owner role. + operationId: getThirdPartyIntegration + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the service which you want to + integrate with MongoDB Cloud. + in: path + name: integrationType + required: true + schema: + type: string + title: Integration Type + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ThridPartyIntegration' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Third-Party Service Integration + tags: + - Third-Party Integrations + post: + description: >- + Adds the settings for configuring one third-party service integration. + These settings apply to all databases managed in the specified MongoDB + Cloud project. Each project can have only one configuration per + `{INTEGRATION-TYPE}`. To use this resource, the requesting API Key must + have the Organization Owner or Project Owner role. + operationId: createThirdPartyIntegration + parameters: + - description: >- + Human-readable label that identifies the service which you want to + integrate with MongoDB Cloud. + in: path + name: integrationType + required: true + schema: + type: string + title: Integration Type + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ThridPartyIntegration' + description: Third-party integration that you want to configure for your project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedIntegration' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Configure One Third-Party Service Integration + tags: + - Third-Party Integrations + put: + description: >- + Updates the settings for configuring integration with one third-party + service. These settings apply to all databases managed in one MongoDB + Cloud project. To use this resource, the requesting API Key must have + the Organization Owner or Project Owner role. + operationId: updateThirdPartyIntegration + parameters: + - description: >- + Human-readable label that identifies the service which you want to + integrate with MongoDB Cloud. + in: path + name: integrationType + required: true + schema: + type: string + title: Integration Type + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ThridPartyIntegration' + description: Third-party integration that you want to configure for your project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedIntegration' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Third-Party Service Integration + tags: + - Third-Party Integrations + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/invites: + get: + description: >- + Returns all pending invitations to the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: listProjectInvitations + parameters: + - $ref: '#/components/parameters/groupId' + - description: Email address of the user account invited to this project. + in: query + name: username + schema: + type: string + format: email + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/GroupInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Project Invitations + tags: + - Projects + patch: + description: >- + Updates the details of one pending invitation to the specified project. + To specify which invitation to update, provide the username of the + invited user. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: updateProjectInvitation + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupInvitationRequest' + description: >- + Updates the details of one pending invitation to the specified + project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Project Invitation + tags: + - Projects + post: + description: >- + Invites one MongoDB Cloud user to join the specified project. The + MongoDB Cloud user must accept the invitation to access information + within the specified project. To use this resource, the requesting API + Key must have the Project Owner role. + operationId: createProjectInvitation + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupInvitationRequest' + description: Invites one MongoDB Cloud user to join the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Invite One MongoDB Cloud User to Join One Project + tags: + - Projects + /api/atlas/v2/groups/{groupId}/invites/{invitationId}: + delete: + description: >- + Cancels one pending invitation sent to the specified MongoDB Cloud user + to join a project. You can't cancel an invitation that the user + accepted. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: deleteProjectInvitation + parameters: + - $ref: '#/components/parameters/groupId' + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Cancel One Project Invitation + tags: + - Projects + get: + description: >- + Returns the details of one pending invitation to the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: getProjectInvitation + parameters: + - $ref: '#/components/parameters/groupId' + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Project Invitation + tags: + - Projects + patch: + description: >- + Updates the details of one pending invitation to the specified project. + To specify which invitation to update, provide the unique identification + string for that invitation. Use the Return All Project Invitations + endpoint to retrieve IDs for all pending project invitations. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: updateProjectInvitationById + parameters: + - $ref: '#/components/parameters/groupId' + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupInvitationUpdateRequest' + description: >- + Updates the details of one pending invitation to the specified + project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Project Invitation by Invitation ID + tags: + - Projects + /api/atlas/v2/groups/{groupId}/limits: + get: + description: >- + Returns all the limits for the specified project. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: listProjectLimits + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/DataFederationLimit' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Limits for One Project + tags: + - Projects + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/limits/{limitName}: + delete: + description: >- + Removes the specified project limit. Depending on the limit, Atlas + either resets the limit to its default value or removes the limit + entirely. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: deleteProjectLimit + parameters: + - description: > + Human-readable label that identifies this project limit. + + + | Limit Name | Description | Default | API Override Limit | + + | --- | --- | --- | --- | + + | atlas.project.deployment.clusters | Limit on the number of + clusters in this project | 25 | 90 | + + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the + number of nodes per Private Link region in this project | 50 | 90 | + + | atlas.project.security.databaseAccess.customRoles | Limit on the + number of custom roles in this project | 100 | 1400 | + + | atlas.project.security.databaseAccess.users | Limit on the number + of database users in this project | 100 | 900 | + + | atlas.project.security.networkAccess.crossRegionEntries | Limit on + the number of cross-region network access entries in this project | + 40 | 220 | + + | atlas.project.security.networkAccess.entries | Limit on the number + of network access entries in this project | 200 | 20 | + + | dataFederation.bytesProcessed.query | Limit on the number of bytes + processed during a single Data Federation query | N/A | N/A | + + | dataFederation.bytesProcessed.daily | Limit on the number of bytes + processed across all Data Federation tenants for the current day | + N/A | N/A | + + | dataFederation.bytesProcessed.weekly | Limit on the number of + bytes processed across all Data Federation tenants for the current + week | N/A | N/A | + + | dataFederation.bytesProcessed.monthly | Limit on the number of + bytes processed across all Data Federation tenants for the current + month | N/A | N/A | + + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | + Number of Private Serivce Connections per Region Group | 50 | 100| + + | atlas.project.deployment.privateServiceConnectionsSubnetMask | + Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + in: path + name: limitName + required: true + schema: + type: string + - $ref: '#/components/parameters/groupId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Project Limit + tags: + - Projects + x-xgen-experimental: true + get: + description: >- + Returns the specified limit for the specified project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getProjectLimit + parameters: + - description: > + Human-readable label that identifies this project limit. + + + | Limit Name | Description | Default | API Override Limit | + + | --- | --- | --- | --- | + + | atlas.project.deployment.clusters | Limit on the number of + clusters in this project | 25 | 90 | + + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the + number of nodes per Private Link region in this project | 50 | 90 | + + | atlas.project.security.databaseAccess.customRoles | Limit on the + number of custom roles in this project | 100 | 1400 | + + | atlas.project.security.databaseAccess.users | Limit on the number + of database users in this project | 100 | 900 | + + | atlas.project.security.networkAccess.crossRegionEntries | Limit on + the number of cross-region network access entries in this project | + 40 | 220 | + + | atlas.project.security.networkAccess.entries | Limit on the number + of network access entries in this project | 200 | 20 | + + | dataFederation.bytesProcessed.query | Limit on the number of bytes + processed during a single Data Federation query | N/A | N/A | + + | dataFederation.bytesProcessed.daily | Limit on the number of bytes + processed across all Data Federation tenants for the current day | + N/A | N/A | + + | dataFederation.bytesProcessed.weekly | Limit on the number of + bytes processed across all Data Federation tenants for the current + week | N/A | N/A | + + | dataFederation.bytesProcessed.monthly | Limit on the number of + bytes processed across all Data Federation tenants for the current + month | N/A | N/A | + + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | + Number of Private Serivce Connections per Region Group | 50 | 100| + + | atlas.project.deployment.privateServiceConnectionsSubnetMask | + Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + in: path + name: limitName + required: true + schema: + type: string + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataFederationLimit' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Limit for One Project + tags: + - Projects + x-xgen-experimental: true + patch: + description: >- + Sets the specified project limit. To use this resource, the requesting + API Key must have the Project Owner role. + + + **NOTE**: Increasing the following configuration limits might lead to + slower response times in the MongoDB Cloud UI or increased user + management overhead leading to authentication or authorization + re-architecture. If possible, we recommend that you create additional + projects to gain access to more of these resources for a more + sustainable growth pattern. + operationId: setProjectLimit + parameters: + - description: > + Human-readable label that identifies this project limit. + + + | Limit Name | Description | Default | API Override Limit | + + | --- | --- | --- | --- | + + | atlas.project.deployment.clusters | Limit on the number of + clusters in this project | 25 | 90 | + + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the + number of nodes per Private Link region in this project | 50 | 90 | + + | atlas.project.security.databaseAccess.customRoles | Limit on the + number of custom roles in this project | 100 | 1400 | + + | atlas.project.security.databaseAccess.users | Limit on the number + of database users in this project | 100 | 900 | + + | atlas.project.security.networkAccess.crossRegionEntries | Limit on + the number of cross-region network access entries in this project | + 40 | 220 | + + | atlas.project.security.networkAccess.entries | Limit on the number + of network access entries in this project | 200 | 20 | + + | dataFederation.bytesProcessed.query | Limit on the number of bytes + processed during a single Data Federation query | N/A | N/A | + + | dataFederation.bytesProcessed.daily | Limit on the number of bytes + processed across all Data Federation tenants for the current day | + N/A | N/A | + + | dataFederation.bytesProcessed.weekly | Limit on the number of + bytes processed across all Data Federation tenants for the current + week | N/A | N/A | + + | dataFederation.bytesProcessed.monthly | Limit on the number of + bytes processed across all Data Federation tenants for the current + month | N/A | N/A | + + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | + Number of Private Serivce Connections per Region Group | 50 | 100| + + | atlas.project.deployment.privateServiceConnectionsSubnetMask | + Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + in: path + name: limitName + required: true + schema: + type: string + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataFederationLimit' + description: Limit to update. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataFederationLimit' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Set One Project Limit + tags: + - Projects + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/liveMigrations: + post: + description: |- + Migrate one cluster that Cloud or Ops Manager manages to MongoDB Atlas. + + Please make sure to [validate](#tag/Cloud-Migration-Service/operation/validateOneMigration) your migration before initiating it. + + You can use this API endpoint for push live migrations only. Your API Key must have the Organization Owner role to successfully call this resource. + operationId: createPushMigration + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LiveMigrationRequest' + description: One migration to be created. + required: true + responses: + '201': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LiveMigrationResponse' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Created + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Migrate One Local Managed Cluster to MongoDB Atlas + tags: + - Cloud Migration Service + /api/atlas/v2/groups/{groupId}/liveMigrations/validate: + post: + description: >- + Verifies whether the provided credentials, available disk space, MongoDB + versions, and so on meet the requirements of the migration request. If + the check passes, the migration can proceed. Your API Key must have the + Organization Owner role to successfully call this resource. + operationId: validateMigration + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LiveMigrationRequest' + description: One migration to be validated. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LiveImportValidation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Validate One Migration Request + tags: + - Cloud Migration Service + /api/atlas/v2/groups/{groupId}/liveMigrations/validate/{validationId}: + get: + description: >- + Return the status of one migration validation job. Your API Key must + have the Organization Owner role to successfully call this resource. + operationId: getValidationStatus + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the validation + job. + in: path + name: validationId + required: true + schema: + type: string + example: 507f1f77bcf86cd799439011 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LiveImportValidation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Migration Validation Job + tags: + - Cloud Migration Service + /api/atlas/v2/groups/{groupId}/liveMigrations/{liveMigrationId}: + get: + description: >- + Return details of one cluster migration job. Each push live migration + job uses one migration host. Your API Key must have the Organization + Member role to successfully call this resource. + operationId: getPushMigration + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/liveMigrationId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LiveMigrationResponse' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Migration Job + tags: + - Cloud Migration Service + /api/atlas/v2/groups/{groupId}/liveMigrations/{liveMigrationId}/cutover: + put: + description: >- + Cut over the migrated cluster to MongoDB Atlas. Confirm when the cut + over completes. When the cut over completes, MongoDB Atlas completes the + live migration process and stops synchronizing with the source cluster. + Your API Key must have the Organization Owner role to successfully call + this resource. + operationId: cutoverMigration + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/liveMigrationId' + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Cut Over the Migrated Cluster + tags: + - Cloud Migration Service + /api/atlas/v2/groups/{groupId}/maintenanceWindow: + delete: + description: >- + Resets the maintenance window for the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + Urgent maintenance activities such as security patches can't wait for + your chosen window. MongoDB Cloud starts those maintenance activities + when needed. After you schedule maintenance for your cluster, you can't + change your maintenance window until the current maintenance efforts + complete. The maintenance procedure that MongoDB Cloud performs requires + at least one replica set election during the maintenance window per + replica set. Maintenance always begins as close to the scheduled hour as + possible, but in-progress cluster updates or unexpected system issues + could delay the start time. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: resetMaintenanceWindow + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Reset One Maintenance Window for One Project + tags: + - Maintenance Windows + get: + description: >- + Returns the maintenance window for the specified project. MongoDB Cloud + starts those maintenance activities when needed. You can't change your + maintenance window until the current maintenance efforts complete. The + maintenance procedure that MongoDB Cloud performs requires at least one + replica set election during the maintenance window per replica set. + Maintenance always begins as close to the scheduled hour as possible, + but in-progress cluster updates or unexpected system issues could delay + the start time. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: getMaintenanceWindow + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupMaintenanceWindow' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Maintenance Window for One Project + tags: + - Maintenance Windows + patch: + description: >- + Updates the maintenance window for the specified project. Urgent + maintenance activities such as security patches can't wait for your + chosen window. MongoDB Cloud starts those maintenance activities when + needed. After you schedule maintenance for your cluster, you can't + change your maintenance window until the current maintenance efforts + complete. The maintenance procedure that MongoDB Cloud performs requires + at least one replica set election during the maintenance window per + replica set. Maintenance always begins as close to the scheduled hour as + possible, but in-progress cluster updates or unexpected system issues + could delay the start time. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: updateMaintenanceWindow + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupMaintenanceWindow' + description: Updates the maintenance window for the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Maintenance Window for One Project + tags: + - Maintenance Windows + /api/atlas/v2/groups/{groupId}/maintenanceWindow/autoDefer: + post: + description: >- + Toggles automatic deferral of the maintenance window for the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: toggleMaintenanceAutoDefer + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Toggle Automatic Deferral of Maintenance for One Project + tags: + - Maintenance Windows + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/maintenanceWindow/defer: + post: + description: >- + Defers the maintenance window for the specified project. Urgent + maintenance activities such as security patches can't wait for your + chosen window. MongoDB Cloud starts those maintenance activities when + needed. After you schedule maintenance for your cluster, you can't + change your maintenance window until the current maintenance efforts + complete. The maintenance procedure that MongoDB Cloud performs requires + at least one replica set election during the maintenance window per + replica set. Maintenance always begins as close to the scheduled hour as + possible, but in-progress cluster updates or unexpected system issues + could delay the start time. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: deferMaintenanceWindow + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Defer One Maintenance Window for One Project + tags: + - Maintenance Windows + /api/atlas/v2/groups/{groupId}/managedSlowMs/disable: + delete: + description: >- + Disables the slow operation threshold that MongoDB Cloud calculated for + the specified project. The threshold determines which operations the + Performance Advisor and Query Profiler considers slow. When enabled, + MongoDB Cloud uses the average execution time for operations on your + cluster to determine slow-running queries. As a result, the threshold is + more pertinent to your cluster workload. The slow operation threshold is + enabled by default for dedicated clusters (M10+). When disabled, MongoDB + Cloud considers any operation that takes longer than 100 milliseconds to + be slow. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: disableSlowOperationThresholding + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Disable Managed Slow Operation Threshold + tags: + - Performance Advisor + /api/atlas/v2/groups/{groupId}/managedSlowMs/enable: + post: + description: >- + Enables MongoDB Cloud to use its slow operation threshold for the + specified project. The threshold determines which operations the + Performance Advisor and Query Profiler considers slow. When enabled, + MongoDB Cloud uses the average execution time for operations on your + cluster to determine slow-running queries. As a result, the threshold is + more pertinent to your cluster workload. The slow operation threshold is + enabled by default for dedicated clusters (M10+). When disabled, MongoDB + Cloud considers any operation that takes longer than 100 milliseconds to + be slow. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: enableSlowOperationThresholding + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Enable Managed Slow Operation Threshold + tags: + - Performance Advisor + /api/atlas/v2/groups/{groupId}/peers: + get: + description: >- + Returns details about all network peering connections in the specified + project. Network peering allows multiple cloud-hosted applications to + securely connect to the same project. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listPeeringConnections + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Cloud service provider to use for this VPC peering connection. + in: query + name: providerName + schema: + type: string + default: AWS + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedContainerPeer' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Network Peering Connections in One Project + tags: + - Network Peering + post: + description: >- + Creates one new network peering connection in the specified project. + Network peering allows multiple cloud-hosted applications to securely + connect to the same project. To use this resource, the requesting API + Key must have the Project Owner role. To learn more about considerations + and prerequisites, see the Network Peering Documentation. + externalDocs: + description: Azure Network Peering Prerequisites + url: >- + https://docs.atlas.mongodb.com/reference/api/vpc-create-peering-connection/#prerequisites + operationId: createPeeringConnection + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + description: Create one network peering connection. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One New Network Peering Connection + tags: + - Network Peering + /api/atlas/v2/groups/{groupId}/peers/{peerId}: + delete: + description: >- + Removes one network peering connection in the specified project. If you + Removes the last network peering connection associated with a project, + MongoDB Cloud also removes any AWS security groups from the project IP + access list. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: deletePeeringConnection + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the network + peering connection that you want to delete. + in: path + name: peerId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/RequestAccepted' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Existing Network Peering Connection + tags: + - Network Peering + get: + description: >- + Returns details about one specified network peering connection in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: getPeeringConnection + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the network + peering connection that you want to retrieve. + in: path + name: peerId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Network Peering Connection in One Project + tags: + - Network Peering + patch: + description: >- + Updates one specified network peering connection in the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: updatePeeringConnection + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the network + peering connection that you want to update. + in: path + name: peerId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + description: Modify one network peering connection. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One New Network Peering Connection + tags: + - Network Peering + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/pipelines: + get: + description: >- + Returns a list of Data Lake Pipelines. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listPipelines + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/DataLakeIngestionPipeline' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Data Lake Pipelines from One Project + tags: + - Data Lake Pipelines + post: + description: Creates one Data Lake Pipeline. + operationId: createPipeline + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeIngestionPipeline' + description: Creates one Data Lake Pipeline. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeIngestionPipeline' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Data Lake Pipeline + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}: + delete: + description: Removes one Data Lake Pipeline. + operationId: deletePipeline + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Data Lake Pipeline + tags: + - Data Lake Pipelines + get: + description: >- + Returns the details of one Data Lake Pipeline within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getPipeline + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeIngestionPipeline' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Data Lake Pipeline + tags: + - Data Lake Pipelines + patch: + description: Updates one Data Lake Pipeline. + operationId: updatePipeline + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeIngestionPipeline' + description: Updates one Data Lake Pipeline. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeIngestionPipeline' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Data Lake Pipeline + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/availableSchedules: + get: + description: >- + Returns a list of backup schedule policy items that you can use as a + Data Lake Pipeline source. To use this resource, the requesting API Key + must have the Project Read Only role. + operationId: listPipelineSchedules + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/DiskBackupApiPolicyItem' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Available Ingestion Schedules for One Data Lake Pipeline + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/availableSnapshots: + get: + description: >- + Returns a list of backup snapshots that you can use to trigger an on + demand pipeline run. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: listPipelineSnapshots + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Date and time after which MongoDB Cloud created the snapshot. If + specified, MongoDB Cloud returns available backup snapshots created + after this time and date only. This parameter expresses its value in + the ISO 8601 timestamp format in UTC. + in: query + name: completedAfter + schema: + type: string + format: date-time + example: 2022-01-01T00:00:00.000Z + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedBackupSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Available Backup Snapshots for One Data Lake Pipeline + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/pause: + post: + description: >- + Pauses ingestion for a Data Lake Pipeline within the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: pausePipeline + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeIngestionPipeline' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Pause One Data Lake Pipeline + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/resume: + post: + description: >- + Resumes ingestion for a Data Lake Pipeline within the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: resumePipeline + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/DataLakeIngestionPipeline' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Resume One Data Lake Pipeline + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/runs: + get: + description: >- + Returns a list of past Data Lake Pipeline runs. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: listPipelineRuns + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + If specified, Atlas returns only Data Lake Pipeline runs initiated + before this time and date. + in: query + name: createdBefore + schema: + type: string + format: date-time + example: 2022-01-01T00:00:00.000Z + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedPipelineRun' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Data Lake Pipeline Runs from One Project + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/runs/{pipelineRunId}: + delete: + description: Deletes dataset that Atlas generated during the specified pipeline run. + operationId: deletePipelineRunDataset + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + - description: >- + Unique 24-hexadecimal character string that identifies a Data Lake + Pipeline run. + in: path + name: pipelineRunId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/RequestAccepted' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Delete Pipeline Run Dataset + tags: + - Data Lake Pipelines + get: + description: >- + Returns the details of one Data Lake Pipeline run within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getPipelineRun + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + - description: >- + Unique 24-hexadecimal character string that identifies a Data Lake + Pipeline run. + in: path + name: pipelineRunId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/IngestionPipelineRun' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Data Lake Pipeline Run + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/trigger: + post: + description: Triggers a Data Lake Pipeline ingestion of a specified snapshot. + operationId: triggerSnapshotIngestion + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TriggerIngestionPipelineRequest' + description: Triggers a single ingestion run of a snapshot. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/IngestionPipelineRun' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Trigger on demand snapshot ingestion + tags: + - Data Lake Pipelines + /api/atlas/v2/groups/{groupId}/privateEndpoint/endpointService: + post: + description: >- + Creates one private endpoint service for the specified cloud service + provider. This cloud service provider manages the private endpoint + service for the project. When you create a private endpoint service, + MongoDB Cloud creates a network container in the project for the cloud + provider for which you create the private endpoint service if one + doesn't already exist. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: createPrivateEndpointService + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudProviderEndpointServiceRequest' + description: Creates one private endpoint for the specified cloud service provider. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/EndpointService' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Private Endpoint Service for One Provider + tags: + - Private Endpoint Services + /api/atlas/v2/groups/{groupId}/privateEndpoint/regionalMode: + get: + description: >- + Checks whether each region in the specified cloud service provider can + create multiple private endpoints per region. The cloud service provider + manages the private endpoint for the project. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: getRegionalizedPrivateEndpointSetting + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ProjectSettingItem' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Regionalized Private Endpoint Status + tags: + - Private Endpoint Services + patch: + description: >- + Enables or disables the ability to create multiple private endpoints per + region in all cloud service providers in one project. The cloud service + provider manages the private endpoints for the project. Connection + strings to existing multi-region and global sharded clusters change when + you enable this setting. You must update your applications to use the + new connection strings. This might cause downtime. To use this resource, + the requesting API Key must have the Project Owner role and all clusters + in the deployment must be sharded clusters. Once enabled, you cannot + create replica sets. + operationId: toggleRegionalizedPrivateEndpointSetting + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ProjectSettingItem' + description: >- + Enables or disables the ability to create multiple private endpoints + per region in all cloud service providers in one project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ProjectSettingItem' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Toggle Regionalized Private Endpoint Status + tags: + - Private Endpoint Services + /api/atlas/v2/groups/{groupId}/privateEndpoint/serverless/instance/{instanceName}/endpoint: + get: + description: >- + Returns all private endpoints for one serverless instance. You must have + at least the Project Read Only role for the project to successfully call + this resource. + operationId: listServerlessPrivateEndpoints + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the serverless instance + associated with the tenant endpoint. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/ServerlessTenantEndpoint' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Private Endpoints for One Serverless Instance + tags: + - Serverless Private Endpoints + post: + description: >- + Creates one private endpoint for one serverless instance. To use this + resource, the requesting API Key must have the Project Owner role. + + A new endpoint won't be immediately available after creation. Read the steps in the linked tutorial for detailed guidance. + externalDocs: + description: Set Up a Private Endpoint for a Serverless Instance Tutorial + url: https://dochub.mongodb.org/core/serverless-private-endpoint + operationId: createServerlessPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the serverless instance for + which the tenant endpoint will be created. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessTenantCreateRequest' + description: >- + Information about the Private Endpoint to create for the Serverless + Instance. + required: true + responses: + '201': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessTenantEndpoint' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Created + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Private Endpoint for One Serverless Instance + tags: + - Serverless Private Endpoints + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/privateEndpoint/serverless/instance/{instanceName}/endpoint/{endpointId}: + delete: + description: >- + Remove one private endpoint from one serverless instance. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: deleteServerlessPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the serverless instance from + which the tenant endpoint will be removed. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the tenant + endpoint which will be removed. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Private Endpoint for One Serverless Instance + tags: + - Serverless Private Endpoints + x-xgen-experimental: true + get: + description: >- + Return one private endpoint for one serverless instance. Identify this + endpoint using its unique ID. You must have at least the Project Read + Only role for the project to successfully call this resource. + operationId: getServerlessPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the serverless instance + associated with the tenant endpoint. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the tenant + endpoint. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessTenantEndpoint' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Private Endpoint for One Serverless Instance + tags: + - Serverless Private Endpoints + x-xgen-experimental: true + patch: + description: >- + Updates one private endpoint for one serverless instance. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: updateServerlessPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the serverless instance + associated with the tenant endpoint that will be updated. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the tenant + endpoint which will be updated. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessTenantEndpointUpdate' + description: Object used for update. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessTenantEndpoint' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Private Endpoint for One Serverless Instance + tags: + - Serverless Private Endpoints + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService: + get: + description: >- + Returns the name, interfaces, and state of all private endpoint services + for the specified cloud service provider. This cloud service provider + manages the private endpoint service for the project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: listPrivateEndpointServices + parameters: + - $ref: '#/components/parameters/groupId' + - description: Cloud service provider that manages this private endpoint service. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/EndpointService' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Private Endpoint Services for One Provider + tags: + - Private Endpoint Services + /api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}: + delete: + description: >- + Removes one private endpoint service from the specified project. This + cloud service provider manages the private endpoint service that belongs + to the project. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: deletePrivateEndpointService + parameters: + - $ref: '#/components/parameters/groupId' + - description: Cloud service provider that manages this private endpoint service. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: >- + Unique 24-hexadecimal digit string that identifies the private + endpoint service that you want to delete. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Private Endpoint Service for One Provider + tags: + - Private Endpoint Services + get: + description: >- + Returns the name, interfaces, and state of the specified private + endpoint service from one project. The cloud service provider hosted + this private endpoint service that belongs to the project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getPrivateEndpointService + parameters: + - $ref: '#/components/parameters/groupId' + - description: Cloud service provider that manages this private endpoint service. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: >- + Unique 24-hexadecimal digit string that identifies the private + endpoint service that you want to return. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/EndpointService' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Private Endpoint Service for One Provider + tags: + - Private Endpoint Services + /api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}/endpoint: + post: + description: >- + Creates one private endpoint for the specified cloud service provider. + This cloud service provider manages the private endpoint service, which + in turn manages the private endpoints for the project. To use this + resource, the requesting API Key must have the Project Owner role. To + learn more about considerations, limitations, and prerequisites, see the + MongoDB documentation for setting up a private endpoint. + operationId: createPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: Cloud service provider that manages this private endpoint. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: >- + Unique 24-hexadecimal digit string that identifies the private + endpoint service for which you want to create a private endpoint. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CreateEndpointRequest' + description: Creates one private endpoint for the specified cloud service provider. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PrivateLinkEndpoint' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '402': + $ref: '#/components/responses/paymentRequired' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Private Endpoint for One Provider + tags: + - Private Endpoint Services + /api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}/endpoint/{endpointId}: + delete: + description: >- + Removes one private endpoint from the specified project and private + endpoint service, as managed by the specified cloud service provider. + When the last private endpoint is removed from a given private endpoint + service, that private endpoint service is also removed. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: deletePrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: Cloud service provider that manages this private endpoint. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: >- + Unique string that identifies the private endpoint you want to + delete. The format of the **endpointId** parameter differs for AWS + and Azure. You must URL encode the **endpointId** for Azure private + endpoints. + in: path + name: endpointId + required: true + schema: + type: string + pattern: >- + ^vpce-[0-9a-f]{17}|^%2[fF]subscriptions%2[fF][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]resource[gG]roups%2[fF]([-\w._()]+)%2[fF]providers%2[fF]Microsoft\.Network%2[fF]privateEndpoints%2[fF]([-\w._()]+) + - description: >- + Unique 24-hexadecimal digit string that identifies the private + endpoint service from which you want to delete a private endpoint. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Private Endpoint for One Provider + tags: + - Private Endpoint Services + get: + description: >- + Returns the connection state of the specified private endpoint. The + private endpoint service manages this private endpoint which belongs to + one project hosted from one cloud service provider. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: Cloud service provider that manages this private endpoint. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: >- + Unique string that identifies the private endpoint you want to + return. The format of the **endpointId** parameter differs for AWS + and Azure. You must URL encode the **endpointId** for Azure private + endpoints. + in: path + name: endpointId + required: true + schema: + type: string + pattern: >- + ^vpce-[0-9a-f]{17}|^%2[fF]subscriptions%2[fF][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]resource[gG]roups%2[fF]([-\w._()]+)%2[fF]providers%2[fF]Microsoft\.Network%2[fF]privateEndpoints%2[fF]([-\w._()]+) + - description: >- + Unique 24-hexadecimal digit string that identifies the private + endpoint service for which you want to return a private endpoint. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PrivateLinkEndpoint' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Private Endpoint for One Provider + tags: + - Private Endpoint Services + /api/atlas/v2/groups/{groupId}/privateIpMode: + get: + deprecated: true + description: >- + Verifies if someone set the specified project to **Connect via Peering + Only** mode. To use this resource, the requesting API Key must have the + Project Read Only role. + externalDocs: + description: Changes to Connection Strings + url: https://docs.atlas.mongodb.com/reference/faq/connection-changes/ + operationId: verifyConnectViaPeeringOnlyModeForOneProject + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PrivateIPMode' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Verify Connect via Peering Only Mode for One Project + tags: + - Network Peering + x-xgen-experimental: true + patch: + deprecated: true + description: >- + Disables Connect via Peering Only mode for the specified project. To use + this resource, the requesting API Key must have the Project Owner role. + externalDocs: + description: Changes to Connection Strings + url: https://docs.atlas.mongodb.com/reference/faq/connection-changes/ + operationId: disablePeering + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PrivateIPMode' + description: Disables Connect via Peering Only mode for the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PrivateIPMode' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Disable Connect via Peering Only Mode for One Project + tags: + - Network Peering + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/privateNetworkSettings/endpointIds: + get: + description: >- + Returns all private endpoints for Federated Database Instances and + Online Archives in the specified project. To use this resource, the + requesting API Key must have the Project Read Only or Project Charts + Admin roles. + operationId: listDataFederationPrivateEndpoints + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedPrivateNetworkEndpointIdEntry' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Return All Federated Database Instance and Online Archive Private + Endpoints in One Project + tags: + - Data Federation + post: + description: >- + Adds one private endpoint for Federated Database Instances and Online + Archives to the specified projects. If the endpoint ID already exists + and the associated comment is unchanged, Atlas Data Federation makes no + change to the endpoint ID list. If the endpoint ID already exists and + the associated comment is changed, Atlas Data Federation updates the + comment value only in the endpoint ID list. If the endpoint ID doesn't + exist, Atlas Data Federation appends the new endpoint to the list of + endpoints in the endpoint ID list. Each region has an associated service + name for the various endpoints in each region. + + `us-east-1` is `com.amazonaws.vpce.us-east-1.vpce-svc-00e311695874992b4`. + + `us-west-1` is `com.amazonaws.vpce.us-west-2.vpce-svc-09d86b19e59d1b4bb`. + + `eu-west-1` is `com.amazonaws.vpce.eu-west-1.vpce-svc-0824460b72e1a420e`. + + `eu-west-2` is `com.amazonaws.vpce.eu-west-2.vpce-svc-052f1840aa0c4f1f9`. + + `eu-central-1` is `com.amazonaws.vpce.eu-central-1.vpce-svc-0ac8ce91871138c0d`. + + `sa-east-1` is `com.amazonaws.vpce.sa-east-1.vpce-svc-0b56e75e8cdf50044`. + + `ap-southeast-2` is `com.amazonaws.vpce.ap-southeast-2.vpce-svc-036f1de74d761706e`. + + `ap-south-1` is `com.amazonaws.vpce.ap-south-1.vpce-svc-03eb8a541f96d356d`. + + To use this resource, the requesting API Key must have the Project Owner or Project Charts Admin roles. + operationId: createDataFederationPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PrivateNetworkEndpointIdEntry' + description: >- + Private endpoint for Federated Database Instances and Online Archives + to add to the specified project. + required: true + responses: + '201': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedPrivateNetworkEndpointIdEntry' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Create One Federated Database Instance and Online Archive Private + Endpoint for One Project + tags: + - Data Federation + /api/atlas/v2/groups/{groupId}/privateNetworkSettings/endpointIds/{endpointId}: + delete: + description: >- + Removes one private endpoint for Federated Database Instances and Online + Archives in the specified project. To use this resource, the requesting + API Key must have the Project Owner role. + operationId: deleteDataFederationPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 22-character alphanumeric string that identifies the private + endpoint to remove. Atlas Data Federation supports AWS private + endpoints using the AWS PrivateLink feature. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 22 + minLength: 22 + pattern: ^vpce-[0-9a-f]{17}$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Remove One Federated Database Instance and Online Archive Private + Endpoint from One Project + tags: + - Data Federation + get: + description: >- + Returns the specified private endpoint for Federated Database Instances + or Online Archives in the specified project. To use this resource, the + requesting API Key must have the Project Read Only or Project Charts + Admin roles. + operationId: getDataFederationPrivateEndpoint + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 22-character alphanumeric string that identifies the private + endpoint to return. Atlas Data Federation supports AWS private + endpoints using the AWS PrivateLink feature. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 22 + minLength: 22 + pattern: ^vpce-[0-9a-f]{17}$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PrivateNetworkEndpointIdEntry' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Return One Federated Database Instance and Online Archive Private + Endpoint in One Project + tags: + - Data Federation + /api/atlas/v2/groups/{groupId}/processes: + get: + description: >- + Returns details of all processes for the specified project. A MongoDB + process can be either a `mongod` or `mongos`. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listAtlasProcesses + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedHostView_Atlas' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All MongoDB Processes in One Project + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/processes/{processId}: + get: + description: >- + Returns the processes for the specified host for the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getAtlasProcess + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiHostView_Atlas' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One MongoDB Process by ID + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/processes/{processId}/databases: + get: + description: >- + Returns the list of databases running on the specified host for the + specified project. `M0` free clusters, `M2`, `M5`, and serverless + clusters have some [operational + limits](https://www.mongodb.com/docs/atlas/reference/free-shared-limitations/#operational-limitations). + The MongoDB Cloud process must be a `mongod`. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listDatabases + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod`). The port must be the IANA port on which the MongoDB + process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedDatabase' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Available Databases for One MongoDB Process + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/processes/{processId}/databases/{databaseName}: + get: + description: >- + Returns one database running on the specified host for the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getDatabase + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the database that the specified + MongoDB process serves. + in: path + name: databaseName + required: true + schema: + type: string + - description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/MesurementsDatabase' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Database for a MongoDB Process + tags: + - Monitoring and Logs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/processes/{processId}/databases/{databaseName}/measurements: + get: + description: >- + Returns the measurements of one database for the specified host for the + specified project. Returns the database's on-disk storage space based on + the MongoDB `dbStats` command output. To calculate some metric series, + Atlas takes the rate between every two adjacent points. For these metric + series, the first data point has a null value because Atlas can't + calculate a rate for the first data point given the query time range. + Atlas retrieves database metrics every 20 minutes but reduces frequency + when necessary to optimize database performance. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: getDatabaseMeasurements + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the database that the specified + MongoDB process serves. + in: path + name: databaseName + required: true + schema: + type: string + - description: >- + One or more types of measurement to request for this MongoDB + process. If omitted, the resource returns all measurements. To + specify multiple values for `m`, repeat the `m` parameter for each + value. Specify measurements that apply to the specified host. + MongoDB Cloud returns an error if you specified any invalid + measurements. + in: query + name: m + schema: + type: array + items: + type: string + description: One measurement requested for this MongoDB process. + maxItems: 10 + minItems: 1 + uniqueItems: true + style: form + - description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: '#/components/parameters/granularity' + - $ref: '#/components/parameters/period' + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/end' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiMeasurementsGeneralView_Atlas' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + summary: Return Measurements of One Database for One MongoDB Process + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/processes/{processId}/disks: + get: + description: >- + Returns the list of disks or partitions for the specified host for the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: listDiskPartitions + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedDiskPartition' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Available Disks for One MongoDB Process + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/processes/{processId}/disks/{partitionName}: + get: + description: >- + Returns measurement details for one disk or partition for the specified + host for the specified project. To use this resource, the requesting API + Key must have the Project Read Only role. + operationId: listDiskMeasurements + parameters: + - description: >- + Human-readable label of the disk or partition to which the + measurements apply. + in: path + name: partitionName + required: true + schema: + type: string + - $ref: '#/components/parameters/groupId' + - description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/MeasurementDiskPartition' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Measurements of One Disk + tags: + - Monitoring and Logs + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/processes/{processId}/disks/{partitionName}/measurements: + get: + description: >- + Returns the measurements of one disk or partition for the specified host + for the specified project. Returned value can be one of the following: + + - Throughput of I/O operations for the disk partition used for the + MongoDB process + + - Percentage of time during which requests the partition issued and + serviced + + - Latency per operation type of the disk partition used for the MongoDB + process + + - Amount of free and used disk space on the disk partition used for the + MongoDB process + + + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getDiskMeasurements + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + One or more types of measurement to request for this MongoDB + process. If omitted, the resource returns all measurements. To + specify multiple values for `m`, repeat the `m` parameter for each + value. Specify measurements that apply to the specified host. + MongoDB Cloud returns an error if you specified any invalid + measurements. + in: query + name: m + schema: + type: array + items: + type: string + description: One measurement requested for this MongoDB process. + maxItems: 10 + minItems: 1 + uniqueItems: true + style: form + - description: >- + Human-readable label of the disk or partition to which the + measurements apply. + in: path + name: partitionName + required: true + schema: + type: string + - description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: '#/components/parameters/granularity' + - $ref: '#/components/parameters/period' + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/end' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiMeasurementsGeneralView_Atlas' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Measurements of One Disk for One MongoDB Process + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/processes/{processId}/measurements: + get: + description: >- + Returns disk, partition, or host measurements per process for the + specified host for the specified project. Returned value can be one of + the following: + + - Throughput of I/O operations for the disk partition used for the + MongoDB process + + - Percentage of time during which requests the partition issued and + serviced + + - Latency per operation type of the disk partition used for the MongoDB + process + + - Amount of free and used disk space on the disk partition used for the + MongoDB process + + - Measurements for the host, such as CPU usage or number of I/O + operations + + + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getHostMeasurements + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + One or more types of measurement to request for this MongoDB + process. If omitted, the resource returns all measurements. To + specify multiple values for `m`, repeat the `m` parameter for each + value. Specify measurements that apply to the specified host. + MongoDB Cloud returns an error if you specified any invalid + measurements. + in: query + name: m + schema: + type: array + items: + type: string + description: One measurement requested for this MongoDB process. + maxItems: 10 + minItems: 1 + uniqueItems: true + style: form + - $ref: '#/components/parameters/period' + - description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: '#/components/parameters/granularity' + - $ref: '#/components/parameters/start' + - $ref: '#/components/parameters/end' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiMeasurementsGeneralView_Atlas' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Measurements for One MongoDB Process + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/namespaces: + get: + description: >- + Returns up to 20 namespaces for collections experiencing slow queries on + the specified host. If you specify a secondary member of a replica set + that hasn't received any database read operations, the endpoint doesn't + return any namespaces. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: listSlowQueryNamespaces + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Length of time expressed during which the query finds suggested + indexes among the managed namespaces in the cluster. This parameter + expresses its value in milliseconds. + + + - If you don't specify the **since** parameter, the endpoint returns + data covering the duration before the current time. + + - If you specify neither the **duration** nor **since** parameters, + the endpoint returns data from the previous 24 hours. + in: query + name: duration + schema: + type: integer + format: int64 + - description: >- + Combination of host and port that serves the MongoDB process. The + host must be the hostname, FQDN, IPv4 address, or IPv6 address of + the host that runs the MongoDB process (`mongod` or `mongos`). The + port must be the IANA port on which the MongoDB process listens for + requests. + in: path + name: processId + required: true + schema: + type: string + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - description: >- + Date and time from which the query retrieves the suggested indexes. + This parameter expresses its value in the number of seconds that + have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + + + - If you don't specify the **duration** parameter, the endpoint + returns data covering from the **since** value and the current time. + + - If you specify neither the **duration** nor the **since** + parameters, the endpoint returns data from the previous 24 hours. + in: query + name: since + schema: + type: integer + format: int64 + minimum: 1199145600 + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Namespaces' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Namespaces for One Host + tags: + - Performance Advisor + /api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/slowQueryLogs: + get: + description: >- + Returns log lines for slow queries that the Performance Advisor and + Query Profiler identified. The Performance Advisor monitors queries that + MongoDB considers slow and suggests new indexes to improve query + performance. MongoDB Cloud bases the threshold for slow queries on the + average time of operations on your cluster. This enables + workload-relevant recommendations. To use this resource, the requesting + API Key must have the Project Data Access Read Write role. + operationId: listSlowQueries + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Length of time expressed during which the query finds slow queries + among the managed namespaces in the cluster. This parameter + expresses its value in milliseconds. + + + - If you don't specify the **since** parameter, the endpoint returns + data covering the duration before the current time. + + - If you specify neither the **duration** nor **since** parameters, + the endpoint returns data from the previous 24 hours. + in: query + name: duration + schema: + type: integer + format: int64 + - description: >- + Namespaces from which to retrieve slow queries. A namespace consists + of one database and one collection resource written as `.`: + `.`. To include multiple namespaces, pass the + parameter multiple times delimited with an ampersand (`&`) between + each namespace. Omit this parameter to return results for all + namespaces. + in: query + name: namespaces + schema: + type: array + items: + type: string + style: form + - description: Maximum number of lines from the log to return. + in: query + name: nLogs + schema: + type: integer + format: int64 + default: 20000 + maximum: 20000 + minimum: 0 + - description: >- + Combination of host and port that serves the MongoDB process. The + host must be the hostname, FQDN, IPv4 address, or IPv6 address of + the host that runs the MongoDB process (`mongod` or `mongos`). The + port must be the IANA port on which the MongoDB process listens for + requests. + in: path + name: processId + required: true + schema: + type: string + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - description: >- + Date and time from which the query retrieves the slow queries. This + parameter expresses its value in the number of seconds that have + elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + + + - If you don't specify the **duration** parameter, the endpoint + returns data covering from the **since** value and the current time. + + - If you specify neither the **duration** nor the **since** + parameters, the endpoint returns data from the previous 24 hours. + in: query + name: since + schema: + type: integer + format: int64 + minimum: 1199145600 + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PerformanceAdvisorSlowQueryList' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Slow Queries + tags: + - Performance Advisor + /api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/suggestedIndexes: + get: + description: >- + Returns the indexes that the Performance Advisor suggests. The + Performance Advisor monitors queries that MongoDB considers slow and + suggests new indexes to improve query performance. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: listSuggestedIndexes + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Length of time expressed during which the query finds suggested + indexes among the managed namespaces in the cluster. This parameter + expresses its value in milliseconds. + + + - If you don't specify the **since** parameter, the endpoint returns + data covering the duration before the current time. + + - If you specify neither the **duration** nor **since** parameters, + the endpoint returns data from the previous 24 hours. + in: query + name: duration + schema: + type: integer + format: int64 + - description: >- + Namespaces from which to retrieve suggested indexes. A namespace + consists of one database and one collection resource written as `.`: + `.`. To include multiple namespaces, pass the + parameter multiple times delimited with an ampersand (`&`) between + each namespace. Omit this parameter to return results for all + namespaces. + in: query + name: namespaces + schema: + type: array + items: + type: string + style: form + - description: >- + Maximum number of example queries that benefit from the suggested + index. + in: query + name: nExamples + schema: + type: integer + format: int64 + default: 5 + - description: Number that indicates the maximum indexes to suggest. + in: query + name: nIndexes + schema: + type: integer + format: int64 + - description: >- + Combination of host and port that serves the MongoDB process. The + host must be the hostname, FQDN, IPv4 address, or IPv6 address of + the host that runs the MongoDB process (`mongod` or `mongos`). The + port must be the IANA port on which the MongoDB process listens for + requests. + in: path + name: processId + required: true + schema: + type: string + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - description: >- + Date and time from which the query retrieves the suggested indexes. + This parameter expresses its value in the number of seconds that + have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + + + - If you don't specify the **duration** parameter, the endpoint + returns data covering from the **since** value and the current time. + + - If you specify neither the **duration** nor the **since** + parameters, the endpoint returns data from the previous 24 hours. + in: query + name: since + schema: + type: integer + format: int64 + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PerformanceAdvisorResponse' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Suggested Indexes + tags: + - Performance Advisor + /api/atlas/v2/groups/{groupId}/pushBasedLogExport: + delete: + description: >- + Disables the push-based log export feature by resetting the project + level settings to its default configuration. + operationId: deletePushBasedLogConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Disable the push-based log export feature for a project + tags: + - Push-Based Log Export + x-xgen-experimental: true + get: + description: >- + Fetches the current project level settings for the push-based log export + feature. + operationId: getPushBasedLogConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PushBasedLogExportProject' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Get the push-based log export configuration for a project + tags: + - Push-Based Log Export + x-xgen-experimental: true + patch: + description: >- + Updates the project level settings for the push-based log export + feature. + operationId: updatePushBasedLogConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PushBasedLogExportProject' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: >- + The project configuration details. The S3 bucket name, IAM role ID, + and prefix path fields are the only fields that may be specified. + Fields left unspecified will not be modified. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update the push-based log export feature for a project + tags: + - Push-Based Log Export + x-xgen-experimental: true + post: + description: >- + Configures the project level settings for the push-based log export + feature. + operationId: createPushBasedLogConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PushBasedLogExportProject' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: >- + The project configuration details. The S3 bucket name, IAM role ID, + and prefix path fields are required. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Enable the push-based log export feature for a project + tags: + - Push-Based Log Export + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/sampleDatasetLoad/{name}: + post: + description: >- + Requests loading the MongoDB sample dataset into the specified cluster. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: loadSampleDataset + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the cluster into which you load + the sample dataset. + in: path + name: name + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '201': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/SampleDatasetStatus' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Created + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Load Sample Dataset Request into Cluster + tags: + - Clusters + /api/atlas/v2/groups/{groupId}/sampleDatasetLoad/{sampleDatasetId}: + get: + description: >- + Checks the progress of loading the sample dataset into one cluster. To + use this resource, the requesting API Key must have the Project Owner + role. + operationId: getSampleDatasetLoadStatus + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the loaded sample + dataset. + in: path + name: sampleDatasetId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/SampleDatasetStatus' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Check Status of Cluster Sample Dataset Request + tags: + - Clusters + /api/atlas/v2/groups/{groupId}/serverless: + get: + description: >- + Returns details for all serverless instances in the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listServerlessInstances + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedServerlessInstanceDescription' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Serverless Instances from One Project + tags: + - Serverless Instances + post: + description: >- + Creates one serverless instance in the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: createServerlessInstance + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessInstanceDescriptionCreate' + description: Create One Serverless Instance in One Project. + required: true + responses: + '201': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessInstanceDescription' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Created + '400': + $ref: '#/components/responses/badRequest' + '402': + $ref: '#/components/responses/paymentRequired' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Serverless Instance in One Project + tags: + - Serverless Instances + /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/restoreJobs: + get: + description: >- + Returns all restore jobs for one serverless instance from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: listServerlessBackupRestoreJobs + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Human-readable label that identifies the serverless instance. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: >- + #/components/schemas/PaginatedApiAtlasServerlessBackupRestoreJob + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Restore Jobs for One Serverless Instance + tags: + - Cloud Backups + post: + description: >- + Restores one snapshot of one serverless instance from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: createServerlessBackupRestoreJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Human-readable label that identifies the serverless instance whose + snapshot you want to restore. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessBackupRestoreJob' + description: >- + Restores one snapshot of one serverless instance from the specified + project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessBackupRestoreJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Restore One Snapshot of One Serverless Instance + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/restoreJobs/{restoreJobId}: + get: + description: >- + Returns one restore job for one serverless instance from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: getServerlessBackupRestoreJob + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the serverless instance. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the restore job + to return. + in: path + name: restoreJobId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessBackupRestoreJob' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Restore Job for One Serverless Instance + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/snapshots: + get: + description: >- + Returns all snapshots of one serverless instance from the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: listServerlessBackups + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Human-readable label that identifies the serverless instance. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiAtlasServerlessBackupSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Snapshots of One Serverless Instance + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/snapshots/{snapshotId}: + get: + description: >- + Returns one snapshot of one serverless instance from the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getServerlessBackup + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the serverless instance. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: >- + Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessBackupSnapshot' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Snapshot of One Serverless Instance + tags: + - Cloud Backups + /api/atlas/v2/groups/{groupId}/serverless/{name}: + delete: + description: >- + Removes one serverless instance from the specified project. The + serverless instance must have termination protection disabled in order + to be deleted. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: deleteServerlessInstance + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the serverless instance. + in: path + name: name + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Serverless Instance from One Project + tags: + - Serverless Instances + get: + description: >- + Returns details for one serverless instance in the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getServerlessInstance + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the serverless instance. + in: path + name: name + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessInstanceDescription' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Serverless Instance from One Project + tags: + - Serverless Instances + patch: + description: >- + Updates one serverless instance in the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: updateServerlessInstance + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the serverless instance. + in: path + name: name + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessInstanceDescriptionUpdate' + description: Update One Serverless Instance in One Project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ServerlessInstanceDescription' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '402': + $ref: '#/components/responses/paymentRequired' + '409': + $ref: '#/components/responses/conflict' + security: + - DigestAuth: [] + summary: Update One Serverless Instance in One Project + tags: + - Serverless Instances + /api/atlas/v2/groups/{groupId}/settings: + get: + description: >- + Returns details about the specified project's settings. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getProjectSettings + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Project Settings + tags: + - Projects + patch: + description: >- + Updates the settings of the specified project. You can update any of the + options available. MongoDB cloud only updates the options provided in + the request. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: updateProjectSettings + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupSettings' + description: Settings to update. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/GroupSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Project Settings + tags: + - Projects + /api/atlas/v2/groups/{groupId}/streams: + get: + description: Returns all stream instances for the specified project. + operationId: listStreamInstances + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiStreamsTenant' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Project Stream Instances + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + post: + description: >- + Creates one stream instance in the specified project. To use this + resource, the requesting API Key must have the Project Owner roles. + operationId: createStreamInstance + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsTenant' + description: Details to create one streams instance in the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsTenant' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Stream Instance + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/streams/{tenantName}: + delete: + description: >- + Delete one stream instance in the specified project. To use this + resource, the requesting API Key must have the Project Owner roles. + operationId: deleteStreamInstance + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the stream instance to delete. + in: path + name: tenantName + required: true + schema: + type: string + responses: + '202': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: Accepted + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Delete One Stream Instance + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + get: + description: >- + Returns the details of one stream instance within the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getStreamInstance + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the stream instance to return. + in: path + name: tenantName + required: true + schema: + type: string + - description: >- + Flag to indicate whether connections information should be included + in the stream instance. + in: query + name: includeConnections + schema: + type: boolean + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsTenant' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Stream Instance + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + patch: + description: >- + Update one stream instance in the specified project. To use this + resource, the requesting API Key must have the Project Owner roles. + operationId: updateStreamInstance + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the stream instance to update. + in: path + name: tenantName + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsDataProcessRegion' + description: >- + Details of the new data process region to update in the streams + instance. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsTenant' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Stream Instance + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections: + get: + description: >- + Returns all connections of the stream instance for the specified + project. + operationId: listStreamConnections + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiStreamsConnection' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Connections Of The Stream Instances + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + post: + description: >- + Creates one connection for a stream instance in the specified project. + To use this resource, the requesting API Key must have the Project Owner + roles. + operationId: createStreamConnection + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsConnection' + description: >- + Details to create one connection for a streams instance in the + specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsConnection' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '409': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Connection + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}: + delete: + description: >- + Delete one connection of the specified stream instance. To use this + resource, the requesting API Key must have the Project Owner roles. + operationId: deleteStreamConnection + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + - description: Human-readable label that identifies the stream connection. + in: path + name: connectionName + required: true + schema: + type: string + responses: + '202': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: Accepted + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Delete One Stream Connection + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + get: + description: >- + Returns the details of one stream connection within the specified stream + instance. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getStreamConnection + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the stream instance to return. + in: path + name: tenantName + required: true + schema: + type: string + - description: >- + Human-readable label that identifies the stream connection to + return. + in: path + name: connectionName + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsConnection' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Stream Connection + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + patch: + description: >- + Update one connection for the specified stream instance in the specified + project. To use this resource, the requesting API Key must have the + Project Owner roles. + operationId: updateStreamConnection + parameters: + - $ref: '#/components/parameters/groupId' + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + - description: Human-readable label that identifies the stream connection. + in: path + name: connectionName + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsConnection' + description: >- + Details to update one connection for a streams instance in the + specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: '#/components/schemas/StreamsConnection' + x-xgen-version: 2023-02-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Stream Connection + tags: + - Streams + x-xgen-changelog: + Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- + The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/teams: + get: + description: >- + Returns all teams to which the authenticated user has access in the + project specified using its unique 24-hexadecimal digit identifier. All + members of the team share the same project access. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: listProjectTeams + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedTeamRole' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Teams in One Project + tags: + - Teams + post: + description: >- + Adds one team to the specified project. All members of the team share + the same project access. MongoDB Cloud limits the number of users to a + maximum of 100 teams per project and a maximum of 250 teams per + organization. To use this resource, the requesting API Key must have the + Project Owner role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: addAllTeamsToProject + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/TeamRole' + description: Team to add to the specified project. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedTeamRole' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Add One or More Teams to One Project + tags: + - Teams + /api/atlas/v2/groups/{groupId}/teams/{teamId}: + delete: + description: >- + Removes one team specified using its unique 24-hexadecimal digit + identifier from the project specified using its unique 24-hexadecimal + digit identifier. To use this resource, the requesting API Key must have + the Project Owner role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: removeProjectTeam + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the team that you + want to remove from the specified project. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Team from One Project + tags: + - Teams + patch: + description: >- + Updates the project roles assigned to the specified team. You can grant + team roles for specific projects and grant project access roles to users + in the team. All members of the team share the same project access. To + use this resource, the requesting API Key must have the Project Owner + role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: updateTeamRoles + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the team for + which you want to update roles. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TeamRole' + description: The project roles assigned to the specified team. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedTeamRole' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Team Roles in One Project + tags: + - Teams + /api/atlas/v2/groups/{groupId}/userSecurity: + get: + description: >- + Returns the current LDAP configuration for the specified project. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: getLDAPConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserSecurity' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return the Current LDAP or X.509 Configuration + tags: + - LDAP Configuration + patch: + description: >- + Edits the LDAP configuration for the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + + + Updating this configuration triggers a rolling restart of the database. + operationId: saveLDAPConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserSecurity' + description: Updates the LDAP configuration for the specified project. + required: true + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserSecurity' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Edit the LDAP or X.509 Configuration + tags: + - LDAP Configuration + /api/atlas/v2/groups/{groupId}/userSecurity/customerX509: + delete: + description: >- + Clears the customer-managed X.509 settings on a project, including the + uploaded Certificate Authority, which disables self-managed X.509. + + Updating this configuration triggers a rolling restart of the database. You must have the Project Owner role to use this endpoint. + operationId: disableCustomerManagedX509 + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserSecurity' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Disable Customer-Managed X.509 + tags: + - X.509 Authentication + /api/atlas/v2/groups/{groupId}/userSecurity/ldap/userToDNMapping: + delete: + description: >- + Removes the current LDAP Distinguished Name mapping captured in the + ``userToDNMapping`` document from the LDAP configuration for the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: deleteLDAPConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserSecurity' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove the Current LDAP User to DN Mapping + tags: + - LDAP Configuration + /api/atlas/v2/groups/{groupId}/userSecurity/ldap/verify: + post: + description: >- + Verifies the LDAP configuration for the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: verifyLDAPConfiguration + parameters: + - $ref: '#/components/parameters/groupId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequestParams' + description: >- + The LDAP configuration for the specified project that you want to + verify. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequest' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Verify the LDAP Configuration in One Project + tags: + - LDAP Configuration + /api/atlas/v2/groups/{groupId}/userSecurity/ldap/verify/{requestId}: + get: + description: >- + Returns the status of one request to verify one LDAP configuration for + the specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: getLDAPConfigurationStatus + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique string that identifies the request to verify an LDAP + configuration. + in: path + name: requestId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequest' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return the Status of One Verify LDAP Configuration Request + tags: + - LDAP Configuration + /api/atlas/v2/groups/{groupId}/users: + get: + description: >- + Returns details about all users in the specified project. Users belong + to an organization. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: listProjectUsers + parameters: + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Flag that indicates whether the returned list should include users + who belong to a team with a role in this project. You might not have + assigned the individual users a role in this project. If + `"flattenTeams" : false`, this resource returns only users with a + role in the project. If `"flattenTeams" : true`, this resource + returns both users with roles in the project and users who belong to + teams with roles in the project. + in: query + name: flattenTeams + schema: + type: boolean + default: false + - description: >- + Flag that indicates whether the returned list should include users + with implicit access to the project, the Organization Owner or + Organization Read Only role. You might not have assigned the + individual users a role in this project. If `"includeOrgUsers": + false`, this resource returns only users with a role in the project. + If `"includeOrgUsers": true`, this resource returns both users with + roles in the project and users who have implicit access to the + project through their organization role. + in: query + name: includeOrgUsers + schema: + type: boolean + default: false + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedAppUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Users in One Project + tags: + - Projects + /api/atlas/v2/groups/{groupId}/users/{userId}: + delete: + description: >- + Removes the specified user from the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: removeProjectUser + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal string that identifies MongoDB Cloud user you + want to remove from the specified project. To return a application + user's ID using their application username, use the Get All + application users in One Project endpoint. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One User from One Project + tags: + - Projects + /api/atlas/v2/groups/{groupId}/users/{userId}/roles: + put: + description: >- + Updates the roles of the specified user in the specified project. To + specify the user to update, provide the unique 24-hexadecimal digit + string that identifies the user in the specified project. To use this + resource, the requesting API Key must have the Group User Admin role. + operationId: updateProjectRoles + parameters: + - $ref: '#/components/parameters/groupId' + - description: >- + Unique 24-hexadecimal digit string that identifies the user to + modify. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UpdateGroupRolesForUser' + description: Roles to update for the specified user. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UpdateGroupRolesForUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Project Roles for One MongoDB Cloud User + tags: + - Projects + x-xgen-experimental: true + /api/atlas/v2/orgs: + get: + description: >- + Returns all organizations to which the requesting API Key has access. To + use this resource, the requesting API Key must have the Organization + Member role. + operationId: listOrganizations + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + - description: >- + Human-readable label of the organization to use to filter the + returned list. Performs a case-insensitive search for an + organization that starts with the specified name. + in: query + name: name + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedOrganization' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Organizations + tags: + - Organizations + post: + description: >- + Creates one organization in MongoDB Cloud and links it to the requesting + API Key's organization. To use this resource, the requesting API Key + must have the Organization Owner role. The requesting API Key's + organization must be a paying organization. To learn more, see + [Configure a Paying + Organization](https://www.mongodb.com/docs/atlas/billing/#configure-a-paying-organization) + in the MongoDB Atlas documentation. + operationId: createOrganization + parameters: [] + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CreateOrganizationRequest' + description: Organization that you want to create. + required: true + responses: + '201': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CreateOrganizationResponse' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Created + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Organization + tags: + - Organizations + /api/atlas/v2/orgs/{orgId}: + delete: + description: >- + Removes one specified organization. MongoDB Cloud imposes the following + limits on this resource: + + - Organizations with active projects cannot be removed. + - All projects in the organization must be removed before you can remove the organization. + To use this resource, the requesting API Key must have the Organization Owner role. + operationId: deleteOrganization + parameters: + - $ref: '#/components/parameters/orgId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '402': + $ref: '#/components/responses/paymentRequired' + '403': + $ref: '#/components/responses/forbidden' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Organization + tags: + - Organizations + get: + description: >- + Returns one organization to which the requesting API key has access. To + use this resource, the requesting API Key must have the Organization + Member role. + operationId: getOrganization + parameters: + - $ref: '#/components/parameters/orgId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AtlasOrganization' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Organization + tags: + - Organizations + patch: + description: >- + Renames one organization. To use this resource, the requesting API Key + must have the Organization Owner role. + operationId: renameOrganization + parameters: + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AtlasOrganization' + description: Details to update on the specified organization. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/AtlasOrganization' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Rename One Organization + tags: + - Organizations + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/apiKeys: + get: + description: >- + Returns all organization API keys for the specified organization. The + organization API keys grant programmatic access to an organization. You + can't use the API key to log into MongoDB Cloud through the console. To + use this resource, the requesting API Key must have the Organization + Member role. + externalDocs: + description: Programmatic API Keys + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: listApiKeys + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/orgId' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiApiUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Organization API Keys + tags: + - Programmatic API Keys + post: + description: >- + Creates one API key for the specified organization. An organization API + key grants programmatic access to an organization. You can't use the API + key to log into the console. To use this resource, the requesting API + Key must have the Organization Owner role. + externalDocs: + description: Programmatic API Keys + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: createApiKey + parameters: + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CreateAtlasOrganizationApiKey' + description: Organization API Key to be created. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiKeyUserDetails' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Organization API Key + tags: + - Programmatic API Keys + /api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}: + delete: + description: >- + Removes one organization API key from the specified organization. When + you remove an API key from an organization, MongoDB Cloud also removes + that key from any projects that use that key. To use this resource, the + requesting API Key must have the Organization Owner role. + externalDocs: + description: Configure Atlas API Access + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + operationId: deleteApiKey + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Organization API Key + tags: + - Programmatic API Keys + get: + description: >- + Returns one organization API key. The organization API keys grant + programmatic access to an organization. You can't use the API key to log + into MongoDB Cloud through the user interface. To use this resource, the + requesting API Key must have the Organization Member role. + externalDocs: + description: Programmatic API Keys + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: getApiKey + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key that you want to update. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiKeyUserDetails' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Organization API Key + tags: + - Programmatic API Keys + patch: + description: >- + Updates one organization API key in the specified organization. The + organization API keys grant programmatic access to an organization. To + use this resource, the requesting API Key must have the Organization + Owner role. + externalDocs: + description: Programmatic API Keys + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: updateApiKey + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key you want to update. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UpdateAtlasOrganizationApiKey' + description: >- + Organization API key to be updated. This request requires a minimum of + one of the two body parameters. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/ApiKeyUserDetails' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Organization API Key + tags: + - Programmatic API Keys + /api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}/accessList: + get: + description: >- + Returns all access list entries that you configured for the specified + organization API key. To use this resource, the requesting API Key must + have the Organization Member role. + externalDocs: + description: Programmatic API Keys + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#view-the-details-of-one-api-key-in-one-organization + operationId: listApiKeyAccessListsEntries + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/orgId' + - $ref: '#/components/parameters/pageNum' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key for which you want to return access list entries. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiUserAccessList' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Access List Entries for One Organization API Key + tags: + - Programmatic API Keys + post: + description: >- + Creates the access list entries for the specified organization API key. + Resources require all API requests originate from IP addresses on the + API access list. To use this resource, the requesting API Key must have + the Read Write role. + operationId: createApiKeyAccessList + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/orgId' + - $ref: '#/components/parameters/pageNum' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key for which you want to create a new access list entry. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/UserAccessList' + description: >- + Access list entries to be created for the specified organization API + key. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiUserAccessList' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create Access List Entries for One Organization API Key + tags: + - Programmatic API Keys + /api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}/accessList/{ipAddress}: + delete: + description: >- + Removes the specified access list entry from the specified organization + API key. Resources require all API requests originate from the IP + addresses on the API access list. To use this resource, the requesting + API Key must have the Read Write role. In addition, you cannot remove + the requesting IP address from the requesting organization API key. + externalDocs: + description: Configure Atlas API Access + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + operationId: deleteApiKeyAccessListEntry + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key for which you want to remove access list entries. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + One IP address or multiple IP addresses represented as one CIDR + block to limit requests to API resources in the specified + organization. When adding a CIDR block with a subnet mask, such as + 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /. + in: path + name: ipAddress + required: true + schema: + type: string + example: 192.0.2.0%2F24 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Access List Entry for One Organization API Key + tags: + - Programmatic API Keys + get: + description: >- + Returns one access list entry for the specified organization API key. + Resources require all API requests originate from IP addresses on the + API access list. To use this resource, the requesting API Key must have + the Organization Member role. + externalDocs: + description: Configure Atlas API Access + url: >- + https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + operationId: getApiKeyAccessList + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + One IP address or multiple IP addresses represented as one CIDR + block to limit requests to API resources in the specified + organization. When adding a CIDR block with a subnet mask, such as + 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /. + in: path + name: ipAddress + required: true + schema: + type: string + example: 192.0.2.0%2F24 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + - description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key for which you want to return access list entries. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UserAccessList' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Access List Entry for One Organization API Key + tags: + - Programmatic API Keys + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/billing/costExplorer/usage: + post: + description: >- + Creates a query process within the Cost Explorer for the given + parameters. A token is returned that can be used to poll the status of + the query and eventually retrievethe results. + operationId: createCostExplorerQueryProcess + parameters: + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CostExplorerFilterRequestBody' + description: Filter parameters for the Cost Explorer query. + required: true + responses: + '202': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CostExplorerFilterResponse' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: Accepted + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create Cost Explorer query process + tags: + - Invoices + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/billing/costExplorer/usage/{token}: + get: + description: >- + Returns the usage details for a Cost Explorer query, if the query is + finished and the data is ready to be viewed. If the data is not ready, a + 'processing' response willindicate that another request should be sent + later to view the data. + operationId: createCostExplorerQueryProcess_1 + parameters: + - $ref: '#/components/parameters/orgId' + - description: Unique 64 digit string that identifies the Cost Explorer query. + in: path + name: token + required: true + schema: + type: string + example: 4ABBE973862346D40F3AE859D4BE96E0F895764EB14EAB039E7B82F9D638C05C + maxLength: 64 + minLength: 64 + responses: + '102': + description: Processing + '200': + content: + application/vnd.atlas.2023-01-01+csv: + schema: + type: string + x-xgen-version: 2023-01-01T00:00:00.000Z + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CostExplorerQueryResult' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: >- + Return results from a given Cost Explorer query, or notify that the + results are not ready yet. + tags: + - Invoices + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/events: + get: + description: >- + Returns all events for the specified organization. Events identify + significant database, billing, or security activities or status changes. + To use this resource, the requesting API Key must have the Organization + Member role. + + + This resource remains under revision and may change. + operationId: listOrganizationEvents + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/orgId' + - $ref: '#/components/parameters/pageNum' + - description: >- + Category of incident recorded at this moment in time. + + + **IMPORTANT**: The complete list of event type values changes + frequently. + in: query + name: eventType + schema: + type: array + items: + $ref: '#/components/schemas/EventTypeForOrg' + - description: >- + Flag that indicates whether to include the raw document in the + output. The raw document contains additional meta information about + the event. + in: query + name: includeRaw + schema: + type: boolean + default: false + - description: >- + Date and time from when MongoDB Cloud stops returning events. This + parameter uses the ISO 8601 timestamp + format in UTC. + in: query + name: maxDate + schema: + type: string + format: date-time + - description: >- + Date and time from when MongoDB Cloud starts returning events. This + parameter uses the ISO 8601 timestamp + format in UTC. + in: query + name: minDate + schema: + type: string + format: date-time + example: 2021-11-17T23:15:00.060Z + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrgPaginatedEvent' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Events from One Organization + tags: + - Events + /api/atlas/v2/orgs/{orgId}/events/{eventId}: + get: + description: >- + Returns one event for the specified organization. Events identify + significant database, billing, or security activities or status changes. + To use this resource, the requesting API Key must have the Organization + Member role. + + + This resource remains under revision and may change. + operationId: getOrganizationEvent + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the event that + you want to return. Use the + [/events](#tag/Events/operation/listOrganizationEvents) endpoint to + retrieve all events to which the authenticated user has access. + in: path + name: eventId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + Flag that indicates whether to include the raw document in the + output. The raw document contains additional meta information about + the event. + in: query + name: includeRaw + schema: + type: boolean + default: false + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/EventViewForOrg' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Event from One Organization + tags: + - Events + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/federationSettings: + get: + description: >- + Returns information about the federation settings for the specified + organization. To use this resource, the requesting API Key must have the + Organization Owner role in the connected org. + operationId: getFederationSettings + parameters: + - $ref: '#/components/parameters/orgId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrgFederationSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Federation Settings for One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/groups: + get: + description: >- + Returns multiple projects in the specified organization. Each + organization can have multiple projects. Use projects to: + + + - Isolate different environments, such as development, test, or + production environments, from each other. + + - Associate different MongoDB Cloud users or teams with different + environments, or give different permission to MongoDB Cloud users in + different environments. + + - Maintain separate cluster security configurations. + + - Create different alert settings. + + + To use this resource, the requesting API Key must have the Organization + Member role. + operationId: listOrganizationProjects + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/orgId' + - $ref: '#/components/parameters/pageNum' + - description: >- + Human-readable label of the project to use to filter the returned + list. Performs a case-insensitive search for a project within the + organization which is prefixed by the specified name. + in: query + name: name + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedAtlasGroup' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One or More Projects in One Organization + tags: + - Organizations + /api/atlas/v2/orgs/{orgId}/invites: + get: + description: >- + Returns all pending invitations to the specified organization. To use + this resource, the requesting API Key must have the Organization Owner + role. + operationId: listOrganizationInvitations + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Email address of the user account invited to this organization. If + you exclude this parameter, this resource returns all pending + invitations. + in: query + name: username + schema: + type: string + format: email + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/OrganizationInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Organization Invitations + tags: + - Organizations + patch: + description: >- + Updates the details of one pending invitation to the specified + organization. To specify which invitation, provide the username of the + invited user. To use this resource, the requesting API Key must have the + Organization Owner role. + operationId: updateOrganizationInvitation + parameters: + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationInvitationRequest' + description: >- + Updates the details of one pending invitation to the specified + organization. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Organization Invitation + tags: + - Organizations + post: + description: >- + Invites one MongoDB Cloud user to join the specified organization. The + user must accept the invitation to access information within the + specified organization. To use this resource, the requesting API Key + must have the Organization Owner role. + operationId: createOrganizationInvitation + parameters: + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationInvitationRequest' + description: Invites one MongoDB Cloud user to join the specified organization. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Invite One MongoDB Cloud User to Join One Atlas Organization + tags: + - Organizations + /api/atlas/v2/orgs/{orgId}/invites/{invitationId}: + delete: + description: >- + Cancels one pending invitation sent to the specified MongoDB Cloud user + to join an organization. You can't cancel an invitation that the user + accepted. To use this resource, the requesting API Key must have the + Organization Owner role. + operationId: deleteOrganizationInvitation + parameters: + - $ref: '#/components/parameters/orgId' + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Cancel One Organization Invitation + tags: + - Organizations + get: + description: >- + Returns the details of one pending invitation to the specified + organization. To use this resource, the requesting API Key must have the + Organization Owner role. + operationId: getOrganizationInvitation + parameters: + - $ref: '#/components/parameters/orgId' + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Organization Invitation + tags: + - Organizations + patch: + description: >- + Updates the details of one pending invitation to the specified + organization. To specify which invitation, provide the unique + identification string for that invitation. Use the Return All + Organization Invitations endpoint to retrieve IDs for all pending + organization invitations. To use this resource, the requesting API Key + must have the Organization Owner role. + operationId: updateOrganizationInvitationById + parameters: + - $ref: '#/components/parameters/orgId' + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationInvitationUpdateRequest' + description: >- + Updates the details of one pending invitation to the specified + organization. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationInvitation' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update One Organization Invitation by Invitation ID + tags: + - Organizations + /api/atlas/v2/orgs/{orgId}/invoices: + get: + description: >- + Returns all invoices that MongoDB issued to the specified organization. + This list includes all invoices regardless of invoice status. To use + this resource, the requesting API Key must have the Organization Billing + Viewer, Organization Billing Admin, or Organization Owner role. If you + have a cross-organization setup, you can view linked invoices if you + have the Organization Billing Admin or Organization Owner role. + operationId: listInvoices + parameters: + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/orgId' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiInvoice' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Invoices for One Organization + tags: + - Invoices + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/invoices/pending: + get: + description: >- + Returns all invoices accruing charges for the current billing cycle for + the specified organization. To use this resource, the requesting API Key + must have the Organization Billing Viewer, Organization Billing Admin, + or Organization Owner role. If you have a cross-organization setup, you + can view linked invoices if you have the Organization Billing Admin or + Organization Owner Role. + operationId: listPendingInvoices + parameters: + - $ref: '#/components/parameters/orgId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiInvoice' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Pending Invoices for One Organization + tags: + - Invoices + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/invoices/{invoiceId}: + get: + description: >- + Returns one invoice that MongoDB issued to the specified organization. A + unique 24-hexadecimal digit string identifies the invoice. You can + choose to receive this invoice in JSON or CSV format. To use this + resource, the requesting API Key must have the Organization Billing + Viewer, Organization Billing Admin, or Organization Owner role. If you + have a cross-organization setup, you can query for a linked invoice if + you have the Organization Billing Admin or Organization Owner role. + operationId: getInvoice + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the invoice + submitted to the specified organization. Charges typically post the + next day. + in: path + name: invoiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+csv: + schema: + type: string + x-xgen-version: 2023-01-01T00:00:00.000Z + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/BillingInvoice' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Organization Invoice + tags: + - Invoices + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/invoices/{invoiceId}/csv: + get: + description: >- + Returns one invoice that MongoDB issued to the specified organization in + CSV format. A unique 24-hexadecimal digit string identifies the invoice. + To use this resource, the requesting API Key have at least the + Organization Billing Viewer, Organization Billing Admin, or Organization + Owner role. If you have a cross-organization setup, you can query for a + linked invoice if you have the Organization Billing Admin or + Organization Owner Role. + operationId: downloadInvoiceCSV + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the invoice + submitted to the specified organization. Charges typically post the + next day. + in: path + name: invoiceId + required: true + schema: + type: string + pattern: '[0-9a-f]+' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+csv: + schema: + type: string + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Organization Invoice as CSV + tags: + - Invoices + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/liveMigrations/availableProjects: + get: + description: Return all projects that you can migrate to the specified organization. + operationId: listSourceProjects + parameters: + - $ref: '#/components/parameters/orgId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/LiveImportAvailableProject' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Projects Available for Migration + tags: + - Cloud Migration Service + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/liveMigrations/linkTokens: + delete: + description: >- + Remove one organization link and its associated public API key. MongoDB + Atlas uses the link-token for push live migrations only. Live migrations + (push) let you securely push data from Cloud Manager or Ops Manager into + MongoDB Atlas. Your API Key must have the Organization Owner role to + successfully call this resource. + operationId: deleteLinkToken + parameters: + - $ref: '#/components/parameters/orgId' + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Link-Token + tags: + - Cloud Migration Service + post: + description: >- + Create one link-token that contains all the information required to + complete the link. MongoDB Atlas uses the link-token for push live + migrations only. Live migration (push) allows you to securely push data + from Cloud Manager or Ops Manager into MongoDB Atlas. Your API Key must + have the Organization Owner role to successfully call this resource. + operationId: createLinkToken + parameters: + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TargetOrgRequest' + description: IP address access list entries associated with the migration. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TargetOrg' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Link-Token + tags: + - Cloud Migration Service + /api/atlas/v2/orgs/{orgId}/settings: + get: + description: >- + Returns details about the specified organization's settings. To use this + resource, the requesting API Key must have the Organization Owner role. + operationId: getOrganizationSettings + parameters: + - $ref: '#/components/parameters/orgId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return Settings for One Organization + tags: + - Organizations + x-xgen-experimental: true + patch: + description: >- + Updates the organization's settings. To use this resource, the + requesting API Key must have the Organization Owner role. + operationId: updateOrganizationSettings + parameters: + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationSettings' + description: Details to update on the specified organization's settings. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/OrganizationSettings' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Settings for One Organization + tags: + - Organizations + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/teams: + get: + description: >- + Returns all teams that belong to the specified organization. Teams + enable you to grant project access roles to MongoDB Cloud users. MongoDB + Cloud only returns teams for which you have access. To use this + resource, the requesting API Key must have the Organization Member role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: listOrganizationTeams + parameters: + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/pageNum' + - $ref: '#/components/parameters/orgId' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedTeam' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All Teams in One Organization + tags: + - Teams + post: + description: >- + Creates one team in the specified organization. Teams enable you to + grant project access roles to MongoDB Cloud users. MongoDB Cloud limits + the number of teams to a maximum of 250 teams per organization. To use + this resource, the requesting API Key must have the Organization Owner + role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: createTeam + parameters: + - $ref: '#/components/parameters/orgId' + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Team' + description: Team that you want to create in the specified organization. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Team' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One Team in One Organization + tags: + - Teams + /api/atlas/v2/orgs/{orgId}/teams/byName/{teamName}: + get: + description: >- + Returns one team that you identified using its human-readable name. This + team belongs to one organization. Teams enable you to grant project + access roles to MongoDB Cloud users. To use this resource, the + requesting API Key must have the Organization Member role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: getTeamByName + parameters: + - $ref: '#/components/parameters/orgId' + - description: Name of the team whose information you want to return. + in: path + name: teamName + required: true + schema: + type: string + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TeamResponse' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Team using its Name + tags: + - Teams + /api/atlas/v2/orgs/{orgId}/teams/{teamId}: + delete: + description: >- + Removes one team specified using its unique 24-hexadecimal digit + identifier from the organization specified using its unique + 24-hexadecimal digit identifier. To use this resource, the requesting + API Key must have the Organization Owner role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: deleteTeam + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the team that you + want to delete. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One Team from One Organization + tags: + - Teams + get: + description: >- + Returns one team that you identified using its unique 24-hexadecimal + digit ID. This team belongs to one organization. Teams enable you to + grant project access roles to MongoDB Cloud users. To use this resource, + the requesting API Key must have the Organization Member role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: getTeamById + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the team whose + information you want to return. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TeamResponse' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One Team using its ID + tags: + - Teams + patch: + description: >- + Renames one team in the specified organization. Teams enable you to + grant project access roles to MongoDB Cloud users. To use this resource, + the requesting API Key must have the Organization Owner role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: renameTeam + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the team that you + want to rename. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/Team' + description: Details to update on the specified team. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/TeamResponse' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Rename One Team + tags: + - Teams + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/teams/{teamId}/users: + get: + description: >- + Returns all MongoDB Cloud users assigned to the team specified using its + unique 24-hexadecimal digit identifier. This team belongs to one + organization. Teams enable you to grant project access roles to MongoDB + Cloud users. To use this resource, the requesting API Key must have the + Organization Member role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: listTeamUsers + parameters: + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/orgId' + - $ref: '#/components/parameters/pageNum' + - description: >- + Unique 24-hexadecimal digit string that identifies the team whose + application users you want to return. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiAppUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All MongoDB Cloud Users Assigned to One Team + tags: + - Teams + post: + description: >- + Adds one or more MongoDB Cloud users from the specified organization to + the specified team. Teams enable you to grant project access roles to + MongoDB Cloud users. You can assign up to 250 MongoDB Cloud users from + one organization to one team. To use this resource, the requesting API + Key must have the Organization Owner role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: addTeamUser + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal character string that identifies the team to + which you want to add MongoDB Cloud users. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: '#/components/schemas/AddUserToTeam' + description: >- + One or more MongoDB Cloud users that you want to add to the specified + team. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedApiAppUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '409': + $ref: '#/components/responses/conflict' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Assign MongoDB Cloud Users from One Organization to One Team + tags: + - Teams + /api/atlas/v2/orgs/{orgId}/teams/{teamId}/users/{userId}: + delete: + description: >- + Removes one MongoDB Cloud user from the specified team. This team + belongs to one organization. Teams enable you to grant project access + roles to MongoDB Cloud users. To use this resource, the requesting API + Key must have the Organization Owner role. + externalDocs: + description: Manage Organization Teams + url: >- + https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: removeTeamUser + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the team from + which you want to remove one database application user. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: >- + Unique 24-hexadecimal digit string that identifies MongoDB Cloud + user that you want to remove from the specified team. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One MongoDB Cloud User from One Team + tags: + - Teams + /api/atlas/v2/orgs/{orgId}/users: + get: + description: >- + Returns details about the MongoDB Cloud users associated with the + specified organization. Each MongoDB Cloud user returned must belong to + the specified organization or to a project within the specified + organization. To use this resource, the requesting API Key must have the + Organization Member role. + operationId: listOrganizationUsers + parameters: + - $ref: '#/components/parameters/orgId' + - $ref: '#/components/parameters/includeCount' + - $ref: '#/components/parameters/itemsPerPage' + - $ref: '#/components/parameters/pageNum' + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/PaginatedAppUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return All MongoDB Cloud Users in One Organization + tags: + - Organizations + /api/atlas/v2/orgs/{orgId}/users/{userId}: + delete: + description: >- + Removes one MongoDB Cloud user from the specified organization. To use + this resource, the requesting API Key must have the Organization User + Admin role. + operationId: removeOrganizationUser + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the user to be + deleted. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '204': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/NoBody' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: This endpoint does not return a response body. + '400': + $ref: '#/components/responses/badRequest' + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Remove One MongoDB Cloud User from One Organization + tags: + - Organizations + x-xgen-experimental: true + /api/atlas/v2/orgs/{orgId}/users/{userId}/roles: + put: + description: >- + Updates the roles of the specified user in the specified organization. + To specify the user to update, provide the unique 24-hexadecimal digit + string that identifies the user in the specified organization. To use + this resource, the requesting API Key must have the Organization User + Admin role. + operationId: updateOrganizationRoles + parameters: + - $ref: '#/components/parameters/orgId' + - description: >- + Unique 24-hexadecimal digit string that identifies the user to + modify. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UpdateOrgRolesForUser' + description: Roles to update for the specified user. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/UpdateOrgRolesForUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Update Organization Roles for One MongoDB Cloud User + tags: + - Organizations + x-xgen-experimental: true + /api/atlas/v2/users: + post: + description: >- + Creates one MongoDB Cloud user account. A MongoDB Cloud user account + grants access to only the MongoDB Cloud application. To grant database + access, create a database user. MongoDB Cloud sends an email to the + users you specify, inviting them to join the project. Invited users + don't have access to the project until they accept the invitation. + Invitations expire after 30 days. + + MongoDB Cloud limits MongoDB Cloud user membership to a maximum of 250 MongoDB Cloud users per team. MongoDB Cloud limits MongoDB Cloud user membership to 500 MongoDB Cloud users per project and 500 MongoDB Cloud users per organization, which includes the combined membership of all projects in the organization. MongoDB Cloud raises an error if an operation exceeds these limits. For example, if you have an organization with five projects, and each project has 100 MongoDB Cloud users, and each MongoDB Cloud user belongs to only one project, you can't add any MongoDB Cloud users to this organization without first removing existing MongoDB Cloud users from the organization. + + To use this resource, the requesting API Key can have any role. + operationId: createUser + parameters: [] + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudAppUser' + description: MongoDB Cloud user account to create. + required: true + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudAppUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Create One MongoDB Cloud User + tags: + - MongoDB Cloud Users + /api/atlas/v2/users/byName/{userName}: + get: + description: >- + Returns the details for one MongoDB Cloud user account with the + specified username. You can't use this endpoint to return information + about an API Key. To return information about an API Key, use the + [Return One Organization](#tag/Organizations/operation/getOrganization) + API Key endpoint. To use this resource, the requesting API Key can have + any role. + operationId: getUserByUsername + parameters: + - description: >- + Email address that belongs to the MongoDB Cloud user account. You + cannot modify this address after creating the user. + in: path + name: userName + required: true + schema: + type: string + pattern: >- + ^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudAppUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One MongoDB Cloud User using Their Username + tags: + - MongoDB Cloud Users + /api/atlas/v2/users/{userId}: + get: + description: >- + Returns the details for one MongoDB Cloud user account with the + specified unique identifier for the user. You can't use this endpoint to + return information on an API Key. To return information about an API + Key, use the [Return One + Organization](#tag/Organizations/operation/getOrganization) API Key + endpoint. You can always retrieve your own user account. If you are the + owner of a MongoDB Cloud organization or project, you can also retrieve + the user profile for any user with membership in that organization or + project. To use this resource, the requesting API Key can have any role. + operationId: getUser + parameters: + - description: Unique 24-hexadecimal digit string that identifies this user. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + '200': + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: '#/components/schemas/CloudAppUser' + x-xgen-version: 2023-01-01T00:00:00.000Z + description: OK + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/notFound' + '500': + $ref: '#/components/responses/internalServerError' + security: + - DigestAuth: [] + summary: Return One MongoDB Cloud User using Its ID + tags: + - MongoDB Cloud Users +components: + parameters: + collectionName: + description: Human-readable label that identifies the collection. + in: path + name: collectionName + required: true + schema: + type: string + example: mycoll + databaseName: + description: Human-readable label that identifies the database. + in: path + name: databaseName + required: true + schema: + type: string + example: mydb + end: + description: >- + Date and time when MongoDB Cloud stops reporting the metrics. This + parameter expresses its value in the ISO 8601 timestamp format in UTC. + Include this parameter when you do not set **period**. + in: query + name: end + required: false + schema: + type: string + format: date-time + envelope: + description: >- + Flag that indicates whether Application wraps the response in an + `envelope` JSON object. Some API clients cannot access the HTTP response + headers or status code. To remediate this, set envelope=true in the + query. Endpoints that return a list of results use the results object as + an envelope. Application adds the status parameter to the response body. + in: query + name: envelope + required: false + schema: + type: boolean + default: false + example: false + federationSettingsId: + description: Unique 24-hexadecimal digit string that identifies your federation. + in: path + name: federationSettingsId + required: true + schema: + type: string + example: 55fa922fb343282757d9554e + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + granularity: + description: >- + Duration that specifies the interval at which Atlas reports the metrics. + This parameter expresses its value in the ISO 8601 duration format in + UTC. + in: query + name: granularity + required: true + schema: + type: string + example: PT1M + groupId: + description: >- + Unique 24-hexadecimal digit string that identifies your project. Use the + [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all + projects to which the authenticated user has access. + + + **NOTE**: Groups and projects are synonymous terms. Your group id is the + same as your project id. For existing groups, your group/project id + remains the same. The resource and corresponding endpoints use the term + groups. + in: path + name: groupId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + identityProviderId: + description: >- + Unique 20-hexadecimal digit string that identifies the identity + provider. + in: path + name: identityProviderId + required: true + schema: + type: string + example: c2777a9eca931f29fc2f + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + includeCount: + description: >- + Flag that indicates whether the response returns the total number of + items (**totalCount**) in the response. + in: query + name: includeCount + required: false + schema: + type: boolean + default: true + example: true + indexName: + description: Human-readable label that identifies the index. + in: path + name: indexName + required: true + schema: + type: string + example: myindex + itemsPerPage: + description: Number of items that the response returns per page. + in: query + name: itemsPerPage + required: false + schema: + type: integer + default: 100 + example: 100 + maximum: 500 + minimum: 1 + liveMigrationId: + description: Unique 24-hexadecimal digit string that identifies the migration. + in: path + name: liveMigrationId + required: true + schema: + type: string + example: 6296fb4c7c7aa997cf94e9a8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + orgId: + description: >- + Unique 24-hexadecimal digit string that identifies the organization that + contains your projects. Use the + [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to + retrieve all organizations to which the authenticated user has access. + in: path + name: orgId + required: true + schema: + type: string + example: 4888442a3354817a7320eb61 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + pageNum: + description: >- + Number of the page that displays the current set of the total objects + that the response returns. + in: query + name: pageNum + required: false + schema: + type: integer + default: 1 + example: 1 + minimum: 1 + period: + description: >- + Duration over which Atlas reports the metrics. This parameter expresses + its value in the ISO 8601 duration format in UTC. Include this parameter + when you do not set **start** and **end**. + in: query + name: period + required: false + schema: + type: string + example: PT10H + pretty: + description: >- + Flag that indicates whether the response body should be in the prettyprint format. + in: query + name: pretty + required: false + schema: + type: boolean + default: false + example: false + processId: + description: >- + Combination of hostname and IANA port that serves the MongoDB process. + The host must be the hostname, fully qualified domain name (FQDN), or + Internet Protocol address (IPv4 or IPv6) of the host that runs the + MongoDB process (mongod or mongos). The port must be the IANA port on + which the MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: my.host.name.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + start: + description: >- + Date and time when MongoDB Cloud begins reporting the metrics. This + parameter expresses its value in the ISO 8601 timestamp format in UTC. + Include this parameter when you do not set **period**. + in: query + name: start + required: false + schema: + type: string + format: date-time + responses: + accepted: + description: Accepted. + badRequest: + content: + application/json: + example: + detail: >- + (This is just an example, the exception may not be related to this + endpoint) No provider AWS exists. + error: 400 + errorCode: INVALID_PROVIDER + parameters: + - AWS + reason: Bad Request + schema: + $ref: '#/components/schemas/ApiError' + description: Bad Request. + conflict: + content: + application/json: + example: + detail: >- + (This is just an example, the exception may not be related to this + endpoint) Cannot delete organization link while there is active + migration in following project ids: 60c4fd418ebe251047c50554 + error: 409 + errorCode: CANNOT_DELETE_ORG_LINK_WITH_RUNNING_LIVE_EXPORT + parameters: + - 60c4fd418ebe251047c50554 + reason: Conflict + schema: + $ref: '#/components/schemas/ApiError' + description: Conflict. + forbidden: + content: + application/json: + example: + detail: >- + (This is just an example, the exception may not be related to this + endpoint) + error: 403 + errorCode: CANNOT_CHANGE_GROUP_NAME + parameters: + - EXAMPLE + reason: Forbidden + schema: + $ref: '#/components/schemas/ApiError' + description: Forbidden. + gone: + content: + application/json: + example: + detail: >- + This happens when a resource is marked for sunset and the sunset + date is in the past. + error: 410 + errorCode: VERSION_GONE + parameters: + - EXAMPLE + reason: Gone + schema: + $ref: '#/components/schemas/ApiError' + description: Gone. + internalServerError: + content: + application/json: + example: + detail: >- + (This is just an example, the exception may not be related to this + endpoint) + error: 500 + errorCode: UNEXPECTED_ERROR + parameters: + - EXAMPLE + reason: Internal Server Error + schema: + $ref: '#/components/schemas/ApiError' + description: Internal Server Error. + methodNotAllowed: + content: + application/json: + example: + detail: >- + (This is just an example, the exception may not be related to this + endpoint) + error: 405 + errorCode: ATLAS_BACKUP_CANCEL_SHARD_RESTORE_JOB_NOT_ALLOWED + parameters: + - EXAMPLE + reason: Method Not Allowed + schema: + $ref: '#/components/schemas/ApiError' + description: Method Not Allowed. + noBody: + description: This endpoint does not return a response body. + notFound: + content: + application/json: + example: + detail: >- + (This is just an example, the exception may not be related to this + endpoint) Cannot find resource AWS + error: 404 + errorCode: RESOURCE_NOT_FOUND + parameters: + - AWS + reason: Not Found + schema: + $ref: '#/components/schemas/ApiError' + description: Not Found. + paymentRequired: + content: + application/json: + example: + detail: >- + (This is just an example, the exception may not be related to this + endpoint) + error: 402 + errorCode: NO_PAYMENT_INFORMATION_FOUND + parameters: + - EXAMPLE + reason: Payment Required + schema: + $ref: '#/components/schemas/ApiError' + description: Payment Required. + unauthorized: + content: + application/json: + example: + detail: >- + (This is just an example, the exception may not be related to this + endpoint) + error: 401 + errorCode: NOT_ORG_GROUP_CREATOR + parameters: + - EXAMPLE + reason: Unauthorized + schema: + $ref: '#/components/schemas/ApiError' + description: Unauthorized. + schemas: + AWSKMSConfiguration: + type: object + description: >- + Amazon Web Services (AWS) KMS configuration details and encryption at + rest configuration set for the specified project. + externalDocs: + description: Amazon Web Services Key Management Service + url: https://www.mongodb.com/docs/atlas/security-aws-kms/ + properties: + accessKeyID: + type: string + description: >- + Unique alphanumeric string that identifies an Identity and Access + Management (IAM) access key with permissions required to access your + Amazon Web Services (AWS) Customer Master Key (CMK). + example: 019dd98d94b4bb778e7552e4 + maxLength: 128 + minLength: 16 + customerMasterKeyID: + type: string + description: >- + Unique alphanumeric string that identifies the Amazon Web Services + (AWS) Customer Master Key (CMK) you used to encrypt and decrypt the + MongoDB master keys. + maxLength: 2048 + minLength: 1 + enabled: + type: boolean + description: >- + Flag that indicates whether someone enabled encryption at rest for + the specified project through Amazon Web Services (AWS) Key + Management Service (KMS). To disable encryption at rest using + customer key management and remove the configuration details, pass + only this parameter with a value of `false`. + region: + type: string + description: >- + Physical location where MongoDB Cloud deploys your AWS-hosted + MongoDB cluster nodes. The region you choose can affect network + latency for clients accessing your databases. When MongoDB Cloud + deploys a dedicated cluster, it checks if a VPC or VPC connection + exists for that provider and region. If not, MongoDB Cloud creates + them as part of the deployment. MongoDB Cloud assigns the VPC a CIDR + block. To limit a new VPC peering connection to one CIDR block and + region, create the connection first. Deploy the cluster after the + connection starts. + title: AWS Regions + roleId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies an Amazon Web + Services (AWS) Identity and Access Management (IAM) role. This IAM + role has the permissions required to manage your AWS customer master + key. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + secretAccessKey: + type: string + description: >- + Human-readable label of the Identity and Access Management (IAM) + secret access key with permissions required to access your Amazon + Web Services (AWS) customer master key. + writeOnly: true + valid: + type: boolean + description: >- + Flag that indicates whether the Amazon Web Services (AWS) Key + Management Service (KMS) encryption key can encrypt and decrypt + data. + readOnly: true + AddUserToTeam: + type: object + properties: + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + user. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + required: + - id + AdvancedAutoScalingSettings: + type: object + description: Options that determine how this cluster handles resource scaling. + properties: + compute: + $ref: '#/components/schemas/AdvancedComputeAutoScaling' + diskGB: + $ref: '#/components/schemas/DiskGBAutoScaling' + title: Automatic Scaling Settings + AdvancedClusterDescription: + type: object + properties: + acceptDataRisksAndForceReplicaSetReconfig: + type: string + format: date-time + description: >- + If reconfiguration is necessary to regain a primary due to a + regional outage, submit this field alongside your topology + reconfiguration to request a new regional outage resistant topology. + Forced reconfigurations during an outage of the majority of + electable nodes carry a risk of data loss if replicated writes (even + majority committed writes) have not been replicated to the new + primary node. MongoDB Atlas docs contain more information. To + proceed with an operation which carries that risk, set + **acceptDataRisksAndForceReplicaSetReconfig** to the current date. + externalDocs: + description: Reconfiguring a Replica Set during a regional outage + url: >- + https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set + backupEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether the cluster can perform backups. If set + to `true`, the cluster can perform backups. You must set this value + to `true` for NVMe clusters. Backup uses [Cloud + Backups](https://docs.atlas.mongodb.com/backup/cloud-backup/overview/) + for dedicated clusters and [Shared Cluster + Backups](https://docs.atlas.mongodb.com/backup/shared-tier/overview/) + for tenant clusters. If set to `false`, the cluster doesn't use + backups. + biConnector: + $ref: '#/components/schemas/BiConnector' + clusterType: + type: string + description: Configuration of nodes that comprise the cluster. + connectionStrings: + $ref: '#/components/schemas/ClusterConnectionStrings' + createDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this cluster. This + parameter expresses its value in ISO 8601 format in UTC. + readOnly: true + diskSizeGB: + type: number + format: double + description: >- + Storage capacity that the host's root volume possesses expressed in + gigabytes. Increase this number to add capacity. MongoDB Cloud + requires this parameter if you set **replicationSpecs**. If you + specify a disk size below the minimum (10 GB), this parameter + defaults to the minimum disk size value. Storage charge calculations + depend on whether you choose the default value or a custom value. + The maximum value for disk storage cannot exceed 50 times the + maximum RAM for the selected cluster. If you require more storage + space, consider upgrading your cluster to a higher tier. + maximum: 4096 + minimum: 10 + encryptionAtRestProvider: + type: string + description: >- + Cloud service provider that manages your customer keys to provide an + additional layer of encryption at rest for the cluster. To enable + customer key management for encryption at rest, the cluster + **replicationSpecs[n].regionConfigs[m].{type}Specs.instanceSize** + setting must be `M10` or higher and `"backupEnabled" : false` or + omitted entirely. + externalDocs: + description: Encryption at Rest using Customer Key Management + url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a Global Cluster. If you include existing zones + in the request, you must specify this parameter. If you add a new + zone to an existing Global Cluster, you may specify this parameter. + The request deletes any existing zones in a Global Cluster that you + exclude from the request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + labels: + type: array + description: >- + Collection of key-value pairs between 1 to 255 characters in length + that tag and categorize the cluster. The MongoDB Cloud console + doesn't display your labels. + + + Cluster labels will be deprecated in a future release. We strongly + recommend that you use [resource + tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) + instead. + items: + $ref: '#/components/schemas/ComponentLabel' + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + mongoDBMajorVersion: + type: string + default: '6.0' + description: >- + Major MongoDB version of the cluster. MongoDB Cloud deploys the + cluster with the latest stable release of the specified version. + mongoDBVersion: + type: string + description: Version of MongoDB that the cluster runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + name: + type: string + description: Human-readable label that identifies the advanced cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + paused: + type: boolean + description: Flag that indicates whether the cluster is paused. + pitEnabled: + type: boolean + description: >- + Flag that indicates whether the cluster uses continuous cloud + backups. + externalDocs: + description: Continuous Cloud Backups + url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ + replicationSpecs: + type: array + description: >- + List of settings that configure your cluster regions. For Global + Clusters, each object in the array represents a zone where your + clusters nodes deploy. For non-Global sharded clusters and replica + sets, this array has one object representing where your clusters + nodes deploy. + items: + $ref: '#/components/schemas/ReplicationSpec' + rootCertType: + type: string + default: ISRGROOTX1 + description: >- + Root Certificate Authority that MongoDB Cloud cluster uses. MongoDB + Cloud supports Internet Security Research Group. + stateName: + type: string + description: >- + Human-readable label that indicates the current operating condition + of this cluster. + readOnly: true + tags: + type: array + description: >- + List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the cluster. + externalDocs: + description: Resource Tags + url: https://dochub.mongodb.org/core/add-cluster-tag-atlas + items: + $ref: '#/components/schemas/ResourceTag' + terminationProtectionEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether termination protection is enabled on the + cluster. If set to `true`, MongoDB Cloud won't delete the cluster. + If set to `false`, MongoDB Cloud will delete the cluster. + versionReleaseSystem: + type: string + default: LTS + description: >- + Method by which the cluster maintains the MongoDB versions. If value + is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. + AdvancedComputeAutoScaling: + type: object + description: Options that determine how this cluster handles CPU scaling. + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether someone enabled instance size + auto-scaling. + + + - Set to `true` to enable instance size auto-scaling. If enabled, + you must specify a value for + **replicationSpecs[n].regionConfigs[m].autoScaling.compute.maxInstanceSize**. + + - Set to `false` to disable instance size automatic scaling. + maxInstanceSize: + $ref: '#/components/schemas/BaseCloudProviderInstanceSize' + minInstanceSize: + $ref: '#/components/schemas/BaseCloudProviderInstanceSize' + scaleDownEnabled: + type: boolean + description: >- + Flag that indicates whether the instance size may scale down. + MongoDB Cloud requires this parameter if + `"replicationSpecs[n].regionConfigs[m].autoScaling.compute.enabled" + : true`. If you enable this option, specify a value for + **replicationSpecs[n].regionConfigs[m].autoScaling.compute.minInstanceSize**. + title: Automatic Compute Scaling Settings + AdvancedDiskBackupSnapshotSchedulePolicy: + type: object + description: >- + List that contains a document for each backup policy item in the desired + backup policy. + properties: + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this backup + policy. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + policyItems: + type: array + description: List that contains the specifications for one policy. + items: + $ref: '#/components/schemas/DiskBackupApiPolicyItem' + AlertViewForNdsGroup: + type: object + properties: + acknowledgedUntil: + type: string + format: date-time + description: >- + Date and time until which this alert has been acknowledged. This + parameter expresses its value in the ISO 8601 timestamp format in UTC. The + resource returns this parameter if a MongoDB User previously + acknowledged this alert. + + + - To acknowledge this alert forever, set the parameter value to 100 + years in the future. + + + - To unacknowledge a previously acknowledged alert, set the + parameter value to a date in the past. + acknowledgementComment: + type: string + description: >- + Comment that a MongoDB Cloud user submitted when acknowledging the + alert. + example: Expiration on 3/19. Silencing for 7days. + maxLength: 200 + acknowledgingUsername: + type: string + format: email + description: >- + MongoDB Cloud username of the person who acknowledged the alert. The + response returns this parameter if a MongoDB Cloud user previously + acknowledged this alert. + readOnly: true + alertConfigId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration that sets this alert. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this alert. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + eventTypeName: + type: string + description: Incident that triggered this alert. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + owns this alert. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this alert. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lastNotified: + type: string + format: date-time + description: >- + Date and time that any notifications were last sent for this alert. + This parameter expresses its value in the ISO 8601 timestamp format in UTC. The + resource returns this parameter if MongoDB Cloud has sent + notifications for this alert. + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + orgId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the + organization that owns the project to which this alert applies. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + resolved: + type: string + format: date-time + description: >- + Date and time that this alert changed to `"status" : "CLOSED"`. This + parameter expresses its value in the ISO 8601 timestamp format in UTC. The + resource returns this parameter once `"status" : "CLOSED"`. + readOnly: true + status: + type: string + description: State of this alert at the time you requested its details. + example: OPEN + readOnly: true + updated: + type: string + format: date-time + description: >- + Date and time when someone last updated this alert. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + clusterName: + type: string + description: >- + Human-readable label that identifies the cluster to which this alert + applies. This resource returns this parameter for alerts of events + impacting backups, replica sets, or sharded clusters. + example: cluster1 + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + hostnameAndPort: + type: string + description: >- + Hostname and port of the host to which this alert applies. The + resource returns this parameter for alerts of events impacting hosts + or replica sets. + example: cloud-test.mongodb.com:27017 + readOnly: true + replicaSetName: + type: string + description: >- + Name of the replica set to which this alert applies. The response + returns this parameter for alerts of events impacting backups, + hosts, or replica sets. + example: event-replica-set + readOnly: true + currentValue: + $ref: '#/components/schemas/NumberMetricValue' + metricName: + type: string + description: >- + Name of the metric against which Atlas checks the configured + `metricThreshold.threshold`. + + + To learn more about the available metrics, see Host Metrics. + + + **NOTE**: If you set eventTypeName to + OUTSIDE_SERVERLESS_METRIC_THRESHOLD, you can specify only metrics + available for serverless. To learn more, see Serverless Measurements. + example: ASSERT_USER + readOnly: true + nonRunningHostIds: + type: array + description: >- + List of unique 24-hexadecimal character strings that identify the + replica set members that are not in PRIMARY nor SECONDARY state. + items: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 32 + minLength: 8 + pattern: ^([a-f0-9]{8,32})$ + readOnly: true + readOnly: true + parentClusterId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the parent + cluster to which this alert applies. The parent cluster contains the + sharded nodes. MongoDB Cloud returns this parameter only for alerts + of events impacting sharded clusters. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 64 + minLength: 1 + pattern: ^([a-f0-9]{24})$ + readOnly: true + AlertsNotificationRootForGroup: + type: object + description: >- + One target that MongoDB Cloud sends notifications when an alert + triggers. + properties: + datadogApiKey: + type: string + description: >- + Datadog API Key that MongoDB Cloud needs to send alert notifications + to Datadog. You can find this API key in the Datadog dashboard. The + resource requires this parameter when `"notifications.[n].typeName" + : "DATADOG"`. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + example: '****************************a23c' + datadogRegion: + type: string + default: US + description: >- + Datadog region that indicates which API Uniform Resource Locator + (URL) to use. The resource requires this parameter when + `"notifications.[n].typeName" : "DATADOG"`. + + + To learn more about Datadog's regions, see Datadog Sites. + delayMin: + type: integer + format: int32 + description: >- + Number of minutes that MongoDB Cloud waits after detecting an alert + condition before it sends out the first notification. + intervalMin: + type: integer + format: int32 + description: >- + Number of minutes to wait between successive notifications. MongoDB + Cloud sends notifications until someone acknowledges the + unacknowledged alert. + + + PagerDuty, VictorOps, and OpsGenie notifications don't return this + element. Configure and manage the notification interval within each + of those services. + minimum: 5 + notifierId: + type: string + description: >- + The notifierId is a system-generated unique identifier assigned to + each notification method. This is needed when updating third-party + notifications without requiring explicit authentication credentials. + example: 6462742adc47d365036da07c + typeName: + type: string + description: Human-readable label that displays the alert notification type. + emailAddress: + type: string + format: email + description: >- + Email address to which MongoDB Cloud sends alert notifications. The + resource requires this parameter when `"notifications.[n].typeName" + : "EMAIL"`. You don’t need to set this value to send emails to + individual or groups of MongoDB Cloud users including: + + + - specific MongoDB Cloud users (`"notifications.[n].typeName" : + "USER"`) + + - MongoDB Cloud users with specific project roles + (`"notifications.[n].typeName" : "GROUP"`) + + - MongoDB Cloud users with specific organization roles + (`"notifications.[n].typeName" : "ORG"`) + + - MongoDB Cloud teams (`"notifications.[n].typeName" : "TEAM"`) + + + To send emails to one MongoDB Cloud user or grouping of users, set + the `notifications.[n].emailEnabled` parameter. + emailEnabled: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud should send email + notifications. The resource requires this parameter when one of the + following values have been set: + + + - `"notifications.[n].typeName" : "ORG"` + + - `"notifications.[n].typeName" : "GROUP"` + + - `"notifications.[n].typeName" : "USER"` + roles: + type: array + description: >- + List that contains the one or more + [organization](https://dochub.mongodb.org/core/atlas-org-roles) or + [project roles](https://dochub.mongodb.org/core/atlas-proj-roles) + that receive the configured alert. The resource requires this + parameter when `"notifications.[n].typeName" : "GROUP"` or + `"notifications.[n].typeName" : "ORG"`. If you include this + parameter, MongoDB Cloud sends alerts only to users assigned the + roles you specify in the array. If you omit this parameter, MongoDB + Cloud sends alerts to users assigned any role. + items: + type: string + description: >- + One organization or project role that receive the configured + alert. + smsEnabled: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud should send text message + notifications. The resource requires this parameter when one of the + following values have been set: + + + - `"notifications.[n].typeName" : "ORG"` + + - `"notifications.[n].typeName" : "GROUP"` + + - `"notifications.[n].typeName" : "USER"` + notificationToken: + type: string + description: >- + HipChat API token that MongoDB Cloud needs to send alert + notifications to HipChat. The resource requires this parameter when + `"notifications.[n].typeName" : "HIP_CHAT"`". If the token later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the token remains invalid, MongoDB Cloud removes it. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + example: '************************************1234' + roomName: + type: string + description: >- + HipChat API room name to which MongoDB Cloud sends alert + notifications. The resource requires this parameter when + `"notifications.[n].typeName" : "HIP_CHAT"`". + example: test room + microsoftTeamsWebhookUrl: + type: string + description: >- + Microsoft Teams Webhook Uniform Resource Locator (URL) that MongoDB + Cloud needs to send this notification via Microsoft Teams. The + resource requires this parameter when `"notifications.[n].typeName" + : "MICROSOFT_TEAMS"`. If the URL later becomes invalid, MongoDB + Cloud sends an email to the project owners. If the key remains + invalid, MongoDB Cloud removes it. + + + **NOTE**: When you view or edit the alert for a Microsoft Teams + notification, the URL appears partially redacted. + example: https://webhook.com/**** + opsGenieApiKey: + type: string + description: >- + API Key that MongoDB Cloud needs to send this notification via + Opsgenie. The resource requires this parameter when + `"notifications.[n].typeName" : "OPS_GENIE"`. If the key later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the key remains invalid, MongoDB Cloud removes it. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + example: '********************************a111' + opsGenieRegion: + type: string + default: US + description: >- + Opsgenie region that indicates which API Uniform Resource Locator + (URL) to use. + region: + type: string + default: US + description: >- + PagerDuty region that indicates which API Uniform Resource Locator + (URL) to use. + serviceKey: + type: string + description: >- + PagerDuty service key that MongoDB Cloud needs to send notifications + via PagerDuty. The resource requires this parameter when + `"notifications.[n].typeName" : "PAGER_DUTY"`. If the key later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the key remains invalid, MongoDB Cloud removes it. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + example: '****************************7890' + apiToken: + type: string + description: >- + Slack API token or Bot token that MongoDB Cloud needs to send alert + notifications via Slack. The resource requires this parameter when + `"notifications.[n].typeName" : "SLACK"`. If the token later becomes + invalid, MongoDB Cloud sends an email to the project owners. If the + token remains invalid, MongoDB Cloud removes the token. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + example: >- + **********************************************************************abcd + channelName: + type: string + description: >- + Name of the Slack channel to which MongoDB Cloud sends alert + notifications. The resource requires this parameter when + `"notifications.[n].typeName" : "SLACK"`. + example: alerts + mobileNumber: + type: string + description: >- + Mobile phone number to which MongoDB Cloud sends alert + notifications. The resource requires this parameter when + `"notifications.[n].typeName" : "SMS"`. + example: '1233337892' + teamId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies one MongoDB Cloud + team. The resource requires this parameter when + `"notifications.[n].typeName" : "TEAM"`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + teamName: + type: string + description: >- + Name of the MongoDB Cloud team that receives this notification. The + resource requires this parameter when `"notifications.[n].typeName" + : "TEAM"`. + example: Atlas + username: + type: string + format: email + description: >- + MongoDB Cloud username of the person to whom MongoDB Cloud sends + notifications. Specify only MongoDB Cloud users who belong to the + project that owns the alert configuration. The resource requires + this parameter when `"notifications.[n].typeName" : "USER"`. + victorOpsApiKey: + type: string + description: >- + API key that MongoDB Cloud needs to send alert notifications to + Splunk On-Call. The resource requires this parameter when + `"notifications.[n].typeName" : "VICTOR_OPS"`. If the key later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the key remains invalid, MongoDB Cloud removes it. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + example: '********************************9abc' + victorOpsRoutingKey: + type: string + description: >- + Routing key that MongoDB Cloud needs to send alert notifications to + Splunk On-Call. The resource requires this parameter when + `"notifications.[n].typeName" : "VICTOR_OPS"`. If the key later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the key remains invalid, MongoDB Cloud removes it. + example: test routing + webhookSecret: + type: string + description: >- + Authentication secret for a webhook-based alert. + + + Atlas returns this value if you set `"notifications.[n].typeName" + :"WEBHOOK"` and either: + + * You set `notification.[n].webhookSecret` to a non-empty string + + * You set a default webhookSecret either on the + [Integrations](https://www.mongodb.com/docs/atlas/tutorial/third-party-service-integrations/#std-label-third-party-integrations) + page, or with the [Integrations + API](#tag/Third-Party-Service-Integrations/operation/createIntegration) + + + **NOTE**: When you view or edit the alert for a webhook + notification, the secret appears completely redacted. + example: '******' + webhookUrl: + type: string + description: >- + Target URL for a webhook-based alert. + + + Atlas returns this value if you set `"notifications.[n].typeName" + :"WEBHOOK"` and either: + + * You set `notification.[n].webhookURL` to a non-empty string + + * You set a default webhookUrl either on the + [Integrations](https://www.mongodb.com/docs/atlas/tutorial/third-party-service-integrations/#std-label-third-party-integrations) + page, or with the [Integrations + API](#tag/Third-Party-Service-Integrations/operation/createIntegration) + + + **NOTE**: When you view or edit the alert for a Webhook URL + notification, the URL appears partially redacted. + example: https://webhook.com/**** + AlertsToggle: + type: object + description: >- + Enables or disables the specified alert configuration in the specified + project. + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether to enable or disable the specified alert + configuration in the specified project. + title: Toggle Request + ApiError: + type: object + properties: + detail: + type: string + description: >- + Describes the specific conditions or reasons that cause each type of + error. + error: + type: integer + format: int32 + description: HTTP status code returned with this error. + maximum: 599 + minimum: 200 + errorCode: + type: string + description: Application error code returned with this error. + example: TOO_MANY_GROUP_NOTIFICATIONS + parameters: + type: array + description: Parameter uses to give more information about the error. + items: {} + reason: + type: string + description: Application error message returned with this error. + example: >- + At most one group notification can be specified for an alert + configuration. + ApiHostView_Atlas: + type: object + properties: + created: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this MongoDB process. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostname: + type: string + description: >- + Hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + readOnly: true + id: + type: string + description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + lastPing: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud received the last ping for this + MongoDB process. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link_Atlas' + readOnly: true + port: + type: integer + format: int32 + description: >- + Internet Assigned Numbers Authority (IANA) port on which the MongoDB + process listens for requests. + readOnly: true + replicaSetName: + type: string + description: >- + Human-readable label that identifies the replica set that contains + this process. This resource returns this parameter if this process + belongs to a replica set. + readOnly: true + shardName: + type: string + description: >- + Human-readable label that identifies the shard that contains this + process. This resource returns this value only if this process + belongs to a sharded cluster. + readOnly: true + typeName: + type: string + description: >- + Type of MongoDB process that MongoDB Cloud tracks. MongoDB Cloud + returns new processes as **NO_DATA** until MongoDB Cloud completes + deploying the process. + readOnly: true + userAlias: + type: string + description: >- + Human-readable label that identifies the cluster node. MongoDB Cloud + sets this hostname usually to the standard hostname for the cluster + node. It appears in the connection string for a cluster instead of + the value of the hostname parameter. + readOnly: true + version: + type: string + description: Version of MongoDB that this process runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + ApiKey: + type: object + description: Details contained in one API key. + properties: + accessList: + type: array + description: >- + List of network addresses granted access to this API using this API + key. + items: + $ref: '#/components/schemas/AccessListItem' + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + publicKey: + type: string + description: Public API key value set for the specified organization API key. + maxLength: 8 + minLength: 8 + readOnly: true + roles: + type: array + description: >- + List that contains roles that the API key needs to have. All roles + you provide must be valid for the specified project or organization. + Each request must include a minimum of one valid role. The resource + returns all project and organization roles assigned to the Cloud + user. + items: + $ref: '#/components/schemas/CloudAccessRoleAssignment' + readOnly: true + readOnly: true + required: + - id + - publicKey + ApiKeyUserDetails: + type: object + properties: + desc: + type: string + description: >- + Purpose or explanation provided when someone created this + organization API key. + maxLength: 250 + minLength: 1 + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this organization + API key assigned to this project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + privateKey: + type: string + description: >- + Redacted private key returned for this organization API key. This + key displays unredacted when first created. + example: 55c3bbb6-b4bb-0be1-e66d20841f3e + readOnly: true + publicKey: + type: string + description: Public API key value set for the specified organization API key. + example: zmmrboas + maxLength: 8 + minLength: 8 + readOnly: true + roles: + type: array + description: >- + List that contains the roles that the API key needs to have. All + roles you provide must be valid for the specified project or + organization. Each request must include a minimum of one valid role. + The resource returns all project and organization roles assigned to + the API key. + items: + $ref: '#/components/schemas/CloudAccessRoleAssignment' + ApiMeasurementsGeneralView_Atlas: + type: object + properties: + databaseName: + type: string + description: >- + Human-readable label that identifies the database that the specified + MongoDB process serves. + readOnly: true + end: + type: string + format: date-time + description: >- + Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: >- + Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostId: + type: string + description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link_Atlas' + readOnly: true + measurements: + type: array + description: List that contains measurements and their data points. + items: + $ref: '#/components/schemas/MetricsMeasurement_Atlas' + readOnly: true + partitionName: + type: string + description: >- + Human-readable label of the disk or partition to which the + measurements apply. + readOnly: true + processId: + type: string + description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: >- + Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + AtlasClusterOutageSimulationOutageFilter: + type: object + properties: + cloudProvider: + type: string + description: >- + The cloud provider of the region that undergoes the outage + simulation. + regionName: + type: string + description: The name of the region to undergo an outage simulation. + type: + type: string + description: |- + The type of cluster outage to simulate. + + | Type | Description | + |------------|-------------| + | `REGION` | Simulates a cluster outage for a region.| + AtlasOrganization: + type: object + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + isDeleted: + type: boolean + description: Flag that indicates whether this organization has been deleted. + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + name: + type: string + description: Human-readable label that identifies the organization. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + required: + - name + AuditLog: + type: object + properties: + auditAuthorizationSuccess: + type: boolean + default: false + description: >- + Flag that indicates whether someone set auditing to track successful + authentications. This only applies to the `"atype" : "authCheck"` + audit filter. Setting this parameter to `true` degrades cluster + performance. + externalDocs: + description: System Auditing Messages + url: >- + https://docs.mongodb.com/manual/reference/audit-message/#audit-event-actions-details-and-results + auditFilter: + type: string + description: >- + JSON document that specifies which events to record. Escape any + characters that may prevent parsing, such as single or double + quotes, using a backslash (`\`). + externalDocs: + description: Custom Auditing Filter + url: https://docs.atlas.mongodb.com/tutorial/auditing-custom-filter/ + configurationType: + type: string + description: >- + Human-readable label that displays how to configure the audit + filter. + readOnly: true + enabled: + type: boolean + default: false + description: >- + Flag that indicates whether someone enabled database auditing for + the specified project. + required: + - auditAuthorizationSuccess + - auditFilter + - enabled + AuthFederationRoleMapping: + type: object + description: Mapping settings that link one IdP and MongoDB Cloud. + properties: + externalGroupName: + type: string + description: >- + Unique human-readable label that identifies the identity provider + group to whichthis role mapping applies. + maxLength: 200 + minLength: 1 + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this role + mapping. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + roleAssignments: + type: array + description: >- + Atlas roles and the unique identifiers of the groups and + organizations associated with each role. + items: + $ref: '#/components/schemas/RoleAssignment' + uniqueItems: true + required: + - externalGroupName + title: Federated Authentication Role Mapping + AvailableCloudProviderRegion: + type: object + description: >- + List of regions that this cloud provider supports for this instance + size. + properties: + default: + type: boolean + description: >- + Flag that indicates whether the cloud provider sets this region as + its default. AWS defaults to US_EAST_1, GCP defaults to CENTRAL_US, + and AZURE defaults to US_WEST_2. + readOnly: true + name: + type: string + description: Human-readable label that identifies the supported region. + readOnly: true + readOnly: true + AvailableClustersDeployment: + type: object + description: Deployments that can be migrated to MongoDB Atlas. + properties: + agentVersion: + type: string + description: Version of MongoDB Agent that monitors/manages the cluster. + readOnly: true + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + dbSizeBytes: + type: integer + format: int64 + description: >- + Size of this database on disk at the time of the request expressed + in bytes. + example: 8192 + readOnly: true + featureCompatibilityVersion: + type: string + description: >- + Version of MongoDB + [features](https://docs.mongodb.com/manual/reference/command/setFeatureCompatibilityVersion) + that this cluster supports. + readOnly: true + managed: + type: boolean + description: Flag that indicates whether Automation manages this cluster. + readOnly: true + mongoDBVersion: + type: string + description: Version of MongoDB that this cluster runs. + readOnly: true + name: + type: string + description: Human-readable label that identifies this cluster. + example: Project X sharded cluster + readOnly: true + oplogSizeMB: + type: integer + format: int32 + description: >- + Size of the Oplog on disk at the time of the request expressed in + MB. + example: 3 + readOnly: true + sharded: + type: boolean + description: >- + Flag that indicates whether someone configured this cluster as a + sharded cluster. + + + - If `true`, this cluster serves as a sharded cluster. + + - If `false`, this cluster serves as a replica set. + readOnly: true + shardsSize: + type: integer + format: int32 + description: Number of shards that comprise this cluster. + example: 3 + readOnly: true + tlsEnabled: + type: boolean + description: Flag that indicates whether someone enabled TLS for this cluster. + readOnly: true + required: + - featureCompatibilityVersion + - managed + - mongoDBVersion + - name + - sharded + - tlsEnabled + title: Available Clusters + AzureKeyVault: + type: object + description: >- + Details that define the configuration of Encryption at Rest using Azure + Key Vault (AKV). + externalDocs: + description: Azure Key Vault + url: https://www.mongodb.com/docs/atlas/security-azure-kms/ + properties: + azureEnvironment: + type: string + description: Azure environment in which your account credentials reside. + clientID: + type: string + format: uuid + description: >- + Unique 36-hexadecimal character string that identifies an Azure + application associated with your Azure Active Directory tenant. + enabled: + type: boolean + description: >- + Flag that indicates whether someone enabled encryption at rest for + the specified project. To disable encryption at rest using customer + key management and remove the configuration details, pass only this + parameter with a value of `false`. + keyIdentifier: + type: string + description: >- + Web address with a unique key that identifies for your Azure Key + Vault. + example: >- + https://EXAMPLEKeyVault.vault.azure.net/keys/EXAMPLEKey/d891821e3d364e9eb88fbd3d11807b86 + keyVaultName: + type: string + description: >- + Unique string that identifies the Azure Key Vault that contains your + key. + resourceGroupName: + type: string + description: Name of the Azure resource group that contains your Azure Key Vault. + secret: + type: string + description: >- + Private data that you need secured and that belongs to the specified + Azure Key Vault (AKV) tenant (**azureKeyVault.tenantID**). This data + can include any type of sensitive data such as passwords, database + connection strings, API keys, and the like. AKV stores this + information as encrypted binary data. + externalDocs: + description: Azure Key Vault Secrets + url: >- + https://docs.microsoft.com/en-us/azure/key-vault/secrets/about-secrets + writeOnly: true + subscriptionID: + type: string + format: uuid + description: >- + Unique 36-hexadecimal character string that identifies your Azure + subscription. + tenantID: + type: string + format: uuid + description: >- + Unique 36-hexadecimal character string that identifies the Azure + Active Directory tenant within your Azure subscription. + valid: + type: boolean + description: >- + Flag that indicates whether the Azure encryption key can encrypt and + decrypt data. + readOnly: true + BackupLabel: + type: object + description: >- + Collection of key-value pairs that represent custom data to add to the + metadata file that MongoDB Cloud uploads to the bucket when the export + job finishes. + properties: + key: + type: string + description: >- + Key for the metadata file that MongoDB Cloud uploads to the bucket + when the export job finishes. + value: + type: string + description: >- + Value for the key to include in file that MongoDB Cloud uploads to + the bucket when the export job finishes. + BackupOnlineArchive: + type: object + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the online + archive. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: >- + Human-readable label that identifies the cluster that contains the + collection for which you want to create an online archive. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + collName: + type: string + description: >- + Human-readable label that identifies the collection for which you + created the online archive. + collectionType: + type: string + default: STANDARD + description: >- + Classification of MongoDB database collection that you want to + return. + + + If you set this parameter to `TIMESERIES`, set `"criteria.type" : + "date"` and `"criteria.dateFormat" : "ISODATE"`. + criteria: + $ref: '#/components/schemas/Criteria' + dataProcessRegion: + $ref: '#/components/schemas/DataProcessRegion' + dataSetName: + type: string + description: >- + Human-readable label that identifies the dataset that Atlas + generates for this online archive. + readOnly: true + dbName: + type: string + description: >- + Human-readable label of the database that contains the collection + that contains the online archive. + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + contains the specified cluster. The specified cluster contains the + collection for which to create the online archive. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + partitionFields: + type: array + description: >- + List that contains document parameters to use to logically divide + data within a collection. Partitions provide a coarse level of + filtering of the underlying collection data. To divide your data, + specify parameters that you frequently query. If you "specified + :criteria.type": "DATE" in the CREATE ONE ONLINE ARCHIVE endpoint, + then you can specify up to three parameters by which to query. One + of these parameters must be the DATE value, which is required in + this case. If you "specified :criteria.type": "CUSTOM" in the CREATE + ONE ONLINE ARCHIVE endpoint, then you can specify up to two + parameters by which to query. Queries that don't use + ":criteria.type": "DATE" or ":criteria.type": "CUSTOM" parameters + cause MongoDB to scan a full collection of all archived documents. + This takes more time and increases your costs. + items: + $ref: '#/components/schemas/PartitionField' + minItems: 1 + paused: + type: boolean + description: >- + Flag that indicates whether this online archive exists in the paused + state. A request to resume fails if the collection has another + active online archive. To pause an active online archive or resume a + paused online archive, you must include this parameter. To pause an + active archive, set this to **true**. To resume a paused archive, + set this to **false**. + schedule: + $ref: '#/components/schemas/OnlineArchiveSchedule' + state: + type: string + description: >- + Phase of the process to create this online archive when you made + this request. + + + | State | Indication | + + |-------------|------------| + + | `PENDING` | MongoDB Cloud has queued documents for archive. + Archiving hasn't started. | + + | `ARCHIVING` | MongoDB Cloud started archiving documents that meet + the archival criteria. | + + | `IDLE` | MongoDB Cloud waits to start the next archival job. + | + + | `PAUSING` | Someone chose to stop archiving. MongoDB Cloud + finishes the running archival job then changes the state to `PAUSED` + when that job completes. | + + | `PAUSED` | MongoDB Cloud has stopped archiving. Archived + documents can be queried. The specified archiving operation on the + active cluster cannot archive additional documents. You can resume + archiving for paused archives at any time. | + + | `ORPHANED` | Someone has deleted the collection associated with + an active or paused archive. MongoDB Cloud doesn't delete the + archived data. You must manually delete the online archives + associated with the deleted collection. | + + | `DELETED` | Someone has deleted the archive was deleted. When + someone deletes an online archive, MongoDB Cloud removes all + associated archived documents from the cloud object storage. | + readOnly: true + BackupOnlineArchiveCreate: + type: object + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the online + archive. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: >- + Human-readable label that identifies the cluster that contains the + collection for which you want to create an online archive. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + collName: + type: string + description: >- + Human-readable label that identifies the collection for which you + created the online archive. + collectionType: + type: string + default: STANDARD + description: >- + Classification of MongoDB database collection that you want to + return. + + + If you set this parameter to `TIMESERIES`, set `"criteria.type" : + "date"` and `"criteria.dateFormat" : "ISODATE"`. + criteria: + $ref: '#/components/schemas/Criteria' + dataProcessRegion: + $ref: '#/components/schemas/DataProcessRegion' + dataSetName: + type: string + description: >- + Human-readable label that identifies the dataset that Atlas + generates for this online archive. + readOnly: true + dbName: + type: string + description: >- + Human-readable label of the database that contains the collection + that contains the online archive. + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + contains the specified cluster. The specified cluster contains the + collection for which to create the online archive. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + partitionFields: + type: array + description: >- + List that contains document parameters to use to logically divide + data within a collection. Partitions provide a coarse level of + filtering of the underlying collection data. To divide your data, + specify parameters that you frequently query. If you "specified + :criteria.type": "DATE" in the CREATE ONE ONLINE ARCHIVE endpoint, + then you can specify up to three parameters by which to query. One + of these parameters must be the DATE value, which is required in + this case. If you "specified :criteria.type": "CUSTOM" in the CREATE + ONE ONLINE ARCHIVE endpoint, then you can specify up to two + parameters by which to query. Queries that don't use + ":criteria.type": "DATE" or ":criteria.type": "CUSTOM" parameters + cause MongoDB to scan a full collection of all archived documents. + This takes more time and increases your costs. + items: + $ref: '#/components/schemas/PartitionField' + minItems: 1 + paused: + type: boolean + description: >- + Flag that indicates whether this online archive exists in the paused + state. A request to resume fails if the collection has another + active online archive. To pause an active online archive or resume a + paused online archive, you must include this parameter. To pause an + active archive, set this to **true**. To resume a paused archive, + set this to **false**. + schedule: + $ref: '#/components/schemas/OnlineArchiveSchedule' + state: + type: string + description: >- + Phase of the process to create this online archive when you made + this request. + + + | State | Indication | + + |-------------|------------| + + | `PENDING` | MongoDB Cloud has queued documents for archive. + Archiving hasn't started. | + + | `ARCHIVING` | MongoDB Cloud started archiving documents that meet + the archival criteria. | + + | `IDLE` | MongoDB Cloud waits to start the next archival job. + | + + | `PAUSING` | Someone chose to stop archiving. MongoDB Cloud + finishes the running archival job then changes the state to `PAUSED` + when that job completes. | + + | `PAUSED` | MongoDB Cloud has stopped archiving. Archived + documents can be queried. The specified archiving operation on the + active cluster cannot archive additional documents. You can resume + archiving for paused archives at any time. | + + | `ORPHANED` | Someone has deleted the collection associated with + an active or paused archive. MongoDB Cloud doesn't delete the + archived data. You must manually delete the online archives + associated with the deleted collection. | + + | `DELETED` | Someone has deleted the archive was deleted. When + someone deletes an online archive, MongoDB Cloud removes all + associated archived documents from the cloud object storage. | + readOnly: true + required: + - collName + - criteria + - dbName + BackupRestoreJob: + type: object + properties: + batchId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the batch to + which this restore job belongs. This parameter exists only for a + sharded cluster restore. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + checkpointId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the sharded + cluster checkpoint. The checkpoint represents the point in time back + to which you want to restore you data. This parameter applies when + `"delivery.methodName" : "AUTOMATED_RESTORE"`. Use this parameter + with sharded clusters only. + + + - If you set **checkpointId**, you can't set **oplogInc**, + **oplogTs**, **snapshotId**, or **pointInTimeUTCMillis**. + + - If you provide this parameter, this endpoint restores all data up + to this checkpoint to the database you specify in the **delivery** + object. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + clusterId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the cluster with + the snapshot you want to return. This parameter returns for restore + clusters. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: >- + Human-readable label that identifies the cluster containing the + snapshots you want to retrieve. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when someone requested this restore job. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + delivery: + $ref: '#/components/schemas/BackupRestoreJobDelivery' + encryptionEnabled: + type: boolean + description: >- + Flag that indicates whether someone encrypted the data in the + restored snapshot. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + owns the snapshots. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hashes: + type: array + description: >- + List that contains documents mapping each restore file to a hashed + checksum. This parameter applies after you download the + corresponding **delivery.url**. If `"methodName" : "HTTP"`, this + list contains one object that represents the hash of the **.tar.gz** + file. + items: + $ref: '#/components/schemas/RestoreJobFileHash' + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the restore job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: >- + Universally Unique Identifier (UUID) that identifies the Key + Management Interoperability (KMIP) master key used to encrypt the + snapshot data. This parameter applies only when `"encryptionEnabled" + : "true"`. + readOnly: true + oplogInc: + type: integer + format: int32 + description: >- + Thirty-two-bit incrementing ordinal that represents operations + within a given second. When paired with **oplogTs**, this represents + the point in time to which MongoDB Cloud restores your data. This + parameter applies when `"delivery.methodName" : + "AUTOMATED_RESTORE"`. + + + - If you set **oplogInc**, you must set **oplogTs**, and can't set + **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. + + - If you provide this parameter, this endpoint restores all data up + to and including this Oplog timestamp to the database you specified + in the **delivery** object. + minimum: 1 + writeOnly: true + oplogTs: + type: string + description: >- + Date and time from which you want to restore this snapshot. This + parameter expresses its value in ISO 8601 format in UTC. This + represents the first part of an Oplog timestamp. When paired with + **oplogInc**, they represent the last database operation to which + you want to restore your data. This parameter applies when + `"delivery.methodName" : "AUTOMATED_RESTORE"`. Run a query against + **local.oplog.rs** on your replica set to find the desired + timestamp. + + + - If you set **oplogTs**, you must set **oplogInc**, and you can't + set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. + + - If you provide this parameter, this endpoint restores all data up + to and including this Oplog timestamp to the database you specified + in the **delivery** object. + pattern: >- + ^(?:[1-9]\\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d{1,9})?(?:Z|[+-][01]\\d:[0-5]\\d)$ + writeOnly: true + pointInTimeUTCMillis: + type: integer + format: int64 + description: >- + Timestamp from which you want to restore this snapshot. This + parameter expresses its value in the number of milliseconds elapsed + since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + This timestamp must fall within the last 24 hours of the current + time. This parameter applies when `"delivery.methodName" : + "AUTOMATED_RESTORE"`. + + + - If you provide this parameter, this endpoint restores all data up + to this point in time to the database you specified in the + **delivery** object. + + - If you set **pointInTimeUTCMillis**, you can't set **oplogInc**, + **oplogTs**, **snapshotId**, or **checkpointId**. + minimum: 1199145600000 + writeOnly: true + snapshotId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the snapshot to + restore. If you set **snapshotId**, you can't set **oplogInc**, + **oplogTs**, **pointInTimeUTCMillis**, or **checkpointId**. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + statusName: + type: string + description: >- + Human-readable label that identifies the status of the downloadable + file at the time of the request. + readOnly: true + timestamp: + $ref: '#/components/schemas/ApiBSONTimestamp' + required: + - delivery + BackupRestoreJobDelivery: + type: object + description: >- + Method and details that indicate how to deliver the restored snapshot + data. + properties: + authHeader: + type: string + description: >- + Header name to use when downloading the restore, used with + `"delivery.methodName" : "HTTP"`. + readOnly: true + authValue: + type: string + description: >- + Header value to use when downloading the restore, used with + `"delivery.methodName" : "HTTP"`. + readOnly: true + expirationHours: + type: integer + format: int32 + description: >- + Number of hours after the restore job completes that indicates when + the Uniform Resource Locator (URL) for the snapshot download file + expires. The resource returns this parameter when + `"delivery.methodName" : "HTTP"`. + minimum: 1 + expires: + type: string + format: date-time + description: >- + Date and time when the Uniform Resource Locator (URL) for the + snapshot download file expires. This parameter expresses its value + in the ISO 8601 timestamp format in UTC. The resource returns this + parameter when `"delivery.methodName" : "HTTP"`. + readOnly: true + maxDownloads: + type: integer + format: int32 + description: >- + Positive integer that indicates how many times you can use the + Uniform Resource Locator (URL) for the snapshot download file. The + resource returns this parameter when `"delivery.methodName" : + "HTTP"`. + minimum: 1 + methodName: + type: string + description: >- + Human-readable label that identifies the means for delivering the + data. If you set `"delivery.methodName" : "AUTOMATED_RESTORE"`, you + must also set: **delivery.targetGroupId** and + **delivery.targetClusterName** or **delivery.targetClusterId**. The + response returns `"delivery.methodName" : "HTTP"` as an automated + restore uses HyperText Transport Protocol (HTTP) to deliver the + restore job to the target host. + statusName: + type: string + description: >- + State of the downloadable snapshot file when MongoDB Cloud received + this request. + readOnly: true + targetClusterId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the target + cluster. Use the **clusterId** returned in the response body of the + **Get All Snapshots** and **Get a Snapshot** endpoints. This + parameter applies when `"delivery.methodName" : + "AUTOMATED_RESTORE"`. + + If the target cluster doesn't have backup enabled, two resources return parameters with empty values: + + - **Get All Snapshots** endpoint returns an empty results array + without **clusterId** elements + + - **Get a Snapshot** endpoint doesn't return a **clusterId** + parameter. + + + To return a response with the **clusterId** parameter, either use + the **delivery.targetClusterName** parameter or enable backup on the + target cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + targetClusterName: + type: string + description: >- + Human-readable label that identifies the target cluster. Use the + **clusterName** returned in the response body of the **Get All + Snapshots** and **Get a Snapshot** endpoints. This parameter + applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. + + + If the target cluster doesn't have backup enabled, two resources + return parameters with empty values: + + + - **Get All Snapshots** endpoint returns an empty results array + without **clusterId** elements + + - **Get a Snapshot** endpoint doesn't return a **clusterId** + parameter. + + + To return a response with the **clusterId** parameter, either use + the **delivery.targetClusterName** parameter or enable backup on the + target cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + targetGroupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + contains the destination cluster for the restore job. The resource + returns this parameter when `"delivery.methodName" : + "AUTOMATED_RESTORE"`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + url: + type: string + deprecated: true + description: >- + Uniform Resource Locator (URL) from which you can download the + restored snapshot data. Url includes the verification key. The + resource returns this parameter when `"delivery.methodName" : + "HTTP"`. + readOnly: true + urlV2: + type: string + description: >- + Uniform Resource Locator (URL) from which you can download the + restored snapshot data. This should be preferred over **url**. The + verification key must be sent as an HTTP header. The resource + returns this parameter when `"delivery.methodName" : "HTTP"`. + readOnly: true + required: + - methodName + title: Restore Snapshot Delivery Metadata + BackupSnapshot: + type: object + properties: + clusterId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the cluster with + the snapshots you want to return. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + complete: + type: boolean + description: >- + Flag that indicates whether the snapshot exists. This flag returns + `false` while MongoDB Cloud creates the snapshot. + readOnly: true + created: + $ref: '#/components/schemas/ApiBSONTimestamp' + doNotDelete: + type: boolean + description: >- + Flag that indicates whether someone can delete this snapshot. You + can't set `"doNotDelete" : true` and set a timestamp for **expires** + in the same request. + expires: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud deletes the snapshot. If + `"doNotDelete" : true`, MongoDB Cloud removes any value set for this + parameter. + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + owns the snapshots. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + incremental: + type: boolean + description: Flag indicating if this is an incremental or a full snapshot. + readOnly: true + lastOplogAppliedTimestamp: + $ref: '#/components/schemas/ApiBSONTimestamp' + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + parts: + type: array + description: >- + Metadata that describes the complete snapshot. + + + - For a replica set, this array contains a single document. + + - For a sharded cluster, this array contains one document for each + shard plus one document for the config host. + items: + $ref: '#/components/schemas/BackupSnapshotPart' + readOnly: true + BackupSnapshotPart: + type: object + description: Characteristics that identify this snapshot. + properties: + clusterId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the cluster with + the snapshots you want to return. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + compressionSetting: + type: string + description: >- + Human-readable label that identifies the method of compression for + the snapshot. + readOnly: true + dataSizeBytes: + type: integer + format: int64 + description: >- + Total size of the data stored on each node in the cluster. This + parameter expresses its value in bytes. + readOnly: true + encryptionEnabled: + type: boolean + description: Flag that indicates whether someone encrypted this snapshot. + readOnly: true + fileSizeBytes: + type: integer + format: int64 + description: Number that indicates the total size of the data files in bytes. + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: >- + Unique string that identifies the Key Management Interoperability + (KMIP) master key used to encrypt the snapshot data. The resource + returns this parameter when `"parts.encryptionEnabled" : true`. + readOnly: true + mongodVersion: + type: string + description: >- + Number that indicates the version of MongoDB that the replica set + primary ran when MongoDB Cloud created the snapshot. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + replicaSetName: + type: string + description: Human-readable label that identifies the replica set. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: >- + Number that indicates the total size of space allocated for document + storage. + readOnly: true + typeName: + type: string + description: >- + Human-readable label that identifies the type of server from which + MongoDB Cloud took this snapshot. + readOnly: true + readOnly: true + title: Snapshot Components + BackupSnapshotRetention: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + retentionUnit: + type: string + description: Quantity of time in which MongoDB Cloud measures snapshot retention. + retentionValue: + type: integer + format: int32 + description: >- + Number that indicates the amount of days, weeks, or months that + MongoDB Cloud retains the snapshot. For less frequent policy items, + MongoDB Cloud requires that you specify a value greater than or + equal to the value specified for more frequent policy items. If the + hourly policy item specifies a retention of two days, specify two + days or greater for the retention of the weekly policy item. + example: 5 + required: + - retentionUnit + - retentionValue + BackupTenantSnapshot: + type: object + properties: + expiration: + type: string + format: date-time + description: >- + Date and time when the download link no longer works. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + finishTime: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud completed writing this snapshot. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the restore job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + mongoDBVersion: + type: string + description: MongoDB host version that the snapshot runs. + readOnly: true + scheduledTime: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud will take the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + startTime: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud began taking the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + status: + type: string + description: >- + Phase of the workflow for this snapshot at the time this resource + made this request. + readOnly: true + BaseAtlasDataLakeRegion: + type: string + description: Name of the region to which the data lake routes client connections. + BaseCloudProviderInstanceSize: + type: string + description: >- + Minimum instance size to which your cluster can automatically scale. + MongoDB Cloud requires this parameter if + `"replicationSpecs[n].regionConfigs[m].autoScaling.compute.scaleDownEnabled" + : true`. + BaseNetworkPeeringConnectionSettings: + type: object + properties: + containerId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + network container that contains the specified network peering + connection. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the network + peering connection. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + providerName: + type: string + description: >- + Cloud service provider that serves the requested network peering + connection. + accepterRegionName: + type: string + description: >- + Amazon Web Services (AWS) region where the Virtual Peering + Connection (VPC) that you peered with the MongoDB Cloud VPC resides. + The resource returns `null` if your VPC and the MongoDB Cloud VPC + reside in the same region. + awsAccountId: + type: string + description: >- + Unique twelve-digit string that identifies the Amazon Web Services + (AWS) account that owns the VPC that you peered with the MongoDB + Cloud VPC. + maxLength: 12 + minLength: 12 + pattern: ^[0-9]{12}$ + connectionId: + type: string + description: Unique string that identifies the peering connection on AWS. + readOnly: true + errorStateName: + type: string + description: >- + Type of error that can be returned when requesting an Amazon Web + Services (AWS) peering connection. The resource returns `null` if + the request succeeded. + readOnly: true + routeTableCidrBlock: + type: string + description: >- + Internet Protocol (IP) addresses expressed in Classless Inter-Domain + Routing (CIDR) notation of the VPC's subnet that you want to peer + with the MongoDB Cloud VPC. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + statusName: + type: string + description: >- + State of the network peering connection at the time you made the + request. + readOnly: true + vpcId: + type: string + description: >- + Unique string that identifies the VPC on Amazon Web Services (AWS) + that you want to peer with the MongoDB Cloud VPC. + minLength: 5 + pattern: ^vpc-[0-9a-f]{17}$ + azureDirectoryId: + type: string + description: >- + Unique string that identifies the Azure AD directory in which the + VNet peered with the MongoDB Cloud VNet resides. + maxLength: 32 + minLength: 32 + pattern: >- + ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + azureSubscriptionId: + type: string + description: >- + Unique string that identifies the Azure subscription in which the + VNet you peered with the MongoDB Cloud VNet resides. + maxLength: 32 + minLength: 32 + pattern: >- + ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + errorState: + type: string + description: >- + Error message returned when a requested Azure network peering + resource returns `"status" : "FAILED"`. The resource returns `null` + if the request succeeded. + readOnly: true + resourceGroupName: + type: string + description: >- + Human-readable label that identifies the resource group in which the + VNet to peer with the MongoDB Cloud VNet resides. + pattern: ^([-\w._()])+$ + status: + type: string + description: >- + State of the network peering connection at the time you made the + request. + readOnly: true + vnetName: + type: string + description: >- + Human-readable label that identifies the VNet that you want to peer + with the MongoDB Cloud VNet. + pattern: ^([-\w._()])+$ + errorMessage: + type: string + description: >- + Details of the error returned when requesting a GCP network peering + resource. The resource returns `null` if the request succeeded. + readOnly: true + gcpProjectId: + type: string + description: >- + Human-readable label that identifies the GCP project that contains + the network that you want to peer with the MongoDB Cloud VPC. + maxLength: 30 + minLength: 6 + pattern: ^[a-z][0-9a-z-]{4,28}[0-9a-z]{1} + networkName: + type: string + description: >- + Human-readable label that identifies the network to peer with the + MongoDB Cloud VPC. + maxLength: 63 + minLength: 1 + pattern: '[a-z]([-a-z0-9]{0,62}[a-z0-9]{0,1})?' + required: + - containerId + BaseStreamsRegion: + type: string + description: Name of the cloud provider region hosting Atlas Stream Processing. + BiConnector: + type: object + description: >- + Settings needed to configure the MongoDB Connector for Business + Intelligence for this cluster. + externalDocs: + description: MongoDB Connector for Business Intelligence + url: https://docs.mongodb.com/bi-connector/current/ + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether MongoDB Connector for Business + Intelligence is enabled on the specified cluster. + readPreference: + type: string + description: >- + Data source node designated for the MongoDB Connector for Business + Intelligence on MongoDB Cloud. The MongoDB Connector for Business + Intelligence on MongoDB Cloud reads data from the primary, + secondary, or analytics node based on your read preferences. + Defaults to `ANALYTICS` node, or `SECONDARY` if there are no + `ANALYTICS` nodes. + externalDocs: + description: Read preferences for BI Connector + url: >- + https://docs.atlas.mongodb.com/cluster-config/enable-bic/#std-label-bic-read-preferences + title: MongoDB Connector for Business Intelligence Settings + BillingInvoice: + type: object + properties: + amountBilledCents: + type: integer + format: int64 + description: >- + Sum of services that the specified organization consumed in the + period covered in this invoice. This parameter expresses its value + in cents (100ths of one US Dollar) and calculates its value as + **subtotalCents** + **salesTaxCents** - **startingBalanceCents**. + readOnly: true + amountPaidCents: + type: integer + format: int64 + description: >- + Sum that the specified organization paid toward this invoice. This + parameter expresses its value in cents (100ths of one US Dollar). + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this invoice. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + creditsCents: + type: integer + format: int64 + description: >- + Sum that MongoDB credited the specified organization toward this + invoice. This parameter expresses its value in cents (100ths of one + US Dollar). + readOnly: true + endDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud finished the billing period that + this invoice covers. This parameter expresses its value in the ISO + 8601 timestamp format in UTC. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project + associated to this invoice. This identifying string doesn't appear + on all invoices. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the invoice + submitted to the specified organization. Charges typically post the + next day. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lineItems: + type: array + description: List that contains individual services included in this invoice. + items: + $ref: '#/components/schemas/InvoiceLineItem' + readOnly: true + linkedInvoices: + type: array + description: >- + List that contains the invoices for organizations linked to the + paying organization. + items: + $ref: '#/components/schemas/BillingInvoice' + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + orgId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + charged for services consumed from MongoDB Cloud. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + payments: + type: array + description: >- + List that contains funds transferred to MongoDB to cover the + specified service noted in this invoice. + items: + $ref: '#/components/schemas/BillingPayment' + readOnly: true + refunds: + type: array + description: >- + List that contains payments that MongoDB returned to the + organization for this invoice. + items: + $ref: '#/components/schemas/BillingRefund' + readOnly: true + salesTaxCents: + type: integer + format: int64 + description: >- + Sum of sales tax applied to this invoice. This parameter expresses + its value in cents (100ths of one US Dollar). + readOnly: true + startDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud began the billing period that this + invoice covers. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + startingBalanceCents: + type: integer + format: int64 + description: >- + Sum that the specified organization owed to MongoDB when MongoDB + issued this invoice. This parameter expresses its value in US + Dollars. + readOnly: true + statusName: + type: string + description: > + Phase of payment processing in which this invoice exists when you + made this request. Accepted phases include: + + + | Phase Value | Reason | + + |---|---| + + | CLOSED | MongoDB finalized all charges in the billing cycle but + has yet to charge the customer. | + + | FAILED | MongoDB attempted to charge the provided credit card but + charge for that amount failed. | + + | FORGIVEN | Customer initiated payment which MongoDB later forgave. + | + + | FREE | All charges totalled zero so the customer won't be charged. + | + + | INVOICED | MongoDB handled these charges using elastic invoicing. + | + + | PAID | MongoDB succeeded in charging the provided credit card. | + + | PENDING | Invoice includes charges for the current billing cycle. + | + + | PREPAID | Customer has a pre-paid plan so they won't be charged. | + subtotalCents: + type: integer + format: int64 + description: >- + Sum of all positive invoice line items contained in this invoice. + This parameter expresses its value in cents (100ths of one US + Dollar). + readOnly: true + updated: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud last updated the value of this + payment. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + BillingPayment: + type: object + description: >- + Funds transferred to MongoDB to cover the specified service in this + invoice. + properties: + amountBilledCents: + type: integer + format: int64 + description: >- + Sum of services that the specified organization consumed in the + period covered in this invoice. This parameter expresses its value + in cents (100ths of one US Dollar) and calculates its value as + **subtotalCents** + **salesTaxCents** - **startingBalanceCents**. + readOnly: true + amountPaidCents: + type: integer + format: int64 + description: >- + Sum that the specified organization paid toward the associated + invoice. This parameter expresses its value in cents (100ths of one + US Dollar). + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when the customer made this payment attempt. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this payment + toward the associated invoice. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + salesTaxCents: + type: integer + format: int64 + description: >- + Sum of sales tax applied to this invoice. This parameter expresses + its value in cents (100ths of one US Dollar). + readOnly: true + statusName: + type: string + description: > + Phase of payment processing for the associated invoice when you made + this request. + + + These phases include: + + + | Phase Value | Reason | + + |---|---| + + | `CANCELLED` | Customer or MongoDB cancelled the payment. | + + | `ERROR` | Issue arose when attempting to complete payment. | + + | `FAILED` | MongoDB tried to charge the credit card without + success. | + + | `FAILED_AUTHENTICATION` | Strong Customer Authentication has + failed. Confirm that your payment method is authenticated. | + + | `FORGIVEN` | Customer initiated payment which MongoDB later + forgave. | + + | `INVOICED` | MongoDB issued an invoice that included this line + item. | + + | `NEW` | Customer provided a method of payment, but MongoDB hasn't + tried to charge the credit card. | + + | `PAID` | Customer submitted a successful payment. | + + | `PARTIAL_PAID` | Customer paid for part of this line item. | + subtotalCents: + type: integer + format: int64 + description: >- + Sum of all positive invoice line items contained in this invoice. + This parameter expresses its value in cents (100ths of one US + Dollar). + readOnly: true + updated: + type: string + format: date-time + description: >- + Date and time when the customer made an update to this payment + attempt. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + title: Payment + BillingRefund: + type: object + description: One payment that MongoDB returned to the organization for this invoice. + properties: + amountCents: + type: integer + format: int64 + description: >- + Sum of the funds returned to the specified organization expressed in + cents (100th of US Dollar). + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this refund. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + paymentId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the payment that + the organization had made. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + reason: + type: string + description: >- + Justification that MongoDB accepted to return funds to the + organization. + readOnly: true + title: Refund + CloudAccessRoleAssignment: + type: object + description: >- + MongoDB Cloud user's roles and the corresponding organization or project + to which that role applies. Each role can apply to one organization or + one project but not both. + properties: + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project to + which this role belongs. You can set a value for this parameter or + **orgId** but not both in the same request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + orgId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + to which this role belongs. You can set a value for this parameter + or **groupId** but not both in the same request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + roleName: + type: string + description: >+ + Human-readable label that identifies the collection of privileges + that MongoDB Cloud grants a specific API key, MongoDB Cloud user, or + MongoDB Cloud team. These roles include organization- and + project-level roles. + + + Organization Roles + + + * ORG_OWNER + + * ORG_MEMBER + + * ORG_GROUP_CREATOR + + * ORG_BILLING_ADMIN + + * ORG_READ_ONLY + + + Project Roles + + + * GROUP_CLUSTER_MANAGER + + * GROUP_DATA_ACCESS_ADMIN + + * GROUP_DATA_ACCESS_READ_ONLY + + * GROUP_DATA_ACCESS_READ_WRITE + + * GROUP_OWNER + + * GROUP_READ_ONLY + + * GROUP_SEARCH_INDEX_EDITOR + + title: Role Assignment + CloudAppUser: + type: object + properties: + country: + type: string + description: >- + Two alphabet characters that identifies MongoDB Cloud user's + geographic location. This parameter uses the ISO 3166-1a2 code + format. + pattern: ^([A-Z]{2})$ + createdAt: + type: string + format: date-time + description: >- + Date and time when the current account is created. This value is in + the ISO 8601 timestamp format in UTC. + readOnly: true + emailAddress: + type: string + format: email + description: Email address that belongs to the MongoDB Cloud user. + firstName: + type: string + description: First or given name that belongs to the MongoDB Cloud user. + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + user. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lastAuth: + type: string + format: date-time + description: >- + Date and time when the current account last authenticated. This + value is in the ISO 8601 timestamp format in UTC. + readOnly: true + lastName: + type: string + description: >- + Last name, family name, or surname that belongs to the MongoDB Cloud + user. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + mobileNumber: + type: string + description: Mobile phone number that belongs to the MongoDB Cloud user. + pattern: >- + (?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})$ + password: + type: string + description: >- + Password applied with the username to log in to MongoDB Cloud. + MongoDB Cloud does not return this parameter except in response to + creating a new MongoDB Cloud user. Only the MongoDB Cloud user can + update their password after it has been set from the MongoDB Cloud + console. + minLength: 8 + roles: + type: array + description: >- + List of objects that display the MongoDB Cloud user's roles and the + corresponding organization or project to which that role applies. A + role can apply to one organization or one project but not both. + items: + $ref: '#/components/schemas/CloudAccessRoleAssignment' + teamIds: + type: array + description: >- + List of unique 24-hexadecimal digit strings that identifies the + teams to which this MongoDB Cloud user belongs. + items: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the team to + which this MongoDB Cloud user belongs. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + uniqueItems: true + username: + type: string + format: email + description: >- + Email address that represents the username of the MongoDB Cloud + user. + required: + - country + - emailAddress + - firstName + - lastName + - mobileNumber + - password + - username + CloudCluster: + type: object + description: >- + Settings that describe the clusters in each project that the API key is + authorized to view. + properties: + alertCount: + type: integer + format: int32 + description: >- + Whole number that indicates the quantity of alerts open on the + cluster. + readOnly: true + authEnabled: + type: boolean + description: >- + Flag that indicates whether authentication is required to access the + nodes in this cluster. + readOnly: true + availability: + type: string + description: >- + Term that expresses how many nodes of the cluster can be accessed + when MongoDB Cloud receives this request. This parameter returns + `available` when all nodes are accessible, `warning` only when some + nodes in the cluster can be accessed, `unavailable` when the cluster + can't be accessed, or `dead` when the cluster has been deactivated. + readOnly: true + backupEnabled: + type: boolean + description: >- + Flag that indicates whether the cluster can perform backups. If set + to `true`, the cluster can perform backups. You must set this value + to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated + clusters and Shared Cluster Backups for tenant clusters. If set to + `false`, the cluster doesn't use MongoDB Cloud backups. + readOnly: true + clusterId: + type: string + description: Unique 24-hexadecimal character string that identifies the cluster. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + dataSizeBytes: + type: integer + format: int64 + description: >- + Total size of the data stored on each node in the cluster. The + resource expresses this value in bytes. + readOnly: true + name: + type: string + description: Human-readable label that identifies the cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + nodeCount: + type: integer + format: int32 + description: >- + Whole number that indicates the quantity of nodes that comprise the + cluster. + readOnly: true + sslEnabled: + type: boolean + description: >- + Flag that indicates whether TLS authentication is required to access + the nodes in this cluster. + readOnly: true + type: + type: string + description: Human-readable label that indicates the cluster type. + readOnly: true + versions: + type: array + description: >- + List that contains the versions of MongoDB that each node in the + cluster runs. + items: + type: string + readOnly: true + uniqueItems: true + readOnly: true + CloudDatabaseUser: + type: object + properties: + awsIAMType: + type: string + default: NONE + description: >- + Human-readable label that indicates whether the new database user + authenticates with the Amazon Web Services (AWS) Identity and Access + Management (IAM) credentials associated with the user or the user's + role. + databaseName: + type: string + default: admin + description: >- + Database against which the database user authenticates. Database + users must provide both a username and authentication database to + log into MongoDB. + deleteAfterDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud deletes the user. This parameter + expresses its value in the ISO 8601 timestamp format in UTC and can + include the time zone designation. You must specify a future date + that falls within one week of making the Application Programming + Interface (API) request. + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + labels: + type: array + description: >- + List that contains the key-value pairs for tagging and categorizing + the MongoDB database user. The labels that you define do not appear + in the console. + items: + $ref: '#/components/schemas/ComponentLabel' + ldapAuthType: + type: string + default: NONE + description: >- + Part of the Lightweight Directory Access Protocol (LDAP) record that + the database uses to authenticate this database user on the LDAP + host. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + oidcAuthType: + type: string + default: NONE + description: >- + Human-readable label that indicates whether the new database user + authenticates with OIDC federated authentication. To create a + federated authentication user, specify the value of IDP_GROUP for + this field. + password: + type: string + description: >- + Alphanumeric string that authenticates this database user against + the database specified in `databaseName`. To authenticate with + SCRAM-SHA, you must specify this parameter. This parameter doesn't + appear in this response. + externalDocs: + description: SCRAM-SHA + url: https://docs.mongodb.com/manual/core/security-scram/ + minLength: 8 + writeOnly: true + roles: + type: array + description: >- + List that provides the pairings of one role with one applicable + database. + items: + $ref: '#/components/schemas/DatabaseUserRole' + scopes: + type: array + description: >- + List that contains clusters and MongoDB Atlas Data Lakes that this + database user can access. If omitted, MongoDB Cloud grants the + database user access to all the clusters and MongoDB Atlas Data + Lakes in the project. + items: + $ref: '#/components/schemas/UserScope' + username: + type: string + description: > + Human-readable label that represents the user that authenticates to + MongoDB. The format of this label depends on the method of + authentication: + + + | Authentication Method | Parameter Needed | Parameter Value | + username Format | + + |---|---|---|---| + + | AWS IAM | awsType | ROLE | ARN | + + | AWS IAM | awsType | USER | ARN | + + | x.509 | x509Type | CUSTOMER | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | x.509 | x509Type | MANAGED | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | USER | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | GROUP | [RFC + 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in + federation settings), followed by a '/', followed by the IdP group + name | + + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | + Alphanumeric string | + maxLength: 1024 + x509Type: + type: string + default: NONE + description: >- + X.509 method that MongoDB Cloud uses to authenticate the database + user. + + + - For application-managed X.509, specify `MANAGED`. + + - For self-managed X.509, specify `CUSTOMER`. + + + Users created with the `CUSTOMER` method require a Common Name (CN) + in the **username** parameter. You must create externally + authenticated users on the `$external` database. + required: + - databaseName + - groupId + - username + CloudProviderAccessAWSIAMRole: + type: object + allOf: + - $ref: '#/components/schemas/CloudProviderAccessRole' + - type: object + properties: + atlasAWSAccountArn: + type: string + description: >- + Amazon Resource Name that identifies the Amazon Web Services + (AWS) user account that MongoDB Cloud uses when it assumes the + Identity and Access Management (IAM) role. + example: arn:aws:iam::772401394250:role/my-test-aws-role + maxLength: 2048 + minLength: 20 + readOnly: true + atlasAssumedRoleExternalId: + type: string + format: uuid + description: >- + Unique external ID that MongoDB Cloud uses when it assumes the + IAM role in your Amazon Web Services (AWS) account. + readOnly: true + authorizedDate: + type: string + format: date-time + description: >- + Date and time when someone authorized this role for the + specified cloud service provider. This parameter expresses its + value in the ISO 8601 timestamp format in UTC. + readOnly: true + createdDate: + type: string + format: date-time + description: >- + Date and time when someone created this role for the specified + cloud service provider. This parameter expresses its value in + the ISO 8601 timestamp format in UTC. + readOnly: true + featureUsages: + type: array + description: >- + List that contains application features associated with this + Amazon Web Services (AWS) Identity and Access Management (IAM) + role. + items: + $ref: '#/components/schemas/CloudProviderAccessFeatureUsage' + readOnly: true + iamAssumedRoleArn: + type: string + description: >- + Amazon Resource Name (ARN) that identifies the Amazon Web + Services (AWS) Identity and Access Management (IAM) role that + MongoDB Cloud assumes when it accesses resources in your AWS + account. + example: arn:aws:iam::123456789012:root + maxLength: 2048 + minLength: 20 + roleId: + type: string + description: Unique 24-hexadecimal digit string that identifies the role. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + description: >- + Details that describe the features linked to the Amazon Web Services + (AWS) Identity and Access Management (IAM) role. + required: + - providerName + properties: + atlasAWSAccountArn: + type: string + description: >- + Amazon Resource Name that identifies the Amazon Web Services (AWS) + user account that MongoDB Cloud uses when it assumes the Identity + and Access Management (IAM) role. + example: arn:aws:iam::772401394250:role/my-test-aws-role + maxLength: 2048 + minLength: 20 + readOnly: true + atlasAssumedRoleExternalId: + type: string + format: uuid + description: >- + Unique external ID that MongoDB Cloud uses when it assumes the IAM + role in your Amazon Web Services (AWS) account. + readOnly: true + authorizedDate: + type: string + format: date-time + description: >- + Date and time when someone authorized this role for the specified + cloud service provider. This parameter expresses its value in the + ISO 8601 timestamp format in UTC. + readOnly: true + createdDate: + type: string + format: date-time + description: >- + Date and time when someone created this role for the specified cloud + service provider. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + featureUsages: + type: array + description: >- + List that contains application features associated with this Amazon + Web Services (AWS) Identity and Access Management (IAM) role. + items: + $ref: '#/components/schemas/CloudProviderAccessFeatureUsage' + readOnly: true + iamAssumedRoleArn: + type: string + description: >- + Amazon Resource Name (ARN) that identifies the Amazon Web Services + (AWS) Identity and Access Management (IAM) role that MongoDB Cloud + assumes when it accesses resources in your AWS account. + example: arn:aws:iam::123456789012:root + maxLength: 2048 + minLength: 20 + roleId: + type: string + description: Unique 24-hexadecimal digit string that identifies the role. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + CloudProviderAccessFeatureUsage: + type: object + description: >- + MongoDB Cloud features associated with this Amazon Web Services (AWS) + Identity and Access Management (IAM) role. + properties: + featureType: + type: string + description: >- + Human-readable label that describes one MongoDB Cloud feature linked + to this Amazon Web Services (AWS) Identity and Access Management + (IAM) role. + readOnly: true + featureId: + $ref: >- + #/components/schemas/CloudProviderAccessFeatureUsagePushBasedLogExportFeatureId + CloudProviderAccessFeatureUsagePushBasedLogExportFeatureId: + type: object + description: >- + Identifying characteristics about the Amazon Web Services (AWS) Simple + Storage Service (S3) export bucket linked to this AWS Identity and + Access Management (IAM) role. + properties: + bucketName: + type: string + description: Name of the AWS S3 bucket to which your logs will be exported to. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies your project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + CloudProviderAccessRole: + type: object + description: Cloud provider access role. + properties: + providerName: + type: string + description: Human-readable label that identifies the cloud provider of the role. + atlasAWSAccountArn: + type: string + description: >- + Amazon Resource Name that identifies the Amazon Web Services (AWS) + user account that MongoDB Cloud uses when it assumes the Identity + and Access Management (IAM) role. + example: arn:aws:iam::772401394250:role/my-test-aws-role + maxLength: 2048 + minLength: 20 + readOnly: true + atlasAssumedRoleExternalId: + type: string + format: uuid + description: >- + Unique external ID that MongoDB Cloud uses when it assumes the IAM + role in your Amazon Web Services (AWS) account. + readOnly: true + authorizedDate: + type: string + format: date-time + description: >- + Date and time when someone authorized this role for the specified + cloud service provider. This parameter expresses its value in the + ISO 8601 timestamp format in UTC. + readOnly: true + createdDate: + type: string + format: date-time + description: >- + Date and time when someone created this role for the specified cloud + service provider. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + + + Alternatively: + + Date and time when this Azure Service Principal was created. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + featureUsages: + type: array + description: >- + List that contains application features associated with this Amazon + Web Services (AWS) Identity and Access Management (IAM) role. + + + Alternatively: + + List that contains application features associated with this Azure + Service Principal. + items: + $ref: '#/components/schemas/CloudProviderAccessFeatureUsage' + readOnly: true + iamAssumedRoleArn: + type: string + description: >- + Amazon Resource Name (ARN) that identifies the Amazon Web Services + (AWS) Identity and Access Management (IAM) role that MongoDB Cloud + assumes when it accesses resources in your AWS account. + example: arn:aws:iam::123456789012:root + maxLength: 2048 + minLength: 20 + roleId: + type: string + description: Unique 24-hexadecimal digit string that identifies the role. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + _id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the Azure Service + Principal in Atlas. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + atlasAzureAppId: + type: string + description: Azure Active Directory Application ID of Atlas. + maxLength: 36 + minLength: 32 + pattern: >- + ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + lastUpdatedDate: + type: string + format: date-time + description: >- + Date and time when this Azure Service Principal was last updated. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + servicePrincipalId: + type: string + description: UUID string that identifies the Azure Service Principal. + maxLength: 36 + minLength: 32 + pattern: >- + ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + tenantId: + type: string + description: UUID String that identifies the Azure Active Directory Tenant ID. + maxLength: 36 + minLength: 32 + pattern: >- + ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + required: + - providerName + CloudProviderAccessRoles: + type: object + properties: + awsIamRoles: + type: array + description: >- + List that contains the Amazon Web Services (AWS) IAM roles + registered and authorized with MongoDB Cloud. + items: + $ref: '#/components/schemas/CloudProviderAccessAWSIAMRole' + CloudProviderContainer: + type: object + description: >- + Collection of settings that configures the network container for a + virtual private connection on Amazon Web Services. + properties: + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the network + peering container. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + providerName: + type: string + description: >- + Cloud service provider that serves the requested network peering + containers. + provisioned: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud clusters exist in the + specified network peering container. + readOnly: true + atlasCidrBlock: + type: string + description: >- + IP addresses expressed in Classless Inter-Domain Routing (CIDR) + notation that MongoDB Cloud uses for the network peering containers + in your project. MongoDB Cloud assigns all of the project's clusters + deployed to this cloud provider an IP address from this range. + MongoDB Cloud locks this value if an M10 or greater cluster or a + network peering connection exists in this project. + + + These CIDR blocks must fall within the ranges reserved per RFC 1918. + AWS and Azure further limit the block to between the `/24` and + `/21` ranges. + + + To modify the CIDR block, the target project cannot have: + + + - Any M10 or greater clusters + + - Any other VPC peering connections + + You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. + + **Example:** A project in an Amazon Web Services (AWS) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. + + Alternatively: + + IP addresses expressed in Classless Inter-Domain Routing (CIDR) + notation that MongoDB Cloud uses for the network peering containers + in your project. MongoDB Cloud assigns all of the project's clusters + deployed to this cloud provider an IP address from this range. + MongoDB Cloud locks this value if an M10 or greater cluster or a + network peering connection exists in this project. + + + These CIDR blocks must fall within the ranges reserved per RFC 1918. + GCP further limits the block to a lower bound of the `/18` range. + + + To modify the CIDR block, the target project cannot have: + + + - Any M10 or greater clusters + + - Any other VPC peering connections + + You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. + + **Example:** A project in an Google Cloud (GCP) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. + + Alternatively: + + IP addresses expressed in Classless Inter-Domain Routing (CIDR) + notation that MongoDB Cloud uses for the network peering containers + in your project. MongoDB Cloud assigns all of the project's clusters + deployed to this cloud provider an IP address from this range. + MongoDB Cloud locks this value if an M10 or greater cluster or a + network peering connection exists in this project. + + + These CIDR blocks must fall within the ranges reserved per RFC 1918. + AWS and Azure further limit the block to between the `/24` and + `/21` ranges. + + + To modify the CIDR block, the target project cannot have: + + + - Any M10 or greater clusters + + - Any other VPC peering connections + + You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. + + **Example:** A project in an Amazon Web Services (AWS) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. + pattern: >- + ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + azureSubscriptionId: + type: string + description: >- + Unique string that identifies the Azure subscription in which the + MongoDB Cloud VNet resides. + example: 32b6e34b3d91647abb20e7b8 + pattern: ^([a-f0-9]{24})$ + readOnly: true + region: + type: string + description: >- + Azure region to which MongoDB Cloud deployed this network peering + container. + vnetName: + type: string + description: >- + Unique string that identifies the Azure VNet in which MongoDB Cloud + clusters in this network peering container exist. The response + returns **null** if no clusters exist in this network peering + container. + maxLength: 38 + minLength: 38 + pattern: ^([-\w._()])+$ + readOnly: true + gcpProjectId: + type: string + description: >- + Unique string that identifies the GCP project in which MongoDB Cloud + clusters in this network peering container exist. The response + returns **null** if no clusters exist in this network peering + container. + maxLength: 26 + minLength: 26 + pattern: ^p-[0-9a-z]{24}$ + readOnly: true + networkName: + type: string + description: >- + Human-readable label that identifies the network in which MongoDB + Cloud clusters in this network peering container exist. MongoDB + Cloud returns **null** if no clusters exist in this network peering + container. + maxLength: 36 + minLength: 36 + pattern: ^nt-[0-9a-f]{24}-[0-9a-z]{8}$ + readOnly: true + regions: + type: array + description: >- + List of GCP regions to which you want to deploy this MongoDB Cloud + network peering container. In this MongoDB Cloud project, you can + deploy clusters only to the GCP regions in this list. To deploy + MongoDB Cloud clusters to other GCP regions, create additional + projects. + items: + type: string + description: >- + List of GCP regions to which you want to deploy this MongoDB Cloud + network peering container. In this MongoDB Cloud project, you can + deploy clusters only to the GCP regions in this list. To deploy + MongoDB Cloud clusters to other GCP regions, create additional + projects. + regionName: + type: string + description: >- + Geographic area that Amazon Web Services (AWS) defines to which + MongoDB Cloud deployed this network peering container. + vpcId: + type: string + description: Unique string that identifies the MongoDB Cloud VPC on AWS. + example: vpc-b555d3b0d9cb783b0 + minLength: 5 + pattern: ^vpc-[0-9a-f]{17}$ + readOnly: true + CloudProviderEndpointServiceRequest: + type: object + properties: + providerName: + type: string + description: >- + Human-readable label that identifies the cloud service provider for + which you want to create the private endpoint service. + writeOnly: true + region: + type: string + description: >- + Cloud provider region in which you want to create the private + endpoint service. Regions accepted as values differ for [Amazon Web + Services](https://docs.atlas.mongodb.com/reference/amazon-aws/), + [Google Cloud + Platform](https://docs.atlas.mongodb.com/reference/google-gcp/), and + [Microsoft + Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). + writeOnly: true + required: + - providerName + - region + CloudProviderRegions: + type: object + properties: + instanceSizes: + type: array + description: List of instances sizes that this cloud provider supports. + items: + $ref: '#/components/schemas/ClusterCloudProviderInstanceSize' + readOnly: true + provider: + type: string + description: Human-readable label that identifies the Cloud provider. + CloudRegionConfig: + type: object + description: Cloud service provider on which MongoDB Cloud provisions the hosts. + properties: + electableSpecs: + $ref: '#/components/schemas/HardwareSpec' + priority: + type: integer + format: int32 + description: >- + Precedence is given to this region when a primary election occurs. + If your **regionConfigs** has only **readOnlySpecs**, + **analyticsSpecs**, or both, set this value to `0`. If you have + multiple **regionConfigs** objects (your cluster is multi-region or + multi-cloud), they must have priorities in descending order. The + highest priority is `7`. + + + **Example:** If you have three regions, their priorities would be + `7`, `6`, and `5` respectively. If you added two more regions for + supporting electable nodes, the priorities of those regions would be + `4` and `3` respectively. + maximum: 7 + minimum: 0 + providerName: + type: string + description: >- + Cloud service provider on which MongoDB Cloud provisions the hosts. + Set dedicated clusters to `AWS`, `GCP`, `AZURE` or `TENANT`. + regionName: + type: string + description: >- + Physical location of your MongoDB cluster nodes. The region you + choose can affect network latency for clients accessing your + databases. When MongoDB Cloud deploys a dedicated cluster, it checks + if a VPC or VPC connection exists for that provider and region. If + not, MongoDB Cloud creates them as part of the deployment. It + assigns the VPC a Classless Inter-Domain Routing (CIDR) block. To + limit a new VPC peering connection to one Classless Inter-Domain + Routing (CIDR) block and region, create the connection first. Deploy + the cluster after the connection starts. GCP Clusters and + Multi-region clusters require one VPC peering connection for each + region. MongoDB nodes can use only the peering connection that + resides in the same region as the nodes to communicate with the + peered VPC. + analyticsAutoScaling: + $ref: '#/components/schemas/AdvancedAutoScalingSettings' + analyticsSpecs: + $ref: '#/components/schemas/DedicatedHardwareSpec' + autoScaling: + $ref: '#/components/schemas/AdvancedAutoScalingSettings' + readOnlySpecs: + $ref: '#/components/schemas/DedicatedHardwareSpec' + backingProviderName: + type: string + description: >- + Cloud service provider on which MongoDB Cloud provisioned the + multi-tenant cluster. The resource returns this parameter when + **providerSettings.providerName** is `TENANT` and + **providerSetting.instanceSizeName** is `M2` or `M5`. + title: Cloud Service Provider Settings for Multi-Cloud Clusters + CloudSearchMetrics: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hardwareMetrics: + type: array + description: >- + List that contains all host compute, memory, and storage utilization + dedicated to Atlas Search when MongoDB Atlas received this request. + items: + $ref: '#/components/schemas/FTSMetric' + readOnly: true + indexMetrics: + type: array + description: >- + List that contains all performance and utilization measurements that + Atlas Search index performed by the time MongoDB Atlas received this + request. + items: + $ref: '#/components/schemas/FTSMetric' + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + processId: + type: string + description: Hostname and port that identifies the process. + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + statusMetrics: + type: array + description: >- + List that contains all available Atlas Search status metrics when + MongoDB Atlas received this request. + items: + $ref: '#/components/schemas/FTSMetric' + readOnly: true + required: + - groupId + - processId + ClusterAutoScalingSettings: + type: object + description: Range of instance sizes to which your cluster can scale. + externalDocs: + description: Cluster Auto-Scaling + url: https://docs.atlas.mongodb.com/cluster-autoscaling/ + properties: + compute: + $ref: '#/components/schemas/ClusterComputeAutoScaling' + diskGBEnabled: + type: boolean + description: >- + Flag that indicates whether someone enabled disk auto-scaling for + this cluster. + title: Automatic Cluster Scaling Settings + ClusterCloudProviderInstanceSize: + type: object + description: List of instances sizes that this cloud provider supports. + properties: + availableRegions: + type: array + description: >- + List of regions that this cloud provider supports for this instance + size. + items: + $ref: '#/components/schemas/AvailableCloudProviderRegion' + readOnly: true + name: + type: string + description: >- + Human-readable label that identifies the instance size or cluster + tier. + readOnly: true + readOnly: true + ClusterComputeAutoScaling: + type: object + description: >- + Collection of settings that configures how a cluster might scale its + cluster tier and whether the cluster can scale down. Cluster tier + auto-scaling is unavailable for clusters using Low CPU or NVME storage + classes. + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether cluster tier auto-scaling is enabled. + Set to `true` to enable cluster tier auto-scaling. If enabled, you + must specify a value for + **providerSettings.autoScaling.compute.maxInstanceSize** also. Set + to `false` to disable cluster tier auto-scaling. + scaleDownEnabled: + type: boolean + description: >- + Flag that indicates whether the cluster tier can scale down. This is + required if **autoScaling.compute.enabled** is `true`. If you enable + this option, specify a value for + **providerSettings.autoScaling.compute.minInstanceSize**. + ClusterConnectionStrings: + type: object + description: >- + Collection of Uniform Resource Locators that point to the MongoDB + database. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + properties: + awsPrivateLink: + type: object + additionalProperties: + type: string + description: >- + Private endpoint-aware connection strings that use AWS-hosted + clusters with Amazon Web Services (AWS) PrivateLink. Each key + identifies an Amazon Web Services (AWS) interface endpoint. Each + value identifies the related `mongodb://` connection string that + you use to connect to MongoDB Cloud through the interface endpoint + that the key names. + externalDocs: + description: Network Peering Connection + url: >- + https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + description: >- + Private endpoint-aware connection strings that use AWS-hosted + clusters with Amazon Web Services (AWS) PrivateLink. Each key + identifies an Amazon Web Services (AWS) interface endpoint. Each + value identifies the related `mongodb://` connection string that you + use to connect to MongoDB Cloud through the interface endpoint that + the key names. + externalDocs: + description: Network Peering Connection + url: >- + https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + awsPrivateLinkSrv: + type: object + additionalProperties: + type: string + description: >- + Private endpoint-aware connection strings that use AWS-hosted + clusters with Amazon Web Services (AWS) PrivateLink. Each key + identifies an Amazon Web Services (AWS) interface endpoint. Each + value identifies the related `mongodb://` connection string that + you use to connect to Atlas through the interface endpoint that + the key names. + externalDocs: + description: Network Peering Connection + url: >- + https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + description: >- + Private endpoint-aware connection strings that use AWS-hosted + clusters with Amazon Web Services (AWS) PrivateLink. Each key + identifies an Amazon Web Services (AWS) interface endpoint. Each + value identifies the related `mongodb://` connection string that you + use to connect to Atlas through the interface endpoint that the key + names. + externalDocs: + description: Network Peering Connection + url: >- + https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + private: + type: string + description: >- + Network peering connection strings for each interface Virtual + Private Cloud (VPC) endpoint that you configured to connect to this + cluster. This connection string uses the `mongodb+srv://` protocol. + The resource returns this parameter once someone creates a network + peering connection to this cluster. This protocol tells the + application to look up the host seed list in the Domain Name System + (DNS). This list synchronizes with the nodes in a cluster. If the + connection string uses this Uniform Resource Identifier (URI) + format, you don't need to append the seed list or change the URI if + the nodes change. Use this URI format if your driver supports it. If + it doesn't, use connectionStrings.private. For Amazon Web Services + (AWS) clusters, this resource returns this parameter only if you + enable custom DNS. + externalDocs: + description: Network Peering Connection + url: >- + https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + privateEndpoint: + type: array + description: >- + List of private endpoint-aware connection strings that you can use + to connect to this cluster through a private endpoint. This + parameter returns only if you deployed a private endpoint to all + regions to which you deployed this clusters' nodes. + items: + $ref: >- + #/components/schemas/ClusterDescriptionConnectionStringsPrivateEndpoint + readOnly: true + privateSrv: + type: string + description: >- + Network peering connection strings for each interface Virtual + Private Cloud (VPC) endpoint that you configured to connect to this + cluster. This connection string uses the `mongodb+srv://` protocol. + The resource returns this parameter when someone creates a network + peering connection to this cluster. This protocol tells the + application to look up the host seed list in the Domain Name System + (DNS). This list synchronizes with the nodes in a cluster. If the + connection string uses this Uniform Resource Identifier (URI) + format, you don't need to append the seed list or change the Uniform + Resource Identifier (URI) if the nodes change. Use this Uniform + Resource Identifier (URI) format if your driver supports it. If it + doesn't, use `connectionStrings.private`. For Amazon Web Services + (AWS) clusters, this parameter returns only if you [enable custom + DNS](https://docs.atlas.mongodb.com/reference/api/aws-custom-dns-update/). + externalDocs: + description: Network Peering Connection + url: >- + https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + standard: + type: string + description: >- + Public connection string that you can use to connect to this + cluster. This connection string uses the `mongodb://` protocol. + externalDocs: + description: Connection String URI Format + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + standardSrv: + type: string + description: >- + Public connection string that you can use to connect to this + cluster. This connection string uses the `mongodb+srv://` protocol. + externalDocs: + description: Connection String URI Format + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + readOnly: true + title: Cluster Connection Strings + ClusterDescriptionConnectionStringsPrivateEndpoint: + type: object + description: >- + Private endpoint-aware connection string that you can use to connect to + this cluster through a private endpoint. + externalDocs: + description: Private Endpoint for Dedicated Cluster + url: https://docs.atlas.mongodb.com/security-private-endpoint/ + properties: + connectionString: + type: string + description: >- + Private endpoint-aware connection string that uses the `mongodb://` + protocol to connect to MongoDB Cloud through a private endpoint. + readOnly: true + endpoints: + type: array + description: >- + List that contains the private endpoints through which you connect + to MongoDB Cloud when you use + **connectionStrings.privateEndpoint[n].connectionString** or + **connectionStrings.privateEndpoint[n].srvConnectionString**. + items: + $ref: >- + #/components/schemas/ClusterDescriptionConnectionStringsPrivateEndpointEndpoint + readOnly: true + srvConnectionString: + type: string + description: >- + Private endpoint-aware connection string that uses the + `mongodb+srv://` protocol to connect to MongoDB Cloud through a + private endpoint. The `mongodb+srv` protocol tells the driver to + look up the seed list of hosts in the Domain Name System (DNS). This + list synchronizes with the nodes in a cluster. If the connection + string uses this Uniform Resource Identifier (URI) format, you don't + need to append the seed list or change the Uniform Resource + Identifier (URI) if the nodes change. Use this Uniform Resource + Identifier (URI) format if your application supports it. If it + doesn't, use connectionStrings.privateEndpoint[n].connectionString. + readOnly: true + srvShardOptimizedConnectionString: + type: string + description: >- + Private endpoint-aware connection string optimized for sharded + clusters that uses the `mongodb+srv://` protocol to connect to + MongoDB Cloud through a private endpoint. If the connection string + uses this Uniform Resource Identifier (URI) format, you don't need + to change the Uniform Resource Identifier (URI) if the nodes change. + Use this Uniform Resource Identifier (URI) format if your + application and Atlas cluster supports it. If it doesn't, use and + consult the documentation for + connectionStrings.privateEndpoint[n].srvConnectionString. + readOnly: true + type: + type: string + description: >- + MongoDB process type to which your application connects. Use + `MONGOD` for replica sets and `MONGOS` for sharded clusters. + readOnly: true + title: Cluster Private Endpoint Connection String + ClusterDescriptionConnectionStringsPrivateEndpointEndpoint: + type: object + description: Details of a private endpoint deployed for this cluster. + properties: + endpointId: + type: string + description: >- + Unique string that the cloud provider uses to identify the private + endpoint. + readOnly: true + providerName: + type: string + description: Cloud provider in which MongoDB Cloud deploys the private endpoint. + readOnly: true + region: + type: string + description: Region where the private endpoint is deployed. + readOnly: true + title: Cluster Private Endpoint Connection Strings Endpoint + ClusterDescriptionProcessArgs: + type: object + properties: + chunkMigrationConcurrency: + type: integer + format: int32 + default: 1 + description: >- + Number of threads on the source shard and the receiving shard for + chunk migration. The number of threads should not exceed the half + the total number of CPU cores in the sharded cluster. + externalDocs: + description: >- + This option corresponds to the `chunkMigrationConcurrency` + `mongod` configuration file option. + url: >- + https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.chunkMigrationConcurrency + defaultReadConcern: + type: string + default: available + description: >- + Default level of acknowledgment requested from MongoDB for read + operations set for this cluster. + + + MongoDB 4.4 clusters default to `available`. MongoDB 5.0 and later + clusters default to `local`. + externalDocs: + description: This option corresponds to the global default read concern. + url: https://docs.mongodb.com/manual/reference/read-concern/ + defaultWriteConcern: + type: string + default: '1' + description: >- + Default level of acknowledgment requested from MongoDB for write + operations set for this cluster. + + + MongoDB 4.4 clusters default to `1`. MongoDB 5.0 and later clusters + default to `majority`. + externalDocs: + description: This option corresponds to the the implicit default write concern. + url: https://docs.mongodb.com/manual/reference/write-concern/ + failIndexKeyTooLong: + type: boolean + default: true + description: >- + Flag that indicates whether you can insert or update documents where + all indexed entries don't exceed 1024 bytes. If you set this to + false, + [mongod](https://docs.mongodb.com/upcoming/reference/program/mongod/#mongodb-binary-bin.mongod) + writes documents that exceed this limit but doesn't index them. + externalDocs: + description: >- + This option corresponds to the `failIndexKeyTooLong` `mongod` + configuration file option. + url: >- + https://docs.mongodb.com/upcoming/reference/parameters/#mongodb-parameter-param.failIndexKeyTooLong + javascriptEnabled: + type: boolean + default: true + description: >- + Flag that indicates whether the cluster allows execution of + operations that perform server-side executions of JavaScript. + externalDocs: + description: >- + If your cluster runs a MongoDB version less than 4.4, this option + corresponds to modifying the `security.javascriptEnabled` + configuration file option for each `mongod` in the cluster. If + your cluster runs MongoDB version 4.4 or greater, this option + corresponds to modifying the `security.javascriptEnabled` + configuration file option for each `mongod` and `mongos` in the + cluster. + url: >- + https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-security.javascriptEnabled + minimumEnabledTlsProtocol: + type: string + description: >- + Minimum Transport Layer Security (TLS) version that the cluster + accepts for incoming connections. Clusters using TLS 1.0 or 1.1 + should consider setting TLS 1.2 as the minimum TLS protocol version. + externalDocs: + description: >- + This option corresponds to the `net.ssl.disabledProtocols` + `mongod` configuration file option. + url: >- + https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-net.ssl.disabledProtocols + noTableScan: + type: boolean + default: false + description: >- + Flag that indicates whether the cluster disables executing any query + that requires a collection scan to return results. + externalDocs: + description: >- + This option corresponds to the `notablescan` `mongod` + configuration file option. + url: >- + https://docs.mongodb.com/upcoming/reference/parameters/#mongodb-parameter-param.notablescan + oplogMinRetentionHours: + type: number + format: double + description: >- + Minimum retention window for cluster's oplog expressed in hours. A + value of null indicates that the cluster uses the default minimum + oplog window that MongoDB Cloud calculates. + externalDocs: + description: >- + This option corresponds to the `storage.oplogMinRetentionHours` + `mongod` configuration file option. + url: >- + https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-storage.oplogMinRetentionHours + oplogSizeMB: + type: integer + format: int32 + description: >- + Storage limit of cluster's oplog expressed in megabytes. A value of + null indicates that the cluster uses the default oplog size that + MongoDB Cloud calculates. + externalDocs: + description: >- + This option corresponds to the `replication.oplogSizeMB` `mongod` + configuration file option. + url: >- + https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-replication.oplogSizeMB + sampleRefreshIntervalBIConnector: + type: integer + format: int32 + default: 0 + description: >- + Interval in seconds at which the mongosqld process re-samples data + to create its relational schema. + externalDocs: + description: >- + This option corresponds to the `sampleRefreshIntervalSecs` + `mongosqld` option. + url: >- + https://docs.mongodb.com/bi-connector/current/reference/mongosqld/#std-option-mongosqld.--schemaRefreshIntervalSecs + minimum: 0 + sampleSizeBIConnector: + type: integer + format: int32 + default: 1000 + description: >- + Number of documents per database to sample when gathering schema + information. + externalDocs: + description: This option corresponds to the `sampleSize` `mongosqld` option. + url: >- + https://docs.mongodb.com/bi-connector/current/reference/mongosqld/#std-option-mongosqld.--sampleSize + minimum: 0 + transactionLifetimeLimitSeconds: + type: integer + format: int64 + default: 60 + description: >- + Lifetime, in seconds, of multi-document transactions. Atlas + considers the transactions that exceed this limit as expired and so + aborts them through a periodic cleanup process. + externalDocs: + description: >- + This option corresponds to the `transactionLifetimeLimitSeconds` + `mongod` configuration file option. + url: >- + https://www.mongodb.com/docs/upcoming/reference/parameters/#mongodb-parameter-param.transactionLifetimeLimitSeconds + minimum: 1 + ClusterFreeAutoScaling: + type: object + description: Range of instance sizes to which your cluster can scale. + properties: + compute: + type: string + description: >- + Collection of settings that configures how a cluster might scale its + cluster tier and whether the cluster can scale down. + title: Tenant + ClusterOutageSimulation: + type: object + properties: + clusterName: + type: string + description: >- + Human-readable label that identifies the cluster that undergoes + outage simulation. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the project + that contains the cluster to undergo outage simulation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the outage + simulation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + outageFilters: + type: array + description: List of settings that specify the type of cluster outage simulation. + items: + $ref: '#/components/schemas/AtlasClusterOutageSimulationOutageFilter' + minItems: 1 + startRequestDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud started the regional outage + simulation. + example: 2022-01-01T00:00:00.000Z + readOnly: true + state: + type: string + description: >- + Phase of the outage simulation. + + + | State | Indication | + + |-------------|------------| + + | `START_REQUESTED` | User has requested cluster outage + simulation.| + + | `STARTING` | MongoDB Cloud is starting cluster outage + simulation.| + + | `SIMULATING` | MongoDB Cloud is simulating cluster + outage.| + + | `RECOVERY_REQUESTED` | User has requested recovery from the + simulated outage.| + + | `RECOVERING` | MongoDB Cloud is recovering the cluster + from the simulated outage.| + + | `COMPLETE` | MongoDB Cloud has completed the cluster + outage simulation.| + readOnly: true + ClusterProviderSettings: + type: object + description: >- + Group of cloud provider settings that configure the provisioned MongoDB + hosts. + properties: + providerName: + type: string + autoScaling: + $ref: '#/components/schemas/ClusterFreeAutoScaling' + diskIOPS: + type: integer + format: int32 + description: >- + Maximum Disk Input/Output Operations per Second (IOPS) that the + database host can perform. + encryptEBSVolume: + type: boolean + default: true + deprecated: true + description: >- + Flag that indicates whether the Amazon Elastic Block Store (EBS) + encryption feature encrypts the host's root volume for both data at + rest within the volume and for data moving between the volume and + the cluster. Clusters always have this setting enabled. + instanceSizeName: + type: string + description: >- + Cluster tier, with a default storage and memory capacity, that + applies to all the data-bearing hosts in your cluster. + + + Alternatively: + + Cluster tier, with a default storage and memory capacity, that + applies to all the data-bearing hosts in your cluster. You must set + **providerSettings.providerName** to `TENANT` and specify the cloud + service provider in **providerSettings.backingProviderName**. + title: Tenant Instance Sizes + regionName: + type: string + description: >- + Physical location where MongoDB Cloud deploys your AWS-hosted + MongoDB cluster nodes. The region you choose can affect network + latency for clients accessing your databases. When MongoDB Cloud + deploys a dedicated cluster, it checks if a VPC or VPC connection + exists for that provider and region. If not, MongoDB Cloud creates + them as part of the deployment. MongoDB Cloud assigns the VPC a CIDR + block. To limit a new VPC peering connection to one CIDR block and + region, create the connection first. Deploy the cluster after the + connection starts. + + + Alternatively: + + Microsoft Azure Regions. + + + Alternatively: + + Google Compute Regions. + + + Alternatively: + + Human-readable label that identifies the geographic location of your + MongoDB cluster. The region you choose can affect network latency + for clients accessing your databases. For a complete list of region + names, see + [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), + [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and + [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). + For multi-region clusters, see **replicationSpec.{region}**. + volumeType: + type: string + description: >- + Disk Input/Output Operations per Second (IOPS) setting for Amazon + Web Services (AWS) storage that you configure only for abbr + title="Amazon Web Services">AWS. Specify whether Disk + Input/Output Operations per Second (IOPS) must not exceed the + default Input/Output Operations per Second (IOPS) rate for the + selected volume size (`STANDARD`), or must fall within the allowable + Input/Output Operations per Second (IOPS) range for the selected + volume size (`PROVISIONED`). + diskTypeName: + type: string + description: >- + Disk type that corresponds to the host's root volume for Azure + instances. If omitted, the default disk type for the selected + **providerSettings.instanceSizeName** applies. + externalDocs: + description: Disk type + url: >- + https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#premium-storage-disk-sizes + backingProviderName: + type: string + description: >- + Cloud service provider on which MongoDB Cloud provisioned the + multi-tenant host. The resource returns this parameter when + **providerSettings.providerName** is `TENANT` and + **providerSetting.instanceSizeName** is `M2` or `M5`. + required: + - providerName + title: Cloud Service Provider Settings for a Cluster + ClusterSearchIndex: + type: object + properties: + analyzer: + type: string + default: lucene.standard + description: >- + Specific pre-defined method chosen to convert database field text + into searchable words. This conversion reduces the text of fields + into the smallest units of text. These units are called a **term** + or **token**. This process, known as tokenization, involves a + variety of changes made to the text in fields: + + + - extracting words + + - removing punctuation + + - removing accents + + - changing to lowercase + + - removing common words + + - reducing words to their root form (stemming) + + - changing words to their base form (lemmatization) + MongoDB Cloud uses the selected process to build the Atlas Search index. + externalDocs: + description: Atlas Search Analyzers + url: https://docs.atlas.mongodb.com/atlas-search/analyzers/ + analyzers: + type: array + description: >- + List of user-defined methods to convert database field text into + searchable words. + externalDocs: + description: Custom Atlas Search Analyzers + url: https://docs.atlas.mongodb.com/atlas-search/analyzers/custom/ + items: + $ref: '#/components/schemas/ApiAtlasFTSAnalyzers' + collectionName: + type: string + description: >- + Human-readable label that identifies the collection that contains + one or more Atlas Search indexes. + database: + type: string + description: >- + Human-readable label that identifies the database that contains the + collection with one or more Atlas Search indexes. + indexID: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this Atlas Search + index. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + mappings: + $ref: '#/components/schemas/ApiAtlasFTSMappings' + name: + type: string + description: >- + Human-readable label that identifies this index. Within each + namespace, names of all indexes in the namespace must be unique. + searchAnalyzer: + type: string + default: lucene.standard + description: Method applied to identify words when searching this index. + status: + type: string + description: | + Condition of the search index when you made this request. + + | Status | Index Condition | + |---|---| + | IN_PROGRESS | Atlas is building or re-building the index after an edit. | + | STEADY | You can use this search index. | + | FAILED | Atlas could not build the index. | + | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | + | PAUSED | The cluster is paused. | + readOnly: true + synonyms: + type: array + description: Rule sets that map words to their synonyms in this index. + externalDocs: + description: Synonym Mapping + url: https://docs.atlas.mongodb.com/atlas-search/synonyms/ + items: + $ref: '#/components/schemas/SearchSynonymMappingDefinition' + required: + - collectionName + - database + - name + ClusterServerlessBackupOptions: + type: object + description: Group of settings that configure serverless backup. + properties: + serverlessContinuousBackupEnabled: + type: boolean + default: true + description: >- + Flag that indicates whether the serverless instance uses + **Serverless Continuous Backup**. + If this parameter is `false`, the serverless instance uses **Basic Backup**. + + | Option | Description | + |---|---| + | Serverless Continuous Backup | Atlas takes incremental [snapshots](https://www.mongodb.com/docs/atlas/backup/cloud-backup/overview/#std-label-serverless-snapshots) of the data in your serverless instance every six hours and lets you restore the data from a selected point in time within the last 72 hours. Atlas also takes daily snapshots and retains these daily snapshots for 35 days. To learn more, see [Serverless Instance Costs](https://www.mongodb.com/docs/atlas/billing/serverless-instance-costs/#std-label-serverless-instance-costs). | + | Basic Backup | Atlas takes incremental [snapshots](https://www.mongodb.com/docs/atlas/backup/cloud-backup/overview/#std-label-serverless-snapshots) of the data in your serverless instance every six hours and retains only the two most recent snapshots. You can use this option for free. | + title: Serverless Backup Options + ClusterStatus: + type: object + properties: + changeStatus: + type: string + description: >- + State of cluster at the time of this request. Atlas returns + **Applied** if it completed adding a user to, or removing a user + from, your cluster. Atlas returns **Pending** if it's still making + the requested user changes. When status is **Pending**, new users + can't log in. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + Collation: + type: object + description: >- + One or more settings that specify language-specific rules to compare + strings within this index. + externalDocs: + description: Collation Options + url: >- + https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options + properties: + alternate: + type: string + default: non-ignorable + description: > + Method to handle whitespace and punctuation as base characters for + purposes of comparison. + + + | Value | Evaluate Whitespace and Punctuation as Base Characters | + + |---|---| + + | `"non-ignorable"` | Yes | + + | `"shifted"` | No. MongoDB Cloud distinguishes these characters + when `"strength" > 3`. | + backwards: + type: boolean + default: false + description: > + Flag that indicates whether strings with diacritics sort from back + of the string. Some French dictionary orders strings in this way. + + + | Value | String Comparison Method | + |---|---| + | `true` | Compare from back to front. | + + | `false` | Compare from front to back. | + caseFirst: + type: string + default: 'off' + description: > + Method to handle sort order of case differences during tertiary + level comparisons. + + + | Value | Sort Order Method | + |---|---| + | `"upper"` | Uppercase sorts before lowercase. | + | `"lower"` | Lowercase sorts before uppercase. | + | `"off"` | Similar to "lower" with slight differences. | + caseLevel: + type: boolean + default: false + description: > + Flag that indicates whether to include case comparison when + `"strength" : 1` or `"strength" : 2`. + + + | Value | Compare case at level 1 or 2? | Strength Level | + Comparisons Include | + |---|---|---|---| + | true | Yes | 1 | Base characters and case. | + | | | 2 | Base characters, diacritics (and possible other secondary differences), and case. | + | false | No | | | + locale: + type: string + description: >- + International Components for Unicode (ICU) code that represents a + localized language. To specify simple binary comparison, set + `"locale" : "simple"`. + maxVariable: + type: string + description: > + Field that indicates which characters can be ignored when + `"alternate" : "shifted"`. This has no affect if `"alternate" : + "non-ignorable"`. + + + | Value | Ignore | + |---|---| + | `"punct"` | Both whitespace and punctuation | + + | `"space"` | Whitespace | + normalization: + type: boolean + default: false + description: > + Flag that indicates whether to check if the text requires + normalization and then perform it. Most text doesn't require this + normalization processing. + + + | Value | Normalization Method | + |---|---| + | `true` | Yes, check if fully normalized and perform normalization + to compare text. | + + | `false` | No, don't check. | + numericOrdering: + type: boolean + default: false + description: > + Flag that indicates whether to compare sequences of digits as + numbers or as strings. + + + | Value | Comparison Method | + |---|---| + | `true` | Compare as numbers. This results in `10 > 2`. | + + | `false` | Compare as strings. This results in `"10" < "2"`. | + strength: + type: integer + format: int32 + default: 3 + description: > + Degree of comparison to perform when sorting words. MongoDB Cloud + accepts the following values: + + + | Value | Comparison Level | Comparison Method | + + |---|---|---| + + | 1 | Primary | Compares the base characters only, ignoring other + differences such as diacritics and case. | + + | 2 | Secondary | Compares base characters (primary) and diacritics + (secondary). Primary differences take precedence over secondary + differences. | + + | 3 | Tertiary | Compares base characters (primary), diacritics + (secondary), and case and variants (tertiary). Differences between + base characters takes precedence over secondary differences which + take precedence over tertiary differences. | + + | 4 | Quaternary | Compares for the specific use case to consider + punctuation when levels 1 through 3 ignore punctuation or for + processing Japanese text. | + + | 5 | Identical | Compares for the specific use case of tie breaker. + | + maximum: 5 + minimum: 1 + required: + - locale + writeOnly: true + ComponentLabel: + type: object + description: Human-readable labels applied to this MongoDB Cloud component. + properties: + key: + type: string + description: Key applied to tag and categorize this component. + maxLength: 255 + minLength: 1 + value: + type: string + description: Value set to the Key applied to tag and categorize this component. + maxLength: 255 + minLength: 1 + title: Component Label + ConnectedOrgConfig: + type: object + properties: + dataAccessIdentityProviderIds: + type: array + description: >- + The collection of unique ids of the identity providers for org's + data access. + items: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the id of the + identity provider for org's data access. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + uniqueItems: true + domainAllowList: + type: array + description: >- + Approved domains that restrict users who can join the organization + based on their email address. + items: + type: string + uniqueItems: true + domainRestrictionEnabled: + type: boolean + description: >- + Value that indicates whether domain restriction is enabled for this + connected org. + identityProviderId: + type: string + description: >- + Unique 20-hexadecimal digit string that identifies the identity + provider that this connected org config is associated with. + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + orgId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the connected + organization configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + postAuthRoleGrants: + type: array + description: >- + Atlas roles that are granted to a user in this organization after + authenticating. + items: + type: string + description: Organization role the user has in Atlas. + uniqueItems: true + roleMappings: + type: array + description: Role mappings that are configured in this organization. + items: + $ref: '#/components/schemas/AuthFederationRoleMapping' + uniqueItems: true + userConflicts: + type: array + description: >- + List that contains the users who have an email address that doesn't + match any domain on the allowed list. + items: + $ref: '#/components/schemas/FederatedUser' + required: + - domainRestrictionEnabled + - identityProviderId + - orgId + CostExplorerFilterRequestBody: + type: object + description: Request body for a cost explorer query. + properties: + clusters: + type: array + description: The list of projects to be included in the Cost Explorer Query. + example: + - 5feeac500000000000000000 + - 61cfdfd00000000000000000 + items: + type: string + endDate: + type: string + format: date + description: >- + The exclusive ending date for the Cost Explorer query. The date must + be the start of a month. + example: 2022-02-01T00:00:00.000Z + groupBy: + type: string + description: >- + The dimension to group the returned usage results by. At least one + filter value needs to be provided for a dimension to be used. + includePartialMatches: + type: boolean + description: >- + Flag to control whether usage that matches the filter criteria, but + does not have values for all filter criteria is included in + response. Default is false, which excludes the partially matching + data. + organizations: + type: array + description: The list of organizations to be included in the Cost Explorer Query. + example: + - 5feeac500000000000000000 + - 61cfdfd00000000000000000 + items: + type: string + projects: + type: array + description: The list of projects to be included in the Cost Explorer Query. + example: + - 5feeac500000000000000000 + - 61cfdfd00000000000000000 + items: + type: string + services: + type: array + description: The list of projects to be included in the Cost Explorer Query. + example: + - Data Transfer + - Atlas Data Federation + items: + type: string + startDate: + type: string + format: date + description: >- + The inclusive starting date for the Cost Explorer query. The date + must be the start of a month. + example: 2022-02-01T00:00:00.000Z + required: + - endDate + - startDate + CostExplorerQueryResult: + type: object + CreateAtlasOrganizationApiKey: + type: object + properties: + desc: + type: string + description: >- + Purpose or explanation provided when someone created this + organization API key. + maxLength: 250 + minLength: 1 + roles: + type: array + description: >- + List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + organization. + items: + type: string + minItems: 1 + required: + - desc + - roles + CreateAtlasProjectApiKey: + type: object + properties: + desc: + type: string + description: >- + Purpose or explanation provided when someone created this project + API key. + maxLength: 250 + minLength: 1 + roles: + type: array + description: >- + List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + project. + items: + type: string + minItems: 1 + required: + - desc + - roles + CreateEndpointRequest: + type: object + properties: + id: + type: string + description: >- + Unique string that identifies the private endpoint's network + interface that someone added to this private endpoint service. + example: >- + /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln + writeOnly: true + privateEndpointIPAddress: + type: string + description: >- + IPv4 address of the private endpoint in your Azure VNet that someone + added to this private endpoint service. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + endpointGroupName: + type: string + description: Human-readable label that identifies a set of endpoints. + writeOnly: true + endpoints: + type: array + description: >- + List of individual private endpoints that comprise this endpoint + group. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: >- + https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + items: + $ref: '#/components/schemas/CreateGCPForwardingRuleRequest' + gcpProjectId: + type: string + description: >- + Unique string that identifies the Google Cloud project in which you + created the endpoints. + example: p-fdeeb3e43b8e733e5ab627b1 + externalDocs: + description: Google Cloud Creating and Managing Projects + url: >- + https://cloud.google.com/resource-manager/docs/creating-managing-projects + pattern: ^p-[0-9a-z]{24}$ + writeOnly: true + CreateGCPForwardingRuleRequest: + type: object + properties: + endpointName: + type: string + description: >- + Human-readable label that identifies the Google Cloud consumer + forwarding rule that you created. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: >- + https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + writeOnly: true + ipAddress: + type: string + description: >- + One Private Internet Protocol version 4 (IPv4) address to which this + Google Cloud consumer forwarding rule resolves. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + writeOnly: true + title: GCP Forwarding Rules + CreateOrganizationRequest: + type: object + properties: + apiKey: + $ref: '#/components/schemas/CreateAtlasOrganizationApiKey' + federationSettingsId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the federation to + link the newly created organization to. If specified, the proposed + Organization Owner of the new organization must have the + Organization Owner role in an organization associated with the + federation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + name: + type: string + description: Human-readable label that identifies the organization. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + orgOwnerId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + user that you want to assign the Organization Owner role. This user + must be a member of the same organization as the calling API key. If + you provide `federationSettingsId`, this user must instead have the + Organization Owner role on an organization in the specified + federation. This parameter is required only when you authenticate + with Programmatic API Keys. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + required: + - name + CreateOrganizationResponse: + type: object + properties: + apiKey: + $ref: '#/components/schemas/ApiKeyUserDetails' + federationSettingsId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the federation + that you linked the newly created organization to. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgOwnerId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + user that you assigned the Organization Owner role in the new + organization. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + organization: + $ref: '#/components/schemas/AtlasOrganization' + DBUserTLSX509Settings: + type: object + description: Settings to configure TLS Certificates for database users. + properties: + cas: + type: string + description: >- + Concatenated list of customer certificate authority (CA) + certificates needed to authenticate database users. MongoDB Cloud + expects this as a PEM-formatted certificate. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + title: Database User TLS Certificate Settings + DataFederationLimit: + type: object + description: Details of user managed limits. + properties: + currentUsage: + type: integer + format: int64 + description: Amount that indicates the current usage of the limit. + readOnly: true + defaultLimit: + type: integer + format: int64 + description: Default value of the limit. + readOnly: true + maximumLimit: + type: integer + format: int64 + description: Maximum value of the limit. + readOnly: true + name: + type: string + description: >- + Human-readable label that identifies the user-managed limit to + modify. + readOnly: true + value: + type: integer + format: int64 + description: Amount to set the limit to. + lastModifiedDate: + type: string + format: date-time + description: >- + Only used for Data Federation limits. Timestamp that indicates when + this usage limit was last modified. This field uses the ISO 8601 + timestamp format in UTC. + readOnly: true + overrunPolicy: + type: string + description: >- + Only used for Data Federation limits. Action to take when the usage + limit is exceeded. If limit span is set to QUERY, this is ignored + because MongoDB Cloud stops the query when it exceeds the usage + limit. + required: + - name + - value + title: Limits + DataFederationTenantQueryLimit: + type: object + description: >- + Details of a tenant-level query limit for Data Federation. Query limit + is the limit on the amount of usage during a time period based on cost. + properties: + currentUsage: + type: integer + format: int64 + description: Amount that indicates the current usage of the limit. + readOnly: true + defaultLimit: + type: integer + format: int64 + description: Default value of the limit. + readOnly: true + lastModifiedDate: + type: string + format: date-time + description: >- + Only used for Data Federation limits. Timestamp that indicates when + this usage limit was last modified. This field uses the ISO 8601 + timestamp format in UTC. + readOnly: true + maximumLimit: + type: integer + format: int64 + description: Maximum value of the limit. + readOnly: true + name: + type: string + description: >- + Human-readable label that identifies the user-managed limit to + modify. + readOnly: true + overrunPolicy: + type: string + description: >- + Only used for Data Federation limits. Action to take when the usage + limit is exceeded. If limit span is set to QUERY, this is ignored + because MongoDB Cloud stops the query when it exceeds the usage + limit. + tenantName: + type: string + description: >- + Human-readable label that identifies the Federated Database + Instance. If specified, the usage limit is for the specified + federated database instance only. If omitted, the usage limit is for + all federated database instances in the project. + readOnly: true + value: + type: integer + format: int64 + description: Amount to set the limit to. + required: + - name + - value + title: Data Federation Tenant-Level Query Limit + DataLakeAWSCloudProviderConfig: + type: object + description: Name of the cloud service that hosts the data lake's data stores. + properties: + externalId: + type: string + description: >- + Unique identifier associated with the Identity and Access Management + (IAM) role that the data lake assumes when accessing the data + stores. + readOnly: true + iamAssumedRoleARN: + type: string + description: >- + Amazon Resource Name (ARN) of the Identity and Access Management + (IAM) role that the data lake assumes when accessing data stores. + example: arn:aws:iam::123456789012:root + maxLength: 2048 + minLength: 20 + readOnly: true + iamUserARN: + type: string + description: >- + Amazon Resource Name (ARN) of the user that the data lake assumes + when accessing data stores. + readOnly: true + roleId: + type: string + description: >- + Unique identifier of the role that the data lake can use to access + the data stores.Required if specifying cloudProviderConfig. + testS3Bucket: + type: string + description: >- + Name of the S3 data bucket that the provided role ID is authorized + to access.Required if specifying cloudProviderConfig. + writeOnly: true + required: + - roleId + - testS3Bucket + DataLakeApiBase: + type: object + description: An aggregation pipeline that applies to the collection. + properties: + name: + type: string + description: >- + Human-readable label that identifies the view, which corresponds to + an aggregation pipeline on a collection. + pipeline: + type: string + description: Aggregation pipeline stages to apply to the source collection. + externalDocs: + description: Aggregation Pipelines + url: https://docs.mongodb.com/manual/core/aggregation-pipeline/ + source: + type: string + description: >- + Human-readable label that identifies the source collection for the + view. + DataLakeAtlasStoreReadConcern: + type: object + description: >- + MongoDB Cloud cluster read concern, which determines the consistency and + isolation properties of the data read from an Atlas cluster. + properties: + level: + type: string + description: >- + [Read Concern + level](https://www.mongodb.com/docs/manual/reference/read-concern/#read-concern-levels) + that specifies the consistency and availability of the data read. + DataLakeAtlasStoreReadPreference: + type: object + description: >- + MongoDB Cloud cluster read preference, which describes how to route read + requests to the cluster. + properties: + maxStalenessSeconds: + type: integer + format: int32 + description: >- + Maximum replication lag, or **staleness**, for reads from + secondaries. + mode: + type: string + description: >- + Read preference mode that specifies to which replica set member to + route the read requests. + externalDocs: + description: Read Preference Modes + url: >- + https://docs.mongodb.com/manual/core/read-preference/#read-preference-modes + tagSets: + type: array + description: >- + List that contains tag sets or tag specification documents. If + specified, Atlas Data Lake routes read requests to replica set + member or members that are associated with the specified tags. + externalDocs: + description: Read Preference Tag Set Lists + url: https://docs.mongodb.com/manual/core/read-preference-tags/ + items: + type: array + items: + $ref: '#/components/schemas/DataLakeAtlasStoreReadPreferenceTag' + DataLakeAtlasStoreReadPreferenceTag: + type: object + properties: + name: + type: string + description: Human-readable label of the tag. + value: + type: string + description: Value of the tag. + DataLakeCloudProviderConfig: + type: object + description: Cloud provider linked to this data lake. + properties: + aws: + $ref: '#/components/schemas/DataLakeAWSCloudProviderConfig' + required: + - aws + title: Data Lake Cloud Provider + DataLakeDataProcessRegion: + type: object + description: >- + Information about the cloud provider region to which the data lake + routes client connections. + properties: + cloudProvider: + type: string + description: Name of the cloud service that hosts the data lake's data stores. + region: + $ref: '#/components/schemas/BaseAtlasDataLakeRegion' + required: + - cloudProvider + - region + DataLakeDatabaseCollection: + type: object + description: A collection and data sources that map to a ``stores`` data store. + properties: + dataSources: + type: array + description: >- + Array that contains the data stores that map to a collection for + this data lake. + items: + $ref: '#/components/schemas/DataLakeDatabaseDataSourceSettings' + name: + type: string + description: >- + Human-readable label that identifies the collection to which MongoDB + Cloud maps the data in the data stores. + DataLakeDatabaseDataSourceSettings: + type: object + description: Data store that maps to a collection for this data lake. + properties: + allowInsecure: + type: boolean + default: false + description: >- + Flag that validates the scheme in the specified URLs. If `true`, + allows insecure `HTTP` scheme, doesn't verify the server's + certificate chain and hostname, and accepts any certificate with any + hostname presented by the server. If `false`, allows secure `HTTPS` + scheme only. + collection: + type: string + description: >- + Human-readable label that identifies the collection in the database. + For creating a wildcard (`*`) collection, you must omit this + parameter. + collectionRegex: + type: string + description: >- + Regex pattern to use for creating the wildcard (*) collection. To + learn more about the regex syntax, see [Go programming + language](https://pkg.go.dev/regexp). + database: + type: string + description: >- + Human-readable label that identifies the database, which contains + the collection in the cluster. You must omit this parameter to + generate wildcard (`*`) collections for dynamically generated + databases. + databaseRegex: + type: string + description: >- + Regex pattern to use for creating the wildcard (*) database. To + learn more about the regex syntax, see [Go programming + language](https://pkg.go.dev/regexp). + datasetName: + type: string + description: >- + Human-readable label that identifies the dataset that Atlas + generates for an ingestion pipeline run or Online Archive. + example: v1$atlas$snapshot$Cluster0$myDatabase$myCollection$19700101T000000Z + datasetPrefix: + type: string + description: >- + Human-readable label that matches against the dataset names for + ingestion pipeline runs or Online Archives. + defaultFormat: + type: string + description: >- + File format that MongoDB Cloud uses if it encounters a file without + a file extension while searching **storeName**. + path: + type: string + description: >- + File path that controls how MongoDB Cloud searches for and parses + files in the **storeName** before mapping them to a + collection.Specify ``/`` to capture all files and folders from the + ``prefix`` path. + provenanceFieldName: + type: string + description: >- + Name for the field that includes the provenance of the documents in + the results. MongoDB Cloud returns different fields in the results + for each supported provider. + storeName: + type: string + description: >- + Human-readable label that identifies the data store that MongoDB + Cloud maps to the collection. + trimLevel: + type: integer + format: int32 + description: >- + Unsigned integer that specifies how many fields of the dataset name + to trim from the left of the dataset name before mapping the + remaining fields to a wildcard collection name. + urls: + type: array + description: >- + URLs of the publicly accessible data files. You can't specify URLs + that require authentication. Atlas Data Lake creates a partition for + each URL. If empty or omitted, Data Lake uses the URLs from the + store specified in the **dataSources.storeName** parameter. + items: + type: string + DataLakeDatabaseInstance: + type: object + description: >- + Database associated with this data lake. Databases contain collections + and views. + properties: + collections: + type: array + description: >- + Array of collections and data sources that map to a ``stores`` data + store. + items: + $ref: '#/components/schemas/DataLakeDatabaseCollection' + maxWildcardCollections: + type: integer + format: int32 + default: 100 + description: >- + Maximum number of wildcard collections in the database. This only + applies to S3 data sources. + maximum: 1000 + minimum: 1 + name: + type: string + description: >- + Human-readable label that identifies the database to which the data + lake maps data. + views: + type: array + description: >- + Array of aggregation pipelines that apply to the collection. This + only applies to S3 data sources. + items: + $ref: '#/components/schemas/DataLakeApiBase' + DataLakeIngestionPipeline: + type: object + description: Details of a Data Lake Pipeline. + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the Data Lake + Pipeline. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + createdDate: + type: string + format: date-time + description: Timestamp that indicates when the Data Lake Pipeline was created. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the group. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lastUpdatedDate: + type: string + format: date-time + description: >- + Timestamp that indicates the last time that the Data Lake Pipeline + was updated. + readOnly: true + name: + type: string + description: Name of this Data Lake Pipeline. + sink: + $ref: '#/components/schemas/IngestionSink' + source: + $ref: '#/components/schemas/IngestionSource' + state: + type: string + description: State of this Data Lake Pipeline. + readOnly: true + transformations: + type: array + description: Fields to be excluded for this Data Lake Pipeline. + items: + $ref: '#/components/schemas/FieldTransformation' + title: Data Lake Pipeline + DataLakePipelinesPartitionField: + type: object + description: >- + Partition Field in the Data Lake Storage provider for a Data Lake + Pipeline. + properties: + fieldName: + type: string + description: >- + Human-readable label that identifies the field name used to + partition data. + maxLength: 700 + order: + type: integer + format: int32 + default: 0 + description: >- + Sequence in which MongoDB Cloud slices the collection data to create + partitions. The resource expresses this sequence starting with zero. + required: + - fieldName + - order + title: Partition Field + DataLakeStorage: + type: object + description: >- + Configuration information for each data store and its mapping to MongoDB + Cloud databases. + properties: + databases: + type: array + description: >- + Array that contains the queryable databases and collections for this + data lake. + items: + $ref: '#/components/schemas/DataLakeDatabaseInstance' + stores: + type: array + description: Array that contains the data stores for the data lake. + items: + $ref: '#/components/schemas/DataLakeStoreSettings' + DataLakeStoreSettings: + type: object + description: Group of settings that define where the data is stored. + properties: + name: + type: string + description: >- + Human-readable label that identifies the data store. The + **databases.[n].collections.[n].dataSources.[n].storeName** field + references this values as part of the mapping configuration. To use + MongoDB Cloud as a data store, the data lake requires a serverless + instance or an `M10` or higher cluster. + provider: + type: string + additionalStorageClasses: + type: array + description: >- + Collection of AWS S3 [storage + classes](https://aws.amazon.com/s3/storage-classes/). Atlas Data + Lake includes the files in these storage classes in the query + results. + items: + type: string + description: >- + AWS S3 [storage class](https://aws.amazon.com/s3/storage-classes/) + where the files to include in the results are stored. + bucket: + type: string + description: >- + Human-readable label that identifies the AWS S3 bucket. This label + must exactly match the name of an S3 bucket that the data lake can + access with the configured AWS Identity and Access Management (IAM) + credentials. + delimiter: + type: string + description: >- + The delimiter that separates + **databases.[n].collections.[n].dataSources.[n].path** segments in + the data store. MongoDB Cloud uses the delimiter to efficiently + traverse S3 buckets with a hierarchical directory structure. You can + specify any character supported by the S3 object keys as the + delimiter. For example, you can specify an underscore (_) or a plus + sign (+) or multiple characters, such as double underscores (__) as + the delimiter. If omitted, defaults to `/`. + includeTags: + type: boolean + default: false + description: >- + Flag that indicates whether to use S3 tags on the files in the given + path as additional partition attributes. If set to `true`, data lake + adds the S3 tags as additional partition attributes and adds new + top-level BSON elements associating each tag to each document. + prefix: + type: string + description: >- + Prefix that MongoDB Cloud applies when searching for files in the S3 + bucket. The data store prepends the value of prefix to the + **databases.[n].collections.[n].dataSources.[n].path** to create the + full path for files to ingest. If omitted, MongoDB Cloud searches + all files from the root of the S3 bucket. + public: + type: boolean + default: false + description: >- + Flag that indicates whether the bucket is public. If set to `true`, + MongoDB Cloud doesn't use the configured AWS Identity and Access + Management (IAM) role to access the S3 bucket. If set to `false`, + the configured AWS IAM role must include permissions to access the + S3 bucket. + region: + type: string + description: >- + Physical location where MongoDB Cloud deploys your AWS-hosted + MongoDB cluster nodes. The region you choose can affect network + latency for clients accessing your databases. When MongoDB Cloud + deploys a dedicated cluster, it checks if a VPC or VPC connection + exists for that provider and region. If not, MongoDB Cloud creates + them as part of the deployment. MongoDB Cloud assigns the VPC a CIDR + block. To limit a new VPC peering connection to one CIDR block and + region, create the connection first. Deploy the cluster after the + connection starts. + + + Alternatively: + + Microsoft Azure Regions. + title: Azure Regions + clusterName: + type: string + description: >- + Human-readable label of the MongoDB Cloud cluster on which the store + is based. + projectId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + readConcern: + $ref: '#/components/schemas/DataLakeAtlasStoreReadConcern' + readPreference: + $ref: '#/components/schemas/DataLakeAtlasStoreReadPreference' + allowInsecure: + type: boolean + default: false + description: >- + Flag that validates the scheme in the specified URLs. If `true`, + allows insecure `HTTP` scheme, doesn't verify the server's + certificate chain and hostname, and accepts any certificate with any + hostname presented by the server. If `false`, allows secure `HTTPS` + scheme only. + defaultFormat: + type: string + description: >- + Default format that Data Lake assumes if it encounters a file + without an extension while searching the `storeName`. If omitted, + Data Lake attempts to detect the file type by processing a few bytes + of the file. The specified format only applies to the URLs specified + in the **databases.[n].collections.[n].dataSources** object. + urls: + type: array + description: >- + Comma-separated list of publicly accessible HTTP URLs where data is + stored. You can't specify URLs that require authentication. + items: + type: string + description: >- + Comma-separated list of publicly accessible HTTP URLs where data + is stored. You can't specify URLs that require authentication. + required: + - provider + DataLakeTenant: + type: object + properties: + cloudProviderConfig: + $ref: '#/components/schemas/DataLakeCloudProviderConfig' + dataProcessRegion: + $ref: '#/components/schemas/DataLakeDataProcessRegion' + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostnames: + type: array + description: List that contains the hostnames assigned to the Data Lake instance. + items: + type: string + description: Unique hostname assigned to the Data Lake instance. + readOnly: true + readOnly: true + name: + type: string + description: Human-readable label that identifies the data lake. + state: + type: string + description: Label that indicates the status of the Data Lake instance. + readOnly: true + storage: + $ref: '#/components/schemas/DataLakeStorage' + DataProtectionSettings: + type: object + properties: + authorizedEmail: + type: string + format: email + description: >- + Email address of the user who authorized to updated the Backup + Compliance Policy settings. + copyProtectionEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether to enable additional backup copies for + the cluster. If unspecified, this value defaults to false. + encryptionAtRestEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether Encryption at Rest using Customer Key + Management is required for all clusters with a Backup Compliance + Policy. If unspecified, this value defaults to false. + externalDocs: + description: Encryption at Rest using Customer Key Management + url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ + onDemandPolicyItem: + $ref: '#/components/schemas/DiskBackupApiPolicyItem' + pitEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether the cluster uses Continuous Cloud + Backups with a Backup Compliance Policy. If unspecified, this value + defaults to false. + externalDocs: + description: Continuous Cloud Backups + url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ + projectId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project for + the Backup Compliance Policy. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + restoreWindowDays: + type: integer + format: int32 + description: >- + Number of previous days that you can restore back to with Continuous + Cloud Backup with a Backup Compliance Policy. You must specify a + positive, non-zero integer, and the maximum retention window can't + exceed the hourly retention time. This parameter applies only to + Continuous Cloud Backups with a Backup Compliance Policy. + scheduledPolicyItems: + type: array + description: List that contains the specifications for one scheduled policy. + items: + $ref: '#/components/schemas/DiskBackupApiPolicyItem' + state: + type: string + description: >- + Label that indicates the state of the Backup Compliance Policy + settings. MongoDB Cloud ignores this setting when you enable or + update the Backup Compliance Policy settings. + readOnly: true + updatedDate: + type: string + format: date-time + description: >- + ISO 8601 timestamp format in UTC that indicates when the user + updated the Data Protection Policy settings. MongoDB Cloud ignores + this setting when you enable or update the Backup Compliance Policy + settings. + readOnly: true + updatedUser: + type: string + format: email + description: >- + Email address that identifies the user who updated the Backup + Compliance Policy settings. MongoDB Cloud ignores this email setting + when you enable or update the Backup Compliance Policy settings. + readOnly: true + required: + - authorizedEmail + DatabaseInheritedRole: + type: object + description: Role inherited from another context for this database user. + externalDocs: + description: Built-in MongoDB Roles + url: https://docs.mongodb.com/manual/reference/built-in-roles/ + properties: + db: + type: string + description: >- + Human-readable label that identifies the database on which someone + grants the action to one MongoDB user. + role: + type: string + description: >- + Human-readable label that identifies the role inherited. Set this + value to `admin` for every role except `read` or `readWrite`. + externalDocs: + description: MongoDB Built-In Roles + url: https://docs.mongodb.com/manual/reference/built-in-roles/ + pattern: >- + ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- + https://docs.mongodb.com/manual/reference/resource-document/#cluster-resource + properties: + cluster: + type: boolean + description: >- + Flag that indicates whether to grant the action on the cluster + resource. If `true`, MongoDB Cloud ignores the + **actions.resources.collection** and **actions.resources.db** + parameters. + collection: + type: string + description: >- + Human-readable label that identifies the collection on which you + grant the action to one MongoDB user. If you don't set this + parameter, you grant the action to all collections in the database + specified in the **actions.resources.db** parameter. If you set + `"actions.resources.cluster" : true`, MongoDB Cloud ignores this + parameter. + db: + type: string + description: >- + Human-readable label that identifies the database on which you grant + the action to one MongoDB user. If you set + `"actions.resources.cluster" : true`, MongoDB Cloud ignores this + parameter. + required: + - cluster + - collection + - db + title: Permitted Namespace + DatabasePrivilegeAction: + type: object + description: Privilege action that the role grants. + properties: + action: + type: string + description: Human-readable label that identifies the privilege action. + resources: + type: array + description: List of resources on which you grant the action. + items: + $ref: '#/components/schemas/DatabasePermittedNamespaceResource' + required: + - action + title: Database Privilege Action + DatabaseRollingIndexRequest: + type: object + properties: + collation: + $ref: '#/components/schemas/Collation' + collection: + type: string + description: >- + Human-readable label of the collection for which MongoDB Cloud + creates an index. + writeOnly: true + db: + type: string + description: >- + Human-readable label of the database that holds the collection on + which MongoDB Cloud creates an index. + writeOnly: true + keys: + type: array + description: >- + List that contains one or more objects that describe the parameters + that you want to index. + items: + type: object + additionalProperties: + type: string + description: >- + Key-value pair that sets the parameter to index as the key and + the type of index as its value. To create a [multikey + index](https://docs.mongodb.com/manual/core/index-multikey/), + list each parameter in its own object within this array. + externalDocs: + description: Index Types + url: https://docs.mongodb.com/manual/indexes/#index-types + maxProperties: 1 + minProperties: 1 + writeOnly: true + description: >- + Key-value pair that sets the parameter to index as the key and the + type of index as its value. To create a [multikey + index](https://docs.mongodb.com/manual/core/index-multikey/), list + each parameter in its own object within this array. + externalDocs: + description: Index Types + url: https://docs.mongodb.com/manual/indexes/#index-types + maxProperties: 1 + minProperties: 1 + writeOnly: true + writeOnly: true + options: + $ref: '#/components/schemas/IndexOptions' + required: + - collection + - db + DatabaseUserRole: + type: object + description: Range of resources available to this database user. + properties: + collectionName: + type: string + description: Collection on which this role applies. + databaseName: + type: string + description: >- + Database against which the database user authenticates. Database + users must provide both a username and authentication database to + log into MongoDB. + roleName: + type: string + description: >- + Human-readable label that identifies a group of privileges assigned + to a database user. This value can either be a built-in role or a + custom role. + required: + - databaseName + - roleName + title: Database User Role + DedicatedHardwareSpec: + type: object + description: >- + Hardware specifications for read-only nodes in the region. Read-only + nodes can never become the primary member, but can enable local reads.If + you don't specify this parameter, no read-only nodes are deployed to the + region. + properties: + nodeCount: + type: integer + format: int32 + description: >- + Number of nodes of the given type for MongoDB Cloud to deploy to the + region. + diskIOPS: + type: integer + format: int32 + description: >- + Target throughput desired for storage attached to your + AWS-provisioned cluster. Change this parameter only if you: + + + - set `"replicationSpecs[n].regionConfigs[m].providerName" : "AWS"`. + + - set + `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" + : "M30"` or greater not including `Mxx_NVME` tiers. + + + The maximum input/output operations per second (IOPS) depend on the + selected **.instanceSize** and **.diskSizeGB**. + + This parameter defaults to the cluster tier's standard IOPS value. + + Changing this value impacts cluster cost. + + MongoDB Cloud enforces minimum ratios of storage capacity to system + memory for given cluster tiers. This keeps cluster performance + consistent with large datasets. + + + - Instance sizes `M10` to `M40` have a ratio of disk capacity to + system memory of 60:1. + + - Instance sizes greater than `M40` have a ratio of 120:1. + ebsVolumeType: + type: string + default: STANDARD + description: >- + Type of storage you want to attach to your AWS-provisioned cluster. + + + - `STANDARD` volume types can't exceed the default input/output + operations per second (IOPS) rate for the selected volume size. + + + - `PROVISIONED` volume types must fall within the allowable IOPS + range for the selected volume size. + instanceSize: + type: string + description: >- + Hardware specification for the instance sizes in this region. Each + instance size has a default storage and memory capacity. The + instance size you select applies to all the data-bearing hosts in + your instance size. + title: GCP Instance Sizes + DeleteCopiedBackups: + type: object + description: Deleted copy setting whose backup copies need to also be deleted. + properties: + cloudProvider: + type: string + description: >- + Human-readable label that identifies the cloud provider for the + deleted copy setting whose backup copies you want to delete. + writeOnly: true + regionName: + type: string + description: >- + Target region for the deleted copy setting whose backup copies you + want to delete. Please supply the 'Atlas Region' which can be found + under [Cloud + Providers](https://www.mongodb.com/docs/atlas/reference/cloud-providers/) + 'regions' link. + writeOnly: true + replicationSpecId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a cluster. For global clusters, there can be + multiple zones to choose from. For sharded clusters and replica + setclusters, there is only one zone in the cluster. To find the + Replication Spec Id, do a GET request to Return One Cluster in One + Project and consult the replicationSpecs array [Return One Cluster + in One Project](#operation/getLegacyCluster). + writeOnly: true + writeOnly: true + Destination: + type: object + description: Document that describes the destination of the migration. + properties: + clusterName: + type: string + description: Label that identifies the destination cluster. + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the destination + project. + example: 9b43a5b329223c3a1591a678 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + hostnameSchemaType: + type: string + default: PUBLIC + description: >- + The network type to use between the migration host and the target + cluster. + privateLinkId: + type: string + description: >- + Represents the endpoint to use when the host schema type is + `PRIVATE_LINK`. + required: + - clusterName + - groupId + - hostnameSchemaType + DiskBackupApiPolicyItem: + type: object + description: Specifications for one policy. + properties: + frequencyInterval: + type: integer + format: int32 + description: >- + Number that indicates the frequency interval for a set of snapshots. + A value of `1` specifies the first instance of the corresponding + `frequencyType`. + + + - In a monthly policy item, `1` indicates that the monthly snapshot + occurs on the first day of the month and `40` indicates the last day + of the month. + + + - In a weekly policy item, `1` indicates that the weekly snapshot + occurs on Monday and `7` indicates Sunday. + + + - In an hourly policy item, you can set the frequency interval to + `1`, `2`, `4`, `6`, `8`, or `12`. For hourly policy items for NVMe + clusters, MongoDB Cloud accepts only `12` as the frequency interval + value. + + MongoDB Cloud ignores this setting for non-hourly policy items in Backup Compliance Policy settings. + frequencyType: + type: string + description: >- + Human-readable label that identifies the frequency type associated + with the backup policy. + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this backup + policy item. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + retentionUnit: + type: string + description: Unit of time in which MongoDB Cloud measures snapshot retention. + retentionValue: + type: integer + format: int32 + description: >- + Duration in days, weeks, or months that MongoDB Cloud retains the + snapshot. For less frequent policy items, MongoDB Cloud requires + that you specify a value greater than or equal to the value + specified for more frequent policy items. + + + For example: If the hourly policy item specifies a retention of two + days, you must specify two days or greater for the retention of the + weekly policy item. + required: + - frequencyInterval + - frequencyType + - retentionUnit + - retentionValue + DiskBackupBaseRestoreMember: + type: object + properties: + replicaSetName: + type: string + description: >- + Human-readable label that identifies the replica set on the sharded + cluster. + readOnly: true + DiskBackupCopySetting: + type: object + description: Copy setting item in the desired backup policy. + properties: + cloudProvider: + type: string + description: >- + Human-readable label that identifies the cloud provider that stores + the snapshot copy. + frequencies: + type: array + description: List that describes which types of snapshots to copy. + items: + type: string + regionName: + type: string + description: >- + Target region to copy snapshots belonging to replicationSpecId to. + Please supply the 'Atlas Region' which can be found under [Cloud + Providers](https://www.mongodb.com/docs/atlas/reference/cloud-providers/) + 'regions' link. + replicationSpecId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a cluster. For global clusters, there can be + multiple zones to choose from. For sharded clusters and replica set + clusters, there is only one zone in the cluster. To find the + Replication Spec Id, do a GET request to Return One Cluster in One + Project and consult the replicationSpecs array [Return One Cluster + in One Project](#operation/getLegacyCluster). + shouldCopyOplogs: + type: boolean + description: >- + Flag that indicates whether to copy the oplogs to the target region. + You can use the oplogs to perform point-in-time restores. + DiskBackupExportJob: + type: object + properties: + components: + type: array + description: >- + Information on the export job for each replica set in the sharded + cluster. + items: + $ref: '#/components/schemas/DiskBackupBaseRestoreMember' + readOnly: true + createdAt: + type: string + format: date-time + description: >- + Date and time when someone created this export job. MongoDB Cloud + represents this timestamp in ISO 8601 format in UTC. + readOnly: true + customData: + type: array + description: >- + Collection of key-value pairs that represent custom data for the + metadata file that MongoDB Cloud uploads to the bucket when the + export job finishes. + items: + $ref: '#/components/schemas/BackupLabel' + deliveryUrl: + type: array + description: >- + One or more Uniform Resource Locators (URLs) that point to the + compressed snapshot files for manual download. MongoDB Cloud returns + this parameter when `"deliveryType" : "download"`. + items: + type: string + description: >- + One Uniform Resource Locator that point to the compressed snapshot + files for manual download. + readOnly: true + exportBucketId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the AWS + bucket to which MongoDB Cloud exports the Cloud Backup snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + exportStatus: + $ref: '#/components/schemas/ExportStatus' + finishedAt: + type: string + format: date-time + description: >- + Date and time when this export job completed. MongoDB Cloud + represents this timestamp in ISO 8601 format in UTC. + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the restore + job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + prefix: + type: string + description: >- + Full path on the cloud provider bucket to the folder where the + snapshot is exported. + pattern: >- + /exported_snapshots/\{ORG-NAME\}/\{PROJECT-NAME\}/\{CLUSTER-NAME\}/\{SNAPSHOT-INITIATION-DATE\}/\{TIMESTAMP\} + readOnly: true + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + state: + type: string + description: State of the export job. + readOnly: true + required: + - exportBucketId + DiskBackupExportJobRequest: + type: object + properties: + customData: + type: array + description: >- + Collection of key-value pairs that represent custom data to add to + the metadata file that MongoDB Cloud uploads to the bucket when the + export job finishes. + items: + $ref: '#/components/schemas/BackupLabel' + exportBucketId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the AWS + bucket to which MongoDB Cloud exports the Cloud Backup snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + snapshotId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the Cloud + Backup snasphot to export. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + required: + - exportBucketId + - snapshotId + DiskBackupOnDemandSnapshotRequest: + type: object + properties: + description: + type: string + description: >- + Human-readable phrase or sentence that explains the purpose of the + snapshot. The resource returns this parameter when `"status" : + "onDemand"`. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + retentionInDays: + type: integer + format: int32 + description: >- + Number of days that MongoDB Cloud should retain the on-demand + snapshot. Must be at least **1**. + minimum: 1 + DiskBackupReplicaSet: + type: object + description: Details of the replica set snapshot that MongoDB Cloud created. + properties: + cloudProvider: + type: string + description: >- + Human-readable label that identifies the cloud provider that stores + this snapshot. The resource returns this parameter when `"type": + "replicaSet"`. + readOnly: true + copyRegions: + type: array + description: >- + List that identifies the regions to which MongoDB Cloud copies the + snapshot. + items: + type: string + readOnly: true + createdAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud took the snapshot. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + description: + type: string + description: >- + Human-readable phrase or sentence that explains the purpose of the + snapshot. The resource returns this parameter when `"status": + "onDemand"`. + readOnly: true + expiresAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud deletes the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + frequencyType: + type: string + description: >- + Human-readable label that identifies how often this snapshot + triggers. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: >- + Unique string that identifies the Amazon Web Services (AWS) Key + Management Service (KMS) Customer Master Key (CMK) used to encrypt + the snapshot. The resource returns this value when + `"encryptionEnabled" : true`. + readOnly: true + mongodVersion: + type: string + description: Version of the MongoDB host that this snapshot backs up. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + policyItems: + type: array + description: List that contains unique identifiers for the policy items. + items: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies one policy + item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + replicaSetName: + type: string + description: >- + Human-readable label that identifies the replica set from which + MongoDB Cloud took this snapshot. The resource returns this + parameter when `"type": "replicaSet"`. + readOnly: true + snapshotType: + type: string + description: Human-readable label that identifies when this snapshot triggers. + readOnly: true + status: + type: string + description: >- + Human-readable label that indicates the stage of the backup process + for this snapshot. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number of bytes taken to store the backup snapshot. + readOnly: true + type: + type: string + description: >- + Human-readable label that categorizes the cluster as a replica set + or sharded cluster. + readOnly: true + title: Replica Set Snapshot + DiskBackupShardedClusterSnapshot: + type: object + description: Details of the sharded cluster snapshot that MongoDB Cloud created. + properties: + createdAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud took the snapshot. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + description: + type: string + description: >- + Human-readable phrase or sentence that explains the purpose of the + snapshot. The resource returns this parameter when `"status": + "onDemand"`. + readOnly: true + expiresAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud deletes the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + frequencyType: + type: string + description: >- + Human-readable label that identifies how often this snapshot + triggers. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: >- + Unique string that identifies the Amazon Web Services (AWS) Key + Management Service (KMS) Customer Master Key (CMK) used to encrypt + the snapshot. The resource returns this value when + `"encryptionEnabled" : true`. + readOnly: true + members: + type: array + description: >- + List that includes the snapshots and the cloud provider that stores + the snapshots. The resource returns this parameter when `"type" : + "SHARDED_CLUSTER"`. + items: + $ref: '#/components/schemas/DiskBackupShardedClusterSnapshotMember' + readOnly: true + mongodVersion: + type: string + description: Version of the MongoDB host that this snapshot backs up. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + policyItems: + type: array + description: List that contains unique identifiers for the policy items. + items: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies one policy + item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + snapshotIds: + type: array + description: >- + List that contains the unique identifiers of the snapshots created + for the shards and config host for a sharded cluster. The resource + returns this parameter when `"type": "SHARDED_CLUSTER"`. These + identifiers should match the ones specified in the **members[n].id** + parameters. This allows you to map a snapshot to its shard or config + host name. + items: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the snapshot + for part of the sharded cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + readOnly: true + snapshotType: + type: string + description: Human-readable label that identifies when this snapshot triggers. + readOnly: true + status: + type: string + description: >- + Human-readable label that indicates the stage of the backup process + for this snapshot. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number of bytes taken to store the backup snapshot. + readOnly: true + type: + type: string + description: >- + Human-readable label that categorizes the cluster as a replica set + or sharded cluster. + readOnly: true + title: Sharded Cluster Snapshot + DiskBackupShardedClusterSnapshotMember: + type: object + properties: + cloudProvider: + type: string + description: >- + Human-readable label that identifies the cloud provider that stores + this snapshot. The resource returns this parameter when `"type": + "replicaSet"`. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + replicaSetName: + type: string + description: >- + Human-readable label that identifies the shard or config host from + which MongoDB Cloud took this snapshot. + readOnly: true + required: + - cloudProvider + - id + - replicaSetName + DiskBackupSnapshot: + type: object + properties: + createdAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud took the snapshot. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + description: + type: string + description: >- + Human-readable phrase or sentence that explains the purpose of the + snapshot. The resource returns this parameter when `"status": + "onDemand"`. + readOnly: true + expiresAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud deletes the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + frequencyType: + type: string + description: >- + Human-readable label that identifies how often this snapshot + triggers. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: >- + Unique string that identifies the Amazon Web Services (AWS) Key + Management Service (KMS) Customer Master Key (CMK) used to encrypt + the snapshot. The resource returns this value when + `"encryptionEnabled" : true`. + readOnly: true + mongodVersion: + type: string + description: Version of the MongoDB host that this snapshot backs up. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + policyItems: + type: array + description: List that contains unique identifiers for the policy items. + items: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies one policy + item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + snapshotType: + type: string + description: Human-readable label that identifies when this snapshot triggers. + readOnly: true + status: + type: string + description: >- + Human-readable label that indicates the stage of the backup process + for this snapshot. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number of bytes taken to store the backup snapshot. + readOnly: true + type: + type: string + description: >- + Human-readable label that categorizes the cluster as a replica set + or sharded cluster. + readOnly: true + cloudProvider: + type: string + description: >- + Human-readable label that identifies the cloud provider that stores + this snapshot. The resource returns this parameter when `"type": + "replicaSet"`. + readOnly: true + copyRegions: + type: array + description: >- + List that identifies the regions to which MongoDB Cloud copies the + snapshot. + items: + type: string + readOnly: true + replicaSetName: + type: string + description: >- + Human-readable label that identifies the replica set from which + MongoDB Cloud took this snapshot. The resource returns this + parameter when `"type": "replicaSet"`. + readOnly: true + members: + type: array + description: >- + List that includes the snapshots and the cloud provider that stores + the snapshots. The resource returns this parameter when `"type" : + "SHARDED_CLUSTER"`. + items: + $ref: '#/components/schemas/DiskBackupShardedClusterSnapshotMember' + readOnly: true + snapshotIds: + type: array + description: >- + List that contains the unique identifiers of the snapshots created + for the shards and config host for a sharded cluster. The resource + returns this parameter when `"type": "SHARDED_CLUSTER"`. These + identifiers should match the ones specified in the **members[n].id** + parameters. This allows you to map a snapshot to its shard or config + host name. + items: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the snapshot + for part of the sharded cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + readOnly: true + DiskBackupSnapshotAWSExportBucket: + type: object + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the Amazon + Web Services (AWS) Simple Storage Service (S3) export bucket. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + bucketName: + type: string + description: >- + Human-readable label that identifies the AWS bucket that the role is + authorized to access. + cloudProvider: + type: string + description: >- + Human-readable label that identifies the cloud provider that stores + this snapshot. + iamRoleId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the AWS IAM + role that MongoDB Cloud uses to access the AWS S3 bucket. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + DiskBackupSnapshotRestoreJob: + type: object + properties: + cancelled: + type: boolean + description: Flag that indicates whether someone canceled this restore job. + readOnly: true + components: + type: array + description: >- + Information on the restore job for each replica set in the sharded + cluster. + items: + $ref: '#/components/schemas/DiskBackupBaseRestoreMember' + readOnly: true + deliveryType: + type: string + description: Human-readable label that categorizes the restore job to create. + deliveryUrl: + type: array + description: >- + One or more Uniform Resource Locators (URLs) that point to the + compressed snapshot files for manual download. MongoDB Cloud returns + this parameter when `"deliveryType" : "download"`. + items: + type: string + description: >- + One Uniform Resource Locator that point to the compressed snapshot + files for manual download. + readOnly: true + desiredTimestamp: + $ref: '#/components/schemas/ApiBSONTimestamp' + expired: + type: boolean + description: Flag that indicates whether the restore job expired. + readOnly: true + expiresAt: + type: string + format: date-time + description: >- + Date and time when the restore job expires. This parameter expresses + its value in the ISO 8601 timestamp format in UTC. + readOnly: true + failed: + type: boolean + description: Flag that indicates whether the restore job failed. + readOnly: true + finishedAt: + type: string + format: date-time + description: >- + Date and time when the restore job completed. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the restore + job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + oplogInc: + type: integer + format: int32 + description: >- + Oplog operation number from which you want to restore this snapshot. + This number represents the second part of an Oplog timestamp. The + resource returns this parameter when `"deliveryType" : + "pointInTime"` and **oplogTs** exceeds `0`. + example: 1 + minimum: 1 + oplogTs: + type: integer + format: int32 + description: >- + Date and time from which you want to restore this snapshot. This + parameter expresses this timestamp in the number of seconds that + have elapsed since the UNIX epoch. This number represents the first + part of an Oplog timestamp. The resource returns this parameter when + `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`. + minimum: 1199145600 + pointInTimeUTCSeconds: + type: integer + format: int32 + description: >- + Date and time from which MongoDB Cloud restored this snapshot. This + parameter expresses this timestamp in the number of seconds that + have elapsed since the UNIX epoch. The resource returns this + parameter when `"deliveryType" : "pointInTime"` and + **pointInTimeUTCSeconds** exceeds `0`. + minimum: 1199145600 + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + targetClusterName: + type: string + description: >- + Human-readable label that identifies the target cluster to which the + restore job restores the snapshot. The resource returns this + parameter when `"deliveryType":` `"automated"`. Required for + `automated` and `pointInTime` restore types. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + targetGroupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the target + project for the specified **targetClusterName**. Required for + `automated` and `pointInTime` restore types. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + timestamp: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud took the snapshot associated with + **snapshotId**. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + required: + - deliveryType + DiskBackupSnapshotSchedule: + type: object + properties: + autoExportEnabled: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud automatically exports + cloud backup snapshots to the AWS bucket. + clusterId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the cluster with + the snapshot you want to return. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: >- + Human-readable label that identifies the cluster with the snapshot + you want to return. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + copySettings: + type: array + description: >- + List that contains a document for each copy setting item in the + desired backup policy. + items: + $ref: '#/components/schemas/DiskBackupCopySetting' + deleteCopiedBackups: + type: array + description: >- + List that contains a document for each deleted copy setting whose + backup copies you want to delete. + items: + $ref: '#/components/schemas/DeleteCopiedBackups' + writeOnly: true + export: + $ref: '#/components/schemas/AutoExportPolicy' + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + nextSnapshot: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud takes the next snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + policies: + type: array + description: Rules set for this backup schedule. + items: + $ref: '#/components/schemas/AdvancedDiskBackupSnapshotSchedulePolicy' + maxItems: 1 + referenceHourOfDay: + type: integer + format: int32 + description: >- + Hour of day in Coordinated Universal Time (UTC) that represents when + MongoDB Cloud takes the snapshot. + referenceMinuteOfHour: + type: integer + format: int32 + description: >- + Minute of the **referenceHourOfDay** that represents when MongoDB + Cloud takes the snapshot. + restoreWindowDays: + type: integer + format: int32 + description: >- + Number of previous days that you can restore back to with Continuous + Cloud Backup accuracy. You must specify a positive, non-zero + integer. This parameter applies to continuous cloud backups only. + updateSnapshots: + type: boolean + description: >- + Flag that indicates whether to apply the retention changes in the + updated backup policy to snapshots that MongoDB Cloud took + previously. + writeOnly: true + useOrgAndGroupNamesInExportPrefix: + type: boolean + description: >- + Flag that indicates whether to use organization and project names + instead of organization and project UUIDs in the path to the + metadata files that MongoDB Cloud uploads to your AWS bucket. + DiskGBAutoScaling: + type: object + description: Setting that enables disk auto-scaling. + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether this cluster enables disk auto-scaling. + The maximum memory allowed for the selected cluster tier and the + oplog size can limit storage auto-scaling. + EncryptionAtRest: + type: object + properties: + awsKms: + $ref: '#/components/schemas/AWSKMSConfiguration' + azureKeyVault: + $ref: '#/components/schemas/AzureKeyVault' + googleCloudKms: + $ref: '#/components/schemas/GoogleCloudKMS' + EndpointService: + type: object + properties: + cloudProvider: + type: string + description: Cloud service provider that serves the requested endpoint service. + readOnly: true + errorMessage: + type: string + description: >- + Error message returned when requesting private connection resource. + The resource returns `null` if the request succeeded. + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the Private + Endpoint Service. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + regionName: + type: string + description: Cloud provider region that manages this Private Endpoint Service. + readOnly: true + status: + type: string + description: >- + State of the Private Endpoint Service connection when MongoDB Cloud + received this request. + readOnly: true + endpointServiceName: + type: string + description: >- + Unique string that identifies the Amazon Web Services (AWS) + PrivateLink endpoint service. MongoDB Cloud returns null while it + creates the endpoint service. + pattern: ^com\.amazonaws\.vpce\.[a-z-0-9]+\.vpce-svc-[0-9a-f]{17} + readOnly: true + interfaceEndpoints: + type: array + description: >- + List of strings that identify private endpoint interfaces applied to + the specified project. + items: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the interface + endpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + readOnly: true + privateEndpoints: + type: array + description: >- + List of private endpoints assigned to this Azure Private Link + Service. + items: + type: string + description: >- + Root-relative path to one private endpoint assigned to this Azure + Private Link Service. + pattern: >- + ^\/subscriptions\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/resource[gG]roups\/([-\w._()]+)\/providers\/Microsoft\.Network\/privateEndpoints\/([-\w._()]+) + readOnly: true + readOnly: true + privateLinkServiceName: + type: string + description: >- + Unique string that identifies the Azure Private Link Service that + MongoDB Cloud manages. + maxLength: 24 + minLength: 24 + pattern: ^pls_[0-9a-f]{24}$ + readOnly: true + privateLinkServiceResourceId: + type: string + description: >- + Root-relative path that identifies of the Azure Private Link Service + that MongoDB Cloud manages. Use this value to create a private + endpoint connection to an Azure VNet. + example: >- + /subscriptions/ae349d51-d12b-ee3d-2a27-7d53f6479cf0/resourcegroups/KObGGz/providers/Microsoft.Network/privateLinkServices/pls_d1820713f8153388d533e9de + readOnly: true + endpointGroupNames: + type: array + description: >- + List of Google Cloud network endpoint groups that corresponds to the + Private Service Connect endpoint service. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: >- + https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + items: + type: string + description: >- + One Google Cloud network endpoint group that corresponds to the + Private Service Connect endpoint service. + serviceAttachmentNames: + type: array + description: >- + List of Uniform Resource Locators (URLs) that identifies endpoints + that MongoDB Cloud can use to access one Google Cloud Service across + a Google Cloud Virtual Private Connection (VPC) network. + externalDocs: + description: Google Cloud Private Service Connect Service Attachments + url: >- + https://cloud.google.com/vpc/docs/private-service-connect#service-attachments + items: + type: string + description: >- + Uniform Resource Locator (URL) that identifies one endpoint that + MongoDB Cloud can use to access one Google Cloud Service across a + Google Cloud Virtual Private Connection (VPC) network. + pattern: >- + https:\/\/([a-z0-9\.]+)+\.[a-z]{2,}(\/[a-z0-9\-]+)+\/projects\/p-[a-z0-9]+\/regions\/[a-z\-0-9]+\/serviceAttachments\/[a-z0-9\-]+ + required: + - cloudProvider + EventTypeForNdsGroup: + type: string + EventTypeForOrg: + type: string + EventViewForNdsGroup: + type: object + properties: + apiKeyId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the [API + Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that + triggered the event. If this resource returns this parameter, it + doesn't return the **userId** parameter. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when this event occurred. This parameter expresses its + value in the ISO 8601 timestamp + format in UTC. + readOnly: true + eventTypeName: + $ref: '#/components/schemas/ResourceEventType' + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project in + which the event occurred. The **eventId** identifies the specific + event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + isGlobalAdmin: + type: boolean + default: false + description: >- + Flag that indicates whether a MongoDB employee triggered the + specified event. + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + orgId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + to which these events apply. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + publicKey: + type: string + format: email + description: >- + Public part of the [API + Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that + triggered the event. If this resource returns this parameter, it + doesn't return the **username** parameter. + example: test.user@mongodb.com + readOnly: true + raw: + $ref: '#/components/schemas/raw' + remoteAddress: + type: string + description: IPv4 or IPv6 address from which the user triggered this event. + example: 216.172.40.186 + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + userId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the console user + who triggered the event. If this resource returns this parameter, it + doesn't return the **apiKeyId** parameter. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + username: + type: string + format: email + description: >- + Email address for the user who triggered this event. If this + resource returns this parameter, it doesn't return the + **publicApiKey** parameter. + example: test.user@mongodb.com + readOnly: true + alertId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the alert + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + alertConfigId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration associated with the **alertId**. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + invoiceId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies of the invoice + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + paymentId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the invoice + payment associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + shardName: + type: string + description: Human-readable label of the shard associated with the event. + example: event-sh-01 + readOnly: true + collection: + type: string + description: >- + Human-readable label of the collection on which the event occurred. + The resource returns this parameter when the **eventTypeName** + includes `DATA_EXPLORER`. + example: test_collection + readOnly: true + database: + type: string + description: >- + Human-readable label of the database on which this incident + occurred. The resource returns this parameter when `"eventTypeName" + : "DATA_EXPLORER"` or `"eventTypeName" : "DATA_EXPLORER_CRUD"`. + example: test_db + readOnly: true + opType: + type: string + description: >- + Action that the database attempted to execute when the event + triggered. The response returns this parameter when `eventTypeName" + : "DATA_EXPLORER"`. + example: insertDocument + readOnly: true + port: + type: integer + format: int32 + description: IANA port on which the MongoDB process listens for requests. + example: 27017 + readOnly: true + replicaSetName: + type: string + description: Human-readable label of the replica set associated with the event. + example: event-replica-set + readOnly: true + currentValue: + $ref: '#/components/schemas/NumberMetricValue' + metricName: + type: string + description: >- + Human-readable label of the metric associated with the **alertId**. + This field may change type of **currentValue** field. + readOnly: true + dbUserUsername: + type: string + description: >- + The username of the MongoDB User that was created, deleted, or + edited. + example: user1 + readOnly: true + whitelistEntry: + type: string + description: >- + Entry in the list of source host addresses that the API key accepts + and this event targets. + example: 0.0.0.0 + readOnly: true + endpointId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the endpoint + associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + providerEndpointId: + type: string + description: >- + Unique identification string that the cloud provider uses to + identify the private endpoint. + example: vpce-0d6c248dedef65a25 + readOnly: true + teamId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + team associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + targetUsername: + type: string + format: email + description: >- + Email address for the console user that this event targets. The + resource returns this parameter when `"eventTypeName" : "USER"`. + example: test.user@mongodb.com + readOnly: true + resourceId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the resource + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + resourceType: + type: string + description: Unique identifier of resource type. + example: cluster + EventViewForOrg: + type: object + properties: + apiKeyId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the [API + Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that + triggered the event. If this resource returns this parameter, it + doesn't return the **userId** parameter. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when this event occurred. This parameter expresses its + value in the ISO 8601 timestamp + format in UTC. + readOnly: true + eventTypeName: + $ref: '#/components/schemas/ResourceEventTypeViewForOrg' + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project in + which the event occurred. The **eventId** identifies the specific + event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + isGlobalAdmin: + type: boolean + default: false + description: >- + Flag that indicates whether a MongoDB employee triggered the + specified event. + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + orgId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + to which these events apply. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + publicKey: + type: string + format: email + description: >- + Public part of the [API + Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that + triggered the event. If this resource returns this parameter, it + doesn't return the **username** parameter. + example: test.user@mongodb.com + readOnly: true + raw: + $ref: '#/components/schemas/raw' + remoteAddress: + type: string + description: IPv4 or IPv6 address from which the user triggered this event. + example: 216.172.40.186 + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + userId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the console user + who triggered the event. If this resource returns this parameter, it + doesn't return the **apiKeyId** parameter. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + username: + type: string + format: email + description: >- + Email address for the user who triggered this event. If this + resource returns this parameter, it doesn't return the + **publicApiKey** parameter. + example: test.user@mongodb.com + readOnly: true + alertId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the alert + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + alertConfigId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration associated with the **alertId**. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + invoiceId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies of the invoice + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + paymentId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the invoice + payment associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + dbUserUsername: + type: string + description: >- + The username of the MongoDB User that was created, deleted, or + edited. + example: user1 + readOnly: true + whitelistEntry: + type: string + description: >- + Entry in the list of source host addresses that the API key accepts + and this event targets. + example: 0.0.0.0 + readOnly: true + teamId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + team associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + targetUsername: + type: string + format: email + description: >- + Email address for the console user that this event targets. The + resource returns this parameter when `"eventTypeName" : "USER"`. + example: test.user@mongodb.com + readOnly: true + resourceId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the resource + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + resourceType: + type: string + description: Unique identifier of resource type. + example: cluster + ExportStatus: + type: object + description: State of the export job for the collections on the replica set only. + properties: + exportedCollections: + type: integer + format: int32 + description: >- + Number of collections on the replica set that MongoDB Cloud + exported. + readOnly: true + totalCollections: + type: integer + format: int32 + description: Total number of collections on the replica set to export. + readOnly: true + FTSMetric: + type: object + description: >- + Measurement of one Atlas Search status when MongoDB Atlas received this + request. + properties: + metricName: + type: string + description: >- + Human-readable label that identifies this Atlas Search hardware, + status, or index measurement. + readOnly: true + units: + type: string + description: Unit of measurement that applies to this Atlas Search metric. + readOnly: true + readOnly: true + required: + - metricName + - units + FederatedUser: + type: object + description: MongoDB Cloud user linked to this federated authentication. + properties: + emailAddress: + type: string + format: email + description: >- + Email address of the MongoDB Cloud user linked to the federated + organization. + federationSettingsId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the federation to + which this MongoDB Cloud user belongs. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + firstName: + type: string + description: First or given name that belongs to the MongoDB Cloud user. + lastName: + type: string + description: >- + Last name, family name, or surname that belongs to the MongoDB Cloud + user. + userId: + type: string + description: Unique 24-hexadecimal digit string that identifies this user. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + required: + - emailAddress + - federationSettingsId + - firstName + - lastName + title: Federated User + FederationIdentityProvider: + type: object + properties: + acsUrl: + type: string + description: URL that points to where to send the SAML response. + associatedDomains: + type: array + description: >- + List that contains the domains associated with the identity + provider. + items: + type: string + uniqueItems: true + associatedOrgs: + type: array + description: >- + List that contains the connected organization configurations + associated with the identity provider. + items: + $ref: '#/components/schemas/ConnectedOrgConfig' + uniqueItems: true + audienceUri: + type: string + description: >- + Unique string that identifies the intended audience of the SAML + assertion. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion. + oktaIdpId: + type: string + description: >- + Unique 20-hexadecimal digit string that identifies the identity + provider. + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + pemFileInfo: + $ref: '#/components/schemas/PemFileInfo' + requestBinding: + type: string + description: >- + SAML Authentication Request Protocol HTTP method binding (POST or + REDIRECT) that Federated Authentication uses to send the + authentication request. + responseSignatureAlgorithm: + type: string + description: >- + Signature algorithm that Federated Authentication uses to encrypt + the identity provider signature. + ssoDebugEnabled: + type: boolean + description: >- + Flag that indicates whether the identity provider has SSO debug + enabled. + ssoUrl: + type: string + description: URL that points to the receiver of the SAML authentication request. + status: + type: string + description: String enum that indicates whether the identity provider is active. + required: + - oktaIdpId + FieldTransformation: + type: object + description: Field Transformations during ingestion of a Data Lake Pipeline. + properties: + field: + type: string + description: Key in the document. + type: + type: string + description: >- + Type of transformation applied during the export of the namespace in + a Data Lake Pipeline. + title: Field Transformation + GCPConsumerForwardingRule: + type: object + properties: + endpointName: + type: string + description: >- + Human-readable label that identifies the Google Cloud consumer + forwarding rule that you created. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: >- + https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + readOnly: true + ipAddress: + type: string + description: >- + One Private Internet Protocol version 4 (IPv4) address to which this + Google Cloud consumer forwarding rule resolves. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + status: + type: string + description: >- + State of the MongoDB Cloud endpoint group when MongoDB Cloud + received this request. + readOnly: true + GeoSharding: + type: object + properties: + customZoneMapping: + type: object + additionalProperties: + type: string + description: >- + List that contains comma-separated key value pairs to map zones to + geographic regions. These pairs map an ISO 3166-1a2 location code, + with an ISO 3166-2 subdivision code when possible, to a unique + 24-hexadecimal string that identifies the custom zone. + + + This parameter returns an empty object if no custom zones exist. + readOnly: true + description: >- + List that contains comma-separated key value pairs to map zones to + geographic regions. These pairs map an ISO 3166-1a2 location code, + with an ISO 3166-2 subdivision code when possible, to a unique + 24-hexadecimal string that identifies the custom zone. + + + This parameter returns an empty object if no custom zones exist. + readOnly: true + managedNamespaces: + type: array + description: >- + List that contains a namespace for a Global Cluster. MongoDB Cloud + manages this cluster. + items: + $ref: '#/components/schemas/ManagedNamespaces' + readOnly: true + GoogleCloudKMS: + type: object + description: >- + Details that define the configuration of Encryption at Rest using Google + Cloud Key Management Service (KMS). + externalDocs: + description: Google Cloud Key Management Service + url: https://www.mongodb.com/docs/atlas/security-gcp-kms/ + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether someone enabled encryption at rest for + the specified project. To disable encryption at rest using customer + key management and remove the configuration details, pass only this + parameter with a value of `false`. + keyVersionResourceID: + type: string + description: >- + Resource path that displays the key version resource ID for your + Google Cloud KMS. + example: >- + projects/my-project-common-0/locations/us-east4/keyRings/my-key-ring-0/cryptoKeys/my-key-0/cryptoKeyVersions/1 + serviceAccountKey: + type: string + description: >- + JavaScript Object Notation (JSON) object that contains the Google + Cloud Key Management Service (KMS). Format the JSON as a string and + not as an object. + externalDocs: + description: Google Cloud Authentication + url: https://cloud.google.com/docs/authentication/getting-started + writeOnly: true + valid: + type: boolean + description: >- + Flag that indicates whether the Google Cloud Key Management Service + (KMS) encryption key can encrypt and decrypt data. + readOnly: true + GreaterThanRawThreshold: + type: object + description: A Limit that triggers an alert when greater than a number. + properties: + operator: + type: string + description: Comparison operator to apply when checking the current metric value. + threshold: + type: integer + format: int32 + description: Value of metric that, when exceeded, triggers an alert. + units: + $ref: '#/components/schemas/RawMetricUnits' + title: Greater Than Raw Threshold + Group: + type: object + properties: + clusterCount: + type: integer + format: int64 + description: Quantity of MongoDB Cloud clusters deployed in this project. + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this project. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + name: + type: string + description: >- + Human-readable label that identifies the project included in the + MongoDB Cloud organization. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + orgId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the MongoDB Cloud + organization to which the project belongs. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + regionUsageRestrictions: + type: string + default: NONE + description: Region usage restrictions that designate the project's AWS region. + withDefaultAlertsSettings: + type: boolean + description: >- + Flag that indicates whether to create the project with default alert + settings. + writeOnly: true + required: + - clusterCount + - created + - name + - orgId + GroupAlertsConfig: + type: object + properties: + created: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created the alert configuration. + This parameter expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + enabled: + type: boolean + default: false + description: >- + Flag that indicates whether someone enabled this alert configuration + for the specified project. + eventTypeName: + $ref: '#/components/schemas/ServerlessEventTypeViewAlertable' + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + owns this alert configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this alert + configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + matchers: + type: array + description: >- + No matchers are available for these alert types. The list is always + empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object + for the alert configuration. You can filter using the matchers array + if the **eventTypeName** specifies an event for a host, replica set, + or sharded cluster. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object + for the alert configuration. You can filter using the matchers array + if the **eventTypeName** specifies an event for a host, replica set, + or sharded cluster. + + + Alternatively: + + No matchers are available for these alert types. The list is always + empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object + for the alert configuration. You can filter using the matchers array + if the **eventTypeName** specifies an event for a host, replica set, + or sharded cluster. + + + Alternatively: + + No matchers are available for these alert types. The list is always + empty. + + + Alternatively: + + No matchers are available for these alert types. The list is always + empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object + for the alert configuration. You can filter using the matchers array + if the **eventTypeName** specifies an event for a host, replica set, + or sharded cluster. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object + for the alert configuration. You can filter using the matchers array + if the **eventTypeName** specifies an event for a host, replica set, + or sharded cluster. + + + Alternatively: + + No matchers are available for these alert types. The list is always + empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object + for the alert configuration. You can filter using the matchers array + if the **eventTypeName** specifies an event for a host, replica set, + or sharded cluster. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object + for the alert configuration. You can filter using the matchers array + if the **eventTypeName** specifies an event for a host, replica set, + or sharded cluster. + + + Alternatively: + + No matchers are available for these alert types. The list is always + empty. + items: + type: object + readOnly: true + notifications: + type: array + description: >- + List that contains the targets that MongoDB Cloud sends + notifications. + items: + $ref: '#/components/schemas/AlertsNotificationRootForGroup' + updated: + type: string + format: date-time + description: >- + Date and time when someone last updated this alert configuration. + This parameter expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + metricThreshold: + $ref: '#/components/schemas/ServerlessMetricThreshold' + threshold: + $ref: '#/components/schemas/GreaterThanRawThreshold' + GroupInvitation: + type: object + properties: + createdAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud sent the invitation. This parameter + expresses its value in ISO 8601 format in UTC. + readOnly: true + expiresAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud expires the invitation. This + parameter expresses its value in ISO 8601 format in UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + groupName: + type: string + description: >- + Human-readable label that identifies the project to which you + invited the MongoDB Cloud user. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the + invitation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + inviterUsername: + type: string + format: email + description: Email address of the MongoDB Cloud user who sent the invitation. + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + roles: + type: array + description: >- + One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + username: + type: string + format: email + description: Email address of the MongoDB Cloud user invited to join the project. + readOnly: true + GroupInvitationRequest: + type: object + properties: + roles: + type: array + description: >- + One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + username: + type: string + format: email + description: >- + Email address of the MongoDB Cloud user invited to the specified + project. + GroupInvitationUpdateRequest: + type: object + properties: + roles: + type: array + description: >- + One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + GroupMaintenanceWindow: + type: object + properties: + autoDeferOnceEnabled: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud should defer all + maintenance windows for one week after you enable them. + dayOfWeek: + type: integer + format: int32 + description: > + One-based integer that represents the day of the week that the + maintenance window starts. + + + | Value | Day of Week | + + |---|---| + + | `1` | Sunday | + + | `2` | Monday | + + | `3` | Tuesday | + + | `4` | Wednesday | + + | `5` | Thursday | + + | `6` | Friday | + + | `7` | Saturday | + maximum: 7 + minimum: 1 + hourOfDay: + type: integer + format: int32 + description: >- + Zero-based integer that represents the hour of the of the day that + the maintenance window starts according to a 24-hour clock. Use `0` + for midnight and `12` for noon. + maximum: 23 + minimum: 0 + startASAP: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud starts the maintenance + window immediately upon receiving this request. To start the + maintenance window immediately for your project, MongoDB Cloud must + have maintenance scheduled and you must set a maintenance window. + This flag resets to `false` after MongoDB Cloud completes + maintenance. + required: + - dayOfWeek + - hourOfDay + GroupName: + type: object + description: Request view to update the group name. + properties: + name: + type: string + description: >- + Human-readable label that identifies the project included in the + MongoDB Cloud organization. + GroupSettings: + type: object + description: Collection of settings that configures the project. + properties: + isCollectDatabaseSpecificsStatisticsEnabled: + type: boolean + description: >- + Flag that indicates whether to collect database-specific metrics + for the specified project. + isDataExplorerEnabled: + type: boolean + description: >- + Flag that indicates whether to enable the Data Explorer for the + specified project. + isExtendedStorageSizesEnabled: + type: boolean + description: >- + Flag that indicates whether to enable extended storage sizes for + the specified project. + isPerformanceAdvisorEnabled: + type: boolean + description: >- + Flag that indicates whether to enable the Performance Advisor and + Profiler for the specified project. + isRealtimePerformancePanelEnabled: + type: boolean + description: >- + Flag that indicates whether to enable the Real Time Performance + Panel for the specified project. + isSchemaAdvisorEnabled: + type: boolean + description: >- + Flag that indicates whether to enable the Schema Advisor for the + specified project. + HardwareSpec: + type: object + description: >- + Hardware specifications for all electable nodes deployed in the region. + Electable nodes can become the primary and can enable local reads. If + you don't specify this option, MongoDB Cloud deploys no electable nodes + to the region. + properties: + diskIOPS: + type: integer + format: int32 + description: >- + Target throughput desired for storage attached to your + AWS-provisioned cluster. Change this parameter only if you: + + + - set `"replicationSpecs[n].regionConfigs[m].providerName" : "AWS"`. + + - set + `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" + : "M30"` or greater not including `Mxx_NVME` tiers. + + + The maximum input/output operations per second (IOPS) depend on the + selected **.instanceSize** and **.diskSizeGB**. + + This parameter defaults to the cluster tier's standard IOPS value. + + Changing this value impacts cluster cost. + + MongoDB Cloud enforces minimum ratios of storage capacity to system + memory for given cluster tiers. This keeps cluster performance + consistent with large datasets. + + + - Instance sizes `M10` to `M40` have a ratio of disk capacity to + system memory of 60:1. + + - Instance sizes greater than `M40` have a ratio of 120:1. + ebsVolumeType: + type: string + default: STANDARD + description: >- + Type of storage you want to attach to your AWS-provisioned cluster. + + + - `STANDARD` volume types can't exceed the default input/output + operations per second (IOPS) rate for the selected volume size. + + + - `PROVISIONED` volume types must fall within the allowable IOPS + range for the selected volume size. + instanceSize: + type: string + description: >- + Hardware specification for the instance sizes in this region. Each + instance size has a default storage and memory capacity. The + instance size you select applies to all the data-bearing hosts in + your instance size. + title: Tenant Instance Sizes + nodeCount: + type: integer + format: int32 + description: >- + Number of nodes of the given type for MongoDB Cloud to deploy to the + region. + IndexOptions: + type: object + description: >- + One or more settings that determine how the MongoDB Cloud creates this + MongoDB index. + externalDocs: + description: Index Options + url: >- + https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options + properties: + 2dsphereIndexVersion: + type: integer + format: int32 + default: 3 + description: >- + Index version number applied to the 2dsphere index. MongoDB 3.2 and + later use version 3. Use this option to override the default version + number. This option applies to the **2dsphere** index type only. + background: + type: boolean + default: false + description: >- + Flag that indicates whether MongoDB should build the index in the + background. This applies to MongoDB databases running feature + compatibility version 4.0 or earlier. MongoDB databases running FCV + 4.2 or later build indexes using an optimized build process. This + process holds the exclusive lock only at the beginning and end of + the build process. The rest of the build process yields to + interleaving read and write operations. MongoDB databases running + FCV 4.2 or later ignore this option. This option applies to all + index types. + bits: + type: integer + format: int32 + default: 26 + description: >- + Number of precision applied to the stored geohash value of the + location data. This option applies to the **2d** index type only. + bucketSize: + type: integer + format: int32 + description: >- + Number of units within which to group the location values. You could + group in the same bucket those location values within the specified + number of units to each other. This option applies to the + geoHaystack index type only. + + + MongoDB 5.0 removed geoHaystack Indexes and the `geoSearch` command. + columnstoreProjection: + type: object + additionalProperties: + type: integer + format: int32 + description: >- + The columnstoreProjection document allows to include or exclude + subschemas schema. One cannot combine inclusion and exclusion + statements. Accordingly, the can be either of the + following: + + 1 or true to include the field and recursively all fields it is a + prefix of in the index + + 0 or false to exclude the field and recursively all fields it is a + prefix of from the index. + description: >- + The columnstoreProjection document allows to include or exclude + subschemas schema. One cannot combine inclusion and exclusion + statements. Accordingly, the can be either of the following: + + 1 or true to include the field and recursively all fields it is a + prefix of in the index + + 0 or false to exclude the field and recursively all fields it is a + prefix of from the index. + default_language: + type: string + default: english + description: >- + Human language that determines the list of stop words and the rules + for the stemmer and tokenizer. This option accepts the supported + languages using its name in lowercase english or the ISO 639-2 code. + If you set this parameter to `"none"`, then the text search uses + simple tokenization with no list of stop words and no stemming. This + option applies to the **text** index type only. + expireAfterSeconds: + type: integer + format: int32 + description: >- + Number of seconds that MongoDB retains documents in a Time To Live + (TTL) index. + hidden: + type: boolean + default: false + description: >- + Flag that determines whether the index is hidden from the query + planner. A hidden index is not evaluated as part of the query plan + selection. + language_override: + type: string + default: language + description: >- + Human-readable label that identifies the document parameter that + contains the override language for the document. This option applies + to the **text** index type only. + max: + type: integer + format: int32 + default: 180 + description: >- + Upper inclusive boundary to limit the longitude and latitude values. + This option applies to the 2d index type only. + min: + type: integer + format: int32 + default: -180 + description: >- + Lower inclusive boundary to limit the longitude and latitude values. + This option applies to the 2d index type only. + name: + type: string + description: >- + Human-readable label that identifies this index. This option applies + to all index types. + partialFilterExpression: + type: object + additionalProperties: + description: >- + Rules that limit the documents that the index references to a + filter expression. All MongoDB index types accept a + **partialFilterExpression** option. **partialFilterExpression** + can include following expressions: + + + - equality (`"parameter" : "value"` or using the `$eq` operator) + + - `"$exists": true` + + , maximum: `$gt`, `$gte`, `$lt`, `$lte` comparisons + + - `$type` + + - `$and` (top-level only) + This option applies to all index types. + description: >- + Rules that limit the documents that the index references to a filter + expression. All MongoDB index types accept a + **partialFilterExpression** option. **partialFilterExpression** can + include following expressions: + + + - equality (`"parameter" : "value"` or using the `$eq` operator) + + - `"$exists": true` + + , maximum: `$gt`, `$gte`, `$lt`, `$lte` comparisons + + - `$type` + + - `$and` (top-level only) + This option applies to all index types. + sparse: + type: boolean + default: false + description: >- + Flag that indicates whether the index references documents that only + have the specified parameter. These indexes use less space but + behave differently in some situations like when sorting. The + following index types default to sparse and ignore this option: + `2dsphere`, `2d`, `geoHaystack`, `text`. + + + Compound indexes that includes one or more indexes with `2dsphere` + keys alongside other key types, only the `2dsphere` index parameters + determine which documents the index references. If you run MongoDB + 3.2 or later, use partial indexes. This option applies to all index + types. + storageEngine: + type: object + additionalProperties: + description: >- + Storage engine set for the specific index. This value can be set + only at creation. This option uses the following format: + `"storageEngine" : { "" : "" }` + MongoDB validates storage engine configuration options when + creating indexes. To support replica sets with members with + different storage engines, MongoDB logs these options to the oplog + during replication. This option applies to all index types. + externalDocs: + description: MongoDB Server Storage Engines + url: https://docs.mongodb.com/manual/core/storage-engines/ + description: >- + Storage engine set for the specific index. This value can be set + only at creation. This option uses the following format: + `"storageEngine" : { "" : "" }` + MongoDB validates storage engine configuration options when creating + indexes. To support replica sets with members with different storage + engines, MongoDB logs these options to the oplog during replication. + This option applies to all index types. + externalDocs: + description: MongoDB Server Storage Engines + url: https://docs.mongodb.com/manual/core/storage-engines/ + textIndexVersion: + type: integer + format: int32 + default: 3 + description: >- + Version applied to this text index. MongoDB 3.2 and later use + version `3`. Use this option to override the default version number. + This option applies to the **text** index type only. + unique: + type: boolean + default: false + description: >- + Flag that indicates whether this index can accept insertion or + update of documents when the index key value matches an existing + index key value. Set `"unique" : true` to set this index as unique. + You can't set a hashed index to be unique. This option applies to + all index types. This option is unsupported for rolling indexes. + weights: + type: object + additionalProperties: + description: >- + Relative importance to place upon provided index parameters. This + object expresses this as key/value pairs of index parameter and + weight to apply to that parameter. You can specify weights for + some or all the indexed parameters. The weight must be an integer + between 1 and 99,999. MongoDB 5.0 and later can apply **weights** + to **text** indexes only. + description: >- + Relative importance to place upon provided index parameters. This + object expresses this as key/value pairs of index parameter and + weight to apply to that parameter. You can specify weights for some + or all the indexed parameters. The weight must be an integer between + 1 and 99,999. MongoDB 5.0 and later can apply **weights** to + **text** indexes only. + writeOnly: true + IngestionPipelineRun: + type: object + description: Run details of a Data Lake Pipeline. + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal character string that identifies a Data Lake + Pipeline run. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + backupFrequencyType: + type: string + description: Backup schedule interval of the Data Lake Pipeline. + readOnly: true + createdDate: + type: string + format: date-time + description: Timestamp that indicates when the pipeline run was created. + readOnly: true + datasetName: + type: string + description: >- + Human-readable label that identifies the dataset that Atlas + generates during this pipeline run. You can use this dataset as a + `dataSource` in a Federated Database collection. + example: v1$atlas$snapshot$Cluster0$myDatabase$myCollection$19700101T000000Z + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lastUpdatedDate: + type: string + format: date-time + description: >- + Timestamp that indicates the last time that the pipeline run was + updated. + readOnly: true + phase: + type: string + description: Processing phase of the Data Lake Pipeline. + readOnly: true + pipelineId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies a Data Lake + Pipeline. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + snapshotId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the snapshot + of a cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + state: + type: string + description: State of the pipeline run. + readOnly: true + stats: + $ref: '#/components/schemas/PipelineRunStats' + title: Data Lake Pipeline Run + IngestionSink: + type: object + description: Ingestion destination of a Data Lake Pipeline. + properties: + type: + type: string + description: Type of ingestion destination of this Data Lake Pipeline. + readOnly: true + metadataProvider: + type: string + description: Target cloud provider for this Data Lake Pipeline. + metadataRegion: + type: string + description: Target cloud provider region for this Data Lake Pipeline. + externalDocs: + description: Supported cloud provider regions + url: https://www.mongodb.com/docs/datalake/limitations + partitionFields: + type: array + description: Ordered fields used to physically organize data in the destination. + items: + $ref: '#/components/schemas/DataLakePipelinesPartitionField' + title: Ingestion Destination + IngestionSource: + type: object + description: Ingestion Source of a Data Lake Pipeline. + properties: + type: + type: string + description: Type of ingestion source of this Data Lake Pipeline. + clusterName: + type: string + description: Human-readable name that identifies the cluster. + collectionName: + type: string + description: Human-readable name that identifies the collection. + databaseName: + type: string + description: Human-readable name that identifies the database. + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + policyItemId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies a policy + item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + title: Ingestion Source + InvoiceLineItem: + type: object + description: One service included in this invoice. + properties: + clusterName: + type: string + description: >- + Human-readable label that identifies the cluster that incurred the + charge. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this line item. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + discountCents: + type: integer + format: int64 + description: >- + Sum by which MongoDB discounted this line item. MongoDB Cloud + expresses this value in cents (100ths of one US Dollar). The + resource returns this parameter when a discount applies. + readOnly: true + endDate: + type: string + format: date-time + description: >- + Date and time when when MongoDB Cloud finished charging for this + line item. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project + associated to this line item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + groupName: + type: string + description: Human-readable label that identifies the project. + note: + type: string + description: Comment that applies to this line item. + readOnly: true + percentDiscount: + type: number + format: float + description: >- + Percentage by which MongoDB discounted this line item. The resource + returns this parameter when a discount applies. + readOnly: true + quantity: + type: number + format: double + description: >- + Number of units included for the line item. These can be expressions + of storage (GB), time (hours), or other units. + readOnly: true + sku: + type: string + description: >- + Human-readable description of the service that this line item + provided. This Stock Keeping Unit (SKU) could be the instance type, + a support charge, advanced security, or another service. + readOnly: true + startDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud began charging for this line item. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + stitchAppName: + type: string + description: >- + Human-readable label that identifies the Atlas App Services + application associated with this line item. + externalDocs: + description: Create a new Atlas App Service + url: >- + https://www.mongodb.com/docs/atlas/app-services/manage-apps/create/create-with-ui/ + readOnly: true + tags: + type: object + additionalProperties: + type: array + description: >- + A map of key-value pairs corresponding to the tags associated with + the line item resource. + items: + type: string + description: >- + A map of key-value pairs corresponding to the tags associated + with the line item resource. + readOnly: true + readOnly: true + description: >- + A map of key-value pairs corresponding to the tags associated with + the line item resource. + readOnly: true + tierLowerBound: + type: number + format: double + description: >- + Lower bound for usage amount range in current SKU tier. + + + **NOTE**: **lineItems[n].tierLowerBound** appears only if your + **lineItems[n].sku** is tiered. + readOnly: true + tierUpperBound: + type: number + format: double + description: >- + Upper bound for usage amount range in current SKU tier. + + + **NOTE**: **lineItems[n].tierUpperBound** appears only if your + **lineItems[n].sku** is tiered. + readOnly: true + totalPriceCents: + type: integer + format: int64 + description: >- + Sum of the cost set for this line item. MongoDB Cloud expresses this + value in cents (100ths of one US Dollar) and calculates this value + as **unitPriceDollars** × **quantity** × 100. + readOnly: true + unit: + type: string + description: >- + Element used to express what **quantity** this line item measures. + This value can be elements of time, storage capacity, and the like. + readOnly: true + unitPriceDollars: + type: number + format: double + description: Value per **unit** for this line item expressed in US Dollars. + readOnly: true + title: Line Item + LDAPSecuritySettings: + type: object + description: >- + Lightweight Directory Access Protocol (LDAP) over Transport Layer + Security (TLS) configuration details that apply to the specified + project. + properties: + authenticationEnabled: + type: boolean + description: >- + Flag that indicates whether users can authenticate using an + Lightweight Directory Access Protocol (LDAP) host. + authorizationEnabled: + type: boolean + description: >- + Flag that indicates whether users can authorize access to MongoDB + Cloud resources using an Lightweight Directory Access Protocol + (LDAP) host. + authzQueryTemplate: + type: string + default: '{USER}?memberOf?base' + description: >- + Lightweight Directory Access Protocol (LDAP) query template that + MongoDB Cloud runs to obtain the LDAP groups associated with the + authenticated user. MongoDB Cloud uses this parameter only for user + authorization. Use the `{USER}` placeholder in the Uniform Resource + Locator (URL) to substitute the authenticated username. The query + relates to the host specified with the hostname. Format this query + according to [RFC 4515](https://tools.ietf.org/search/rfc4515) and + [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). + example: '{USER}?memberOf?base' + bindPassword: + type: string + description: >- + Password that MongoDB Cloud uses to authenticate the + **bindUsername**. + writeOnly: true + bindUsername: + type: string + description: >- + Full Distinguished Name (DN) of the Lightweight Directory Access + Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP + host. LDAP distinguished names must be formatted according to RFC + 2253. + example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + externalDocs: + description: RFC 2253 + url: https://tools.ietf.org/html/2253 + pattern: >- + ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + caCertificate: + type: string + description: >- + Certificate Authority (CA) certificate that MongoDB Cloud uses to + verify the identity of the Lightweight Directory Access Protocol + (LDAP) host. MongoDB Cloud allows self-signed certificates. To + delete an assigned value, pass an empty string: `"caCertificate": + ""`. + hostname: + type: string + description: >- + Human-readable label that identifies the hostname or Internet + Protocol (IP) address of the Lightweight Directory Access Protocol + (LDAP) host. This host must have access to the internet or have a + Virtual Private Cloud (VPC) peering connection to your cluster. + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + port: + type: integer + format: int32 + default: 636 + description: >- + Port to which the Lightweight Directory Access Protocol (LDAP) host + listens for client connections. + userToDNMapping: + type: array + description: >- + User-to-Distinguished Name (DN) map that MongoDB Cloud uses to + transform a Lightweight Directory Access Protocol (LDAP) username + into an LDAP DN. + items: + $ref: '#/components/schemas/UserToDNMapping' + title: LDAP Security Settings + LDAPVerifyConnectivityJobRequest: + type: object + properties: + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project + associated with this Lightweight Directory Access Protocol (LDAP) + over Transport Layer Security (TLS) configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + request: + $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequestParams' + requestId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this request to + verify an Lightweight Directory Access Protocol (LDAP) + configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + status: + type: string + description: >- + Human-readable string that indicates the status of the Lightweight + Directory Access Protocol (LDAP) over Transport Layer Security (TLS) + configuration. + readOnly: true + validations: + type: array + description: >- + List that contains the validation messages related to the + verification of the provided Lightweight Directory Access Protocol + (LDAP) over Transport Layer Security (TLS) configuration details. + The list contains a document for each test that MongoDB Cloud runs. + MongoDB Cloud stops running tests after the first failure. + items: + $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequestValidation' + readOnly: true + LDAPVerifyConnectivityJobRequestParams: + type: object + description: >- + Request information needed to verify an Lightweight Directory Access + Protocol (LDAP) over Transport Layer Security (TLS) configuration. The + response does not return the **bindPassword**. + properties: + authzQueryTemplate: + type: string + default: '{USER}?memberOf?base' + description: >- + Lightweight Directory Access Protocol (LDAP) query template that + MongoDB Cloud applies to create an LDAP query to return the LDAP + groups associated with the authenticated MongoDB user. MongoDB Cloud + uses this parameter only for user authorization. + + + Use the `{USER}` placeholder in the Uniform Resource Locator (URL) + to substitute the authenticated username. The query relates to the + host specified with the hostname. Format this query per [RFC + 4515](https://tools.ietf.org/search/rfc4515) and [RFC + 4516](https://datatracker.ietf.org/doc/html/rfc4516). + example: '{USER}?memberOf?base' + writeOnly: true + bindPassword: + type: string + description: >- + Password that MongoDB Cloud uses to authenticate the + **bindUsername**. + writeOnly: true + bindUsername: + type: string + description: >- + Full Distinguished Name (DN) of the Lightweight Directory Access + Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP + host. LDAP distinguished names must be formatted according to RFC + 2253. + example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + externalDocs: + description: RFC 2253 + url: https://tools.ietf.org/html/2253 + pattern: >- + ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + caCertificate: + type: string + description: >- + Certificate Authority (CA) certificate that MongoDB Cloud uses to + verify the identity of the Lightweight Directory Access Protocol + (LDAP) host. MongoDB Cloud allows self-signed certificates. To + delete an assigned value, pass an empty string: `"caCertificate": + ""`. + hostname: + type: string + description: >- + Human-readable label that identifies the hostname or Internet + Protocol (IP) address of the Lightweight Directory Access Protocol + (LDAP) host. This host must have access to the internet or have a + Virtual Private Cloud (VPC) peering connection to your cluster. + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + port: + type: integer + format: int32 + default: 636 + description: >- + IANA port to which the Lightweight Directory Access Protocol (LDAP) + host listens for client connections. + required: + - bindPassword + - bindUsername + - hostname + - port + LDAPVerifyConnectivityJobRequestValidation: + type: object + description: >- + One test that MongoDB Cloud runs to test verification of the provided + Lightweight Directory Access Protocol (LDAP) over Transport Layer + Security (TLS) configuration details. + properties: + status: + type: string + description: >- + Human-readable string that indicates the result of this verification + test. + readOnly: true + validationType: + type: string + description: >- + Human-readable label that identifies this verification test that + MongoDB Cloud runs. + readOnly: true + readOnly: true + LegacyAtlasCluster: + type: object + description: Group of settings that configure a MongoDB cluster. + properties: + acceptDataRisksAndForceReplicaSetReconfig: + type: string + format: date-time + description: >- + If reconfiguration is necessary to regain a primary due to a + regional outage, submit this field alongside your topology + reconfiguration to request a new regional outage resistant topology. + Forced reconfigurations during an outage of the majority of + electable nodes carry a risk of data loss if replicated writes (even + majority committed writes) have not been replicated to the new + primary node. MongoDB Atlas docs contain more information. To + proceed with an operation which carries that risk, set + **acceptDataRisksAndForceReplicaSetReconfig** to the current date. + externalDocs: + description: Reconfiguring a Replica Set during a regional outage + url: >- + https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set + autoScaling: + $ref: '#/components/schemas/ClusterAutoScalingSettings' + backupEnabled: + type: boolean + description: >- + Flag that indicates whether the cluster can perform backups. If set + to `true`, the cluster can perform backups. You must set this value + to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated + clusters and Shared Cluster Backups for tenant clusters. If set to + `false`, the cluster doesn't use MongoDB Cloud backups. + biConnector: + $ref: '#/components/schemas/BiConnector' + clusterType: + type: string + description: Configuration of nodes that comprise the cluster. + connectionStrings: + $ref: '#/components/schemas/ClusterConnectionStrings' + createDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this serverless instance. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + diskSizeGB: + type: number + format: double + description: >- + Storage capacity that the host's root volume possesses expressed in + gigabytes. Increase this number to add capacity. MongoDB Cloud + requires this parameter if you set **replicationSpecs**. If you + specify a disk size below the minimum (10 GB), this parameter + defaults to the minimum disk size value. Storage charge calculations + depend on whether you choose the default value or a custom value. + The maximum value for disk storage cannot exceed 50 times the + maximum RAM for the selected cluster. If you require more storage + space, consider upgrading your cluster to a higher tier. + maximum: 4096 + minimum: 10 + encryptionAtRestProvider: + type: string + description: >- + Cloud service provider that manages your customer keys to provide an + additional layer of Encryption at Rest for the cluster. + externalDocs: + description: Encryption at Rest using Customer Key Management + url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + labels: + type: array + description: >- + Collection of key-value pairs between 1 to 255 characters in length + that tag and categorize the cluster. The MongoDB Cloud console + doesn't display your labels. + + + Cluster labels will be deprecated in a future release. We strongly + recommend that you use [resource + tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) + instead. + items: + $ref: '#/components/schemas/ComponentLabel' + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + mongoDBMajorVersion: + type: string + default: '6.0' + description: >- + Major MongoDB version of the cluster. MongoDB Cloud deploys the + cluster with the latest stable release of the specified version. + mongoDBVersion: + type: string + description: Version of MongoDB that the cluster runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + mongoURI: + type: string + description: >- + Base connection string that you can use to connect to the cluster. + MongoDB Cloud displays the string only after the cluster starts, not + while it builds the cluster. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + mongoURIUpdated: + type: string + format: date-time + description: >- + Date and time when someone last updated the connection string. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + mongoURIWithOptions: + type: string + description: >- + Connection string that you can use to connect to the cluster + including the `replicaSet`, `ssl`, and `authSource` query parameters + with values appropriate for the cluster. You may need to add MongoDB + database users. The response returns this parameter once the cluster + can receive requests, not while it builds the cluster. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + name: + type: string + description: Human-readable label that identifies the cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + numShards: + type: integer + format: int32 + default: 1 + description: >- + Number of shards up to 50 to deploy for a sharded cluster. The + resource returns `1` to indicate a replica set and values of `2` and + higher to indicate a sharded cluster. The returned value equals the + number of shards in the cluster. + externalDocs: + description: Sharding + url: https://docs.mongodb.com/manual/sharding/ + maximum: 50 + minimum: 1 + paused: + type: boolean + description: Flag that indicates whether the cluster is paused. + pitEnabled: + type: boolean + description: >- + Flag that indicates whether the cluster uses continuous cloud + backups. + externalDocs: + description: Continuous Cloud Backups + url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ + providerBackupEnabled: + type: boolean + description: >- + Flag that indicates whether the M10 or higher cluster can perform + Cloud Backups. If set to `true`, the cluster can perform backups. If + this and **backupEnabled** are set to `false`, the cluster doesn't + use MongoDB Cloud backups. + providerSettings: + $ref: '#/components/schemas/ClusterProviderSettings' + replicationFactor: + type: integer + format: int32 + default: 3 + deprecated: true + description: >- + Number of members that belong to the replica set. Each member + retains a copy of your databases, providing high availability and + data redundancy. Use **replicationSpecs** instead. + replicationSpec: + type: object + additionalProperties: + $ref: '#/components/schemas/RegionSpec' + description: Physical location where MongoDB Cloud provisions cluster nodes. + title: Region Configuration + replicationSpecs: + type: array + description: >- + List of settings that configure your cluster regions. + + + - For Global Clusters, each object in the array represents one zone + where MongoDB Cloud deploys your clusters nodes. + + - For non-Global sharded clusters and replica sets, the single + object represents where MongoDB Cloud deploys your clusters nodes. + items: + $ref: '#/components/schemas/LegacyReplicationSpec' + rootCertType: + type: string + default: ISRGROOTX1 + description: >- + Root Certificate Authority that MongoDB Atlas clusters uses. MongoDB + Cloud supports Internet Security Research Group. + srvAddress: + type: string + description: >- + Connection string that you can use to connect to the cluster. The + `+srv` modifier forces the connection to use Transport Layer + Security (TLS). The `mongoURI` parameter lists additional options. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + stateName: + type: string + description: >- + Human-readable label that indicates the current operating condition + of the cluster. + readOnly: true + tags: + type: array + description: >- + List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the cluster. + externalDocs: + description: Resource Tags + url: https://dochub.mongodb.org/core/add-cluster-tag-atlas + items: + $ref: '#/components/schemas/ResourceTag' + terminationProtectionEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether termination protection is enabled on the + cluster. If set to `true`, MongoDB Cloud won't delete the cluster. + If set to `false`, MongoDB Cloud will delete the cluster. + versionReleaseSystem: + type: string + default: LTS + description: >- + Method by which the cluster maintains the MongoDB versions. If value + is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. + title: Cluster Description + LegacyReplicationSpec: + type: object + properties: + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a Global Cluster. + + + - If you include existing zones in the request, you must specify + this parameter. + + + - If you add a new zone to an existing Global Cluster, you may + specify this parameter. The request deletes any existing zones in a + Global Cluster that you exclude from the request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + numShards: + type: integer + format: int32 + default: 1 + description: >- + Positive integer that specifies the number of shards to deploy in + each specified zone If you set this value to `1` and **clusterType** + is `SHARDED`, MongoDB Cloud deploys a single-shard sharded cluster. + Don't create a sharded cluster with a single shard for production + environments. Single-shard sharded clusters don't provide the same + benefits as multi-shard configurations. + regionsConfig: + type: object + additionalProperties: + $ref: '#/components/schemas/RegionSpec' + description: Physical location where MongoDB Cloud provisions cluster nodes. + title: Region Configuration + zoneName: + type: string + description: >- + Human-readable label that identifies the zone in a Global Cluster. + Provide this value only if **clusterType** is `GEOSHARDED`. + Link: + type: object + properties: + href: + type: string + description: >- + Uniform Resource Locator (URL) that points another API resource to + which this response has some relationship. This URL often begins + with `https://cloud.mongodb.com/api/atlas`. + example: https://cloud.mongodb.com/api/atlas + rel: + type: string + description: >- + Uniform Resource Locator (URL) that defines the semantic + relationship between this resource and another API resource. This + URL often begins with `https://cloud.mongodb.com/api/atlas`. + example: self + Link_Atlas: + type: object + properties: + href: + type: string + description: >- + Uniform Resource Locator (URL) that points another API resource to + which this response has some relationship. This URL often begins + with `https://cloud.mongodb.com/api/atlas`. + example: https://cloud.mongodb.com/api/atlas + rel: + type: string + description: >- + Uniform Resource Locator (URL) that defines the semantic + relationship between this resource and another API resource. This + URL often begins with `https://cloud.mongodb.com/api/atlas`. + example: self + LiveImportAvailableProject: + type: object + properties: + deployments: + type: array + description: List of clusters that can be migrated to MongoDB Cloud. + items: + $ref: '#/components/schemas/AvailableClustersDeployment' + migrationHosts: + type: array + description: >- + Hostname of MongoDB Agent list that you configured to perform a + migration. + items: + type: string + description: >- + Hostname of MongoDB Agent that you configured to perform a + migration. + name: + type: string + description: Human-readable label that identifies this project. + maxLength: 64 + minLength: 1 + readOnly: true + projectId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project to be + migrated. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + required: + - name + - projectId + LiveImportValidation: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the validation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + errorMessage: + type: string + description: Reason why the validation job failed. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project to + validate. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + sourceGroupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the source + project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + status: + type: string + description: >- + State of the specified validation job returned at the time of the + request. + readOnly: true + LiveMigrationRequest: + type: object + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the migration + request. + example: 507f1f77bcf86cd799439011 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + destination: + $ref: '#/components/schemas/Destination' + dropEnabled: + type: boolean + description: >- + Flag that indicates whether the migration process drops all + collections from the destination cluster before the migration + starts. + writeOnly: true + migrationHosts: + type: array + description: List of migration hosts used for this migration. + items: + type: string + example: vm001.example.com + maxItems: 1 + minItems: 1 + source: + $ref: '#/components/schemas/Source' + required: + - destination + - dropEnabled + - source + LiveMigrationResponse: + type: object + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the migration + job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lagTimeSeconds: + type: integer + format: int64 + description: >- + Replication lag between the source and destination clusters. Atlas + returns this setting only during an active migration, before the + cutover phase. + readOnly: true + migrationHosts: + type: array + description: >- + List of hosts running MongoDB Agents. These Agents can transfer your + MongoDB data between one source and one target cluster. + items: + type: string + description: >- + One host running a MongoDB Agent. This Agent can transfer your + MongoDB data between one source and one target cluster. + example: vm001.example.com + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + readOnly: true + readyForCutover: + type: boolean + description: >- + Flag that indicates the migrated cluster can be cut over to MongoDB + Atlas. + readOnly: true + status: + type: string + description: > + Progress made in migrating one cluster to MongoDB Atlas. + + + | Status | Explanation | + + |----------|-------------| + + | NEW | Someone scheduled a local cluster migration to MongoDB + Atlas. | + + | FAILED | The cluster migration to MongoDB Atlas + failed. | + + | COMPLETE | The cluster migration to MongoDB Atlas + succeeded. | + + | EXPIRED | MongoDB Atlas prepares to begin the cut over of the + migrating cluster when source and target clusters have almost + synchronized. If `"readyForCutover" : true`, this synchronization + starts a timer of 120 hours. You can extend this timer. If the timer + expires, MongoDB Atlas returns this status. | + + | WORKING | The cluster migration to MongoDB Atlas is performing + one of the following tasks:
  • Preparing connections to source + and target clusters
  • Replicating data from source to + target
  • Verifying MongoDB Atlas connection + settings
  • Stopping replication after the cut over
| + readOnly: true + ManagedNamespaces: + type: object + properties: + collection: + type: string + description: >- + Human-readable label of the collection to manage for this Global + Cluster. + customShardKey: + type: string + description: >- + Database parameter used to divide the *collection* into shards. + Global clusters require a compound shard key. This compound shard + key combines the location parameter and the user-selected custom + key. + readOnly: true + db: + type: string + description: >- + Human-readable label of the database to manage for this Global + Cluster. + isCustomShardKeyHashed: + type: boolean + default: false + description: >- + Flag that indicates whether someone hashed the custom shard key for + the specified collection. If you set this value to `false`, MongoDB + Cloud uses ranged sharding. + externalDocs: + description: Hashed Shard Keys + url: >- + https://www.mongodb.com/docs/manual/reference/method/sh.shardCollection/#hashed-shard-keys + writeOnly: true + isShardKeyUnique: + type: boolean + default: false + description: >- + Flag that indicates whether someone + [hashed](https://www.mongodb.com/docs/manual/reference/method/sh.shardCollection/#hashed-shard-keys) + the custom shard key. If this parameter returns `false`, this + cluster uses [ranged + sharding](https://www.mongodb.com/docs/manual/core/ranged-sharding/). + writeOnly: true + numInitialChunks: + type: integer + format: int64 + description: >- + Minimum number of chunks to create initially when sharding an empty + collection with a [hashed shard + key](https://www.mongodb.com/docs/manual/core/hashed-sharding/). + externalDocs: + description: Global Cluster Sharding + url: https://www.mongodb.com/docs/atlas/shard-global-collection/ + maximum: 8192 + writeOnly: true + presplitHashedZones: + type: boolean + default: false + description: >- + Flag that indicates whether MongoDB Cloud should create and + distribute initial chunks for an empty or non-existing collection. + MongoDB Cloud distributes data based on the defined zones and zone + ranges for the collection. + externalDocs: + description: Hashed Shard Key + url: https://www.mongodb.com/docs/manual/core/hashed-sharding/ + writeOnly: true + required: + - collection + - customShardKey + - db + MeasurementDiskPartition: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + partitionName: + type: string + description: >- + Human-readable label of the disk or partition to which the + measurements apply. + readOnly: true + MeasurementsIndexes: + type: object + properties: + collectionName: + type: string + description: Human-readable label that identifies the collection. + readOnly: true + databaseName: + type: string + description: >- + Human-readable label that identifies the database that the specified + MongoDB process serves. + readOnly: true + end: + type: string + format: date-time + description: >- + Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: >- + Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + indexIds: + type: array + description: List that contains the Atlas Search index identifiers. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the index. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + indexStatsMeasurements: + type: array + description: List that contains the Atlas Search index stats measurements. + items: + $ref: '#/components/schemas/MetricsMeasurement' + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + processId: + type: string + description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: >- + Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + MeasurementsNonIndex: + type: object + properties: + end: + type: string + format: date-time + description: >- + Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: >- + Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hardwareMeasurements: + type: array + description: List that contains the Atlas Search hardware measurements. + items: + $ref: '#/components/schemas/MetricsMeasurement' + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + processId: + type: string + description: >- + Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: >- + Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + statusMeasurements: + type: array + description: List that contains the Atlas Search status measurements. + items: + $ref: '#/components/schemas/MetricsMeasurement' + readOnly: true + MesurementsDatabase: + type: object + properties: + databaseName: + type: string + description: >- + Human-readable label that identifies the database that the specified + MongoDB process serves. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + MetricDataPoint: + type: object + description: >- + value of, and metadata provided for, one data point generated at a + particular moment in time. If no data point exists for a particular + moment in time, the `value` parameter returns `null`. + properties: + timestamp: + type: string + format: date-time + description: >- + Date and time when this data point occurred. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + value: + type: number + description: Value that comprises this data point. + readOnly: true + readOnly: true + MetricDataPoint_Atlas: + type: object + description: >- + value of, and metadata provided for, one data point generated at a + particular moment in time. If no data point exists for a particular + moment in time, the `value` parameter returns `null`. + properties: + timestamp: + type: string + format: date-time + description: >- + Date and time when this data point occurred. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + value: + type: number + description: Value that comprises this data point. + readOnly: true + readOnly: true + MetricsMeasurement: + type: object + properties: + dataPoints: + type: array + description: >- + List that contains the value of, and metadata provided for, one data + point generated at a particular moment in time. If no data point + exists for a particular moment in time, the `value` parameter + returns `null`. + items: + $ref: '#/components/schemas/MetricDataPoint' + readOnly: true + name: + type: string + description: Human-readable label of the measurement that this data point covers. + readOnly: true + units: + type: string + description: >- + Element used to quantify the measurement. The resource returns units + of throughput, storage, and time. + readOnly: true + MetricsMeasurement_Atlas: + type: object + properties: + dataPoints: + type: array + description: >- + List that contains the value of, and metadata provided for, one data + point generated at a particular moment in time. If no data point + exists for a particular moment in time, the `value` parameter + returns `null`. + items: + $ref: '#/components/schemas/MetricDataPoint_Atlas' + readOnly: true + name: + type: string + description: Human-readable label of the measurement that this data point covers. + readOnly: true + units: + type: string + description: >- + Element used to quantify the measurement. The resource returns units + of throughput, storage, and time. + readOnly: true + MongoDBAccessLogs: + type: object + description: Authentication attempt, one per object, made against the cluster. + properties: + authResult: + type: boolean + description: >- + Flag that indicates whether the response should return successful + authentication attempts only. + authSource: + type: string + description: Database against which someone attempted to authenticate. + readOnly: true + failureReason: + type: string + description: >- + Reason that the authentication failed. Null if authentication + succeeded. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostname: + type: string + description: >- + Human-readable label that identifies the hostname of the target node + that received the authentication attempt. + readOnly: true + ipAddress: + type: string + description: >- + Internet Protocol address that attempted to authenticate with the + database. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + logLine: + type: string + description: Text of the host log concerning the authentication attempt. + readOnly: true + timestamp: + type: string + description: >- + Date and time when someone made this authentication attempt. MongoDB + Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + username: + type: string + description: Username used to authenticate against the database. + readOnly: true + MongoDBAccessLogsList: + type: object + properties: + accessLogs: + type: array + description: Authentication attempt, one per object, made against the cluster. + items: + $ref: '#/components/schemas/MongoDBAccessLogs' + readOnly: true + NamespaceObj: + type: object + description: >- + Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + properties: + namespace: + type: string + description: >- + Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + readOnly: true + type: + type: string + default: collection + description: Human-readable label that identifies the type of namespace. + readOnly: true + readOnly: true + Namespaces: + type: object + properties: + namespaces: + type: array + description: >- + List that contains each combination of database, collection, and + type on the specified host. + items: + $ref: '#/components/schemas/NamespaceObj' + readOnly: true + uniqueItems: true + NetworkPermissionEntry: + type: object + properties: + awsSecurityGroup: + type: string + description: >- + Unique string of the Amazon Web Services (AWS) security group that + you want to add to the project's IP access list. Your IP access list + entry can be one **awsSecurityGroup**, one **cidrBlock**, or one + **ipAddress**. You must configure Virtual Private Connection (VPC) + peering for your project before you can add an AWS security group to + an IP access list. You cannot set AWS security groups as temporary + access list entries. Don't set this parameter if you set + **cidrBlock** or **ipAddress**. + pattern: ^([0-9]*\/)?sg-([0-9]*) + cidrBlock: + type: string + description: >- + Range of IP addresses in Classless Inter-Domain Routing (CIDR) + notation that you want to add to the project's IP access list. Your + IP access list entry can be one **awsSecurityGroup**, one + **cidrBlock**, or one **ipAddress**. Don't set this parameter if you + set **awsSecurityGroup** or **ipAddress**. + pattern: >- + ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + comment: + type: string + description: >- + Remark that explains the purpose or scope of this IP access list + entry. + maxLength: 80 + deleteAfterDate: + type: string + format: date-time + description: >- + Date and time after which MongoDB Cloud deletes the temporary access + list entry. This parameter expresses its value in the ISO 8601 + timestamp format in UTC and can include the time zone designation. + The date must be later than the current date but no later than one + week after you submit this request. The resource returns this + parameter if you specified an expiration date when creating this IP + access list entry. + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + contains the IP access list to which you want to add one or more + entries. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + ipAddress: + type: string + description: >- + IP address that you want to add to the project's IP access list. + Your IP access list entry can be one **awsSecurityGroup**, one + **cidrBlock**, or one **ipAddress**. Don't set this parameter if you + set **awsSecurityGroup** or **cidrBlock**. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + NetworkPermissionEntryStatus: + type: object + properties: + STATUS: + type: string + description: > + State of the access list entry when MongoDB Cloud made this request. + + + | Status | Activity | + + |---|---| + + | `ACTIVE` | This access list entry applies to all relevant cloud + providers. | + + | `PENDING` | MongoDB Cloud has started to add access list entry. + This access list entry may not apply to all cloud providers at the + time of this request. | + + | `FAILED` | MongoDB Cloud didn't succeed in adding this access list + entry. | + readOnly: true + required: + - STATUS + NoBody: + type: object + description: Endpoint does not return a response body. + NumberMetricUnits: + type: string + description: >- + Element used to express the quantity. This can be an element of time, + storage capacity, and the like. + example: COUNT + title: Number Metric Units + OnlineArchiveSchedule: + type: object + description: Regular frequency and duration when archiving process occurs. + properties: + type: + type: string + description: Type of schedule. + endHour: + type: integer + format: int32 + description: >- + Hour of the day when the scheduled window to run one online archive + ends. + maximum: 23 + minimum: 0 + endMinute: + type: integer + format: int32 + description: >- + Minute of the hour when the scheduled window to run one online + archive ends. + maximum: 59 + minimum: 0 + startHour: + type: integer + format: int32 + description: >- + Hour of the day when the when the scheduled window to run one online + archive starts. + maximum: 23 + minimum: 0 + startMinute: + type: integer + format: int32 + description: >- + Minute of the hour when the scheduled window to run one online + archive starts. + maximum: 59 + minimum: 0 + dayOfWeek: + type: integer + format: int32 + description: >- + Day of the week when the scheduled archive starts. The week starts + with Monday (`1`) and ends with Sunday (`7`). + maximum: 7 + minimum: 1 + dayOfMonth: + type: integer + format: int32 + description: Day of the month when the scheduled archive starts. + maximum: 31 + minimum: 1 + required: + - type + title: Online Archive Schedule + Operator: + type: string + description: Comparison operator to apply when checking the current metric value. + OrgFederationSettings: + type: object + description: >- + Details that define how to connect one MongoDB Cloud organization to one + federated authentication service. + properties: + federatedDomains: + type: array + description: >- + List of domains associated with the organization's identity + provider. + items: + type: string + uniqueItems: true + hasRoleMappings: + type: boolean + description: >- + Flag that indicates whether this organization has role mappings + configured. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this federation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + identityProviderId: + type: string + description: >- + Unique 20-hexadecimal digit string that identifies the identity + provider connected to this organization. + example: c2777a9eca931f29fc2f + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + identityProviderStatus: + type: string + description: String enum that indicates whether the identity provider is active. + title: Organization Federation Settings + OrgGroup: + type: object + properties: + clusters: + type: array + description: >- + Settings that describe the clusters in each project that the API key + is authorized to view. + items: + $ref: '#/components/schemas/CloudCluster' + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + groupName: + type: string + description: Human-readable label that identifies the project. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + orgId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the + organization that contains the project. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgName: + type: string + description: >- + Human-readable label that identifies the organization that contains + the project. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + planType: + type: string + description: Human-readable label that indicates the plan type. + readOnly: true + tags: + type: array + description: >- + List of human-readable labels that categorize the specified project. + MongoDB Cloud returns an empty array. + items: + type: string + readOnly: true + readOnly: true + OrganizationInvitation: + type: object + properties: + createdAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud sent the invitation. MongoDB Cloud + represents this timestamp in ISO 8601 format in UTC. + readOnly: true + expiresAt: + type: string + format: date-time + description: >- + Date and time when the invitation from MongoDB Cloud expires. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this + organization. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + inviterUsername: + type: string + format: email + description: >- + Email address of the MongoDB Cloud user who sent the invitation to + join the organization. + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgName: + type: string + description: Human-readable label that identifies this organization. + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + roles: + type: array + description: >- + One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + teamIds: + type: array + description: >- + List of unique 24-hexadecimal digit strings that identifies each + team. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + uniqueItems: true + username: + type: string + format: email + description: >- + Email address of the MongoDB Cloud user invited to join the + organization. + required: + - orgName + OrganizationInvitationRequest: + type: object + properties: + roles: + type: array + description: >- + One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + teamIds: + type: array + description: >- + List of teams to which you want to invite the desired MongoDB Cloud + user. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + uniqueItems: true + username: + type: string + format: email + description: Email address that belongs to the desired MongoDB Cloud user. + OrganizationInvitationUpdateRequest: + type: object + properties: + roles: + type: array + description: >- + One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + teamIds: + type: array + description: >- + List of teams to which you want to invite the desired MongoDB Cloud + user. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + uniqueItems: true + OrganizationSettings: + type: object + description: Collection of settings that configures the organization. + properties: + apiAccessListRequired: + type: boolean + description: >- + Flag that indicates whether to require API operations to originate + from an IP Address added to the API access list for the specified + organization. + multiFactorAuthRequired: + type: boolean + description: >- + Flag that indicates whether to require users to set up Multi-Factor + Authentication (MFA) before accessing the specified organization. To + learn more, see: + https://www.mongodb.com/docs/atlas/security-multi-factor-authentication/. + restrictEmployeeAccess: + type: boolean + description: >- + Flag that indicates whether to block MongoDB Support from accessing + Atlas infrastructure for any deployment in the specified + organization without explicit permission. Once this setting is + turned on, you can grant MongoDB Support a 24-hour bypass access to + the Atlas deployment to resolve support issues. To learn more, see: + https://www.mongodb.com/docs/atlas/security-restrict-support-access/. + PaginatedHostView_Atlas: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link_Atlas' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/ApiHostView_Atlas' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PemFileInfo: + type: object + description: PEM file information for the identity provider's certificates. + properties: + certificates: + type: array + items: + $ref: '#/components/schemas/X509Certificate' + fileName: + type: string + PerformanceAdvisorIndex: + type: object + properties: + avgObjSize: + type: number + format: double + description: The average size of an object in the collection of this index. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this index. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + impact: + type: array + description: >- + List that contains unique 24-hexadecimal character string that + identifies the query shapes in this response that the Performance + Advisor suggests. + items: + type: string + description: >- + One unique 24-hexadecimal character string that identifies one + query shape. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + index: + type: array + description: >- + List that contains documents that specify a key in the index and its + sort order. + items: + type: object + additionalProperties: + type: integer + format: int32 + description: >- + One index key paired with its sort order. A value of `1` + indicates an ascending sort order. A value of `-1` indicates a + descending sort order. Keys in indexes with multiple keys appear + in the same order that they appear in the index. + description: >- + One index key paired with its sort order. A value of `1` indicates + an ascending sort order. A value of `-1` indicates a descending + sort order. Keys in indexes with multiple keys appear in the same + order that they appear in the index. + readOnly: true + namespace: + type: string + description: >- + Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + readOnly: true + weight: + type: number + format: double + description: >- + Estimated performance improvement that the suggested index provides. + This value corresponds to **Impact** in the Performance Advisor user + interface. + readOnly: true + PerformanceAdvisorOpStats: + type: object + description: Details that this resource returned about the specified query. + properties: + ms: + type: integer + format: int64 + description: >- + Length of time expressed during which the query finds suggested + indexes among the managed namespaces in the cluster. This parameter + expresses its value in milliseconds. This parameter relates to the + **duration** query parameter. + readOnly: true + nReturned: + type: integer + format: int64 + description: Number of results that the query returns. + readOnly: true + nScanned: + type: integer + format: int64 + description: Number of documents that the query read. + readOnly: true + ts: + type: integer + format: int64 + description: >- + Date and time from which the query retrieves the suggested indexes. + This parameter expresses its value in the number of seconds that + have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). This parameter + relates to the **since** query parameter. + readOnly: true + readOnly: true + PerformanceAdvisorResponse: + type: object + properties: + shapes: + type: array + description: >- + List of query predicates, sorts, and projections that the + Performance Advisor suggests. + items: + $ref: '#/components/schemas/PerformanceAdvisorShape' + readOnly: true + suggestedIndexes: + type: array + description: >- + List that contains the documents with information about the indexes + that the Performance Advisor suggests. + items: + $ref: '#/components/schemas/PerformanceAdvisorIndex' + readOnly: true + PerformanceAdvisorShape: + type: object + properties: + avgMs: + type: integer + format: int64 + description: >- + Average duration in milliseconds for the queries examined that match + this shape. + readOnly: true + count: + type: integer + format: int64 + description: Number of queries examined that match this shape. + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies this shape. This + string exists only for the duration of this API request. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + inefficiencyScore: + type: integer + format: int64 + description: >- + Average number of documents read for every document that the query + returns. + externalDocs: + description: Understanding the Query Inefficiency Score + url: >- + https://www.mongodb.com/docs/atlas/performance-advisor/#std-label-query-inefficiency-score + readOnly: true + namespace: + type: string + description: >- + Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + readOnly: true + operations: + type: array + description: List that contains specific about individual queries. + items: + $ref: '#/components/schemas/PerformanceAdvisorOperation' + readOnly: true + PerformanceAdvisorSlowQuery: + type: object + description: Details of one slow query that the Performance Advisor detected. + properties: + line: + type: string + description: Text of the MongoDB log related to this slow query. + readOnly: true + namespace: + type: string + description: >- + Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + readOnly: true + readOnly: true + PerformanceAdvisorSlowQueryList: + type: object + properties: + slowQueries: + type: array + description: >- + List of operations that the Performance Advisor detected that took + longer to execute than a specified threshold. + items: + $ref: '#/components/schemas/PerformanceAdvisorSlowQuery' + readOnly: true + PipelineRunStats: + type: object + description: Runtime statistics for this Data Lake Pipeline run. + properties: + bytesExported: + type: integer + format: int64 + description: Total data size in bytes exported for this pipeline run. + readOnly: true + numDocs: + type: integer + format: int64 + description: Number of docs ingested for a this pipeline run. + readOnly: true + readOnly: true + title: Data Lake Pipeline Run Statistics + PrivateLinkEndpoint: + type: object + properties: + cloudProvider: + type: string + description: Cloud service provider that serves the requested endpoint. + readOnly: true + deleteRequested: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud received a request to + remove the specified private endpoint from the private endpoint + service. + readOnly: true + errorMessage: + type: string + description: >- + Error message returned when requesting private connection resource. + The resource returns `null` if the request succeeded. + readOnly: true + connectionStatus: + type: string + description: >- + State of the Amazon Web Service PrivateLink connection when MongoDB + Cloud received this request. + readOnly: true + interfaceEndpointId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the interface + endpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + endpointGroupName: + type: string + description: Human-readable label that identifies a set of endpoints. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: >- + https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + readOnly: true + endpoints: + type: array + description: >- + List of individual private endpoints that comprise this endpoint + group. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: >- + https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + items: + $ref: '#/components/schemas/GCPConsumerForwardingRule' + readOnly: true + status: + type: string + description: >- + State of the Google Cloud network endpoint group when MongoDB Cloud + received this request. + + + Alternatively: + + State of the Azure Private Link Service connection when MongoDB + Cloud received this request. + readOnly: true + privateEndpointConnectionName: + type: string + description: >- + Human-readable label that MongoDB Cloud generates that identifies + the private endpoint connection. + pattern: >- + ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]([-\w._()]+)%2[fF]([-\w._()]+) + readOnly: true + privateEndpointIPAddress: + type: string + description: >- + IPv4 address of the private endpoint in your Azure VNet that someone + added to this private endpoint service. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + privateEndpointResourceId: + type: string + description: >- + Unique string that identifies the Azure private endpoint's network + interface that someone added to this private endpoint service. + example: >- + /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln + readOnly: true + required: + - cloudProvider + PrivateNetworkEndpointIdEntry: + type: object + properties: + comment: + type: string + description: Human-readable string to associate with this private endpoint. + endpointId: + type: string + description: >- + Unique 22-character alphanumeric string that identifies the private + endpoint. + example: vpce-3bf78b0ddee411ba1 + externalDocs: + description: >- + Atlas Data Lake supports Amazon Web Services private endpoints + using the AWS PrivateLink feature. + url: >- + https://aws.amazon.com/privatelink/?privatelink-blogs.sort-by=item.additionalFields.createdDate&privatelink-blogs.sort-order=desc + maxLength: 22 + minLength: 22 + pattern: ^vpce-[0-9a-f]{17}$ + provider: + type: string + default: AWS + description: >- + Human-readable label that identifies the cloud service provider. + Atlas Data Lake supports Amazon Web Services only. + type: + type: string + default: DATA_LAKE + description: >- + Human-readable label that identifies the resource type associated + with this private endpoint. + required: + - endpointId + PushBasedLogExportProject: + type: object + properties: + bucketName: + type: string + description: The name of the bucket to which the agent will send the logs to. + createDate: + type: string + format: date-time + description: Date and time that this feature was enabled on. + readOnly: true + iamRoleId: + type: string + description: ID of the AWS IAM role that will be used to write to the S3 bucket. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + prefixPath: + type: string + description: >- + S3 directory in which vector will write to in order to store the + logs. + state: + type: string + description: >- + Describes whether or not the feature is enabled and what status it + is in. + RawMetricUnits: + type: string + default: RAW + description: >- + Element used to express the quantity. This can be an element of time, + storage capacity, and the like. + title: Raw Metric Units + RegionSpec: + type: object + description: Physical location where MongoDB Cloud provisions cluster nodes. + properties: + analyticsNodes: + type: integer + format: int32 + description: >- + Number of analytics nodes in the region. Analytics nodes handle + analytic data such as reporting queries from MongoDB Connector for + Business Intelligence on MongoDB Cloud. Analytics nodes are + read-only, and can never become the primary. Use + **replicationSpecs[n].{region}.analyticsNodes** instead. + electableNodes: + type: integer + format: int32 + description: >- + Number of electable nodes to deploy in the specified region. + Electable nodes can become the primary and can facilitate local + reads. Use **replicationSpecs[n].{region}.electableNodes** instead. + priority: + type: integer + format: int32 + description: >- + Number that indicates the election priority of the region. To + identify the Preferred Region of the cluster, set this parameter to + `7`. The primary node runs in the **Preferred Region**. To identify + a read-only region, set this parameter to `0`. + maximum: 7 + minimum: 0 + readOnlyNodes: + type: integer + format: int32 + description: >- + Number of read-only nodes in the region. Read-only nodes can never + become the primary member, but can facilitate local reads. Use + **replicationSpecs[n].{region}.readOnlyNodes** instead. + title: Region Configuration + ReplicationSpec: + type: object + description: >- + Details that explain how MongoDB Cloud replicates data on the specified + MongoDB database. + properties: + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a Multi-Cloud Cluster. If you include existing + zones in the request, you must specify this parameter. If you add a + new zone to an existing Multi-Cloud Cluster, you may specify this + parameter. The request deletes any existing zones in the Multi-Cloud + Cluster that you exclude from the request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + numShards: + type: integer + format: int32 + description: >- + Positive integer that specifies the number of shards to deploy in + each specified zone. If you set this value to `1` and + **clusterType** is `SHARDED`, MongoDB Cloud deploys a single-shard + sharded cluster. Don't create a sharded cluster with a single shard + for production environments. Single-shard sharded clusters don't + provide the same benefits as multi-shard configurations. + minimum: 1 + regionConfigs: + type: array + description: >- + Hardware specifications for nodes set for a given region. Each + **regionConfigs** object describes the region's priority in + elections and the number and type of MongoDB nodes that MongoDB + Cloud deploys to the region. Each **regionConfigs** object must have + either an **analyticsSpecs** object, **electableSpecs** object, or + **readOnlySpecs** object. Tenant clusters only require + **electableSpecs. Dedicated** clusters can specify any of these + specifications, but must have at least one **electableSpecs** object + within a **replicationSpec**. Every hardware specification must use + the same **instanceSize**. + + + **Example:** + + + If you set + `"replicationSpecs[n].regionConfigs[m].analyticsSpecs.instanceSize" + : "M30"`, set + `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" + : `"M30"` if you have electable nodes and + `"replicationSpecs[n].regionConfigs[m].readOnlySpecs.instanceSize" : + `"M30"` if you have read-only nodes. + items: + $ref: '#/components/schemas/CloudRegionConfig' + zoneName: + type: string + description: >- + Human-readable label that identifies the zone in a Global Cluster. + Provide this value only if `"clusterType" : "GEOSHARDED"`. + title: Replication Specifications + RequestAccepted: + type: object + description: Accepted + ResourceEventTypeViewForOrg: + type: string + description: Unique identifier of event type. + example: GROUP_TAGS_MODIFIED + title: Resource Event Types + ResourceTag: + type: object + description: >- + Key-value pair that tags and categorizes a MongoDB Cloud organization, + project, or cluster. For example, `environment : production`. + properties: + key: + type: string + description: >- + Constant that defines the set of the tag. For example, `environment` + in the `environment : production` tag. + maxLength: 255 + minLength: 1 + value: + type: string + description: >- + Variable that belongs to the set of the tag. For example, + `production` in the `environment : production` tag. + maxLength: 255 + minLength: 1 + title: Resource Tag + RestoreJobFileHash: + type: object + description: >- + Key and value pair that map one restore file to one hashed checksum. + This parameter applies after you download the corresponding + **delivery.url**. + properties: + fileName: + type: string + description: Human-readable label that identifies the hashed file. + readOnly: true + hash: + type: string + description: Hashed checksum that maps to the restore file. + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + typeName: + type: string + description: >- + Human-readable label that identifies the hashing algorithm used to + compute the hash value. + readOnly: true + readOnly: true + RoleAssignment: + type: object + properties: + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project to + which this role belongs. You can set a value for this parameter or + **orgId** but not both in the same request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + orgId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + to which this role belongs. You can set a value for this parameter + or **groupId** but not both in the same request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + role: + type: string + description: >+ + Human-readable label that identifies the collection of privileges + that MongoDB Cloud grants a specific API key, MongoDB Cloud user, or + MongoDB Cloud team. These roles include organization- and + project-level roles. + + + Organization Roles + + + * ORG_OWNER + + * ORG_MEMBER + + * ORG_GROUP_CREATOR + + * ORG_BILLING_ADMIN + + * ORG_READ_ONLY + + + Project Roles + + + * GROUP_CLUSTER_MANAGER + + * GROUP_DATA_ACCESS_ADMIN + + * GROUP_DATA_ACCESS_READ_ONLY + + * GROUP_DATA_ACCESS_READ_WRITE + + * GROUP_OWNER + + * GROUP_READ_ONLY + + * GROUP_SEARCH_INDEX_EDITOR + + SamlIdentityProviderUpdate: + type: object + properties: + associatedDomains: + type: array + description: >- + List that contains the domains associated with the identity + provider. + items: + type: string + uniqueItems: true + description: + type: string + description: The description for the identity provider. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + maxLength: 50 + minLength: 1 + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion. + example: urn:idp:default + pemFileInfo: + $ref: '#/components/schemas/PemFileInfo' + protocol: + type: string + description: The protocol for the identity provider. + requestBinding: + type: string + description: >- + SAML Authentication Request Protocol HTTP method binding (POST or + REDIRECT) that Federated Authentication uses to send the + authentication request. + responseSignatureAlgorithm: + type: string + description: >- + Signature algorithm that Federated Authentication uses to encrypt + the identity provider signature. + ssoDebugEnabled: + type: boolean + description: >- + Flag that indicates whether the identity provider has SSO debug + enabled. + ssoUrl: + type: string + description: >- + Unique string that identifies the intended audience of the SAML + assertion. + example: https://example.com + status: + type: string + description: String enum that indicates whether the identity provider is active. + required: + - ssoDebugEnabled + SampleDatasetStatus: + type: object + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal character string that identifies this sample + dataset. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: >- + Human-readable label that identifies the cluster into which you + loaded the sample dataset. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + completeDate: + type: string + format: date-time + description: >- + Date and time when the sample dataset load job completed. MongoDB + Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + createDate: + type: string + format: date-time + description: >- + Date and time when you started the sample dataset load job. MongoDB + Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + errorMessage: + type: string + description: >- + Details of the error returned when MongoDB Cloud loads the sample + dataset. This endpoint returns null if state has a value other than + FAILED. + readOnly: true + state: + type: string + description: Status of the sample dataset load job. + readOnly: true + SearchSynonymMappingDefinition: + type: object + description: Synonyms used for this full text index. + properties: + analyzer: + type: string + default: lucene.standard + description: >- + Specific pre-defined method chosen to apply to the synonyms to be + searched. + name: + type: string + description: >- + Human-readable label that identifies the synonym definition. Each + **synonym.name** must be unique within the same index definition. + source: + $ref: '#/components/schemas/SynonymSource' + required: + - analyzer + - name + - source + title: Synonym Mapping Definition + ServerlessBackupRestoreJob: + type: object + properties: + cancelled: + type: boolean + description: Flag that indicates whether someone canceled this restore job. + readOnly: true + deliveryType: + type: string + description: Human-readable label that categorizes the restore job to create. + deliveryUrl: + type: array + description: >- + One or more Uniform Resource Locators (URLs) that point to the + compressed snapshot files for manual download. MongoDB Cloud returns + this parameter when `"deliveryType" : "download"`. + items: + type: string + description: >- + One Uniform Resource Locator that point to the compressed snapshot + files for manual download. + readOnly: true + desiredTimestamp: + $ref: '#/components/schemas/ApiBSONTimestamp' + expired: + type: boolean + description: Flag that indicates whether the restore job expired. + readOnly: true + expiresAt: + type: string + format: date-time + description: >- + Date and time when the restore job expires. This parameter expresses + its value in the ISO 8601 timestamp format in UTC. + readOnly: true + failed: + type: boolean + description: Flag that indicates whether the restore job failed. + readOnly: true + finishedAt: + type: string + format: date-time + description: >- + Date and time when the restore job completed. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the restore + job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + oplogInc: + type: integer + format: int32 + description: >- + Oplog operation number from which you want to restore this snapshot. + This number represents the second part of an Oplog timestamp. The + resource returns this parameter when `"deliveryType" : + "pointInTime"` and **oplogTs** exceeds `0`. + example: 1 + minimum: 1 + oplogTs: + type: integer + format: int32 + description: >- + Date and time from which you want to restore this snapshot. This + parameter expresses this timestamp in the number of seconds that + have elapsed since the UNIX epoch. This number represents the first + part of an Oplog timestamp. The resource returns this parameter when + `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`. + minimum: 1199145600 + pointInTimeUTCSeconds: + type: integer + format: int32 + description: >- + Date and time from which MongoDB Cloud restored this snapshot. This + parameter expresses this timestamp in the number of seconds that + have elapsed since the UNIX epoch. The resource returns this + parameter when `"deliveryType" : "pointInTime"` and + **pointInTimeUTCSeconds** exceeds `0`. + minimum: 1199145600 + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + targetClusterName: + type: string + description: >- + Human-readable label that identifies the target cluster to which the + restore job restores the snapshot. The resource returns this + parameter when `"deliveryType":` `"automated"`. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + targetGroupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the target + project for the specified **targetClusterName**. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + timestamp: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud took the snapshot associated with + **snapshotId**. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + required: + - deliveryType + - targetClusterName + - targetGroupId + ServerlessBackupSnapshot: + type: object + properties: + createdAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud took the snapshot. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + expiresAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud deletes the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + frequencyType: + type: string + description: >- + Human-readable label that identifies how often this snapshot + triggers. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + mongodVersion: + type: string + description: Version of the MongoDB host that this snapshot backs up. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + serverlessInstanceName: + type: string + description: >- + Human-readable label given to the serverless instance from which + MongoDB Cloud took this snapshot. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + snapshotType: + type: string + description: Human-readable label that identifies when this snapshot triggers. + readOnly: true + status: + type: string + description: >- + Human-readable label that indicates the stage of the backup process + for this snapshot. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number of bytes taken to store the backup snapshot. + readOnly: true + ServerlessConnectionStringsPrivateEndpointItem: + type: object + description: Details of a private endpoint deployed for this serverless instance. + properties: + endpointId: + type: string + description: >- + Unique string that the cloud provider uses to identify the private + endpoint. + readOnly: true + providerName: + type: string + description: Cloud provider where the private endpoint is deployed. + readOnly: true + region: + type: string + description: Region where the private endpoint is deployed. + readOnly: true + title: Serverless Instance Private Endpoint Connection Strings Endpoint + ServerlessConnectionStringsPrivateEndpointList: + type: object + description: >- + Private endpoint connection string that you can use to connect to this + serverless instance through a private endpoint. + externalDocs: + description: Private Endpoint for Serverless Instance + url: https://docs.atlas.mongodb.com/security-serverless-private-endpoint/ + properties: + endpoints: + type: array + description: >- + List that contains the private endpoints through which you connect + to MongoDB Cloud when you use + **connectionStrings.privateEndpoint[n].srvConnectionString**. + items: + $ref: >- + #/components/schemas/ServerlessConnectionStringsPrivateEndpointItem + readOnly: true + srvConnectionString: + type: string + description: >- + Private endpoint-aware connection string that uses the + `mongodb+srv://` protocol to connect to MongoDB Cloud through a + private endpoint. The `mongodb+srv` protocol tells the driver to + look up the seed list of hosts in the Domain Name System (DNS). + readOnly: true + type: + type: string + description: MongoDB process type to which your application connects. + readOnly: true + title: Serverless Instance Private Endpoint Connection String + ServerlessEventTypeViewAlertable: + type: string + description: Event type that triggers an alert. + example: OUTSIDE_SERVERLESS_METRIC_THRESHOLD + title: Serverless Event Types + ServerlessInstanceDescription: + type: object + description: Group of settings that configure a MongoDB serverless instance. + properties: + connectionStrings: + $ref: '#/components/schemas/ServerlessInstanceDescriptionConnectionStrings' + createDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this serverless instance. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the serverless + instance. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + mongoDBVersion: + type: string + description: Version of MongoDB that the serverless instance runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + name: + type: string + description: Human-readable label that identifies the serverless instance. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + providerSettings: + $ref: '#/components/schemas/ServerlessProviderSettings' + serverlessBackupOptions: + $ref: '#/components/schemas/ClusterServerlessBackupOptions' + stateName: + type: string + description: >- + Human-readable label that indicates the current operating condition + of the serverless instance. + readOnly: true + tags: + type: array + description: >- + List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the serverless instance. + items: + $ref: '#/components/schemas/ResourceTag' + terminationProtectionEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether termination protection is enabled on the + serverless instance. If set to `true`, MongoDB Cloud won't delete + the serverless instance. If set to `false`, MongoDB Cloud will + delete the serverless instance. + required: + - providerSettings + title: Serverless Instance Description + ServerlessInstanceDescriptionConnectionStrings: + type: object + description: >- + Collection of Uniform Resource Locators that point to the MongoDB + database. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + properties: + privateEndpoint: + type: array + description: >- + List of private endpoint-aware connection strings that you can use + to connect to this serverless instance through a private endpoint. + This parameter returns only if you created a private endpoint for + this serverless instance and it is AVAILABLE. + items: + $ref: >- + #/components/schemas/ServerlessConnectionStringsPrivateEndpointList + readOnly: true + standardSrv: + type: string + description: >- + Public connection string that you can use to connect to this + serverless instance. This connection string uses the + `mongodb+srv://` protocol. + externalDocs: + description: Connection String URI Format + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + readOnly: true + title: Serverless Instance Connection Strings + ServerlessInstanceDescriptionCreate: + type: object + description: Settings that you can specify when you create a serverless instance. + properties: + name: + type: string + description: Human-readable label that identifies the serverless instance. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + writeOnly: true + providerSettings: + $ref: '#/components/schemas/ServerlessProviderSettings' + serverlessBackupOptions: + $ref: '#/components/schemas/ClusterServerlessBackupOptions' + stateName: + type: string + description: >- + Human-readable label that indicates the current operating condition + of the serverless instance. + readOnly: true + tags: + type: array + description: >- + List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the serverless instance. + items: + $ref: '#/components/schemas/ResourceTag' + terminationProtectionEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether termination protection is enabled on the + serverless instance. If set to `true`, MongoDB Cloud won't delete + the serverless instance. If set to `false`, MongoDB Cloud will + delete the serverless instance. + required: + - name + - providerSettings + title: Serverless Instance Description Create + ServerlessInstanceDescriptionUpdate: + type: object + description: >- + Settings that you can update when you request a serverless cluster + update. + properties: + serverlessBackupOptions: + $ref: '#/components/schemas/ClusterServerlessBackupOptions' + tags: + type: array + description: >- + List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the serverless instance. + items: + $ref: '#/components/schemas/ResourceTag' + terminationProtectionEnabled: + type: boolean + default: false + description: >- + Flag that indicates whether termination protection is enabled on the + serverless instance. If set to `true`, MongoDB Cloud won't delete + the serverless instance. If set to `false`, MongoDB Cloud will + delete the serverless instance. + title: Serverless Instance Description Update + ServerlessMetricThreshold: + type: object + description: >- + Threshold for the metric that, when exceeded, triggers an alert. The + metric threshold pertains to event types which reflects changes of + measurements and metrics about the serverless database. + properties: + metricName: + type: string + description: >- + Human-readable label that identifies the metric against which + MongoDB Cloud checks the configured **metricThreshold.threshold**. + mode: + type: string + description: MongoDB Cloud computes the current metric value as an average. + operator: + $ref: '#/components/schemas/Operator' + threshold: + type: number + format: double + description: Value of metric that, when exceeded, triggers an alert. + units: + $ref: '#/components/schemas/ServerlessMetricUnits' + required: + - metricName + title: Serverless Metric Threshold + ServerlessMetricUnits: + type: string + description: >- + Element used to express the quantity. This can be an element of time, + storage capacity, and the like. + example: RPU + title: Serverless Metric Units + ServerlessProviderSettings: + type: object + description: >- + Group of cloud provider settings that configure the provisioned MongoDB + serverless instance. + properties: + backingProviderName: + type: string + description: >- + Cloud service provider on which MongoDB Cloud provisioned the + serverless instance. + providerName: + type: string + default: SERVERLESS + description: Human-readable label that identifies the cloud service provider. + regionName: + type: string + description: >- + Human-readable label that identifies the geographic location of your + MongoDB serverless instance. The region you choose can affect + network latency for clients accessing your databases. For a complete + list of region names, see + [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), + [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and + [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). + required: + - backingProviderName + - regionName + title: Cloud Service Provider Settings for a Serverless Instance + ServerlessTenantCreateRequest: + type: object + properties: + comment: + type: string + description: Human-readable comment associated with the private endpoint. + maxLength: 80 + writeOnly: true + ServerlessTenantEndpoint: + type: object + properties: + _id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the private + endpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + cloudProviderEndpointId: + type: string + description: >- + Unique string that identifies the private endpoint's network + interface. + + + Alternatively: + + Unique string that identifies the Azure private endpoint's network + interface that someone added to this private endpoint service. + pattern: >- + ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + readOnly: true + comment: + type: string + description: Human-readable comment associated with the private endpoint. + maxLength: 80 + readOnly: true + endpointServiceName: + type: string + description: >- + Unique string that identifies the PrivateLink endpoint service. + MongoDB Cloud returns null while it creates the endpoint service. + + + Alternatively: + + Unique string that identifies the Amazon Web Services (AWS) + PrivateLink endpoint service. MongoDB Cloud returns null while it + creates the endpoint service. + + + Alternatively: + + Unique string that identifies the Azure private endpoint service. + MongoDB Cloud returns null while it creates the endpoint service. + pattern: ^pls_[0-9a-f]{24}$ + readOnly: true + errorMessage: + type: string + description: >- + Human-readable error message that indicates error condition + associated with establishing the private endpoint connection. + readOnly: true + status: + type: string + description: >- + Human-readable label that indicates the current operating status of + the private endpoint. + readOnly: true + providerName: + type: string + description: Human-readable label that identifies the cloud service provider. + readOnly: true + privateEndpointIpAddress: + type: string + description: >- + IPv4 address of the private endpoint in your Azure VNet that someone + added to this private endpoint service. + maxLength: 24 + minLength: 24 + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + privateLinkServiceResourceId: + type: string + description: >- + Root-relative path that identifies the Azure Private Link Service + that MongoDB Cloud manages. MongoDB Cloud returns null while it + creates the endpoint service. + readOnly: true + ServerlessTenantEndpointUpdate: + type: object + description: Update view for a serverless tenant endpoint. + properties: + comment: + type: string + description: Human-readable comment associated with the private endpoint. + maxLength: 80 + writeOnly: true + providerName: + type: string + description: >- + Human-readable label that identifies the cloud provider of the + tenant endpoint. + writeOnly: true + cloudProviderEndpointId: + type: string + description: >- + Unique string that identifies the private endpoint's network + interface. + + + Alternatively: + + Unique string that identifies the Azure private endpoint's network + interface for this private endpoint service. + pattern: >- + ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + writeOnly: true + privateEndpointIpAddress: + type: string + description: >- + IPv4 address of the private endpoint in your Azure VNet that someone + added to this private endpoint service. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + writeOnly: true + required: + - providerName + Source: + type: object + description: Document that describes the source of the migration. + properties: + caCertificatePath: + type: string + description: >- + Path to the CA certificate that signed SSL certificates use to + authenticate to the source cluster. + clusterName: + type: string + description: Label that identifies the source cluster name. + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the source + project. + example: 9b43a5b329223c3a1591a678 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + managedAuthentication: + type: boolean + description: >- + Flag that indicates whether MongoDB Automation manages + authentication to the source cluster. If true, do not provide values + for username and password. + password: + type: string + description: Password that authenticates the username to the source cluster. + writeOnly: true + ssl: + type: boolean + description: Flag that indicates whether you have SSL enabled. + username: + type: string + description: >- + Label that identifies the SCRAM-SHA user that connects to the source + cluster. + writeOnly: true + required: + - clusterName + - groupId + - managedAuthentication + - ssl + StreamsConnection: + type: object + description: Settings that define a connection to an external data store. + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + name: + type: string + description: Human-readable label that identifies the stream connection. + type: + type: string + description: Type of the connection. Can be either Cluster or Kafka. + clusterName: + type: string + description: Name of the cluster configured for this connection. + authentication: + $ref: '#/components/schemas/StreamsKafkaAuthentication' + bootstrapServers: + type: string + description: Comma separated list of server addresses. + config: + type: object + additionalProperties: + type: string + description: >- + A map of Kafka key-value pairs for optional configuration. This is + a flat object, and keys can have '.' characters. + example: '{"group.protocol.type":"consumer","debug":"queue, msg, protocol"}' + description: >- + A map of Kafka key-value pairs for optional configuration. This is a + flat object, and keys can have '.' characters. + example: + debug: queue, msg, protocol + group.protocol.type: consumer + security: + $ref: '#/components/schemas/StreamsKafkaSecurity' + readOnly: true + StreamsDataProcessRegion: + type: object + properties: + cloudProvider: + type: string + description: >- + Label that identifies the cloud service provider where MongoDB Cloud + performs stream processing. Currently, this parameter supports AWS + only. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + region: + $ref: '#/components/schemas/BaseStreamsRegion' + required: + - cloudProvider + - region + StreamsKafkaAuthentication: + type: object + description: >- + User credentials required to connect to a Kafka Cluster. Includes the + authentication type, as well as the parameters for that authentication + mode. + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + mechanism: + type: string + description: >- + Style of authentication. Can be one of PLAIN, SCRAM-256, or + SCRAM-512. + password: + type: string + format: password + description: Password of the account to connect to the Kafka cluster. + writeOnly: true + username: + type: string + description: Username of the account to connect to the Kafka cluster. + StreamsKafkaSecurity: + type: object + description: >- + Properties for the secure transport connection to Kafka. For SSL, this + can include the trusted certificate to use. + properties: + brokerPublicCertificate: + type: string + description: A trusted, public x509 certificate for connecting to Kafka over SSL. + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + protocol: + type: string + description: Describes the transport type. Can be either PLAINTEXT or SSL. + StreamsTenant: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + connections: + type: array + description: List of connections configured in the stream instance. + items: + $ref: '#/components/schemas/StreamsConnection' + readOnly: true + dataProcessRegion: + $ref: '#/components/schemas/StreamsDataProcessRegion' + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostnames: + type: array + description: List that contains the hostnames assigned to the stream instance. + items: + type: string + description: Unique hostname assigned to the stream instance. + readOnly: true + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + name: + type: string + description: Human-readable label that identifies the stream instance. + SynonymSource: + type: object + description: >- + Data set that stores the mapping one or more words map to one or more + synonyms of those words. + properties: + collection: + type: string + description: >- + Human-readable label that identifies the MongoDB collection that + stores words and their applicable synonyms. + required: + - collection + SystemStatus: + type: object + properties: + apiKey: + $ref: '#/components/schemas/ApiKey' + appName: + type: string + description: >- + Human-readable label that identifies the service from which you + requested this response. + readOnly: true + build: + type: string + description: >- + Unique 40-hexadecimal digit hash that identifies the latest git + commit merged for this application. + example: 83be55e140f493c88e7f578aae96548dd881587b + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + throttling: + type: boolean + description: >- + Flag that indicates whether someone enabled throttling on this + service. + readOnly: true + required: + - apiKey + - appName + - build + - throttling + TargetOrg: + type: object + properties: + linkToken: + type: string + description: >- + Link token that contains all the information required to complete + the link. + required: + - linkToken + TargetOrgRequest: + type: object + properties: + accessListIps: + type: array + description: IP address access list entries associated with the API key. + items: + type: string + description: One IP address access list entry associated with the API key. + Team: + type: object + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + name: + type: string + description: Human-readable label that identifies the team. + usernames: + type: array + description: List that contains the MongoDB Cloud users in this team. + items: + type: string + format: email + description: >- + List that contains email addresses that identify MongoDB Cloud + users to in this team. + uniqueItems: true + required: + - name + TeamResponse: + type: object + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + name: + type: string + description: Human-readable label that identifies the team. + TeamRole: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + roleNames: + type: array + description: >- + One or more organization- or project-level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + teamId: + type: string + description: Unique 24-hexadecimal character string that identifies the team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + TenantRestore: + type: object + properties: + clusterName: + type: string + description: Human-readable label that identifies the source cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + deliveryType: + type: string + description: >- + Means by which this resource returns the snapshot to the requesting + MongoDB Cloud user. + readOnly: true + expirationDate: + type: string + format: date-time + description: >- + Date and time when the download link no longer works. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the restore job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + projectId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project from + which the restore job originated. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + restoreFinishedDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud completed writing this snapshot. + MongoDB Cloud changes the status of the restore job to `CLOSED`. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + restoreScheduledDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud will restore this snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + snapshotFinishedDate: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud completed writing this snapshot. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + snapshotId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the snapshot to + restore. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + snapshotUrl: + type: string + description: >- + Internet address from which you can download the compressed snapshot + files. The resource returns this parameter when `"deliveryType" : + "DOWNLOAD"`. + readOnly: true + status: + type: string + description: >- + Phase of the restore workflow for this job at the time this resource + made this request. + readOnly: true + targetDeploymentItemName: + type: string + description: >- + Human-readable label that identifies the cluster on the target + project to which you want to restore the snapshot. You can restore + the snapshot to a cluster tier *M2* or greater. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + targetProjectId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + contains the cluster to which you want to restore the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + required: + - snapshotId + - targetDeploymentItemName + ThridPartyIntegration: + type: object + description: Collection of settings that describe third-party integrations. + properties: + type: + type: string + description: >- + Integration type + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want + to integrate with MongoDB Cloud. The value must match the + third-party service integration type. + apiKey: + type: string + description: >- + Key that allows MongoDB Cloud to access your Datadog account. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + + + Alternatively: + + Key that allows MongoDB Cloud to access your Opsgenie account. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + + + Alternatively: + + Key that allows MongoDB Cloud to access your VictorOps account. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + example: '********************************9abc' + region: + type: string + description: >- + Two-letter code that indicates which regional URL MongoDB uses to + access the Datadog API. + + + To learn more about Datadog's regions, see Datadog Sites. + + + Alternatively: + + Two-letter code that indicates which regional URL MongoDB uses to + access the Opsgenie API. + + + Alternatively: + + PagerDuty region that indicates the API Uniform Resource Locator + (URL) to use. + microsoftTeamsWebhookUrl: + type: string + description: >- + Endpoint web address of the Microsoft Teams webhook to which MongoDB + Cloud sends notifications. + + + **NOTE**: When you view or edit the alert for a Microsoft Teams + notification, the URL appears partially redacted. + example: https://webhook.com/**** + accountId: + type: string + description: >- + Unique 40-hexadecimal digit string that identifies your New Relic + account. + example: bcc3c81b344a6030a3935c2527e2216535af7718 + maxLength: 40 + minLength: 40 + pattern: ^([0-9a-f]){40}$ + licenseKey: + type: string + description: >- + Unique 40-hexadecimal digit string that identifies your New Relic + license. + + + **IMPORTANT**: Effective Wednesday, June 16th, 2021, New Relic no + longer supports the plugin-based integration with MongoDB. We do not + recommend that you sign up for the plugin-based integration. + + To learn more, see the New Relic Plugin EOL Statement Consider + configuring an alternative monitoring integration before June 16th + to maintain visibility into your MongoDB deployments. + example: bc3768f44193c282b2688ab39e00f8e4fc8d75ea + maxLength: 40 + minLength: 40 + pattern: ^([0-9a-f]){40}$ + readToken: + type: string + description: Query key used to access your New Relic account. + example: 193c96aee4a3ac640b98634562e2631f17ae0a69 + writeToken: + type: string + description: Insert key associated with your New Relic account. + example: a67b10e5cd7f8fb6a34b501136c409f373edc218 + serviceKey: + type: string + description: >- + Service key associated with your PagerDuty account. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + example: '****************************7890' + enabled: + type: boolean + description: >- + Flag that indicates whether someone has activated the Prometheus + integration. + listenAddress: + type: string + default: ':9216' + description: >- + Combination of IPv4 address and Internet Assigned Numbers Authority + (IANA) port or the IANA port alone to which Prometheus binds to + ingest MongoDB metrics. + password: + type: string + writeOnly: true + rateLimitInterval: + type: integer + format: int32 + writeOnly: true + scheme: + type: string + description: >- + Security Scheme to apply to HyperText Transfer Protocol (HTTP) + traffic between Prometheus and MongoDB Cloud. + serviceDiscovery: + type: string + description: Desired method to discover the Prometheus service. + tlsPemPath: + type: string + description: >- + Root-relative path to the Transport Layer Security (TLS) Privacy + Enhanced Mail (PEM) key and certificate file on the host. + example: /path/to/file + username: + type: string + description: >- + Human-readable label that identifies your Prometheus incoming + webhook. + example: prom_user_618d48e05277a606ed2496fe + apiToken: + type: string + description: >- + Key that allows MongoDB Cloud to access your Slack account. + + + **NOTE**: After you create a notification which requires an API or + integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas + Administration API. + + + **IMPORTANT**: Slack integrations now use the OAuth2 verification + method and must be initially configured, or updated from a legacy + integration, through the Atlas third-party service integrations + page. Legacy tokens will soon no longer be supported. + example: >- + **********************************************************************abcd + channelName: + type: string + description: >- + Name of the Slack channel to which MongoDB Cloud sends alert + notifications. + example: alerts + maxLength: 80 + minLength: 1 + teamName: + type: string + description: >- + Human-readable label that identifies your Slack team. Set this + parameter when you configure a legacy Slack integration. + example: MongoDB + routingKey: + type: string + description: Routing key associated with your Splunk On-Call account. + example: test routing + secret: + type: string + description: >- + An optional field returned if your webhook is configured with a + secret. + + + **NOTE**: When you view or edit the alert for a webhook + notification, the secret appears completely redacted. + example: '******' + url: + type: string + description: >- + Endpoint web address to which MongoDB Cloud sends notifications. + + + **NOTE**: When you view or edit the alert for a webhook + notification, the URL appears partially redacted. + example: https://webhook.com/**** + title: Third-Party Integration + TriggerIngestionPipelineRequest: + type: object + properties: + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + required: + - snapshotId + UpdateAtlasOrganizationApiKey: + type: object + properties: + desc: + type: string + description: >- + Purpose or explanation provided when someone creates this + organization API key. + maxLength: 250 + minLength: 1 + roles: + type: array + description: >- + List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + organization. + items: + type: string + UpdateAtlasProjectApiKey: + type: object + properties: + desc: + type: string + description: >- + Purpose or explanation provided when someone creates this project + API key. + maxLength: 250 + minLength: 1 + roles: + type: array + description: >- + List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + project. + items: + type: string + UpdateCustomDBRole: + type: object + properties: + actions: + type: array + description: List of the individual privilege actions that the role grants. + items: + $ref: '#/components/schemas/DatabasePrivilegeAction' + inheritedRoles: + type: array + description: List of the built-in roles that this custom role inherits. + items: + $ref: '#/components/schemas/DatabaseInheritedRole' + uniqueItems: true + UpdateGroupRolesForUser: + type: object + properties: + groupRoles: + type: array + description: One or more project level roles to assign to the MongoDB Cloud user. + items: + type: string + uniqueItems: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + UpdateOrgRolesForUser: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + orgRoles: + type: array + description: >- + One or more organization level roles to assign to the MongoDB Cloud + user. + items: + type: string + uniqueItems: true + UserAccessList: + type: object + properties: + cidrBlock: + type: string + description: >- + Range of network addresses that you want to add to the access list + for the API key. This parameter requires the range to be expressed + in classless inter-domain routing (CIDR) notation of Internet + Protocol version 4 or version 6 addresses. You can set a value for + this parameter or **ipAddress** but not both in the same request. + example: 203.0.113.0/24 + pattern: >- + ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + count: + type: integer + format: int32 + description: >- + Total number of requests that have originated from the Internet + Protocol (IP) address given as the value of the *lastUsedAddress* + parameter. + minimum: 1 + readOnly: true + created: + type: string + format: date-time + description: >- + Date and time when someone added the network addresses to the + specified API access list. This parameter expresses its value in the + ISO 8601 timestamp format in UTC. + readOnly: true + ipAddress: + type: string + description: >- + Network address that you want to add to the access list for the API + key. This parameter requires the address to be expressed as one + Internet Protocol version 4 or version 6 address. You can set a + value for this parameter or **cidrBlock** but not both in the same + request. + example: 203.0.113.10 + pattern: >- + ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ + lastUsed: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud received the most recent request + that originated from this Internet Protocol version 4 or version 6 + address. The resource returns this parameter when at least one + request has originated from this IP address. MongoDB Cloud updates + this parameter each time a client accesses the permitted resource. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + lastUsedAddress: + type: string + description: >- + Network address that issued the most recent request to the API. This + parameter requires the address to be expressed as one Internet + Protocol version 4 or version 6 address. The resource returns this + parameter after this IP address made at least one request. + example: 203.0.113.10 + pattern: >- + ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + UserAccessRoleAssignment: + type: object + properties: + apiUserId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + API key. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + roles: + type: array + description: >- + List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + project. + items: + type: string + UserCert: + type: object + properties: + _id: + type: integer + format: int64 + description: >- + Unique 24-hexadecimal character string that identifies this + certificate. + readOnly: true + createdAt: + type: string + format: date-time + description: >- + Date and time when MongoDB Cloud created this certificate. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + monthsUntilExpiration: + type: integer + format: int32 + default: 3 + description: >- + Number of months that the certificate remains valid until it + expires. + maximum: 24 + writeOnly: true + notAfter: + type: string + format: date-time + description: >- + Date and time when this certificate expires. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + subject: + type: string + description: >- + Subject Alternative Name associated with this certificate. This + parameter expresses its value as a distinguished name as defined in + [RFC 2253](https://tools.ietf.org/html/2253). + example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + pattern: >- + ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + readOnly: true + UserCustomDBRole: + type: object + properties: + actions: + type: array + description: List of the individual privilege actions that the role grants. + items: + $ref: '#/components/schemas/DatabasePrivilegeAction' + inheritedRoles: + type: array + description: List of the built-in roles that this custom role inherits. + items: + $ref: '#/components/schemas/DatabaseInheritedRole' + uniqueItems: true + roleName: + type: string + description: >- + Human-readable label that identifies the role for the request. This + name must be unique for this custom role in this project. + pattern: >- + ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- + Human-readable label that identifies the cluster or MongoDB Atlas + Data Lake that this database user can access. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + type: + type: string + description: Category of resource that this database user can access. + required: + - name + - type + title: Database User Scope + UserSecurity: + type: object + properties: + customerX509: + $ref: '#/components/schemas/DBUserTLSX509Settings' + ldap: + $ref: '#/components/schemas/LDAPSecuritySettings' + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + UserToDNMapping: + type: object + description: >- + User-to-Distinguished Name (DN) map that MongoDB Cloud uses to transform + a Lightweight Directory Access Protocol (LDAP) username into an LDAP DN. + properties: + ldapQuery: + type: string + description: >- + Lightweight Directory Access Protocol (LDAP) query template that + inserts the LDAP name that the regular expression matches into an + LDAP query Uniform Resource Identifier (URI). The formatting for the + query must conform to [RFC + 4515](https://datatracker.ietf.org/doc/html/rfc4515) and [RFC + 4516](https://datatracker.ietf.org/doc/html/rfc4516). + match: + type: string + description: >- + Regular expression that MongoDB Cloud uses to match against the + provided Lightweight Directory Access Protocol (LDAP) username. Each + parenthesis-enclosed section represents a regular expression capture + group that the substitution or `ldapQuery` template uses. + example: (.*) + substitution: + type: string + description: >- + Lightweight Directory Access Protocol (LDAP) Distinguished Name (DN) + template that converts the LDAP username that matches regular + expression in the *match* parameter into an LDAP Distinguished Name + (DN). + example: CN={0},CN=Users,DC=my-atlas-ldap-server,DC=example,DC=com + required: + - match + title: User to Distinguished Name Mapping + X509Certificate: + type: object + properties: + content: + type: string + notAfter: + type: string + format: date-time + notBefore: + type: string + format: date-time + raw: + type: object + description: >- + Additional meta information captured about this event. The response + returns this parameter as a JSON object when the query parameter + `includeRaw=true`. The list of fields in the raw document may change. + Don't rely on raw values for formal monitoring. + properties: + _t: + type: string + description: Unique identifier of event type. + example: ALERT_AUDIT + alertConfigId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the alert + configuration related to the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + cid: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project in + which the event occurred. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + cre: + type: string + format: date-time + description: >- + Date and time when this event occurred. This parameter expresses its + value in the ISO 8601 timestamp + format in UTC. + readOnly: true + description: + type: string + description: Description of the event. + example: Alert Acknowledged + gn: + type: string + description: Human-readable label that identifies the project. + example: Test Project + maxLength: 64 + minLength: 1 + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the organization + to which these events apply. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgName: + type: string + description: >- + Human-readable label that identifies the organization that contains + the project. + example: Test Organization + maxLength: 64 + minLength: 1 + severity: + type: string + readOnly: true + AWSCustomDNSEnabled: + type: object + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether the project's clusters deployed to + Amazon Web Services (AWS) use a custom Domain Name System (DNS). + + When `"enabled": true`, connect to your cluster using Private IP for + Peering connection strings. + externalDocs: + description: >- + To learn more, see FAQ: Connection String Options in the MongoDB + Atlas documentation. + url: >- + https://www.mongodb.com/docs/atlas/reference/faq/connection-changes/#how-does-this-affect-aws-vpc-peering-when-i-use-custom-dns- + required: + - enabled + AccessListItem: + type: object + properties: + cidrBlock: + type: string + description: >- + Range of IP addresses in Classless Inter-Domain Routing (CIDR) + notation that found in this project's access list. + pattern: >- + ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + readOnly: true + ipAddress: + type: string + description: IP address included in the API access list. + pattern: >- + ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + required: + - ipAddress + ApiAtlasCheckpoint: + type: object + properties: + clusterId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the cluster that + contains the checkpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + completed: + type: string + format: date-time + description: >- + Date and time when the checkpoint completed and the balancer + restarted. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + owns the checkpoints. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies checkpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + parts: + type: array + description: >- + Metadata that describes the complete snapshot. + + + - For a replica set, this array contains a single document. + + - For a sharded cluster, this array contains one document for each + shard plus one document for the config host. + items: + $ref: '#/components/schemas/ApiCheckpointPart' + readOnly: true + restorable: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud can use the checkpoint for + a restore. + readOnly: true + started: + type: string + format: date-time + description: >- + Date and time when the balancer stopped and began the checkpoint. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + timestamp: + type: string + format: date-time + description: >- + Date and time to which the checkpoint restores. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + ApiAtlasSnapshotSchedule: + type: object + properties: + clusterCheckpointIntervalMin: + type: integer + format: int32 + description: >- + Quantity of time expressed in minutes between successive cluster + checkpoints. This parameter applies only to sharded clusters. This + number determines the granularity of continuous cloud backups for + sharded clusters. + clusterId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the cluster with + the snapshot you want to return. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + dailySnapshotRetentionDays: + type: integer + format: int32 + description: >- + Quantity of time to keep daily snapshots. MongoDB Cloud expresses + this value in days. Set this value to `0` to disable daily snapshot + retention. + groupId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the project that + contains the cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + monthlySnapshotRetentionMonths: + type: integer + format: int32 + description: >- + Number of months that MongoDB Cloud must keep monthly snapshots. Set + this value to `0` to disable monthly snapshot retention. + pointInTimeWindowHours: + type: integer + format: int32 + description: >- + Number of hours before the current time from which MongoDB Cloud can + create a Continuous Cloud Backup snapshot. + snapshotIntervalHours: + type: integer + format: int32 + description: Number of hours that must elapse before taking another snapshot. + snapshotRetentionDays: + type: integer + format: int32 + description: Number of days that MongoDB Cloud must keep recent snapshots. + weeklySnapshotRetentionWeeks: + type: integer + format: int32 + description: >- + Number of weeks that MongoDB Cloud must keep weekly snapshots. Set + this value to `0` to disable weekly snapshot retention. + required: + - clusterCheckpointIntervalMin + - clusterId + - dailySnapshotRetentionDays + - groupId + - monthlySnapshotRetentionMonths + - pointInTimeWindowHours + - snapshotIntervalHours + - snapshotRetentionDays + - weeklySnapshotRetentionWeeks + ApiBSONTimestamp: + type: object + description: >- + BSON timestamp that indicates when the checkpoint token entry in the + oplog occurred. + properties: + date: + type: string + format: date-time + description: >- + Date and time when the oplog recorded this database operation. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + increment: + type: integer + format: int32 + description: >- + Order of the database operation that the oplog recorded at specific + date and time. + example: 1199145600 + minimum: 1199145600 + readOnly: true + readOnly: true + title: BSON Timestamp + ApiCheckpointPart: + type: object + description: >- + Metadata contained in one document that describes the complete snapshot + taken for this node. + properties: + replicaSetName: + type: string + description: >- + Human-readable label that identifies the replica set to which this + checkpoint applies. + readOnly: true + shardName: + type: string + description: >- + Human-readable label that identifies the shard to which this + checkpoint applies. + readOnly: true + tokenDiscovered: + type: boolean + description: Flag that indicates whether the token exists. + readOnly: true + tokenTimestamp: + $ref: '#/components/schemas/ApiBSONTimestamp' + typeName: + type: string + description: >- + Human-readable label that identifies the type of host that the part + represents. + readOnly: true + readOnly: true + AutoExportPolicy: + type: object + description: Policy for automatically exporting cloud backup snapshots. + properties: + exportBucketId: + type: string + description: >- + Unique 24-hexadecimal character string that identifies the AWS + Bucket. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + frequencyType: + type: string + description: >- + Human-readable label that indicates the rate at which the export + policy item occurs. + title: export + CostExplorerFilterResponse: + type: object + description: Response object to give information about created query. + properties: + token: + type: string + description: The token used to identify the created Cost Explorer query. + example: d9ab638a801efe182f98ae3e18ea4bb47b9fda808a28a8c7de205bb0e94f7d71 + maxLength: 64 + minLength: 64 + Criteria: + type: object + description: >- + Rules by which MongoDB MongoDB Cloud archives data. + + + Use the **criteria.type** field to choose how MongoDB Cloud selects data + to archive. Choose data using the age of the data or a MongoDB query. + + **"criteria.type": "DATE"** selects documents to archive based on a + date. + + **"criteria.type": "CUSTOM"** selects documents to archive based on a + custom JSON query. MongoDB Cloud doesn't support **"criteria.type": + "CUSTOM"** when **"collectionType": "TIMESERIES"**. + properties: + type: + type: string + description: >- + Means by which MongoDB Cloud selects data to archive. Data can be + chosen using the age of the data or a MongoDB query. + + **DATE** selects documents to archive based on a date. + + **CUSTOM** selects documents to archive based on a custom JSON + query. MongoDB Cloud doesn't support **CUSTOM** when + `"collectionType": "TIMESERIES"`. + query: + type: string + description: >- + MongoDB find query that selects documents to archive. The specified + query follows the syntax of the `db.collection.find(query)` command. + This query can't use the empty document (`{}`) to return all + documents. Set this parameter when **"criteria.type" : "CUSTOM"**. + dateField: + type: string + description: >- + Indexed database parameter that stores the date that determines when + data moves to the online archive. MongoDB Cloud archives the data + when the current date exceeds the date in this database parameter + plus the number of days specified through the **expireAfterDays** + parameter. Set this parameter when you set `"criteria.type" : + "DATE"`. + dateFormat: + type: string + default: ISODATE + description: >- + Syntax used to write the date after which data moves to the online + archive. Date can be expressed as ISO 8601 or Epoch timestamps. The + Epoch timestamp can be expressed as nanoseconds, milliseconds, or + seconds. Set this parameter when **"criteria.type" : "DATE"**. + + You must set **"criteria.type" : "DATE"** if **"collectionType": + "TIMESERIES"**. + expireAfterDays: + type: integer + format: int32 + description: >- + Number of days after the value in the **criteria.dateField** when + MongoDB Cloud archives data in the specified cluster. Set this + parameter when you set **"criteria.type" : "DATE"**. + DataProcessRegion: + type: object + description: >- + Settings to configure the region where you wish to store your archived + data. + properties: + cloudProvider: + type: string + description: >- + Human-readable label that identifies the Cloud service provider + where you wish to store your archived data. + region: + type: string + description: >- + Human-readable label that identifies the geographic location of the + region where you wish to store your archived data. + GroupPaginatedEvent: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/EventViewForNdsGroup' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + ManagedNamespace: + type: object + properties: + collection: + type: string + description: >- + Human-readable label of the collection to manage for this Global + Cluster. + customShardKey: + type: string + description: >- + Database parameter used to divide the *collection* into shards. + Global clusters require a compound shard key. This compound shard + key combines the location parameter and the user-selected custom + key. + db: + type: string + description: >- + Human-readable label of the database to manage for this Global + Cluster. + isCustomShardKeyHashed: + type: boolean + default: false + description: >- + Flag that indicates whether someone hashed the custom shard key. If + this parameter returns `false`, this cluster uses ranged sharding. + isShardKeyUnique: + type: boolean + default: false + description: >- + Flag that indicates whether the underlying index enforces unique + values. + numInitialChunks: + type: integer + format: int64 + description: >- + Minimum number of chunks to create initially when sharding an empty + collection with a hashed shard key. + presplitHashedZones: + type: boolean + default: false + description: >- + Flag that indicates whether MongoDB Cloud should create and + distribute initial chunks for an empty or non-existing collection. + MongoDB Cloud distributes data based on the defined zones and zone + ranges for the collection. + MatcherField: + type: string + NumberMetricValue: + type: object + description: Measurement of the **metricName** recorded at the time of the event. + properties: + number: + type: number + format: double + description: >- + Amount of the **metricName** recorded at the time of the event. This + value triggered the alert. + readOnly: true + units: + $ref: '#/components/schemas/NumberMetricUnits' + readOnly: true + title: Number Metric Value + OrgPaginatedEvent: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/EventViewForOrg' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedAdvancedClusterDescription: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/AdvancedClusterDescription' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedAlertConfig: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/GroupAlertsConfig' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedAlert: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/AlertViewForNdsGroup' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedApiApiUser: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/ApiKeyUserDetails' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAppUser: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/CloudAppUser' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasCheckpoint: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/ApiAtlasCheckpoint' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasDatabaseUser: + type: object + description: >- + List of MongoDB Database users granted access to databases in the + specified project. + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/CloudDatabaseUser' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasDiskBackupExportJob: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/DiskBackupExportJob' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasProviderRegions: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/CloudProviderRegions' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasServerlessBackupRestoreJob: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/ServerlessBackupRestoreJob' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasServerlessBackupSnapshot: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/ServerlessBackupSnapshot' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiInvoice: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/BillingInvoice' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiStreamsConnection: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/StreamsConnection' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedApiStreamsTenant: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/StreamsTenant' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedApiUserAccessList: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/UserAccessList' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedAppUser: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/CloudAppUser' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedAtlasGroup: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/Group' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedBackupSnapshotExportBucket: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/DiskBackupSnapshotAWSExportBucket' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedBackupSnapshot: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/DiskBackupSnapshot' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedCloudBackupReplicaSet: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/DiskBackupReplicaSet' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedCloudBackupRestoreJob: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/DiskBackupSnapshotRestoreJob' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedCloudBackupShardedClusterSnapshot: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/DiskBackupShardedClusterSnapshot' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedCloudProviderContainer: + type: object + description: List of Network Peering Containers that Amazon Web Services serves. + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/CloudProviderContainer' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + title: Network Peering + PaginatedContainerPeer: + type: object + description: Group of Network Peering connection settings. + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedDatabase: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/MesurementsDatabase' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedDiskPartition: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/MeasurementDiskPartition' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedIntegration: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/ThridPartyIntegration' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedNetworkAccess: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/NetworkPermissionEntry' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedOnlineArchive: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/BackupOnlineArchive' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedOrgGroup: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/OrgGroup' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedOrganization: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/AtlasOrganization' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedPipelineRun: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/IngestionPipelineRun' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedPrivateNetworkEndpointIdEntry: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/PrivateNetworkEndpointIdEntry' + readOnly: true + totalCount: + type: integer + format: int32 + description: >- + Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedRestoreJob: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/BackupRestoreJob' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedServerlessInstanceDescription: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/ServerlessInstanceDescription' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedSnapshot: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/BackupSnapshot' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedTeamRole: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/TeamRole' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedTeam: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/TeamResponse' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedTenantRestore: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/TenantRestore' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedTenantSnapshot: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/BackupTenantSnapshot' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedUserCert: + type: object + properties: + links: + type: array + description: >- + List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: '#/components/schemas/Link' + readOnly: true + results: + type: array + description: >- + List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: '#/components/schemas/UserCert' + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PartitionField: + type: object + description: Metadata to partition this online archive. + properties: + fieldName: + type: string + description: >- + Human-readable label that identifies the parameter that MongoDB + Cloud uses to partition data. To specify a nested parameter, use the + dot notation. + maxLength: 700 + fieldType: + type: string + description: >- + Data type of the parameter that that MongoDB Cloud uses to partition + data. Partition parameters of type + [UUID](http://bsonspec.org/spec.html) must be of binary subtype 4. + MongoDB Cloud skips partition parameters of type UUID with subtype + 3. + readOnly: true + order: + type: integer + format: int32 + default: 0 + description: >- + Sequence in which MongoDB Cloud slices the collection data to create + partitions. The resource expresses this sequence starting with zero. + The value of the **criteria.dateField** parameter defaults as the + first item in the partition sequence. + required: + - fieldName + - order + title: Online Archive Partition + PerformanceAdvisorOperation: + type: object + properties: + predicates: + type: array + description: >- + List that contains the search criteria that the query uses. To use + the values in key-value pairs in these predicates requires **Project + Data Access Read Only** permissions or greater. Otherwise, MongoDB + Cloud redacts these values. + items: + type: object + description: >- + List that contains the search criteria that the query uses. To use + the values in key-value pairs in these predicates requires + **Project Data Access Read Only** permissions or greater. + Otherwise, MongoDB Cloud redacts these values. + readOnly: true + readOnly: true + stats: + $ref: '#/components/schemas/PerformanceAdvisorOpStats' + PrivateIPMode: + type: object + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether someone enabled **Connect via Peering + Only** mode for the specified project. + required: + - enabled + ProjectSettingItem: + type: object + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether someone enabled the regionalized private + endpoint setting for the specified project. + + + - Set this value to `true` to enable regionalized private endpoints. + This allows you to create more than one private endpoint in a cloud + provider region. You need to enable this setting to connect to + multi-region and global MongoDB Cloud sharded clusters. Enabling + regionalized private endpoints introduces the following limitations: + - Your applications must use the new connection strings for existing multi-region and global sharded clusters. This might cause downtime. + - Your MongoDB Cloud project can't contain replica sets nor can you create new replica sets in this project. + + - You can't disable this setting if you have: + - more than one private endpoint in more than one region + - more than one private endpoint in one region and one private endpoint in one or more regions. + + - Set this value to `false` to disable regionalized private + endpoints. + required: + - enabled + ResourceEventType: + type: string + description: Unique identifier of event type. + example: TAGS_MODIFIED + title: Resource Event Types + ApiAtlasFTSAnalyzers: + type: object + description: Settings that describe one Atlas Search custom analyzer. + properties: + charFilters: + type: array + description: >- + Filters that examine text one character at a time and perform + filtering operations. + items: {} + name: + type: string + description: >- + Human-readable name that identifies the custom analyzer. Names must + be unique within an index, and must not start with any of the + following strings: + + - `lucene.` + + - `builtin.` + + - `mongodb.` + tokenFilters: + type: array + description: >- + Filter that performs operations such as: + + + - Stemming, which reduces related words, such as "talking", + "talked", and "talks" to their root word "talk". + + + - Redaction, the removal of sensitive information from public + documents. + items: {} + tokenizer: + type: object + description: >- + Tokenizer that you want to use to create tokens. Tokens determine + how Atlas Search splits up text into discrete chunks for indexing. + properties: + maxGram: + type: integer + description: >- + Characters to include in the longest token that Atlas Search + creates. + minGram: + type: integer + description: >- + Characters to include in the shortest token that Atlas Search + creates. + type: + type: string + description: Human-readable label that identifies this tokenizer type. + group: + type: integer + description: >- + Index of the character group within the matching expression to + extract into tokens. Use `0` to extract all character groups. + pattern: + type: string + description: Regular expression to match against. + maxTokenLength: + type: integer + default: 255 + description: >- + Maximum number of characters in a single token. Tokens greater + than this length are split at this length into multiple tokens. + required: + - name + - tokenizer + title: analyzers + ApiAtlasFTSMappings: + type: object + description: Index specifications for the collection's fields. + properties: + dynamic: + type: boolean + default: false + description: >- + Flag that indicates whether the index uses dynamic or static + mappings. Required if **mappings.fields** is omitted. + externalDocs: + description: Dynamic or Static Mappings + url: >- + https://www.mongodb.com/docs/atlas/atlas-search/index-definitions/#field-mapping-examples + fields: + type: object + additionalProperties: + externalDocs: + description: Atlas Search Field Mappings + url: >- + https://www.mongodb.com/docs/atlas/atlas-search/define-field-mappings/#define-field-mappings + description: >- + One or more field specifications for the Atlas Search index. + Required if **mappings.dynamic** is omitted or set to **false**. + externalDocs: + description: Atlas Search Index + url: https://www.mongodb.com/docs/atlas/atlas-search/index-definitions/ + title: mappings + securitySchemes: + DigestAuth: + scheme: digest + type: http diff --git a/tools/openapi-generator/config/atlas-api.yaml b/tools/openapi-generator/config/atlas-api.yaml new file mode 100644 index 0000000000..59df5fdcf7 --- /dev/null +++ b/tools/openapi-generator/config/atlas-api.yaml @@ -0,0 +1,28877 @@ +openapi: 3.0.1 +info: + description: >- + The MongoDB Atlas Administration API allows developers to manage all + components in MongoDB Atlas. + + + The Atlas Administration API uses HTTP Digest Authentication to authenticate requests. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request. For example, to [return database access history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the terminal: + + + ``` + + curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" \ + --digest \ + --header "Accept: application/vnd.atlas.2023-02-01+json" \ + GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true" + ``` + + + To learn more, see [Get Started with the Atlas Administration API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, see [MongoDB Support](https://www.mongodb.com/support/get-started). + license: + name: CC BY-NC-SA 3.0 US + url: https://creativecommons.org/licenses/by-nc-sa/3.0/us/ + termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions + title: MongoDB Atlas Administration API + version: 2.0~6e54278ed8 + x-xgen-sha: 6e54278ed80f8e54655f8d970425d6ee8247ae30 +servers: + - url: https://cloud.mongodb.com +tags: + - description: Returns access logs for authentication attempts made to Atlas + database deployments. To view database access history, you must have + either the Project Owner or Organization Owner role. + name: Access Tracking + - description: Returns and edits the conditions that trigger alerts and how + MongoDB Cloud notifies users. This collection remains under revision and + may change. + name: Alert Configurations + - description: Returns and acknowledges alerts that MongoDB Cloud triggers based + on the alert conditions that you define. This collection remains under + revision and may change. + name: Alerts + - description: Returns, adds, edits, and removes Atlas Search indexes for the + specified cluster. Also returns and updates user-defined analyzers for the + specified cluster. + name: Atlas Search + - description: Returns and edits database auditing settings for MongoDB Cloud projects. + name: Auditing + - description: Manages Cloud Backup snapshots, snapshot export buckets, restore + jobs, and schedules. This resource applies only to clusters that use Cloud + Backups. + name: Cloud Backups + - description: Manages the Cloud Migration Service. Source organizations, + projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. + Destination organizations, projects, and MongoDB clusters reside on + MongoDB Cloud. Source databases can't use any authentication except + SCRAM-SHA. + name: Cloud Migration Service + - description: Returns, adds, authorizes, and removes AWS IAM roles in Atlas. + name: Cloud Provider Access + - description: Returns, starts, or ends a cluster outage simulation. + name: Cluster Outage Simulation + - description: Returns, adds, edits, and removes database deployments. Changes to + cluster configurations can affect costs. This resource requires your + Project ID. + name: Clusters + - description: Returns and edits custom DNS configurations for MongoDB Cloud + database deployments on AWS. The resource requires your Project ID. If you + use the VPC peering on AWS and you use your own DNS servers instead of + Amazon Route 53, enable custom DNS. Before 31 March 2020, applications + deployed within AWS using custom DNS services and VPC-peered with MongoDB + Cloud couldn't connect over private IP addresses. Custom DNS resolved to + public IP addresses. AWS internal DNS resolved to private IP addresses. + Applications deployed with custom DNS services in AWS should use Private + IP for Peering connection strings. + name: AWS Clusters DNS + - description: Returns, adds, edits, and removes custom database user privilege + roles. Use custom roles to specify custom sets of actions that the MongoDB + Cloud built-in roles can't describe. You define custom roles at the + project level, for all clusters in the project. This resource supports a + subset of MongoDB privilege actions. You can create a subset of custom + role actions. To create a wider list of custom role actions, use the + MongoDB Cloud user interface. Custom roles must include actions that all + project's clusters support, and that are compatible with each MongoDB + version that your project's clusters use. For example, if your project has + MongoDB 4.2 clusters, you can't create custom roles that use actions + introduced in MongoDB 4.4. + name: Custom Database Roles + - description: Returns, adds, edits, and removes database users. + name: Database Users + - description: Returns, adds, edits, and removes Federated Database Instances. + This resource requires your project ID. Changes to federated database + instance configurations can affect costs. + name: Data Federation + - description: Returns, adds, edits, and removes Atlas Data Lake Pipelines and + associated runs. + name: Data Lake Pipelines + - description: Returns and edits the Encryption at Rest using Customer Key + Management configuration. MongoDB Cloud encrypts all storage whether or + not you use your own key management. + name: Encryption at Rest using Customer Key Management + - description: Returns events. This collection remains under revision and may change. + name: Events + - description: Returns, adds, edits, and removes federation-related features such + as role mappings and connected organization configurations. + name: Federated Authentication + - description: >- + Returns, adds, and removes Global Cluster managed namespaces and custom + zone mappings. Each collection in a Global Cluster is associated with a + managed namespace. When you create a managed namespace for a Global + Cluster, MongoDB Cloud creates an empty collection for that namespace. + Creating a managed namespace doesn't populate a collection with data. + Similarly, deleting a managed namespace doesn't delete the associated + collection. + + MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster. + name: Global Clusters + - description: Returns invoices. + name: Invoices + - description: Returns, edits, verifies, and removes LDAP configurations. An LDAP + configuration defines settings for MongoDB Cloud to connect to your LDAP + server over TLS for user authentication and authorization. Your LDAP + server must be visible to the internet or connected to your MongoDB Cloud + cluster with VPC Peering. Also, your LDAP server must use TLS. You must + have the MongoDB Cloud admin user privilege to use these endpoints. Also, + to configure user authentication and authorization with LDAPS, your + cluster must run MongoDB 3.6 or higher. Groups for which you have + configured LDAPS can't create a cluster using a version of MongoDB 3.6 or + lower. + name: LDAP Configuration + - description: Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints. + name: Legacy Backup + - description: Returns, edits, and removes maintenance windows. The maintenance + procedure that MongoDB Cloud performs requires at least one replica set + election during the maintenance window per replica set. You can defer a + scheduled maintenance event for a project up to two times. Deferred + maintenance events occur during your preferred maintenance window exactly + one week after the previously scheduled date and time. + name: Maintenance Windows + - description: Returns, adds, and edits MongoDB Cloud users. + name: MongoDB Cloud Users + - description: Returns database deployment monitoring and logging data. + name: Monitoring and Logs + - description: >- + Returns, adds, edits, and removes network peering containers and peering + connections. + + When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block. + name: Network Peering + - description: Returns, adds, edits, or removes an online archive. + name: Online Archive + - description: Returns, adds, and edits organizational units in MongoDB Cloud. + name: Organizations + - description: Returns suggested indexes and slow query data for a database + deployment. Also enables or disables MongoDB Cloud-managed slow operation + thresholds. To view field values in a sample query, you must have the + Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud + returns redacted data rather than the field values. + name: Performance Advisor + - description: Returns, adds, edits, and removes private endpoint services. + name: Private Endpoint Services + - description: Returns, adds, edits, and removes access tokens to use the MongoDB + Cloud API. MongoDB Cloud applies these keys to organizations. These + resources can return, assign, or revoke use of these keys within a + specified project. + name: Programmatic API Keys + - description: Returns, adds, edits, and removes network access limits to database + deployments in Atlas. This resource replaces the whitelist resource. Atlas + removed whitelists in July 2021. Update your applications to use this new + resource. This resource manages a project's IP Access List and supports + creating temporary Access List entries that automatically expire within a + user-configurable 7-day period. + name: Project IP Access List + - description: Returns, adds, and edits collections of clusters and users in + MongoDB Cloud. + name: Projects + - description: Creates one index to a database deployment in a rolling manner. You + can't create a rolling index on an `M0` free cluster or `M2/M5` shared + cluster. + name: Rolling Index + - description: Returns details that describe the MongoDB Cloud build and the + access token that requests this resource. This starts the MongoDB Cloud + API. + name: Root + - description: Returns, adds, edits, and removes serverless instances. + name: Serverless Instances + - description: Returns, adds, edits, and removes private endpoints for serverless + instances. To learn more, see the Atlas Administration API tab on the + following tutorial. + externalDocs: + description: Set Up a Private Endpoint for a Serverless Instance Tutorial + url: https://dochub.mongodb.org/core/serverless-private-endpoint + name: Serverless Private Endpoints + - description: Returns and adds restore jobs for shared-tier database deployments. + name: Shared-Tier Restore Jobs + - description: Returns and requests to download shared-tier database deployment snapshots. + name: Shared-Tier Snapshots + - description: Returns, adds, edits, and removes Streams Instances. This resource + requires your project ID. + name: Streams + - description: Returns, adds, edits, or removes teams. + name: Teams + - description: >- + Returns, adds, edits, and removes third-party service integration + configurations. MongoDB Cloud sends alerts to each third-party service + that you configure. + + + **IMPORTANT**: Each project can only have one configuration per integrationType. + name: Third-Party Integrations + - description: Returns, edits, and removes user-managed X.509 configurations. Also + returns and generates MongoDB Cloud-managed X.509 certificates for + database users. The following resources help manage database users who + authenticate using X.509 certificates. You can manage these X.509 + certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages + your certificates, it also manages your Certificate Authority and can + generate certificates for your database users. No additional X.509 + configuration is required. If you manage your certificates, you must + provide a Certificate Authority and generate certificates for your + database users. + externalDocs: + description: Self-Managed X.509 Certificates + url: https://www.mongodb.com/docs/atlas/security-self-managed-x509/ + name: X.509 Authentication +paths: + /api/atlas/v2: + get: + description: This resource returns information about the MongoDB application + along with API key meta data. + operationId: getSystemStatus + parameters: [] + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/SystemStatus" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + summary: Return the status of this MongoDB application + tags: + - Root + x-xgen-experimental: true + /api/atlas/v2/alertConfigs/matchers/fieldNames: + get: + description: Get all field names that the `matchers.fieldName` parameter accepts + when you create or update an Alert Configuration. You can successfully + call this endpoint with any assigned role. + operationId: listAlertConfigurationMatchersFieldNames + parameters: [] + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/MatcherField" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Get All Alert Configuration Matchers Field Names + tags: + - Alert Configurations + /api/atlas/v2/clusters: + get: + description: Returns the details for all clusters in all projects to which you + have access. Clusters contain a group of hosts that maintain the same + data set. The response does not include multi-cloud clusters. To use + this resource, the requesting API Key can have any cluster-level role. + operationId: listClustersForAllProjects + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedOrgGroup" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Authorized Clusters in All Projects + tags: + - Clusters + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}": + delete: + description: "Deletes the federation settings instance and all associated data, + including identity providers and domains. To use this resource, the + requesting API Key must have the Organization Owner role in the last + remaining connected organization. **Note**: requests to this resource + will fail if there is more than one connected organization in the + federation." + operationId: deleteFederationApp + parameters: + - $ref: "#/components/parameters/federationSettingsId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: No Content + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Delete the federation settings instance. + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs": + get: + description: Returns all connected org configs in the specified federation. To + use this resource, the requesting API Key must have the Organization + Owner role in one of the connected orgs. + operationId: listConnectedOrgConfigs + parameters: + - $ref: "#/components/parameters/federationSettingsId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/ConnectedOrgConfig" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + summary: Return All Connected Org Configs from the Federation + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}": + delete: + description: "Removes one connected organization configuration from the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. Note: This request fails if only one + connected organization exists in the federation." + operationId: removeConnectedOrgConfig + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the connected + organization configuration to remove. + in: path + name: orgId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Org Config Connected to One Federation + tags: + - Federated Authentication + x-xgen-experimental: true + get: + description: Returns the specified connected org config from the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role in the connected org. + operationId: getConnectedOrgConfig + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the connected + organization configuration to return. + in: path + name: orgId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ConnectedOrgConfig" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Org Config Connected to One Federation + tags: + - Federated Authentication + x-xgen-experimental: true + patch: + description: >- + Updates one connected organization configuration from the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role. + + + **Note** If the organization configuration has no associated identity provider, you can't use this resource to update role mappings or post authorization role grants. + + + **Note**: The domainRestrictionEnabled field defaults to false if not provided in the request. + + + **Note**: If the identityProviderId field is not provided, you will disconnect the organization and the identity provider. + operationId: updateConnectedOrgConfig + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the connected + organization configuration to update. + in: path + name: orgId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ConnectedOrgConfig" + description: The connected organization configuration that you want to update. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ConnectedOrgConfig" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Org Config Connected to One Federation + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings": + get: + description: Returns all role mappings from the specified organization in the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. + operationId: listRoleMappings + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/orgId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/AuthFederationRoleMapping" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Role Mappings from One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + post: + description: Adds one role mapping to the specified organization in the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. + operationId: createRoleMapping + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AuthFederationRoleMapping" + description: The role mapping that you want to create. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AuthFederationRoleMapping" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Add One Role Mapping to One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}": + delete: + description: Removes one role mapping in the specified organization from the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. + operationId: deleteRoleMapping + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the role mapping + that you want to remove. + in: path + name: id + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - $ref: "#/components/parameters/orgId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: No Content + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Role Mapping from One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + get: + description: Returns one role mapping from the specified organization in the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. + operationId: getRoleMapping + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the role mapping + that you want to return. + in: path + name: id + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - $ref: "#/components/parameters/orgId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AuthFederationRoleMapping" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Role Mapping from One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + put: + description: Updates one role mapping in the specified organization in the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. + operationId: updateRoleMapping + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the role mapping + that you want to update. + in: path + name: id + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AuthFederationRoleMapping" + description: The role mapping that you want to update. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AuthFederationRoleMapping" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Role Mapping in One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders": + get: + description: Returns all identity providers in the specified federation. To use + this resource, the requesting API Key must have the Organization Owner + role in one of the connected organizations. + operationId: listIdentityProviders + parameters: + - $ref: "#/components/parameters/federationSettingsId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/FederationIdentityProvider" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return all identity providers from the specified federation. + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}": + get: + description: Returns one identity provider from the specified federation. To use + this resource, the requesting API Key must have the Organization Owner + role in one of the connected organizations. + operationId: getIdentityProvider + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/identityProviderId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/FederationIdentityProvider" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return one identity provider from the specified federation. + tags: + - Federated Authentication + x-xgen-experimental: true + patch: + description: Updates one identity provider in the specified federation. To use + this resource, the requesting API Key must have the Organization Owner + role in one of the connected organizations. + operationId: updateIdentityProvider + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/identityProviderId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/SamlIdentityProviderUpdate" + description: The identity provider that you want to update. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/FederationIdentityProvider" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update the identity provider. + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}/metadata.xml": + get: + description: Returns the metadata of one identity provider in the specified + federation. To use this resource, the requesting API Key must have the + Organization Owner role in one of the connected organizations. + operationId: getIdentityProviderMetadata + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/identityProviderId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: string + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return the metadata of one identity provider in the specified federation. + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/groups: + get: + description: Returns details about all projects. Projects group clusters into + logical collections that support an application environment, workload, + or both. Each project can have its own users, teams, security, and alert + settings. To use this resource, the requesting API Key must have the + Read Write role. + operationId: listProjects + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedAtlasGroup" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + summary: Return All Projects + tags: + - Projects + post: + description: Creates one project. Projects group clusters into logical + collections that support an application environment, workload, or both. + Each project can have its own users, teams, security, and alert + settings. To use this resource, the requesting API Key must have the + Read Write role. + operationId: createProject + parameters: + - description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user to whom to grant the Project Owner role on the specified + project. If you set this parameter, it overrides the default value + of the oldest Organization Owner. + in: query + name: projectOwnerId + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Group" + description: Creates one project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Group" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Project + tags: + - Projects + "/api/atlas/v2/groups/byName/{groupName}": + get: + description: Returns details about the specified project. Projects group + clusters into logical collections that support an application + environment, workload, or both. Each project can have its own users, + teams, security, and alert settings. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: getProjectByName + parameters: + - description: Human-readable label that identifies this project. + in: path + name: groupName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Group" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + summary: Return One Project using Its Name + tags: + - Projects + "/api/atlas/v2/groups/{groupId}": + delete: + description: Removes the specified project. Projects group clusters into logical + collections that support an application environment, workload, or both. + Each project can have its own users, teams, security, and alert + settings. You can delete a project only if there are no Online Archives + for the clusters in the project. To use this resource, the requesting + API Key must have the Project Owner role. + operationId: deleteProject + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Project + tags: + - Projects + get: + description: Returns details about the specified project. Projects group + clusters into logical collections that support an application + environment, workload, or both. Each project can have its own users, + teams, security, and alert settings. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: getProject + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Group" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Project + tags: + - Projects + patch: + description: Updates the human-readable label that identifies the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: updateProject + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupName" + description: Project to update. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Group" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Project Name + tags: + - Projects + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/accessList": + get: + description: Returns all access list entries from the specified project's IP + access list. Each entry in the project's IP access list contains either + one IP address or one CIDR-notated block of IP addresses. MongoDB Cloud + only allows client connections to the cluster from entries in the + project's IP access list. To use this resource, the requesting API Key + must have the Project Read Only or Project Charts Admin roles. This + resource replaces the whitelist resource. MongoDB Cloud removed + whitelists in July 2021. Update your applications to use this new + resource. The `/groups/{GROUP-ID}/accessList` endpoint manages the + database IP access list. This endpoint is distinct from the + `orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist` endpoint, which manages + the access list for MongoDB Cloud organizations. + externalDocs: + description: IP access list + url: https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + operationId: listProjectIpAccessLists + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedNetworkAccess" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Project IP Access List + tags: + - Project IP Access List + post: + description: Adds one or more access list entries to the specified project. + MongoDB Cloud only allows client connections to the cluster from entries + in the project's IP access list. Write each entry as either one IP + address or one CIDR-notated block of IP addresses. To use this resource, + the requesting API Key must have the Project Owner or Project Charts + Admin roles. This resource replaces the whitelist resource. MongoDB + Cloud removed whitelists in July 2021. Update your applications to use + this new resource. The `/groups/{GROUP-ID}/accessList` endpoint manages + the database IP access list. This endpoint is distinct from the + `orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist` endpoint, which manages + the access list for MongoDB Cloud organizations. This endpoint doesn't + support concurrent `POST` requests. You must submit multiple `POST` + requests synchronously. + externalDocs: + description: IP access list + url: https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + operationId: createProjectIpAccessList + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/NetworkPermissionEntry" + description: One or more access list entries to add to the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedNetworkAccess" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Add Entries to Project IP Access List + tags: + - Project IP Access List + "/api/atlas/v2/groups/{groupId}/accessList/{entryValue}": + delete: + description: Removes one access list entry from the specified project's IP + access list. Each entry in the project's IP access list contains one IP + address, one CIDR-notated block of IP addresses, or one AWS Security + Group ID. MongoDB Cloud only allows client connections to the cluster + from entries in the project's IP access list. To use this resource, the + requesting API Key must have the Project Owner role. This resource + replaces the whitelist resource. MongoDB Cloud removed whitelists in + July 2021. Update your applications to use this new resource. The + `/groups/{GROUP-ID}/accessList` endpoint manages the database IP access + list. This endpoint is distinct from the + `orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist` endpoint, which manages + the access list for MongoDB Cloud organizations. + externalDocs: + description: IP access list + url: https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + operationId: deleteProjectIpAccessList + parameters: + - $ref: "#/components/parameters/groupId" + - description: >- + Access list entry that you want to remove from the project's IP + access list. This value can use one of the following: one AWS + security group ID, one IP address, or one CIDR block of addresses. + For CIDR blocks that use a subnet mask, replace the forward slash + (`/`) with its URL-encoded value (`%2F`). When you remove an entry + from the IP access list, existing connections from the removed + address or addresses may remain open for a variable amount of time. + The amount of time it takes MongoDB Cloud to close the connection + depends upon several factors, including: + + + - how your application established the connection, + + - how MongoDB Cloud or the driver using the address behaves, and + + - which protocol (like TCP or UDP) the connection uses. + in: path + name: entryValue + required: true + schema: + type: string + example: "IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 or + IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or AWS + SG: sg-903004f8" + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Entry from One Project IP Access List + tags: + - Project IP Access List + get: + description: Returns one access list entry from the specified project's IP + access list. Each entry in the project's IP access list contains either + one IP address or one CIDR-notated block of IP addresses. MongoDB Cloud + only allows client connections to the cluster from entries in the + project's IP access list. To use this resource, the requesting API Key + must have the Project Read Only or Project Charts Admin roles. This + resource replaces the whitelist resource. MongoDB Cloud removed + whitelists in July 2021. Update your applications to use this new + resource. This endpoint (`/groups/{GROUP-ID}/accessList`) manages the + Project IP Access List. It doesn't manage the access list for MongoDB + Cloud organizations. TheProgrammatic API Keys endpoint + (`/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist`) manages those access + lists. + externalDocs: + description: IP access list + url: https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + operationId: getProjectIpList + parameters: + - $ref: "#/components/parameters/groupId" + - description: "Access list entry that you want to return from the project's IP + access list. This value can use one of the following: one AWS + security group ID, one IP address, or one CIDR block of addresses. + For CIDR blocks that use a subnet mask, replace the forward slash + (`/`) with its URL-encoded value (`%2F`)." + in: path + name: entryValue + required: true + schema: + type: string + example: "IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 or + IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or AWS + SG: sg-903004f8" + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NetworkPermissionEntry" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Project IP Access List Entry + tags: + - Project IP Access List + "/api/atlas/v2/groups/{groupId}/accessList/{entryValue}/status": + get: + description: Returns the status of one project IP access list entry. This + resource checks if the provided project IP access list entry applies to + all cloud providers serving clusters from the specified project. + operationId: getProjectIpAccessListStatus + parameters: + - $ref: "#/components/parameters/groupId" + - description: Network address or cloud provider security construct that + identifies which project access list entry to be verified. + in: path + name: entryValue + required: true + schema: + type: string + example: "IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 or + IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or AWS + SG: sg-903004f8" + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NetworkPermissionEntryStatus" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Status of One Project IP Access List Entry + tags: + - Project IP Access List + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/alertConfigs": + get: + description: >- + Returns all alert configurations for one project. These alert + configurations apply to any component in the project. Alert + configurations define the triggers and notification methods for alerts. + To use this resource, the requesting API Key must have the Project Read + Only role. + + + This resource remains under revision and may change. + operationId: listAlertConfigurations + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedAlertConfig" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Alert Configurations for One Project + tags: + - Alert Configurations + post: + description: >- + Creates one alert configuration for the specified project. Alert + configurations define the triggers and notification methods for alerts. + To use this resource, the requesting API Key must have the Organization + Owner or Project Owner role. + + + This resource remains under revision and may change. + operationId: createAlertConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupAlertsConfig" + description: Creates one alert configuration for the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupAlertsConfig" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Alert Configuration in One Project + tags: + - Alert Configurations + "/api/atlas/v2/groups/{groupId}/alertConfigs/{alertConfigId}": + delete: + description: >- + Removes one alert configuration from the specified project. To use this + resource, the requesting API Key must have the Organization Owner or + Project Owner role. + + + This resource remains under revision and may change. + operationId: deleteAlertConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert + configuration. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: No Content + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Alert Configuration from One Project + tags: + - Alert Configurations + get: + description: >- + Returns the specified alert configuration from the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. + + + This resource remains under revision and may change. + operationId: getAlertConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert + configuration. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupAlertsConfig" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Alert Configuration from One Project + tags: + - Alert Configurations + x-xgen-experimental: true + patch: + description: >- + Enables or disables the specified alert configuration in the specified + project. The resource enables the specified alert configuration if + currently enabled. The resource disables the specified alert + configuration if currently disabled. To use this resource, the + requesting API Key must have the Organization Owner or Project Owner + role. + + + **NOTE**: This endpoint updates only the enabled/disabled state for the alert configuration. To update more than just this configuration, see [Update One Alert Configuration](#tag/Alert-Configurations/operation/updateAlertConfiguration). + + + This resource remains under revision and may change. + operationId: toggleAlertConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert + configuration that triggered this alert. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AlertsToggle" + description: Enables or disables the specified alert configuration in the + specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupAlertsConfig" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Toggle One State of One Alert Configuration in One Project + tags: + - Alert Configurations + put: + description: >- + Updates one alert configuration in the specified project. Alert + configurations define the triggers and notification methods for alerts. + To use this resource, the requesting API Key must have the Organization + Owner or Project Owner role. + + + **NOTE**: To enable or disable the alert configuration, see [Toggle One State of One Alert Configuration in One Project](#tag/Alert-Configurations/operation/toggleAlertConfiguration). + + + This resource remains under revision and may change. + operationId: updateAlertConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert + configuration. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupAlertsConfig" + description: Updates one alert configuration in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupAlertsConfig" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Alert Configuration for One Project + tags: + - Alert Configurations + "/api/atlas/v2/groups/{groupId}/alertConfigs/{alertConfigId}/alerts": + get: + description: >- + Returns all open alerts that the specified alert configuration triggers. + These alert configurations apply to the specified project only. Alert + configurations define the triggers and notification methods for alerts. + Open alerts have been triggered but remain unacknowledged. To use this + resource, the requesting API Key must have the Project Read Only role. + + + This resource remains under revision and may change. + operationId: listAlertsByAlertConfigurationId + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies the alert + configuration. Use the + [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) + endpoint to retrieve all alert configurations to which the + authenticated user has access. + in: path + name: alertConfigId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedAlert" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Open Alerts for Alert Configuration + tags: + - Alerts + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/alerts": + get: + description: >- + Returns all alerts. These alerts apply to all components in one project. + You receive an alert when a monitored component meets or exceeds a value + you set. To use this resource, the requesting API Key must have the + Project Read Only role. + + + This resource remains under revision and may change. + operationId: listAlerts + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Status of the alerts to return. Omit to return all alerts in all + statuses. + in: query + name: status + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedAlert" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Alerts from One Project + tags: + - Alerts + "/api/atlas/v2/groups/{groupId}/alerts/{alertId}": + get: + description: >- + Returns one alert. This alert applies to any component in one project. + You receive an alert when a monitored component meets or exceeds a value + you set. To use this resource, the requesting API Key must have the + Project Read Only role. + + + This resource remains under revision and may change. + operationId: getAlert + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert. Use + the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve + all alerts to which the authenticated user has access. + in: path + name: alertId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AlertViewForNdsGroup" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Alert from One Project + tags: + - Alerts + patch: + description: >- + Confirms receipt of one existing alert. This alert applies to any + component in one project. Acknowledging an alert prevents successive + notifications. You receive an alert when a monitored component meets or + exceeds a value you set until you acknowledge the alert. To use this + resource, the requesting API Key must have the Organization Owner or + Project Owner role. + + + This resource remains under revision and may change. + operationId: acknowledgeAlert + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert. Use + the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve + all alerts to which the authenticated user has access. + in: path + name: alertId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AlertViewForNdsGroup" + description: Confirm one alert. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AlertViewForNdsGroup" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Acknowledge One Alert from One Project + tags: + - Alerts + "/api/atlas/v2/groups/{groupId}/alerts/{alertId}/alertConfigs": + get: + description: >- + Returns all alert configurations set for the specified alert. To use + this resource, the requesting API Key must have the Project Read Only + role. + + + This resource remains under revision and may change. + operationId: listAlertConfigurationsByAlertId + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies the alert. Use + the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve + all alerts to which the authenticated user has access. + in: path + name: alertId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedAlertConfig" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Alert Configurations Set for One Alert + tags: + - Alert Configurations + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/apiKeys": + get: + description: Returns all organization API keys that you assigned to the + specified project. Users with the Project Owner role in the project + associated with the API key can use the organization API key to access + the resources. To use this resource, the requesting API Key must have + the Project User Admin role. + externalDocs: + description: Programmatic API Keys + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: listProjectApiKeys + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiApiUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Organization API Keys Assigned to One Project + tags: + - Programmatic API Keys + post: + description: Creates and assigns the specified organization API key to the + specified project. Users with the Project Owner role in the project + associated with the API key can use the organization API key to access + the resources. To use this resource, the requesting API Key must have + the Project User Admin role. + operationId: createProjectApiKey + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CreateAtlasProjectApiKey" + description: Organization API key to be created and assigned to the specified + project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create and Assign One Organization API Key to One Project + tags: + - Programmatic API Keys + "/api/atlas/v2/groups/{groupId}/apiKeys/{apiUserId}": + delete: + description: Removes one organization API key from the specified project. To use + this resource, the requesting API Key must have the Project User Admin + role. + externalDocs: + description: Programmatic API Keys + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: removeProjectApiKey + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key that you want to unassign from one project. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Unassign One Organization API Key from One Project + tags: + - Programmatic API Keys + patch: + description: Updates the roles of the organization API key that you specify for + the project that you specify. You must specify at least one valid role + for the project. The application removes any roles that you do not + include in this request if they were previously set in the organization + API key that you specify for the project. + operationId: updateApiKeyRoles + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/pageNum" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/includeCount" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key that you want to unassign from one project. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UpdateAtlasProjectApiKey" + description: Organization API Key to be updated. This request requires a minimum + of one of the two body parameters. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Roles of One Organization API Key to One Project + tags: + - Programmatic API Keys + post: + description: Assigns the specified organization API key to the specified + project. Users with the Project Owner role in the project associated + with the API key can then use the organization API key to access the + resources. To use this resource, the requesting API Key must have the + Project User Admin role. + operationId: addProjectApiKey + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key that you want to assign to one project. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/UserAccessRoleAssignment" + description: Organization API key to be assigned to the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Assign One Organization API Key to One Project + tags: + - Programmatic API Keys + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/auditLog": + get: + description: Returns the auditing configuration for the specified project. The + auditing configuration defines the events that MongoDB Cloud records in + the audit log. To use this resource, the requesting API Key must have + the Project Owner role. This feature isn't available for `M0`, `M2`, + `M5`, or serverless clusters. + operationId: getAuditingConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AuditLog" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return the Auditing Configuration for One Project + tags: + - Auditing + patch: + description: Updates the auditing configuration for the specified project. The + auditing configuration defines the events that MongoDB Cloud records in + the audit log. To use this resource, the requesting API Key must have + the Project Owner role. This feature isn't available for `M0`, `M2`, + `M5`, or serverless clusters. + operationId: updateAuditingConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AuditLog" + description: Updated auditing configuration for the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AuditLog" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Auditing Configuration for One Project + tags: + - Auditing + "/api/atlas/v2/groups/{groupId}/awsCustomDNS": + get: + description: Returns the custom DNS configuration for AWS clusters in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: getAWSCustomDNS + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AWSCustomDNSEnabled" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Custom DNS Configuration for Atlas Clusters on AWS + tags: + - AWS Clusters DNS + patch: + description: Enables or disables the custom DNS configuration for AWS clusters + in the specified project. Enable custom DNS if you use AWS VPC peering + and use your own DNS servers. To use this resource, the requesting API + Key must have the Project Atlas Admin role. + operationId: toggleAWSCustomDNS + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AWSCustomDNSEnabled" + description: Enables or disables the custom DNS configuration for AWS clusters + in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AWSCustomDNSEnabled" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS + tags: + - AWS Clusters DNS + "/api/atlas/v2/groups/{groupId}/backup/exportBuckets": + get: + description: Returns all AWS S3 buckets associated with the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listExportBuckets + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedBackupSnapshotExportBucket" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports + tags: + - Cloud Backups + post: + description: Grants MongoDB Cloud access to the specified AWS S3 bucket. This + enables this bucket to receive Atlas Cloud Backup snapshots. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: createExportBucket + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotAWSExportBucket" + description: Grants MongoDB Cloud access to the specified AWS S3 bucket. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotAWSExportBucket" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/backup/exportBuckets/{exportBucketId}": + delete: + description: Revoke MongoDB Cloud access to the specified AWS S3 bucket. This + prevents this bucket to receive Atlas Cloud Backup snapshots. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: deleteExportBucket + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique string that identifies the AWS S3 bucket to which you export + your snapshots. + in: path + name: exportBucketId + required: true + schema: + type: string + maxLength: 63 + minLength: 3 + pattern: ^((?!xn--)(?!.*-s3alias)[a-z0-9][a-z0-9-]{1,61}[a-z0-9])$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports + tags: + - Cloud Backups + get: + description: Returns one AWS S3 bucket associated with the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getExportBucket + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique string that identifies the AWS S3 bucket to which you export + your snapshots. + in: path + name: exportBucketId + required: true + schema: + type: string + maxLength: 63 + minLength: 3 + pattern: ^((?!xn--)(?!.*-s3alias)[a-z0-9][a-z0-9-]{1,61}[a-z0-9])$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotAWSExportBucket" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/backupCompliancePolicy": + get: + description: Returns the Backup Compliance Policy settings with the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: getDataProtectionSettings + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataProtectionSettings" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return the Backup Compliance Policy settings + tags: + - Cloud Backups + put: + description: Updates the Backup Compliance Policy settings for the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: updateDataProtectionSettings + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataProtectionSettings" + x-xgen-version: 2023-01-01 + description: The new Backup Compliance Policy settings. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataProtectionSettings" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update or enable the Backup Compliance Policy settings + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/cloudProviderAccess": + get: + description: Returns all cloud provider access roles with access to the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: listCloudProviderAccessRoles + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderAccessRoles" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Cloud Provider Access Roles + tags: + - Cloud Provider Access + post: + description: Creates one access role for the specified cloud provider. Some + MongoDB Cloud features use these cloud provider access roles for + authentication. To use this resource, the requesting API Key must have + the Project Owner role. + externalDocs: + description: Set Up Access to Cloud Providers + url: https://www.mongodb.com/docs/atlas/security/cloud-provider-access/ + operationId: createCloudProviderAccessRole + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderAccessRole" + description: Creates one role for the specified cloud provider. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderAccessRole" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Cloud Provider Access Role + tags: + - Cloud Provider Access + "/api/atlas/v2/groups/{groupId}/cloudProviderAccess/{cloudProvider}/{roleId}": + delete: + description: Revokes access to the specified project for the specified access + role. To use this resource, the requesting API Key must have the Project + Owner role. + operationId: deauthorizeCloudProviderAccessRole + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cloud provider of the role + to deauthorize. + in: path + name: cloudProvider + required: true + schema: + type: string + - description: Unique 24-hexadecimal digit string that identifies the role. + in: path + name: roleId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: No Content + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Deauthorize One Cloud Provider Access Role + tags: + - Cloud Provider Access + "/api/atlas/v2/groups/{groupId}/cloudProviderAccess/{roleId}": + get: + description: Returns the access role with the specified id and with access to + the specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: getCloudProviderAccessRole + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the role. + in: path + name: roleId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderAccessRole" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return specified Cloud Provider Access Role + tags: + - Cloud Provider Access + x-xgen-experimental: true + patch: + description: Grants access to the specified project for the specified access + role. To use this resource, the requesting API Key must have the Project + Owner role. This API endpoint is one step in a procedure to create + unified access for MongoDB Cloud services. + externalDocs: + description: Set Up Access to Cloud Providers + url: https://www.mongodb.com/docs/atlas/security/cloud-provider-access/ + operationId: authorizeCloudProviderAccessRole + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the role. + in: path + name: roleId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderAccessRole" + description: Grants access to the specified project for the specified access role. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderAccessRole" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Authorize One Cloud Provider Access Role + tags: + - Cloud Provider Access + "/api/atlas/v2/groups/{groupId}/clusters": + get: + description: "Returns the details for all clusters in the specific project to + which you have access. Clusters contain a group of hosts that maintain + the same data set. The response includes multi-cloud clusters. To use + this resource, the requesting API Key must have the Project Read Only + role. This feature is not available for serverless clusters. Deprecated + versions: v2-{2023-01-01}" + operationId: listClusters + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Flag that indicates whether to return Clusters with retain backups. + in: query + name: includeDeletedWithRetainedBackups + schema: + type: boolean + default: false + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/PaginatedAdvancedClusterDescription" + x-xgen-version: 2023-02-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Clusters in One Project + tags: + - Clusters + post: + description: "Creates one cluster in the specified project. Clusters contain a + group of hosts that maintain the same data set. This resource can create + multi-cloud clusters. Each project supports up to 25 database + deployments. To use this resource, the requesting API Key must have the + Project Owner role. This feature is not available for serverless + clusters. Deprecated versions: v2-{2023-01-01}" + operationId: createCluster + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + examples: + Multi Cloud Cluster: + description: Multi Cloud Cluster + value: + clusterType: REPLICASET + links: [] + name: multiCloud + replicationSpecs: + - numShards: 1 + regionConfigs: + - analyticsAutoScaling: + autoIndexing: + enabled: false + compute: + enabled: true + maxInstanceSize: M40 + minInstanceSize: M30 + scaleDownEnabled: true + diskGB: + enabled: true + analyticsSpecs: + instanceSize: M30 + nodeCount: 0 + autoScaling: + autoIndexing: + enabled: false + compute: + enabled: true + maxInstanceSize: M40 + minInstanceSize: M30 + scaleDownEnabled: true + diskGB: + enabled: true + electableSpecs: + instanceSize: M30 + nodeCount: 3 + hiddenSecondarySpecs: + instanceSize: M30 + nodeCount: 0 + priority: 7 + providerName: AWS + readOnlySpecs: + instanceSize: M30 + nodeCount: 0 + regionName: US_EAST_1 + - analyticsAutoScaling: + autoIndexing: + enabled: false + compute: + enabled: true + maxInstanceSize: M40 + minInstanceSize: M30 + scaleDownEnabled: true + diskGB: + enabled: true + analyticsSpecs: + instanceSize: M30 + nodeCount: 0 + autoScaling: + autoIndexing: + enabled: false + compute: + enabled: true + maxInstanceSize: M40 + minInstanceSize: M30 + scaleDownEnabled: true + diskGB: + enabled: true + electableSpecs: + instanceSize: M30 + nodeCount: 2 + hiddenSecondarySpecs: + instanceSize: M30 + nodeCount: 0 + priority: 6 + providerName: GCP + readOnlySpecs: + instanceSize: M30 + nodeCount: 0 + regionName: EASTERN_US + zoneName: Zone 1 + schema: + $ref: "#/components/schemas/AdvancedClusterDescription" + description: Cluster to create in the specific project. + required: true + responses: + "201": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/AdvancedClusterDescription" + x-xgen-version: 2023-02-01 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "402": + $ref: "#/components/responses/paymentRequired" + "403": + $ref: "#/components/responses/forbidden" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Multi-Cloud Cluster from One Project + tags: + - Clusters + "/api/atlas/v2/groups/{groupId}/clusters/provider/regions": + get: + description: Returns the list of regions available for the specified cloud + provider at the specified tier. To use this resource, the requesting API + Key must have the Project Read Only role. + operationId: listCloudProviderRegions + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Cloud providers whose regions to retrieve. When you specify + multiple providers, the response can return only tiers and regions + that support multi-cloud clusters. + in: query + name: providers + schema: + type: array + items: + type: string + - description: Cluster tier for which to retrieve the regions. + in: query + name: tier + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiAtlasProviderRegions" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Cloud Provider Regions + tags: + - Clusters + "/api/atlas/v2/groups/{groupId}/clusters/tenantUpgrade": + post: + description: Upgrades a shared-tier cluster in the specified project. To use + this resource, the requesting API key must have the Project Cluster + Manager role. Each project supports up to 25 clusters. + operationId: upgradeSharedCluster + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LegacyAtlasCluster" + description: Details of the shared-tier cluster upgrade in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LegacyAtlasCluster" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "402": + $ref: "#/components/responses/paymentRequired" + "403": + $ref: "#/components/responses/forbidden" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Upgrade One Shared-tier Cluster + tags: + - Clusters + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/tenantUpgradeToServerless": + post: + description: Upgrades a shared-tier cluster to a serverless instance in the + specified project. To use this resource, the requesting API key must + have the Project Cluster Manager role. + operationId: upgradeSharedClusterToServerless + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessInstanceDescription" + description: Details of the shared-tier cluster upgrade in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessInstanceDescription" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "402": + $ref: "#/components/responses/paymentRequired" + "403": + $ref: "#/components/responses/forbidden" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Upgrades One Shared-Tier Cluster to the Serverless Instance + tags: + - Clusters + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}": + delete: + description: "Removes one cluster with advanced features from the specified + project. The cluster must have termination protection disabled in order + to be deleted. To use this resource, the requesting API Key must have + the Project Owner role. This feature is not available for serverless + clusters. Deprecated versions: v2-{2023-01-01}" + operationId: deleteCluster + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Flag that indicates whether to retain backup snapshots for the + deleted dedicated cluster. + in: query + name: retainBackups + schema: + type: boolean + responses: + "202": + content: + application/vnd.atlas.2023-02-01+json: + x-xgen-version: 2023-02-01 + description: Accepted + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Multi-Cloud Cluster from One Project + tags: + - Clusters + get: + description: "Returns the details for one cluster in the specified project. + Clusters contain a group of hosts that maintain the same data set. The + response includes multi-cloud clusters. To use this resource, the + requesting API Key must have the Project Read Only role. This feature is + not available for serverless clusters. Deprecated versions: + v2-{2023-01-01}" + operationId: getCluster + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/AdvancedClusterDescription" + x-xgen-version: 2023-02-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Multi-Cloud Cluster from One Project + tags: + - Clusters + patch: + description: "Updates the details for one cluster in the specified project. + Clusters contain a group of hosts that maintain the same data set. This + resource can update multi-cloud clusters. To update a cluster's + termination protection, the requesting API Key must have the Project + Owner role. For all other updates, the requesting API Key must have the + Project Cluster Manager role. You can't modify a paused cluster (`paused + : true`). You must call this endpoint to set `paused : false`. After + this endpoint responds with `paused : false`, you can call it again with + the changes you want to make to the cluster. This feature is not + available for serverless clusters. Deprecated versions: v2-{2023-01-01}" + operationId: updateCluster + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/AdvancedClusterDescription" + description: Cluster to update in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/AdvancedClusterDescription" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Modify One Multi-Cloud Cluster from One Project + tags: + - Clusters + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/exports": + get: + description: Returns all Cloud Backup snapshot export jobs associated with the + specified Atlas cluster. To use this resource, the requesting API Key + must have the Project Atlas Admin role. + operationId: listBackupExportJobs + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiAtlasDiskBackupExportJob" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Cloud Backup Snapshot Export Jobs + tags: + - Cloud Backups + post: + description: Exports one backup snapshot for dedicated Atlas cluster using Cloud + Backups to an AWS bucket. To use this resource, the requesting API Key + must have the Project Atlas Admin role. + operationId: createBackupExportJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupExportJobRequest" + description: Information about the Cloud Backup Snapshot Export Job to create. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupExportJob" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Cloud Backup Snapshot Export Job + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/exports/{exportId}": + get: + description: Returns one Cloud Backup snapshot export job associated with the + specified Atlas cluster. To use this resource, the requesting API Key + must have the Project Atlas Admin role. + operationId: getBackupExportJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique string that identifies the AWS S3 bucket to which you export + your snapshots. + in: path + name: exportId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupExportJob" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Cloud Backup Snapshot Export Job + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/restoreJobs": + get: + description: Returns all cloud backup restore jobs for one cluster from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: listBackupRestoreJobs + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster with the restore + jobs you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedCloudBackupRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Restore Jobs for One Cluster + tags: + - Cloud Backups + post: + description: >- + Restores one snapshot of one cluster from the specified project. Atlas + takes on-demand snapshots immediately and scheduled snapshots at regular + intervals. If an on-demand snapshot with a status of **queued** or + **inProgress** exists, before taking another snapshot, wait until Atlas + completes completes processing the previously taken on-demand snapshot. + + To use this resource, the requesting API Key must have the Project Owner role. + operationId: createBackupRestoreJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotRestoreJob" + description: Restores one snapshot of one cluster from the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Restore One Snapshot of One Cluster + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/restoreJobs/{restoreJobId}": + delete: + description: Cancels one cloud backup restore job of one cluster from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: cancelBackupRestoreJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the restore job + to remove. + in: path + name: restoreJobId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "405": + $ref: "#/components/responses/methodNotAllowed" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Cancel One Restore Job of One Cluster + tags: + - Cloud Backups + x-xgen-experimental: true + get: + description: Returns one cloud backup restore job for one cluster from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: getBackupRestoreJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the restore + jobs you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the restore job + to return. + in: path + name: restoreJobId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Restore Job of One Cluster + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/schedule": + delete: + description: Removes all cloud backup schedules for the specified cluster. This + schedule defines when MongoDB Cloud takes scheduled snapshots and how + long it stores those snapshots. To use this resource, the requesting API + Key must have the Project Atlas Admin role. + operationId: deleteAllBackupSchedules + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove All Cloud Backup Schedules + tags: + - Cloud Backups + get: + description: Returns the cloud backup schedule for the specified cluster within + the specified project. This schedule defines when MongoDB Cloud takes + scheduled snapshots and how long it stores those snapshots. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getBackupSchedule + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Cloud Backup Schedule + tags: + - Cloud Backups + patch: + description: Updates the cloud backup schedule for one cluster within the + specified project. This schedule defines when MongoDB Cloud takes + scheduled snapshots and how long it stores those snapshots. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: updateBackupSchedule + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotSchedule" + description: >- + Updates the cloud backup schedule for one cluster within the specified + project. + + + **Note**: In the request body, provide only the fields that you want to update. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Cloud Backup Schedule for One Cluster + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots": + get: + description: Returns all snapshots of one cluster from the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listReplicaSetBackups + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedCloudBackupReplicaSet" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Replica Set Cloud Backups + tags: + - Cloud Backups + post: + description: >- + Takes one on-demand snapshot for the specified cluster. Atlas takes + on-demand snapshots immediately and scheduled snapshots at regular + intervals. If an on-demand snapshot with a status of **queued** or + **inProgress** exists, before taking another snapshot, wait until Atlas + completes completes processing the previously taken on-demand snapshot. + + To use this resource, the requesting API Key must have the Project Owner role. + operationId: takeSnapshot + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupOnDemandSnapshotRequest" + description: Takes one on-demand snapshot. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Take One On-Demand Snapshot + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/shardedCluster/{snapshotId}": + delete: + description: Removes one snapshot of one sharded cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: deleteShardedClusterBackup + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Sharded Cluster Cloud Backup + tags: + - Cloud Backups + x-xgen-experimental: true + get: + description: Returns one snapshot of one sharded cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getShardedClusterBackup + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupShardedClusterSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Sharded Cluster Cloud Backup + tags: + - Cloud Backups + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/shardedClusters": + get: + description: Returns all snapshots of one sharded cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: listShardedClusterBackups + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedCloudBackupShardedClusterSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Sharded Cluster Cloud Backups + tags: + - Cloud Backups + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/{snapshotId}": + delete: + description: Removes the specified snapshot. To use this resource, the + requesting API Key must have the Project Owner role. + operationId: deleteReplicaSetBackup + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Replica Set Cloud Backup + tags: + - Cloud Backups + get: + description: Returns one snapshot from the specified cluster. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getReplicaSetBackup + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupReplicaSet" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Replica Set Cloud Backup + tags: + - Cloud Backups + patch: + description: Changes the expiration date for one cloud backup snapshot for one + cluster in the specified project. + operationId: updateSnapshotRetention + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupSnapshotRetention" + description: Changes the expiration date for one cloud backup snapshot for one + cluster in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DiskBackupReplicaSet" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Change Expiration Date for One Cloud Backup + tags: + - Cloud Backups + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/download": + post: + description: Requests one snapshot for the specified shared cluster. This + resource returns a `snapshotURL` that you can use to download the + snapshot. This `snapshotURL` remains active for four hours after you + make the request. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: downloadSharedClusterBackup + parameters: + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TenantRestore" + description: Snapshot to be downloaded. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TenantRestore" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Download One M2 or M5 Cluster Snapshot + tags: + - Shared-Tier Snapshots + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restore": + post: + description: Restores the specified cluster. MongoDB Cloud limits which clusters + can be the target clusters of a restore. The target cluster can't use + encryption at rest, run a major release MongoDB version different than + the snapshot, or receive client requests during restores. MongoDB Cloud + deletes all existing data on the target cluster prior to the restore + operation. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: createSharedClusterBackupRestoreJob + parameters: + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TenantRestore" + description: The restore job details. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TenantRestore" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Restore Job from One M2 or M5 Cluster + tags: + - Shared-Tier Restore Jobs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restores": + get: + description: Returns all restore jobs for the specified M2 or M5 cluster. + Restore jobs restore a cluster using a snapshot. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: listSharedClusterBackupRestoreJobs + parameters: + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedTenantRestore" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Restore Jobs for One M2 or M5 Cluster + tags: + - Shared-Tier Restore Jobs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restores/{restoreId}": + get: + description: Returns the specified restore job. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: getSharedClusterBackupRestoreJob + parameters: + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the restore job + to return. + in: path + name: restoreId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TenantRestore" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Restore Job for One M2 or M5 Cluster + tags: + - Shared-Tier Restore Jobs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/snapshots": + get: + description: Returns details for all snapshots for the specified shared cluster. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listSharedClusterBackups + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedTenantSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Snapshots for One M2 or M5 Cluster + tags: + - Shared-Tier Snapshots + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/snapshots/{snapshotId}": + get: + description: Returns details for one snapshot for the specified shared cluster. + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getSharedClusterBackup + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupTenantSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Snapshot for One M2 or M5 Cluster + tags: + - Shared-Tier Snapshots + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backupCheckpoints": + get: + deprecated: true + description: Returns all legacy backup checkpoints for one cluster in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: listLegacyBackupCheckpoints + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster that contains the + checkpoints that you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiAtlasCheckpoint" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Legacy Backup Checkpoints + tags: + - Legacy Backup + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backupCheckpoints/{checkpointId}": + get: + deprecated: true + description: Returns one legacy backup checkpoint for one cluster in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: getLegacyBackupCheckpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the checkpoint. + in: path + name: checkpointId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: Human-readable label that identifies the cluster that contains the + checkpoints that you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasCheckpoint" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Legacy Backup Checkpoint + tags: + - Legacy Backup + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes": + post: + description: Creates one Atlas Search index on the specified collection. Atlas + Search indexes define the fields on which to create the index and the + analyzers to use when creating the index. Only clusters running MongoDB + v4.2 or later can use Atlas Search. To use this resource, the requesting + API Key must have the Project Data Access Admin role. + externalDocs: + description: Atlas Search Indexes + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: createAtlasSearchIndex + parameters: + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection on which to create + an Atlas Search index. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + description: Creates one Atlas Search index on the specified collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Atlas Search Index + tags: + - Atlas Search + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{databaseName}/{collectionName}": + get: + description: Returns all Atlas Search indexes on the specified collection. Atlas + Search indexes contain the indexed fields and the analyzers used to + create the indexes. To use this resource, the requesting API Key must + have the Project Data Access Read Write role. + externalDocs: + description: Atlas Search Indexes + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: listAtlasSearchIndexes + parameters: + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection with one or more + Atlas Search indexes. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Name of the collection that contains one or more Atlas Search + indexes. + in: path + name: collectionName + required: true + schema: + type: string + - description: Human-readable label that identifies the database that contains the + collection with one or more Atlas Search indexes. + in: path + name: databaseName + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Atlas Search Indexes for One Collection + tags: + - Atlas Search + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{indexId}": + delete: + description: Removes one Atlas Search index that you identified with its unique + ID. To use this resource, the requesting API Key must have the Project + Data Access Admin role. + externalDocs: + description: Atlas Search Indexes + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: deleteAtlasSearchIndex + parameters: + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the database and collection with + one or more Application Search indexes. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the Atlas Search + index. Use the [Get All Atlas Search Indexes for a Collection + API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) + endpoint to find the IDs of all Atlas Search indexes. + in: path + name: indexId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Atlas Search Index + tags: + - Atlas Search + get: + description: Returns one Atlas Search index in the specified project. You + identify this index using its unique ID. Atlas Search index contains the + indexed fields and the analyzers used to create the index. To use this + resource, the requesting API Key must have the Project Data Access Read + Write role. + externalDocs: + description: Atlas Search Indexes + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: getAtlasSearchIndex + parameters: + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection with one or more + Atlas Search indexes. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the Application + Search + [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). + Use the [Get All Application Search Indexes for a Collection + API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) + endpoint to find the IDs of all Application Search indexes. + in: path + name: indexId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Atlas Search Index + tags: + - Atlas Search + patch: + description: Updates one Atlas Search index that you identified with its unique + ID. Atlas Search indexes define the fields on which to create the index + and the analyzers to use when creating the index. To use this resource, + the requesting API Key must have the Project Data Access Admin role. + externalDocs: + description: Atlas Search Indexes + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: updateAtlasSearchIndex + parameters: + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection whose Atlas Search + index to update. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the Atlas Search + [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). + Use the [Get All Atlas Search Indexes for a Collection + API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) + endpoint to find the IDs of all Atlas Search indexes. + in: path + name: indexId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + description: Details to update on the Atlas Search index. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Atlas Search Index + tags: + - Atlas Search + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites": + get: + description: "Returns one managed namespace within the specified global cluster. + A managed namespace identifies a collection using the database name, the + dot separator, and the collection name. To use this resource, the + requesting API Key must have the Project Read Only role. Deprecated + versions: v2-{2023-01-01}" + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: getManagedNamespace + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Managed Namespace in One Global Multi-Cloud Cluster + tags: + - Global Clusters + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/customZoneMapping": + delete: + description: "Removes all custom zone mappings for the specified global cluster. + A custom zone mapping matches one ISO 3166-2 location code to a zone in + your global cluster. Removing the custom zone mappings restores the + default mapping. By default, MongoDB Cloud maps each location code to + the closest geographical zone. To use this resource, the requesting API + Key must have the Project Owner role. Deprecated versions: + v2-{2023-01-01}" + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: deleteAllCustomZoneMappings + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster + tags: + - Global Clusters + x-xgen-experimental: true + post: + description: "Creates one custom zone mapping for the specified global cluster. + A custom zone mapping matches one ISO 3166-2 location code to a zone in + your global cluster. By default, MongoDB Cloud maps each location code + to the closest geographical zone. To use this resource, the requesting + API Key must have the Project Owner role. Deprecated versions: + v2-{2023-01-01}" + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: createCustomZoneMapping + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/GeoSharding" + description: Custom zone mapping to add to the specified global cluster. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Add One Entry to One Custom Zone Mapping + tags: + - Global Clusters + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/managedNamespaces": + delete: + description: "Removes one managed namespace within the specified global cluster. + A managed namespace identifies a collection using the database name, the + dot separator, and the collection name. Deleting a managed namespace + does not remove the associated collection or data. To use this resource, + the requesting API Key must have the Project Data Access Admin role. + Deprecated versions: v2-{2023-01-01}" + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: deleteManagedNamespace + parameters: + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database that contains the + collection. + in: query + name: db + schema: + type: string + - description: Human-readable label that identifies the collection associated with + the managed namespace. + in: query + name: collection + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Managed Namespace from One Global Multi-Cloud Cluster + tags: + - Global Clusters + x-xgen-experimental: true + post: + description: "Creates one managed namespace within the specified global cluster. + A managed namespace identifies a collection using the database name, the + dot separator, and the collection name. To use this resource, the + requesting API Key must have the Project Data Access Admin role. + Deprecated versions: v2-{2023-01-01}" + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: createManagedNamespace + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies this advanced cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/ManagedNamespace" + description: Managed namespace to create within the specified global cluster. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "405": + $ref: "#/components/responses/methodNotAllowed" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Managed Namespace in One Global Multi-Cloud Cluster + tags: + - Global Clusters + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/index": + post: + description: Creates an index on the cluster identified by its name in a rolling + manner. Creating the index in this way allows index builds on one + replica set member as a standalone at a time, starting with the + secondary members. Creating indexes in this way requires at least one + replica set election. To use this resource, the requesting API Key must + have the Project Data Access Admin role. + externalDocs: + description: Rolling Index Builds on Replica Sets + url: https://docs.mongodb.com/manual/tutorial/build-indexes-on-replica-sets/ + operationId: createRollingIndex + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster on which MongoDB + Cloud creates an index. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DatabaseRollingIndexRequest" + description: Rolling index to create on the specified cluster. + required: true + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: Accepted + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Rolling Index + tags: + - Rolling Index + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives": + get: + description: Returns details of all online archives. This archive stores data + from one cluster within one project. To use this resource, the + requesting API Key must have the Project Read Only role. + externalDocs: + description: Online Archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: listOnlineArchives + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster that contains the + collection for which you want to return the online archives. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedOnlineArchive" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Online Archives for One Cluster + tags: + - Online Archive + post: + description: Creates one online archive. This archive stores data from one + cluster within one project. To use this resource, the requesting API Key + must have the Project Data Access Admin role. + externalDocs: + description: Online Archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: createOnlineArchive + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster that contains the + collection for which you want to create one online archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupOnlineArchiveCreate" + description: Creates one online archive. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupOnlineArchive" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Online Archive + tags: + - Online Archive + x-xgen-changelog: + 2023-08-02: If 'criteria':'DATE' is specified, then you must specify 'DATE' + values in partition fields + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives/queryLogs.gz": + get: + description: Downloads query logs for the specified online archive. To use this + resource, the requesting API Key must have the Project Data Access Read + Only or higher role. + externalDocs: + description: Online Archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: downloadOnlineArchiveQueryLogs + parameters: + - $ref: "#/components/parameters/groupId" + - description: Date and time that specifies the starting point for the range of + log messages to return. This resource expresses this value in the + number of seconds that have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + in: query + name: startDate + schema: + type: integer + format: int64 + example: 1636481348 + minimum: 1199145600 + - description: Date and time that specifies the end point for the range of log + messages to return. This resource expresses this value in the number + of seconds that have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + in: query + name: endDate + schema: + type: integer + format: int64 + example: 1636481348 + minimum: 1199145600 + - description: Human-readable label that identifies the cluster that contains the + collection for which you want to return the query logs from one + online archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Flag that indicates whether to download logs for queries against + your online archive only or both your online archive and cluster. + in: query + name: archiveOnly + schema: + type: boolean + default: false + responses: + "200": + content: + application/vnd.atlas.2023-01-01+gzip: + schema: + type: string + format: binary + description: This resource downloads a compressed log file to your current + working directory. You can specify its name using the + `--output` option or use the default filename using the `-OJ` + option. The default filename varies based on whether you + download logs for queries of your online archive only or both + your online archive and cluster. + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Download Online Archive Query Logs + tags: + - Online Archive + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives/{archiveId}": + delete: + description: Removes one online archive. This archive stores data from one + cluster within one project. To use this resource, the requesting API Key + must have the Project Data Access Admin role. + externalDocs: + description: Online Archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: deleteOnlineArchive + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the online + archive to delete. + in: path + name: archiveId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: Human-readable label that identifies the cluster that contains the + collection from which you want to remove an online archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Online Archive + tags: + - Online Archive + get: + description: Returns one online archive for one cluster. This archive stores + data from one cluster within one project. To use this resource, the + requesting API Key must have the Project Read Only role. + externalDocs: + description: Online Archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: getOnlineArchive + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the online + archive to return. + in: path + name: archiveId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: Human-readable label that identifies the cluster that contains the + specified collection from which Application created the online + archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupOnlineArchive" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Online Archive + tags: + - Online Archive + patch: + description: Updates, pauses, or resumes one online archive. This archive stores + data from one cluster within one project. To use this resource, the + requesting API Key must have the Project Data Access Admin role. + externalDocs: + description: Online Archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + operationId: updateOnlineArchive + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the online + archive to update. + in: path + name: archiveId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: Human-readable label that identifies the cluster that contains the + specified collection from which Application created the online + archive. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupOnlineArchive" + description: Updates, pauses, or resumes one online archive. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupOnlineArchive" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Online Archive + tags: + - Online Archive + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/outageSimulation": + delete: + description: Ends a cluster outage simulation. + externalDocs: + description: Cluster Outage Simulation + url: https://dochub.mongodb.org/core/test-regional-outage + operationId: endOutageSimulation + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster that is undergoing + outage simulation. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterOutageSimulation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: End an Outage Simulation + tags: + - Cluster Outage Simulation + x-xgen-experimental: true + get: + description: Returns one outage simulation for one cluster. + externalDocs: + description: Cluster Outage Simulation + url: https://dochub.mongodb.org/core/test-regional-outage + operationId: getOutageSimulation + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster that is undergoing + outage simulation. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterOutageSimulation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Outage Simulation + tags: + - Cluster Outage Simulation + x-xgen-experimental: true + post: + description: Starts a cluster outage simulation. + externalDocs: + description: Cluster Outage Simulation + url: https://dochub.mongodb.org/core/test-regional-outage + operationId: startOutageSimulation + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to undergo an + outage simulation. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterOutageSimulation" + description: Describes the outage simulation. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterOutageSimulation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Start an Outage Simulation + tags: + - Cluster Outage Simulation + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/processArgs": + get: + description: Returns the advanced configuration details for one cluster in the + specified project. Clusters contain a group of hosts that maintain the + same data set. Advanced configuration details include the read/write + concern, index and oplog limits, and other database settings. This + feature isn't available for `M0` free clusters, `M2` and `M5` + shared-tier clusters, or serverless clusters. To use this resource, the + requesting API Key must have the Project Read Only role. + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: getClusterAdvancedConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterDescriptionProcessArgs" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Advanced Configuration Options for One Cluster + tags: + - Clusters + patch: + description: Updates the advanced configuration details for one cluster in the + specified project. Clusters contain a group of hosts that maintain the + same data set. Advanced configuration details include the read/write + concern, index and oplog limits, and other database settings. To use + this resource, the requesting API Key must have the Project Cluster + Manager role. This feature isn't available for `M0` free clusters, `M2` + and `M5` shared-tier clusters, or serverless clusters. + externalDocs: + description: Global Clusters + url: https://www.mongodb.com/docs/atlas/global-clusters/ + operationId: updateClusterAdvancedConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterDescriptionProcessArgs" + description: Advanced configuration details to add for one cluster in the + specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterDescriptionProcessArgs" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Advanced Configuration Options for One Cluster + tags: + - Clusters + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restartPrimaries": + post: + description: "Starts a failover test for the specified cluster in the specified + project. Clusters contain a group of hosts that maintain the same data + set. A failover test checks how MongoDB Cloud handles the failure of the + cluster's primary node. During the test, MongoDB Cloud shuts down the + primary node and elects a new primary. To use this resource, the + requesting API Key must have the Project Cluster Manager role. + Deprecated versions: v2-{2023-01-01}" + operationId: testFailover + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + x-xgen-version: 2023-02-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Test Failover for One Multi-Cloud Cluster + tags: + - Clusters + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs": + get: + deprecated: true + description: >- + Returns all legacy backup restore jobs for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). If you use the `BATCH-ID` query parameter, you can retrieve all restore jobs in the specified batch. When creating a restore job for a sharded cluster, MongoDB Cloud creates a separate job for each shard, plus another for the config server. Each of those jobs are part of a batch. However, a batch can't include a restore job for a replica set. + operationId: listLegacyBackupRestoreJobs + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies the batch of + restore jobs to return. Timestamp in ISO 8601 date and time format + in UTC when creating a restore job for a sharded cluster, + Application creates a separate job for each shard, plus another for + the config host. Each of these jobs comprise one batch. A restore + job for a replica set can't be part of a batch. + in: query + name: batchId + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Legacy Backup Restore Jobs + tags: + - Legacy Backup + x-xgen-experimental: true + post: + deprecated: true + description: Restores one legacy backup for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. Effective 23 March 2020, all new clusters can use + only Cloud Backups. When you upgrade to 4.2, your backup system upgrades + to cloud backup if it is currently set to legacy backup. After this + upgrade, all your existing legacy backup snapshots remain available. + They expire over time in accordance with your retention policy. Your + backup policy resets to the default schedule. If you had a custom backup + policy in place with legacy backups, you must re-create it with the + procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + This endpoint doesn't support creating checkpoint restore jobs for + sharded clusters, or creating restore jobs for queryable backup + snapshots. If you create an automated restore job by specifying + `delivery.methodName` of `AUTOMATED_RESTORE` in your request body, + MongoDB Cloud removes all existing data on the target cluster prior to + the restore. + operationId: createLegacyBackupRestoreJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupRestoreJob" + description: Legacy backup to restore to one cluster in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Legacy Backup Restore Job + tags: + - Legacy Backup Restore Jobs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs/{jobId}": + get: + deprecated: true + description: >- + Returns one legacy backup restore job for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: getLegacyBackupRestoreJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the restore job. + in: path + name: jobId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Legacy Backup Restore Job + tags: + - Legacy Backup + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshotSchedule": + get: + deprecated: true + description: >- + Returns the snapshot schedule for one cluster in the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: getLegacySnapshotSchedule + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Snapshot Schedule + tags: + - Legacy Backup + x-xgen-experimental: true + patch: + deprecated: true + description: >- + Updates the snapshot schedule for one cluster in the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: updateLegacySnapshotSchedule + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + description: Update the snapshot schedule for one cluster in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Snapshot Schedule for One Cluster + tags: + - Legacy Backup + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots": + get: + deprecated: true + description: Returns all legacy backup snapshots for one cluster in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. Effective 23 March 2020, all new + clusters can use only Cloud Backups. When you upgrade to 4.2, your + backup system upgrades to cloud backup if it is currently set to legacy + backup. After this upgrade, all your existing legacy backup snapshots + remain available. They expire over time in accordance with your + retention policy. Your backup policy resets to the default schedule. If + you had a custom backup policy in place with legacy backups, you must + re-create it with the procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: listLegacySnapshots + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Human-readable label that specifies whether to return only + completed, incomplete, or all snapshots. By default, MongoDB Cloud + only returns completed snapshots. + in: query + name: completed + schema: + type: string + default: "true" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Legacy Backup Snapshots + tags: + - Legacy Backup + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots/{snapshotId}": + delete: + deprecated: true + description: Removes one legacy backup snapshot for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. Effective 23 March 2020, all new clusters can use + only Cloud Backups. When you upgrade to 4.2, your backup system upgrades + to cloud backup if it is currently set to legacy backup. After this + upgrade, all your existing legacy backup snapshots remain available. + They expire over time in accordance with your retention policy. Your + backup policy resets to the default schedule. If you had a custom backup + policy in place with legacy backups, you must re-create it with the + procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: deleteLegacySnapshot + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Legacy Backup Snapshot + tags: + - Legacy Backup + x-xgen-experimental: true + get: + deprecated: true + description: Returns one legacy backup snapshot for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. Effective 23 March 2020, all new clusters can + use only Cloud Backups. When you upgrade to 4.2, your backup system + upgrades to cloud backup if it is currently set to legacy backup. After + this upgrade, all your existing legacy backup snapshots remain + available. They expire over time in accordance with your retention + policy. Your backup policy resets to the default schedule. If you had a + custom backup policy in place with legacy backups, you must re-create it + with the procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: getLegacySnapshot + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Legacy Backup Snapshot + tags: + - Legacy Backup + x-xgen-experimental: true + patch: + deprecated: true + description: Changes the expiration date for one legacy backup snapshot for one + cluster in the specified project. To use this resource, the requesting + API Key must have the Project Owner role. Effective 23 March 2020, all + new clusters can use only Cloud Backups. When you upgrade to 4.2, your + backup system upgrades to cloud backup if it is currently set to legacy + backup. After this upgrade, all your existing legacy backup snapshots + remain available. They expire over time in accordance with your + retention policy. Your backup policy resets to the default schedule. If + you had a custom backup policy in place with legacy backups, you must + re-create it with the procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: updateLegacySnapshotRetention + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupSnapshot" + description: Changes One Legacy Backup Snapshot Expiration. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BackupSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Change One Legacy Backup Snapshot Expiration + tags: + - Legacy Backup + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/status": + get: + description: Returns the status of all changes that you made to the specified + cluster in the specified project. Use this resource to check the + progress MongoDB Cloud has made in processing your changes. The response + does not include the deployment of new dedicated clusters. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getClusterStatus + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterStatus" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Status of All Cluster Operations + tags: + - Clusters + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{hostName}/logs/{logName}.gz": + get: + description: "Returns a compressed (.gz) log file that contains a range of log + messages for the specified host for the specified project. MongoDB + updates process and audit logs from the cluster backend infrastructure + every five minutes and contain log data from the previous five minutes. + If you poll the API for log files, we recommend polling every five + minutes. For example, if the logs are updated at 4:00 UTC and then you + poll the API, the API returns log data from the interval between 3:55 + UTC and 4:00 UTC. This feature isn't available for `M0` free clusters, + `M2`, `M5`, or serverless clusters. To use this resource, the requesting + API Key must have the Project Data Access Read Only or higher role. + Deprecated versions: v2-{2023-01-01}" + operationId: getHostLogs + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the host that stores the log + files that you want to download. + in: path + name: hostName + required: true + schema: + type: string + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + - description: Human-readable label that identifies the log file that you want to + return. To return audit logs, enable *Database Auditing* for the + specified project. + in: path + name: logName + required: true + schema: + type: string + externalDocs: + description: Set up Database Auditing + url: https://docs.atlas.mongodb.com/database-auditing/ + - description: Date and time when the period specifies the inclusive ending point + for the range of log messages to retrieve. This parameter expresses + its value in the number of seconds that have elapsed since the UNIX + epoch. + in: query + name: endDate + schema: + type: integer + format: int64 + minimum: 1199145600 + - description: Date and time when the period specifies the inclusive starting + point for the range of log messages to retrieve. This parameter + expresses its value in the number of seconds that have elapsed since + the UNIX epoch. + in: query + name: startDate + schema: + type: integer + format: int64 + minimum: 1199145600 + responses: + "200": + content: + application/vnd.atlas.2023-02-01+gzip: + schema: + type: string + format: binary + description: Compressed (.gz) log file that contains a range of log messages for + the specified host for the specified project + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Download Logs for One Cluster Host in One Project + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/containers": + get: + description: Returns details about all network peering containers in the + specified project for the specified cloud provider. If you do not + specify the cloud provider, MongoDB Cloud returns details about all + network peering containers in the project for Amazon Web Services (AWS). + To use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listPeeringContainerByCloudProvider + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Cloud service provider that serves the desired network peering + containers. + in: query + name: providerName + required: true + schema: + type: string + default: AWS + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedCloudProviderContainer" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Network Peering Containers in One Project for One Cloud + Provider + tags: + - Network Peering + post: + description: Creates one new network peering container in the specified project. + MongoDB Cloud can deploy Network Peering connections in a network + peering container. GCP can have one container per project. AWS and Azure + can have one container per cloud provider region. To use this resource, + the requesting API Key must have the Project Owner role. + operationId: createPeeringContainer + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderContainer" + description: Creates one new network peering container in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderContainer" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One New Network Peering Container + tags: + - Network Peering + "/api/atlas/v2/groups/{groupId}/containers/all": + get: + description: Returns details about all network peering containers in the + specified project. Network peering containers contain network peering + connections. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: listPeeringContainers + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedCloudProviderContainer" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Network Peering Containers in One Project + tags: + - Network Peering + "/api/atlas/v2/groups/{groupId}/containers/{containerId}": + delete: + description: Removes one network peering container in the specified project. To + use this resource, the requesting API Key must have the Project Owner + role. + operationId: deletePeeringContainer + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud network container that you want to remove. + in: path + name: containerId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Network Peering Container + tags: + - Network Peering + get: + description: Returns details about one network peering container in one + specified project. Network peering containers contain network peering + connections. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getPeeringContainer + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud network container that you want to remove. + in: path + name: containerId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderContainer" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Network Peering Container + tags: + - Network Peering + patch: + description: Updates the network details and labels of one specified network + peering container in the specified project. To use this resource, the + requesting API Key must have the Project Owner role. + operationId: updatePeeringContainer + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud network container that you want to remove. + in: path + name: containerId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderContainer" + description: Updates the network details and labels of one specified network + peering container in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderContainer" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Network Peering Container + tags: + - Network Peering + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/customDBRoles/roles": + get: + description: Returns all custom roles for the specified project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: listCustomDatabaseRoles + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/UserCustomDBRole" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Custom Roles in One Project + tags: + - Custom Database Roles + post: + description: Creates one custom role in the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: createCustomDatabaseRole + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserCustomDBRole" + description: Creates one custom role in the specified project. + required: true + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserCustomDBRole" + x-xgen-version: 2023-01-01 + description: Accepted + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Custom Role + tags: + - Custom Database Roles + "/api/atlas/v2/groups/{groupId}/customDBRoles/roles/{roleName}": + delete: + description: Removes one custom role from the specified project. You can't + remove a custom role that would leave one or more child roles with no + parent roles or actions. You also can't remove a custom role that would + leave one or more database users without roles. To use this resource, + the requesting API Key must have the Project Atlas Admin role. + operationId: deleteCustomDatabaseRole + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the role for the request. This + name must be unique for this custom role in this project. + in: path + name: roleName + required: true + schema: + type: string + pattern: ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(? + Human-readable label that identifies this data federation instance + limit. + + + | Limit Name | Description | Default | + + | --- | --- | --- | + + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | + + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | + + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | + + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | + in: path + name: limitName + required: true + schema: + type: string + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Delete One Query Limit For One Federated Database Instance + tags: + - Data Federation + get: + description: Returns the details of one query limit for the specified federated + database instance in the specified project. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: returnFederatedDatabaseQueryLimit + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the federated database + instance to which the query limit applies. + in: path + name: tenantName + required: true + schema: + type: string + - description: > + Human-readable label that identifies this data federation instance + limit. + + + | Limit Name | Description | Default | + + | --- | --- | --- | + + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | + + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | + + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | + + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | + in: path + name: limitName + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataFederationTenantQueryLimit" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Federated Database Instance Query Limit for One Project + tags: + - Data Federation + patch: + description: Creates or updates one query limit for one federated database + instance. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: createOneDataFederationQueryLimit + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the federated database + instance to which the query limit applies. + in: path + name: tenantName + required: true + schema: + type: string + - description: > + Human-readable label that identifies this data federation instance + limit. + + + | Limit Name | Description | Default | + + | --- | --- | --- | + + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | + + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | + + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | + + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | + in: path + name: limitName + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataFederationTenantQueryLimit" + description: Creates or updates one query limit for one federated database instance. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataFederationTenantQueryLimit" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Configure One Query Limit for One Federated Database Instance + tags: + - Data Federation + "/api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/queryLogs.gz": + get: + description: Downloads the query logs for the specified federated database + instance. To use this resource, the requesting API Key must have the + Project Owner or Project Data Access Read Write roles. + operationId: downloadFederatedDatabaseQueryLogs + parameters: + - $ref: "#/components/parameters/groupId" + - description: Timestamp that specifies the end point for the range of log + messages to download. MongoDB Cloud expresses this timestamp in the + number of seconds that have elapsed since the UNIX epoch. + in: query + name: endDate + schema: + type: integer + format: int64 + example: 1636481348 + pattern: "1199145600" + - description: Timestamp that specifies the starting point for the range of log + messages to download. MongoDB Cloud expresses this timestamp in the + number of seconds that have elapsed since the UNIX epoch. + in: query + name: startDate + schema: + type: integer + format: int64 + example: 1636466948 + pattern: "1199145600" + - description: Human-readable label that identifies the federated database + instance for which you want to download query logs. + in: path + name: tenantName + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+gzip: + schema: + type: string + format: binary + description: Compressed archive labeled `queryLogs.gz` downloads + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Download Query Logs for One Federated Database Instance + tags: + - Data Federation + "/api/atlas/v2/groups/{groupId}/databaseUsers": + get: + description: Returns all database users that belong to the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. + operationId: listDatabaseUsers + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiAtlasDatabaseUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Database Users from One Project + tags: + - Database Users + post: + description: Creates one database user in the specified project. This MongoDB + Cloud supports a maximum of 100 database users per project. If you + require more than 100 database users on a project, contact + [Support](https://cloud.mongodb.com/support). To use this resource, the + requesting API Key must have the Project Owner or Project Charts Admin + roles. + operationId: createDatabaseUser + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + examples: + AWS IAM Authentication: + description: AWS IAM Authentication + value: + awsIAMType: USER + databaseName: $external + groupId: 32b6e34b3d91647abb20e7b8 + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: arn:aws:iam::358363220050:user/mongodb-aws-iam-auth-test-user + Federated Authentication: + description: Federated Authentication + value: + databaseName: admin + groupId: 32b6e34b3d91647abb20e7b8 + oidcAuthType: IDP_GROUP + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: 5dd7496c7a3e5a648454341c/sales + LDAP Authentication: + description: LDAP Authentication + value: + databaseName: admin + groupId: 32b6e34b3d91647abb20e7b8 + ldapAuthType: GROUP + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: CN=marketing,OU=groups,DC=example,DC=com + SCRAM-SHA Authentication: + description: SCRAM-SHA Authentication + value: + databaseName: admin + groupId: 32b6e34b3d91647abb20e7b8 + password: changeme123 + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: david + X509 Authentication: + description: X509 Authentication + value: + databaseName: $external + groupId: 32b6e34b3d91647abb20e7b8 + roles: + - databaseName: sales + roleName: readWrite + - databaseName: marketing + roleName: read + scopes: + - name: myCluster + type: CLUSTER + username: CN=david@example.com,OU=users,DC=example,DC=com + x509Type: CUSTOMER + schema: + $ref: "#/components/schemas/CloudDatabaseUser" + description: Creates one database user in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudDatabaseUser" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Database User in One Project + tags: + - Database Users + "/api/atlas/v2/groups/{groupId}/databaseUsers/{databaseName}/{username}": + delete: + description: Removes one database user from the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: deleteDatabaseUser + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database against which the + database user authenticates. Database users must provide both a + username and authentication database to log into MongoDB. If the + user authenticates with AWS IAM, x.509, or LDAP, this value should + be `$external`. If the user authenticates with SCRAM-SHA or OIDC, + this value should be `admin`. + in: path + name: databaseName + required: true + schema: + type: string + - description: > + Human-readable label that represents the user that authenticates to + MongoDB. The format of this label depends on the method of + authentication: + + + | Authentication Method | Parameter Needed | Parameter Value | username Format | + + |---|---|---|---| + + | AWS IAM | awsType | ROLE | ARN | + + | AWS IAM | awsType | USER | ARN | + + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | + + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | + in: path + name: username + required: true + schema: + type: string + example: "SCRAM-SHA: dylan or AWS IAM: + arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or + x.509/LDAP: CN=Dylan + Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: + IdPIdentifier/IdPGroupName" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Database User from One Project + tags: + - Database Users + get: + description: Returns one database user that belong to the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. + operationId: getDatabaseUser + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database against which the + database user authenticates. Database users must provide both a + username and authentication database to log into MongoDB. If the + user authenticates with AWS IAM, x.509, or LDAP, this value should + be `$external`. If the user authenticates with SCRAM-SHA or OIDC, + this value should be `admin`. + in: path + name: databaseName + required: true + schema: + type: string + - description: > + Human-readable label that represents the user that authenticates to + MongoDB. The format of this label depends on the method of + authentication: + + + | Authentication Method | Parameter Needed | Parameter Value | username Format | + + |---|---|---|---| + + | AWS IAM | awsType | ROLE | ARN | + + | AWS IAM | awsType | USER | ARN | + + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | + + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | + in: path + name: username + required: true + schema: + type: string + example: "SCRAM-SHA: dylan or AWS IAM: + arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or + x.509/LDAP: CN=Dylan + Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: + IdPIdentifier/IdPGroupName" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudDatabaseUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Database User from One Project + tags: + - Database Users + patch: + description: Updates one database user that belongs to the specified project. To + use this resource, the requesting API Key must have the Project Owner or + Project Charts Admin roles. + operationId: updateDatabaseUser + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database against which the + database user authenticates. Database users must provide both a + username and authentication database to log into MongoDB. If the + user authenticates with AWS IAM, x.509, or LDAP, this value should + be `$external`. If the user authenticates with SCRAM-SHA or OIDC, + this value should be `admin`. + in: path + name: databaseName + required: true + schema: + type: string + - description: > + Human-readable label that represents the user that authenticates to + MongoDB. The format of this label depends on the method of + authentication: + + + | Authentication Method | Parameter Needed | Parameter Value | username Format | + + |---|---|---|---| + + | AWS IAM | awsType | ROLE | ARN | + + | AWS IAM | awsType | USER | ARN | + + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | + + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | + in: path + name: username + required: true + schema: + type: string + example: "SCRAM-SHA: dylan or AWS IAM: + arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or + x.509/LDAP: CN=Dylan + Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: + IdPIdentifier/IdPGroupName" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudDatabaseUser" + description: Updates one database user that belongs to the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudDatabaseUser" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Database User in One Project + tags: + - Database Users + "/api/atlas/v2/groups/{groupId}/databaseUsers/{username}/certs": + get: + description: Returns all unexpired X.509 certificates for the specified MongoDB + user. This MongoDB user belongs to one project. Atlas manages these + certificates and the MongoDB user. To use this resource, the requesting + API Key must have the Project Read Only role. + operationId: listDatabaseUserCertificates + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that represents the MongoDB database user + account whose certificates you want to return. + in: path + name: username + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedUserCert" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All X.509 Certificates Assigned to One MongoDB User + tags: + - X.509 Authentication + post: + description: >- + Generates one X.509 certificate for the specified MongoDB user. Atlas + manages the certificate and MongoDB user that belong to one project. To + use this resource, the requesting API Key must have the Project Owner + role. + + + To get MongoDB Cloud to generate a managed certificate for a database user, set `"x509Type" : "MANAGED"` on the desired MongoDB Database User. + + + If you are managing your own Certificate Authority (CA) in Self-Managed X.509 mode, you must generate certificates for database users using your own CA. + externalDocs: + description: Self-Managed X.509 + url: https://www.mongodb.com/docs/atlas/security-self-managed-x509/#std-label-self-managed-x509 + operationId: createDatabaseUserCertificate + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that represents the MongoDB database user + account for whom to create a certificate. + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserCert" + description: Generates one X.509 certificate for the specified MongoDB user. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: string + description: PEM file that contains the user's X.509 certificate and private + key. + x-xgen-version: 2023-01-01 + description: This endpoint returns a PEM file with the certificate and private + key. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One X.509 Certificate for One MongoDB User + tags: + - X.509 Authentication + "/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}": + get: + description: Returns the access logs of one cluster identified by the cluster's + name. Access logs contain a list of authentication requests made against + your cluster. You can't use this feature on tenant-tier clusters (M0, + M2, M5). To use this resource, the requesting API Key must have the + Project Monitoring Admin role. + externalDocs: + description: Database Access History + url: https://docs.atlas.mongodb.com/access-tracking/ + operationId: listAccessLogsByClusterName + parameters: + - $ref: "#/components/parameters/groupId" + - description: Flag that indicates whether the response returns the successful + authentication attempts only. + in: query + name: authResult + schema: + type: boolean + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Date and time when to stop retrieving database history. If you + specify **end**, you must also specify **start**. This parameter + uses UNIX epoch time in milliseconds. + in: query + name: end + schema: + type: integer + format: int64 + - description: One Internet Protocol address that attempted to authenticate with + the database. + in: query + name: ipAddress + schema: + type: string + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + - description: Maximum number of lines from the log to return. + in: query + name: nLogs + schema: + type: integer + format: int32 + default: 20000 + maximum: 20000 + minimum: 0 + - description: Date and time when MongoDB Cloud begins retrieving database + history. If you specify **start**, you must also specify **end**. + This parameter uses UNIX epoch time in milliseconds. + in: query + name: start + schema: + type: integer + format: int64 + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/MongoDBAccessLogsList" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Database Access History for One Cluster using Its Cluster Name + tags: + - Access Tracking + "/api/atlas/v2/groups/{groupId}/dbAccessHistory/processes/{hostname}": + get: + description: Returns the access logs of one cluster identified by the cluster's + hostname. Access logs contain a list of authentication requests made + against your clusters. You can't use this feature on tenant-tier + clusters (M0, M2, M5). To use this resource, the requesting API Key must + have the Project Monitoring Admin role. + externalDocs: + description: Database Access History + url: https://docs.atlas.mongodb.com/access-tracking/ + operationId: listAccessLogsByHostname + parameters: + - $ref: "#/components/parameters/groupId" + - description: Flag that indicates whether the response returns the successful + authentication attempts only. + in: query + name: authResult + schema: + type: boolean + - description: Date and time when to stop retrieving database history. If you + specify **end**, you must also specify **start**. This parameter + uses UNIX epoch time in milliseconds. + in: query + name: end + schema: + type: integer + format: int64 + - description: Fully qualified domain name or IP address of the MongoDB host that + stores the log files that you want to download. + in: path + name: hostname + required: true + schema: + type: string + - description: One Internet Protocol address that attempted to authenticate with + the database. + in: query + name: ipAddress + schema: + type: string + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + - description: Maximum number of lines from the log to return. + in: query + name: nLogs + schema: + type: integer + format: int32 + default: 20000 + maximum: 20000 + minimum: 0 + - description: Date and time when MongoDB Cloud begins retrieving database + history. If you specify **start**, you must also specify **end**. + This parameter uses UNIX epoch time in milliseconds. + in: query + name: start + schema: + type: integer + format: int64 + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/MongoDBAccessLogsList" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Database Access History for One Cluster using Its Hostname + tags: + - Access Tracking + "/api/atlas/v2/groups/{groupId}/encryptionAtRest": + get: + description: >- + Returns the configuration for encryption at rest using the keys you + manage through your cloud provider. MongoDB Cloud encrypts all storage + even if you don't use your own key management. This resource requires + the requesting API Key to have the Project Owner role. + + + **LIMITED TO M10 OR GREATER:** MongoDB Cloud limits this feature to dedicated cluster tiers of M10 and greater. + operationId: getEncryptionAtRest + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/EncryptionAtRest" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Configuration for Encryption at Rest using Customer-Managed + Keys for One Project + tags: + - Encryption at Rest using Customer Key Management + patch: + description: >- + Updates the configuration for encryption at rest using the keys you + manage through your cloud provider. MongoDB Cloud encrypts all storage + even if you don't use your own key management. This resource requires + the requesting API Key to have the Project Owner role. This feature + isn't available for `M0` free clusters, `M2`, `M5`, or serverless + clusters. + + After you configure at least one Encryption at Rest using a Customer Key Management provider for the MongoDB Cloud project, Project Owners can enable Encryption at Rest using Customer Key Management for each MongoDB Cloud cluster for which they require encryption. The Encryption at Rest using Customer Key Management provider doesn't have to match the cluster cloud service provider. MongoDB Cloud doesn't automatically rotate user-managed encryption keys. Defer to your preferred Encryption at Rest using Customer Key Management provider's documentation and guidance for best practices on key rotation. MongoDB Cloud automatically creates a 90-day key rotation alert when you configure Encryption at Rest using Customer Key Management using your Key Management in an MongoDB Cloud project. MongoDB Cloud encrypts all storage whether or not you use your own key management. + operationId: updateEncryptionAtRest + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/EncryptionAtRest" + description: >- + Required parameters depend on whether someone has enabled Encryption + at Rest using Customer Key Management: + + + If you have enabled Encryption at Rest using Customer Key Management (CMK), Atlas requires all of the parameters for the desired encryption provider. + + + - To use AWS Key Management Service (KMS), MongoDB Cloud requires all the fields in the **awsKms** object. + + - To use Azure Key Vault, MongoDB Cloud requires all the fields in the **azureKeyVault** object. + + - To use Google Cloud Key Management Service (KMS), MongoDB Cloud requires all the fields in the **googleCloudKms** object. + + + If you enabled Encryption at Rest using Customer Key Management, administrators can pass only the changed fields for the **awsKms**, **azureKeyVault**, or **googleCloudKms** object to update the configuration to this endpoint. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/EncryptionAtRest" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Configuration for Encryption at Rest using Customer-Managed Keys + for One Project + tags: + - Encryption at Rest using Customer Key Management + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/events": + get: + description: >- + Returns one event for the specified project. Events identify significant + database, billing, or security activities or status changes. To use this + resource, the requesting API Key must have the Project Read Only role. + + + This resource remains under revision and may change. + operationId: listProjectEvents + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster. + in: query + name: clusterNames + schema: + type: array + items: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + style: form + - description: >- + Category of incident recorded at this moment in time. + + + **IMPORTANT**: The complete list of event type values changes frequently. + in: query + name: eventType + schema: + type: array + items: + $ref: "#/components/schemas/EventTypeForNdsGroup" + - description: >- + Category of event that you would like to exclude from query results, + such as CLUSTER_CREATED + + + **IMPORTANT**: Event type names change frequently. Verify that you specify the event type correctly by checking the complete list of event types. + in: query + name: excludedEventType + schema: + type: array + items: + $ref: "#/components/schemas/EventTypeForNdsGroup" + - description: Flag that indicates whether to include the raw document in the + output. The raw document contains additional meta information about + the event. + in: query + name: includeRaw + schema: + type: boolean + default: false + - description: Date and time from when MongoDB Cloud stops returning events. This + parameter uses the ISO 8601 timestamp + format in UTC. + in: query + name: maxDate + schema: + type: string + format: date-time + - description: Date and time from when MongoDB Cloud starts returning events. This + parameter uses the ISO 8601 timestamp + format in UTC. + in: query + name: minDate + schema: + type: string + format: date-time + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupPaginatedEvent" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Events from One Project + tags: + - Events + "/api/atlas/v2/groups/{groupId}/events/{eventId}": + get: + description: >- + Returns one event for the specified project. Events identify significant + database, billing, or security activities or status changes. To use this + resource, the requesting API Key must have the Project Read Only role. + + + This resource remains under revision and may change. + operationId: getProjectEvent + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the event that + you want to return. Use the + [/events](#tag/Events/operation/listProjectEvents) endpoint to + retrieve all events to which the authenticated user has access. + in: path + name: eventId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: Flag that indicates whether to include the raw document in the + output. The raw document contains additional meta information about + the event. + in: query + name: includeRaw + schema: + type: boolean + default: false + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/EventViewForNdsGroup" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Event from One Project + tags: + - Events + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics": + get: + description: Returns all Atlas Search metric types available for one process in + the specified project. You must have the Project Read Only or higher + role to view the Atlas Search metric types. + operationId: listMetricTypes + parameters: + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudSearchMetrics" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Atlas Search Metric Types for One Process + tags: + - Monitoring and Logs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/indexes/{databaseName}/{collectionName}/measurements": + get: + description: Returns the Atlas Search index metrics within the specified time + range for one namespace in the specified process. + operationId: listIndexMetrics + parameters: + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/databaseName" + - $ref: "#/components/parameters/collectionName" + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - description: List that contains the measurements that MongoDB Atlas reports for + the associated data series. + in: query + name: metrics + required: true + schema: + type: array + description: List that contains the measurements that MongoDB Atlas reports for + the associated data series. + items: + type: string + maxItems: 10 + uniqueItems: true + style: form + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/MeasurementsIndexes" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Atlas Search Index Metrics for One Namespace + tags: + - Monitoring and Logs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/indexes/{databaseName}/{collectionName}/{indexName}/measurements": + get: + description: Returns the Atlas Search metrics data series within the provided + time range for one namespace and index name on the specified process. + You must have the Project Read Only or higher role to view the Atlas + Search metric types. + operationId: getIndexMetrics + parameters: + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/indexName" + - $ref: "#/components/parameters/databaseName" + - $ref: "#/components/parameters/collectionName" + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - description: List that contains the measurements that MongoDB Atlas reports for + the associated data series. + in: query + name: metrics + required: true + schema: + type: array + description: List that contains the measurements that MongoDB Atlas reports for + the associated data series. + items: + type: string + maxItems: 10 + uniqueItems: true + style: form + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/MeasurementsIndexes" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Atlas Search Metrics for One Index in One Specified Namespace + tags: + - Monitoring and Logs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/measurements": + get: + description: Returns the Atlas Search hardware and status data series within the + provided time range for one process in the specified project. You must + have the Project Read Only or higher role to view the Atlas Search + metric types. + operationId: getMeasurements + parameters: + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - description: List that contains the metrics that you want MongoDB Atlas to + report for the associated data series. If you don't set this + parameter, this resource returns all hardware and status metrics for + the associated data series. + in: query + name: metrics + required: true + schema: + type: array + description: List that contains the metrics that you want MongoDB Atlas to + report for the associated data series. If you don't set this + parameter, this resource returns all hardware and status metrics + for the associated data series. + items: + type: string + maxItems: 10 + uniqueItems: true + style: form + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/MeasurementsNonIndex" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Atlas Search Hardware and Status Metrics + tags: + - Monitoring and Logs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/integrations": + get: + description: Returns the settings that permit integrations with all configured + third-party services. These settings apply to all databases managed in + one MongoDB Cloud project. To use this resource, the requesting API Key + must have the Organization Owner or Project Owner role. + operationId: listThirdPartyIntegrations + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedIntegration" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Active Third-Party Service Integrations + tags: + - Third-Party Integrations + "/api/atlas/v2/groups/{groupId}/integrations/{integrationType}": + delete: + description: Removes the settings that permit configuring one third-party + service integration. These settings apply to all databases managed in + one MongoDB Cloud project. If you delete an integration from a project, + you remove that integration configuration only for that project. This + action doesn't affect any other project or organization's configured + `{INTEGRATION-TYPE}` integrations. To use this resource, the requesting + API Key must have the Organization Owner or Project Owner role. + operationId: deleteThirdPartyIntegration + parameters: + - description: Human-readable label that identifies the service which you want to + integrate with MongoDB Cloud. + in: path + name: integrationType + required: true + schema: + type: string + title: Integration Type + - $ref: "#/components/parameters/groupId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Third-Party Service Integration + tags: + - Third-Party Integrations + get: + description: Returns the settings for configuring integration with one + third-party service. These settings apply to all databases managed in + one MongoDB Cloud project. To use this resource, the requesting API Key + must have the Organization Owner or Project Owner role. + operationId: getThirdPartyIntegration + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the service which you want to + integrate with MongoDB Cloud. + in: path + name: integrationType + required: true + schema: + type: string + title: Integration Type + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ThridPartyIntegration" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Third-Party Service Integration + tags: + - Third-Party Integrations + post: + description: Adds the settings for configuring one third-party service + integration. These settings apply to all databases managed in the + specified MongoDB Cloud project. Each project can have only one + configuration per `{INTEGRATION-TYPE}`. To use this resource, the + requesting API Key must have the Organization Owner or Project Owner + role. + operationId: createThirdPartyIntegration + parameters: + - description: Human-readable label that identifies the service which you want to + integrate with MongoDB Cloud. + in: path + name: integrationType + required: true + schema: + type: string + title: Integration Type + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ThridPartyIntegration" + description: Third-party integration that you want to configure for your project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedIntegration" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Configure One Third-Party Service Integration + tags: + - Third-Party Integrations + put: + description: Updates the settings for configuring integration with one + third-party service. These settings apply to all databases managed in + one MongoDB Cloud project. To use this resource, the requesting API Key + must have the Organization Owner or Project Owner role. + operationId: updateThirdPartyIntegration + parameters: + - description: Human-readable label that identifies the service which you want to + integrate with MongoDB Cloud. + in: path + name: integrationType + required: true + schema: + type: string + title: Integration Type + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ThridPartyIntegration" + description: Third-party integration that you want to configure for your project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedIntegration" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Third-Party Service Integration + tags: + - Third-Party Integrations + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/invites": + get: + description: Returns all pending invitations to the specified project. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: listProjectInvitations + parameters: + - $ref: "#/components/parameters/groupId" + - description: Email address of the user account invited to this project. + in: query + name: username + schema: + type: string + format: email + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Project Invitations + tags: + - Projects + patch: + description: Updates the details of one pending invitation to the specified + project. To specify which invitation to update, provide the username of + the invited user. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: updateProjectInvitation + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupInvitationRequest" + description: Updates the details of one pending invitation to the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Project Invitation + tags: + - Projects + post: + description: Invites one MongoDB Cloud user to join the specified project. The + MongoDB Cloud user must accept the invitation to access information + within the specified project. To use this resource, the requesting API + Key must have the Project Owner role. + operationId: createProjectInvitation + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupInvitationRequest" + description: Invites one MongoDB Cloud user to join the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Invite One MongoDB Cloud User to Join One Project + tags: + - Projects + "/api/atlas/v2/groups/{groupId}/invites/{invitationId}": + delete: + description: Cancels one pending invitation sent to the specified MongoDB Cloud + user to join a project. You can't cancel an invitation that the user + accepted. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: deleteProjectInvitation + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Cancel One Project Invitation + tags: + - Projects + get: + description: Returns the details of one pending invitation to the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: getProjectInvitation + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Project Invitation + tags: + - Projects + patch: + description: Updates the details of one pending invitation to the specified + project. To specify which invitation to update, provide the unique + identification string for that invitation. Use the Return All Project + Invitations endpoint to retrieve IDs for all pending project + invitations. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: updateProjectInvitationById + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupInvitationUpdateRequest" + description: Updates the details of one pending invitation to the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Project Invitation by Invitation ID + tags: + - Projects + "/api/atlas/v2/groups/{groupId}/limits": + get: + description: Returns all the limits for the specified project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: listProjectLimits + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/DataFederationLimit" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Limits for One Project + tags: + - Projects + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/limits/{limitName}": + delete: + description: Removes the specified project limit. Depending on the limit, Atlas + either resets the limit to its default value or removes the limit + entirely. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: deleteProjectLimit + parameters: + - description: > + Human-readable label that identifies this project limit. + + + | Limit Name | Description | Default | API Override Limit | + + | --- | --- | --- | --- | + + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | + + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | + + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | + + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | + + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | + + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | + + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | + + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | + + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | + + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | + + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| + + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + in: path + name: limitName + required: true + schema: + type: string + - $ref: "#/components/parameters/groupId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Project Limit + tags: + - Projects + x-xgen-experimental: true + get: + description: Returns the specified limit for the specified project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getProjectLimit + parameters: + - description: > + Human-readable label that identifies this project limit. + + + | Limit Name | Description | Default | API Override Limit | + + | --- | --- | --- | --- | + + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | + + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | + + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | + + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | + + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | + + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | + + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | + + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | + + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | + + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | + + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| + + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + in: path + name: limitName + required: true + schema: + type: string + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataFederationLimit" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Limit for One Project + tags: + - Projects + x-xgen-experimental: true + patch: + description: >- + Sets the specified project limit. To use this resource, the requesting + API Key must have the Project Owner role. + + + **NOTE**: Increasing the following configuration limits might lead to slower response times in the MongoDB Cloud UI or increased user management overhead leading to authentication or authorization re-architecture. If possible, we recommend that you create additional projects to gain access to more of these resources for a more sustainable growth pattern. + operationId: setProjectLimit + parameters: + - description: > + Human-readable label that identifies this project limit. + + + | Limit Name | Description | Default | API Override Limit | + + | --- | --- | --- | --- | + + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | + + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | + + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | + + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | + + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | + + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | + + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | + + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | + + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | + + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | + + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| + + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + in: path + name: limitName + required: true + schema: + type: string + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataFederationLimit" + description: Limit to update. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataFederationLimit" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Set One Project Limit + tags: + - Projects + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/liveMigrations": + post: + description: >- + Migrate one cluster that Cloud or Ops Manager manages to MongoDB Atlas. + + Please make sure to [validate](#tag/Cloud-Migration-Service/operation/validateOneMigration) your migration before initiating it. + + You can use this API endpoint for push live migrations only. Your API Key must have the Organization Owner role to successfully call this resource. + operationId: createPushMigration + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LiveMigrationRequest" + description: One migration to be created. + required: true + responses: + "201": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LiveMigrationResponse" + x-xgen-version: 2023-01-01 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Migrate One Local Managed Cluster to MongoDB Atlas + tags: + - Cloud Migration Service + "/api/atlas/v2/groups/{groupId}/liveMigrations/validate": + post: + description: Verifies whether the provided credentials, available disk space, + MongoDB versions, and so on meet the requirements of the migration + request. If the check passes, the migration can proceed. Your API Key + must have the Organization Owner role to successfully call this + resource. + operationId: validateMigration + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LiveMigrationRequest" + description: One migration to be validated. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LiveImportValidation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Validate One Migration Request + tags: + - Cloud Migration Service + "/api/atlas/v2/groups/{groupId}/liveMigrations/validate/{validationId}": + get: + description: Return the status of one migration validation job. Your API Key + must have the Organization Owner role to successfully call this + resource. + operationId: getValidationStatus + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the validation + job. + in: path + name: validationId + required: true + schema: + type: string + example: 507f1f77bcf86cd799439011 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LiveImportValidation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Migration Validation Job + tags: + - Cloud Migration Service + "/api/atlas/v2/groups/{groupId}/liveMigrations/{liveMigrationId}": + get: + description: Return details of one cluster migration job. Each push live + migration job uses one migration host. Your API Key must have the + Organization Member role to successfully call this resource. + operationId: getPushMigration + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/liveMigrationId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LiveMigrationResponse" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Migration Job + tags: + - Cloud Migration Service + "/api/atlas/v2/groups/{groupId}/liveMigrations/{liveMigrationId}/cutover": + put: + description: Cut over the migrated cluster to MongoDB Atlas. Confirm when the + cut over completes. When the cut over completes, MongoDB Atlas completes + the live migration process and stops synchronizing with the source + cluster. Your API Key must have the Organization Owner role to + successfully call this resource. + operationId: cutoverMigration + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/liveMigrationId" + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: Accepted. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Cut Over the Migrated Cluster + tags: + - Cloud Migration Service + "/api/atlas/v2/groups/{groupId}/maintenanceWindow": + delete: + description: Resets the maintenance window for the specified project. To use + this resource, the requesting API Key must have the Project Owner role. + Urgent maintenance activities such as security patches can't wait for + your chosen window. MongoDB Cloud starts those maintenance activities + when needed. After you schedule maintenance for your cluster, you can't + change your maintenance window until the current maintenance efforts + complete. The maintenance procedure that MongoDB Cloud performs requires + at least one replica set election during the maintenance window per + replica set. Maintenance always begins as close to the scheduled hour as + possible, but in-progress cluster updates or unexpected system issues + could delay the start time. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: resetMaintenanceWindow + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Reset One Maintenance Window for One Project + tags: + - Maintenance Windows + get: + description: Returns the maintenance window for the specified project. MongoDB + Cloud starts those maintenance activities when needed. You can't change + your maintenance window until the current maintenance efforts complete. + The maintenance procedure that MongoDB Cloud performs requires at least + one replica set election during the maintenance window per replica set. + Maintenance always begins as close to the scheduled hour as possible, + but in-progress cluster updates or unexpected system issues could delay + the start time. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: getMaintenanceWindow + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupMaintenanceWindow" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Maintenance Window for One Project + tags: + - Maintenance Windows + patch: + description: Updates the maintenance window for the specified project. Urgent + maintenance activities such as security patches can't wait for your + chosen window. MongoDB Cloud starts those maintenance activities when + needed. After you schedule maintenance for your cluster, you can't + change your maintenance window until the current maintenance efforts + complete. The maintenance procedure that MongoDB Cloud performs requires + at least one replica set election during the maintenance window per + replica set. Maintenance always begins as close to the scheduled hour as + possible, but in-progress cluster updates or unexpected system issues + could delay the start time. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: updateMaintenanceWindow + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupMaintenanceWindow" + description: Updates the maintenance window for the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Maintenance Window for One Project + tags: + - Maintenance Windows + "/api/atlas/v2/groups/{groupId}/maintenanceWindow/autoDefer": + post: + description: Toggles automatic deferral of the maintenance window for the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: toggleMaintenanceAutoDefer + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Toggle Automatic Deferral of Maintenance for One Project + tags: + - Maintenance Windows + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/maintenanceWindow/defer": + post: + description: Defers the maintenance window for the specified project. Urgent + maintenance activities such as security patches can't wait for your + chosen window. MongoDB Cloud starts those maintenance activities when + needed. After you schedule maintenance for your cluster, you can't + change your maintenance window until the current maintenance efforts + complete. The maintenance procedure that MongoDB Cloud performs requires + at least one replica set election during the maintenance window per + replica set. Maintenance always begins as close to the scheduled hour as + possible, but in-progress cluster updates or unexpected system issues + could delay the start time. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: deferMaintenanceWindow + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Defer One Maintenance Window for One Project + tags: + - Maintenance Windows + "/api/atlas/v2/groups/{groupId}/managedSlowMs/disable": + delete: + description: Disables the slow operation threshold that MongoDB Cloud calculated + for the specified project. The threshold determines which operations the + Performance Advisor and Query Profiler considers slow. When enabled, + MongoDB Cloud uses the average execution time for operations on your + cluster to determine slow-running queries. As a result, the threshold is + more pertinent to your cluster workload. The slow operation threshold is + enabled by default for dedicated clusters (M10+). When disabled, MongoDB + Cloud considers any operation that takes longer than 100 milliseconds to + be slow. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: disableSlowOperationThresholding + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Disable Managed Slow Operation Threshold + tags: + - Performance Advisor + "/api/atlas/v2/groups/{groupId}/managedSlowMs/enable": + post: + description: Enables MongoDB Cloud to use its slow operation threshold for the + specified project. The threshold determines which operations the + Performance Advisor and Query Profiler considers slow. When enabled, + MongoDB Cloud uses the average execution time for operations on your + cluster to determine slow-running queries. As a result, the threshold is + more pertinent to your cluster workload. The slow operation threshold is + enabled by default for dedicated clusters (M10+). When disabled, MongoDB + Cloud considers any operation that takes longer than 100 milliseconds to + be slow. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: enableSlowOperationThresholding + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Enable Managed Slow Operation Threshold + tags: + - Performance Advisor + "/api/atlas/v2/groups/{groupId}/peers": + get: + description: Returns details about all network peering connections in the + specified project. Network peering allows multiple cloud-hosted + applications to securely connect to the same project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: listPeeringConnections + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Cloud service provider to use for this VPC peering connection. + in: query + name: providerName + schema: + type: string + default: AWS + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedContainerPeer" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Network Peering Connections in One Project + tags: + - Network Peering + post: + description: Creates one new network peering connection in the specified + project. Network peering allows multiple cloud-hosted applications to + securely connect to the same project. To use this resource, the + requesting API Key must have the Project Owner role. To learn more about + considerations and prerequisites, see the Network Peering Documentation. + externalDocs: + description: Azure Network Peering Prerequisites + url: https://docs.atlas.mongodb.com/reference/api/vpc-create-peering-connection/#prerequisites + operationId: createPeeringConnection + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + description: Create one network peering connection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One New Network Peering Connection + tags: + - Network Peering + "/api/atlas/v2/groups/{groupId}/peers/{peerId}": + delete: + description: Removes one network peering connection in the specified project. If + you Removes the last network peering connection associated with a + project, MongoDB Cloud also removes any AWS security groups from the + project IP access list. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: deletePeeringConnection + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the network + peering connection that you want to delete. + in: path + name: peerId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/RequestAccepted" + x-xgen-version: 2023-01-01 + description: Accepted + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Existing Network Peering Connection + tags: + - Network Peering + get: + description: Returns details about one specified network peering connection in + the specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: getPeeringConnection + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the network + peering connection that you want to retrieve. + in: path + name: peerId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Network Peering Connection in One Project + tags: + - Network Peering + patch: + description: Updates one specified network peering connection in the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: updatePeeringConnection + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the network + peering connection that you want to update. + in: path + name: peerId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + description: Modify one network peering connection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One New Network Peering Connection + tags: + - Network Peering + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/pipelines": + get: + description: Returns a list of Data Lake Pipelines. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listPipelines + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Data Lake Pipelines from One Project + tags: + - Data Lake Pipelines + post: + description: Creates one Data Lake Pipeline. + operationId: createPipeline + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataLakeIngestionPipeline" + description: Creates one Data Lake Pipeline. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Data Lake Pipeline + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}": + delete: + description: Removes one Data Lake Pipeline. + operationId: deletePipeline + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Data Lake Pipeline + tags: + - Data Lake Pipelines + get: + description: Returns the details of one Data Lake Pipeline within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getPipeline + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Data Lake Pipeline + tags: + - Data Lake Pipelines + patch: + description: Updates one Data Lake Pipeline. + operationId: updatePipeline + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataLakeIngestionPipeline" + description: Updates one Data Lake Pipeline. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Data Lake Pipeline + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/availableSchedules": + get: + description: Returns a list of backup schedule policy items that you can use as + a Data Lake Pipeline source. To use this resource, the requesting API + Key must have the Project Read Only role. + operationId: listPipelineSchedules + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/DiskBackupApiPolicyItem" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Available Ingestion Schedules for One Data Lake Pipeline + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/availableSnapshots": + get: + description: Returns a list of backup snapshots that you can use to trigger an + on demand pipeline run. To use this resource, the requesting API Key + must have the Project Read Only role. + operationId: listPipelineSnapshots + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Date and time after which MongoDB Cloud created the snapshot. If + specified, MongoDB Cloud returns available backup snapshots created + after this time and date only. This parameter expresses its value in + the ISO 8601 timestamp format in UTC. + in: query + name: completedAfter + schema: + type: string + format: date-time + example: 2022-01-01T00:00:00Z + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedBackupSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Available Backup Snapshots for One Data Lake Pipeline + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/pause": + post: + description: Pauses ingestion for a Data Lake Pipeline within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: pausePipeline + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Pause One Data Lake Pipeline + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/resume": + post: + description: Resumes ingestion for a Data Lake Pipeline within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: resumePipeline + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Resume One Data Lake Pipeline + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/runs": + get: + description: Returns a list of past Data Lake Pipeline runs. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: listPipelineRuns + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: If specified, Atlas returns only Data Lake Pipeline runs initiated + before this time and date. + in: query + name: createdBefore + schema: + type: string + format: date-time + example: 2022-01-01T00:00:00Z + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedPipelineRun" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Data Lake Pipeline Runs from One Project + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/runs/{pipelineRunId}": + delete: + description: Deletes dataset that Atlas generated during the specified pipeline run. + operationId: deletePipelineRunDataset + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + - description: Unique 24-hexadecimal character string that identifies a Data Lake + Pipeline run. + in: path + name: pipelineRunId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/RequestAccepted" + x-xgen-version: 2023-01-01 + description: Accepted + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Delete Pipeline Run Dataset + tags: + - Data Lake Pipelines + get: + description: Returns the details of one Data Lake Pipeline run within the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: getPipelineRun + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + - description: Unique 24-hexadecimal character string that identifies a Data Lake + Pipeline run. + in: path + name: pipelineRunId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/IngestionPipelineRun" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Data Lake Pipeline Run + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/trigger": + post: + description: Triggers a Data Lake Pipeline ingestion of a specified snapshot. + operationId: triggerSnapshotIngestion + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Data Lake Pipeline. + in: path + name: pipelineName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[^/\\ "$]{1,64}$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TriggerIngestionPipelineRequest" + description: Triggers a single ingestion run of a snapshot. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/IngestionPipelineRun" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Trigger on demand snapshot ingestion + tags: + - Data Lake Pipelines + "/api/atlas/v2/groups/{groupId}/privateEndpoint/endpointService": + post: + description: Creates one private endpoint service for the specified cloud + service provider. This cloud service provider manages the private + endpoint service for the project. When you create a private endpoint + service, MongoDB Cloud creates a network container in the project for + the cloud provider for which you create the private endpoint service if + one doesn't already exist. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: createPrivateEndpointService + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudProviderEndpointServiceRequest" + description: Creates one private endpoint for the specified cloud service provider. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/EndpointService" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Private Endpoint Service for One Provider + tags: + - Private Endpoint Services + "/api/atlas/v2/groups/{groupId}/privateEndpoint/regionalMode": + get: + description: Checks whether each region in the specified cloud service provider + can create multiple private endpoints per region. The cloud service + provider manages the private endpoint for the project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getRegionalizedPrivateEndpointSetting + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ProjectSettingItem" + x-xgen-version: 2023-01-01 + description: OK + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Regionalized Private Endpoint Status + tags: + - Private Endpoint Services + patch: + description: Enables or disables the ability to create multiple private + endpoints per region in all cloud service providers in one project. The + cloud service provider manages the private endpoints for the project. + Connection strings to existing multi-region and global sharded clusters + change when you enable this setting. You must update your applications + to use the new connection strings. This might cause downtime. To use + this resource, the requesting API Key must have the Project Owner role + and all clusters in the deployment must be sharded clusters. Once + enabled, you cannot create replica sets. + operationId: toggleRegionalizedPrivateEndpointSetting + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ProjectSettingItem" + description: Enables or disables the ability to create multiple private + endpoints per region in all cloud service providers in one project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ProjectSettingItem" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Toggle Regionalized Private Endpoint Status + tags: + - Private Endpoint Services + "/api/atlas/v2/groups/{groupId}/privateEndpoint/serverless/instance/{instanceName}/endpoint": + get: + description: Returns all private endpoints for one serverless instance. You must + have at least the Project Read Only role for the project to successfully + call this resource. + operationId: listServerlessPrivateEndpoints + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance + associated with the tenant endpoint. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/ServerlessTenantEndpoint" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Private Endpoints for One Serverless Instance + tags: + - Serverless Private Endpoints + post: + description: >- + Creates one private endpoint for one serverless instance. To use this + resource, the requesting API Key must have the Project Owner role. + + A new endpoint won't be immediately available after creation. Read the steps in the linked tutorial for detailed guidance. + externalDocs: + description: Set Up a Private Endpoint for a Serverless Instance Tutorial + url: https://dochub.mongodb.org/core/serverless-private-endpoint + operationId: createServerlessPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance for + which the tenant endpoint will be created. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessTenantCreateRequest" + description: Information about the Private Endpoint to create for the Serverless + Instance. + required: true + responses: + "201": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessTenantEndpoint" + x-xgen-version: 2023-01-01 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Private Endpoint for One Serverless Instance + tags: + - Serverless Private Endpoints + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/privateEndpoint/serverless/instance/{instanceName}/endpoint/{endpointId}": + delete: + description: Remove one private endpoint from one serverless instance. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: deleteServerlessPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance from + which the tenant endpoint will be removed. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the tenant + endpoint which will be removed. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Private Endpoint for One Serverless Instance + tags: + - Serverless Private Endpoints + x-xgen-experimental: true + get: + description: Return one private endpoint for one serverless instance. Identify + this endpoint using its unique ID. You must have at least the Project + Read Only role for the project to successfully call this resource. + operationId: getServerlessPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance + associated with the tenant endpoint. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the tenant + endpoint. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessTenantEndpoint" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Private Endpoint for One Serverless Instance + tags: + - Serverless Private Endpoints + x-xgen-experimental: true + patch: + description: Updates one private endpoint for one serverless instance. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: updateServerlessPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance + associated with the tenant endpoint that will be updated. + in: path + name: instanceName + required: true + schema: + type: string + maxLength: 64 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the tenant + endpoint which will be updated. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessTenantEndpointUpdate" + description: Object used for update. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessTenantEndpoint" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Private Endpoint for One Serverless Instance + tags: + - Serverless Private Endpoints + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService": + get: + description: Returns the name, interfaces, and state of all private endpoint + services for the specified cloud service provider. This cloud service + provider manages the private endpoint service for the project. To use + this resource, the requesting API Key must have the Project Read Only + role. + operationId: listPrivateEndpointServices + parameters: + - $ref: "#/components/parameters/groupId" + - description: Cloud service provider that manages this private endpoint service. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/EndpointService" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Private Endpoint Services for One Provider + tags: + - Private Endpoint Services + "/api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}": + delete: + description: Removes one private endpoint service from the specified project. + This cloud service provider manages the private endpoint service that + belongs to the project. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: deletePrivateEndpointService + parameters: + - $ref: "#/components/parameters/groupId" + - description: Cloud service provider that manages this private endpoint service. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: Unique 24-hexadecimal digit string that identifies the private + endpoint service that you want to delete. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Private Endpoint Service for One Provider + tags: + - Private Endpoint Services + get: + description: Returns the name, interfaces, and state of the specified private + endpoint service from one project. The cloud service provider hosted + this private endpoint service that belongs to the project. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getPrivateEndpointService + parameters: + - $ref: "#/components/parameters/groupId" + - description: Cloud service provider that manages this private endpoint service. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: Unique 24-hexadecimal digit string that identifies the private + endpoint service that you want to return. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/EndpointService" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Private Endpoint Service for One Provider + tags: + - Private Endpoint Services + "/api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}/endpoint": + post: + description: Creates one private endpoint for the specified cloud service + provider. This cloud service provider manages the private endpoint + service, which in turn manages the private endpoints for the project. To + use this resource, the requesting API Key must have the Project Owner + role. To learn more about considerations, limitations, and + prerequisites, see the MongoDB documentation for setting up a private + endpoint. + operationId: createPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Cloud service provider that manages this private endpoint. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: Unique 24-hexadecimal digit string that identifies the private + endpoint service for which you want to create a private endpoint. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CreateEndpointRequest" + description: Creates one private endpoint for the specified cloud service provider. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PrivateLinkEndpoint" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "402": + $ref: "#/components/responses/paymentRequired" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Private Endpoint for One Provider + tags: + - Private Endpoint Services + "/api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}/endpoint/{endpointId}": + delete: + description: Removes one private endpoint from the specified project and private + endpoint service, as managed by the specified cloud service provider. + When the last private endpoint is removed from a given private endpoint + service, that private endpoint service is also removed. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: deletePrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Cloud service provider that manages this private endpoint. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: Unique string that identifies the private endpoint you want to + delete. The format of the **endpointId** parameter differs for AWS + and Azure. You must URL encode the **endpointId** for Azure private + endpoints. + in: path + name: endpointId + required: true + schema: + type: string + pattern: ^vpce-[0-9a-f]{17}|^%2[fF]subscriptions%2[fF][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]resource[gG]roups%2[fF]([-\w._()]+)%2[fF]providers%2[fF]Microsoft\.Network%2[fF]privateEndpoints%2[fF]([-\w._()]+) + - description: Unique 24-hexadecimal digit string that identifies the private + endpoint service from which you want to delete a private endpoint. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Private Endpoint for One Provider + tags: + - Private Endpoint Services + get: + description: Returns the connection state of the specified private endpoint. The + private endpoint service manages this private endpoint which belongs to + one project hosted from one cloud service provider. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Cloud service provider that manages this private endpoint. + in: path + name: cloudProvider + required: true + schema: + type: string + default: AWS + - description: Unique string that identifies the private endpoint you want to + return. The format of the **endpointId** parameter differs for AWS + and Azure. You must URL encode the **endpointId** for Azure private + endpoints. + in: path + name: endpointId + required: true + schema: + type: string + pattern: ^vpce-[0-9a-f]{17}|^%2[fF]subscriptions%2[fF][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]resource[gG]roups%2[fF]([-\w._()]+)%2[fF]providers%2[fF]Microsoft\.Network%2[fF]privateEndpoints%2[fF]([-\w._()]+) + - description: Unique 24-hexadecimal digit string that identifies the private + endpoint service for which you want to return a private endpoint. + in: path + name: endpointServiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PrivateLinkEndpoint" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Private Endpoint for One Provider + tags: + - Private Endpoint Services + "/api/atlas/v2/groups/{groupId}/privateIpMode": + get: + deprecated: true + description: Verifies if someone set the specified project to **Connect via + Peering Only** mode. To use this resource, the requesting API Key must + have the Project Read Only role. + externalDocs: + description: Changes to Connection Strings + url: https://docs.atlas.mongodb.com/reference/faq/connection-changes/ + operationId: verifyConnectViaPeeringOnlyModeForOneProject + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PrivateIPMode" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Verify Connect via Peering Only Mode for One Project + tags: + - Network Peering + x-xgen-experimental: true + patch: + deprecated: true + description: Disables Connect via Peering Only mode for the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + externalDocs: + description: Changes to Connection Strings + url: https://docs.atlas.mongodb.com/reference/faq/connection-changes/ + operationId: disablePeering + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PrivateIPMode" + description: Disables Connect via Peering Only mode for the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PrivateIPMode" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Disable Connect via Peering Only Mode for One Project + tags: + - Network Peering + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/privateNetworkSettings/endpointIds": + get: + description: Returns all private endpoints for Federated Database Instances and + Online Archives in the specified project. To use this resource, the + requesting API Key must have the Project Read Only or Project Charts + Admin roles. + operationId: listDataFederationPrivateEndpoints + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedPrivateNetworkEndpointIdEntry" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Federated Database Instance and Online Archive Private + Endpoints in One Project + tags: + - Data Federation + post: + description: >- + Adds one private endpoint for Federated Database Instances and Online + Archives to the specified projects. If the endpoint ID already exists + and the associated comment is unchanged, Atlas Data Federation makes no + change to the endpoint ID list. If the endpoint ID already exists and + the associated comment is changed, Atlas Data Federation updates the + comment value only in the endpoint ID list. If the endpoint ID doesn't + exist, Atlas Data Federation appends the new endpoint to the list of + endpoints in the endpoint ID list. Each region has an associated service + name for the various endpoints in each region. + + `us-east-1` is `com.amazonaws.vpce.us-east-1.vpce-svc-00e311695874992b4`. + + `us-west-1` is `com.amazonaws.vpce.us-west-2.vpce-svc-09d86b19e59d1b4bb`. + + `eu-west-1` is `com.amazonaws.vpce.eu-west-1.vpce-svc-0824460b72e1a420e`. + + `eu-west-2` is `com.amazonaws.vpce.eu-west-2.vpce-svc-052f1840aa0c4f1f9`. + + `eu-central-1` is `com.amazonaws.vpce.eu-central-1.vpce-svc-0ac8ce91871138c0d`. + + `sa-east-1` is `com.amazonaws.vpce.sa-east-1.vpce-svc-0b56e75e8cdf50044`. + + `ap-southeast-2` is `com.amazonaws.vpce.ap-southeast-2.vpce-svc-036f1de74d761706e`. + + `ap-south-1` is `com.amazonaws.vpce.ap-south-1.vpce-svc-03eb8a541f96d356d`. + + To use this resource, the requesting API Key must have the Project Owner or Project Charts Admin roles. + operationId: createDataFederationPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PrivateNetworkEndpointIdEntry" + description: Private endpoint for Federated Database Instances and Online + Archives to add to the specified project. + required: true + responses: + "201": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedPrivateNetworkEndpointIdEntry" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Federated Database Instance and Online Archive Private + Endpoint for One Project + tags: + - Data Federation + "/api/atlas/v2/groups/{groupId}/privateNetworkSettings/endpointIds/{endpointId}": + delete: + description: Removes one private endpoint for Federated Database Instances and + Online Archives in the specified project. To use this resource, the + requesting API Key must have the Project Owner role. + operationId: deleteDataFederationPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 22-character alphanumeric string that identifies the private + endpoint to remove. Atlas Data Federation supports AWS private + endpoints using the AWS PrivateLink feature. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 22 + minLength: 22 + pattern: ^vpce-[0-9a-f]{17}$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Federated Database Instance and Online Archive Private + Endpoint from One Project + tags: + - Data Federation + get: + description: Returns the specified private endpoint for Federated Database + Instances or Online Archives in the specified project. To use this + resource, the requesting API Key must have the Project Read Only or + Project Charts Admin roles. + operationId: getDataFederationPrivateEndpoint + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 22-character alphanumeric string that identifies the private + endpoint to return. Atlas Data Federation supports AWS private + endpoints using the AWS PrivateLink feature. + in: path + name: endpointId + required: true + schema: + type: string + maxLength: 22 + minLength: 22 + pattern: ^vpce-[0-9a-f]{17}$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PrivateNetworkEndpointIdEntry" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Federated Database Instance and Online Archive Private + Endpoint in One Project + tags: + - Data Federation + "/api/atlas/v2/groups/{groupId}/processes": + get: + description: Returns details of all processes for the specified project. A + MongoDB process can be either a `mongod` or `mongos`. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: listAtlasProcesses + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedHostView_Atlas" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All MongoDB Processes in One Project + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/processes/{processId}": + get: + description: Returns the processes for the specified host for the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getAtlasProcess + parameters: + - $ref: "#/components/parameters/groupId" + - description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiHostView_Atlas" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One MongoDB Process by ID + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/processes/{processId}/databases": + get: + description: Returns the list of databases running on the specified host for the + specified project. `M0` free clusters, `M2`, `M5`, and serverless + clusters have some [operational + limits](https://www.mongodb.com/docs/atlas/reference/free-shared-limitations/#operational-limitations). + The MongoDB Cloud process must be a `mongod`. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listDatabases + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod`). The port must be the IANA port on which the MongoDB + process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedDatabase" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Available Databases for One MongoDB Process + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/processes/{processId}/databases/{databaseName}": + get: + description: Returns one database running on the specified host for the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: getDatabase + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database that the + specified MongoDB process serves. + in: path + name: databaseName + required: true + schema: + type: string + - description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/MesurementsDatabase" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Database for a MongoDB Process + tags: + - Monitoring and Logs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/processes/{processId}/databases/{databaseName}/measurements": + get: + description: Returns the measurements of one database for the specified host for + the specified project. Returns the database's on-disk storage space + based on the MongoDB `dbStats` command output. To calculate some metric + series, Atlas takes the rate between every two adjacent points. For + these metric series, the first data point has a null value because Atlas + can't calculate a rate for the first data point given the query time + range. Atlas retrieves database metrics every 20 minutes but reduces + frequency when necessary to optimize database performance. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getDatabaseMeasurements + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database that the + specified MongoDB process serves. + in: path + name: databaseName + required: true + schema: + type: string + - description: One or more types of measurement to request for this MongoDB + process. If omitted, the resource returns all measurements. To + specify multiple values for `m`, repeat the `m` parameter for each + value. Specify measurements that apply to the specified host. + MongoDB Cloud returns an error if you specified any invalid + measurements. + in: query + name: m + schema: + type: array + items: + type: string + description: One measurement requested for this MongoDB process. + maxItems: 10 + minItems: 1 + uniqueItems: true + style: form + - description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiMeasurementsGeneralView_Atlas" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + summary: Return Measurements of One Database for One MongoDB Process + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/processes/{processId}/disks": + get: + description: Returns the list of disks or partitions for the specified host for + the specified project. To use this resource, the requesting API Key must + have the Project Read Only role. + operationId: listDiskPartitions + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedDiskPartition" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Available Disks for One MongoDB Process + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/processes/{processId}/disks/{partitionName}": + get: + description: Returns measurement details for one disk or partition for the + specified host for the specified project. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listDiskMeasurements + parameters: + - description: Human-readable label of the disk or partition to which the + measurements apply. + in: path + name: partitionName + required: true + schema: + type: string + - $ref: "#/components/parameters/groupId" + - description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/MeasurementDiskPartition" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Measurements of One Disk + tags: + - Monitoring and Logs + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/processes/{processId}/disks/{partitionName}/measurements": + get: + description: >- + Returns the measurements of one disk or partition for the specified host + for the specified project. Returned value can be one of the following: + + - Throughput of I/O operations for the disk partition used for the MongoDB process + + - Percentage of time during which requests the partition issued and serviced + + - Latency per operation type of the disk partition used for the MongoDB process + + - Amount of free and used disk space on the disk partition used for the MongoDB process + + + To use this resource, the requesting API Key must have the Project Read Only role. + operationId: getDiskMeasurements + parameters: + - $ref: "#/components/parameters/groupId" + - description: One or more types of measurement to request for this MongoDB + process. If omitted, the resource returns all measurements. To + specify multiple values for `m`, repeat the `m` parameter for each + value. Specify measurements that apply to the specified host. + MongoDB Cloud returns an error if you specified any invalid + measurements. + in: query + name: m + schema: + type: array + items: + type: string + description: One measurement requested for this MongoDB process. + maxItems: 10 + minItems: 1 + uniqueItems: true + style: form + - description: Human-readable label of the disk or partition to which the + measurements apply. + in: path + name: partitionName + required: true + schema: + type: string + - description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiMeasurementsGeneralView_Atlas" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Measurements of One Disk for One MongoDB Process + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/processes/{processId}/measurements": + get: + description: >- + Returns disk, partition, or host measurements per process for the + specified host for the specified project. Returned value can be one of + the following: + + - Throughput of I/O operations for the disk partition used for the MongoDB process + + - Percentage of time during which requests the partition issued and serviced + + - Latency per operation type of the disk partition used for the MongoDB process + + - Amount of free and used disk space on the disk partition used for the MongoDB process + + - Measurements for the host, such as CPU usage or number of I/O operations + + + To use this resource, the requesting API Key must have the Project Read Only role. + operationId: getHostMeasurements + parameters: + - $ref: "#/components/parameters/groupId" + - description: One or more types of measurement to request for this MongoDB + process. If omitted, the resource returns all measurements. To + specify multiple values for `m`, repeat the `m` parameter for each + value. Specify measurements that apply to the specified host. + MongoDB Cloud returns an error if you specified any invalid + measurements. + in: query + name: m + schema: + type: array + items: + type: string + description: One measurement requested for this MongoDB process. + maxItems: 10 + minItems: 1 + uniqueItems: true + style: form + - $ref: "#/components/parameters/period" + - description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiMeasurementsGeneralView_Atlas" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Measurements for One MongoDB Process + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/namespaces": + get: + description: Returns up to 20 namespaces for collections experiencing slow + queries on the specified host. If you specify a secondary member of a + replica set that hasn't received any database read operations, the + endpoint doesn't return any namespaces. To use this resource, the + requesting API Key must have the Project Read Only role. + operationId: listSlowQueryNamespaces + parameters: + - $ref: "#/components/parameters/groupId" + - description: >- + Length of time expressed during which the query finds suggested + indexes among the managed namespaces in the cluster. This parameter + expresses its value in milliseconds. + + + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. + + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. + in: query + name: duration + schema: + type: integer + format: int64 + - description: Combination of host and port that serves the MongoDB process. The + host must be the hostname, FQDN, IPv4 address, or IPv6 address of + the host that runs the MongoDB process (`mongod` or `mongos`). The + port must be the IANA port on which the MongoDB process listens for + requests. + in: path + name: processId + required: true + schema: + type: string + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - description: >- + Date and time from which the query retrieves the suggested indexes. + This parameter expresses its value in the number of seconds that + have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + + + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. + + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. + in: query + name: since + schema: + type: integer + format: int64 + minimum: 1199145600 + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Namespaces" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Namespaces for One Host + tags: + - Performance Advisor + "/api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/slowQueryLogs": + get: + description: Returns log lines for slow queries that the Performance Advisor and + Query Profiler identified. The Performance Advisor monitors queries that + MongoDB considers slow and suggests new indexes to improve query + performance. MongoDB Cloud bases the threshold for slow queries on the + average time of operations on your cluster. This enables + workload-relevant recommendations. To use this resource, the requesting + API Key must have the Project Data Access Read Write role. + operationId: listSlowQueries + parameters: + - $ref: "#/components/parameters/groupId" + - description: >- + Length of time expressed during which the query finds slow queries + among the managed namespaces in the cluster. This parameter + expresses its value in milliseconds. + + + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. + + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. + in: query + name: duration + schema: + type: integer + format: int64 + - description: "Namespaces from which to retrieve slow queries. A namespace + consists of one database and one collection resource written as `.`: + `.`. To include multiple namespaces, pass the + parameter multiple times delimited with an ampersand (`&`) between + each namespace. Omit this parameter to return results for all + namespaces." + in: query + name: namespaces + schema: + type: array + items: + type: string + style: form + - description: Maximum number of lines from the log to return. + in: query + name: nLogs + schema: + type: integer + format: int64 + default: 20000 + maximum: 20000 + minimum: 0 + - description: Combination of host and port that serves the MongoDB process. The + host must be the hostname, FQDN, IPv4 address, or IPv6 address of + the host that runs the MongoDB process (`mongod` or `mongos`). The + port must be the IANA port on which the MongoDB process listens for + requests. + in: path + name: processId + required: true + schema: + type: string + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - description: >- + Date and time from which the query retrieves the slow queries. This + parameter expresses its value in the number of seconds that have + elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + + + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. + + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. + in: query + name: since + schema: + type: integer + format: int64 + minimum: 1199145600 + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PerformanceAdvisorSlowQueryList" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Slow Queries + tags: + - Performance Advisor + "/api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/suggestedIndexes": + get: + description: Returns the indexes that the Performance Advisor suggests. The + Performance Advisor monitors queries that MongoDB considers slow and + suggests new indexes to improve query performance. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: listSuggestedIndexes + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: >- + Length of time expressed during which the query finds suggested + indexes among the managed namespaces in the cluster. This parameter + expresses its value in milliseconds. + + + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. + + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. + in: query + name: duration + schema: + type: integer + format: int64 + - description: "Namespaces from which to retrieve suggested indexes. A namespace + consists of one database and one collection resource written as `.`: + `.`. To include multiple namespaces, pass the + parameter multiple times delimited with an ampersand (`&`) between + each namespace. Omit this parameter to return results for all + namespaces." + in: query + name: namespaces + schema: + type: array + items: + type: string + style: form + - description: Maximum number of example queries that benefit from the suggested + index. + in: query + name: nExamples + schema: + type: integer + format: int64 + default: 5 + - description: Number that indicates the maximum indexes to suggest. + in: query + name: nIndexes + schema: + type: integer + format: int64 + - description: Combination of host and port that serves the MongoDB process. The + host must be the hostname, FQDN, IPv4 address, or IPv6 address of + the host that runs the MongoDB process (`mongod` or `mongos`). The + port must be the IANA port on which the MongoDB process listens for + requests. + in: path + name: processId + required: true + schema: + type: string + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - description: >- + Date and time from which the query retrieves the suggested indexes. + This parameter expresses its value in the number of seconds that + have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). + + + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. + + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. + in: query + name: since + schema: + type: integer + format: int64 + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PerformanceAdvisorResponse" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Suggested Indexes + tags: + - Performance Advisor + "/api/atlas/v2/groups/{groupId}/pushBasedLogExport": + delete: + description: Disables the push-based log export feature by resetting the project + level settings to its default configuration. + operationId: deletePushBasedLogConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Disable the push-based log export feature for a project + tags: + - Push-Based Log Export + x-xgen-experimental: true + get: + description: Fetches the current project level settings for the push-based log + export feature. + operationId: getPushBasedLogConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PushBasedLogExportProject" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Get the push-based log export configuration for a project + tags: + - Push-Based Log Export + x-xgen-experimental: true + patch: + description: Updates the project level settings for the push-based log export feature. + operationId: updatePushBasedLogConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PushBasedLogExportProject" + x-xgen-version: 2023-01-01 + description: The project configuration details. The S3 bucket name, IAM role ID, + and prefix path fields are the only fields that may be specified. + Fields left unspecified will not be modified. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update the push-based log export feature for a project + tags: + - Push-Based Log Export + x-xgen-experimental: true + post: + description: Configures the project level settings for the push-based log export + feature. + operationId: createPushBasedLogConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PushBasedLogExportProject" + x-xgen-version: 2023-01-01 + description: The project configuration details. The S3 bucket name, IAM role ID, + and prefix path fields are required. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Enable the push-based log export feature for a project + tags: + - Push-Based Log Export + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/sampleDatasetLoad/{name}": + post: + description: Requests loading the MongoDB sample dataset into the specified + cluster. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: loadSampleDataset + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster into which you + load the sample dataset. + in: path + name: name + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "201": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/SampleDatasetStatus" + x-xgen-version: 2023-01-01 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Load Sample Dataset Request into Cluster + tags: + - Clusters + "/api/atlas/v2/groups/{groupId}/sampleDatasetLoad/{sampleDatasetId}": + get: + description: Checks the progress of loading the sample dataset into one cluster. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: getSampleDatasetLoadStatus + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the loaded + sample dataset. + in: path + name: sampleDatasetId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/SampleDatasetStatus" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Check Status of Cluster Sample Dataset Request + tags: + - Clusters + "/api/atlas/v2/groups/{groupId}/serverless": + get: + description: Returns details for all serverless instances in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: listServerlessInstances + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedServerlessInstanceDescription" + x-xgen-version: 2023-01-01 + description: OK + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Serverless Instances from One Project + tags: + - Serverless Instances + post: + description: Creates one serverless instance in the specified project. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: createServerlessInstance + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessInstanceDescriptionCreate" + description: Create One Serverless Instance in One Project. + required: true + responses: + "201": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessInstanceDescription" + x-xgen-version: 2023-01-01 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "402": + $ref: "#/components/responses/paymentRequired" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Serverless Instance in One Project + tags: + - Serverless Instances + "/api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/restoreJobs": + get: + description: Returns all restore jobs for one serverless instance from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: listServerlessBackupRestoreJobs + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the serverless instance. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiAtlasServerlessBackupRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Restore Jobs for One Serverless Instance + tags: + - Cloud Backups + post: + description: Restores one snapshot of one serverless instance from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. + operationId: createServerlessBackupRestoreJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance whose + snapshot you want to restore. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessBackupRestoreJob" + description: Restores one snapshot of one serverless instance from the specified + project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessBackupRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Restore One Snapshot of One Serverless Instance + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/restoreJobs/{restoreJobId}": + get: + description: Returns one restore job for one serverless instance from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: getServerlessBackupRestoreJob + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the restore job + to return. + in: path + name: restoreJobId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessBackupRestoreJob" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Restore Job for One Serverless Instance + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/snapshots": + get: + description: Returns all snapshots of one serverless instance from the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: listServerlessBackups + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the serverless instance. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiAtlasServerlessBackupSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Snapshots of One Serverless Instance + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/snapshots/{snapshotId}": + get: + description: Returns one snapshot of one serverless instance from the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getServerlessBackup + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Unique 24-hexadecimal digit string that identifies the desired + snapshot. + in: path + name: snapshotId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessBackupSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Snapshot of One Serverless Instance + tags: + - Cloud Backups + "/api/atlas/v2/groups/{groupId}/serverless/{name}": + delete: + description: Removes one serverless instance from the specified project. The + serverless instance must have termination protection disabled in order + to be deleted. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: deleteServerlessInstance + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance. + in: path + name: name + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Serverless Instance from One Project + tags: + - Serverless Instances + get: + description: Returns details for one serverless instance in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getServerlessInstance + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance. + in: path + name: name + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessInstanceDescription" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Serverless Instance from One Project + tags: + - Serverless Instances + patch: + description: Updates one serverless instance in the specified project. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: updateServerlessInstance + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance. + in: path + name: name + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessInstanceDescriptionUpdate" + description: Update One Serverless Instance in One Project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ServerlessInstanceDescription" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "402": + $ref: "#/components/responses/paymentRequired" + "409": + $ref: "#/components/responses/conflict" + security: + - DigestAuth: [] + summary: Update One Serverless Instance in One Project + tags: + - Serverless Instances + "/api/atlas/v2/groups/{groupId}/settings": + get: + description: Returns details about the specified project's settings. To use this + resource, the requesting API Key must have the Project Read Only role. + operationId: getProjectSettings + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupSettings" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Project Settings + tags: + - Projects + patch: + description: Updates the settings of the specified project. You can update any + of the options available. MongoDB cloud only updates the options + provided in the request. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: updateProjectSettings + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupSettings" + description: Settings to update. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupSettings" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Project Settings + tags: + - Projects + "/api/atlas/v2/groups/{groupId}/streams": + get: + description: Returns all stream instances for the specified project. + operationId: listStreamInstances + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiStreamsTenant" + x-xgen-version: 2023-02-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Project Stream Instances + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + post: + description: Creates one stream instance in the specified project. To use this + resource, the requesting API Key must have the Project Owner roles. + operationId: createStreamInstance + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsTenant" + description: Details to create one streams instance in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsTenant" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Stream Instance + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/streams/{tenantName}": + delete: + description: Delete one stream instance in the specified project. To use this + resource, the requesting API Key must have the Project Owner roles. + operationId: deleteStreamInstance + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the stream instance to delete. + in: path + name: tenantName + required: true + schema: + type: string + responses: + "202": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-02-01 + description: Accepted + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Delete One Stream Instance + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + get: + description: Returns the details of one stream instance within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. + operationId: getStreamInstance + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the stream instance to return. + in: path + name: tenantName + required: true + schema: + type: string + - description: Flag to indicate whether connections information should be included + in the stream instance. + in: query + name: includeConnections + schema: + type: boolean + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsTenant" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Stream Instance + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + patch: + description: Update one stream instance in the specified project. To use this + resource, the requesting API Key must have the Project Owner roles. + operationId: updateStreamInstance + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the stream instance to update. + in: path + name: tenantName + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsDataProcessRegion" + description: Details of the new data process region to update in the streams + instance. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsTenant" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Stream Instance + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections": + get: + description: Returns all connections of the stream instance for the specified project. + operationId: listStreamConnections + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiStreamsConnection" + x-xgen-version: 2023-02-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Connections Of The Stream Instances + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + post: + description: Creates one connection for a stream instance in the specified + project. To use this resource, the requesting API Key must have the + Project Owner roles. + operationId: createStreamConnection + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsConnection" + description: Details to create one connection for a streams instance in the + specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsConnection" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "409": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Connection + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}": + delete: + description: Delete one connection of the specified stream instance. To use this + resource, the requesting API Key must have the Project Owner roles. + operationId: deleteStreamConnection + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + - description: Human-readable label that identifies the stream connection. + in: path + name: connectionName + required: true + schema: + type: string + responses: + "202": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-02-01 + description: Accepted + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Delete One Stream Connection + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + get: + description: Returns the details of one stream connection within the specified + stream instance. To use this resource, the requesting API Key must have + the Project Read Only role. + operationId: getStreamConnection + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the stream instance to return. + in: path + name: tenantName + required: true + schema: + type: string + - description: Human-readable label that identifies the stream connection to return. + in: path + name: connectionName + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsConnection" + x-xgen-version: 2023-02-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Stream Connection + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + patch: + description: Update one connection for the specified stream instance in the + specified project. To use this resource, the requesting API Key must + have the Project Owner roles. + operationId: updateStreamConnection + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + - description: Human-readable label that identifies the stream connection. + in: path + name: connectionName + required: true + schema: + type: string + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsConnection" + description: Details to update one connection for a streams instance in the + specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/StreamsConnection" + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Stream Connection + tags: + - Streams + x-xgen-changelog: + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of + private preview, but is subject to change until GA. + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/teams": + get: + description: Returns all teams to which the authenticated user has access in the + project specified using its unique 24-hexadecimal digit identifier. All + members of the team share the same project access. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: listProjectTeams + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedTeamRole" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Teams in One Project + tags: + - Teams + post: + description: Adds one team to the specified project. All members of the team + share the same project access. MongoDB Cloud limits the number of users + to a maximum of 100 teams per project and a maximum of 250 teams per + organization. To use this resource, the requesting API Key must have the + Project Owner role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: addAllTeamsToProject + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/TeamRole" + description: Team to add to the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedTeamRole" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Add One or More Teams to One Project + tags: + - Teams + "/api/atlas/v2/groups/{groupId}/teams/{teamId}": + delete: + description: Removes one team specified using its unique 24-hexadecimal digit + identifier from the project specified using its unique 24-hexadecimal + digit identifier. To use this resource, the requesting API Key must have + the Project Owner role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: removeProjectTeam + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the team that + you want to remove from the specified project. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Team from One Project + tags: + - Teams + patch: + description: Updates the project roles assigned to the specified team. You can + grant team roles for specific projects and grant project access roles to + users in the team. All members of the team share the same project + access. To use this resource, the requesting API Key must have the + Project Owner role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: updateTeamRoles + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the team for + which you want to update roles. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TeamRole" + description: The project roles assigned to the specified team. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedTeamRole" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Team Roles in One Project + tags: + - Teams + "/api/atlas/v2/groups/{groupId}/userSecurity": + get: + description: Returns the current LDAP configuration for the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + operationId: getLDAPConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserSecurity" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return the Current LDAP or X.509 Configuration + tags: + - LDAP Configuration + patch: + description: >- + Edits the LDAP configuration for the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + + + Updating this configuration triggers a rolling restart of the database. + operationId: saveLDAPConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserSecurity" + description: Updates the LDAP configuration for the specified project. + required: true + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserSecurity" + x-xgen-version: 2023-01-01 + description: Accepted + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Edit the LDAP or X.509 Configuration + tags: + - LDAP Configuration + "/api/atlas/v2/groups/{groupId}/userSecurity/customerX509": + delete: + description: >- + Clears the customer-managed X.509 settings on a project, including the + uploaded Certificate Authority, which disables self-managed X.509. + + Updating this configuration triggers a rolling restart of the database. You must have the Project Owner role to use this endpoint. + operationId: disableCustomerManagedX509 + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserSecurity" + x-xgen-version: 2023-01-01 + description: Accepted + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Disable Customer-Managed X.509 + tags: + - X.509 Authentication + "/api/atlas/v2/groups/{groupId}/userSecurity/ldap/userToDNMapping": + delete: + description: Removes the current LDAP Distinguished Name mapping captured in the + ``userToDNMapping`` document from the LDAP configuration for the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. + operationId: deleteLDAPConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserSecurity" + x-xgen-version: 2023-01-01 + description: Accepted + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove the Current LDAP User to DN Mapping + tags: + - LDAP Configuration + "/api/atlas/v2/groups/{groupId}/userSecurity/ldap/verify": + post: + description: Verifies the LDAP configuration for the specified project. To use + this resource, the requesting API Key must have the Project Owner role. + operationId: verifyLDAPConfiguration + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequestParams" + description: The LDAP configuration for the specified project that you want to + verify. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequest" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Verify the LDAP Configuration in One Project + tags: + - LDAP Configuration + "/api/atlas/v2/groups/{groupId}/userSecurity/ldap/verify/{requestId}": + get: + description: Returns the status of one request to verify one LDAP configuration + for the specified project. To use this resource, the requesting API Key + must have the Project Owner role. + operationId: getLDAPConfigurationStatus + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique string that identifies the request to verify an LDAP + configuration. + in: path + name: requestId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequest" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return the Status of One Verify LDAP Configuration Request + tags: + - LDAP Configuration + "/api/atlas/v2/groups/{groupId}/users": + get: + description: Returns details about all users in the specified project. Users + belong to an organization. To use this resource, the requesting API Key + must have the Project Read Only role. + operationId: listProjectUsers + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: 'Flag that indicates whether the returned list should include users + who belong to a team with a role in this project. You might not have + assigned the individual users a role in this project. If + `"flattenTeams" : false`, this resource returns only users with a + role in the project. If `"flattenTeams" : true`, this resource + returns both users with roles in the project and users who belong to + teams with roles in the project.' + in: query + name: flattenTeams + schema: + type: boolean + default: false + - description: 'Flag that indicates whether the returned list should include users + with implicit access to the project, the Organization Owner or + Organization Read Only role. You might not have assigned the + individual users a role in this project. If `"includeOrgUsers": + false`, this resource returns only users with a role in the project. + If `"includeOrgUsers": true`, this resource returns both users with + roles in the project and users who have implicit access to the + project through their organization role.' + in: query + name: includeOrgUsers + schema: + type: boolean + default: false + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedAppUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Users in One Project + tags: + - Projects + "/api/atlas/v2/groups/{groupId}/users/{userId}": + delete: + description: Removes the specified user from the specified project. To use this + resource, the requesting API Key must have the Project Owner role. + operationId: removeProjectUser + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal string that identifies MongoDB Cloud user you + want to remove from the specified project. To return a application + user's ID using their application username, use the Get All + application users in One Project endpoint. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One User from One Project + tags: + - Projects + "/api/atlas/v2/groups/{groupId}/users/{userId}/roles": + put: + description: Updates the roles of the specified user in the specified project. + To specify the user to update, provide the unique 24-hexadecimal digit + string that identifies the user in the specified project. To use this + resource, the requesting API Key must have the Group User Admin role. + operationId: updateProjectRoles + parameters: + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the user to + modify. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UpdateGroupRolesForUser" + description: Roles to update for the specified user. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UpdateGroupRolesForUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Project Roles for One MongoDB Cloud User + tags: + - Projects + x-xgen-experimental: true + /api/atlas/v2/orgs: + get: + description: Returns all organizations to which the requesting API Key has + access. To use this resource, the requesting API Key must have the + Organization Member role. + operationId: listOrganizations + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label of the organization to use to filter the + returned list. Performs a case-insensitive search for an + organization that starts with the specified name. + in: query + name: name + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedOrganization" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Organizations + tags: + - Organizations + post: + description: Creates one organization in MongoDB Cloud and links it to the + requesting API Key's organization. To use this resource, the requesting + API Key must have the Organization Owner role. The requesting API Key's + organization must be a paying organization. To learn more, see + [Configure a Paying + Organization](https://www.mongodb.com/docs/atlas/billing/#configure-a-paying-organization) + in the MongoDB Atlas documentation. + operationId: createOrganization + parameters: [] + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CreateOrganizationRequest" + description: Organization that you want to create. + required: true + responses: + "201": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CreateOrganizationResponse" + x-xgen-version: 2023-01-01 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Organization + tags: + - Organizations + "/api/atlas/v2/orgs/{orgId}": + delete: + description: >- + Removes one specified organization. MongoDB Cloud imposes the following + limits on this resource: + + - Organizations with active projects cannot be removed. + - All projects in the organization must be removed before you can remove the organization. + To use this resource, the requesting API Key must have the Organization Owner role. + operationId: deleteOrganization + parameters: + - $ref: "#/components/parameters/orgId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "402": + $ref: "#/components/responses/paymentRequired" + "403": + $ref: "#/components/responses/forbidden" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Organization + tags: + - Organizations + get: + description: Returns one organization to which the requesting API key has + access. To use this resource, the requesting API Key must have the + Organization Member role. + operationId: getOrganization + parameters: + - $ref: "#/components/parameters/orgId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AtlasOrganization" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Organization + tags: + - Organizations + patch: + description: Renames one organization. To use this resource, the requesting API + Key must have the Organization Owner role. + operationId: renameOrganization + parameters: + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AtlasOrganization" + description: Details to update on the specified organization. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/AtlasOrganization" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Rename One Organization + tags: + - Organizations + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/apiKeys": + get: + description: Returns all organization API keys for the specified organization. + The organization API keys grant programmatic access to an organization. + You can't use the API key to log into MongoDB Cloud through the console. + To use this resource, the requesting API Key must have the Organization + Member role. + externalDocs: + description: Programmatic API Keys + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: listApiKeys + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiApiUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Organization API Keys + tags: + - Programmatic API Keys + post: + description: Creates one API key for the specified organization. An organization + API key grants programmatic access to an organization. You can't use the + API key to log into the console. To use this resource, the requesting + API Key must have the Organization Owner role. + externalDocs: + description: Programmatic API Keys + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: createApiKey + parameters: + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CreateAtlasOrganizationApiKey" + description: Organization API Key to be created. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Organization API Key + tags: + - Programmatic API Keys + "/api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}": + delete: + description: Removes one organization API key from the specified organization. + When you remove an API key from an organization, MongoDB Cloud also + removes that key from any projects that use that key. To use this + resource, the requesting API Key must have the Organization Owner role. + externalDocs: + description: Configure Atlas API Access + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + operationId: deleteApiKey + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Organization API Key + tags: + - Programmatic API Keys + get: + description: Returns one organization API key. The organization API keys grant + programmatic access to an organization. You can't use the API key to log + into MongoDB Cloud through the user interface. To use this resource, the + requesting API Key must have the Organization Member role. + externalDocs: + description: Programmatic API Keys + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: getApiKey + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key that you want to update. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Organization API Key + tags: + - Programmatic API Keys + patch: + description: Updates one organization API key in the specified organization. The + organization API keys grant programmatic access to an organization. To + use this resource, the requesting API Key must have the Organization + Owner role. + externalDocs: + description: Programmatic API Keys + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + operationId: updateApiKey + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key you want to update. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UpdateAtlasOrganizationApiKey" + description: Organization API key to be updated. This request requires a minimum + of one of the two body parameters. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Organization API Key + tags: + - Programmatic API Keys + "/api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}/accessList": + get: + description: Returns all access list entries that you configured for the + specified organization API key. To use this resource, the requesting API + Key must have the Organization Member role. + externalDocs: + description: Programmatic API Keys + url: https://docs.atlas.mongodb.com/configure-api-access/#view-the-details-of-one-api-key-in-one-organization + operationId: listApiKeyAccessListsEntries + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key for which you want to return access list + entries. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiUserAccessList" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Access List Entries for One Organization API Key + tags: + - Programmatic API Keys + post: + description: Creates the access list entries for the specified organization API + key. Resources require all API requests originate from IP addresses on + the API access list. To use this resource, the requesting API Key must + have the Read Write role. + operationId: createApiKeyAccessList + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key for which you want to create a new access list + entry. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/UserAccessList" + description: Access list entries to be created for the specified organization + API key. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiUserAccessList" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create Access List Entries for One Organization API Key + tags: + - Programmatic API Keys + "/api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}/accessList/{ipAddress}": + delete: + description: Removes the specified access list entry from the specified + organization API key. Resources require all API requests originate from + the IP addresses on the API access list. To use this resource, the + requesting API Key must have the Read Write role. In addition, you + cannot remove the requesting IP address from the requesting organization + API key. + externalDocs: + description: Configure Atlas API Access + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + operationId: deleteApiKeyAccessListEntry + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key for which you want to remove access list + entries. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: One IP address or multiple IP addresses represented as one CIDR + block to limit requests to API resources in the specified + organization. When adding a CIDR block with a subnet mask, such as + 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /. + in: path + name: ipAddress + required: true + schema: + type: string + example: 192.0.2.0%2F24 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Access List Entry for One Organization API Key + tags: + - Programmatic API Keys + get: + description: Returns one access list entry for the specified organization API + key. Resources require all API requests originate from IP addresses on + the API access list. To use this resource, the requesting API Key must + have the Organization Member role. + externalDocs: + description: Configure Atlas API Access + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + operationId: getApiKeyAccessList + parameters: + - $ref: "#/components/parameters/orgId" + - description: One IP address or multiple IP addresses represented as one CIDR + block to limit requests to API resources in the specified + organization. When adding a CIDR block with a subnet mask, such + as 192.0.2.0/24, use the URL-encoded value %2F for the forward + slash /. + in: path + name: ipAddress + required: true + schema: + type: string + example: 192.0.2.0%2F24 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + - description: Unique 24-hexadecimal digit string that identifies this + organization API key for which you want to return access list + entries. + in: path + name: apiUserId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UserAccessList" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Access List Entry for One Organization API Key + tags: + - Programmatic API Keys + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/billing/costExplorer/usage": + post: + description: Creates a query process within the Cost Explorer for the given + parameters. A token is returned that can be used to poll the status of + the query and eventually retrievethe results. + operationId: createCostExplorerQueryProcess + parameters: + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CostExplorerFilterRequestBody" + description: Filter parameters for the Cost Explorer query. + required: true + responses: + "202": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CostExplorerFilterResponse" + x-xgen-version: 2023-01-01 + description: Accepted + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create Cost Explorer query process + tags: + - Invoices + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/billing/costExplorer/usage/{token}": + get: + description: Returns the usage details for a Cost Explorer query, if the query + is finished and the data is ready to be viewed. If the data is not + ready, a 'processing' response willindicate that another request should + be sent later to view the data. + operationId: createCostExplorerQueryProcess_1 + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 64 digit string that identifies the Cost Explorer query. + in: path + name: token + required: true + schema: + type: string + example: 4ABBE973862346D40F3AE859D4BE96E0F895764EB14EAB039E7B82F9D638C05C + maxLength: 64 + minLength: 64 + responses: + "102": + description: Processing + "200": + content: + application/vnd.atlas.2023-01-01+csv: + schema: + type: string + x-xgen-version: 2023-01-01 + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CostExplorerQueryResult" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return results from a given Cost Explorer query, or notify that the + results are not ready yet. + tags: + - Invoices + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/events": + get: + description: >- + Returns all events for the specified organization. Events identify + significant database, billing, or security activities or status changes. + To use this resource, the requesting API Key must have the Organization + Member role. + + + This resource remains under revision and may change. + operationId: listOrganizationEvents + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: >- + Category of incident recorded at this moment in time. + + + **IMPORTANT**: The complete list of event type values changes frequently. + in: query + name: eventType + schema: + type: array + items: + $ref: "#/components/schemas/EventTypeForOrg" + - description: Flag that indicates whether to include the raw document in the + output. The raw document contains additional meta information about + the event. + in: query + name: includeRaw + schema: + type: boolean + default: false + - description: Date and time from when MongoDB Cloud stops returning events. This + parameter uses the ISO 8601 timestamp + format in UTC. + in: query + name: maxDate + schema: + type: string + format: date-time + - description: Date and time from when MongoDB Cloud starts returning events. This + parameter uses the ISO 8601 timestamp + format in UTC. + in: query + name: minDate + schema: + type: string + format: date-time + example: 2021-11-17T23:15:00.06Z + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrgPaginatedEvent" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Events from One Organization + tags: + - Events + "/api/atlas/v2/orgs/{orgId}/events/{eventId}": + get: + description: >- + Returns one event for the specified organization. Events identify + significant database, billing, or security activities or status changes. + To use this resource, the requesting API Key must have the Organization + Member role. + + + This resource remains under revision and may change. + operationId: getOrganizationEvent + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the event that + you want to return. Use the + [/events](#tag/Events/operation/listOrganizationEvents) endpoint to + retrieve all events to which the authenticated user has access. + in: path + name: eventId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: Flag that indicates whether to include the raw document in the + output. The raw document contains additional meta information about + the event. + in: query + name: includeRaw + schema: + type: boolean + default: false + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/EventViewForOrg" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Event from One Organization + tags: + - Events + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/federationSettings": + get: + description: Returns information about the federation settings for the specified + organization. To use this resource, the requesting API Key must have the + Organization Owner role in the connected org. + operationId: getFederationSettings + parameters: + - $ref: "#/components/parameters/orgId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrgFederationSettings" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Federation Settings for One Organization + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/groups": + get: + description: >- + Returns multiple projects in the specified organization. Each + organization can have multiple projects. Use projects to: + + + - Isolate different environments, such as development, test, or production environments, from each other. + + - Associate different MongoDB Cloud users or teams with different environments, or give different permission to MongoDB Cloud users in different environments. + + - Maintain separate cluster security configurations. + + - Create different alert settings. + + + To use this resource, the requesting API Key must have the Organization Member role. + operationId: listOrganizationProjects + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label of the project to use to filter the returned + list. Performs a case-insensitive search for a project within the + organization which is prefixed by the specified name. + in: query + name: name + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedAtlasGroup" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One or More Projects in One Organization + tags: + - Organizations + "/api/atlas/v2/orgs/{orgId}/invites": + get: + description: Returns all pending invitations to the specified organization. To + use this resource, the requesting API Key must have the Organization + Owner role. + operationId: listOrganizationInvitations + parameters: + - $ref: "#/components/parameters/orgId" + - description: Email address of the user account invited to this organization. If + you exclude this parameter, this resource returns all pending + invitations. + in: query + name: username + schema: + type: string + format: email + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Organization Invitations + tags: + - Organizations + patch: + description: Updates the details of one pending invitation to the specified + organization. To specify which invitation, provide the username of the + invited user. To use this resource, the requesting API Key must have the + Organization Owner role. + operationId: updateOrganizationInvitation + parameters: + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitationRequest" + description: Updates the details of one pending invitation to the specified + organization. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Organization Invitation + tags: + - Organizations + post: + description: Invites one MongoDB Cloud user to join the specified organization. + The user must accept the invitation to access information within the + specified organization. To use this resource, the requesting API Key + must have the Organization Owner role. + operationId: createOrganizationInvitation + parameters: + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitationRequest" + description: Invites one MongoDB Cloud user to join the specified organization. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Invite One MongoDB Cloud User to Join One Atlas Organization + tags: + - Organizations + "/api/atlas/v2/orgs/{orgId}/invites/{invitationId}": + delete: + description: Cancels one pending invitation sent to the specified MongoDB Cloud + user to join an organization. You can't cancel an invitation that the + user accepted. To use this resource, the requesting API Key must have + the Organization Owner role. + operationId: deleteOrganizationInvitation + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Cancel One Organization Invitation + tags: + - Organizations + get: + description: Returns the details of one pending invitation to the specified + organization. To use this resource, the requesting API Key must have the + Organization Owner role. + operationId: getOrganizationInvitation + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Organization Invitation + tags: + - Organizations + patch: + description: Updates the details of one pending invitation to the specified + organization. To specify which invitation, provide the unique + identification string for that invitation. Use the Return All + Organization Invitations endpoint to retrieve IDs for all pending + organization invitations. To use this resource, the requesting API Key + must have the Organization Owner role. + operationId: updateOrganizationInvitationById + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the invitation. + in: path + name: invitationId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitationUpdateRequest" + description: Updates the details of one pending invitation to the specified + organization. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update One Organization Invitation by Invitation ID + tags: + - Organizations + "/api/atlas/v2/orgs/{orgId}/invoices": + get: + description: Returns all invoices that MongoDB issued to the specified + organization. This list includes all invoices regardless of invoice + status. To use this resource, the requesting API Key must have the + Organization Billing Viewer, Organization Billing Admin, or Organization + Owner role. If you have a cross-organization setup, you can view linked + invoices if you have the Organization Billing Admin or Organization + Owner role. + operationId: listInvoices + parameters: + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiInvoice" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Invoices for One Organization + tags: + - Invoices + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/invoices/pending": + get: + description: Returns all invoices accruing charges for the current billing cycle + for the specified organization. To use this resource, the requesting API + Key must have the Organization Billing Viewer, Organization Billing + Admin, or Organization Owner role. If you have a cross-organization + setup, you can view linked invoices if you have the Organization Billing + Admin or Organization Owner Role. + operationId: listPendingInvoices + parameters: + - $ref: "#/components/parameters/orgId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiInvoice" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Pending Invoices for One Organization + tags: + - Invoices + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/invoices/{invoiceId}": + get: + description: Returns one invoice that MongoDB issued to the specified + organization. A unique 24-hexadecimal digit string identifies the + invoice. You can choose to receive this invoice in JSON or CSV format. + To use this resource, the requesting API Key must have the Organization + Billing Viewer, Organization Billing Admin, or Organization Owner role. + If you have a cross-organization setup, you can query for a linked + invoice if you have the Organization Billing Admin or Organization Owner + role. + operationId: getInvoice + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the invoice + submitted to the specified organization. Charges typically post the + next day. + in: path + name: invoiceId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+csv: + schema: + type: string + x-xgen-version: 2023-01-01 + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/BillingInvoice" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Organization Invoice + tags: + - Invoices + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/invoices/{invoiceId}/csv": + get: + description: Returns one invoice that MongoDB issued to the specified + organization in CSV format. A unique 24-hexadecimal digit string + identifies the invoice. To use this resource, the requesting API Key + have at least the Organization Billing Viewer, Organization Billing + Admin, or Organization Owner role. If you have a cross-organization + setup, you can query for a linked invoice if you have the Organization + Billing Admin or Organization Owner Role. + operationId: downloadInvoiceCSV + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the invoice + submitted to the specified organization. Charges typically post the + next day. + in: path + name: invoiceId + required: true + schema: + type: string + pattern: "[0-9a-f]+" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+csv: + schema: + type: string + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Organization Invoice as CSV + tags: + - Invoices + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/liveMigrations/availableProjects": + get: + description: Return all projects that you can migrate to the specified organization. + operationId: listSourceProjects + parameters: + - $ref: "#/components/parameters/orgId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/LiveImportAvailableProject" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Projects Available for Migration + tags: + - Cloud Migration Service + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/liveMigrations/linkTokens": + delete: + description: Remove one organization link and its associated public API key. + MongoDB Atlas uses the link-token for push live migrations only. Live + migrations (push) let you securely push data from Cloud Manager or Ops + Manager into MongoDB Atlas. Your API Key must have the Organization + Owner role to successfully call this resource. + operationId: deleteLinkToken + parameters: + - $ref: "#/components/parameters/orgId" + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Link-Token + tags: + - Cloud Migration Service + post: + description: Create one link-token that contains all the information required to + complete the link. MongoDB Atlas uses the link-token for push live + migrations only. Live migration (push) allows you to securely push data + from Cloud Manager or Ops Manager into MongoDB Atlas. Your API Key must + have the Organization Owner role to successfully call this resource. + operationId: createLinkToken + parameters: + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TargetOrgRequest" + description: IP address access list entries associated with the migration. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TargetOrg" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Link-Token + tags: + - Cloud Migration Service + "/api/atlas/v2/orgs/{orgId}/settings": + get: + description: Returns details about the specified organization's settings. To use + this resource, the requesting API Key must have the Organization Owner + role. + operationId: getOrganizationSettings + parameters: + - $ref: "#/components/parameters/orgId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationSettings" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Settings for One Organization + tags: + - Organizations + x-xgen-experimental: true + patch: + description: Updates the organization's settings. To use this resource, the + requesting API Key must have the Organization Owner role. + operationId: updateOrganizationSettings + parameters: + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationSettings" + description: Details to update on the specified organization's settings. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/OrganizationSettings" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Settings for One Organization + tags: + - Organizations + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/teams": + get: + description: Returns all teams that belong to the specified organization. Teams + enable you to grant project access roles to MongoDB Cloud users. MongoDB + Cloud only returns teams for which you have access. To use this + resource, the requesting API Key must have the Organization Member role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: listOrganizationTeams + parameters: + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/pageNum" + - $ref: "#/components/parameters/orgId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedTeam" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Teams in One Organization + tags: + - Teams + post: + description: Creates one team in the specified organization. Teams enable you to + grant project access roles to MongoDB Cloud users. MongoDB Cloud limits + the number of teams to a maximum of 250 teams per organization. To use + this resource, the requesting API Key must have the Organization Owner + role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: createTeam + parameters: + - $ref: "#/components/parameters/orgId" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Team" + description: Team that you want to create in the specified organization. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Team" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Team in One Organization + tags: + - Teams + "/api/atlas/v2/orgs/{orgId}/teams/byName/{teamName}": + get: + description: Returns one team that you identified using its human-readable name. + This team belongs to one organization. Teams enable you to grant project + access roles to MongoDB Cloud users. To use this resource, the + requesting API Key must have the Organization Member role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: getTeamByName + parameters: + - $ref: "#/components/parameters/orgId" + - description: Name of the team whose information you want to return. + in: path + name: teamName + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TeamResponse" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Team using its Name + tags: + - Teams + "/api/atlas/v2/orgs/{orgId}/teams/{teamId}": + delete: + description: Removes one team specified using its unique 24-hexadecimal digit + identifier from the organization specified using its unique + 24-hexadecimal digit identifier. To use this resource, the requesting + API Key must have the Organization Owner role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: deleteTeam + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the team that + you want to delete. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One Team from One Organization + tags: + - Teams + get: + description: Returns one team that you identified using its unique + 24-hexadecimal digit ID. This team belongs to one organization. Teams + enable you to grant project access roles to MongoDB Cloud users. To use + this resource, the requesting API Key must have the Organization Member + role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: getTeamById + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the team whose + information you want to return. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TeamResponse" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Team using its ID + tags: + - Teams + patch: + description: Renames one team in the specified organization. Teams enable you to + grant project access roles to MongoDB Cloud users. To use this resource, + the requesting API Key must have the Organization Owner role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: renameTeam + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the team that + you want to rename. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/Team" + description: Details to update on the specified team. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/TeamResponse" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Rename One Team + tags: + - Teams + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/teams/{teamId}/users": + get: + description: Returns all MongoDB Cloud users assigned to the team specified + using its unique 24-hexadecimal digit identifier. This team belongs to + one organization. Teams enable you to grant project access roles to + MongoDB Cloud users. To use this resource, the requesting API Key must + have the Organization Member role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: listTeamUsers + parameters: + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies the team whose + application users you want to return. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiAppUser" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All MongoDB Cloud Users Assigned to One Team + tags: + - Teams + post: + description: Adds one or more MongoDB Cloud users from the specified + organization to the specified team. Teams enable you to grant project + access roles to MongoDB Cloud users. You can assign up to 250 MongoDB + Cloud users from one organization to one team. To use this resource, the + requesting API Key must have the Organization Owner role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: addTeamUser + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal character string that identifies the team to + which you want to add MongoDB Cloud users. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: array + items: + $ref: "#/components/schemas/AddUserToTeam" + description: One or more MongoDB Cloud users that you want to add to the + specified team. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedApiAppUser" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Assign MongoDB Cloud Users from One Organization to One Team + tags: + - Teams + "/api/atlas/v2/orgs/{orgId}/teams/{teamId}/users/{userId}": + delete: + description: Removes one MongoDB Cloud user from the specified team. This team + belongs to one organization. Teams enable you to grant project access + roles to MongoDB Cloud users. To use this resource, the requesting API + Key must have the Organization Owner role. + externalDocs: + description: Manage Organization Teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + operationId: removeTeamUser + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the team from + which you want to remove one database application user. + in: path + name: teamId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + - description: Unique 24-hexadecimal digit string that identifies MongoDB Cloud + user that you want to remove from the specified team. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One MongoDB Cloud User from One Team + tags: + - Teams + "/api/atlas/v2/orgs/{orgId}/users": + get: + description: Returns details about the MongoDB Cloud users associated with the + specified organization. Each MongoDB Cloud user returned must belong to + the specified organization or to a project within the specified + organization. To use this resource, the requesting API Key must have the + Organization Member role. + operationId: listOrganizationUsers + parameters: + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedAppUser" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All MongoDB Cloud Users in One Organization + tags: + - Organizations + "/api/atlas/v2/orgs/{orgId}/users/{userId}": + delete: + description: Removes one MongoDB Cloud user from the specified organization. To + use this resource, the requesting API Key must have the Organization + User Admin role. + operationId: removeOrganizationUser + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the user to be + deleted. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "204": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: This endpoint does not return a response body. + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Remove One MongoDB Cloud User from One Organization + tags: + - Organizations + x-xgen-experimental: true + "/api/atlas/v2/orgs/{orgId}/users/{userId}/roles": + put: + description: Updates the roles of the specified user in the specified + organization. To specify the user to update, provide the unique + 24-hexadecimal digit string that identifies the user in the specified + organization. To use this resource, the requesting API Key must have the + Organization User Admin role. + operationId: updateOrganizationRoles + parameters: + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the user to + modify. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UpdateOrgRolesForUser" + description: Roles to update for the specified user. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/UpdateOrgRolesForUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Organization Roles for One MongoDB Cloud User + tags: + - Organizations + x-xgen-experimental: true + /api/atlas/v2/users: + post: + description: >- + Creates one MongoDB Cloud user account. A MongoDB Cloud user account + grants access to only the MongoDB Cloud application. To grant database + access, create a database user. MongoDB Cloud sends an email to the + users you specify, inviting them to join the project. Invited users + don't have access to the project until they accept the invitation. + Invitations expire after 30 days. + + MongoDB Cloud limits MongoDB Cloud user membership to a maximum of 250 MongoDB Cloud users per team. MongoDB Cloud limits MongoDB Cloud user membership to 500 MongoDB Cloud users per project and 500 MongoDB Cloud users per organization, which includes the combined membership of all projects in the organization. MongoDB Cloud raises an error if an operation exceeds these limits. For example, if you have an organization with five projects, and each project has 100 MongoDB Cloud users, and each MongoDB Cloud user belongs to only one project, you can't add any MongoDB Cloud users to this organization without first removing existing MongoDB Cloud users from the organization. + + To use this resource, the requesting API Key can have any role. + operationId: createUser + parameters: [] + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudAppUser" + description: MongoDB Cloud user account to create. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudAppUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One MongoDB Cloud User + tags: + - MongoDB Cloud Users + "/api/atlas/v2/users/byName/{userName}": + get: + description: Returns the details for one MongoDB Cloud user account with the + specified username. You can't use this endpoint to return information + about an API Key. To return information about an API Key, use the + [Return One Organization](#tag/Organizations/operation/getOrganization) + API Key endpoint. To use this resource, the requesting API Key can have + any role. + operationId: getUserByUsername + parameters: + - description: Email address that belongs to the MongoDB Cloud user account. You + cannot modify this address after creating the user. + in: path + name: userName + required: true + schema: + type: string + pattern: ^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudAppUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One MongoDB Cloud User using Their Username + tags: + - MongoDB Cloud Users + "/api/atlas/v2/users/{userId}": + get: + description: Returns the details for one MongoDB Cloud user account with the + specified unique identifier for the user. You can't use this endpoint to + return information on an API Key. To return information about an API + Key, use the [Return One + Organization](#tag/Organizations/operation/getOrganization) API Key + endpoint. You can always retrieve your own user account. If you are the + owner of a MongoDB Cloud organization or project, you can also retrieve + the user profile for any user with membership in that organization or + project. To use this resource, the requesting API Key can have any role. + operationId: getUser + parameters: + - description: Unique 24-hexadecimal digit string that identifies this user. + in: path + name: userId + required: true + schema: + type: string + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/CloudAppUser" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One MongoDB Cloud User using Its ID + tags: + - MongoDB Cloud Users +components: + parameters: + collectionName: + description: Human-readable label that identifies the collection. + in: path + name: collectionName + required: true + schema: + type: string + example: mycoll + databaseName: + description: Human-readable label that identifies the database. + in: path + name: databaseName + required: true + schema: + type: string + example: mydb + end: + description: Date and time when MongoDB Cloud stops reporting the metrics. This + parameter expresses its value in the ISO 8601 timestamp format in UTC. + Include this parameter when you do not set **period**. + in: query + name: end + required: false + schema: + type: string + format: date-time + envelope: + description: Flag that indicates whether Application wraps the response in an + `envelope` JSON object. Some API clients cannot access the HTTP response + headers or status code. To remediate this, set envelope=true in the + query. Endpoints that return a list of results use the results object as + an envelope. Application adds the status parameter to the response body. + in: query + name: envelope + required: false + schema: + type: boolean + default: false + example: false + federationSettingsId: + description: Unique 24-hexadecimal digit string that identifies your federation. + in: path + name: federationSettingsId + required: true + schema: + type: string + example: 55fa922fb343282757d9554e + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + granularity: + description: Duration that specifies the interval at which Atlas reports the + metrics. This parameter expresses its value in the ISO 8601 duration + format in UTC. + in: query + name: granularity + required: true + schema: + type: string + example: PT1M + groupId: + description: >- + Unique 24-hexadecimal digit string that identifies your project. Use the + [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all + projects to which the authenticated user has access. + + + **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups. + in: path + name: groupId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + identityProviderId: + description: Unique 20-hexadecimal digit string that identifies the identity provider. + in: path + name: identityProviderId + required: true + schema: + type: string + example: c2777a9eca931f29fc2f + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + includeCount: + description: Flag that indicates whether the response returns the total number + of items (**totalCount**) in the response. + in: query + name: includeCount + required: false + schema: + type: boolean + default: true + example: true + indexName: + description: Human-readable label that identifies the index. + in: path + name: indexName + required: true + schema: + type: string + example: myindex + itemsPerPage: + description: Number of items that the response returns per page. + in: query + name: itemsPerPage + required: false + schema: + type: integer + default: 100 + example: 100 + maximum: 500 + minimum: 1 + liveMigrationId: + description: Unique 24-hexadecimal digit string that identifies the migration. + in: path + name: liveMigrationId + required: true + schema: + type: string + example: 6296fb4c7c7aa997cf94e9a8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + orgId: + description: Unique 24-hexadecimal digit string that identifies the organization + that contains your projects. Use the + [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to + retrieve all organizations to which the authenticated user has access. + in: path + name: orgId + required: true + schema: + type: string + example: 4888442a3354817a7320eb61 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + pageNum: + description: Number of the page that displays the current set of the total + objects that the response returns. + in: query + name: pageNum + required: false + schema: + type: integer + default: 1 + example: 1 + minimum: 1 + period: + description: Duration over which Atlas reports the metrics. This parameter + expresses its value in the ISO 8601 duration format in UTC. Include this + parameter when you do not set **start** and **end**. + in: query + name: period + required: false + schema: + type: string + example: PT10H + pretty: + description: Flag that indicates whether the response body should be in the prettyprint format. + in: query + name: pretty + required: false + schema: + type: boolean + default: false + example: false + processId: + description: Combination of hostname and IANA port that serves the MongoDB + process. The host must be the hostname, fully qualified domain name + (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that + runs the MongoDB process (mongod or mongos). The port must be the IANA + port on which the MongoDB process listens for requests. + in: path + name: processId + required: true + schema: + type: string + example: my.host.name.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + start: + description: Date and time when MongoDB Cloud begins reporting the metrics. This + parameter expresses its value in the ISO 8601 timestamp format in UTC. + Include this parameter when you do not set **period**. + in: query + name: start + required: false + schema: + type: string + format: date-time + responses: + accepted: + description: Accepted. + badRequest: + content: + application/json: + example: + detail: (This is just an example, the exception may not be related to this + endpoint) No provider AWS exists. + error: 400 + errorCode: INVALID_PROVIDER + parameters: + - AWS + reason: Bad Request + schema: + $ref: "#/components/schemas/ApiError" + description: Bad Request. + conflict: + content: + application/json: + example: + detail: "(This is just an example, the exception may not be related to this + endpoint) Cannot delete organization link while there is active + migration in following project ids: 60c4fd418ebe251047c50554" + error: 409 + errorCode: CANNOT_DELETE_ORG_LINK_WITH_RUNNING_LIVE_EXPORT + parameters: + - 60c4fd418ebe251047c50554 + reason: Conflict + schema: + $ref: "#/components/schemas/ApiError" + description: Conflict. + forbidden: + content: + application/json: + example: + detail: (This is just an example, the exception may not be related to this + endpoint) + error: 403 + errorCode: CANNOT_CHANGE_GROUP_NAME + parameters: + - EXAMPLE + reason: Forbidden + schema: + $ref: "#/components/schemas/ApiError" + description: Forbidden. + gone: + content: + application/json: + example: + detail: This happens when a resource is marked for sunset and the sunset date is + in the past. + error: 410 + errorCode: VERSION_GONE + parameters: + - EXAMPLE + reason: Gone + schema: + $ref: "#/components/schemas/ApiError" + description: Gone. + internalServerError: + content: + application/json: + example: + detail: (This is just an example, the exception may not be related to this + endpoint) + error: 500 + errorCode: UNEXPECTED_ERROR + parameters: + - EXAMPLE + reason: Internal Server Error + schema: + $ref: "#/components/schemas/ApiError" + description: Internal Server Error. + methodNotAllowed: + content: + application/json: + example: + detail: (This is just an example, the exception may not be related to this + endpoint) + error: 405 + errorCode: ATLAS_BACKUP_CANCEL_SHARD_RESTORE_JOB_NOT_ALLOWED + parameters: + - EXAMPLE + reason: Method Not Allowed + schema: + $ref: "#/components/schemas/ApiError" + description: Method Not Allowed. + noBody: + description: This endpoint does not return a response body. + notFound: + content: + application/json: + example: + detail: (This is just an example, the exception may not be related to this + endpoint) Cannot find resource AWS + error: 404 + errorCode: RESOURCE_NOT_FOUND + parameters: + - AWS + reason: Not Found + schema: + $ref: "#/components/schemas/ApiError" + description: Not Found. + paymentRequired: + content: + application/json: + example: + detail: (This is just an example, the exception may not be related to this + endpoint) + error: 402 + errorCode: NO_PAYMENT_INFORMATION_FOUND + parameters: + - EXAMPLE + reason: Payment Required + schema: + $ref: "#/components/schemas/ApiError" + description: Payment Required. + unauthorized: + content: + application/json: + example: + detail: (This is just an example, the exception may not be related to this + endpoint) + error: 401 + errorCode: NOT_ORG_GROUP_CREATOR + parameters: + - EXAMPLE + reason: Unauthorized + schema: + $ref: "#/components/schemas/ApiError" + description: Unauthorized. + schemas: + AWSKMSConfiguration: + type: object + description: Amazon Web Services (AWS) KMS configuration details and encryption + at rest configuration set for the specified project. + externalDocs: + description: Amazon Web Services Key Management Service + url: https://www.mongodb.com/docs/atlas/security-aws-kms/ + properties: + accessKeyID: + type: string + description: Unique alphanumeric string that identifies an Identity and Access + Management (IAM) access key with permissions required to access your + Amazon Web Services (AWS) Customer Master Key (CMK). + example: 019dd98d94b4bb778e7552e4 + maxLength: 128 + minLength: 16 + customerMasterKeyID: + type: string + description: Unique alphanumeric string that identifies the Amazon Web Services + (AWS) Customer Master Key (CMK) you used to encrypt and decrypt the + MongoDB master keys. + maxLength: 2048 + minLength: 1 + enabled: + type: boolean + description: Flag that indicates whether someone enabled encryption at rest for + the specified project through Amazon Web Services (AWS) Key + Management Service (KMS). To disable encryption at rest using + customer key management and remove the configuration details, pass + only this parameter with a value of `false`. + region: + type: string + description: Physical location where MongoDB Cloud deploys your AWS-hosted + MongoDB cluster nodes. The region you choose can affect network + latency for clients accessing your databases. When MongoDB Cloud + deploys a dedicated cluster, it checks if a VPC or VPC connection + exists for that provider and region. If not, MongoDB Cloud creates + them as part of the deployment. MongoDB Cloud assigns the VPC a CIDR + block. To limit a new VPC peering connection to one CIDR block and + region, create the connection first. Deploy the cluster after the + connection starts. + title: AWS Regions + roleId: + type: string + description: Unique 24-hexadecimal digit string that identifies an Amazon Web + Services (AWS) Identity and Access Management (IAM) role. This IAM + role has the permissions required to manage your AWS customer master + key. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + secretAccessKey: + type: string + description: Human-readable label of the Identity and Access Management (IAM) + secret access key with permissions required to access your Amazon + Web Services (AWS) customer master key. + writeOnly: true + valid: + type: boolean + description: Flag that indicates whether the Amazon Web Services (AWS) Key + Management Service (KMS) encryption key can encrypt and decrypt + data. + readOnly: true + AddUserToTeam: + type: object + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + required: + - id + AdvancedAutoScalingSettings: + type: object + description: Options that determine how this cluster handles resource scaling. + properties: + compute: + $ref: "#/components/schemas/AdvancedComputeAutoScaling" + diskGB: + $ref: "#/components/schemas/DiskGBAutoScaling" + title: Automatic Scaling Settings + AdvancedClusterDescription: + type: object + properties: + acceptDataRisksAndForceReplicaSetReconfig: + type: string + format: date-time + description: If reconfiguration is necessary to regain a primary due to a + regional outage, submit this field alongside your topology + reconfiguration to request a new regional outage resistant topology. + Forced reconfigurations during an outage of the majority of + electable nodes carry a risk of data loss if replicated writes (even + majority committed writes) have not been replicated to the new + primary node. MongoDB Atlas docs contain more information. To + proceed with an operation which carries that risk, set + **acceptDataRisksAndForceReplicaSetReconfig** to the current date. + externalDocs: + description: Reconfiguring a Replica Set during a regional outage + url: https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set + backupEnabled: + type: boolean + default: false + description: Flag that indicates whether the cluster can perform backups. If set + to `true`, the cluster can perform backups. You must set this value + to `true` for NVMe clusters. Backup uses [Cloud + Backups](https://docs.atlas.mongodb.com/backup/cloud-backup/overview/) + for dedicated clusters and [Shared Cluster + Backups](https://docs.atlas.mongodb.com/backup/shared-tier/overview/) + for tenant clusters. If set to `false`, the cluster doesn't use + backups. + biConnector: + $ref: "#/components/schemas/BiConnector" + clusterType: + type: string + description: Configuration of nodes that comprise the cluster. + connectionStrings: + $ref: "#/components/schemas/ClusterConnectionStrings" + createDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this cluster. This + parameter expresses its value in ISO 8601 format in UTC. + readOnly: true + diskSizeGB: + type: number + format: double + description: Storage capacity that the host's root volume possesses expressed in + gigabytes. Increase this number to add capacity. MongoDB Cloud + requires this parameter if you set **replicationSpecs**. If you + specify a disk size below the minimum (10 GB), this parameter + defaults to the minimum disk size value. Storage charge calculations + depend on whether you choose the default value or a custom + value. The maximum value for disk storage cannot exceed 50 times + the maximum RAM for the selected cluster. If you require more + storage space, consider upgrading your cluster to a higher tier. + maximum: 4096 + minimum: 10 + encryptionAtRestProvider: + type: string + description: 'Cloud service provider that manages your customer keys to provide + an additional layer of encryption at rest for the cluster. To enable + customer key management for encryption at rest, the cluster + **replicationSpecs[n].regionConfigs[m].{type}Specs.instanceSize** + setting must be `M10` or higher and `"backupEnabled" : false` or + omitted entirely.' + externalDocs: + description: Encryption at Rest using Customer Key Management + url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a Global Cluster. If you include existing zones + in the request, you must specify this parameter. If you add a new + zone to an existing Global Cluster, you may specify this parameter. + The request deletes any existing zones in a Global Cluster that you + exclude from the request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + labels: + type: array + description: >- + Collection of key-value pairs between 1 to 255 characters in length + that tag and categorize the cluster. The MongoDB Cloud console + doesn't display your labels. + + + Cluster labels will be deprecated in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. + items: + $ref: "#/components/schemas/ComponentLabel" + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mongoDBMajorVersion: + type: string + default: "6.0" + description: Major MongoDB version of the cluster. MongoDB Cloud deploys the + cluster with the latest stable release of the specified version. + mongoDBVersion: + type: string + description: Version of MongoDB that the cluster runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + name: + type: string + description: Human-readable label that identifies the advanced cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + paused: + type: boolean + description: Flag that indicates whether the cluster is paused. + pitEnabled: + type: boolean + description: Flag that indicates whether the cluster uses continuous cloud + backups. + externalDocs: + description: Continuous Cloud Backups + url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ + replicationSpecs: + type: array + description: List of settings that configure your cluster regions. For Global + Clusters, each object in the array represents a zone where your + clusters nodes deploy. For non-Global sharded clusters and replica + sets, this array has one object representing where your clusters + nodes deploy. + items: + $ref: "#/components/schemas/ReplicationSpec" + rootCertType: + type: string + default: ISRGROOTX1 + description: Root Certificate Authority that MongoDB Cloud cluster uses. MongoDB + Cloud supports Internet Security Research Group. + stateName: + type: string + description: Human-readable label that indicates the current operating condition + of this cluster. + readOnly: true + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the cluster. + externalDocs: + description: Resource Tags + url: https://dochub.mongodb.org/core/add-cluster-tag-atlas + items: + $ref: "#/components/schemas/ResourceTag" + terminationProtectionEnabled: + type: boolean + default: false + description: Flag that indicates whether termination protection is enabled on + the cluster. If set to `true`, MongoDB Cloud won't delete the + cluster. If set to `false`, MongoDB Cloud will delete the cluster. + versionReleaseSystem: + type: string + default: LTS + description: Method by which the cluster maintains the MongoDB versions. If + value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. + AdvancedComputeAutoScaling: + type: object + description: Options that determine how this cluster handles CPU scaling. + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether someone enabled instance size + auto-scaling. + + + - Set to `true` to enable instance size auto-scaling. If enabled, you must specify a value for **replicationSpecs[n].regionConfigs[m].autoScaling.compute.maxInstanceSize**. + + - Set to `false` to disable instance size automatic scaling. + maxInstanceSize: + $ref: "#/components/schemas/BaseCloudProviderInstanceSize" + minInstanceSize: + $ref: "#/components/schemas/BaseCloudProviderInstanceSize" + scaleDownEnabled: + type: boolean + description: 'Flag that indicates whether the instance size may scale down. + MongoDB Cloud requires this parameter if + `"replicationSpecs[n].regionConfigs[m].autoScaling.compute.enabled" + : true`. If you enable this option, specify a value for + **replicationSpecs[n].regionConfigs[m].autoScaling.compute.minInstanceSize**.' + title: Automatic Compute Scaling Settings + AdvancedDiskBackupSnapshotSchedulePolicy: + type: object + description: List that contains a document for each backup policy item in the + desired backup policy. + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this backup + policy. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + policyItems: + type: array + description: List that contains the specifications for one policy. + items: + $ref: "#/components/schemas/DiskBackupApiPolicyItem" + AlertViewForNdsGroup: + type: object + properties: + acknowledgedUntil: + type: string + format: date-time + description: >- + Date and time until which this alert has been acknowledged. This + parameter expresses its value in the ISO 8601 timestamp format in UTC. The + resource returns this parameter if a MongoDB User previously + acknowledged this alert. + + + - To acknowledge this alert forever, set the parameter value to 100 years in the future. + + + - To unacknowledge a previously acknowledged alert, set the parameter value to a date in the past. + acknowledgementComment: + type: string + description: Comment that a MongoDB Cloud user submitted when acknowledging the + alert. + example: Expiration on 3/19. Silencing for 7days. + maxLength: 200 + acknowledgingUsername: + type: string + format: email + description: MongoDB Cloud username of the person who acknowledged the alert. + The response returns this parameter if a MongoDB Cloud user + previously acknowledged this alert. + readOnly: true + alertConfigId: + type: string + description: Unique 24-hexadecimal digit string that identifies the alert + configuration that sets this alert. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + created: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this alert. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + eventTypeName: + type: string + description: Incident that triggered this alert. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + owns this alert. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this alert. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lastNotified: + type: string + format: date-time + description: Date and time that any notifications were last sent for this alert. + This parameter expresses its value in the ISO 8601 timestamp format in UTC. The + resource returns this parameter if MongoDB Cloud has sent + notifications for this alert. + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + orgId: + type: string + description: Unique 24-hexadecimal character string that identifies the + organization that owns the project to which this alert applies. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + resolved: + type: string + format: date-time + description: 'Date and time that this alert changed to `"status" : "CLOSED"`. + This parameter expresses its value in the ISO 8601 timestamp format in UTC. The + resource returns this parameter once `"status" : "CLOSED"`.' + readOnly: true + status: + type: string + description: State of this alert at the time you requested its details. + example: OPEN + readOnly: true + updated: + type: string + format: date-time + description: Date and time when someone last updated this alert. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + clusterName: + type: string + description: Human-readable label that identifies the cluster to which this + alert applies. This resource returns this parameter for alerts of + events impacting backups, replica sets, or sharded clusters. + example: cluster1 + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + hostnameAndPort: + type: string + description: Hostname and port of the host to which this alert applies. The + resource returns this parameter for alerts of events impacting hosts + or replica sets. + example: cloud-test.mongodb.com:27017 + readOnly: true + replicaSetName: + type: string + description: Name of the replica set to which this alert applies. The response + returns this parameter for alerts of events impacting backups, + hosts, or replica sets. + example: event-replica-set + readOnly: true + currentValue: + $ref: "#/components/schemas/NumberMetricValue" + metricName: + type: string + description: >- + Name of the metric against which Atlas checks the configured + `metricThreshold.threshold`. + + + To learn more about the available metrics, see Host Metrics. + + + **NOTE**: If you set eventTypeName to OUTSIDE_SERVERLESS_METRIC_THRESHOLD, you can specify only metrics available for serverless. To learn more, see Serverless Measurements. + example: ASSERT_USER + readOnly: true + nonRunningHostIds: + type: array + description: List of unique 24-hexadecimal character strings that identify the + replica set members that are not in PRIMARY nor SECONDARY state. + items: + type: string + example: 32b6e34b3d91647abb20e7b8 + maxLength: 32 + minLength: 8 + pattern: ^([a-f0-9]{8,32})$ + readOnly: true + readOnly: true + parentClusterId: + type: string + description: Unique 24-hexadecimal character string that identifies the parent + cluster to which this alert applies. The parent cluster contains the + sharded nodes. MongoDB Cloud returns this parameter only for alerts + of events impacting sharded clusters. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 64 + minLength: 1 + pattern: ^([a-f0-9]{24})$ + readOnly: true + AlertsNotificationRootForGroup: + type: object + description: One target that MongoDB Cloud sends notifications when an alert triggers. + properties: + datadogApiKey: + type: string + description: >- + Datadog API Key that MongoDB Cloud needs to send alert notifications + to Datadog. You can find this API key in the Datadog dashboard. The + resource requires this parameter when `"notifications.[n].typeName" + : "DATADOG"`. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + example: "****************************a23c" + datadogRegion: + type: string + default: US + description: >- + Datadog region that indicates which API Uniform Resource Locator + (URL) to use. The resource requires this parameter when + `"notifications.[n].typeName" : "DATADOG"`. + + + To learn more about Datadog's regions, see Datadog Sites. + delayMin: + type: integer + format: int32 + description: Number of minutes that MongoDB Cloud waits after detecting an alert + condition before it sends out the first notification. + intervalMin: + type: integer + format: int32 + description: >- + Number of minutes to wait between successive notifications. MongoDB + Cloud sends notifications until someone acknowledges the + unacknowledged alert. + + + PagerDuty, VictorOps, and OpsGenie notifications don't return this element. Configure and manage the notification interval within each of those services. + minimum: 5 + notifierId: + type: string + description: The notifierId is a system-generated unique identifier assigned to + each notification method. This is needed when updating third-party + notifications without requiring explicit authentication credentials. + example: 6462742adc47d365036da07c + typeName: + type: string + description: Human-readable label that displays the alert notification type. + emailAddress: + type: string + format: email + description: >- + Email address to which MongoDB Cloud sends alert notifications. The + resource requires this parameter when `"notifications.[n].typeName" + : "EMAIL"`. You don’t need to set this value to send emails to + individual or groups of MongoDB Cloud users including: + + + - specific MongoDB Cloud users (`"notifications.[n].typeName" : "USER"`) + + - MongoDB Cloud users with specific project roles (`"notifications.[n].typeName" : "GROUP"`) + + - MongoDB Cloud users with specific organization roles (`"notifications.[n].typeName" : "ORG"`) + + - MongoDB Cloud teams (`"notifications.[n].typeName" : "TEAM"`) + + + To send emails to one MongoDB Cloud user or grouping of users, set the `notifications.[n].emailEnabled` parameter. + emailEnabled: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud should send email + notifications. The resource requires this parameter when one of the + following values have been set: + + + - `"notifications.[n].typeName" : "ORG"` + + - `"notifications.[n].typeName" : "GROUP"` + + - `"notifications.[n].typeName" : "USER"` + roles: + type: array + description: 'List that contains the one or more + [organization](https://dochub.mongodb.org/core/atlas-org-roles) or + [project roles](https://dochub.mongodb.org/core/atlas-proj-roles) + that receive the configured alert. The resource requires this + parameter when `"notifications.[n].typeName" : "GROUP"` or + `"notifications.[n].typeName" : "ORG"`. If you include this + parameter, MongoDB Cloud sends alerts only to users assigned the + roles you specify in the array. If you omit this parameter, MongoDB + Cloud sends alerts to users assigned any role.' + items: + type: string + description: One organization or project role that receive the configured alert. + smsEnabled: + type: boolean + description: >- + Flag that indicates whether MongoDB Cloud should send text message + notifications. The resource requires this parameter when one of the + following values have been set: + + + - `"notifications.[n].typeName" : "ORG"` + + - `"notifications.[n].typeName" : "GROUP"` + + - `"notifications.[n].typeName" : "USER"` + notificationToken: + type: string + description: >- + HipChat API token that MongoDB Cloud needs to send alert + notifications to HipChat. The resource requires this parameter when + `"notifications.[n].typeName" : "HIP_CHAT"`". If the token later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the token remains invalid, MongoDB Cloud removes it. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + example: "************************************1234" + roomName: + type: string + description: 'HipChat API room name to which MongoDB Cloud sends alert + notifications. The resource requires this parameter when + `"notifications.[n].typeName" : "HIP_CHAT"`".' + example: test room + microsoftTeamsWebhookUrl: + type: string + description: >- + Microsoft Teams Webhook Uniform Resource Locator (URL) that MongoDB + Cloud needs to send this notification via Microsoft Teams. The + resource requires this parameter when `"notifications.[n].typeName" + : "MICROSOFT_TEAMS"`. If the URL later becomes invalid, MongoDB + Cloud sends an email to the project owners. If the key remains + invalid, MongoDB Cloud removes it. + + + **NOTE**: When you view or edit the alert for a Microsoft Teams notification, the URL appears partially redacted. + example: https://webhook.com/**** + opsGenieApiKey: + type: string + description: >- + API Key that MongoDB Cloud needs to send this notification via + Opsgenie. The resource requires this parameter when + `"notifications.[n].typeName" : "OPS_GENIE"`. If the key later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the key remains invalid, MongoDB Cloud removes it. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + example: "********************************a111" + opsGenieRegion: + type: string + default: US + description: Opsgenie region that indicates which API Uniform Resource Locator + (URL) to use. + region: + type: string + default: US + description: PagerDuty region that indicates which API Uniform Resource Locator + (URL) to use. + serviceKey: + type: string + description: >- + PagerDuty service key that MongoDB Cloud needs to send notifications + via PagerDuty. The resource requires this parameter when + `"notifications.[n].typeName" : "PAGER_DUTY"`. If the key later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the key remains invalid, MongoDB Cloud removes it. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + example: "****************************7890" + apiToken: + type: string + description: >- + Slack API token or Bot token that MongoDB Cloud needs to send alert + notifications via Slack. The resource requires this parameter when + `"notifications.[n].typeName" : "SLACK"`. If the token later becomes + invalid, MongoDB Cloud sends an email to the project owners. If the + token remains invalid, MongoDB Cloud removes the token. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + example: "*********************************************************************\ + *abcd" + channelName: + type: string + description: 'Name of the Slack channel to which MongoDB Cloud sends alert + notifications. The resource requires this parameter when + `"notifications.[n].typeName" : "SLACK"`.' + example: alerts + mobileNumber: + type: string + description: 'Mobile phone number to which MongoDB Cloud sends alert + notifications. The resource requires this parameter when + `"notifications.[n].typeName" : "SMS"`.' + example: "1233337892" + teamId: + type: string + description: 'Unique 24-hexadecimal digit string that identifies one MongoDB + Cloud team. The resource requires this parameter when + `"notifications.[n].typeName" : "TEAM"`.' + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + teamName: + type: string + description: 'Name of the MongoDB Cloud team that receives this notification. + The resource requires this parameter when + `"notifications.[n].typeName" : "TEAM"`.' + example: Atlas + username: + type: string + format: email + description: 'MongoDB Cloud username of the person to whom MongoDB Cloud sends + notifications. Specify only MongoDB Cloud users who belong to the + project that owns the alert configuration. The resource requires + this parameter when `"notifications.[n].typeName" : "USER"`.' + victorOpsApiKey: + type: string + description: >- + API key that MongoDB Cloud needs to send alert notifications to + Splunk On-Call. The resource requires this parameter when + `"notifications.[n].typeName" : "VICTOR_OPS"`. If the key later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the key remains invalid, MongoDB Cloud removes it. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + example: "********************************9abc" + victorOpsRoutingKey: + type: string + description: 'Routing key that MongoDB Cloud needs to send alert notifications + to Splunk On-Call. The resource requires this parameter when + `"notifications.[n].typeName" : "VICTOR_OPS"`. If the key later + becomes invalid, MongoDB Cloud sends an email to the project owners. + If the key remains invalid, MongoDB Cloud removes it.' + example: test routing + webhookSecret: + type: string + description: >- + Authentication secret for a webhook-based alert. + + + Atlas returns this value if you set `"notifications.[n].typeName" :"WEBHOOK"` and either: + + * You set `notification.[n].webhookSecret` to a non-empty string + + * You set a default webhookSecret either on the [Integrations](https://www.mongodb.com/docs/atlas/tutorial/third-party-service-integrations/#std-label-third-party-integrations) page, or with the [Integrations API](#tag/Third-Party-Service-Integrations/operation/createIntegration) + + + **NOTE**: When you view or edit the alert for a webhook notification, the secret appears completely redacted. + example: "******" + webhookUrl: + type: string + description: >- + Target URL for a webhook-based alert. + + + Atlas returns this value if you set `"notifications.[n].typeName" :"WEBHOOK"` and either: + + * You set `notification.[n].webhookURL` to a non-empty string + + * You set a default webhookUrl either on the [Integrations](https://www.mongodb.com/docs/atlas/tutorial/third-party-service-integrations/#std-label-third-party-integrations) page, or with the [Integrations API](#tag/Third-Party-Service-Integrations/operation/createIntegration) + + + **NOTE**: When you view or edit the alert for a Webhook URL notification, the URL appears partially redacted. + example: https://webhook.com/**** + AlertsToggle: + type: object + description: Enables or disables the specified alert configuration in the + specified project. + properties: + enabled: + type: boolean + description: Flag that indicates whether to enable or disable the specified + alert configuration in the specified project. + title: Toggle Request + ApiError: + type: object + properties: + detail: + type: string + description: Describes the specific conditions or reasons that cause each type + of error. + error: + type: integer + format: int32 + description: HTTP status code returned with this error. + maximum: 599 + minimum: 200 + errorCode: + type: string + description: Application error code returned with this error. + example: TOO_MANY_GROUP_NOTIFICATIONS + parameters: + type: array + description: Parameter uses to give more information about the error. + items: {} + reason: + type: string + description: Application error message returned with this error. + example: At most one group notification can be specified for an alert + configuration. + ApiHostView_Atlas: + type: object + properties: + created: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this MongoDB process. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostname: + type: string + description: Hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + readOnly: true + id: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + lastPing: + type: string + format: date-time + description: Date and time when MongoDB Cloud received the last ping for this + MongoDB process. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link_Atlas" + readOnly: true + port: + type: integer + format: int32 + description: Internet Assigned Numbers Authority (IANA) port on which the + MongoDB process listens for requests. + readOnly: true + replicaSetName: + type: string + description: Human-readable label that identifies the replica set that contains + this process. This resource returns this parameter if this process + belongs to a replica set. + readOnly: true + shardName: + type: string + description: Human-readable label that identifies the shard that contains this + process. This resource returns this value only if this process + belongs to a sharded cluster. + readOnly: true + typeName: + type: string + description: Type of MongoDB process that MongoDB Cloud tracks. MongoDB Cloud + returns new processes as **NO_DATA** until MongoDB Cloud completes + deploying the process. + readOnly: true + userAlias: + type: string + description: Human-readable label that identifies the cluster node. MongoDB + Cloud sets this hostname usually to the standard hostname for the + cluster node. It appears in the connection string for a cluster + instead of the value of the hostname parameter. + readOnly: true + version: + type: string + description: Version of MongoDB that this process runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + ApiKey: + type: object + description: Details contained in one API key. + properties: + accessList: + type: array + description: List of network addresses granted access to this API using this API + key. + items: + $ref: "#/components/schemas/AccessListItem" + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this + organization API key. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + publicKey: + type: string + description: Public API key value set for the specified organization API key. + maxLength: 8 + minLength: 8 + readOnly: true + roles: + type: array + description: List that contains roles that the API key needs to have. All roles + you provide must be valid for the specified project or organization. + Each request must include a minimum of one valid role. The resource + returns all project and organization roles assigned to the Cloud + user. + items: + $ref: "#/components/schemas/CloudAccessRoleAssignment" + readOnly: true + readOnly: true + required: + - id + - publicKey + ApiKeyUserDetails: + type: object + properties: + desc: + type: string + description: Purpose or explanation provided when someone created this + organization API key. + maxLength: 250 + minLength: 1 + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this + organization API key assigned to this project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + privateKey: + type: string + description: Redacted private key returned for this organization API key. This + key displays unredacted when first created. + example: 55c3bbb6-b4bb-0be1-e66d20841f3e + readOnly: true + publicKey: + type: string + description: Public API key value set for the specified organization API key. + example: zmmrboas + maxLength: 8 + minLength: 8 + readOnly: true + roles: + type: array + description: List that contains the roles that the API key needs to have. All + roles you provide must be valid for the specified project or + organization. Each request must include a minimum of one valid role. + The resource returns all project and organization roles assigned to + the API key. + items: + $ref: "#/components/schemas/CloudAccessRoleAssignment" + ApiMeasurementsGeneralView_Atlas: + type: object + properties: + databaseName: + type: string + description: Human-readable label that identifies the database that the + specified MongoDB process serves. + readOnly: true + end: + type: string + format: date-time + description: Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostId: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link_Atlas" + readOnly: true + measurements: + type: array + description: List that contains measurements and their data points. + items: + $ref: "#/components/schemas/MetricsMeasurement_Atlas" + readOnly: true + partitionName: + type: string + description: Human-readable label of the disk or partition to which the + measurements apply. + readOnly: true + processId: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + AtlasClusterOutageSimulationOutageFilter: + type: object + properties: + cloudProvider: + type: string + description: The cloud provider of the region that undergoes the outage + simulation. + regionName: + type: string + description: The name of the region to undergo an outage simulation. + type: + type: string + description: |- + The type of cluster outage to simulate. + + | Type | Description | + |------------|-------------| + | `REGION` | Simulates a cluster outage for a region.| + AtlasOrganization: + type: object + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + isDeleted: + type: boolean + description: Flag that indicates whether this organization has been deleted. + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + name: + type: string + description: Human-readable label that identifies the organization. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + required: + - name + AuditLog: + type: object + properties: + auditAuthorizationSuccess: + type: boolean + default: false + description: 'Flag that indicates whether someone set auditing to track + successful authentications. This only applies to the `"atype" : + "authCheck"` audit filter. Setting this parameter to `true` degrades + cluster performance.' + externalDocs: + description: System Auditing Messages + url: https://docs.mongodb.com/manual/reference/audit-message/#audit-event-actions-details-and-results + auditFilter: + type: string + description: JSON document that specifies which events to record. Escape any + characters that may prevent parsing, such as single or double + quotes, using a backslash (`\`). + externalDocs: + description: Custom Auditing Filter + url: https://docs.atlas.mongodb.com/tutorial/auditing-custom-filter/ + configurationType: + type: string + description: Human-readable label that displays how to configure the audit filter. + readOnly: true + enabled: + type: boolean + default: false + description: Flag that indicates whether someone enabled database auditing for + the specified project. + required: + - auditAuthorizationSuccess + - auditFilter + - enabled + AuthFederationRoleMapping: + type: object + description: Mapping settings that link one IdP and MongoDB Cloud. + properties: + externalGroupName: + type: string + description: Unique human-readable label that identifies the identity provider + group to whichthis role mapping applies. + maxLength: 200 + minLength: 1 + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this role mapping. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + roleAssignments: + type: array + description: Atlas roles and the unique identifiers of the groups and + organizations associated with each role. + items: + $ref: "#/components/schemas/RoleAssignment" + uniqueItems: true + required: + - externalGroupName + title: Federated Authentication Role Mapping + AvailableCloudProviderRegion: + type: object + description: List of regions that this cloud provider supports for this instance size. + properties: + default: + type: boolean + description: Flag that indicates whether the cloud provider sets this region as + its default. AWS defaults to US_EAST_1, GCP defaults to CENTRAL_US, + and AZURE defaults to US_WEST_2. + readOnly: true + name: + type: string + description: Human-readable label that identifies the supported region. + readOnly: true + readOnly: true + AvailableClustersDeployment: + type: object + description: Deployments that can be migrated to MongoDB Atlas. + properties: + agentVersion: + type: string + description: Version of MongoDB Agent that monitors/manages the cluster. + readOnly: true + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + dbSizeBytes: + type: integer + format: int64 + description: Size of this database on disk at the time of the request expressed + in bytes. + example: 8192 + readOnly: true + featureCompatibilityVersion: + type: string + description: Version of MongoDB + [features](https://docs.mongodb.com/manual/reference/command/setFeatureCompatibilityVersion) + that this cluster supports. + readOnly: true + managed: + type: boolean + description: Flag that indicates whether Automation manages this cluster. + readOnly: true + mongoDBVersion: + type: string + description: Version of MongoDB that this cluster runs. + readOnly: true + name: + type: string + description: Human-readable label that identifies this cluster. + example: Project X sharded cluster + readOnly: true + oplogSizeMB: + type: integer + format: int32 + description: Size of the Oplog on disk at the time of the request expressed in MB. + example: 3 + readOnly: true + sharded: + type: boolean + description: >- + Flag that indicates whether someone configured this cluster as a + sharded cluster. + + + - If `true`, this cluster serves as a sharded cluster. + + - If `false`, this cluster serves as a replica set. + readOnly: true + shardsSize: + type: integer + format: int32 + description: Number of shards that comprise this cluster. + example: 3 + readOnly: true + tlsEnabled: + type: boolean + description: Flag that indicates whether someone enabled TLS for this cluster. + readOnly: true + required: + - featureCompatibilityVersion + - managed + - mongoDBVersion + - name + - sharded + - tlsEnabled + title: Available Clusters + AzureKeyVault: + type: object + description: Details that define the configuration of Encryption at Rest using + Azure Key Vault (AKV). + externalDocs: + description: Azure Key Vault + url: https://www.mongodb.com/docs/atlas/security-azure-kms/ + properties: + azureEnvironment: + type: string + description: Azure environment in which your account credentials reside. + clientID: + type: string + format: uuid + description: Unique 36-hexadecimal character string that identifies an Azure + application associated with your Azure Active Directory tenant. + enabled: + type: boolean + description: Flag that indicates whether someone enabled encryption at rest for + the specified project. To disable encryption at rest using customer + key management and remove the configuration details, pass only this + parameter with a value of `false`. + keyIdentifier: + type: string + description: Web address with a unique key that identifies for your Azure Key + Vault. + example: https://EXAMPLEKeyVault.vault.azure.net/keys/EXAMPLEKey/d891821e3d364e9eb88fbd3d11807b86 + keyVaultName: + type: string + description: Unique string that identifies the Azure Key Vault that contains + your key. + resourceGroupName: + type: string + description: Name of the Azure resource group that contains your Azure Key Vault. + secret: + type: string + description: Private data that you need secured and that belongs to the + specified Azure Key Vault (AKV) tenant (**azureKeyVault.tenantID**). + This data can include any type of sensitive data such as passwords, + database connection strings, API keys, and the like. AKV stores this + information as encrypted binary data. + externalDocs: + description: Azure Key Vault Secrets + url: https://docs.microsoft.com/en-us/azure/key-vault/secrets/about-secrets + writeOnly: true + subscriptionID: + type: string + format: uuid + description: Unique 36-hexadecimal character string that identifies your Azure + subscription. + tenantID: + type: string + format: uuid + description: Unique 36-hexadecimal character string that identifies the Azure + Active Directory tenant within your Azure subscription. + valid: + type: boolean + description: Flag that indicates whether the Azure encryption key can encrypt + and decrypt data. + readOnly: true + BackupLabel: + type: object + description: Collection of key-value pairs that represent custom data to add to + the metadata file that MongoDB Cloud uploads to the bucket when the + export job finishes. + properties: + key: + type: string + description: Key for the metadata file that MongoDB Cloud uploads to the bucket + when the export job finishes. + value: + type: string + description: Value for the key to include in file that MongoDB Cloud uploads to + the bucket when the export job finishes. + BackupOnlineArchive: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the online + archive. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: Human-readable label that identifies the cluster that contains the + collection for which you want to create an online archive. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + collName: + type: string + description: Human-readable label that identifies the collection for which you + created the online archive. + collectionType: + type: string + default: STANDARD + description: >- + Classification of MongoDB database collection that you want to + return. + + + If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`. + criteria: + $ref: "#/components/schemas/Criteria" + dataProcessRegion: + $ref: "#/components/schemas/DataProcessRegion" + dataSetName: + type: string + description: Human-readable label that identifies the dataset that Atlas + generates for this online archive. + readOnly: true + dbName: + type: string + description: Human-readable label of the database that contains the collection + that contains the online archive. + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + contains the specified cluster. The specified cluster contains the + collection for which to create the online archive. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + partitionFields: + type: array + description: "List that contains document parameters to use to logically divide + data within a collection. Partitions provide a coarse level of + filtering of the underlying collection data. To divide your data, + specify parameters that you frequently query. If you \"specified + :criteria.type\": \"DATE\" in the CREATE ONE ONLINE ARCHIVE + endpoint, then you can specify up to three parameters by which to + query. One of these parameters must be the DATE value, which is + required in this case. If you \"specified :criteria.type\": + \"CUSTOM\" in the CREATE ONE ONLINE ARCHIVE endpoint, then you can + specify up to two parameters by which to query. Queries that don't + use \":criteria.type\": \"DATE\" or \":criteria.type\": \"CUSTOM\" + parameters cause MongoDB to scan a full collection of all archived + documents. This takes more time and increases your costs." + items: + $ref: "#/components/schemas/PartitionField" + minItems: 1 + paused: + type: boolean + description: Flag that indicates whether this online archive exists in the + paused state. A request to resume fails if the collection has + another active online archive. To pause an active online archive or + resume a paused online archive, you must include this parameter. To + pause an active archive, set this to **true**. To resume a paused + archive, set this to **false**. + schedule: + $ref: "#/components/schemas/OnlineArchiveSchedule" + state: + type: string + description: >- + Phase of the process to create this online archive when you made + this request. + + + | State | Indication | + + |-------------|------------| + + | `PENDING` | MongoDB Cloud has queued documents for archive. Archiving hasn't started. | + + | `ARCHIVING` | MongoDB Cloud started archiving documents that meet the archival criteria. | + + | `IDLE` | MongoDB Cloud waits to start the next archival job. | + + | `PAUSING` | Someone chose to stop archiving. MongoDB Cloud finishes the running archival job then changes the state to `PAUSED` when that job completes. | + + | `PAUSED` | MongoDB Cloud has stopped archiving. Archived documents can be queried. The specified archiving operation on the active cluster cannot archive additional documents. You can resume archiving for paused archives at any time. | + + | `ORPHANED` | Someone has deleted the collection associated with an active or paused archive. MongoDB Cloud doesn't delete the archived data. You must manually delete the online archives associated with the deleted collection. | + + | `DELETED` | Someone has deleted the archive was deleted. When someone deletes an online archive, MongoDB Cloud removes all associated archived documents from the cloud object storage. | + readOnly: true + BackupOnlineArchiveCreate: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the online + archive. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: Human-readable label that identifies the cluster that contains the + collection for which you want to create an online archive. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + collName: + type: string + description: Human-readable label that identifies the collection for which you + created the online archive. + collectionType: + type: string + default: STANDARD + description: >- + Classification of MongoDB database collection that you want to + return. + + + If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`. + criteria: + $ref: "#/components/schemas/Criteria" + dataProcessRegion: + $ref: "#/components/schemas/DataProcessRegion" + dataSetName: + type: string + description: Human-readable label that identifies the dataset that Atlas + generates for this online archive. + readOnly: true + dbName: + type: string + description: Human-readable label of the database that contains the collection + that contains the online archive. + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + contains the specified cluster. The specified cluster contains the + collection for which to create the online archive. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + partitionFields: + type: array + description: "List that contains document parameters to use to logically divide + data within a collection. Partitions provide a coarse level of + filtering of the underlying collection data. To divide your data, + specify parameters that you frequently query. If you \"specified + :criteria.type\": \"DATE\" in the CREATE ONE ONLINE ARCHIVE + endpoint, then you can specify up to three parameters by which to + query. One of these parameters must be the DATE value, which is + required in this case. If you \"specified :criteria.type\": + \"CUSTOM\" in the CREATE ONE ONLINE ARCHIVE endpoint, then you can + specify up to two parameters by which to query. Queries that don't + use \":criteria.type\": \"DATE\" or \":criteria.type\": \"CUSTOM\" + parameters cause MongoDB to scan a full collection of all archived + documents. This takes more time and increases your costs." + items: + $ref: "#/components/schemas/PartitionField" + minItems: 1 + paused: + type: boolean + description: Flag that indicates whether this online archive exists in the + paused state. A request to resume fails if the collection has + another active online archive. To pause an active online archive or + resume a paused online archive, you must include this parameter. To + pause an active archive, set this to **true**. To resume a paused + archive, set this to **false**. + schedule: + $ref: "#/components/schemas/OnlineArchiveSchedule" + state: + type: string + description: >- + Phase of the process to create this online archive when you made + this request. + + + | State | Indication | + + |-------------|------------| + + | `PENDING` | MongoDB Cloud has queued documents for archive. Archiving hasn't started. | + + | `ARCHIVING` | MongoDB Cloud started archiving documents that meet the archival criteria. | + + | `IDLE` | MongoDB Cloud waits to start the next archival job. | + + | `PAUSING` | Someone chose to stop archiving. MongoDB Cloud finishes the running archival job then changes the state to `PAUSED` when that job completes. | + + | `PAUSED` | MongoDB Cloud has stopped archiving. Archived documents can be queried. The specified archiving operation on the active cluster cannot archive additional documents. You can resume archiving for paused archives at any time. | + + | `ORPHANED` | Someone has deleted the collection associated with an active or paused archive. MongoDB Cloud doesn't delete the archived data. You must manually delete the online archives associated with the deleted collection. | + + | `DELETED` | Someone has deleted the archive was deleted. When someone deletes an online archive, MongoDB Cloud removes all associated archived documents from the cloud object storage. | + readOnly: true + required: + - collName + - criteria + - dbName + BackupRestoreJob: + type: object + properties: + batchId: + type: string + description: Unique 24-hexadecimal digit string that identifies the batch to + which this restore job belongs. This parameter exists only for a + sharded cluster restore. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + checkpointId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the sharded + cluster checkpoint. The checkpoint represents the point in time back + to which you want to restore you data. This parameter applies when + `"delivery.methodName" : "AUTOMATED_RESTORE"`. Use this parameter + with sharded clusters only. + + + - If you set **checkpointId**, you can't set **oplogInc**, **oplogTs**, **snapshotId**, or **pointInTimeUTCMillis**. + + - If you provide this parameter, this endpoint restores all data up to this checkpoint to the database you specify in the **delivery** object. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster with + the snapshot you want to return. This parameter returns for restore + clusters. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: Human-readable label that identifies the cluster containing the + snapshots you want to retrieve. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + created: + type: string + format: date-time + description: Date and time when someone requested this restore job. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + delivery: + $ref: "#/components/schemas/BackupRestoreJobDelivery" + encryptionEnabled: + type: boolean + description: Flag that indicates whether someone encrypted the data in the + restored snapshot. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + owns the snapshots. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hashes: + type: array + description: 'List that contains documents mapping each restore file to a hashed + checksum. This parameter applies after you download the + corresponding **delivery.url**. If `"methodName" : "HTTP"`, this + list contains one object that represents the hash of the **.tar.gz** + file.' + items: + $ref: "#/components/schemas/RestoreJobFileHash" + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the restore job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: 'Universally Unique Identifier (UUID) that identifies the Key + Management Interoperability (KMIP) master key used to encrypt the + snapshot data. This parameter applies only when `"encryptionEnabled" + : "true"`.' + readOnly: true + oplogInc: + type: integer + format: int32 + description: >- + Thirty-two-bit incrementing ordinal that represents operations + within a given second. When paired with **oplogTs**, this represents + the point in time to which MongoDB Cloud restores your data. This + parameter applies when `"delivery.methodName" : + "AUTOMATED_RESTORE"`. + + + - If you set **oplogInc**, you must set **oplogTs**, and can't set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. + + - If you provide this parameter, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the **delivery** object. + minimum: 1 + writeOnly: true + oplogTs: + type: string + description: >- + Date and time from which you want to restore this snapshot. This + parameter expresses its value in ISO 8601 format in UTC. This + represents the first part of an Oplog timestamp. When paired with + **oplogInc**, they represent the last database operation to which + you want to restore your data. This parameter applies when + `"delivery.methodName" : "AUTOMATED_RESTORE"`. Run a query against + **local.oplog.rs** on your replica set to find the desired + timestamp. + + + - If you set **oplogTs**, you must set **oplogInc**, and you can't set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. + + - If you provide this parameter, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the **delivery** object. + pattern: ^(?:[1-9]\\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d{1,9})?(?:Z|[+-][01]\\d:[0-5]\\d)$ + writeOnly: true + pointInTimeUTCMillis: + type: integer + format: int64 + description: >- + Timestamp from which you want to restore this snapshot. This + parameter expresses its value in the number of milliseconds elapsed + since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + This timestamp must fall within the last 24 hours of the current + time. This parameter applies when `"delivery.methodName" : + "AUTOMATED_RESTORE"`. + + + - If you provide this parameter, this endpoint restores all data up to this point in time to the database you specified in the **delivery** object. + + - If you set **pointInTimeUTCMillis**, you can't set **oplogInc**, **oplogTs**, **snapshotId**, or **checkpointId**. + minimum: 1199145600000 + writeOnly: true + snapshotId: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot to + restore. If you set **snapshotId**, you can't set **oplogInc**, + **oplogTs**, **pointInTimeUTCMillis**, or **checkpointId**. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + statusName: + type: string + description: Human-readable label that identifies the status of the downloadable + file at the time of the request. + readOnly: true + timestamp: + $ref: "#/components/schemas/ApiBSONTimestamp" + required: + - delivery + BackupRestoreJobDelivery: + type: object + description: Method and details that indicate how to deliver the restored + snapshot data. + properties: + authHeader: + type: string + description: 'Header name to use when downloading the restore, used with + `"delivery.methodName" : "HTTP"`.' + readOnly: true + authValue: + type: string + description: 'Header value to use when downloading the restore, used with + `"delivery.methodName" : "HTTP"`.' + readOnly: true + expirationHours: + type: integer + format: int32 + description: 'Number of hours after the restore job completes that indicates + when the Uniform Resource Locator (URL) for the snapshot download + file expires. The resource returns this parameter when + `"delivery.methodName" : "HTTP"`.' + minimum: 1 + expires: + type: string + format: date-time + description: 'Date and time when the Uniform Resource Locator (URL) for the + snapshot download file expires. This parameter expresses its value + in the ISO 8601 timestamp format in UTC. The resource returns this + parameter when `"delivery.methodName" : "HTTP"`.' + readOnly: true + maxDownloads: + type: integer + format: int32 + description: 'Positive integer that indicates how many times you can use the + Uniform Resource Locator (URL) for the snapshot download file. The + resource returns this parameter when `"delivery.methodName" : + "HTTP"`.' + minimum: 1 + methodName: + type: string + description: 'Human-readable label that identifies the means for delivering the + data. If you set `"delivery.methodName" : "AUTOMATED_RESTORE"`, you + must also set: **delivery.targetGroupId** and + **delivery.targetClusterName** or **delivery.targetClusterId**. The + response returns `"delivery.methodName" : "HTTP"` as an automated + restore uses HyperText Transport Protocol (HTTP) to deliver the + restore job to the target host.' + statusName: + type: string + description: State of the downloadable snapshot file when MongoDB Cloud received + this request. + readOnly: true + targetClusterId: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the target + cluster. Use the **clusterId** returned in the response body of the + **Get All Snapshots** and **Get a Snapshot** endpoints. This + parameter applies when `"delivery.methodName" : + "AUTOMATED_RESTORE"`. + + If the target cluster doesn't have backup enabled, two resources return parameters with empty values: + + - **Get All Snapshots** endpoint returns an empty results array without **clusterId** elements + + - **Get a Snapshot** endpoint doesn't return a **clusterId** parameter. + + + To return a response with the **clusterId** parameter, either use the **delivery.targetClusterName** parameter or enable backup on the target cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + targetClusterName: + type: string + description: >- + Human-readable label that identifies the target cluster. Use the + **clusterName** returned in the response body of the **Get All + Snapshots** and **Get a Snapshot** endpoints. This parameter + applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. + + + If the target cluster doesn't have backup enabled, two resources return parameters with empty values: + + + - **Get All Snapshots** endpoint returns an empty results array without **clusterId** elements + + - **Get a Snapshot** endpoint doesn't return a **clusterId** parameter. + + + To return a response with the **clusterId** parameter, either use the **delivery.targetClusterName** parameter or enable backup on the target cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + targetGroupId: + type: string + description: 'Unique 24-hexadecimal digit string that identifies the project + that contains the destination cluster for the restore job. The + resource returns this parameter when `"delivery.methodName" : + "AUTOMATED_RESTORE"`.' + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + url: + type: string + deprecated: true + description: 'Uniform Resource Locator (URL) from which you can download the + restored snapshot data. Url includes the verification key. The + resource returns this parameter when `"delivery.methodName" : + "HTTP"`.' + readOnly: true + urlV2: + type: string + description: 'Uniform Resource Locator (URL) from which you can download the + restored snapshot data. This should be preferred over **url**. The + verification key must be sent as an HTTP header. The resource + returns this parameter when `"delivery.methodName" : "HTTP"`.' + readOnly: true + required: + - methodName + title: Restore Snapshot Delivery Metadata + BackupSnapshot: + type: object + properties: + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster with + the snapshots you want to return. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + complete: + type: boolean + description: Flag that indicates whether the snapshot exists. This flag returns + `false` while MongoDB Cloud creates the snapshot. + readOnly: true + created: + $ref: "#/components/schemas/ApiBSONTimestamp" + doNotDelete: + type: boolean + description: "Flag that indicates whether someone can delete this snapshot. You + can't set `\"doNotDelete\" : true` and set a timestamp for + **expires** in the same request." + expires: + type: string + format: date-time + description: 'Date and time when MongoDB Cloud deletes the snapshot. If + `"doNotDelete" : true`, MongoDB Cloud removes any value set for this + parameter.' + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + owns the snapshots. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + incremental: + type: boolean + description: Flag indicating if this is an incremental or a full snapshot. + readOnly: true + lastOplogAppliedTimestamp: + $ref: "#/components/schemas/ApiBSONTimestamp" + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + parts: + type: array + description: >- + Metadata that describes the complete snapshot. + + + - For a replica set, this array contains a single document. + + - For a sharded cluster, this array contains one document for each shard plus one document for the config host. + items: + $ref: "#/components/schemas/BackupSnapshotPart" + readOnly: true + BackupSnapshotPart: + type: object + description: Characteristics that identify this snapshot. + properties: + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster with + the snapshots you want to return. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + compressionSetting: + type: string + description: Human-readable label that identifies the method of compression for + the snapshot. + readOnly: true + dataSizeBytes: + type: integer + format: int64 + description: Total size of the data stored on each node in the cluster. This + parameter expresses its value in bytes. + readOnly: true + encryptionEnabled: + type: boolean + description: Flag that indicates whether someone encrypted this snapshot. + readOnly: true + fileSizeBytes: + type: integer + format: int64 + description: Number that indicates the total size of the data files in bytes. + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: 'Unique string that identifies the Key Management Interoperability + (KMIP) master key used to encrypt the snapshot data. The resource + returns this parameter when `"parts.encryptionEnabled" : true`.' + readOnly: true + mongodVersion: + type: string + description: Number that indicates the version of MongoDB that the replica set + primary ran when MongoDB Cloud created the snapshot. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + replicaSetName: + type: string + description: Human-readable label that identifies the replica set. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number that indicates the total size of space allocated for + document storage. + readOnly: true + typeName: + type: string + description: Human-readable label that identifies the type of server from which + MongoDB Cloud took this snapshot. + readOnly: true + readOnly: true + title: Snapshot Components + BackupSnapshotRetention: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + retentionUnit: + type: string + description: Quantity of time in which MongoDB Cloud measures snapshot retention. + retentionValue: + type: integer + format: int32 + description: Number that indicates the amount of days, weeks, or months that + MongoDB Cloud retains the snapshot. For less frequent policy items, + MongoDB Cloud requires that you specify a value greater than or + equal to the value specified for more frequent policy items. If the + hourly policy item specifies a retention of two days, specify two + days or greater for the retention of the weekly policy item. + example: 5 + required: + - retentionUnit + - retentionValue + BackupTenantSnapshot: + type: object + properties: + expiration: + type: string + format: date-time + description: Date and time when the download link no longer works. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + finishTime: + type: string + format: date-time + description: Date and time when MongoDB Cloud completed writing this snapshot. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the restore job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mongoDBVersion: + type: string + description: MongoDB host version that the snapshot runs. + readOnly: true + scheduledTime: + type: string + format: date-time + description: Date and time when MongoDB Cloud will take the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + startTime: + type: string + format: date-time + description: Date and time when MongoDB Cloud began taking the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + status: + type: string + description: Phase of the workflow for this snapshot at the time this resource + made this request. + readOnly: true + BaseAtlasDataLakeRegion: + type: string + description: Name of the region to which the data lake routes client connections. + BaseCloudProviderInstanceSize: + type: string + description: 'Minimum instance size to which your cluster can automatically + scale. MongoDB Cloud requires this parameter if + `"replicationSpecs[n].regionConfigs[m].autoScaling.compute.scaleDownEnabled" + : true`.' + BaseNetworkPeeringConnectionSettings: + type: object + properties: + containerId: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud network container that contains the specified network peering + connection. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the network + peering connection. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + providerName: + type: string + description: Cloud service provider that serves the requested network peering + connection. + accepterRegionName: + type: string + description: Amazon Web Services (AWS) region where the Virtual Peering + Connection (VPC) that you peered with the MongoDB Cloud VPC resides. + The resource returns `null` if your VPC and the MongoDB Cloud VPC + reside in the same region. + awsAccountId: + type: string + description: Unique twelve-digit string that identifies the Amazon Web Services + (AWS) account that owns the VPC that you peered with the MongoDB + Cloud VPC. + maxLength: 12 + minLength: 12 + pattern: ^[0-9]{12}$ + connectionId: + type: string + description: Unique string that identifies the peering connection on AWS. + readOnly: true + errorStateName: + type: string + description: Type of error that can be returned when requesting an Amazon Web + Services (AWS) peering connection. The resource returns `null` if + the request succeeded. + readOnly: true + routeTableCidrBlock: + type: string + description: Internet Protocol (IP) addresses expressed in Classless + Inter-Domain Routing (CIDR) notation of the VPC's subnet that you + want to peer with the MongoDB Cloud VPC. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + statusName: + type: string + description: State of the network peering connection at the time you made the + request. + readOnly: true + vpcId: + type: string + description: Unique string that identifies the VPC on Amazon Web Services (AWS) + that you want to peer with the MongoDB Cloud VPC. + minLength: 5 + pattern: ^vpc-[0-9a-f]{17}$ + azureDirectoryId: + type: string + description: Unique string that identifies the Azure AD directory in which the + VNet peered with the MongoDB Cloud VNet resides. + maxLength: 32 + minLength: 32 + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + azureSubscriptionId: + type: string + description: Unique string that identifies the Azure subscription in which the + VNet you peered with the MongoDB Cloud VNet resides. + maxLength: 32 + minLength: 32 + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + errorState: + type: string + description: 'Error message returned when a requested Azure network peering + resource returns `"status" : "FAILED"`. The resource returns `null` + if the request succeeded.' + readOnly: true + resourceGroupName: + type: string + description: Human-readable label that identifies the resource group in which + the VNet to peer with the MongoDB Cloud VNet resides. + pattern: ^([-\w._()])+$ + status: + type: string + description: State of the network peering connection at the time you made the + request. + readOnly: true + vnetName: + type: string + description: Human-readable label that identifies the VNet that you want to peer + with the MongoDB Cloud VNet. + pattern: ^([-\w._()])+$ + errorMessage: + type: string + description: Details of the error returned when requesting a GCP network peering + resource. The resource returns `null` if the request succeeded. + readOnly: true + gcpProjectId: + type: string + description: Human-readable label that identifies the GCP project that contains + the network that you want to peer with the MongoDB Cloud VPC. + maxLength: 30 + minLength: 6 + pattern: ^[a-z][0-9a-z-]{4,28}[0-9a-z]{1} + networkName: + type: string + description: Human-readable label that identifies the network to peer with the + MongoDB Cloud VPC. + maxLength: 63 + minLength: 1 + pattern: "[a-z]([-a-z0-9]{0,62}[a-z0-9]{0,1})?" + required: + - containerId + BaseStreamsRegion: + type: string + description: Name of the cloud provider region hosting Atlas Stream Processing. + BiConnector: + type: object + description: Settings needed to configure the MongoDB Connector for Business + Intelligence for this cluster. + externalDocs: + description: MongoDB Connector for Business Intelligence + url: https://docs.mongodb.com/bi-connector/current/ + properties: + enabled: + type: boolean + description: Flag that indicates whether MongoDB Connector for Business + Intelligence is enabled on the specified cluster. + readPreference: + type: string + description: Data source node designated for the MongoDB Connector for Business + Intelligence on MongoDB Cloud. The MongoDB Connector for Business + Intelligence on MongoDB Cloud reads data from the primary, + secondary, or analytics node based on your read preferences. + Defaults to `ANALYTICS` node, or `SECONDARY` if there are no + `ANALYTICS` nodes. + externalDocs: + description: Read preferences for BI Connector + url: https://docs.atlas.mongodb.com/cluster-config/enable-bic/#std-label-bic-read-preferences + title: MongoDB Connector for Business Intelligence Settings + BillingInvoice: + type: object + properties: + amountBilledCents: + type: integer + format: int64 + description: Sum of services that the specified organization consumed in the + period covered in this invoice. This parameter expresses its value + in cents (100ths of one US Dollar) and calculates its value as + **subtotalCents** + **salesTaxCents** - **startingBalanceCents**. + readOnly: true + amountPaidCents: + type: integer + format: int64 + description: Sum that the specified organization paid toward this invoice. This + parameter expresses its value in cents (100ths of one US Dollar). + readOnly: true + created: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this invoice. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + creditsCents: + type: integer + format: int64 + description: Sum that MongoDB credited the specified organization toward this + invoice. This parameter expresses its value in cents (100ths of one + US Dollar). + readOnly: true + endDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud finished the billing period that + this invoice covers. This parameter expresses its value in the ISO + 8601 timestamp format in UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project + associated to this invoice. This identifying string doesn't appear + on all invoices. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the invoice + submitted to the specified organization. Charges typically post the + next day. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lineItems: + type: array + description: List that contains individual services included in this invoice. + items: + $ref: "#/components/schemas/InvoiceLineItem" + readOnly: true + linkedInvoices: + type: array + description: List that contains the invoices for organizations linked to the + paying organization. + items: + $ref: "#/components/schemas/BillingInvoice" + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + charged for services consumed from MongoDB Cloud. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + payments: + type: array + description: List that contains funds transferred to MongoDB to cover the + specified service noted in this invoice. + items: + $ref: "#/components/schemas/BillingPayment" + readOnly: true + refunds: + type: array + description: List that contains payments that MongoDB returned to the + organization for this invoice. + items: + $ref: "#/components/schemas/BillingRefund" + readOnly: true + salesTaxCents: + type: integer + format: int64 + description: Sum of sales tax applied to this invoice. This parameter expresses + its value in cents (100ths of one US Dollar). + readOnly: true + startDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud began the billing period that this + invoice covers. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + startingBalanceCents: + type: integer + format: int64 + description: Sum that the specified organization owed to MongoDB when MongoDB + issued this invoice. This parameter expresses its value in US + Dollars. + readOnly: true + statusName: + type: string + description: > + Phase of payment processing in which this invoice exists when you + made this request. Accepted phases include: + + + | Phase Value | Reason | + + |---|---| + + | CLOSED | MongoDB finalized all charges in the billing cycle but has yet to charge the customer. | + + | FAILED | MongoDB attempted to charge the provided credit card but charge for that amount failed. | + + | FORGIVEN | Customer initiated payment which MongoDB later forgave. | + + | FREE | All charges totalled zero so the customer won't be charged. | + + | INVOICED | MongoDB handled these charges using elastic invoicing. | + + | PAID | MongoDB succeeded in charging the provided credit card. | + + | PENDING | Invoice includes charges for the current billing cycle. | + + | PREPAID | Customer has a pre-paid plan so they won't be charged. | + subtotalCents: + type: integer + format: int64 + description: Sum of all positive invoice line items contained in this invoice. + This parameter expresses its value in cents (100ths of one US + Dollar). + readOnly: true + updated: + type: string + format: date-time + description: Date and time when MongoDB Cloud last updated the value of this + payment. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + BillingPayment: + type: object + description: Funds transferred to MongoDB to cover the specified service in this + invoice. + properties: + amountBilledCents: + type: integer + format: int64 + description: Sum of services that the specified organization consumed in the + period covered in this invoice. This parameter expresses its value + in cents (100ths of one US Dollar) and calculates its value as + **subtotalCents** + **salesTaxCents** - **startingBalanceCents**. + readOnly: true + amountPaidCents: + type: integer + format: int64 + description: Sum that the specified organization paid toward the associated + invoice. This parameter expresses its value in cents (100ths of one + US Dollar). + readOnly: true + created: + type: string + format: date-time + description: Date and time when the customer made this payment attempt. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this payment + toward the associated invoice. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + salesTaxCents: + type: integer + format: int64 + description: Sum of sales tax applied to this invoice. This parameter expresses + its value in cents (100ths of one US Dollar). + readOnly: true + statusName: + type: string + description: > + Phase of payment processing for the associated invoice when you made + this request. + + + These phases include: + + + | Phase Value | Reason | + + |---|---| + + | `CANCELLED` | Customer or MongoDB cancelled the payment. | + + | `ERROR` | Issue arose when attempting to complete payment. | + + | `FAILED` | MongoDB tried to charge the credit card without success. | + + | `FAILED_AUTHENTICATION` | Strong Customer Authentication has failed. Confirm that your payment method is authenticated. | + + | `FORGIVEN` | Customer initiated payment which MongoDB later forgave. | + + | `INVOICED` | MongoDB issued an invoice that included this line item. | + + | `NEW` | Customer provided a method of payment, but MongoDB hasn't tried to charge the credit card. | + + | `PAID` | Customer submitted a successful payment. | + + | `PARTIAL_PAID` | Customer paid for part of this line item. | + subtotalCents: + type: integer + format: int64 + description: Sum of all positive invoice line items contained in this invoice. + This parameter expresses its value in cents (100ths of one US + Dollar). + readOnly: true + updated: + type: string + format: date-time + description: Date and time when the customer made an update to this payment + attempt. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + title: Payment + BillingRefund: + type: object + description: One payment that MongoDB returned to the organization for this invoice. + properties: + amountCents: + type: integer + format: int64 + description: Sum of the funds returned to the specified organization expressed + in cents (100th of US Dollar). + readOnly: true + created: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this refund. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + paymentId: + type: string + description: Unique 24-hexadecimal digit string that identifies the payment that + the organization had made. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + reason: + type: string + description: Justification that MongoDB accepted to return funds to the + organization. + readOnly: true + title: Refund + CloudAccessRoleAssignment: + type: object + description: MongoDB Cloud user's roles and the corresponding organization or + project to which that role applies. Each role can apply to one + organization or one project but not both. + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project to + which this role belongs. You can set a value for this parameter or + **orgId** but not both in the same request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + to which this role belongs. You can set a value for this parameter + or **groupId** but not both in the same request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + roleName: + type: string + description: >+ + Human-readable label that identifies the collection of privileges + that MongoDB Cloud grants a specific API key, MongoDB Cloud user, or + MongoDB Cloud team. These roles include organization- and + project-level roles. + + + Organization Roles + + + * ORG_OWNER + + * ORG_MEMBER + + * ORG_GROUP_CREATOR + + * ORG_BILLING_ADMIN + + * ORG_READ_ONLY + + + Project Roles + + + * GROUP_CLUSTER_MANAGER + + * GROUP_DATA_ACCESS_ADMIN + + * GROUP_DATA_ACCESS_READ_ONLY + + * GROUP_DATA_ACCESS_READ_WRITE + + * GROUP_OWNER + + * GROUP_READ_ONLY + + * GROUP_SEARCH_INDEX_EDITOR + + title: Role Assignment + CloudAppUser: + type: object + properties: + country: + type: string + description: Two alphabet characters that identifies MongoDB Cloud user's + geographic location. This parameter uses the ISO 3166-1a2 code + format. + pattern: ^([A-Z]{2})$ + createdAt: + type: string + format: date-time + description: Date and time when the current account is created. This value is in + the ISO 8601 timestamp format in UTC. + readOnly: true + emailAddress: + type: string + format: email + description: Email address that belongs to the MongoDB Cloud user. + firstName: + type: string + description: First or given name that belongs to the MongoDB Cloud user. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lastAuth: + type: string + format: date-time + description: Date and time when the current account last authenticated. This + value is in the ISO 8601 timestamp format in UTC. + readOnly: true + lastName: + type: string + description: Last name, family name, or surname that belongs to the MongoDB + Cloud user. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mobileNumber: + type: string + description: Mobile phone number that belongs to the MongoDB Cloud user. + pattern: (?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})$ + password: + type: string + description: Password applied with the username to log in to MongoDB Cloud. + MongoDB Cloud does not return this parameter except in response to + creating a new MongoDB Cloud user. Only the MongoDB Cloud user can + update their password after it has been set from the MongoDB Cloud + console. + minLength: 8 + roles: + type: array + description: List of objects that display the MongoDB Cloud user's roles and the + corresponding organization or project to which that role applies. A + role can apply to one organization or one project but not both. + items: + $ref: "#/components/schemas/CloudAccessRoleAssignment" + teamIds: + type: array + description: List of unique 24-hexadecimal digit strings that identifies the + teams to which this MongoDB Cloud user belongs. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the team to + which this MongoDB Cloud user belongs. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + uniqueItems: true + username: + type: string + format: email + description: Email address that represents the username of the MongoDB Cloud user. + required: + - country + - emailAddress + - firstName + - lastName + - mobileNumber + - password + - username + CloudCluster: + type: object + description: Settings that describe the clusters in each project that the API + key is authorized to view. + properties: + alertCount: + type: integer + format: int32 + description: Whole number that indicates the quantity of alerts open on the + cluster. + readOnly: true + authEnabled: + type: boolean + description: Flag that indicates whether authentication is required to access + the nodes in this cluster. + readOnly: true + availability: + type: string + description: Term that expresses how many nodes of the cluster can be accessed + when MongoDB Cloud receives this request. This parameter returns + `available` when all nodes are accessible, `warning` only when some + nodes in the cluster can be accessed, `unavailable` when the cluster + can't be accessed, or `dead` when the cluster has been deactivated. + readOnly: true + backupEnabled: + type: boolean + description: Flag that indicates whether the cluster can perform backups. If set + to `true`, the cluster can perform backups. You must set this value + to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated + clusters and Shared Cluster Backups for tenant clusters. If set to + `false`, the cluster doesn't use MongoDB Cloud backups. + readOnly: true + clusterId: + type: string + description: Unique 24-hexadecimal character string that identifies the cluster. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + dataSizeBytes: + type: integer + format: int64 + description: Total size of the data stored on each node in the cluster. The + resource expresses this value in bytes. + readOnly: true + name: + type: string + description: Human-readable label that identifies the cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + nodeCount: + type: integer + format: int32 + description: Whole number that indicates the quantity of nodes that comprise the + cluster. + readOnly: true + sslEnabled: + type: boolean + description: Flag that indicates whether TLS authentication is required to + access the nodes in this cluster. + readOnly: true + type: + type: string + description: Human-readable label that indicates the cluster type. + readOnly: true + versions: + type: array + description: List that contains the versions of MongoDB that each node in the + cluster runs. + items: + type: string + readOnly: true + uniqueItems: true + readOnly: true + CloudDatabaseUser: + type: object + properties: + awsIAMType: + type: string + default: NONE + description: Human-readable label that indicates whether the new database user + authenticates with the Amazon Web Services (AWS) Identity and Access + Management (IAM) credentials associated with the user or the user's + role. + databaseName: + type: string + default: admin + description: Database against which the database user authenticates. Database + users must provide both a username and authentication database to + log into MongoDB. + deleteAfterDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud deletes the user. This parameter + expresses its value in the ISO 8601 timestamp format in UTC and can + include the time zone designation. You must specify a future date + that falls within one week of making the Application Programming + Interface (API) request. + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + labels: + type: array + description: List that contains the key-value pairs for tagging and categorizing + the MongoDB database user. The labels that you define do not appear + in the console. + items: + $ref: "#/components/schemas/ComponentLabel" + ldapAuthType: + type: string + default: NONE + description: Part of the Lightweight Directory Access Protocol (LDAP) record + that the database uses to authenticate this database user on the + LDAP host. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + oidcAuthType: + type: string + default: NONE + description: Human-readable label that indicates whether the new database user + authenticates with OIDC federated authentication. To create a + federated authentication user, specify the value of IDP_GROUP for + this field. + password: + type: string + description: Alphanumeric string that authenticates this database user against + the database specified in `databaseName`. To authenticate with + SCRAM-SHA, you must specify this parameter. This parameter doesn't + appear in this response. + externalDocs: + description: SCRAM-SHA + url: https://docs.mongodb.com/manual/core/security-scram/ + minLength: 8 + writeOnly: true + roles: + type: array + description: List that provides the pairings of one role with one applicable + database. + items: + $ref: "#/components/schemas/DatabaseUserRole" + scopes: + type: array + description: List that contains clusters and MongoDB Atlas Data Lakes that this + database user can access. If omitted, MongoDB Cloud grants the + database user access to all the clusters and MongoDB Atlas Data + Lakes in the project. + items: + $ref: "#/components/schemas/UserScope" + username: + type: string + description: > + Human-readable label that represents the user that authenticates to + MongoDB. The format of this label depends on the method of + authentication: + + + | Authentication Method | Parameter Needed | Parameter Value | username Format | + + |---|---|---|---| + + | AWS IAM | awsType | ROLE | ARN | + + | AWS IAM | awsType | USER | ARN | + + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | + + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | + maxLength: 1024 + x509Type: + type: string + default: NONE + description: >- + X.509 method that MongoDB Cloud uses to authenticate the database + user. + + + - For application-managed X.509, specify `MANAGED`. + + - For self-managed X.509, specify `CUSTOMER`. + + + Users created with the `CUSTOMER` method require a Common Name (CN) in the **username** parameter. You must create externally authenticated users on the `$external` database. + required: + - databaseName + - groupId + - username + CloudProviderAccessAWSIAMRole: + type: object + allOf: + - $ref: "#/components/schemas/CloudProviderAccessRole" + - type: object + properties: + atlasAWSAccountArn: + type: string + description: Amazon Resource Name that identifies the Amazon Web Services (AWS) + user account that MongoDB Cloud uses when it assumes the + Identity and Access Management (IAM) role. + example: arn:aws:iam::772401394250:role/my-test-aws-role + maxLength: 2048 + minLength: 20 + readOnly: true + atlasAssumedRoleExternalId: + type: string + format: uuid + description: Unique external ID that MongoDB Cloud uses when it assumes the IAM + role in your Amazon Web Services (AWS) account. + readOnly: true + authorizedDate: + type: string + format: date-time + description: Date and time when someone authorized this role for the specified + cloud service provider. This parameter expresses its value in + the ISO 8601 timestamp format in UTC. + readOnly: true + createdDate: + type: string + format: date-time + description: Date and time when someone created this role for the specified + cloud service provider. This parameter expresses its value in + the ISO 8601 timestamp format in UTC. + readOnly: true + featureUsages: + type: array + description: List that contains application features associated with this Amazon + Web Services (AWS) Identity and Access Management (IAM) role. + items: + $ref: "#/components/schemas/CloudProviderAccessFeatureUsage" + readOnly: true + iamAssumedRoleArn: + type: string + description: Amazon Resource Name (ARN) that identifies the Amazon Web Services + (AWS) Identity and Access Management (IAM) role that MongoDB + Cloud assumes when it accesses resources in your AWS account. + example: arn:aws:iam::123456789012:root + maxLength: 2048 + minLength: 20 + roleId: + type: string + description: Unique 24-hexadecimal digit string that identifies the role. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + description: Details that describe the features linked to the Amazon Web + Services (AWS) Identity and Access Management (IAM) role. + required: + - providerName + properties: + atlasAWSAccountArn: + type: string + description: Amazon Resource Name that identifies the Amazon Web Services (AWS) + user account that MongoDB Cloud uses when it assumes the Identity + and Access Management (IAM) role. + example: arn:aws:iam::772401394250:role/my-test-aws-role + maxLength: 2048 + minLength: 20 + readOnly: true + atlasAssumedRoleExternalId: + type: string + format: uuid + description: Unique external ID that MongoDB Cloud uses when it assumes the IAM + role in your Amazon Web Services (AWS) account. + readOnly: true + authorizedDate: + type: string + format: date-time + description: Date and time when someone authorized this role for the specified + cloud service provider. This parameter expresses its value in the + ISO 8601 timestamp format in UTC. + readOnly: true + createdDate: + type: string + format: date-time + description: Date and time when someone created this role for the specified + cloud service provider. This parameter expresses its value in the + ISO 8601 timestamp format in UTC. + readOnly: true + featureUsages: + type: array + description: List that contains application features associated with this Amazon + Web Services (AWS) Identity and Access Management (IAM) role. + items: + $ref: "#/components/schemas/CloudProviderAccessFeatureUsage" + readOnly: true + iamAssumedRoleArn: + type: string + description: Amazon Resource Name (ARN) that identifies the Amazon Web Services + (AWS) Identity and Access Management (IAM) role that MongoDB Cloud + assumes when it accesses resources in your AWS account. + example: arn:aws:iam::123456789012:root + maxLength: 2048 + minLength: 20 + roleId: + type: string + description: Unique 24-hexadecimal digit string that identifies the role. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + CloudProviderAccessFeatureUsage: + type: object + description: MongoDB Cloud features associated with this Amazon Web Services + (AWS) Identity and Access Management (IAM) role. + properties: + featureType: + type: string + description: Human-readable label that describes one MongoDB Cloud feature + linked to this Amazon Web Services (AWS) Identity and Access + Management (IAM) role. + readOnly: true + featureId: + $ref: "#/components/schemas/CloudProviderAccessFeatureUsagePushBasedLogExportFe\ + atureId" + CloudProviderAccessFeatureUsagePushBasedLogExportFeatureId: + type: object + description: Identifying characteristics about the Amazon Web Services (AWS) + Simple Storage Service (S3) export bucket linked to this AWS Identity + and Access Management (IAM) role. + properties: + bucketName: + type: string + description: Name of the AWS S3 bucket to which your logs will be exported to. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies your project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + CloudProviderAccessRole: + type: object + description: Cloud provider access role. + properties: + providerName: + type: string + description: Human-readable label that identifies the cloud provider of the role. + atlasAWSAccountArn: + type: string + description: Amazon Resource Name that identifies the Amazon Web Services (AWS) + user account that MongoDB Cloud uses when it assumes the Identity + and Access Management (IAM) role. + example: arn:aws:iam::772401394250:role/my-test-aws-role + maxLength: 2048 + minLength: 20 + readOnly: true + atlasAssumedRoleExternalId: + type: string + format: uuid + description: Unique external ID that MongoDB Cloud uses when it assumes the IAM + role in your Amazon Web Services (AWS) account. + readOnly: true + authorizedDate: + type: string + format: date-time + description: Date and time when someone authorized this role for the specified + cloud service provider. This parameter expresses its value in the + ISO 8601 timestamp format in UTC. + readOnly: true + createdDate: + type: string + format: date-time + description: >- + Date and time when someone created this role for the specified cloud + service provider. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + + + Alternatively: + + Date and time when this Azure Service Principal was created. This parameter expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + featureUsages: + type: array + description: >- + List that contains application features associated with this Amazon + Web Services (AWS) Identity and Access Management (IAM) role. + + + Alternatively: + + List that contains application features associated with this Azure Service Principal. + items: + $ref: "#/components/schemas/CloudProviderAccessFeatureUsage" + readOnly: true + iamAssumedRoleArn: + type: string + description: Amazon Resource Name (ARN) that identifies the Amazon Web Services + (AWS) Identity and Access Management (IAM) role that MongoDB Cloud + assumes when it accesses resources in your AWS account. + example: arn:aws:iam::123456789012:root + maxLength: 2048 + minLength: 20 + roleId: + type: string + description: Unique 24-hexadecimal digit string that identifies the role. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the Azure + Service Principal in Atlas. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + atlasAzureAppId: + type: string + description: Azure Active Directory Application ID of Atlas. + maxLength: 36 + minLength: 32 + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + lastUpdatedDate: + type: string + format: date-time + description: Date and time when this Azure Service Principal was last updated. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + servicePrincipalId: + type: string + description: UUID string that identifies the Azure Service Principal. + maxLength: 36 + minLength: 32 + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + tenantId: + type: string + description: UUID String that identifies the Azure Active Directory Tenant ID. + maxLength: 36 + minLength: 32 + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + required: + - providerName + CloudProviderAccessRoles: + type: object + properties: + awsIamRoles: + type: array + description: List that contains the Amazon Web Services (AWS) IAM roles + registered and authorized with MongoDB Cloud. + items: + $ref: "#/components/schemas/CloudProviderAccessAWSIAMRole" + CloudProviderContainer: + type: object + description: Collection of settings that configures the network container for a + virtual private connection on Amazon Web Services. + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the network + peering container. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + providerName: + type: string + description: Cloud service provider that serves the requested network peering + containers. + provisioned: + type: boolean + description: Flag that indicates whether MongoDB Cloud clusters exist in the + specified network peering container. + readOnly: true + atlasCidrBlock: + type: string + description: >- + IP addresses expressed in Classless Inter-Domain Routing (CIDR) + notation that MongoDB Cloud uses for the network peering containers + in your project. MongoDB Cloud assigns all of the project's clusters + deployed to this cloud provider an IP address from this range. + MongoDB Cloud locks this value if an M10 or greater cluster or a + network peering connection exists in this project. + + + These CIDR blocks must fall within the ranges reserved per RFC 1918. AWS and Azure further limit the block to between the `/24` and `/21` ranges. + + + To modify the CIDR block, the target project cannot have: + + + - Any M10 or greater clusters + + - Any other VPC peering connections + + You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. + + **Example:** A project in an Amazon Web Services (AWS) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. + + Alternatively: + + IP addresses expressed in Classless Inter-Domain Routing (CIDR) notation that MongoDB Cloud uses for the network peering containers in your project. MongoDB Cloud assigns all of the project's clusters deployed to this cloud provider an IP address from this range. MongoDB Cloud locks this value if an M10 or greater cluster or a network peering connection exists in this project. + + + These CIDR blocks must fall within the ranges reserved per RFC 1918. GCP further limits the block to a lower bound of the `/18` range. + + + To modify the CIDR block, the target project cannot have: + + + - Any M10 or greater clusters + + - Any other VPC peering connections + + You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. + + **Example:** A project in an Google Cloud (GCP) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. + + Alternatively: + + IP addresses expressed in Classless Inter-Domain Routing (CIDR) notation that MongoDB Cloud uses for the network peering containers in your project. MongoDB Cloud assigns all of the project's clusters deployed to this cloud provider an IP address from this range. MongoDB Cloud locks this value if an M10 or greater cluster or a network peering connection exists in this project. + + + These CIDR blocks must fall within the ranges reserved per RFC 1918. AWS and Azure further limit the block to between the `/24` and `/21` ranges. + + + To modify the CIDR block, the target project cannot have: + + + - Any M10 or greater clusters + + - Any other VPC peering connections + + You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. + + **Example:** A project in an Amazon Web Services (AWS) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + azureSubscriptionId: + type: string + description: Unique string that identifies the Azure subscription in which the + MongoDB Cloud VNet resides. + example: 32b6e34b3d91647abb20e7b8 + pattern: ^([a-f0-9]{24})$ + readOnly: true + region: + type: string + description: Azure region to which MongoDB Cloud deployed this network peering + container. + vnetName: + type: string + description: Unique string that identifies the Azure VNet in which MongoDB Cloud + clusters in this network peering container exist. The response + returns **null** if no clusters exist in this network peering + container. + maxLength: 38 + minLength: 38 + pattern: ^([-\w._()])+$ + readOnly: true + gcpProjectId: + type: string + description: Unique string that identifies the GCP project in which MongoDB + Cloud clusters in this network peering container exist. The response + returns **null** if no clusters exist in this network peering + container. + maxLength: 26 + minLength: 26 + pattern: ^p-[0-9a-z]{24}$ + readOnly: true + networkName: + type: string + description: Human-readable label that identifies the network in which MongoDB + Cloud clusters in this network peering container exist. MongoDB + Cloud returns **null** if no clusters exist in this network peering + container. + maxLength: 36 + minLength: 36 + pattern: ^nt-[0-9a-f]{24}-[0-9a-z]{8}$ + readOnly: true + regions: + type: array + description: List of GCP regions to which you want to deploy this MongoDB Cloud + network peering container. In this MongoDB Cloud project, you can + deploy clusters only to the GCP regions in this list. To deploy + MongoDB Cloud clusters to other GCP regions, create additional + projects. + items: + type: string + description: List of GCP regions to which you want to deploy this MongoDB Cloud + network peering container. In this MongoDB Cloud project, you can + deploy clusters only to the GCP regions in this list. To deploy + MongoDB Cloud clusters to other GCP regions, create additional + projects. + regionName: + type: string + description: Geographic area that Amazon Web Services (AWS) defines to which + MongoDB Cloud deployed this network peering container. + vpcId: + type: string + description: Unique string that identifies the MongoDB Cloud VPC on AWS. + example: vpc-b555d3b0d9cb783b0 + minLength: 5 + pattern: ^vpc-[0-9a-f]{17}$ + readOnly: true + CloudProviderEndpointServiceRequest: + type: object + properties: + providerName: + type: string + description: Human-readable label that identifies the cloud service provider for + which you want to create the private endpoint service. + writeOnly: true + region: + type: string + description: Cloud provider region in which you want to create the private + endpoint service. Regions accepted as values differ for [Amazon Web + Services](https://docs.atlas.mongodb.com/reference/amazon-aws/), + [Google Cloud + Platform](https://docs.atlas.mongodb.com/reference/google-gcp/), and + [Microsoft + Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). + writeOnly: true + required: + - providerName + - region + CloudProviderRegions: + type: object + properties: + instanceSizes: + type: array + description: List of instances sizes that this cloud provider supports. + items: + $ref: "#/components/schemas/ClusterCloudProviderInstanceSize" + readOnly: true + provider: + type: string + description: Human-readable label that identifies the Cloud provider. + CloudRegionConfig: + type: object + description: Cloud service provider on which MongoDB Cloud provisions the hosts. + properties: + electableSpecs: + $ref: "#/components/schemas/HardwareSpec" + priority: + type: integer + format: int32 + description: >- + Precedence is given to this region when a primary election occurs. + If your **regionConfigs** has only **readOnlySpecs**, + **analyticsSpecs**, or both, set this value to `0`. If you have + multiple **regionConfigs** objects (your cluster is multi-region or + multi-cloud), they must have priorities in descending order. The + highest priority is `7`. + + + **Example:** If you have three regions, their priorities would be `7`, `6`, and `5` respectively. If you added two more regions for supporting electable nodes, the priorities of those regions would be `4` and `3` respectively. + maximum: 7 + minimum: 0 + providerName: + type: string + description: Cloud service provider on which MongoDB Cloud provisions the hosts. + Set dedicated clusters to `AWS`, `GCP`, `AZURE` or `TENANT`. + regionName: + type: string + description: Physical location of your MongoDB cluster nodes. The region you + choose can affect network latency for clients accessing your + databases. When MongoDB Cloud deploys a dedicated cluster, it checks + if a VPC or VPC connection exists for that provider and region. If + not, MongoDB Cloud creates them as part of the deployment. It + assigns the VPC a Classless Inter-Domain Routing (CIDR) block. To + limit a new VPC peering connection to one Classless Inter-Domain + Routing (CIDR) block and region, create the connection first. Deploy + the cluster after the connection starts. GCP Clusters and + Multi-region clusters require one VPC peering connection for each + region. MongoDB nodes can use only the peering connection that + resides in the same region as the nodes to communicate with the + peered VPC. + analyticsAutoScaling: + $ref: "#/components/schemas/AdvancedAutoScalingSettings" + analyticsSpecs: + $ref: "#/components/schemas/DedicatedHardwareSpec" + autoScaling: + $ref: "#/components/schemas/AdvancedAutoScalingSettings" + readOnlySpecs: + $ref: "#/components/schemas/DedicatedHardwareSpec" + backingProviderName: + type: string + description: Cloud service provider on which MongoDB Cloud provisioned the + multi-tenant cluster. The resource returns this parameter when + **providerSettings.providerName** is `TENANT` and + **providerSetting.instanceSizeName** is `M2` or `M5`. + title: Cloud Service Provider Settings for Multi-Cloud Clusters + CloudSearchMetrics: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hardwareMetrics: + type: array + description: List that contains all host compute, memory, and storage + utilization dedicated to Atlas Search when MongoDB Atlas received + this request. + items: + $ref: "#/components/schemas/FTSMetric" + readOnly: true + indexMetrics: + type: array + description: List that contains all performance and utilization measurements + that Atlas Search index performed by the time MongoDB Atlas received + this request. + items: + $ref: "#/components/schemas/FTSMetric" + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + processId: + type: string + description: Hostname and port that identifies the process. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + statusMetrics: + type: array + description: List that contains all available Atlas Search status metrics when + MongoDB Atlas received this request. + items: + $ref: "#/components/schemas/FTSMetric" + readOnly: true + required: + - groupId + - processId + ClusterAutoScalingSettings: + type: object + description: Range of instance sizes to which your cluster can scale. + externalDocs: + description: Cluster Auto-Scaling + url: https://docs.atlas.mongodb.com/cluster-autoscaling/ + properties: + compute: + $ref: "#/components/schemas/ClusterComputeAutoScaling" + diskGBEnabled: + type: boolean + description: Flag that indicates whether someone enabled disk auto-scaling for + this cluster. + title: Automatic Cluster Scaling Settings + ClusterCloudProviderInstanceSize: + type: object + description: List of instances sizes that this cloud provider supports. + properties: + availableRegions: + type: array + description: List of regions that this cloud provider supports for this instance + size. + items: + $ref: "#/components/schemas/AvailableCloudProviderRegion" + readOnly: true + name: + type: string + description: Human-readable label that identifies the instance size or cluster + tier. + readOnly: true + readOnly: true + ClusterComputeAutoScaling: + type: object + description: Collection of settings that configures how a cluster might scale + its cluster tier and whether the cluster can scale down. Cluster tier + auto-scaling is unavailable for clusters using Low CPU or NVME storage + classes. + properties: + enabled: + type: boolean + description: Flag that indicates whether cluster tier auto-scaling is enabled. + Set to `true` to enable cluster tier auto-scaling. If enabled, you + must specify a value for + **providerSettings.autoScaling.compute.maxInstanceSize** also. Set + to `false` to disable cluster tier auto-scaling. + scaleDownEnabled: + type: boolean + description: Flag that indicates whether the cluster tier can scale down. This + is required if **autoScaling.compute.enabled** is `true`. If you + enable this option, specify a value for + **providerSettings.autoScaling.compute.minInstanceSize**. + ClusterConnectionStrings: + type: object + description: Collection of Uniform Resource Locators that point to the MongoDB + database. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + properties: + awsPrivateLink: + type: object + additionalProperties: + type: string + description: Private endpoint-aware connection strings that use AWS-hosted + clusters with Amazon Web Services (AWS) PrivateLink. Each key + identifies an Amazon Web Services (AWS) interface endpoint. Each + value identifies the related `mongodb://` connection string that + you use to connect to MongoDB Cloud through the interface endpoint + that the key names. + externalDocs: + description: Network Peering Connection + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + description: Private endpoint-aware connection strings that use AWS-hosted + clusters with Amazon Web Services (AWS) PrivateLink. Each key + identifies an Amazon Web Services (AWS) interface endpoint. Each + value identifies the related `mongodb://` connection string that you + use to connect to MongoDB Cloud through the interface endpoint that + the key names. + externalDocs: + description: Network Peering Connection + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + awsPrivateLinkSrv: + type: object + additionalProperties: + type: string + description: Private endpoint-aware connection strings that use AWS-hosted + clusters with Amazon Web Services (AWS) PrivateLink. Each key + identifies an Amazon Web Services (AWS) interface endpoint. Each + value identifies the related `mongodb://` connection string that + you use to connect to Atlas through the interface endpoint that + the key names. + externalDocs: + description: Network Peering Connection + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + description: Private endpoint-aware connection strings that use AWS-hosted + clusters with Amazon Web Services (AWS) PrivateLink. Each key + identifies an Amazon Web Services (AWS) interface endpoint. Each + value identifies the related `mongodb://` connection string that you + use to connect to Atlas through the interface endpoint that the key + names. + externalDocs: + description: Network Peering Connection + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + private: + type: string + description: Network peering connection strings for each interface Virtual + Private Cloud (VPC) endpoint that you configured to connect to this + cluster. This connection string uses the `mongodb+srv://` protocol. + The resource returns this parameter once someone creates a network + peering connection to this cluster. This protocol tells the + application to look up the host seed list in the Domain Name System + (DNS). This list synchronizes with the nodes in a cluster. If the + connection string uses this Uniform Resource Identifier (URI) + format, you don't need to append the seed list or change the URI if + the nodes change. Use this URI format if your driver supports it. If + it doesn't, use connectionStrings.private. For Amazon Web Services + (AWS) clusters, this resource returns this parameter only if you + enable custom DNS. + externalDocs: + description: Network Peering Connection + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + privateEndpoint: + type: array + description: List of private endpoint-aware connection strings that you can use + to connect to this cluster through a private endpoint. This + parameter returns only if you deployed a private endpoint to all + regions to which you deployed this clusters' nodes. + items: + $ref: "#/components/schemas/ClusterDescriptionConnectionStringsPrivateEndpoint" + readOnly: true + privateSrv: + type: string + description: Network peering connection strings for each interface Virtual + Private Cloud (VPC) endpoint that you configured to connect to this + cluster. This connection string uses the `mongodb+srv://` protocol. + The resource returns this parameter when someone creates a network + peering connection to this cluster. This protocol tells the + application to look up the host seed list in the Domain Name System + (DNS). This list synchronizes with the nodes in a cluster. If the + connection string uses this Uniform Resource Identifier (URI) + format, you don't need to append the seed list or change the Uniform + Resource Identifier (URI) if the nodes change. Use this Uniform + Resource Identifier (URI) format if your driver supports it. If it + doesn't, use `connectionStrings.private`. For Amazon Web Services + (AWS) clusters, this parameter returns only if you [enable custom + DNS](https://docs.atlas.mongodb.com/reference/api/aws-custom-dns-update/). + externalDocs: + description: Network Peering Connection + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + readOnly: true + standard: + type: string + description: Public connection string that you can use to connect to this + cluster. This connection string uses the `mongodb://` protocol. + externalDocs: + description: Connection String URI Format + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + standardSrv: + type: string + description: Public connection string that you can use to connect to this + cluster. This connection string uses the `mongodb+srv://` protocol. + externalDocs: + description: Connection String URI Format + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + readOnly: true + title: Cluster Connection Strings + ClusterDescriptionConnectionStringsPrivateEndpoint: + type: object + description: Private endpoint-aware connection string that you can use to + connect to this cluster through a private endpoint. + externalDocs: + description: Private Endpoint for Dedicated Cluster + url: https://docs.atlas.mongodb.com/security-private-endpoint/ + properties: + connectionString: + type: string + description: Private endpoint-aware connection string that uses the `mongodb://` + protocol to connect to MongoDB Cloud through a private endpoint. + readOnly: true + endpoints: + type: array + description: List that contains the private endpoints through which you connect + to MongoDB Cloud when you use + **connectionStrings.privateEndpoint[n].connectionString** or + **connectionStrings.privateEndpoint[n].srvConnectionString**. + items: + $ref: "#/components/schemas/ClusterDescriptionConnectionStringsPrivateEndpointE\ + ndpoint" + readOnly: true + srvConnectionString: + type: string + description: Private endpoint-aware connection string that uses the + `mongodb+srv://` protocol to connect to MongoDB Cloud through a + private endpoint. The `mongodb+srv` protocol tells the driver to + look up the seed list of hosts in the Domain Name System (DNS). This + list synchronizes with the nodes in a cluster. If the connection + string uses this Uniform Resource Identifier (URI) format, you don't + need to append the seed list or change the Uniform Resource + Identifier (URI) if the nodes change. Use this Uniform Resource + Identifier (URI) format if your application supports it. If it + doesn't, use connectionStrings.privateEndpoint[n].connectionString. + readOnly: true + srvShardOptimizedConnectionString: + type: string + description: Private endpoint-aware connection string optimized for sharded + clusters that uses the `mongodb+srv://` protocol to connect to + MongoDB Cloud through a private endpoint. If the connection string + uses this Uniform Resource Identifier (URI) format, you don't need + to change the Uniform Resource Identifier (URI) if the nodes change. + Use this Uniform Resource Identifier (URI) format if your + application and Atlas cluster supports it. If it doesn't, use and + consult the documentation for + connectionStrings.privateEndpoint[n].srvConnectionString. + readOnly: true + type: + type: string + description: MongoDB process type to which your application connects. Use + `MONGOD` for replica sets and `MONGOS` for sharded clusters. + readOnly: true + title: Cluster Private Endpoint Connection String + ClusterDescriptionConnectionStringsPrivateEndpointEndpoint: + type: object + description: Details of a private endpoint deployed for this cluster. + properties: + endpointId: + type: string + description: Unique string that the cloud provider uses to identify the private + endpoint. + readOnly: true + providerName: + type: string + description: Cloud provider in which MongoDB Cloud deploys the private endpoint. + readOnly: true + region: + type: string + description: Region where the private endpoint is deployed. + readOnly: true + title: Cluster Private Endpoint Connection Strings Endpoint + ClusterDescriptionProcessArgs: + type: object + properties: + chunkMigrationConcurrency: + type: integer + format: int32 + default: 1 + description: Number of threads on the source shard and the receiving shard for + chunk migration. The number of threads should not exceed the half + the total number of CPU cores in the sharded cluster. + externalDocs: + description: This option corresponds to the `chunkMigrationConcurrency` `mongod` + configuration file option. + url: https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.chunkMigrationConcurrency + defaultReadConcern: + type: string + default: available + description: >- + Default level of acknowledgment requested from MongoDB for read + operations set for this cluster. + + + MongoDB 4.4 clusters default to `available`. MongoDB 5.0 and later clusters default to `local`. + externalDocs: + description: This option corresponds to the global default read concern. + url: https://docs.mongodb.com/manual/reference/read-concern/ + defaultWriteConcern: + type: string + default: "1" + description: >- + Default level of acknowledgment requested from MongoDB for write + operations set for this cluster. + + + MongoDB 4.4 clusters default to `1`. MongoDB 5.0 and later clusters default to `majority`. + externalDocs: + description: This option corresponds to the the implicit default write concern. + url: https://docs.mongodb.com/manual/reference/write-concern/ + failIndexKeyTooLong: + type: boolean + default: true + description: Flag that indicates whether you can insert or update documents + where all indexed entries don't exceed 1024 bytes. If you set this + to false, + [mongod](https://docs.mongodb.com/upcoming/reference/program/mongod/#mongodb-binary-bin.mongod) + writes documents that exceed this limit but doesn't index them. + externalDocs: + description: This option corresponds to the `failIndexKeyTooLong` `mongod` + configuration file option. + url: https://docs.mongodb.com/upcoming/reference/parameters/#mongodb-parameter-param.failIndexKeyTooLong + javascriptEnabled: + type: boolean + default: true + description: Flag that indicates whether the cluster allows execution of + operations that perform server-side executions of JavaScript. + externalDocs: + description: If your cluster runs a MongoDB version less than 4.4, this option + corresponds to modifying the `security.javascriptEnabled` + configuration file option for each `mongod` in the cluster. If + your cluster runs MongoDB version 4.4 or greater, this option + corresponds to modifying the `security.javascriptEnabled` + configuration file option for each `mongod` and `mongos` in the + cluster. + url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-security.javascriptEnabled + minimumEnabledTlsProtocol: + type: string + description: Minimum Transport Layer Security (TLS) version that the cluster + accepts for incoming connections. Clusters using TLS 1.0 or 1.1 + should consider setting TLS 1.2 as the minimum TLS protocol version. + externalDocs: + description: This option corresponds to the `net.ssl.disabledProtocols` `mongod` + configuration file option. + url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-net.ssl.disabledProtocols + noTableScan: + type: boolean + default: false + description: Flag that indicates whether the cluster disables executing any + query that requires a collection scan to return results. + externalDocs: + description: This option corresponds to the `notablescan` `mongod` configuration + file option. + url: https://docs.mongodb.com/upcoming/reference/parameters/#mongodb-parameter-param.notablescan + oplogMinRetentionHours: + type: number + format: double + description: Minimum retention window for cluster's oplog expressed in hours. A + value of null indicates that the cluster uses the default minimum + oplog window that MongoDB Cloud calculates. + externalDocs: + description: This option corresponds to the `storage.oplogMinRetentionHours` + `mongod` configuration file option. + url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-storage.oplogMinRetentionHours + oplogSizeMB: + type: integer + format: int32 + description: Storage limit of cluster's oplog expressed in megabytes. A value of + null indicates that the cluster uses the default oplog size that + MongoDB Cloud calculates. + externalDocs: + description: This option corresponds to the `replication.oplogSizeMB` `mongod` + configuration file option. + url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-replication.oplogSizeMB + sampleRefreshIntervalBIConnector: + type: integer + format: int32 + default: 0 + description: Interval in seconds at which the mongosqld process re-samples data + to create its relational schema. + externalDocs: + description: This option corresponds to the `sampleRefreshIntervalSecs` + `mongosqld` option. + url: https://docs.mongodb.com/bi-connector/current/reference/mongosqld/#std-option-mongosqld.--schemaRefreshIntervalSecs + minimum: 0 + sampleSizeBIConnector: + type: integer + format: int32 + default: 1000 + description: Number of documents per database to sample when gathering schema + information. + externalDocs: + description: This option corresponds to the `sampleSize` `mongosqld` option. + url: https://docs.mongodb.com/bi-connector/current/reference/mongosqld/#std-option-mongosqld.--sampleSize + minimum: 0 + transactionLifetimeLimitSeconds: + type: integer + format: int64 + default: 60 + description: Lifetime, in seconds, of multi-document transactions. Atlas + considers the transactions that exceed this limit as expired and so + aborts them through a periodic cleanup process. + externalDocs: + description: This option corresponds to the `transactionLifetimeLimitSeconds` + `mongod` configuration file option. + url: https://www.mongodb.com/docs/upcoming/reference/parameters/#mongodb-parameter-param.transactionLifetimeLimitSeconds + minimum: 1 + ClusterFreeAutoScaling: + type: object + description: Range of instance sizes to which your cluster can scale. + properties: + compute: + type: string + description: Collection of settings that configures how a cluster might scale + its cluster tier and whether the cluster can scale down. + title: Tenant + ClusterOutageSimulation: + type: object + properties: + clusterName: + type: string + description: Human-readable label that identifies the cluster that undergoes + outage simulation. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project + that contains the cluster to undergo outage simulation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal character string that identifies the outage + simulation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + outageFilters: + type: array + description: List of settings that specify the type of cluster outage simulation. + items: + $ref: "#/components/schemas/AtlasClusterOutageSimulationOutageFilter" + minItems: 1 + startRequestDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud started the regional outage + simulation. + example: 2022-01-01T00:00:00Z + readOnly: true + state: + type: string + description: >- + Phase of the outage simulation. + + + | State | Indication | + + |-------------|------------| + + | `START_REQUESTED` | User has requested cluster outage simulation.| + + | `STARTING` | MongoDB Cloud is starting cluster outage simulation.| + + | `SIMULATING` | MongoDB Cloud is simulating cluster outage.| + + | `RECOVERY_REQUESTED` | User has requested recovery from the simulated outage.| + + | `RECOVERING` | MongoDB Cloud is recovering the cluster from the simulated outage.| + + | `COMPLETE` | MongoDB Cloud has completed the cluster outage simulation.| + readOnly: true + ClusterProviderSettings: + type: object + description: Group of cloud provider settings that configure the provisioned + MongoDB hosts. + properties: + providerName: + type: string + autoScaling: + $ref: "#/components/schemas/ClusterFreeAutoScaling" + diskIOPS: + type: integer + format: int32 + description: Maximum Disk Input/Output Operations per Second (IOPS) that the + database host can perform. + encryptEBSVolume: + type: boolean + default: true + deprecated: true + description: Flag that indicates whether the Amazon Elastic Block Store (EBS) + encryption feature encrypts the host's root volume for both data at + rest within the volume and for data moving between the volume and + the cluster. Clusters always have this setting enabled. + instanceSizeName: + type: string + description: >- + Cluster tier, with a default storage and memory capacity, that + applies to all the data-bearing hosts in your cluster. + + + Alternatively: + + Cluster tier, with a default storage and memory capacity, that applies to all the data-bearing hosts in your cluster. You must set **providerSettings.providerName** to `TENANT` and specify the cloud service provider in **providerSettings.backingProviderName**. + title: Tenant Instance Sizes + regionName: + type: string + description: >- + Physical location where MongoDB Cloud deploys your AWS-hosted + MongoDB cluster nodes. The region you choose can affect network + latency for clients accessing your databases. When MongoDB Cloud + deploys a dedicated cluster, it checks if a VPC or VPC connection + exists for that provider and region. If not, MongoDB Cloud creates + them as part of the deployment. MongoDB Cloud assigns the VPC a CIDR + block. To limit a new VPC peering connection to one CIDR block and + region, create the connection first. Deploy the cluster after the + connection starts. + + + Alternatively: + + Microsoft Azure Regions. + + + Alternatively: + + Google Compute Regions. + + + Alternatively: + + Human-readable label that identifies the geographic location of your MongoDB cluster. The region you choose can affect network latency for clients accessing your databases. For a complete list of region names, see [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). For multi-region clusters, see **replicationSpec.{region}**. + volumeType: + type: string + description: Disk Input/Output Operations per Second (IOPS) setting for Amazon + Web Services (AWS) storage that you configure only for abbr + title="Amazon Web Services">AWS. Specify whether Disk + Input/Output Operations per Second (IOPS) must not exceed the + default Input/Output Operations per Second (IOPS) rate for the + selected volume size (`STANDARD`), or must fall within the allowable + Input/Output Operations per Second (IOPS) range for the selected + volume size (`PROVISIONED`). + diskTypeName: + type: string + description: Disk type that corresponds to the host's root volume for Azure + instances. If omitted, the default disk type for the selected + **providerSettings.instanceSizeName** applies. + externalDocs: + description: Disk type + url: https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#premium-storage-disk-sizes + backingProviderName: + type: string + description: Cloud service provider on which MongoDB Cloud provisioned the + multi-tenant host. The resource returns this parameter when + **providerSettings.providerName** is `TENANT` and + **providerSetting.instanceSizeName** is `M2` or `M5`. + required: + - providerName + title: Cloud Service Provider Settings for a Cluster + ClusterSearchIndex: + type: object + properties: + analyzer: + type: string + default: lucene.standard + description: >- + Specific pre-defined method chosen to convert database field text + into searchable words. This conversion reduces the text of fields + into the smallest units of text. These units are called a **term** + or **token**. This process, known as tokenization, involves a + variety of changes made to the text in fields: + + + - extracting words + + - removing punctuation + + - removing accents + + - changing to lowercase + + - removing common words + + - reducing words to their root form (stemming) + + - changing words to their base form (lemmatization) + MongoDB Cloud uses the selected process to build the Atlas Search index. + externalDocs: + description: Atlas Search Analyzers + url: https://docs.atlas.mongodb.com/atlas-search/analyzers/ + analyzers: + type: array + description: List of user-defined methods to convert database field text into + searchable words. + externalDocs: + description: Custom Atlas Search Analyzers + url: https://docs.atlas.mongodb.com/atlas-search/analyzers/custom/ + items: + $ref: "#/components/schemas/ApiAtlasFTSAnalyzers" + collectionName: + type: string + description: Human-readable label that identifies the collection that contains + one or more Atlas Search indexes. + database: + type: string + description: Human-readable label that identifies the database that contains the + collection with one or more Atlas Search indexes. + indexID: + type: string + description: Unique 24-hexadecimal digit string that identifies this Atlas + Search index. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + mappings: + $ref: "#/components/schemas/ApiAtlasFTSMappings" + name: + type: string + description: Human-readable label that identifies this index. Within each + namespace, names of all indexes in the namespace must be unique. + searchAnalyzer: + type: string + default: lucene.standard + description: Method applied to identify words when searching this index. + status: + type: string + description: > + Condition of the search index when you made this request. + + + | Status | Index Condition | + |---|---| + | IN_PROGRESS | Atlas is building or re-building the index after an edit. | + | STEADY | You can use this search index. | + | FAILED | Atlas could not build the index. | + | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | + | PAUSED | The cluster is paused. | + readOnly: true + synonyms: + type: array + description: Rule sets that map words to their synonyms in this index. + externalDocs: + description: Synonym Mapping + url: https://docs.atlas.mongodb.com/atlas-search/synonyms/ + items: + $ref: "#/components/schemas/SearchSynonymMappingDefinition" + required: + - collectionName + - database + - name + ClusterServerlessBackupOptions: + type: object + description: Group of settings that configure serverless backup. + properties: + serverlessContinuousBackupEnabled: + type: boolean + default: true + description: >- + Flag that indicates whether the serverless instance uses + **Serverless Continuous Backup**. + If this parameter is `false`, the serverless instance uses **Basic Backup**. + + | Option | Description | + |---|---| + | Serverless Continuous Backup | Atlas takes incremental [snapshots](https://www.mongodb.com/docs/atlas/backup/cloud-backup/overview/#std-label-serverless-snapshots) of the data in your serverless instance every six hours and lets you restore the data from a selected point in time within the last 72 hours. Atlas also takes daily snapshots and retains these daily snapshots for 35 days. To learn more, see [Serverless Instance Costs](https://www.mongodb.com/docs/atlas/billing/serverless-instance-costs/#std-label-serverless-instance-costs). | + | Basic Backup | Atlas takes incremental [snapshots](https://www.mongodb.com/docs/atlas/backup/cloud-backup/overview/#std-label-serverless-snapshots) of the data in your serverless instance every six hours and retains only the two most recent snapshots. You can use this option for free. | + title: Serverless Backup Options + ClusterStatus: + type: object + properties: + changeStatus: + type: string + description: State of cluster at the time of this request. Atlas returns + **Applied** if it completed adding a user to, or removing a user + from, your cluster. Atlas returns **Pending** if it's still making + the requested user changes. When status is **Pending**, new users + can't log in. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + Collation: + type: object + description: One or more settings that specify language-specific rules to + compare strings within this index. + externalDocs: + description: Collation Options + url: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options + properties: + alternate: + type: string + default: non-ignorable + description: > + Method to handle whitespace and punctuation as base characters for + purposes of comparison. + + + | Value | Evaluate Whitespace and Punctuation as Base Characters | + + |---|---| + + | `"non-ignorable"` | Yes | + + | `"shifted"` | No. MongoDB Cloud distinguishes these characters when `"strength" > 3`. | + backwards: + type: boolean + default: false + description: > + Flag that indicates whether strings with diacritics sort from back + of the string. Some French dictionary orders strings in this way. + + + | Value | String Comparison Method | + |---|---| + | `true` | Compare from back to front. | + + | `false` | Compare from front to back. | + caseFirst: + type: string + default: off + description: > + Method to handle sort order of case differences during tertiary + level comparisons. + + + | Value | Sort Order Method | + |---|---| + | `"upper"` | Uppercase sorts before lowercase. | + | `"lower"` | Lowercase sorts before uppercase. | + | `"off"` | Similar to "lower" with slight differences. | + caseLevel: + type: boolean + default: false + description: > + Flag that indicates whether to include case comparison when + `"strength" : 1` or `"strength" : 2`. + + + | Value | Compare case at level 1 or 2? | Strength Level | Comparisons Include | + |---|---|---|---| + | true | Yes | 1 | Base characters and case. | + | | | 2 | Base characters, diacritics (and possible other secondary differences), and case. | + | false | No | | | + locale: + type: string + description: 'International Components for Unicode (ICU) code that represents a + localized language. To specify simple binary comparison, set + `"locale" : "simple"`.' + maxVariable: + type: string + description: > + Field that indicates which characters can be ignored when + `"alternate" : "shifted"`. This has no affect if `"alternate" : + "non-ignorable"`. + + + | Value | Ignore | + |---|---| + | `"punct"` | Both whitespace and punctuation | + + | `"space"` | Whitespace | + normalization: + type: boolean + default: false + description: > + Flag that indicates whether to check if the text requires + normalization and then perform it. Most text doesn't require this + normalization processing. + + + | Value | Normalization Method | + |---|---| + | `true` | Yes, check if fully normalized and perform normalization to compare text. | + + | `false` | No, don't check. | + numericOrdering: + type: boolean + default: false + description: > + Flag that indicates whether to compare sequences of digits as + numbers or as strings. + + + | Value | Comparison Method | + |---|---| + | `true` | Compare as numbers. This results in `10 > 2`. | + + | `false` | Compare as strings. This results in `"10" < "2"`. | + strength: + type: integer + format: int32 + default: 3 + description: > + Degree of comparison to perform when sorting words. MongoDB Cloud + accepts the following values: + + + | Value | Comparison Level | Comparison Method | + + |---|---|---| + + | 1 | Primary | Compares the base characters only, ignoring other differences such as diacritics and case. | + + | 2 | Secondary | Compares base characters (primary) and diacritics (secondary). Primary differences take precedence over secondary differences. | + + | 3 | Tertiary | Compares base characters (primary), diacritics (secondary), and case and variants (tertiary). Differences between base characters takes precedence over secondary differences which take precedence over tertiary differences. | + + | 4 | Quaternary | Compares for the specific use case to consider punctuation when levels 1 through 3 ignore punctuation or for processing Japanese text. | + + | 5 | Identical | Compares for the specific use case of tie breaker. | + maximum: 5 + minimum: 1 + required: + - locale + writeOnly: true + ComponentLabel: + type: object + description: Human-readable labels applied to this MongoDB Cloud component. + properties: + key: + type: string + description: Key applied to tag and categorize this component. + maxLength: 255 + minLength: 1 + value: + type: string + description: Value set to the Key applied to tag and categorize this component. + maxLength: 255 + minLength: 1 + title: Component Label + ConnectedOrgConfig: + type: object + properties: + dataAccessIdentityProviderIds: + type: array + description: The collection of unique ids of the identity providers for org's + data access. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the id of the + identity provider for org's data access. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + uniqueItems: true + domainAllowList: + type: array + description: Approved domains that restrict users who can join the organization + based on their email address. + items: + type: string + uniqueItems: true + domainRestrictionEnabled: + type: boolean + description: Value that indicates whether domain restriction is enabled for this + connected org. + identityProviderId: + type: string + description: Unique 20-hexadecimal digit string that identifies the identity + provider that this connected org config is associated with. + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the connected + organization configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + postAuthRoleGrants: + type: array + description: Atlas roles that are granted to a user in this organization after + authenticating. + items: + type: string + description: Organization role the user has in Atlas. + uniqueItems: true + roleMappings: + type: array + description: Role mappings that are configured in this organization. + items: + $ref: "#/components/schemas/AuthFederationRoleMapping" + uniqueItems: true + userConflicts: + type: array + description: List that contains the users who have an email address that doesn't + match any domain on the allowed list. + items: + $ref: "#/components/schemas/FederatedUser" + required: + - domainRestrictionEnabled + - identityProviderId + - orgId + CostExplorerFilterRequestBody: + type: object + description: Request body for a cost explorer query. + properties: + clusters: + type: array + description: The list of projects to be included in the Cost Explorer Query. + example: + - 5feeac500000000000000000 + - 61cfdfd00000000000000000 + items: + type: string + endDate: + type: string + format: date + description: The exclusive ending date for the Cost Explorer query. The date + must be the start of a month. + example: 2022-02-01 + groupBy: + type: string + description: The dimension to group the returned usage results by. At least one + filter value needs to be provided for a dimension to be used. + includePartialMatches: + type: boolean + description: Flag to control whether usage that matches the filter criteria, but + does not have values for all filter criteria is included in + response. Default is false, which excludes the partially matching + data. + organizations: + type: array + description: The list of organizations to be included in the Cost Explorer Query. + example: + - 5feeac500000000000000000 + - 61cfdfd00000000000000000 + items: + type: string + projects: + type: array + description: The list of projects to be included in the Cost Explorer Query. + example: + - 5feeac500000000000000000 + - 61cfdfd00000000000000000 + items: + type: string + services: + type: array + description: The list of projects to be included in the Cost Explorer Query. + example: + - Data Transfer + - Atlas Data Federation + items: + type: string + startDate: + type: string + format: date + description: The inclusive starting date for the Cost Explorer query. The date + must be the start of a month. + example: 2022-02-01 + required: + - endDate + - startDate + CostExplorerQueryResult: + type: object + CreateAtlasOrganizationApiKey: + type: object + properties: + desc: + type: string + description: Purpose or explanation provided when someone created this + organization API key. + maxLength: 250 + minLength: 1 + roles: + type: array + description: List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + organization. + items: + type: string + minItems: 1 + required: + - desc + - roles + CreateAtlasProjectApiKey: + type: object + properties: + desc: + type: string + description: Purpose or explanation provided when someone created this project + API key. + maxLength: 250 + minLength: 1 + roles: + type: array + description: List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + project. + items: + type: string + minItems: 1 + required: + - desc + - roles + CreateEndpointRequest: + type: object + properties: + id: + type: string + description: Unique string that identifies the private endpoint's network + interface that someone added to this private endpoint service. + example: /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln + writeOnly: true + privateEndpointIPAddress: + type: string + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + endpointGroupName: + type: string + description: Human-readable label that identifies a set of endpoints. + writeOnly: true + endpoints: + type: array + description: List of individual private endpoints that comprise this endpoint + group. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + items: + $ref: "#/components/schemas/CreateGCPForwardingRuleRequest" + gcpProjectId: + type: string + description: Unique string that identifies the Google Cloud project in which you + created the endpoints. + example: p-fdeeb3e43b8e733e5ab627b1 + externalDocs: + description: Google Cloud Creating and Managing Projects + url: https://cloud.google.com/resource-manager/docs/creating-managing-projects + pattern: ^p-[0-9a-z]{24}$ + writeOnly: true + CreateGCPForwardingRuleRequest: + type: object + properties: + endpointName: + type: string + description: Human-readable label that identifies the Google Cloud consumer + forwarding rule that you created. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + writeOnly: true + ipAddress: + type: string + description: One Private Internet Protocol version 4 (IPv4) address to which + this Google Cloud consumer forwarding rule resolves. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + writeOnly: true + title: GCP Forwarding Rules + CreateOrganizationRequest: + type: object + properties: + apiKey: + $ref: "#/components/schemas/CreateAtlasOrganizationApiKey" + federationSettingsId: + type: string + description: Unique 24-hexadecimal digit string that identifies the federation + to link the newly created organization to. If specified, the + proposed Organization Owner of the new organization must have the + Organization Owner role in an organization associated with the + federation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + name: + type: string + description: Human-readable label that identifies the organization. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + orgOwnerId: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user that you want to assign the Organization Owner role. This + user must be a member of the same organization as the calling API + key. If you provide `federationSettingsId`, this user must instead + have the Organization Owner role on an organization in the specified + federation. This parameter is required only when you authenticate + with Programmatic API Keys. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + required: + - name + CreateOrganizationResponse: + type: object + properties: + apiKey: + $ref: "#/components/schemas/ApiKeyUserDetails" + federationSettingsId: + type: string + description: Unique 24-hexadecimal digit string that identifies the federation + that you linked the newly created organization to. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgOwnerId: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user that you assigned the Organization Owner role in the new + organization. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + organization: + $ref: "#/components/schemas/AtlasOrganization" + DBUserTLSX509Settings: + type: object + description: Settings to configure TLS Certificates for database users. + properties: + cas: + type: string + description: Concatenated list of customer certificate authority (CA) + certificates needed to authenticate database users. MongoDB Cloud + expects this as a PEM-formatted certificate. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + title: Database User TLS Certificate Settings + DataFederationLimit: + type: object + description: Details of user managed limits. + properties: + currentUsage: + type: integer + format: int64 + description: Amount that indicates the current usage of the limit. + readOnly: true + defaultLimit: + type: integer + format: int64 + description: Default value of the limit. + readOnly: true + maximumLimit: + type: integer + format: int64 + description: Maximum value of the limit. + readOnly: true + name: + type: string + description: Human-readable label that identifies the user-managed limit to + modify. + readOnly: true + value: + type: integer + format: int64 + description: Amount to set the limit to. + lastModifiedDate: + type: string + format: date-time + description: Only used for Data Federation limits. Timestamp that indicates when + this usage limit was last modified. This field uses the ISO 8601 + timestamp format in UTC. + readOnly: true + overrunPolicy: + type: string + description: Only used for Data Federation limits. Action to take when the usage + limit is exceeded. If limit span is set to QUERY, this is ignored + because MongoDB Cloud stops the query when it exceeds the usage + limit. + required: + - name + - value + title: Limits + DataFederationTenantQueryLimit: + type: object + description: Details of a tenant-level query limit for Data Federation. Query + limit is the limit on the amount of usage during a time period based on + cost. + properties: + currentUsage: + type: integer + format: int64 + description: Amount that indicates the current usage of the limit. + readOnly: true + defaultLimit: + type: integer + format: int64 + description: Default value of the limit. + readOnly: true + lastModifiedDate: + type: string + format: date-time + description: Only used for Data Federation limits. Timestamp that indicates when + this usage limit was last modified. This field uses the ISO 8601 + timestamp format in UTC. + readOnly: true + maximumLimit: + type: integer + format: int64 + description: Maximum value of the limit. + readOnly: true + name: + type: string + description: Human-readable label that identifies the user-managed limit to + modify. + readOnly: true + overrunPolicy: + type: string + description: Only used for Data Federation limits. Action to take when the usage + limit is exceeded. If limit span is set to QUERY, this is ignored + because MongoDB Cloud stops the query when it exceeds the usage + limit. + tenantName: + type: string + description: Human-readable label that identifies the Federated Database + Instance. If specified, the usage limit is for the specified + federated database instance only. If omitted, the usage limit is for + all federated database instances in the project. + readOnly: true + value: + type: integer + format: int64 + description: Amount to set the limit to. + required: + - name + - value + title: Data Federation Tenant-Level Query Limit + DataLakeAWSCloudProviderConfig: + type: object + description: Name of the cloud service that hosts the data lake's data stores. + properties: + externalId: + type: string + description: Unique identifier associated with the Identity and Access + Management (IAM) role that the data lake assumes when accessing the + data stores. + readOnly: true + iamAssumedRoleARN: + type: string + description: Amazon Resource Name (ARN) of the Identity and Access Management + (IAM) role that the data lake assumes when accessing data stores. + example: arn:aws:iam::123456789012:root + maxLength: 2048 + minLength: 20 + readOnly: true + iamUserARN: + type: string + description: Amazon Resource Name (ARN) of the user that the data lake assumes + when accessing data stores. + readOnly: true + roleId: + type: string + description: Unique identifier of the role that the data lake can use to access + the data stores.Required if specifying cloudProviderConfig. + testS3Bucket: + type: string + description: Name of the S3 data bucket that the provided role ID is authorized + to access.Required if specifying cloudProviderConfig. + writeOnly: true + required: + - roleId + - testS3Bucket + DataLakeApiBase: + type: object + description: An aggregation pipeline that applies to the collection. + properties: + name: + type: string + description: Human-readable label that identifies the view, which corresponds to + an aggregation pipeline on a collection. + pipeline: + type: string + description: Aggregation pipeline stages to apply to the source collection. + externalDocs: + description: Aggregation Pipelines + url: https://docs.mongodb.com/manual/core/aggregation-pipeline/ + source: + type: string + description: Human-readable label that identifies the source collection for the + view. + DataLakeAtlasStoreReadConcern: + type: object + description: MongoDB Cloud cluster read concern, which determines the + consistency and isolation properties of the data read from an Atlas + cluster. + properties: + level: + type: string + description: "[Read Concern + level](https://www.mongodb.com/docs/manual/reference/read-concern/#\ + read-concern-levels) that specifies the consistency and availability + of the data read." + DataLakeAtlasStoreReadPreference: + type: object + description: MongoDB Cloud cluster read preference, which describes how to route + read requests to the cluster. + properties: + maxStalenessSeconds: + type: integer + format: int32 + description: Maximum replication lag, or **staleness**, for reads from + secondaries. + mode: + type: string + description: Read preference mode that specifies to which replica set member to + route the read requests. + externalDocs: + description: Read Preference Modes + url: https://docs.mongodb.com/manual/core/read-preference/#read-preference-modes + tagSets: + type: array + description: List that contains tag sets or tag specification documents. If + specified, Atlas Data Lake routes read requests to replica set + member or members that are associated with the specified tags. + externalDocs: + description: Read Preference Tag Set Lists + url: https://docs.mongodb.com/manual/core/read-preference-tags/ + items: + type: array + items: + $ref: "#/components/schemas/DataLakeAtlasStoreReadPreferenceTag" + DataLakeAtlasStoreReadPreferenceTag: + type: object + properties: + name: + type: string + description: Human-readable label of the tag. + value: + type: string + description: Value of the tag. + DataLakeCloudProviderConfig: + type: object + description: Cloud provider linked to this data lake. + properties: + aws: + $ref: "#/components/schemas/DataLakeAWSCloudProviderConfig" + required: + - aws + title: Data Lake Cloud Provider + DataLakeDataProcessRegion: + type: object + description: Information about the cloud provider region to which the data lake + routes client connections. + properties: + cloudProvider: + type: string + description: Name of the cloud service that hosts the data lake's data stores. + region: + $ref: "#/components/schemas/BaseAtlasDataLakeRegion" + required: + - cloudProvider + - region + DataLakeDatabaseCollection: + type: object + description: A collection and data sources that map to a ``stores`` data store. + properties: + dataSources: + type: array + description: Array that contains the data stores that map to a collection for + this data lake. + items: + $ref: "#/components/schemas/DataLakeDatabaseDataSourceSettings" + name: + type: string + description: Human-readable label that identifies the collection to which + MongoDB Cloud maps the data in the data stores. + DataLakeDatabaseDataSourceSettings: + type: object + description: Data store that maps to a collection for this data lake. + properties: + allowInsecure: + type: boolean + default: false + description: Flag that validates the scheme in the specified URLs. If `true`, + allows insecure `HTTP` scheme, doesn't verify the server's + certificate chain and hostname, and accepts any certificate with any + hostname presented by the server. If `false`, allows secure `HTTPS` + scheme only. + collection: + type: string + description: Human-readable label that identifies the collection in the + database. For creating a wildcard (`*`) collection, you must omit + this parameter. + collectionRegex: + type: string + description: Regex pattern to use for creating the wildcard (*) collection. To + learn more about the regex syntax, see [Go programming + language](https://pkg.go.dev/regexp). + database: + type: string + description: Human-readable label that identifies the database, which contains + the collection in the cluster. You must omit this parameter to + generate wildcard (`*`) collections for dynamically generated + databases. + databaseRegex: + type: string + description: Regex pattern to use for creating the wildcard (*) database. To + learn more about the regex syntax, see [Go programming + language](https://pkg.go.dev/regexp). + datasetName: + type: string + description: Human-readable label that identifies the dataset that Atlas + generates for an ingestion pipeline run or Online Archive. + example: v1$atlas$snapshot$Cluster0$myDatabase$myCollection$19700101T000000Z + datasetPrefix: + type: string + description: Human-readable label that matches against the dataset names for + ingestion pipeline runs or Online Archives. + defaultFormat: + type: string + description: File format that MongoDB Cloud uses if it encounters a file without + a file extension while searching **storeName**. + path: + type: string + description: File path that controls how MongoDB Cloud searches for and parses + files in the **storeName** before mapping them to a + collection.Specify ``/`` to capture all files and folders from the + ``prefix`` path. + provenanceFieldName: + type: string + description: Name for the field that includes the provenance of the documents in + the results. MongoDB Cloud returns different fields in the results + for each supported provider. + storeName: + type: string + description: Human-readable label that identifies the data store that MongoDB + Cloud maps to the collection. + trimLevel: + type: integer + format: int32 + description: Unsigned integer that specifies how many fields of the dataset name + to trim from the left of the dataset name before mapping the + remaining fields to a wildcard collection name. + urls: + type: array + description: URLs of the publicly accessible data files. You can't specify URLs + that require authentication. Atlas Data Lake creates a partition for + each URL. If empty or omitted, Data Lake uses the URLs from the + store specified in the **dataSources.storeName** parameter. + items: + type: string + DataLakeDatabaseInstance: + type: object + description: Database associated with this data lake. Databases contain + collections and views. + properties: + collections: + type: array + description: Array of collections and data sources that map to a ``stores`` data + store. + items: + $ref: "#/components/schemas/DataLakeDatabaseCollection" + maxWildcardCollections: + type: integer + format: int32 + default: 100 + description: Maximum number of wildcard collections in the database. This only + applies to S3 data sources. + maximum: 1000 + minimum: 1 + name: + type: string + description: Human-readable label that identifies the database to which the data + lake maps data. + views: + type: array + description: Array of aggregation pipelines that apply to the collection. This + only applies to S3 data sources. + items: + $ref: "#/components/schemas/DataLakeApiBase" + DataLakeIngestionPipeline: + type: object + description: Details of a Data Lake Pipeline. + properties: + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the Data Lake + Pipeline. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + createdDate: + type: string + format: date-time + description: Timestamp that indicates when the Data Lake Pipeline was created. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the group. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lastUpdatedDate: + type: string + format: date-time + description: Timestamp that indicates the last time that the Data Lake Pipeline + was updated. + readOnly: true + name: + type: string + description: Name of this Data Lake Pipeline. + sink: + $ref: "#/components/schemas/IngestionSink" + source: + $ref: "#/components/schemas/IngestionSource" + state: + type: string + description: State of this Data Lake Pipeline. + readOnly: true + transformations: + type: array + description: Fields to be excluded for this Data Lake Pipeline. + items: + $ref: "#/components/schemas/FieldTransformation" + title: Data Lake Pipeline + DataLakePipelinesPartitionField: + type: object + description: Partition Field in the Data Lake Storage provider for a Data Lake + Pipeline. + properties: + fieldName: + type: string + description: Human-readable label that identifies the field name used to + partition data. + maxLength: 700 + order: + type: integer + format: int32 + default: 0 + description: Sequence in which MongoDB Cloud slices the collection data to + create partitions. The resource expresses this sequence starting + with zero. + required: + - fieldName + - order + title: Partition Field + DataLakeStorage: + type: object + description: Configuration information for each data store and its mapping to + MongoDB Cloud databases. + properties: + databases: + type: array + description: Array that contains the queryable databases and collections for + this data lake. + items: + $ref: "#/components/schemas/DataLakeDatabaseInstance" + stores: + type: array + description: Array that contains the data stores for the data lake. + items: + $ref: "#/components/schemas/DataLakeStoreSettings" + DataLakeStoreSettings: + type: object + description: Group of settings that define where the data is stored. + properties: + name: + type: string + description: Human-readable label that identifies the data store. The + **databases.[n].collections.[n].dataSources.[n].storeName** field + references this values as part of the mapping configuration. To use + MongoDB Cloud as a data store, the data lake requires a serverless + instance or an `M10` or higher cluster. + provider: + type: string + additionalStorageClasses: + type: array + description: Collection of AWS S3 [storage + classes](https://aws.amazon.com/s3/storage-classes/). Atlas Data + Lake includes the files in these storage classes in the query + results. + items: + type: string + description: AWS S3 [storage class](https://aws.amazon.com/s3/storage-classes/) + where the files to include in the results are stored. + bucket: + type: string + description: Human-readable label that identifies the AWS S3 bucket. This label + must exactly match the name of an S3 bucket that the data lake can + access with the configured AWS Identity and Access Management (IAM) + credentials. + delimiter: + type: string + description: The delimiter that separates + **databases.[n].collections.[n].dataSources.[n].path** segments in + the data store. MongoDB Cloud uses the delimiter to efficiently + traverse S3 buckets with a hierarchical directory structure. You can + specify any character supported by the S3 object keys as the + delimiter. For example, you can specify an underscore (_) or a plus + sign (+) or multiple characters, such as double underscores (__) as + the delimiter. If omitted, defaults to `/`. + includeTags: + type: boolean + default: false + description: Flag that indicates whether to use S3 tags on the files in the + given path as additional partition attributes. If set to `true`, + data lake adds the S3 tags as additional partition attributes and + adds new top-level BSON elements associating each tag to each + document. + prefix: + type: string + description: Prefix that MongoDB Cloud applies when searching for files in the + S3 bucket. The data store prepends the value of prefix to the + **databases.[n].collections.[n].dataSources.[n].path** to create the + full path for files to ingest. If omitted, MongoDB Cloud searches + all files from the root of the S3 bucket. + public: + type: boolean + default: false + description: Flag that indicates whether the bucket is public. If set to `true`, + MongoDB Cloud doesn't use the configured AWS Identity and Access + Management (IAM) role to access the S3 bucket. If set to `false`, + the configured AWS IAM role must include permissions to access the + S3 bucket. + region: + type: string + description: >- + Physical location where MongoDB Cloud deploys your AWS-hosted + MongoDB cluster nodes. The region you choose can affect network + latency for clients accessing your databases. When MongoDB Cloud + deploys a dedicated cluster, it checks if a VPC or VPC connection + exists for that provider and region. If not, MongoDB Cloud creates + them as part of the deployment. MongoDB Cloud assigns the VPC a CIDR + block. To limit a new VPC peering connection to one CIDR block and + region, create the connection first. Deploy the cluster after the + connection starts. + + + Alternatively: + + Microsoft Azure Regions. + title: Azure Regions + clusterName: + type: string + description: Human-readable label of the MongoDB Cloud cluster on which the + store is based. + projectId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + readConcern: + $ref: "#/components/schemas/DataLakeAtlasStoreReadConcern" + readPreference: + $ref: "#/components/schemas/DataLakeAtlasStoreReadPreference" + allowInsecure: + type: boolean + default: false + description: Flag that validates the scheme in the specified URLs. If `true`, + allows insecure `HTTP` scheme, doesn't verify the server's + certificate chain and hostname, and accepts any certificate with any + hostname presented by the server. If `false`, allows secure `HTTPS` + scheme only. + defaultFormat: + type: string + description: Default format that Data Lake assumes if it encounters a file + without an extension while searching the `storeName`. If omitted, + Data Lake attempts to detect the file type by processing a few bytes + of the file. The specified format only applies to the URLs specified + in the **databases.[n].collections.[n].dataSources** object. + urls: + type: array + description: Comma-separated list of publicly accessible HTTP URLs where data is + stored. You can't specify URLs that require authentication. + items: + type: string + description: Comma-separated list of publicly accessible HTTP URLs where data is + stored. You can't specify URLs that require authentication. + required: + - provider + DataLakeTenant: + type: object + properties: + cloudProviderConfig: + $ref: "#/components/schemas/DataLakeCloudProviderConfig" + dataProcessRegion: + $ref: "#/components/schemas/DataLakeDataProcessRegion" + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostnames: + type: array + description: List that contains the hostnames assigned to the Data Lake instance. + items: + type: string + description: Unique hostname assigned to the Data Lake instance. + readOnly: true + readOnly: true + name: + type: string + description: Human-readable label that identifies the data lake. + state: + type: string + description: Label that indicates the status of the Data Lake instance. + readOnly: true + storage: + $ref: "#/components/schemas/DataLakeStorage" + DataProtectionSettings: + type: object + properties: + authorizedEmail: + type: string + format: email + description: Email address of the user who authorized to updated the Backup + Compliance Policy settings. + copyProtectionEnabled: + type: boolean + default: false + description: Flag that indicates whether to enable additional backup copies for + the cluster. If unspecified, this value defaults to false. + encryptionAtRestEnabled: + type: boolean + default: false + description: Flag that indicates whether Encryption at Rest using Customer + Key Management is required for all clusters with a Backup + Compliance Policy. If unspecified, this value defaults to false. + externalDocs: + description: Encryption at Rest using Customer Key Management + url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ + onDemandPolicyItem: + $ref: "#/components/schemas/DiskBackupApiPolicyItem" + pitEnabled: + type: boolean + default: false + description: Flag that indicates whether the cluster uses Continuous Cloud + Backups with a Backup Compliance Policy. If unspecified, this value + defaults to false. + externalDocs: + description: Continuous Cloud Backups + url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ + projectId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project for + the Backup Compliance Policy. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + restoreWindowDays: + type: integer + format: int32 + description: Number of previous days that you can restore back to with + Continuous Cloud Backup with a Backup Compliance Policy. You must + specify a positive, non-zero integer, and the maximum retention + window can't exceed the hourly retention time. This parameter + applies only to Continuous Cloud Backups with a Backup Compliance + Policy. + scheduledPolicyItems: + type: array + description: List that contains the specifications for one scheduled policy. + items: + $ref: "#/components/schemas/DiskBackupApiPolicyItem" + state: + type: string + description: Label that indicates the state of the Backup Compliance Policy + settings. MongoDB Cloud ignores this setting when you enable or + update the Backup Compliance Policy settings. + readOnly: true + updatedDate: + type: string + format: date-time + description: ISO 8601 timestamp format in UTC that indicates when the user + updated the Data Protection Policy settings. MongoDB Cloud ignores + this setting when you enable or update the Backup Compliance Policy + settings. + readOnly: true + updatedUser: + type: string + format: email + description: Email address that identifies the user who updated the Backup + Compliance Policy settings. MongoDB Cloud ignores this email setting + when you enable or update the Backup Compliance Policy settings. + readOnly: true + required: + - authorizedEmail + DatabaseInheritedRole: + type: object + description: Role inherited from another context for this database user. + externalDocs: + description: Built-in MongoDB Roles + url: https://docs.mongodb.com/manual/reference/built-in-roles/ + properties: + db: + type: string + description: Human-readable label that identifies the database on which someone + grants the action to one MongoDB user. + role: + type: string + description: Human-readable label that identifies the role inherited. Set this + value to `admin` for every role except `read` or `readWrite`. + externalDocs: + description: MongoDB Built-In Roles + url: https://docs.mongodb.com/manual/reference/built-in-roles/ + pattern: ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- + Target throughput desired for storage attached to your + AWS-provisioned cluster. Change this parameter only if you: + + + - set `"replicationSpecs[n].regionConfigs[m].providerName" : "AWS"`. + + - set `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" : "M30"` or greater not including `Mxx_NVME` tiers. + + + The maximum input/output operations per second (IOPS) depend on the selected **.instanceSize** and **.diskSizeGB**. + + This parameter defaults to the cluster tier's standard IOPS value. + + Changing this value impacts cluster cost. + + MongoDB Cloud enforces minimum ratios of storage capacity to system memory for given cluster tiers. This keeps cluster performance consistent with large datasets. + + + - Instance sizes `M10` to `M40` have a ratio of disk capacity to system memory of 60:1. + + - Instance sizes greater than `M40` have a ratio of 120:1. + ebsVolumeType: + type: string + default: STANDARD + description: >- + Type of storage you want to attach to your AWS-provisioned cluster. + + + - `STANDARD` volume types can't exceed the default input/output operations per second (IOPS) rate for the selected volume size. + + + - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. + instanceSize: + type: string + description: Hardware specification for the instance sizes in this region. Each + instance size has a default storage and memory capacity. The + instance size you select applies to all the data-bearing hosts in + your instance size. + title: GCP Instance Sizes + DeleteCopiedBackups: + type: object + description: Deleted copy setting whose backup copies need to also be deleted. + properties: + cloudProvider: + type: string + description: Human-readable label that identifies the cloud provider for the + deleted copy setting whose backup copies you want to delete. + writeOnly: true + regionName: + type: string + description: Target region for the deleted copy setting whose backup copies you + want to delete. Please supply the 'Atlas Region' which can be found + under [Cloud + Providers](https://www.mongodb.com/docs/atlas/reference/cloud-providers/) + 'regions' link. + writeOnly: true + replicationSpecId: + type: string + description: Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a cluster. For global clusters, there can be + multiple zones to choose from. For sharded clusters and replica + setclusters, there is only one zone in the cluster. To find the + Replication Spec Id, do a GET request to Return One Cluster in One + Project and consult the replicationSpecs array [Return One Cluster + in One Project](#operation/getLegacyCluster). + writeOnly: true + writeOnly: true + Destination: + type: object + description: Document that describes the destination of the migration. + properties: + clusterName: + type: string + description: Label that identifies the destination cluster. + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the destination + project. + example: 9b43a5b329223c3a1591a678 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + hostnameSchemaType: + type: string + default: PUBLIC + description: The network type to use between the migration host and the target + cluster. + privateLinkId: + type: string + description: Represents the endpoint to use when the host schema type is + `PRIVATE_LINK`. + required: + - clusterName + - groupId + - hostnameSchemaType + DiskBackupApiPolicyItem: + type: object + description: Specifications for one policy. + properties: + frequencyInterval: + type: integer + format: int32 + description: >- + Number that indicates the frequency interval for a set of snapshots. + A value of `1` specifies the first instance of the corresponding + `frequencyType`. + + + - In a monthly policy item, `1` indicates that the monthly snapshot occurs on the first day of the month and `40` indicates the last day of the month. + + + - In a weekly policy item, `1` indicates that the weekly snapshot occurs on Monday and `7` indicates Sunday. + + + - In an hourly policy item, you can set the frequency interval to `1`, `2`, `4`, `6`, `8`, or `12`. For hourly policy items for NVMe clusters, MongoDB Cloud accepts only `12` as the frequency interval value. + + MongoDB Cloud ignores this setting for non-hourly policy items in Backup Compliance Policy settings. + frequencyType: + type: string + description: Human-readable label that identifies the frequency type associated + with the backup policy. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this backup + policy item. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + retentionUnit: + type: string + description: Unit of time in which MongoDB Cloud measures snapshot retention. + retentionValue: + type: integer + format: int32 + description: >- + Duration in days, weeks, or months that MongoDB Cloud retains the + snapshot. For less frequent policy items, MongoDB Cloud requires + that you specify a value greater than or equal to the value + specified for more frequent policy items. + + + For example: If the hourly policy item specifies a retention of two days, you must specify two days or greater for the retention of the weekly policy item. + required: + - frequencyInterval + - frequencyType + - retentionUnit + - retentionValue + DiskBackupBaseRestoreMember: + type: object + properties: + replicaSetName: + type: string + description: Human-readable label that identifies the replica set on the sharded + cluster. + readOnly: true + DiskBackupCopySetting: + type: object + description: Copy setting item in the desired backup policy. + properties: + cloudProvider: + type: string + description: Human-readable label that identifies the cloud provider that stores + the snapshot copy. + frequencies: + type: array + description: List that describes which types of snapshots to copy. + items: + type: string + regionName: + type: string + description: Target region to copy snapshots belonging to replicationSpecId to. + Please supply the 'Atlas Region' which can be found under [Cloud + Providers](https://www.mongodb.com/docs/atlas/reference/cloud-providers/) + 'regions' link. + replicationSpecId: + type: string + description: Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a cluster. For global clusters, there can be + multiple zones to choose from. For sharded clusters and replica set + clusters, there is only one zone in the cluster. To find the + Replication Spec Id, do a GET request to Return One Cluster in One + Project and consult the replicationSpecs array [Return One Cluster + in One Project](#operation/getLegacyCluster). + shouldCopyOplogs: + type: boolean + description: Flag that indicates whether to copy the oplogs to the target + region. You can use the oplogs to perform point-in-time restores. + DiskBackupExportJob: + type: object + properties: + components: + type: array + description: Information on the export job for each replica set in the sharded + cluster. + items: + $ref: "#/components/schemas/DiskBackupBaseRestoreMember" + readOnly: true + createdAt: + type: string + format: date-time + description: Date and time when someone created this export job. MongoDB Cloud + represents this timestamp in ISO 8601 format in UTC. + readOnly: true + customData: + type: array + description: Collection of key-value pairs that represent custom data for the + metadata file that MongoDB Cloud uploads to the bucket when the + export job finishes. + items: + $ref: "#/components/schemas/BackupLabel" + deliveryUrl: + type: array + description: 'One or more Uniform Resource Locators (URLs) that point to the + compressed snapshot files for manual download. MongoDB Cloud returns + this parameter when `"deliveryType" : "download"`.' + items: + type: string + description: One Uniform Resource Locator that point to the compressed snapshot + files for manual download. + readOnly: true + exportBucketId: + type: string + description: Unique 24-hexadecimal character string that identifies the AWS + bucket to which MongoDB Cloud exports the Cloud Backup snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + exportStatus: + $ref: "#/components/schemas/ExportStatus" + finishedAt: + type: string + format: date-time + description: Date and time when this export job completed. MongoDB Cloud + represents this timestamp in ISO 8601 format in UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal character string that identifies the restore + job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + prefix: + type: string + description: Full path on the cloud provider bucket to the folder where the + snapshot is exported. + pattern: /exported_snapshots/\{ORG-NAME\}/\{PROJECT-NAME\}/\{CLUSTER-NAME\}/\{SNAPSHOT-INITIATION-DATE\}/\{TIMESTAMP\} + readOnly: true + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + state: + type: string + description: State of the export job. + readOnly: true + required: + - exportBucketId + DiskBackupExportJobRequest: + type: object + properties: + customData: + type: array + description: Collection of key-value pairs that represent custom data to add to + the metadata file that MongoDB Cloud uploads to the bucket when the + export job finishes. + items: + $ref: "#/components/schemas/BackupLabel" + exportBucketId: + type: string + description: Unique 24-hexadecimal character string that identifies the AWS + bucket to which MongoDB Cloud exports the Cloud Backup snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the Cloud + Backup snasphot to export. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + required: + - exportBucketId + - snapshotId + DiskBackupOnDemandSnapshotRequest: + type: object + properties: + description: + type: string + description: 'Human-readable phrase or sentence that explains the purpose of the + snapshot. The resource returns this parameter when `"status" : + "onDemand"`.' + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + retentionInDays: + type: integer + format: int32 + description: Number of days that MongoDB Cloud should retain the on-demand + snapshot. Must be at least **1**. + minimum: 1 + DiskBackupReplicaSet: + type: object + description: Details of the replica set snapshot that MongoDB Cloud created. + properties: + cloudProvider: + type: string + description: 'Human-readable label that identifies the cloud provider that + stores this snapshot. The resource returns this parameter when + `"type": "replicaSet"`.' + readOnly: true + copyRegions: + type: array + description: List that identifies the regions to which MongoDB Cloud copies the + snapshot. + items: + type: string + readOnly: true + createdAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud took the snapshot. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + description: + type: string + description: 'Human-readable phrase or sentence that explains the purpose of the + snapshot. The resource returns this parameter when `"status": + "onDemand"`.' + readOnly: true + expiresAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud deletes the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + frequencyType: + type: string + description: Human-readable label that identifies how often this snapshot + triggers. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: 'Unique string that identifies the Amazon Web Services (AWS) Key + Management Service (KMS) Customer Master Key (CMK) used to encrypt + the snapshot. The resource returns this value when + `"encryptionEnabled" : true`.' + readOnly: true + mongodVersion: + type: string + description: Version of the MongoDB host that this snapshot backs up. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + policyItems: + type: array + description: List that contains unique identifiers for the policy items. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies one policy item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + replicaSetName: + type: string + description: 'Human-readable label that identifies the replica set from which + MongoDB Cloud took this snapshot. The resource returns this + parameter when `"type": "replicaSet"`.' + readOnly: true + snapshotType: + type: string + description: Human-readable label that identifies when this snapshot triggers. + readOnly: true + status: + type: string + description: Human-readable label that indicates the stage of the backup process + for this snapshot. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number of bytes taken to store the backup snapshot. + readOnly: true + type: + type: string + description: Human-readable label that categorizes the cluster as a replica set + or sharded cluster. + readOnly: true + title: Replica Set Snapshot + DiskBackupShardedClusterSnapshot: + type: object + description: Details of the sharded cluster snapshot that MongoDB Cloud created. + properties: + createdAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud took the snapshot. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + description: + type: string + description: 'Human-readable phrase or sentence that explains the purpose of the + snapshot. The resource returns this parameter when `"status": + "onDemand"`.' + readOnly: true + expiresAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud deletes the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + frequencyType: + type: string + description: Human-readable label that identifies how often this snapshot + triggers. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: 'Unique string that identifies the Amazon Web Services (AWS) Key + Management Service (KMS) Customer Master Key (CMK) used to encrypt + the snapshot. The resource returns this value when + `"encryptionEnabled" : true`.' + readOnly: true + members: + type: array + description: 'List that includes the snapshots and the cloud provider that + stores the snapshots. The resource returns this parameter when + `"type" : "SHARDED_CLUSTER"`.' + items: + $ref: "#/components/schemas/DiskBackupShardedClusterSnapshotMember" + readOnly: true + mongodVersion: + type: string + description: Version of the MongoDB host that this snapshot backs up. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + policyItems: + type: array + description: List that contains unique identifiers for the policy items. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies one policy item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + snapshotIds: + type: array + description: 'List that contains the unique identifiers of the snapshots created + for the shards and config host for a sharded cluster. The resource + returns this parameter when `"type": "SHARDED_CLUSTER"`. These + identifiers should match the ones specified in the **members[n].id** + parameters. This allows you to map a snapshot to its shard or config + host name.' + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot for + part of the sharded cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + readOnly: true + snapshotType: + type: string + description: Human-readable label that identifies when this snapshot triggers. + readOnly: true + status: + type: string + description: Human-readable label that indicates the stage of the backup process + for this snapshot. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number of bytes taken to store the backup snapshot. + readOnly: true + type: + type: string + description: Human-readable label that categorizes the cluster as a replica set + or sharded cluster. + readOnly: true + title: Sharded Cluster Snapshot + DiskBackupShardedClusterSnapshotMember: + type: object + properties: + cloudProvider: + type: string + description: 'Human-readable label that identifies the cloud provider that + stores this snapshot. The resource returns this parameter when + `"type": "replicaSet"`.' + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + replicaSetName: + type: string + description: Human-readable label that identifies the shard or config host from + which MongoDB Cloud took this snapshot. + readOnly: true + required: + - cloudProvider + - id + - replicaSetName + DiskBackupSnapshot: + type: object + properties: + createdAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud took the snapshot. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + description: + type: string + description: 'Human-readable phrase or sentence that explains the purpose of the + snapshot. The resource returns this parameter when `"status": + "onDemand"`.' + readOnly: true + expiresAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud deletes the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + frequencyType: + type: string + description: Human-readable label that identifies how often this snapshot + triggers. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + masterKeyUUID: + type: string + format: uuid + description: 'Unique string that identifies the Amazon Web Services (AWS) Key + Management Service (KMS) Customer Master Key (CMK) used to encrypt + the snapshot. The resource returns this value when + `"encryptionEnabled" : true`.' + readOnly: true + mongodVersion: + type: string + description: Version of the MongoDB host that this snapshot backs up. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + policyItems: + type: array + description: List that contains unique identifiers for the policy items. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies one policy item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + snapshotType: + type: string + description: Human-readable label that identifies when this snapshot triggers. + readOnly: true + status: + type: string + description: Human-readable label that indicates the stage of the backup process + for this snapshot. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number of bytes taken to store the backup snapshot. + readOnly: true + type: + type: string + description: Human-readable label that categorizes the cluster as a replica set + or sharded cluster. + readOnly: true + cloudProvider: + type: string + description: 'Human-readable label that identifies the cloud provider that + stores this snapshot. The resource returns this parameter when + `"type": "replicaSet"`.' + readOnly: true + copyRegions: + type: array + description: List that identifies the regions to which MongoDB Cloud copies the + snapshot. + items: + type: string + readOnly: true + replicaSetName: + type: string + description: 'Human-readable label that identifies the replica set from which + MongoDB Cloud took this snapshot. The resource returns this + parameter when `"type": "replicaSet"`.' + readOnly: true + members: + type: array + description: 'List that includes the snapshots and the cloud provider that + stores the snapshots. The resource returns this parameter when + `"type" : "SHARDED_CLUSTER"`.' + items: + $ref: "#/components/schemas/DiskBackupShardedClusterSnapshotMember" + readOnly: true + snapshotIds: + type: array + description: 'List that contains the unique identifiers of the snapshots created + for the shards and config host for a sharded cluster. The resource + returns this parameter when `"type": "SHARDED_CLUSTER"`. These + identifiers should match the ones specified in the **members[n].id** + parameters. This allows you to map a snapshot to its shard or config + host name.' + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot for + part of the sharded cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + readOnly: true + DiskBackupSnapshotAWSExportBucket: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal character string that identifies the Amazon + Web Services (AWS) Simple Storage Service (S3) export bucket. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + bucketName: + type: string + description: Human-readable label that identifies the AWS bucket that the role + is authorized to access. + cloudProvider: + type: string + description: Human-readable label that identifies the cloud provider that stores + this snapshot. + iamRoleId: + type: string + description: Unique 24-hexadecimal character string that identifies the AWS IAM + role that MongoDB Cloud uses to access the AWS S3 bucket. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + DiskBackupSnapshotRestoreJob: + type: object + properties: + cancelled: + type: boolean + description: Flag that indicates whether someone canceled this restore job. + readOnly: true + components: + type: array + description: Information on the restore job for each replica set in the sharded + cluster. + items: + $ref: "#/components/schemas/DiskBackupBaseRestoreMember" + readOnly: true + deliveryType: + type: string + description: Human-readable label that categorizes the restore job to create. + deliveryUrl: + type: array + description: 'One or more Uniform Resource Locators (URLs) that point to the + compressed snapshot files for manual download. MongoDB Cloud returns + this parameter when `"deliveryType" : "download"`.' + items: + type: string + description: One Uniform Resource Locator that point to the compressed snapshot + files for manual download. + readOnly: true + desiredTimestamp: + $ref: "#/components/schemas/ApiBSONTimestamp" + expired: + type: boolean + description: Flag that indicates whether the restore job expired. + readOnly: true + expiresAt: + type: string + format: date-time + description: Date and time when the restore job expires. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + failed: + type: boolean + description: Flag that indicates whether the restore job failed. + readOnly: true + finishedAt: + type: string + format: date-time + description: Date and time when the restore job completed. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal character string that identifies the restore + job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + oplogInc: + type: integer + format: int32 + description: 'Oplog operation number from which you want to restore this + snapshot. This number represents the second part of an Oplog + timestamp. The resource returns this parameter when `"deliveryType" + : "pointInTime"` and **oplogTs** exceeds `0`.' + example: 1 + minimum: 1 + oplogTs: + type: integer + format: int32 + description: 'Date and time from which you want to restore this snapshot. This + parameter expresses this timestamp in the number of seconds that + have elapsed since the UNIX epoch. This number represents the first + part of an Oplog timestamp. The resource returns this parameter when + `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.' + minimum: 1199145600 + pointInTimeUTCSeconds: + type: integer + format: int32 + description: 'Date and time from which MongoDB Cloud restored this snapshot. + This parameter expresses this timestamp in the number of seconds + that have elapsed since the UNIX epoch. The resource returns this + parameter when `"deliveryType" : "pointInTime"` and + **pointInTimeUTCSeconds** exceeds `0`.' + minimum: 1199145600 + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + targetClusterName: + type: string + description: Human-readable label that identifies the target cluster to which + the restore job restores the snapshot. The resource returns this + parameter when `"deliveryType":` `"automated"`. Required for + `automated` and `pointInTime` restore types. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + targetGroupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the target + project for the specified **targetClusterName**. Required for + `automated` and `pointInTime` restore types. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + timestamp: + type: string + format: date-time + description: Date and time when MongoDB Cloud took the snapshot associated with + **snapshotId**. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + required: + - deliveryType + DiskBackupSnapshotSchedule: + type: object + properties: + autoExportEnabled: + type: boolean + description: Flag that indicates whether MongoDB Cloud automatically exports + cloud backup snapshots to the AWS bucket. + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster with + the snapshot you want to return. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: Human-readable label that identifies the cluster with the snapshot + you want to return. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + copySettings: + type: array + description: List that contains a document for each copy setting item in the + desired backup policy. + items: + $ref: "#/components/schemas/DiskBackupCopySetting" + deleteCopiedBackups: + type: array + description: List that contains a document for each deleted copy setting whose + backup copies you want to delete. + items: + $ref: "#/components/schemas/DeleteCopiedBackups" + writeOnly: true + export: + $ref: "#/components/schemas/AutoExportPolicy" + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + nextSnapshot: + type: string + format: date-time + description: Date and time when MongoDB Cloud takes the next snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + policies: + type: array + description: Rules set for this backup schedule. + items: + $ref: "#/components/schemas/AdvancedDiskBackupSnapshotSchedulePolicy" + maxItems: 1 + referenceHourOfDay: + type: integer + format: int32 + description: Hour of day in Coordinated Universal Time (UTC) that represents + when MongoDB Cloud takes the snapshot. + referenceMinuteOfHour: + type: integer + format: int32 + description: Minute of the **referenceHourOfDay** that represents when MongoDB + Cloud takes the snapshot. + restoreWindowDays: + type: integer + format: int32 + description: Number of previous days that you can restore back to with + Continuous Cloud Backup accuracy. You must specify a positive, + non-zero integer. This parameter applies to continuous cloud backups + only. + updateSnapshots: + type: boolean + description: Flag that indicates whether to apply the retention changes in the + updated backup policy to snapshots that MongoDB Cloud took + previously. + writeOnly: true + useOrgAndGroupNamesInExportPrefix: + type: boolean + description: Flag that indicates whether to use organization and project names + instead of organization and project UUIDs in the path to the + metadata files that MongoDB Cloud uploads to your AWS bucket. + DiskGBAutoScaling: + type: object + description: Setting that enables disk auto-scaling. + properties: + enabled: + type: boolean + description: Flag that indicates whether this cluster enables disk auto-scaling. + The maximum memory allowed for the selected cluster tier and the + oplog size can limit storage auto-scaling. + EncryptionAtRest: + type: object + properties: + awsKms: + $ref: "#/components/schemas/AWSKMSConfiguration" + azureKeyVault: + $ref: "#/components/schemas/AzureKeyVault" + googleCloudKms: + $ref: "#/components/schemas/GoogleCloudKMS" + EndpointService: + type: object + properties: + cloudProvider: + type: string + description: Cloud service provider that serves the requested endpoint service. + readOnly: true + errorMessage: + type: string + description: Error message returned when requesting private connection resource. + The resource returns `null` if the request succeeded. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the Private + Endpoint Service. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + regionName: + type: string + description: Cloud provider region that manages this Private Endpoint Service. + readOnly: true + status: + type: string + description: State of the Private Endpoint Service connection when MongoDB Cloud + received this request. + readOnly: true + endpointServiceName: + type: string + description: Unique string that identifies the Amazon Web Services (AWS) + PrivateLink endpoint service. MongoDB Cloud returns null while it + creates the endpoint service. + pattern: ^com\.amazonaws\.vpce\.[a-z-0-9]+\.vpce-svc-[0-9a-f]{17} + readOnly: true + interfaceEndpoints: + type: array + description: List of strings that identify private endpoint interfaces applied + to the specified project. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the interface + endpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + readOnly: true + privateEndpoints: + type: array + description: List of private endpoints assigned to this Azure Private Link + Service. + items: + type: string + description: Root-relative path to one private endpoint assigned to this Azure + Private Link Service. + pattern: ^\/subscriptions\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/resource[gG]roups\/([-\w._()]+)\/providers\/Microsoft\.Network\/privateEndpoints\/([-\w._()]+) + readOnly: true + readOnly: true + privateLinkServiceName: + type: string + description: Unique string that identifies the Azure Private Link Service that + MongoDB Cloud manages. + maxLength: 24 + minLength: 24 + pattern: ^pls_[0-9a-f]{24}$ + readOnly: true + privateLinkServiceResourceId: + type: string + description: Root-relative path that identifies of the Azure Private Link + Service that MongoDB Cloud manages. Use this value to create a + private endpoint connection to an Azure VNet. + example: /subscriptions/ae349d51-d12b-ee3d-2a27-7d53f6479cf0/resourcegroups/KObGGz/providers/Microsoft.Network/privateLinkServices/pls_d1820713f8153388d533e9de + readOnly: true + endpointGroupNames: + type: array + description: List of Google Cloud network endpoint groups that corresponds to + the Private Service Connect endpoint service. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + items: + type: string + description: One Google Cloud network endpoint group that corresponds to the + Private Service Connect endpoint service. + serviceAttachmentNames: + type: array + description: List of Uniform Resource Locators (URLs) that identifies endpoints + that MongoDB Cloud can use to access one Google Cloud Service across + a Google Cloud Virtual Private Connection (VPC) network. + externalDocs: + description: Google Cloud Private Service Connect Service Attachments + url: https://cloud.google.com/vpc/docs/private-service-connect#service-attachments + items: + type: string + description: Uniform Resource Locator (URL) that identifies one endpoint that + MongoDB Cloud can use to access one Google Cloud Service across a + Google Cloud Virtual Private Connection (VPC) network. + pattern: https:\/\/([a-z0-9\.]+)+\.[a-z]{2,}(\/[a-z0-9\-]+)+\/projects\/p-[a-z0-9]+\/regions\/[a-z\-0-9]+\/serviceAttachments\/[a-z0-9\-]+ + required: + - cloudProvider + EventTypeForNdsGroup: + type: string + EventTypeForOrg: + type: string + EventViewForNdsGroup: + type: object + properties: + apiKeyId: + type: string + description: Unique 24-hexadecimal digit string that identifies the [API + Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that + triggered the event. If this resource returns this parameter, it + doesn't return the **userId** parameter. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + created: + type: string + format: date-time + description: Date and time when this event occurred. This parameter expresses + its value in the ISO 8601 timestamp + format in UTC. + readOnly: true + eventTypeName: + $ref: "#/components/schemas/ResourceEventType" + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project in + which the event occurred. The **eventId** identifies the specific + event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + isGlobalAdmin: + type: boolean + default: false + description: Flag that indicates whether a MongoDB employee triggered the + specified event. + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + to which these events apply. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + publicKey: + type: string + format: email + description: Public part of the [API + Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that + triggered the event. If this resource returns this parameter, it + doesn't return the **username** parameter. + example: test.user@mongodb.com + readOnly: true + raw: + $ref: "#/components/schemas/raw" + remoteAddress: + type: string + description: IPv4 or IPv6 address from which the user triggered this event. + example: 216.172.40.186 + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + userId: + type: string + description: Unique 24-hexadecimal digit string that identifies the console user + who triggered the event. If this resource returns this parameter, it + doesn't return the **apiKeyId** parameter. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + username: + type: string + format: email + description: Email address for the user who triggered this event. If this + resource returns this parameter, it doesn't return the + **publicApiKey** parameter. + example: test.user@mongodb.com + readOnly: true + alertId: + type: string + description: Unique 24-hexadecimal digit string that identifies the alert + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + alertConfigId: + type: string + description: Unique 24-hexadecimal digit string that identifies the alert + configuration associated with the **alertId**. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + invoiceId: + type: string + description: Unique 24-hexadecimal digit string that identifies of the invoice + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + paymentId: + type: string + description: Unique 24-hexadecimal digit string that identifies the invoice + payment associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + shardName: + type: string + description: Human-readable label of the shard associated with the event. + example: event-sh-01 + readOnly: true + collection: + type: string + description: Human-readable label of the collection on which the event occurred. + The resource returns this parameter when the **eventTypeName** + includes `DATA_EXPLORER`. + example: test_collection + readOnly: true + database: + type: string + description: 'Human-readable label of the database on which this incident + occurred. The resource returns this parameter when `"eventTypeName" + : "DATA_EXPLORER"` or `"eventTypeName" : "DATA_EXPLORER_CRUD"`.' + example: test_db + readOnly: true + opType: + type: string + description: 'Action that the database attempted to execute when the event + triggered. The response returns this parameter when `eventTypeName" + : "DATA_EXPLORER"`.' + example: insertDocument + readOnly: true + port: + type: integer + format: int32 + description: IANA port on which the MongoDB process listens for requests. + example: 27017 + readOnly: true + replicaSetName: + type: string + description: Human-readable label of the replica set associated with the event. + example: event-replica-set + readOnly: true + currentValue: + $ref: "#/components/schemas/NumberMetricValue" + metricName: + type: string + description: Human-readable label of the metric associated with the **alertId**. + This field may change type of **currentValue** field. + readOnly: true + dbUserUsername: + type: string + description: The username of the MongoDB User that was created, deleted, or + edited. + example: user1 + readOnly: true + whitelistEntry: + type: string + description: Entry in the list of source host addresses that the API key accepts + and this event targets. + example: 0.0.0.0 + readOnly: true + endpointId: + type: string + description: Unique 24-hexadecimal digit string that identifies the endpoint + associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + providerEndpointId: + type: string + description: Unique identification string that the cloud provider uses to + identify the private endpoint. + example: vpce-0d6c248dedef65a25 + readOnly: true + teamId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + team associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + targetUsername: + type: string + format: email + description: 'Email address for the console user that this event targets. The + resource returns this parameter when `"eventTypeName" : "USER"`.' + example: test.user@mongodb.com + readOnly: true + resourceId: + type: string + description: Unique 24-hexadecimal digit string that identifies the resource + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + resourceType: + type: string + description: Unique identifier of resource type. + example: cluster + EventViewForOrg: + type: object + properties: + apiKeyId: + type: string + description: Unique 24-hexadecimal digit string that identifies the [API + Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that + triggered the event. If this resource returns this parameter, it + doesn't return the **userId** parameter. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + created: + type: string + format: date-time + description: Date and time when this event occurred. This parameter expresses + its value in the ISO 8601 timestamp + format in UTC. + readOnly: true + eventTypeName: + $ref: "#/components/schemas/ResourceEventTypeViewForOrg" + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project in + which the event occurred. The **eventId** identifies the specific + event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + isGlobalAdmin: + type: boolean + default: false + description: Flag that indicates whether a MongoDB employee triggered the + specified event. + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + to which these events apply. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + publicKey: + type: string + format: email + description: Public part of the [API + Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that + triggered the event. If this resource returns this parameter, it + doesn't return the **username** parameter. + example: test.user@mongodb.com + readOnly: true + raw: + $ref: "#/components/schemas/raw" + remoteAddress: + type: string + description: IPv4 or IPv6 address from which the user triggered this event. + example: 216.172.40.186 + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + userId: + type: string + description: Unique 24-hexadecimal digit string that identifies the console user + who triggered the event. If this resource returns this parameter, it + doesn't return the **apiKeyId** parameter. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + username: + type: string + format: email + description: Email address for the user who triggered this event. If this + resource returns this parameter, it doesn't return the + **publicApiKey** parameter. + example: test.user@mongodb.com + readOnly: true + alertId: + type: string + description: Unique 24-hexadecimal digit string that identifies the alert + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + alertConfigId: + type: string + description: Unique 24-hexadecimal digit string that identifies the alert + configuration associated with the **alertId**. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + invoiceId: + type: string + description: Unique 24-hexadecimal digit string that identifies of the invoice + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + paymentId: + type: string + description: Unique 24-hexadecimal digit string that identifies the invoice + payment associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + dbUserUsername: + type: string + description: The username of the MongoDB User that was created, deleted, or + edited. + example: user1 + readOnly: true + whitelistEntry: + type: string + description: Entry in the list of source host addresses that the API key accepts + and this event targets. + example: 0.0.0.0 + readOnly: true + teamId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + team associated with this event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + targetUsername: + type: string + format: email + description: 'Email address for the console user that this event targets. The + resource returns this parameter when `"eventTypeName" : "USER"`.' + example: test.user@mongodb.com + readOnly: true + resourceId: + type: string + description: Unique 24-hexadecimal digit string that identifies the resource + associated with the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + resourceType: + type: string + description: Unique identifier of resource type. + example: cluster + ExportStatus: + type: object + description: State of the export job for the collections on the replica set only. + properties: + exportedCollections: + type: integer + format: int32 + description: Number of collections on the replica set that MongoDB Cloud exported. + readOnly: true + totalCollections: + type: integer + format: int32 + description: Total number of collections on the replica set to export. + readOnly: true + FTSMetric: + type: object + description: Measurement of one Atlas Search status when MongoDB Atlas received + this request. + properties: + metricName: + type: string + description: Human-readable label that identifies this Atlas Search hardware, + status, or index measurement. + readOnly: true + units: + type: string + description: Unit of measurement that applies to this Atlas Search metric. + readOnly: true + readOnly: true + required: + - metricName + - units + FederatedUser: + type: object + description: MongoDB Cloud user linked to this federated authentication. + properties: + emailAddress: + type: string + format: email + description: Email address of the MongoDB Cloud user linked to the federated + organization. + federationSettingsId: + type: string + description: Unique 24-hexadecimal digit string that identifies the federation + to which this MongoDB Cloud user belongs. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + firstName: + type: string + description: First or given name that belongs to the MongoDB Cloud user. + lastName: + type: string + description: Last name, family name, or surname that belongs to the MongoDB + Cloud user. + userId: + type: string + description: Unique 24-hexadecimal digit string that identifies this user. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + required: + - emailAddress + - federationSettingsId + - firstName + - lastName + title: Federated User + FederationIdentityProvider: + type: object + properties: + acsUrl: + type: string + description: URL that points to where to send the SAML response. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + associatedOrgs: + type: array + description: List that contains the connected organization configurations + associated with the identity provider. + items: + $ref: "#/components/schemas/ConnectedOrgConfig" + uniqueItems: true + audienceUri: + type: string + description: Unique string that identifies the intended audience of the SAML + assertion. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion. + oktaIdpId: + type: string + description: Unique 20-hexadecimal digit string that identifies the identity + provider. + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + pemFileInfo: + $ref: "#/components/schemas/PemFileInfo" + requestBinding: + type: string + description: SAML Authentication Request Protocol HTTP method binding (POST or + REDIRECT) that Federated Authentication uses to send the + authentication request. + responseSignatureAlgorithm: + type: string + description: Signature algorithm that Federated Authentication uses to encrypt + the identity provider signature. + ssoDebugEnabled: + type: boolean + description: Flag that indicates whether the identity provider has SSO debug + enabled. + ssoUrl: + type: string + description: URL that points to the receiver of the SAML authentication request. + status: + type: string + description: String enum that indicates whether the identity provider is active. + required: + - oktaIdpId + FieldTransformation: + type: object + description: Field Transformations during ingestion of a Data Lake Pipeline. + properties: + field: + type: string + description: Key in the document. + type: + type: string + description: Type of transformation applied during the export of the namespace + in a Data Lake Pipeline. + title: Field Transformation + GCPConsumerForwardingRule: + type: object + properties: + endpointName: + type: string + description: Human-readable label that identifies the Google Cloud consumer + forwarding rule that you created. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + readOnly: true + ipAddress: + type: string + description: One Private Internet Protocol version 4 (IPv4) address to which + this Google Cloud consumer forwarding rule resolves. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + status: + type: string + description: State of the MongoDB Cloud endpoint group when MongoDB Cloud + received this request. + readOnly: true + GeoSharding: + type: object + properties: + customZoneMapping: + type: object + additionalProperties: + type: string + description: >- + List that contains comma-separated key value pairs to map zones to + geographic regions. These pairs map an ISO 3166-1a2 location code, + with an ISO 3166-2 subdivision code when possible, to a unique + 24-hexadecimal string that identifies the custom zone. + + + This parameter returns an empty object if no custom zones exist. + readOnly: true + description: >- + List that contains comma-separated key value pairs to map zones to + geographic regions. These pairs map an ISO 3166-1a2 location code, + with an ISO 3166-2 subdivision code when possible, to a unique + 24-hexadecimal string that identifies the custom zone. + + + This parameter returns an empty object if no custom zones exist. + readOnly: true + managedNamespaces: + type: array + description: List that contains a namespace for a Global Cluster. MongoDB Cloud + manages this cluster. + items: + $ref: "#/components/schemas/ManagedNamespaces" + readOnly: true + GoogleCloudKMS: + type: object + description: Details that define the configuration of Encryption at Rest using + Google Cloud Key Management Service (KMS). + externalDocs: + description: Google Cloud Key Management Service + url: https://www.mongodb.com/docs/atlas/security-gcp-kms/ + properties: + enabled: + type: boolean + description: Flag that indicates whether someone enabled encryption at rest for + the specified project. To disable encryption at rest using customer + key management and remove the configuration details, pass only this + parameter with a value of `false`. + keyVersionResourceID: + type: string + description: Resource path that displays the key version resource ID for your + Google Cloud KMS. + example: projects/my-project-common-0/locations/us-east4/keyRings/my-key-ring-0/cryptoKeys/my-key-0/cryptoKeyVersions/1 + serviceAccountKey: + type: string + description: JavaScript Object Notation (JSON) object that contains the Google + Cloud Key Management Service (KMS). Format the JSON as a string and + not as an object. + externalDocs: + description: Google Cloud Authentication + url: https://cloud.google.com/docs/authentication/getting-started + writeOnly: true + valid: + type: boolean + description: Flag that indicates whether the Google Cloud Key Management Service + (KMS) encryption key can encrypt and decrypt data. + readOnly: true + GreaterThanRawThreshold: + type: object + description: A Limit that triggers an alert when greater than a number. + properties: + operator: + type: string + description: Comparison operator to apply when checking the current metric value. + threshold: + type: integer + format: int32 + description: Value of metric that, when exceeded, triggers an alert. + units: + $ref: "#/components/schemas/RawMetricUnits" + title: Greater Than Raw Threshold + Group: + type: object + properties: + clusterCount: + type: integer + format: int64 + description: Quantity of MongoDB Cloud clusters deployed in this project. + readOnly: true + created: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this project. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + name: + type: string + description: Human-readable label that identifies the project included in the + MongoDB Cloud organization. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud organization to which the project belongs. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + regionUsageRestrictions: + type: string + default: NONE + description: Region usage restrictions that designate the project's AWS region. + withDefaultAlertsSettings: + type: boolean + description: Flag that indicates whether to create the project with default + alert settings. + writeOnly: true + required: + - clusterCount + - created + - name + - orgId + GroupAlertsConfig: + type: object + properties: + created: + type: string + format: date-time + description: Date and time when MongoDB Cloud created the alert configuration. + This parameter expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + enabled: + type: boolean + default: false + description: Flag that indicates whether someone enabled this alert + configuration for the specified project. + eventTypeName: + $ref: "#/components/schemas/ServerlessEventTypeViewAlertable" + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + owns this alert configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this alert + configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + matchers: + type: array + description: >- + No matchers are available for these alert types. The list is always + empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. + + + Alternatively: + + No matchers are available for these alert types. The list is always empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. + + + Alternatively: + + No matchers are available for these alert types. The list is always empty. + + + Alternatively: + + No matchers are available for these alert types. The list is always empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. + + + Alternatively: + + No matchers are available for these alert types. The list is always empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. + + + Alternatively: + + No matchers are available for these alert types. The list is always empty. + items: + type: object + readOnly: true + notifications: + type: array + description: List that contains the targets that MongoDB Cloud sends + notifications. + items: + $ref: "#/components/schemas/AlertsNotificationRootForGroup" + updated: + type: string + format: date-time + description: Date and time when someone last updated this alert configuration. + This parameter expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + metricThreshold: + $ref: "#/components/schemas/ServerlessMetricThreshold" + threshold: + $ref: "#/components/schemas/GreaterThanRawThreshold" + GroupInvitation: + type: object + properties: + createdAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud sent the invitation. This + parameter expresses its value in ISO 8601 format in UTC. + readOnly: true + expiresAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud expires the invitation. This + parameter expresses its value in ISO 8601 format in UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + groupName: + type: string + description: Human-readable label that identifies the project to which you + invited the MongoDB Cloud user. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal character string that identifies the + invitation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + inviterUsername: + type: string + format: email + description: Email address of the MongoDB Cloud user who sent the invitation. + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + roles: + type: array + description: One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + username: + type: string + format: email + description: Email address of the MongoDB Cloud user invited to join the project. + readOnly: true + GroupInvitationRequest: + type: object + properties: + roles: + type: array + description: One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + username: + type: string + format: email + description: Email address of the MongoDB Cloud user invited to the specified + project. + GroupInvitationUpdateRequest: + type: object + properties: + roles: + type: array + description: One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + GroupMaintenanceWindow: + type: object + properties: + autoDeferOnceEnabled: + type: boolean + description: Flag that indicates whether MongoDB Cloud should defer all + maintenance windows for one week after you enable them. + dayOfWeek: + type: integer + format: int32 + description: > + One-based integer that represents the day of the week that the + maintenance window starts. + + + | Value | Day of Week | + + |---|---| + + | `1` | Sunday | + + | `2` | Monday | + + | `3` | Tuesday | + + | `4` | Wednesday | + + | `5` | Thursday | + + | `6` | Friday | + + | `7` | Saturday | + maximum: 7 + minimum: 1 + hourOfDay: + type: integer + format: int32 + description: Zero-based integer that represents the hour of the of the day that + the maintenance window starts according to a 24-hour clock. Use `0` + for midnight and `12` for noon. + maximum: 23 + minimum: 0 + startASAP: + type: boolean + description: Flag that indicates whether MongoDB Cloud starts the maintenance + window immediately upon receiving this request. To start the + maintenance window immediately for your project, MongoDB Cloud must + have maintenance scheduled and you must set a maintenance window. + This flag resets to `false` after MongoDB Cloud completes + maintenance. + required: + - dayOfWeek + - hourOfDay + GroupName: + type: object + description: Request view to update the group name. + properties: + name: + type: string + description: Human-readable label that identifies the project included in the + MongoDB Cloud organization. + GroupSettings: + type: object + description: Collection of settings that configures the project. + properties: + isCollectDatabaseSpecificsStatisticsEnabled: + type: boolean + description: Flag that indicates whether to collect database-specific + metrics for the specified project. + isDataExplorerEnabled: + type: boolean + description: Flag that indicates whether to enable the Data Explorer for the + specified project. + isExtendedStorageSizesEnabled: + type: boolean + description: Flag that indicates whether to enable extended storage sizes for + the specified project. + isPerformanceAdvisorEnabled: + type: boolean + description: Flag that indicates whether to enable the Performance Advisor and + Profiler for the specified project. + isRealtimePerformancePanelEnabled: + type: boolean + description: Flag that indicates whether to enable the Real Time Performance + Panel for the specified project. + isSchemaAdvisorEnabled: + type: boolean + description: Flag that indicates whether to enable the Schema Advisor for the + specified project. + HardwareSpec: + type: object + description: Hardware specifications for all electable nodes deployed in the + region. Electable nodes can become the primary and can enable local + reads. If you don't specify this option, MongoDB Cloud deploys no + electable nodes to the region. + properties: + diskIOPS: + type: integer + format: int32 + description: >- + Target throughput desired for storage attached to your + AWS-provisioned cluster. Change this parameter only if you: + + + - set `"replicationSpecs[n].regionConfigs[m].providerName" : "AWS"`. + + - set `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" : "M30"` or greater not including `Mxx_NVME` tiers. + + + The maximum input/output operations per second (IOPS) depend on the selected **.instanceSize** and **.diskSizeGB**. + + This parameter defaults to the cluster tier's standard IOPS value. + + Changing this value impacts cluster cost. + + MongoDB Cloud enforces minimum ratios of storage capacity to system memory for given cluster tiers. This keeps cluster performance consistent with large datasets. + + + - Instance sizes `M10` to `M40` have a ratio of disk capacity to system memory of 60:1. + + - Instance sizes greater than `M40` have a ratio of 120:1. + ebsVolumeType: + type: string + default: STANDARD + description: >- + Type of storage you want to attach to your AWS-provisioned cluster. + + + - `STANDARD` volume types can't exceed the default input/output operations per second (IOPS) rate for the selected volume size. + + + - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. + instanceSize: + type: string + description: Hardware specification for the instance sizes in this region. Each + instance size has a default storage and memory capacity. The + instance size you select applies to all the data-bearing hosts in + your instance size. + title: Tenant Instance Sizes + nodeCount: + type: integer + format: int32 + description: Number of nodes of the given type for MongoDB Cloud to deploy to + the region. + IndexOptions: + type: object + description: One or more settings that determine how the MongoDB Cloud creates + this MongoDB index. + externalDocs: + description: Index Options + url: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options + properties: + 2dsphereIndexVersion: + type: integer + format: int32 + default: 3 + description: Index version number applied to the 2dsphere index. MongoDB 3.2 and + later use version 3. Use this option to override the default version + number. This option applies to the **2dsphere** index type only. + background: + type: boolean + default: false + description: Flag that indicates whether MongoDB should build the index in the + background. This applies to MongoDB databases running feature + compatibility version 4.0 or earlier. MongoDB databases running FCV + 4.2 or later build indexes using an optimized build process. This + process holds the exclusive lock only at the beginning and end of + the build process. The rest of the build process yields to + interleaving read and write operations. MongoDB databases running + FCV 4.2 or later ignore this option. This option applies to all + index types. + bits: + type: integer + format: int32 + default: 26 + description: Number of precision applied to the stored geohash value of the + location data. This option applies to the **2d** index type only. + bucketSize: + type: integer + format: int32 + description: >- + Number of units within which to group the location values. You could + group in the same bucket those location values within the specified + number of units to each other. This option applies to the + geoHaystack index type only. + + + MongoDB 5.0 removed geoHaystack Indexes and the `geoSearch` command. + columnstoreProjection: + type: object + additionalProperties: + type: integer + format: int32 + description: >- + The columnstoreProjection document allows to include or exclude + subschemas schema. One cannot combine inclusion and exclusion + statements. Accordingly, the can be either of the + following: + + 1 or true to include the field and recursively all fields it is a prefix of in the index + + 0 or false to exclude the field and recursively all fields it is a prefix of from the index. + description: >- + The columnstoreProjection document allows to include or exclude + subschemas schema. One cannot combine inclusion and exclusion + statements. Accordingly, the can be either of the following: + + 1 or true to include the field and recursively all fields it is a prefix of in the index + + 0 or false to exclude the field and recursively all fields it is a prefix of from the index. + default_language: + type: string + default: english + description: Human language that determines the list of stop words and the rules + for the stemmer and tokenizer. This option accepts the supported + languages using its name in lowercase english or the ISO 639-2 code. + If you set this parameter to `"none"`, then the text search uses + simple tokenization with no list of stop words and no stemming. This + option applies to the **text** index type only. + expireAfterSeconds: + type: integer + format: int32 + description: Number of seconds that MongoDB retains documents in a Time To Live + (TTL) index. + hidden: + type: boolean + default: false + description: Flag that determines whether the index is hidden from the query + planner. A hidden index is not evaluated as part of the query plan + selection. + language_override: + type: string + default: language + description: Human-readable label that identifies the document parameter that + contains the override language for the document. This option applies + to the **text** index type only. + max: + type: integer + format: int32 + default: 180 + description: Upper inclusive boundary to limit the longitude and latitude + values. This option applies to the 2d index type only. + min: + type: integer + format: int32 + default: -180 + description: Lower inclusive boundary to limit the longitude and latitude + values. This option applies to the 2d index type only. + name: + type: string + description: Human-readable label that identifies this index. This option + applies to all index types. + partialFilterExpression: + type: object + additionalProperties: + description: >- + Rules that limit the documents that the index references to a + filter expression. All MongoDB index types accept a + **partialFilterExpression** option. **partialFilterExpression** + can include following expressions: + + + - equality (`"parameter" : "value"` or using the `$eq` operator) + + - `"$exists": true` + + , maximum: `$gt`, `$gte`, `$lt`, `$lte` comparisons + + - `$type` + + - `$and` (top-level only) + This option applies to all index types. + description: >- + Rules that limit the documents that the index references to a filter + expression. All MongoDB index types accept a + **partialFilterExpression** option. **partialFilterExpression** can + include following expressions: + + + - equality (`"parameter" : "value"` or using the `$eq` operator) + + - `"$exists": true` + + , maximum: `$gt`, `$gte`, `$lt`, `$lte` comparisons + + - `$type` + + - `$and` (top-level only) + This option applies to all index types. + sparse: + type: boolean + default: false + description: >- + Flag that indicates whether the index references documents that only + have the specified parameter. These indexes use less space but + behave differently in some situations like when sorting. The + following index types default to sparse and ignore this option: + `2dsphere`, `2d`, `geoHaystack`, `text`. + + + Compound indexes that includes one or more indexes with `2dsphere` keys alongside other key types, only the `2dsphere` index parameters determine which documents the index references. If you run MongoDB 3.2 or later, use partial indexes. This option applies to all index types. + storageEngine: + type: object + additionalProperties: + description: 'Storage engine set for the specific index. This value can be set + only at creation. This option uses the following format: + `"storageEngine" : { "" : "" }` + MongoDB validates storage engine configuration options when + creating indexes. To support replica sets with members with + different storage engines, MongoDB logs these options to the oplog + during replication. This option applies to all index types.' + externalDocs: + description: MongoDB Server Storage Engines + url: https://docs.mongodb.com/manual/core/storage-engines/ + description: 'Storage engine set for the specific index. This value can be set + only at creation. This option uses the following format: + `"storageEngine" : { "" : "" }` + MongoDB validates storage engine configuration options when creating + indexes. To support replica sets with members with different storage + engines, MongoDB logs these options to the oplog during replication. + This option applies to all index types.' + externalDocs: + description: MongoDB Server Storage Engines + url: https://docs.mongodb.com/manual/core/storage-engines/ + textIndexVersion: + type: integer + format: int32 + default: 3 + description: Version applied to this text index. MongoDB 3.2 and later use + version `3`. Use this option to override the default version number. + This option applies to the **text** index type only. + unique: + type: boolean + default: false + description: "Flag that indicates whether this index can accept insertion or + update of documents when the index key value matches an existing + index key value. Set `\"unique\" : true` to set this index as + unique. You can't set a hashed index to be unique. This option + applies to all index types. This option is unsupported for rolling + indexes." + weights: + type: object + additionalProperties: + description: Relative importance to place upon provided index parameters. This + object expresses this as key/value pairs of index parameter and + weight to apply to that parameter. You can specify weights for + some or all the indexed parameters. The weight must be an integer + between 1 and 99,999. MongoDB 5.0 and later can apply **weights** + to **text** indexes only. + description: Relative importance to place upon provided index parameters. This + object expresses this as key/value pairs of index parameter and + weight to apply to that parameter. You can specify weights for some + or all the indexed parameters. The weight must be an integer between + 1 and 99,999. MongoDB 5.0 and later can apply **weights** to + **text** indexes only. + writeOnly: true + IngestionPipelineRun: + type: object + description: Run details of a Data Lake Pipeline. + properties: + _id: + type: string + description: Unique 24-hexadecimal character string that identifies a Data Lake + Pipeline run. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + backupFrequencyType: + type: string + description: Backup schedule interval of the Data Lake Pipeline. + readOnly: true + createdDate: + type: string + format: date-time + description: Timestamp that indicates when the pipeline run was created. + readOnly: true + datasetName: + type: string + description: Human-readable label that identifies the dataset that Atlas + generates during this pipeline run. You can use this dataset as a + `dataSource` in a Federated Database collection. + example: v1$atlas$snapshot$Cluster0$myDatabase$myCollection$19700101T000000Z + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lastUpdatedDate: + type: string + format: date-time + description: Timestamp that indicates the last time that the pipeline run was + updated. + readOnly: true + phase: + type: string + description: Processing phase of the Data Lake Pipeline. + readOnly: true + pipelineId: + type: string + description: Unique 24-hexadecimal character string that identifies a Data Lake + Pipeline. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot + of a cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + state: + type: string + description: State of the pipeline run. + readOnly: true + stats: + $ref: "#/components/schemas/PipelineRunStats" + title: Data Lake Pipeline Run + IngestionSink: + type: object + description: Ingestion destination of a Data Lake Pipeline. + properties: + type: + type: string + description: Type of ingestion destination of this Data Lake Pipeline. + readOnly: true + metadataProvider: + type: string + description: Target cloud provider for this Data Lake Pipeline. + metadataRegion: + type: string + description: Target cloud provider region for this Data Lake Pipeline. + externalDocs: + description: Supported cloud provider regions + url: https://www.mongodb.com/docs/datalake/limitations + partitionFields: + type: array + description: Ordered fields used to physically organize data in the destination. + items: + $ref: "#/components/schemas/DataLakePipelinesPartitionField" + title: Ingestion Destination + IngestionSource: + type: object + description: Ingestion Source of a Data Lake Pipeline. + properties: + type: + type: string + description: Type of ingestion source of this Data Lake Pipeline. + clusterName: + type: string + description: Human-readable name that identifies the cluster. + collectionName: + type: string + description: Human-readable name that identifies the collection. + databaseName: + type: string + description: Human-readable name that identifies the database. + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + policyItemId: + type: string + description: Unique 24-hexadecimal character string that identifies a policy item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + title: Ingestion Source + InvoiceLineItem: + type: object + description: One service included in this invoice. + properties: + clusterName: + type: string + description: Human-readable label that identifies the cluster that incurred the + charge. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + created: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this line item. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + discountCents: + type: integer + format: int64 + description: Sum by which MongoDB discounted this line item. MongoDB Cloud + expresses this value in cents (100ths of one US Dollar). The + resource returns this parameter when a discount applies. + readOnly: true + endDate: + type: string + format: date-time + description: Date and time when when MongoDB Cloud finished charging for this + line item. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project + associated to this line item. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + groupName: + type: string + description: Human-readable label that identifies the project. + note: + type: string + description: Comment that applies to this line item. + readOnly: true + percentDiscount: + type: number + format: float + description: Percentage by which MongoDB discounted this line item. The resource + returns this parameter when a discount applies. + readOnly: true + quantity: + type: number + format: double + description: Number of units included for the line item. These can be + expressions of storage (GB), time (hours), or other units. + readOnly: true + sku: + type: string + description: Human-readable description of the service that this line item + provided. This Stock Keeping Unit (SKU) could be the instance type, + a support charge, advanced security, or another service. + readOnly: true + startDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud began charging for this line item. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + stitchAppName: + type: string + description: Human-readable label that identifies the Atlas App Services + application associated with this line item. + externalDocs: + description: Create a new Atlas App Service + url: https://www.mongodb.com/docs/atlas/app-services/manage-apps/create/create-with-ui/ + readOnly: true + tags: + type: object + additionalProperties: + type: array + description: A map of key-value pairs corresponding to the tags associated with + the line item resource. + items: + type: string + description: A map of key-value pairs corresponding to the tags associated with + the line item resource. + readOnly: true + readOnly: true + description: A map of key-value pairs corresponding to the tags associated with + the line item resource. + readOnly: true + tierLowerBound: + type: number + format: double + description: >- + Lower bound for usage amount range in current SKU tier. + + + **NOTE**: **lineItems[n].tierLowerBound** appears only if your **lineItems[n].sku** is tiered. + readOnly: true + tierUpperBound: + type: number + format: double + description: >- + Upper bound for usage amount range in current SKU tier. + + + **NOTE**: **lineItems[n].tierUpperBound** appears only if your **lineItems[n].sku** is tiered. + readOnly: true + totalPriceCents: + type: integer + format: int64 + description: Sum of the cost set for this line item. MongoDB Cloud expresses + this value in cents (100ths of one US Dollar) and calculates this + value as **unitPriceDollars** × **quantity** × 100. + readOnly: true + unit: + type: string + description: Element used to express what **quantity** this line item measures. + This value can be elements of time, storage capacity, and the like. + readOnly: true + unitPriceDollars: + type: number + format: double + description: Value per **unit** for this line item expressed in US Dollars. + readOnly: true + title: Line Item + LDAPSecuritySettings: + type: object + description: Lightweight Directory Access Protocol (LDAP) over Transport Layer + Security (TLS) configuration details that apply to the specified + project. + properties: + authenticationEnabled: + type: boolean + description: Flag that indicates whether users can authenticate using an + Lightweight Directory Access Protocol (LDAP) host. + authorizationEnabled: + type: boolean + description: Flag that indicates whether users can authorize access to MongoDB + Cloud resources using an Lightweight Directory Access Protocol + (LDAP) host. + authzQueryTemplate: + type: string + default: "{USER}?memberOf?base" + description: Lightweight Directory Access Protocol (LDAP) query template that + MongoDB Cloud runs to obtain the LDAP groups associated with the + authenticated user. MongoDB Cloud uses this parameter only for user + authorization. Use the `{USER}` placeholder in the Uniform Resource + Locator (URL) to substitute the authenticated username. The query + relates to the host specified with the hostname. Format this query + according to [RFC 4515](https://tools.ietf.org/search/rfc4515) and + [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). + example: "{USER}?memberOf?base" + bindPassword: + type: string + description: Password that MongoDB Cloud uses to authenticate the + **bindUsername**. + writeOnly: true + bindUsername: + type: string + description: Full Distinguished Name (DN) of the Lightweight Directory Access + Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP + host. LDAP distinguished names must be formatted according to RFC + 2253. + example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + externalDocs: + description: RFC 2253 + url: https://tools.ietf.org/html/2253 + pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + caCertificate: + type: string + description: 'Certificate Authority (CA) certificate that MongoDB Cloud uses to + verify the identity of the Lightweight Directory Access Protocol + (LDAP) host. MongoDB Cloud allows self-signed certificates. To + delete an assigned value, pass an empty string: `"caCertificate": + ""`.' + hostname: + type: string + description: Human-readable label that identifies the hostname or Internet + Protocol (IP) address of the Lightweight Directory Access Protocol + (LDAP) host. This host must have access to the internet or have a + Virtual Private Cloud (VPC) peering connection to your cluster. + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + port: + type: integer + format: int32 + default: 636 + description: Port to which the Lightweight Directory Access Protocol (LDAP) host + listens for client connections. + userToDNMapping: + type: array + description: User-to-Distinguished Name (DN) map that MongoDB Cloud uses to + transform a Lightweight Directory Access Protocol (LDAP) username + into an LDAP DN. + items: + $ref: "#/components/schemas/UserToDNMapping" + title: LDAP Security Settings + LDAPVerifyConnectivityJobRequest: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project + associated with this Lightweight Directory Access Protocol (LDAP) + over Transport Layer Security (TLS) configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + request: + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequestParams" + requestId: + type: string + description: Unique 24-hexadecimal digit string that identifies this request to + verify an Lightweight Directory Access Protocol (LDAP) + configuration. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + status: + type: string + description: Human-readable string that indicates the status of the Lightweight + Directory Access Protocol (LDAP) over Transport Layer Security (TLS) + configuration. + readOnly: true + validations: + type: array + description: List that contains the validation messages related to the + verification of the provided Lightweight Directory Access Protocol + (LDAP) over Transport Layer Security (TLS) configuration details. + The list contains a document for each test that MongoDB Cloud runs. + MongoDB Cloud stops running tests after the first failure. + items: + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequestValidation" + readOnly: true + LDAPVerifyConnectivityJobRequestParams: + type: object + description: Request information needed to verify an Lightweight Directory + Access Protocol (LDAP) over Transport Layer Security (TLS) + configuration. The response does not return the **bindPassword**. + properties: + authzQueryTemplate: + type: string + default: "{USER}?memberOf?base" + description: >- + Lightweight Directory Access Protocol (LDAP) query template that + MongoDB Cloud applies to create an LDAP query to return the LDAP + groups associated with the authenticated MongoDB user. MongoDB Cloud + uses this parameter only for user authorization. + + + Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query per [RFC 4515](https://tools.ietf.org/search/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). + example: "{USER}?memberOf?base" + writeOnly: true + bindPassword: + type: string + description: Password that MongoDB Cloud uses to authenticate the + **bindUsername**. + writeOnly: true + bindUsername: + type: string + description: Full Distinguished Name (DN) of the Lightweight Directory Access + Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP + host. LDAP distinguished names must be formatted according to RFC + 2253. + example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + externalDocs: + description: RFC 2253 + url: https://tools.ietf.org/html/2253 + pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + caCertificate: + type: string + description: 'Certificate Authority (CA) certificate that MongoDB Cloud uses to + verify the identity of the Lightweight Directory Access Protocol + (LDAP) host. MongoDB Cloud allows self-signed certificates. To + delete an assigned value, pass an empty string: `"caCertificate": + ""`.' + hostname: + type: string + description: Human-readable label that identifies the hostname or Internet + Protocol (IP) address of the Lightweight Directory Access Protocol + (LDAP) host. This host must have access to the internet or have a + Virtual Private Cloud (VPC) peering connection to your cluster. + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + port: + type: integer + format: int32 + default: 636 + description: IANA port to which the Lightweight Directory Access Protocol (LDAP) + host listens for client connections. + required: + - bindPassword + - bindUsername + - hostname + - port + LDAPVerifyConnectivityJobRequestValidation: + type: object + description: One test that MongoDB Cloud runs to test verification of the + provided Lightweight Directory Access Protocol (LDAP) over Transport + Layer Security (TLS) configuration details. + properties: + status: + type: string + description: Human-readable string that indicates the result of this + verification test. + readOnly: true + validationType: + type: string + description: Human-readable label that identifies this verification test that + MongoDB Cloud runs. + readOnly: true + readOnly: true + LegacyAtlasCluster: + type: object + description: Group of settings that configure a MongoDB cluster. + properties: + acceptDataRisksAndForceReplicaSetReconfig: + type: string + format: date-time + description: If reconfiguration is necessary to regain a primary due to a + regional outage, submit this field alongside your topology + reconfiguration to request a new regional outage resistant topology. + Forced reconfigurations during an outage of the majority of + electable nodes carry a risk of data loss if replicated writes (even + majority committed writes) have not been replicated to the new + primary node. MongoDB Atlas docs contain more information. To + proceed with an operation which carries that risk, set + **acceptDataRisksAndForceReplicaSetReconfig** to the current date. + externalDocs: + description: Reconfiguring a Replica Set during a regional outage + url: https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set + autoScaling: + $ref: "#/components/schemas/ClusterAutoScalingSettings" + backupEnabled: + type: boolean + description: Flag that indicates whether the cluster can perform backups. If set + to `true`, the cluster can perform backups. You must set this value + to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated + clusters and Shared Cluster Backups for tenant clusters. If set to + `false`, the cluster doesn't use MongoDB Cloud backups. + biConnector: + $ref: "#/components/schemas/BiConnector" + clusterType: + type: string + description: Configuration of nodes that comprise the cluster. + connectionStrings: + $ref: "#/components/schemas/ClusterConnectionStrings" + createDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this serverless instance. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + diskSizeGB: + type: number + format: double + description: Storage capacity that the host's root volume possesses expressed in + gigabytes. Increase this number to add capacity. MongoDB Cloud + requires this parameter if you set **replicationSpecs**. If you + specify a disk size below the minimum (10 GB), this parameter + defaults to the minimum disk size value. Storage charge calculations + depend on whether you choose the default value or a custom + value. The maximum value for disk storage cannot exceed 50 times + the maximum RAM for the selected cluster. If you require more + storage space, consider upgrading your cluster to a higher tier. + maximum: 4096 + minimum: 10 + encryptionAtRestProvider: + type: string + description: Cloud service provider that manages your customer keys to provide + an additional layer of Encryption at Rest for the cluster. + externalDocs: + description: Encryption at Rest using Customer Key Management + url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + labels: + type: array + description: >- + Collection of key-value pairs between 1 to 255 characters in length + that tag and categorize the cluster. The MongoDB Cloud console + doesn't display your labels. + + + Cluster labels will be deprecated in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. + items: + $ref: "#/components/schemas/ComponentLabel" + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mongoDBMajorVersion: + type: string + default: "6.0" + description: Major MongoDB version of the cluster. MongoDB Cloud deploys the + cluster with the latest stable release of the specified version. + mongoDBVersion: + type: string + description: Version of MongoDB that the cluster runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + mongoURI: + type: string + description: Base connection string that you can use to connect to the cluster. + MongoDB Cloud displays the string only after the cluster starts, not + while it builds the cluster. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + mongoURIUpdated: + type: string + format: date-time + description: Date and time when someone last updated the connection string. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + mongoURIWithOptions: + type: string + description: Connection string that you can use to connect to the cluster + including the `replicaSet`, `ssl`, and `authSource` query parameters + with values appropriate for the cluster. You may need to add MongoDB + database users. The response returns this parameter once the cluster + can receive requests, not while it builds the cluster. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + name: + type: string + description: Human-readable label that identifies the cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + numShards: + type: integer + format: int32 + default: 1 + description: Number of shards up to 50 to deploy for a sharded cluster. The + resource returns `1` to indicate a replica set and values of `2` and + higher to indicate a sharded cluster. The returned value equals the + number of shards in the cluster. + externalDocs: + description: Sharding + url: https://docs.mongodb.com/manual/sharding/ + maximum: 50 + minimum: 1 + paused: + type: boolean + description: Flag that indicates whether the cluster is paused. + pitEnabled: + type: boolean + description: Flag that indicates whether the cluster uses continuous cloud + backups. + externalDocs: + description: Continuous Cloud Backups + url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ + providerBackupEnabled: + type: boolean + description: Flag that indicates whether the M10 or higher cluster can perform + Cloud Backups. If set to `true`, the cluster can perform backups. If + this and **backupEnabled** are set to `false`, the cluster doesn't + use MongoDB Cloud backups. + providerSettings: + $ref: "#/components/schemas/ClusterProviderSettings" + replicationFactor: + type: integer + format: int32 + default: 3 + deprecated: true + description: Number of members that belong to the replica set. Each member + retains a copy of your databases, providing high availability and + data redundancy. Use **replicationSpecs** instead. + replicationSpec: + type: object + additionalProperties: + $ref: "#/components/schemas/RegionSpec" + description: Physical location where MongoDB Cloud provisions cluster nodes. + title: Region Configuration + replicationSpecs: + type: array + description: >- + List of settings that configure your cluster regions. + + + - For Global Clusters, each object in the array represents one zone where MongoDB Cloud deploys your clusters nodes. + + - For non-Global sharded clusters and replica sets, the single object represents where MongoDB Cloud deploys your clusters nodes. + items: + $ref: "#/components/schemas/LegacyReplicationSpec" + rootCertType: + type: string + default: ISRGROOTX1 + description: Root Certificate Authority that MongoDB Atlas clusters uses. + MongoDB Cloud supports Internet Security Research Group. + srvAddress: + type: string + description: Connection string that you can use to connect to the cluster. The + `+srv` modifier forces the connection to use Transport Layer + Security (TLS). The `mongoURI` parameter lists additional options. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + stateName: + type: string + description: Human-readable label that indicates the current operating condition + of the cluster. + readOnly: true + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the cluster. + externalDocs: + description: Resource Tags + url: https://dochub.mongodb.org/core/add-cluster-tag-atlas + items: + $ref: "#/components/schemas/ResourceTag" + terminationProtectionEnabled: + type: boolean + default: false + description: Flag that indicates whether termination protection is enabled on + the cluster. If set to `true`, MongoDB Cloud won't delete the + cluster. If set to `false`, MongoDB Cloud will delete the cluster. + versionReleaseSystem: + type: string + default: LTS + description: Method by which the cluster maintains the MongoDB versions. If + value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. + title: Cluster Description + LegacyReplicationSpec: + type: object + properties: + id: + type: string + description: >- + Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a Global Cluster. + + + - If you include existing zones in the request, you must specify this parameter. + + + - If you add a new zone to an existing Global Cluster, you may specify this parameter. The request deletes any existing zones in a Global Cluster that you exclude from the request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + numShards: + type: integer + format: int32 + default: 1 + description: Positive integer that specifies the number of shards to deploy in + each specified zone If you set this value to `1` and **clusterType** + is `SHARDED`, MongoDB Cloud deploys a single-shard sharded cluster. + Don't create a sharded cluster with a single shard for production + environments. Single-shard sharded clusters don't provide the same + benefits as multi-shard configurations. + regionsConfig: + type: object + additionalProperties: + $ref: "#/components/schemas/RegionSpec" + description: Physical location where MongoDB Cloud provisions cluster nodes. + title: Region Configuration + zoneName: + type: string + description: Human-readable label that identifies the zone in a Global Cluster. + Provide this value only if **clusterType** is `GEOSHARDED`. + Link: + type: object + properties: + href: + type: string + description: Uniform Resource Locator (URL) that points another API resource to + which this response has some relationship. This URL often begins + with `https://cloud.mongodb.com/api/atlas`. + example: https://cloud.mongodb.com/api/atlas + rel: + type: string + description: Uniform Resource Locator (URL) that defines the semantic + relationship between this resource and another API resource. This + URL often begins with `https://cloud.mongodb.com/api/atlas`. + example: self + Link_Atlas: + type: object + properties: + href: + type: string + description: Uniform Resource Locator (URL) that points another API resource to + which this response has some relationship. This URL often begins + with `https://cloud.mongodb.com/api/atlas`. + example: https://cloud.mongodb.com/api/atlas + rel: + type: string + description: Uniform Resource Locator (URL) that defines the semantic + relationship between this resource and another API resource. This + URL often begins with `https://cloud.mongodb.com/api/atlas`. + example: self + LiveImportAvailableProject: + type: object + properties: + deployments: + type: array + description: List of clusters that can be migrated to MongoDB Cloud. + items: + $ref: "#/components/schemas/AvailableClustersDeployment" + migrationHosts: + type: array + description: Hostname of MongoDB Agent list that you configured to perform a + migration. + items: + type: string + description: Hostname of MongoDB Agent that you configured to perform a + migration. + name: + type: string + description: Human-readable label that identifies this project. + maxLength: 64 + minLength: 1 + readOnly: true + projectId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project to + be migrated. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + required: + - name + - projectId + LiveImportValidation: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the validation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + errorMessage: + type: string + description: Reason why the validation job failed. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project to + validate. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + sourceGroupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the source + project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + status: + type: string + description: State of the specified validation job returned at the time of the + request. + readOnly: true + LiveMigrationRequest: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the migration + request. + example: 507f1f77bcf86cd799439011 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + destination: + $ref: "#/components/schemas/Destination" + dropEnabled: + type: boolean + description: Flag that indicates whether the migration process drops all + collections from the destination cluster before the migration + starts. + writeOnly: true + migrationHosts: + type: array + description: List of migration hosts used for this migration. + items: + type: string + example: vm001.example.com + maxItems: 1 + minItems: 1 + source: + $ref: "#/components/schemas/Source" + required: + - destination + - dropEnabled + - source + LiveMigrationResponse: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the migration job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + lagTimeSeconds: + type: integer + format: int64 + description: Replication lag between the source and destination clusters. Atlas + returns this setting only during an active migration, before the + cutover phase. + readOnly: true + migrationHosts: + type: array + description: List of hosts running MongoDB Agents. These Agents can transfer + your MongoDB data between one source and one target cluster. + items: + type: string + description: One host running a MongoDB Agent. This Agent can transfer your + MongoDB data between one source and one target cluster. + example: vm001.example.com + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + readOnly: true + readyForCutover: + type: boolean + description: Flag that indicates the migrated cluster can be cut over to MongoDB + Atlas. + readOnly: true + status: + type: string + description: > + Progress made in migrating one cluster to MongoDB Atlas. + + + | Status | Explanation | + + |----------|-------------| + + | NEW | Someone scheduled a local cluster migration to MongoDB Atlas. | + + | FAILED | The cluster migration to MongoDB Atlas failed. | + + | COMPLETE | The cluster migration to MongoDB Atlas succeeded. | + + | EXPIRED | MongoDB Atlas prepares to begin the cut over of the migrating cluster when source and target clusters have almost synchronized. If `"readyForCutover" : true`, this synchronization starts a timer of 120 hours. You can extend this timer. If the timer expires, MongoDB Atlas returns this status. | + + | WORKING | The cluster migration to MongoDB Atlas is performing one of the following tasks:
  • Preparing connections to source and target clusters
  • Replicating data from source to target
  • Verifying MongoDB Atlas connection settings
  • Stopping replication after the cut over
| + readOnly: true + ManagedNamespaces: + type: object + properties: + collection: + type: string + description: Human-readable label of the collection to manage for this Global + Cluster. + customShardKey: + type: string + description: Database parameter used to divide the *collection* into shards. + Global clusters require a compound shard key. This compound shard + key combines the location parameter and the user-selected custom + key. + readOnly: true + db: + type: string + description: Human-readable label of the database to manage for this Global + Cluster. + isCustomShardKeyHashed: + type: boolean + default: false + description: Flag that indicates whether someone hashed the custom shard key for + the specified collection. If you set this value to `false`, MongoDB + Cloud uses ranged sharding. + externalDocs: + description: Hashed Shard Keys + url: https://www.mongodb.com/docs/manual/reference/method/sh.shardCollection/#hashed-shard-keys + writeOnly: true + isShardKeyUnique: + type: boolean + default: false + description: Flag that indicates whether someone + [hashed](https://www.mongodb.com/docs/manual/reference/method/sh.shardCollection/#hashed-shard-keys) + the custom shard key. If this parameter returns `false`, this + cluster uses [ranged + sharding](https://www.mongodb.com/docs/manual/core/ranged-sharding/). + writeOnly: true + numInitialChunks: + type: integer + format: int64 + description: Minimum number of chunks to create initially when sharding an empty + collection with a [hashed shard + key](https://www.mongodb.com/docs/manual/core/hashed-sharding/). + externalDocs: + description: Global Cluster Sharding + url: https://www.mongodb.com/docs/atlas/shard-global-collection/ + maximum: 8192 + writeOnly: true + presplitHashedZones: + type: boolean + default: false + description: Flag that indicates whether MongoDB Cloud should create and + distribute initial chunks for an empty or non-existing collection. + MongoDB Cloud distributes data based on the defined zones and zone + ranges for the collection. + externalDocs: + description: Hashed Shard Key + url: https://www.mongodb.com/docs/manual/core/hashed-sharding/ + writeOnly: true + required: + - collection + - customShardKey + - db + MeasurementDiskPartition: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + partitionName: + type: string + description: Human-readable label of the disk or partition to which the + measurements apply. + readOnly: true + MeasurementsIndexes: + type: object + properties: + collectionName: + type: string + description: Human-readable label that identifies the collection. + readOnly: true + databaseName: + type: string + description: Human-readable label that identifies the database that the + specified MongoDB process serves. + readOnly: true + end: + type: string + format: date-time + description: Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + indexIds: + type: array + description: List that contains the Atlas Search index identifiers. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the index. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + indexStatsMeasurements: + type: array + description: List that contains the Atlas Search index stats measurements. + items: + $ref: "#/components/schemas/MetricsMeasurement" + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + processId: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + MeasurementsNonIndex: + type: object + properties: + end: + type: string + format: date-time + description: Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hardwareMeasurements: + type: array + description: List that contains the Atlas Search hardware measurements. + items: + $ref: "#/components/schemas/MetricsMeasurement" + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + processId: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + statusMeasurements: + type: array + description: List that contains the Atlas Search status measurements. + items: + $ref: "#/components/schemas/MetricsMeasurement" + readOnly: true + MesurementsDatabase: + type: object + properties: + databaseName: + type: string + description: Human-readable label that identifies the database that the + specified MongoDB process serves. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + MetricDataPoint: + type: object + description: value of, and metadata provided for, one data point generated at a + particular moment in time. If no data point exists for a particular + moment in time, the `value` parameter returns `null`. + properties: + timestamp: + type: string + format: date-time + description: Date and time when this data point occurred. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + value: + type: number + description: Value that comprises this data point. + readOnly: true + readOnly: true + MetricDataPoint_Atlas: + type: object + description: value of, and metadata provided for, one data point generated at a + particular moment in time. If no data point exists for a particular + moment in time, the `value` parameter returns `null`. + properties: + timestamp: + type: string + format: date-time + description: Date and time when this data point occurred. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + value: + type: number + description: Value that comprises this data point. + readOnly: true + readOnly: true + MetricsMeasurement: + type: object + properties: + dataPoints: + type: array + description: List that contains the value of, and metadata provided for, one + data point generated at a particular moment in time. If no data + point exists for a particular moment in time, the `value` parameter + returns `null`. + items: + $ref: "#/components/schemas/MetricDataPoint" + readOnly: true + name: + type: string + description: Human-readable label of the measurement that this data point covers. + readOnly: true + units: + type: string + description: Element used to quantify the measurement. The resource returns + units of throughput, storage, and time. + readOnly: true + MetricsMeasurement_Atlas: + type: object + properties: + dataPoints: + type: array + description: List that contains the value of, and metadata provided for, one + data point generated at a particular moment in time. If no data + point exists for a particular moment in time, the `value` parameter + returns `null`. + items: + $ref: "#/components/schemas/MetricDataPoint_Atlas" + readOnly: true + name: + type: string + description: Human-readable label of the measurement that this data point covers. + readOnly: true + units: + type: string + description: Element used to quantify the measurement. The resource returns + units of throughput, storage, and time. + readOnly: true + MongoDBAccessLogs: + type: object + description: Authentication attempt, one per object, made against the cluster. + properties: + authResult: + type: boolean + description: Flag that indicates whether the response should return successful + authentication attempts only. + authSource: + type: string + description: Database against which someone attempted to authenticate. + readOnly: true + failureReason: + type: string + description: Reason that the authentication failed. Null if authentication + succeeded. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostname: + type: string + description: Human-readable label that identifies the hostname of the target + node that received the authentication attempt. + readOnly: true + ipAddress: + type: string + description: Internet Protocol address that attempted to authenticate with the + database. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + logLine: + type: string + description: Text of the host log concerning the authentication attempt. + readOnly: true + timestamp: + type: string + description: Date and time when someone made this authentication attempt. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + username: + type: string + description: Username used to authenticate against the database. + readOnly: true + MongoDBAccessLogsList: + type: object + properties: + accessLogs: + type: array + description: Authentication attempt, one per object, made against the cluster. + items: + $ref: "#/components/schemas/MongoDBAccessLogs" + readOnly: true + NamespaceObj: + type: object + description: Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + properties: + namespace: + type: string + description: Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + readOnly: true + type: + type: string + default: collection + description: Human-readable label that identifies the type of namespace. + readOnly: true + readOnly: true + Namespaces: + type: object + properties: + namespaces: + type: array + description: List that contains each combination of database, collection, and + type on the specified host. + items: + $ref: "#/components/schemas/NamespaceObj" + readOnly: true + uniqueItems: true + NetworkPermissionEntry: + type: object + properties: + awsSecurityGroup: + type: string + description: Unique string of the Amazon Web Services (AWS) security group that + you want to add to the project's IP access list. Your IP access list + entry can be one **awsSecurityGroup**, one **cidrBlock**, or one + **ipAddress**. You must configure Virtual Private Connection (VPC) + peering for your project before you can add an AWS security group to + an IP access list. You cannot set AWS security groups as temporary + access list entries. Don't set this parameter if you set + **cidrBlock** or **ipAddress**. + pattern: ^([0-9]*\/)?sg-([0-9]*) + cidrBlock: + type: string + description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) + notation that you want to add to the project's IP access list. Your + IP access list entry can be one **awsSecurityGroup**, one + **cidrBlock**, or one **ipAddress**. Don't set this parameter if you + set **awsSecurityGroup** or **ipAddress**. + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + comment: + type: string + description: Remark that explains the purpose or scope of this IP access list + entry. + maxLength: 80 + deleteAfterDate: + type: string + format: date-time + description: Date and time after which MongoDB Cloud deletes the temporary + access list entry. This parameter expresses its value in the ISO + 8601 timestamp format in UTC and can include the time zone + designation. The date must be later than the current date but no + later than one week after you submit this request. The resource + returns this parameter if you specified an expiration date when + creating this IP access list entry. + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + contains the IP access list to which you want to add one or more + entries. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + ipAddress: + type: string + description: IP address that you want to add to the project's IP access list. + Your IP access list entry can be one **awsSecurityGroup**, one + **cidrBlock**, or one **ipAddress**. Don't set this parameter if you + set **awsSecurityGroup** or **cidrBlock**. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + NetworkPermissionEntryStatus: + type: object + properties: + STATUS: + type: string + description: > + State of the access list entry when MongoDB Cloud made this request. + + + | Status | Activity | + + |---|---| + + | `ACTIVE` | This access list entry applies to all relevant cloud providers. | + + | `PENDING` | MongoDB Cloud has started to add access list entry. This access list entry may not apply to all cloud providers at the time of this request. | + + | `FAILED` | MongoDB Cloud didn't succeed in adding this access list entry. | + readOnly: true + required: + - STATUS + NoBody: + type: object + description: Endpoint does not return a response body. + NumberMetricUnits: + type: string + description: Element used to express the quantity. This can be an element of + time, storage capacity, and the like. + example: COUNT + title: Number Metric Units + OnlineArchiveSchedule: + type: object + description: Regular frequency and duration when archiving process occurs. + properties: + type: + type: string + description: Type of schedule. + endHour: + type: integer + format: int32 + description: Hour of the day when the scheduled window to run one online archive + ends. + maximum: 23 + minimum: 0 + endMinute: + type: integer + format: int32 + description: Minute of the hour when the scheduled window to run one online + archive ends. + maximum: 59 + minimum: 0 + startHour: + type: integer + format: int32 + description: Hour of the day when the when the scheduled window to run one + online archive starts. + maximum: 23 + minimum: 0 + startMinute: + type: integer + format: int32 + description: Minute of the hour when the scheduled window to run one online + archive starts. + maximum: 59 + minimum: 0 + dayOfWeek: + type: integer + format: int32 + description: Day of the week when the scheduled archive starts. The week starts + with Monday (`1`) and ends with Sunday (`7`). + maximum: 7 + minimum: 1 + dayOfMonth: + type: integer + format: int32 + description: Day of the month when the scheduled archive starts. + maximum: 31 + minimum: 1 + required: + - type + title: Online Archive Schedule + Operator: + type: string + description: Comparison operator to apply when checking the current metric value. + OrgFederationSettings: + type: object + description: Details that define how to connect one MongoDB Cloud organization + to one federated authentication service. + properties: + federatedDomains: + type: array + description: List of domains associated with the organization's identity provider. + items: + type: string + uniqueItems: true + hasRoleMappings: + type: boolean + description: Flag that indicates whether this organization has role mappings + configured. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this federation. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + identityProviderId: + type: string + description: Unique 20-hexadecimal digit string that identifies the identity + provider connected to this organization. + example: c2777a9eca931f29fc2f + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + identityProviderStatus: + type: string + description: String enum that indicates whether the identity provider is active. + title: Organization Federation Settings + OrgGroup: + type: object + properties: + clusters: + type: array + description: Settings that describe the clusters in each project that the API + key is authorized to view. + items: + $ref: "#/components/schemas/CloudCluster" + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + groupName: + type: string + description: Human-readable label that identifies the project. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + orgId: + type: string + description: Unique 24-hexadecimal character string that identifies the + organization that contains the project. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgName: + type: string + description: Human-readable label that identifies the organization that contains + the project. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + planType: + type: string + description: Human-readable label that indicates the plan type. + readOnly: true + tags: + type: array + description: List of human-readable labels that categorize the specified + project. MongoDB Cloud returns an empty array. + items: + type: string + readOnly: true + readOnly: true + OrganizationInvitation: + type: object + properties: + createdAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud sent the invitation. MongoDB Cloud + represents this timestamp in ISO 8601 format in UTC. + readOnly: true + expiresAt: + type: string + format: date-time + description: Date and time when the invitation from MongoDB Cloud expires. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this organization. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + inviterUsername: + type: string + format: email + description: Email address of the MongoDB Cloud user who sent the invitation to + join the organization. + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgName: + type: string + description: Human-readable label that identifies this organization. + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + roles: + type: array + description: One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + teamIds: + type: array + description: List of unique 24-hexadecimal digit strings that identifies each + team. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + uniqueItems: true + username: + type: string + format: email + description: Email address of the MongoDB Cloud user invited to join the + organization. + required: + - orgName + OrganizationInvitationRequest: + type: object + properties: + roles: + type: array + description: One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + teamIds: + type: array + description: List of teams to which you want to invite the desired MongoDB Cloud + user. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + uniqueItems: true + username: + type: string + format: email + description: Email address that belongs to the desired MongoDB Cloud user. + OrganizationInvitationUpdateRequest: + type: object + properties: + roles: + type: array + description: One or more organization or project level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + teamIds: + type: array + description: List of teams to which you want to invite the desired MongoDB Cloud + user. + items: + type: string + description: Unique 24-hexadecimal digit string that identifies the team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + uniqueItems: true + OrganizationSettings: + type: object + description: Collection of settings that configures the organization. + properties: + apiAccessListRequired: + type: boolean + description: Flag that indicates whether to require API operations to originate + from an IP Address added to the API access list for the specified + organization. + multiFactorAuthRequired: + type: boolean + description: "Flag that indicates whether to require users to set up + Multi-Factor Authentication (MFA) before accessing the specified + organization. To learn more, see: + https://www.mongodb.com/docs/atlas/security-multi-factor-authentica\ + tion/." + restrictEmployeeAccess: + type: boolean + description: "Flag that indicates whether to block MongoDB Support from + accessing Atlas infrastructure for any deployment in the specified + organization without explicit permission. Once this setting is + turned on, you can grant MongoDB Support a 24-hour bypass access to + the Atlas deployment to resolve support issues. To learn more, see: + https://www.mongodb.com/docs/atlas/security-restrict-support-access\ + /." + PaginatedHostView_Atlas: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link_Atlas" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/ApiHostView_Atlas" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PemFileInfo: + type: object + description: PEM file information for the identity provider's certificates. + properties: + certificates: + type: array + items: + $ref: "#/components/schemas/X509Certificate" + fileName: + type: string + PerformanceAdvisorIndex: + type: object + properties: + avgObjSize: + type: number + format: double + description: The average size of an object in the collection of this index. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this index. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + impact: + type: array + description: List that contains unique 24-hexadecimal character string that + identifies the query shapes in this response that the Performance + Advisor suggests. + items: + type: string + description: One unique 24-hexadecimal character string that identifies one + query shape. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + index: + type: array + description: List that contains documents that specify a key in the index and + its sort order. + items: + type: object + additionalProperties: + type: integer + format: int32 + description: One index key paired with its sort order. A value of `1` indicates + an ascending sort order. A value of `-1` indicates a descending + sort order. Keys in indexes with multiple keys appear in the + same order that they appear in the index. + description: One index key paired with its sort order. A value of `1` indicates + an ascending sort order. A value of `-1` indicates a descending + sort order. Keys in indexes with multiple keys appear in the same + order that they appear in the index. + readOnly: true + namespace: + type: string + description: Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + readOnly: true + weight: + type: number + format: double + description: Estimated performance improvement that the suggested index + provides. This value corresponds to **Impact** in the Performance + Advisor user interface. + readOnly: true + PerformanceAdvisorOpStats: + type: object + description: Details that this resource returned about the specified query. + properties: + ms: + type: integer + format: int64 + description: Length of time expressed during which the query finds suggested + indexes among the managed namespaces in the cluster. This parameter + expresses its value in milliseconds. This parameter relates to the + **duration** query parameter. + readOnly: true + nReturned: + type: integer + format: int64 + description: Number of results that the query returns. + readOnly: true + nScanned: + type: integer + format: int64 + description: Number of documents that the query read. + readOnly: true + ts: + type: integer + format: int64 + description: Date and time from which the query retrieves the suggested indexes. + This parameter expresses its value in the number of seconds that + have elapsed since the [UNIX + epoch](https://en.wikipedia.org/wiki/Unix_time). This parameter + relates to the **since** query parameter. + readOnly: true + readOnly: true + PerformanceAdvisorResponse: + type: object + properties: + shapes: + type: array + description: List of query predicates, sorts, and projections that the + Performance Advisor suggests. + items: + $ref: "#/components/schemas/PerformanceAdvisorShape" + readOnly: true + suggestedIndexes: + type: array + description: List that contains the documents with information about the indexes + that the Performance Advisor suggests. + items: + $ref: "#/components/schemas/PerformanceAdvisorIndex" + readOnly: true + PerformanceAdvisorShape: + type: object + properties: + avgMs: + type: integer + format: int64 + description: Average duration in milliseconds for the queries examined that + match this shape. + readOnly: true + count: + type: integer + format: int64 + description: Number of queries examined that match this shape. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this shape. This + string exists only for the duration of this API request. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + inefficiencyScore: + type: integer + format: int64 + description: Average number of documents read for every document that the query + returns. + externalDocs: + description: Understanding the Query Inefficiency Score + url: https://www.mongodb.com/docs/atlas/performance-advisor/#std-label-query-inefficiency-score + readOnly: true + namespace: + type: string + description: Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + readOnly: true + operations: + type: array + description: List that contains specific about individual queries. + items: + $ref: "#/components/schemas/PerformanceAdvisorOperation" + readOnly: true + PerformanceAdvisorSlowQuery: + type: object + description: Details of one slow query that the Performance Advisor detected. + properties: + line: + type: string + description: Text of the MongoDB log related to this slow query. + readOnly: true + namespace: + type: string + description: Human-readable label that identifies the namespace on the specified + host. The resource expresses this parameter value as + `.`. + readOnly: true + readOnly: true + PerformanceAdvisorSlowQueryList: + type: object + properties: + slowQueries: + type: array + description: List of operations that the Performance Advisor detected that took + longer to execute than a specified threshold. + items: + $ref: "#/components/schemas/PerformanceAdvisorSlowQuery" + readOnly: true + PipelineRunStats: + type: object + description: Runtime statistics for this Data Lake Pipeline run. + properties: + bytesExported: + type: integer + format: int64 + description: Total data size in bytes exported for this pipeline run. + readOnly: true + numDocs: + type: integer + format: int64 + description: Number of docs ingested for a this pipeline run. + readOnly: true + readOnly: true + title: Data Lake Pipeline Run Statistics + PrivateLinkEndpoint: + type: object + properties: + cloudProvider: + type: string + description: Cloud service provider that serves the requested endpoint. + readOnly: true + deleteRequested: + type: boolean + description: Flag that indicates whether MongoDB Cloud received a request to + remove the specified private endpoint from the private endpoint + service. + readOnly: true + errorMessage: + type: string + description: Error message returned when requesting private connection resource. + The resource returns `null` if the request succeeded. + readOnly: true + connectionStatus: + type: string + description: State of the Amazon Web Service PrivateLink connection when MongoDB + Cloud received this request. + readOnly: true + interfaceEndpointId: + type: string + description: Unique 24-hexadecimal digit string that identifies the interface + endpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + endpointGroupName: + type: string + description: Human-readable label that identifies a set of endpoints. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + readOnly: true + endpoints: + type: array + description: List of individual private endpoints that comprise this endpoint + group. + externalDocs: + description: Google Cloud Forwarding Rule Concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + items: + $ref: "#/components/schemas/GCPConsumerForwardingRule" + readOnly: true + status: + type: string + description: >- + State of the Google Cloud network endpoint group when MongoDB Cloud + received this request. + + + Alternatively: + + State of the Azure Private Link Service connection when MongoDB Cloud received this request. + readOnly: true + privateEndpointConnectionName: + type: string + description: Human-readable label that MongoDB Cloud generates that identifies + the private endpoint connection. + pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]([-\w._()]+)%2[fF]([-\w._()]+) + readOnly: true + privateEndpointIPAddress: + type: string + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + privateEndpointResourceId: + type: string + description: Unique string that identifies the Azure private endpoint's network + interface that someone added to this private endpoint service. + example: /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln + readOnly: true + required: + - cloudProvider + PrivateNetworkEndpointIdEntry: + type: object + properties: + comment: + type: string + description: Human-readable string to associate with this private endpoint. + endpointId: + type: string + description: Unique 22-character alphanumeric string that identifies the private + endpoint. + example: vpce-3bf78b0ddee411ba1 + externalDocs: + description: Atlas Data Lake supports Amazon Web Services private endpoints + using the AWS PrivateLink feature. + url: https://aws.amazon.com/privatelink/?privatelink-blogs.sort-by=item.additionalFields.createdDate&privatelink-blogs.sort-order=desc + maxLength: 22 + minLength: 22 + pattern: ^vpce-[0-9a-f]{17}$ + provider: + type: string + default: AWS + description: Human-readable label that identifies the cloud service provider. + Atlas Data Lake supports Amazon Web Services only. + type: + type: string + default: DATA_LAKE + description: Human-readable label that identifies the resource type associated + with this private endpoint. + required: + - endpointId + PushBasedLogExportProject: + type: object + properties: + bucketName: + type: string + description: The name of the bucket to which the agent will send the logs to. + createDate: + type: string + format: date-time + description: Date and time that this feature was enabled on. + readOnly: true + iamRoleId: + type: string + description: ID of the AWS IAM role that will be used to write to the S3 bucket. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + prefixPath: + type: string + description: S3 directory in which vector will write to in order to store the + logs. + state: + type: string + description: Describes whether or not the feature is enabled and what status it + is in. + RawMetricUnits: + type: string + default: RAW + description: Element used to express the quantity. This can be an element of + time, storage capacity, and the like. + title: Raw Metric Units + RegionSpec: + type: object + description: Physical location where MongoDB Cloud provisions cluster nodes. + properties: + analyticsNodes: + type: integer + format: int32 + description: Number of analytics nodes in the region. Analytics nodes handle + analytic data such as reporting queries from MongoDB Connector for + Business Intelligence on MongoDB Cloud. Analytics nodes are + read-only, and can never become the primary. Use + **replicationSpecs[n].{region}.analyticsNodes** instead. + electableNodes: + type: integer + format: int32 + description: Number of electable nodes to deploy in the specified region. + Electable nodes can become the primary and can facilitate local + reads. Use **replicationSpecs[n].{region}.electableNodes** instead. + priority: + type: integer + format: int32 + description: Number that indicates the election priority of the region. To + identify the Preferred Region of the cluster, set this parameter to + `7`. The primary node runs in the **Preferred Region**. To identify + a read-only region, set this parameter to `0`. + maximum: 7 + minimum: 0 + readOnlyNodes: + type: integer + format: int32 + description: Number of read-only nodes in the region. Read-only nodes can never + become the primary member, but can facilitate local reads. Use + **replicationSpecs[n].{region}.readOnlyNodes** instead. + title: Region Configuration + ReplicationSpec: + type: object + description: Details that explain how MongoDB Cloud replicates data on the + specified MongoDB database. + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the replication + object for a zone in a Multi-Cloud Cluster. If you include existing + zones in the request, you must specify this parameter. If you add a + new zone to an existing Multi-Cloud Cluster, you may specify this + parameter. The request deletes any existing zones in the Multi-Cloud + Cluster that you exclude from the request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + numShards: + type: integer + format: int32 + description: Positive integer that specifies the number of shards to deploy in + each specified zone. If you set this value to `1` and + **clusterType** is `SHARDED`, MongoDB Cloud deploys a single-shard + sharded cluster. Don't create a sharded cluster with a single shard + for production environments. Single-shard sharded clusters don't + provide the same benefits as multi-shard configurations. + minimum: 1 + regionConfigs: + type: array + description: >- + Hardware specifications for nodes set for a given region. Each + **regionConfigs** object describes the region's priority in + elections and the number and type of MongoDB nodes that MongoDB + Cloud deploys to the region. Each **regionConfigs** object must have + either an **analyticsSpecs** object, **electableSpecs** object, or + **readOnlySpecs** object. Tenant clusters only require + **electableSpecs. Dedicated** clusters can specify any of these + specifications, but must have at least one **electableSpecs** object + within a **replicationSpec**. Every hardware specification must use + the same **instanceSize**. + + + **Example:** + + + If you set `"replicationSpecs[n].regionConfigs[m].analyticsSpecs.instanceSize" : "M30"`, set `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" : `"M30"` if you have electable nodes and `"replicationSpecs[n].regionConfigs[m].readOnlySpecs.instanceSize" : `"M30"` if you have read-only nodes. + items: + $ref: "#/components/schemas/CloudRegionConfig" + zoneName: + type: string + description: 'Human-readable label that identifies the zone in a Global Cluster. + Provide this value only if `"clusterType" : "GEOSHARDED"`.' + title: Replication Specifications + RequestAccepted: + type: object + description: Accepted + ResourceEventTypeViewForOrg: + type: string + description: Unique identifier of event type. + example: GROUP_TAGS_MODIFIED + title: Resource Event Types + ResourceTag: + type: object + description: "Key-value pair that tags and categorizes a MongoDB Cloud + organization, project, or cluster. For example, `environment : + production`." + properties: + key: + type: string + description: "Constant that defines the set of the tag. For example, + `environment` in the `environment : production` tag." + maxLength: 255 + minLength: 1 + value: + type: string + description: "Variable that belongs to the set of the tag. For example, + `production` in the `environment : production` tag." + maxLength: 255 + minLength: 1 + title: Resource Tag + RestoreJobFileHash: + type: object + description: Key and value pair that map one restore file to one hashed + checksum. This parameter applies after you download the corresponding + **delivery.url**. + properties: + fileName: + type: string + description: Human-readable label that identifies the hashed file. + readOnly: true + hash: + type: string + description: Hashed checksum that maps to the restore file. + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + typeName: + type: string + description: Human-readable label that identifies the hashing algorithm used to + compute the hash value. + readOnly: true + readOnly: true + RoleAssignment: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project to + which this role belongs. You can set a value for this parameter or + **orgId** but not both in the same request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + to which this role belongs. You can set a value for this parameter + or **groupId** but not both in the same request. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + role: + type: string + description: >+ + Human-readable label that identifies the collection of privileges + that MongoDB Cloud grants a specific API key, MongoDB Cloud user, or + MongoDB Cloud team. These roles include organization- and + project-level roles. + + + Organization Roles + + + * ORG_OWNER + + * ORG_MEMBER + + * ORG_GROUP_CREATOR + + * ORG_BILLING_ADMIN + + * ORG_READ_ONLY + + + Project Roles + + + * GROUP_CLUSTER_MANAGER + + * GROUP_DATA_ACCESS_ADMIN + + * GROUP_DATA_ACCESS_READ_ONLY + + * GROUP_DATA_ACCESS_READ_WRITE + + * GROUP_OWNER + + * GROUP_READ_ONLY + + * GROUP_SEARCH_INDEX_EDITOR + + SamlIdentityProviderUpdate: + type: object + properties: + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + description: + type: string + description: The description for the identity provider. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + maxLength: 50 + minLength: 1 + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion. + example: urn:idp:default + pemFileInfo: + $ref: "#/components/schemas/PemFileInfo" + protocol: + type: string + description: The protocol for the identity provider. + requestBinding: + type: string + description: SAML Authentication Request Protocol HTTP method binding (POST or + REDIRECT) that Federated Authentication uses to send the + authentication request. + responseSignatureAlgorithm: + type: string + description: Signature algorithm that Federated Authentication uses to encrypt + the identity provider signature. + ssoDebugEnabled: + type: boolean + description: Flag that indicates whether the identity provider has SSO debug + enabled. + ssoUrl: + type: string + description: Unique string that identifies the intended audience of the SAML + assertion. + example: https://example.com + status: + type: string + description: String enum that indicates whether the identity provider is active. + required: + - ssoDebugEnabled + SampleDatasetStatus: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal character string that identifies this sample + dataset. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + clusterName: + type: string + description: Human-readable label that identifies the cluster into which you + loaded the sample dataset. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + completeDate: + type: string + format: date-time + description: Date and time when the sample dataset load job completed. MongoDB + Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + createDate: + type: string + format: date-time + description: Date and time when you started the sample dataset load job. MongoDB + Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + errorMessage: + type: string + description: Details of the error returned when MongoDB Cloud loads the sample + dataset. This endpoint returns null if state has a value other than + FAILED. + readOnly: true + state: + type: string + description: Status of the sample dataset load job. + readOnly: true + SearchSynonymMappingDefinition: + type: object + description: Synonyms used for this full text index. + properties: + analyzer: + type: string + default: lucene.standard + description: Specific pre-defined method chosen to apply to the synonyms to be + searched. + name: + type: string + description: Human-readable label that identifies the synonym definition. Each + **synonym.name** must be unique within the same index definition. + source: + $ref: "#/components/schemas/SynonymSource" + required: + - analyzer + - name + - source + title: Synonym Mapping Definition + ServerlessBackupRestoreJob: + type: object + properties: + cancelled: + type: boolean + description: Flag that indicates whether someone canceled this restore job. + readOnly: true + deliveryType: + type: string + description: Human-readable label that categorizes the restore job to create. + deliveryUrl: + type: array + description: 'One or more Uniform Resource Locators (URLs) that point to the + compressed snapshot files for manual download. MongoDB Cloud returns + this parameter when `"deliveryType" : "download"`.' + items: + type: string + description: One Uniform Resource Locator that point to the compressed snapshot + files for manual download. + readOnly: true + desiredTimestamp: + $ref: "#/components/schemas/ApiBSONTimestamp" + expired: + type: boolean + description: Flag that indicates whether the restore job expired. + readOnly: true + expiresAt: + type: string + format: date-time + description: Date and time when the restore job expires. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + failed: + type: boolean + description: Flag that indicates whether the restore job failed. + readOnly: true + finishedAt: + type: string + format: date-time + description: Date and time when the restore job completed. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal character string that identifies the restore + job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + oplogInc: + type: integer + format: int32 + description: 'Oplog operation number from which you want to restore this + snapshot. This number represents the second part of an Oplog + timestamp. The resource returns this parameter when `"deliveryType" + : "pointInTime"` and **oplogTs** exceeds `0`.' + example: 1 + minimum: 1 + oplogTs: + type: integer + format: int32 + description: 'Date and time from which you want to restore this snapshot. This + parameter expresses this timestamp in the number of seconds that + have elapsed since the UNIX epoch. This number represents the first + part of an Oplog timestamp. The resource returns this parameter when + `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.' + minimum: 1199145600 + pointInTimeUTCSeconds: + type: integer + format: int32 + description: 'Date and time from which MongoDB Cloud restored this snapshot. + This parameter expresses this timestamp in the number of seconds + that have elapsed since the UNIX epoch. The resource returns this + parameter when `"deliveryType" : "pointInTime"` and + **pointInTimeUTCSeconds** exceeds `0`.' + minimum: 1199145600 + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + targetClusterName: + type: string + description: Human-readable label that identifies the target cluster to which + the restore job restores the snapshot. The resource returns this + parameter when `"deliveryType":` `"automated"`. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + targetGroupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the target + project for the specified **targetClusterName**. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + timestamp: + type: string + format: date-time + description: Date and time when MongoDB Cloud took the snapshot associated with + **snapshotId**. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + required: + - deliveryType + - targetClusterName + - targetGroupId + ServerlessBackupSnapshot: + type: object + properties: + createdAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud took the snapshot. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + expiresAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud deletes the snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + frequencyType: + type: string + description: Human-readable label that identifies how often this snapshot + triggers. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mongodVersion: + type: string + description: Version of the MongoDB host that this snapshot backs up. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + serverlessInstanceName: + type: string + description: Human-readable label given to the serverless instance from which + MongoDB Cloud took this snapshot. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + snapshotType: + type: string + description: Human-readable label that identifies when this snapshot triggers. + readOnly: true + status: + type: string + description: Human-readable label that indicates the stage of the backup process + for this snapshot. + readOnly: true + storageSizeBytes: + type: integer + format: int64 + description: Number of bytes taken to store the backup snapshot. + readOnly: true + ServerlessConnectionStringsPrivateEndpointItem: + type: object + description: Details of a private endpoint deployed for this serverless instance. + properties: + endpointId: + type: string + description: Unique string that the cloud provider uses to identify the private + endpoint. + readOnly: true + providerName: + type: string + description: Cloud provider where the private endpoint is deployed. + readOnly: true + region: + type: string + description: Region where the private endpoint is deployed. + readOnly: true + title: Serverless Instance Private Endpoint Connection Strings Endpoint + ServerlessConnectionStringsPrivateEndpointList: + type: object + description: Private endpoint connection string that you can use to connect to + this serverless instance through a private endpoint. + externalDocs: + description: Private Endpoint for Serverless Instance + url: https://docs.atlas.mongodb.com/security-serverless-private-endpoint/ + properties: + endpoints: + type: array + description: List that contains the private endpoints through which you connect + to MongoDB Cloud when you use + **connectionStrings.privateEndpoint[n].srvConnectionString**. + items: + $ref: "#/components/schemas/ServerlessConnectionStringsPrivateEndpointItem" + readOnly: true + srvConnectionString: + type: string + description: Private endpoint-aware connection string that uses the + `mongodb+srv://` protocol to connect to MongoDB Cloud through a + private endpoint. The `mongodb+srv` protocol tells the driver to + look up the seed list of hosts in the Domain Name System (DNS). + readOnly: true + type: + type: string + description: MongoDB process type to which your application connects. + readOnly: true + title: Serverless Instance Private Endpoint Connection String + ServerlessEventTypeViewAlertable: + type: string + description: Event type that triggers an alert. + example: OUTSIDE_SERVERLESS_METRIC_THRESHOLD + title: Serverless Event Types + ServerlessInstanceDescription: + type: object + description: Group of settings that configure a MongoDB serverless instance. + properties: + connectionStrings: + $ref: "#/components/schemas/ServerlessInstanceDescriptionConnectionStrings" + createDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this serverless instance. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the serverless + instance. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mongoDBVersion: + type: string + description: Version of MongoDB that the serverless instance runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + readOnly: true + name: + type: string + description: Human-readable label that identifies the serverless instance. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + providerSettings: + $ref: "#/components/schemas/ServerlessProviderSettings" + serverlessBackupOptions: + $ref: "#/components/schemas/ClusterServerlessBackupOptions" + stateName: + type: string + description: Human-readable label that indicates the current operating condition + of the serverless instance. + readOnly: true + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the serverless instance. + items: + $ref: "#/components/schemas/ResourceTag" + terminationProtectionEnabled: + type: boolean + default: false + description: Flag that indicates whether termination protection is enabled on + the serverless instance. If set to `true`, MongoDB Cloud won't + delete the serverless instance. If set to `false`, MongoDB Cloud + will delete the serverless instance. + required: + - providerSettings + title: Serverless Instance Description + ServerlessInstanceDescriptionConnectionStrings: + type: object + description: Collection of Uniform Resource Locators that point to the MongoDB + database. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + properties: + privateEndpoint: + type: array + description: List of private endpoint-aware connection strings that you can use + to connect to this serverless instance through a private endpoint. + This parameter returns only if you created a private endpoint for + this serverless instance and it is AVAILABLE. + items: + $ref: "#/components/schemas/ServerlessConnectionStringsPrivateEndpointList" + readOnly: true + standardSrv: + type: string + description: Public connection string that you can use to connect to this + serverless instance. This connection string uses the + `mongodb+srv://` protocol. + externalDocs: + description: Connection String URI Format + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + readOnly: true + title: Serverless Instance Connection Strings + ServerlessInstanceDescriptionCreate: + type: object + description: Settings that you can specify when you create a serverless instance. + properties: + name: + type: string + description: Human-readable label that identifies the serverless instance. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + writeOnly: true + providerSettings: + $ref: "#/components/schemas/ServerlessProviderSettings" + serverlessBackupOptions: + $ref: "#/components/schemas/ClusterServerlessBackupOptions" + stateName: + type: string + description: Human-readable label that indicates the current operating condition + of the serverless instance. + readOnly: true + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the serverless instance. + items: + $ref: "#/components/schemas/ResourceTag" + terminationProtectionEnabled: + type: boolean + default: false + description: Flag that indicates whether termination protection is enabled on + the serverless instance. If set to `true`, MongoDB Cloud won't + delete the serverless instance. If set to `false`, MongoDB Cloud + will delete the serverless instance. + required: + - name + - providerSettings + title: Serverless Instance Description Create + ServerlessInstanceDescriptionUpdate: + type: object + description: Settings that you can update when you request a serverless cluster + update. + properties: + serverlessBackupOptions: + $ref: "#/components/schemas/ClusterServerlessBackupOptions" + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the serverless instance. + items: + $ref: "#/components/schemas/ResourceTag" + terminationProtectionEnabled: + type: boolean + default: false + description: Flag that indicates whether termination protection is enabled on + the serverless instance. If set to `true`, MongoDB Cloud won't + delete the serverless instance. If set to `false`, MongoDB Cloud + will delete the serverless instance. + title: Serverless Instance Description Update + ServerlessMetricThreshold: + type: object + description: Threshold for the metric that, when exceeded, triggers an alert. + The metric threshold pertains to event types which reflects changes of + measurements and metrics about the serverless database. + properties: + metricName: + type: string + description: Human-readable label that identifies the metric against which + MongoDB Cloud checks the configured **metricThreshold.threshold**. + mode: + type: string + description: MongoDB Cloud computes the current metric value as an average. + operator: + $ref: "#/components/schemas/Operator" + threshold: + type: number + format: double + description: Value of metric that, when exceeded, triggers an alert. + units: + $ref: "#/components/schemas/ServerlessMetricUnits" + required: + - metricName + title: Serverless Metric Threshold + ServerlessMetricUnits: + type: string + description: Element used to express the quantity. This can be an element of + time, storage capacity, and the like. + example: RPU + title: Serverless Metric Units + ServerlessProviderSettings: + type: object + description: Group of cloud provider settings that configure the provisioned + MongoDB serverless instance. + properties: + backingProviderName: + type: string + description: Cloud service provider on which MongoDB Cloud provisioned the + serverless instance. + providerName: + type: string + default: SERVERLESS + description: Human-readable label that identifies the cloud service provider. + regionName: + type: string + description: Human-readable label that identifies the geographic location of + your MongoDB serverless instance. The region you choose can affect + network latency for clients accessing your databases. For a complete + list of region names, see + [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), + [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and + [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). + required: + - backingProviderName + - regionName + title: Cloud Service Provider Settings for a Serverless Instance + ServerlessTenantCreateRequest: + type: object + properties: + comment: + type: string + description: Human-readable comment associated with the private endpoint. + maxLength: 80 + writeOnly: true + ServerlessTenantEndpoint: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal digit string that identifies the private + endpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + cloudProviderEndpointId: + type: string + description: >- + Unique string that identifies the private endpoint's network + interface. + + + Alternatively: + + Unique string that identifies the Azure private endpoint's network interface that someone added to this private endpoint service. + pattern: ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + readOnly: true + comment: + type: string + description: Human-readable comment associated with the private endpoint. + maxLength: 80 + readOnly: true + endpointServiceName: + type: string + description: >- + Unique string that identifies the PrivateLink endpoint service. + MongoDB Cloud returns null while it creates the endpoint service. + + + Alternatively: + + Unique string that identifies the Amazon Web Services (AWS) PrivateLink endpoint service. MongoDB Cloud returns null while it creates the endpoint service. + + + Alternatively: + + Unique string that identifies the Azure private endpoint service. MongoDB Cloud returns null while it creates the endpoint service. + pattern: ^pls_[0-9a-f]{24}$ + readOnly: true + errorMessage: + type: string + description: Human-readable error message that indicates error condition + associated with establishing the private endpoint connection. + readOnly: true + status: + type: string + description: Human-readable label that indicates the current operating status of + the private endpoint. + readOnly: true + providerName: + type: string + description: Human-readable label that identifies the cloud service provider. + readOnly: true + privateEndpointIpAddress: + type: string + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + maxLength: 24 + minLength: 24 + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + privateLinkServiceResourceId: + type: string + description: Root-relative path that identifies the Azure Private Link Service + that MongoDB Cloud manages. MongoDB Cloud returns null while it + creates the endpoint service. + readOnly: true + ServerlessTenantEndpointUpdate: + type: object + description: Update view for a serverless tenant endpoint. + properties: + comment: + type: string + description: Human-readable comment associated with the private endpoint. + maxLength: 80 + writeOnly: true + providerName: + type: string + description: Human-readable label that identifies the cloud provider of the + tenant endpoint. + writeOnly: true + cloudProviderEndpointId: + type: string + description: >- + Unique string that identifies the private endpoint's network + interface. + + + Alternatively: + + Unique string that identifies the Azure private endpoint's network interface for this private endpoint service. + pattern: ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + writeOnly: true + privateEndpointIpAddress: + type: string + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + writeOnly: true + required: + - providerName + Source: + type: object + description: Document that describes the source of the migration. + properties: + caCertificatePath: + type: string + description: Path to the CA certificate that signed SSL certificates use to + authenticate to the source cluster. + clusterName: + type: string + description: Label that identifies the source cluster name. + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the source + project. + example: 9b43a5b329223c3a1591a678 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + managedAuthentication: + type: boolean + description: Flag that indicates whether MongoDB Automation manages + authentication to the source cluster. If true, do not provide values + for username and password. + password: + type: string + description: Password that authenticates the username to the source cluster. + writeOnly: true + ssl: + type: boolean + description: Flag that indicates whether you have SSL enabled. + username: + type: string + description: Label that identifies the SCRAM-SHA user that connects to the + source cluster. + writeOnly: true + required: + - clusterName + - groupId + - managedAuthentication + - ssl + StreamsConnection: + type: object + description: Settings that define a connection to an external data store. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + name: + type: string + description: Human-readable label that identifies the stream connection. + type: + type: string + description: Type of the connection. Can be either Cluster or Kafka. + clusterName: + type: string + description: Name of the cluster configured for this connection. + authentication: + $ref: "#/components/schemas/StreamsKafkaAuthentication" + bootstrapServers: + type: string + description: Comma separated list of server addresses. + config: + type: object + additionalProperties: + type: string + description: A map of Kafka key-value pairs for optional configuration. This is + a flat object, and keys can have '.' characters. + example: '{"group.protocol.type":"consumer","debug":"queue, msg, protocol"}' + description: A map of Kafka key-value pairs for optional configuration. This is + a flat object, and keys can have '.' characters. + example: + debug: queue, msg, protocol + group.protocol.type: consumer + security: + $ref: "#/components/schemas/StreamsKafkaSecurity" + readOnly: true + StreamsDataProcessRegion: + type: object + properties: + cloudProvider: + type: string + description: Label that identifies the cloud service provider where MongoDB + Cloud performs stream processing. Currently, this parameter supports + AWS only. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + region: + $ref: "#/components/schemas/BaseStreamsRegion" + required: + - cloudProvider + - region + StreamsKafkaAuthentication: + type: object + description: User credentials required to connect to a Kafka Cluster. Includes + the authentication type, as well as the parameters for that + authentication mode. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mechanism: + type: string + description: Style of authentication. Can be one of PLAIN, SCRAM-256, or + SCRAM-512. + password: + type: string + format: password + description: Password of the account to connect to the Kafka cluster. + writeOnly: true + username: + type: string + description: Username of the account to connect to the Kafka cluster. + StreamsKafkaSecurity: + type: object + description: Properties for the secure transport connection to Kafka. For SSL, + this can include the trusted certificate to use. + properties: + brokerPublicCertificate: + type: string + description: A trusted, public x509 certificate for connecting to Kafka over SSL. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + protocol: + type: string + description: Describes the transport type. Can be either PLAINTEXT or SSL. + StreamsTenant: + type: object + properties: + _id: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + connections: + type: array + description: List of connections configured in the stream instance. + items: + $ref: "#/components/schemas/StreamsConnection" + readOnly: true + dataProcessRegion: + $ref: "#/components/schemas/StreamsDataProcessRegion" + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + hostnames: + type: array + description: List that contains the hostnames assigned to the stream instance. + items: + type: string + description: Unique hostname assigned to the stream instance. + readOnly: true + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + name: + type: string + description: Human-readable label that identifies the stream instance. + SynonymSource: + type: object + description: Data set that stores the mapping one or more words map to one or + more synonyms of those words. + properties: + collection: + type: string + description: Human-readable label that identifies the MongoDB collection that + stores words and their applicable synonyms. + required: + - collection + SystemStatus: + type: object + properties: + apiKey: + $ref: "#/components/schemas/ApiKey" + appName: + type: string + description: Human-readable label that identifies the service from which you + requested this response. + readOnly: true + build: + type: string + description: Unique 40-hexadecimal digit hash that identifies the latest git + commit merged for this application. + example: 83be55e140f493c88e7f578aae96548dd881587b + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + throttling: + type: boolean + description: Flag that indicates whether someone enabled throttling on this + service. + readOnly: true + required: + - apiKey + - appName + - build + - throttling + TargetOrg: + type: object + properties: + linkToken: + type: string + description: Link token that contains all the information required to complete + the link. + required: + - linkToken + TargetOrgRequest: + type: object + properties: + accessListIps: + type: array + description: IP address access list entries associated with the API key. + items: + type: string + description: One IP address access list entry associated with the API key. + Team: + type: object + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + name: + type: string + description: Human-readable label that identifies the team. + usernames: + type: array + description: List that contains the MongoDB Cloud users in this team. + items: + type: string + format: email + description: List that contains email addresses that identify MongoDB Cloud + users to in this team. + uniqueItems: true + required: + - name + TeamResponse: + type: object + properties: + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + name: + type: string + description: Human-readable label that identifies the team. + TeamRole: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + roleNames: + type: array + description: One or more organization- or project-level roles to assign to the + MongoDB Cloud user. + items: + type: string + uniqueItems: true + teamId: + type: string + description: Unique 24-hexadecimal character string that identifies the team. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + TenantRestore: + type: object + properties: + clusterName: + type: string + description: Human-readable label that identifies the source cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + readOnly: true + deliveryType: + type: string + description: Means by which this resource returns the snapshot to the requesting + MongoDB Cloud user. + readOnly: true + expirationDate: + type: string + format: date-time + description: Date and time when the download link no longer works. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the restore job. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + projectId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project from + which the restore job originated. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + restoreFinishedDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud completed writing this snapshot. + MongoDB Cloud changes the status of the restore job to `CLOSED`. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + restoreScheduledDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud will restore this snapshot. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + snapshotFinishedDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud completed writing this snapshot. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + snapshotId: + type: string + description: Unique 24-hexadecimal digit string that identifies the snapshot to + restore. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + snapshotUrl: + type: string + description: 'Internet address from which you can download the compressed + snapshot files. The resource returns this parameter + when `"deliveryType" : "DOWNLOAD"`.' + readOnly: true + status: + type: string + description: Phase of the restore workflow for this job at the time this + resource made this request. + readOnly: true + targetDeploymentItemName: + type: string + description: Human-readable label that identifies the cluster on the target + project to which you want to restore the snapshot. You can restore + the snapshot to a cluster tier *M2* or greater. + maxLength: 64 + minLength: 1 + pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ + targetProjectId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + contains the cluster to which you want to restore the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + required: + - snapshotId + - targetDeploymentItemName + ThridPartyIntegration: + type: object + description: Collection of settings that describe third-party integrations. + properties: + type: + type: string + description: >- + Integration type + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + + + Alternatively: + + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. + apiKey: + type: string + description: >- + Key that allows MongoDB Cloud to access your Datadog account. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + + + Alternatively: + + Key that allows MongoDB Cloud to access your Opsgenie account. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + + + Alternatively: + + Key that allows MongoDB Cloud to access your VictorOps account. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + example: "********************************9abc" + region: + type: string + description: >- + Two-letter code that indicates which regional URL MongoDB uses to + access the Datadog API. + + + To learn more about Datadog's regions, see Datadog Sites. + + + Alternatively: + + Two-letter code that indicates which regional URL MongoDB uses to access the Opsgenie API. + + + Alternatively: + + PagerDuty region that indicates the API Uniform Resource Locator (URL) to use. + microsoftTeamsWebhookUrl: + type: string + description: >- + Endpoint web address of the Microsoft Teams webhook to which MongoDB + Cloud sends notifications. + + + **NOTE**: When you view or edit the alert for a Microsoft Teams notification, the URL appears partially redacted. + example: https://webhook.com/**** + accountId: + type: string + description: Unique 40-hexadecimal digit string that identifies your New Relic + account. + example: bcc3c81b344a6030a3935c2527e2216535af7718 + maxLength: 40 + minLength: 40 + pattern: ^([0-9a-f]){40}$ + licenseKey: + type: string + description: >- + Unique 40-hexadecimal digit string that identifies your New Relic + license. + + + **IMPORTANT**: Effective Wednesday, June 16th, 2021, New Relic no longer supports the plugin-based integration with MongoDB. We do not recommend that you sign up for the plugin-based integration. + + To learn more, see the New Relic Plugin EOL Statement Consider configuring an alternative monitoring integration before June 16th to maintain visibility into your MongoDB deployments. + example: bc3768f44193c282b2688ab39e00f8e4fc8d75ea + maxLength: 40 + minLength: 40 + pattern: ^([0-9a-f]){40}$ + readToken: + type: string + description: Query key used to access your New Relic account. + example: 193c96aee4a3ac640b98634562e2631f17ae0a69 + writeToken: + type: string + description: Insert key associated with your New Relic account. + example: a67b10e5cd7f8fb6a34b501136c409f373edc218 + serviceKey: + type: string + description: >- + Service key associated with your PagerDuty account. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + example: "****************************7890" + enabled: + type: boolean + description: Flag that indicates whether someone has activated the Prometheus + integration. + listenAddress: + type: string + default: :9216 + description: Combination of IPv4 address and Internet Assigned Numbers Authority + (IANA) port or the IANA port alone to which Prometheus binds to + ingest MongoDB metrics. + password: + type: string + writeOnly: true + rateLimitInterval: + type: integer + format: int32 + writeOnly: true + scheme: + type: string + description: Security Scheme to apply to HyperText Transfer Protocol (HTTP) + traffic between Prometheus and MongoDB Cloud. + serviceDiscovery: + type: string + description: Desired method to discover the Prometheus service. + tlsPemPath: + type: string + description: Root-relative path to the Transport Layer Security (TLS) Privacy + Enhanced Mail (PEM) key and certificate file on the host. + example: /path/to/file + username: + type: string + description: Human-readable label that identifies your Prometheus incoming + webhook. + example: prom_user_618d48e05277a606ed2496fe + apiToken: + type: string + description: >- + Key that allows MongoDB Cloud to access your Slack account. + + + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: + + + * View or edit the alert through the Atlas UI. + + + * Query the alert for the notification through the Atlas Administration API. + + + **IMPORTANT**: Slack integrations now use the OAuth2 verification method and must be initially configured, or updated from a legacy integration, through the Atlas third-party service integrations page. Legacy tokens will soon no longer be supported. + example: "*********************************************************************\ + *abcd" + channelName: + type: string + description: Name of the Slack channel to which MongoDB Cloud sends alert + notifications. + example: alerts + maxLength: 80 + minLength: 1 + teamName: + type: string + description: Human-readable label that identifies your Slack team. Set this + parameter when you configure a legacy Slack integration. + example: MongoDB + routingKey: + type: string + description: Routing key associated with your Splunk On-Call account. + example: test routing + secret: + type: string + description: >- + An optional field returned if your webhook is configured with a + secret. + + + **NOTE**: When you view or edit the alert for a webhook notification, the secret appears completely redacted. + example: "******" + url: + type: string + description: >- + Endpoint web address to which MongoDB Cloud sends notifications. + + + **NOTE**: When you view or edit the alert for a webhook notification, the URL appears partially redacted. + example: https://webhook.com/**** + title: Third-Party Integration + TriggerIngestionPipelineRequest: + type: object + properties: + snapshotId: + type: string + description: Unique 24-hexadecimal character string that identifies the snapshot. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + writeOnly: true + required: + - snapshotId + UpdateAtlasOrganizationApiKey: + type: object + properties: + desc: + type: string + description: Purpose or explanation provided when someone creates this + organization API key. + maxLength: 250 + minLength: 1 + roles: + type: array + description: List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + organization. + items: + type: string + UpdateAtlasProjectApiKey: + type: object + properties: + desc: + type: string + description: Purpose or explanation provided when someone creates this project + API key. + maxLength: 250 + minLength: 1 + roles: + type: array + description: List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + project. + items: + type: string + UpdateCustomDBRole: + type: object + properties: + actions: + type: array + description: List of the individual privilege actions that the role grants. + items: + $ref: "#/components/schemas/DatabasePrivilegeAction" + inheritedRoles: + type: array + description: List of the built-in roles that this custom role inherits. + items: + $ref: "#/components/schemas/DatabaseInheritedRole" + uniqueItems: true + UpdateGroupRolesForUser: + type: object + properties: + groupRoles: + type: array + description: One or more project level roles to assign to the MongoDB Cloud user. + items: + type: string + uniqueItems: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + UpdateOrgRolesForUser: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + orgRoles: + type: array + description: One or more organization level roles to assign to the MongoDB Cloud + user. + items: + type: string + uniqueItems: true + UserAccessList: + type: object + properties: + cidrBlock: + type: string + description: Range of network addresses that you want to add to the access list + for the API key. This parameter requires the range to be expressed + in classless inter-domain routing (CIDR) notation of Internet + Protocol version 4 or version 6 addresses. You can set a value for + this parameter or **ipAddress** but not both in the same request. + example: 203.0.113.0/24 + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + count: + type: integer + format: int32 + description: Total number of requests that have originated from the Internet + Protocol (IP) address given as the value of the *lastUsedAddress* + parameter. + minimum: 1 + readOnly: true + created: + type: string + format: date-time + description: Date and time when someone added the network addresses to the + specified API access list. This parameter expresses its value in the + ISO 8601 timestamp format in UTC. + readOnly: true + ipAddress: + type: string + description: Network address that you want to add to the access list for the API + key. This parameter requires the address to be expressed as one + Internet Protocol version 4 or version 6 address. You can set a + value for this parameter or **cidrBlock** but not both in the same + request. + example: 203.0.113.10 + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ + lastUsed: + type: string + format: date-time + description: Date and time when MongoDB Cloud received the most recent request + that originated from this Internet Protocol version 4 or version 6 + address. The resource returns this parameter when at least one + request has originated from this IP address. MongoDB Cloud updates + this parameter each time a client accesses the permitted resource. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + lastUsedAddress: + type: string + description: Network address that issued the most recent request to the API. + This parameter requires the address to be expressed as one Internet + Protocol version 4 or version 6 address. The resource returns this + parameter after this IP address made at least one request. + example: 203.0.113.10 + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + UserAccessRoleAssignment: + type: object + properties: + apiUserId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + API key. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + roles: + type: array + description: List of roles to grant this API key. If you provide this list, + provide a minimum of one role and ensure each role applies to this + project. + items: + type: string + UserCert: + type: object + properties: + _id: + type: integer + format: int64 + description: Unique 24-hexadecimal character string that identifies this + certificate. + readOnly: true + createdAt: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this certificate. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + monthsUntilExpiration: + type: integer + format: int32 + default: 3 + description: Number of months that the certificate remains valid until it expires. + maximum: 24 + writeOnly: true + notAfter: + type: string + format: date-time + description: Date and time when this certificate expires. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + subject: + type: string + description: Subject Alternative Name associated with this certificate. This + parameter expresses its value as a distinguished name as defined in + [RFC 2253](https://tools.ietf.org/html/2253). + example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + readOnly: true + UserCustomDBRole: + type: object + properties: + actions: + type: array + description: List of the individual privilege actions that the role grants. + items: + $ref: "#/components/schemas/DatabasePrivilegeAction" + inheritedRoles: + type: array + description: List of the built-in roles that this custom role inherits. + items: + $ref: "#/components/schemas/DatabaseInheritedRole" + uniqueItems: true + roleName: + type: string + description: Human-readable label that identifies the role for the request. This + name must be unique for this custom role in this project. + pattern: ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?ISO 8601 timestamp + format in UTC. + readOnly: true + description: + type: string + description: Description of the event. + example: Alert Acknowledged + gn: + type: string + description: Human-readable label that identifies the project. + example: Test Project + maxLength: 64 + minLength: 1 + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the event. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgId: + type: string + description: Unique 24-hexadecimal digit string that identifies the organization + to which these events apply. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + orgName: + type: string + description: Human-readable label that identifies the organization that contains + the project. + example: Test Organization + maxLength: 64 + minLength: 1 + severity: + type: string + readOnly: true + AWSCustomDNSEnabled: + type: object + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether the project's clusters deployed to + Amazon Web Services (AWS) use a custom Domain Name System (DNS). + + When `"enabled": true`, connect to your cluster using Private IP for Peering connection strings. + externalDocs: + description: "To learn more, see FAQ: Connection String Options in the MongoDB + Atlas documentation." + url: https://www.mongodb.com/docs/atlas/reference/faq/connection-changes/#how-does-this-affect-aws-vpc-peering-when-i-use-custom-dns- + required: + - enabled + AccessListItem: + type: object + properties: + cidrBlock: + type: string + description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) + notation that found in this project's access list. + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + readOnly: true + ipAddress: + type: string + description: IP address included in the API access list. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + readOnly: true + required: + - ipAddress + ApiAtlasCheckpoint: + type: object + properties: + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster that + contains the checkpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + completed: + type: string + format: date-time + description: Date and time when the checkpoint completed and the balancer + restarted. This parameter expresses its value in the ISO 8601 + timestamp format in UTC. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + owns the checkpoints. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies checkpoint. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + parts: + type: array + description: >- + Metadata that describes the complete snapshot. + + + - For a replica set, this array contains a single document. + + - For a sharded cluster, this array contains one document for each shard plus one document for the config host. + items: + $ref: "#/components/schemas/ApiCheckpointPart" + readOnly: true + restorable: + type: boolean + description: Flag that indicates whether MongoDB Cloud can use the checkpoint + for a restore. + readOnly: true + started: + type: string + format: date-time + description: Date and time when the balancer stopped and began the checkpoint. + This parameter expresses its value in the ISO 8601 timestamp format + in UTC. + readOnly: true + timestamp: + type: string + format: date-time + description: Date and time to which the checkpoint restores. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + ApiAtlasSnapshotSchedule: + type: object + properties: + clusterCheckpointIntervalMin: + type: integer + format: int32 + description: Quantity of time expressed in minutes between successive cluster + checkpoints. This parameter applies only to sharded clusters. This + number determines the granularity of continuous cloud backups for + sharded clusters. + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster with + the snapshot you want to return. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + dailySnapshotRetentionDays: + type: integer + format: int32 + description: Quantity of time to keep daily snapshots. MongoDB Cloud expresses + this value in days. Set this value to `0` to disable daily snapshot + retention. + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project that + contains the cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + monthlySnapshotRetentionMonths: + type: integer + format: int32 + description: Number of months that MongoDB Cloud must keep monthly snapshots. + Set this value to `0` to disable monthly snapshot retention. + pointInTimeWindowHours: + type: integer + format: int32 + description: Number of hours before the current time from which MongoDB Cloud + can create a Continuous Cloud Backup snapshot. + snapshotIntervalHours: + type: integer + format: int32 + description: Number of hours that must elapse before taking another snapshot. + snapshotRetentionDays: + type: integer + format: int32 + description: Number of days that MongoDB Cloud must keep recent snapshots. + weeklySnapshotRetentionWeeks: + type: integer + format: int32 + description: Number of weeks that MongoDB Cloud must keep weekly snapshots. Set + this value to `0` to disable weekly snapshot retention. + required: + - clusterCheckpointIntervalMin + - clusterId + - dailySnapshotRetentionDays + - groupId + - monthlySnapshotRetentionMonths + - pointInTimeWindowHours + - snapshotIntervalHours + - snapshotRetentionDays + - weeklySnapshotRetentionWeeks + ApiBSONTimestamp: + type: object + description: BSON timestamp that indicates when the checkpoint token entry in + the oplog occurred. + properties: + date: + type: string + format: date-time + description: Date and time when the oplog recorded this database operation. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. + readOnly: true + increment: + type: integer + format: int32 + description: Order of the database operation that the oplog recorded at specific + date and time. + example: 1199145600 + minimum: 1199145600 + readOnly: true + readOnly: true + title: BSON Timestamp + ApiCheckpointPart: + type: object + description: Metadata contained in one document that describes the complete + snapshot taken for this node. + properties: + replicaSetName: + type: string + description: Human-readable label that identifies the replica set to which this + checkpoint applies. + readOnly: true + shardName: + type: string + description: Human-readable label that identifies the shard to which this + checkpoint applies. + readOnly: true + tokenDiscovered: + type: boolean + description: Flag that indicates whether the token exists. + readOnly: true + tokenTimestamp: + $ref: "#/components/schemas/ApiBSONTimestamp" + typeName: + type: string + description: Human-readable label that identifies the type of host that the part + represents. + readOnly: true + readOnly: true + AutoExportPolicy: + type: object + description: Policy for automatically exporting cloud backup snapshots. + properties: + exportBucketId: + type: string + description: Unique 24-hexadecimal character string that identifies the AWS + Bucket. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + frequencyType: + type: string + description: Human-readable label that indicates the rate at which the export + policy item occurs. + title: export + CostExplorerFilterResponse: + type: object + description: Response object to give information about created query. + properties: + token: + type: string + description: The token used to identify the created Cost Explorer query. + example: d9ab638a801efe182f98ae3e18ea4bb47b9fda808a28a8c7de205bb0e94f7d71 + maxLength: 64 + minLength: 64 + Criteria: + type: object + description: >- + Rules by which MongoDB MongoDB Cloud archives data. + + + Use the **criteria.type** field to choose how MongoDB Cloud selects data to archive. Choose data using the age of the data or a MongoDB query. + + **"criteria.type": "DATE"** selects documents to archive based on a date. + + **"criteria.type": "CUSTOM"** selects documents to archive based on a custom JSON query. MongoDB Cloud doesn't support **"criteria.type": "CUSTOM"** when **"collectionType": "TIMESERIES"**. + properties: + type: + type: string + description: >- + Means by which MongoDB Cloud selects data to archive. Data can be + chosen using the age of the data or a MongoDB query. + + **DATE** selects documents to archive based on a date. + + **CUSTOM** selects documents to archive based on a custom JSON query. MongoDB Cloud doesn't support **CUSTOM** when `"collectionType": "TIMESERIES"`. + query: + type: string + description: "MongoDB find query that selects documents to archive. The + specified query follows the syntax of the + `db.collection.find(query)` command. This query can't use the empty + document (`{}`) to return all documents. Set this parameter when + **\"criteria.type\" : \"CUSTOM\"**." + dateField: + type: string + description: 'Indexed database parameter that stores the date that determines + when data moves to the online archive. MongoDB Cloud archives the + data when the current date exceeds the date in this database + parameter plus the number of days specified through the + **expireAfterDays** parameter. Set this parameter when you set + `"criteria.type" : "DATE"`.' + dateFormat: + type: string + default: ISODATE + description: >- + Syntax used to write the date after which data moves to the online + archive. Date can be expressed as ISO 8601 or Epoch timestamps. The + Epoch timestamp can be expressed as nanoseconds, milliseconds, or + seconds. Set this parameter when **"criteria.type" : "DATE"**. + + You must set **"criteria.type" : "DATE"** if **"collectionType": "TIMESERIES"**. + expireAfterDays: + type: integer + format: int32 + description: 'Number of days after the value in the **criteria.dateField** when + MongoDB Cloud archives data in the specified cluster. Set this + parameter when you set **"criteria.type" : "DATE"**.' + DataProcessRegion: + type: object + description: Settings to configure the region where you wish to store your + archived data. + properties: + cloudProvider: + type: string + description: Human-readable label that identifies the Cloud service provider + where you wish to store your archived data. + region: + type: string + description: Human-readable label that identifies the geographic location of the + region where you wish to store your archived data. + GroupPaginatedEvent: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/EventViewForNdsGroup" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + ManagedNamespace: + type: object + properties: + collection: + type: string + description: Human-readable label of the collection to manage for this Global + Cluster. + customShardKey: + type: string + description: Database parameter used to divide the *collection* into shards. + Global clusters require a compound shard key. This compound shard + key combines the location parameter and the user-selected custom + key. + db: + type: string + description: Human-readable label of the database to manage for this Global + Cluster. + isCustomShardKeyHashed: + type: boolean + default: false + description: Flag that indicates whether someone hashed the custom shard key. If + this parameter returns `false`, this cluster uses ranged sharding. + isShardKeyUnique: + type: boolean + default: false + description: Flag that indicates whether the underlying index enforces unique + values. + numInitialChunks: + type: integer + format: int64 + description: Minimum number of chunks to create initially when sharding an empty + collection with a hashed shard key. + presplitHashedZones: + type: boolean + default: false + description: Flag that indicates whether MongoDB Cloud should create and + distribute initial chunks for an empty or non-existing collection. + MongoDB Cloud distributes data based on the defined zones and zone + ranges for the collection. + MatcherField: + type: string + NumberMetricValue: + type: object + description: Measurement of the **metricName** recorded at the time of the event. + properties: + number: + type: number + format: double + description: Amount of the **metricName** recorded at the time of the event. + This value triggered the alert. + readOnly: true + units: + $ref: "#/components/schemas/NumberMetricUnits" + readOnly: true + title: Number Metric Value + OrgPaginatedEvent: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/EventViewForOrg" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedAdvancedClusterDescription: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/AdvancedClusterDescription" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedAlertConfig: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/GroupAlertsConfig" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedAlert: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/AlertViewForNdsGroup" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedApiApiUser: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/ApiKeyUserDetails" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAppUser: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/CloudAppUser" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasCheckpoint: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/ApiAtlasCheckpoint" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasDatabaseUser: + type: object + description: List of MongoDB Database users granted access to databases in the + specified project. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/CloudDatabaseUser" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasDiskBackupExportJob: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/DiskBackupExportJob" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasProviderRegions: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/CloudProviderRegions" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasServerlessBackupRestoreJob: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/ServerlessBackupRestoreJob" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiAtlasServerlessBackupSnapshot: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/ServerlessBackupSnapshot" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiInvoice: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/BillingInvoice" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedApiStreamsConnection: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/StreamsConnection" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedApiStreamsTenant: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/StreamsTenant" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedApiUserAccessList: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/UserAccessList" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedAppUser: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/CloudAppUser" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedAtlasGroup: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/Group" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedBackupSnapshotExportBucket: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/DiskBackupSnapshotAWSExportBucket" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedBackupSnapshot: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/DiskBackupSnapshot" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedCloudBackupReplicaSet: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/DiskBackupReplicaSet" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedCloudBackupRestoreJob: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/DiskBackupSnapshotRestoreJob" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedCloudBackupShardedClusterSnapshot: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/DiskBackupShardedClusterSnapshot" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedCloudProviderContainer: + type: object + description: List of Network Peering Containers that Amazon Web Services serves. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/CloudProviderContainer" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + title: Network Peering + PaginatedContainerPeer: + type: object + description: Group of Network Peering connection settings. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedDatabase: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/MesurementsDatabase" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedDiskPartition: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/MeasurementDiskPartition" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedIntegration: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/ThridPartyIntegration" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedNetworkAccess: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/NetworkPermissionEntry" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedOnlineArchive: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/BackupOnlineArchive" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedOrgGroup: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/OrgGroup" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedOrganization: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/AtlasOrganization" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedPipelineRun: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/IngestionPipelineRun" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedPrivateNetworkEndpointIdEntry: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/PrivateNetworkEndpointIdEntry" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response if **includeCount** + query param is true. + minimum: 0 + readOnly: true + PaginatedRestoreJob: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/BackupRestoreJob" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedServerlessInstanceDescription: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/ServerlessInstanceDescription" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedSnapshot: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/BackupSnapshot" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedTeamRole: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/TeamRole" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedTeam: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/TeamResponse" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedTenantRestore: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/TenantRestore" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedTenantSnapshot: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/BackupTenantSnapshot" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PaginatedUserCert: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/UserCert" + readOnly: true + totalCount: + type: integer + format: int32 + description: Number of documents returned in this response. + minimum: 0 + readOnly: true + PartitionField: + type: object + description: Metadata to partition this online archive. + properties: + fieldName: + type: string + description: Human-readable label that identifies the parameter that MongoDB + Cloud uses to partition data. To specify a nested parameter, use the + dot notation. + maxLength: 700 + fieldType: + type: string + description: Data type of the parameter that that MongoDB Cloud uses to + partition data. Partition parameters of type + [UUID](http://bsonspec.org/spec.html) must be of binary subtype 4. + MongoDB Cloud skips partition parameters of type UUID with subtype + 3. + readOnly: true + order: + type: integer + format: int32 + default: 0 + description: Sequence in which MongoDB Cloud slices the collection data to + create partitions. The resource expresses this sequence starting + with zero. The value of the **criteria.dateField** parameter + defaults as the first item in the partition sequence. + required: + - fieldName + - order + title: Online Archive Partition + PerformanceAdvisorOperation: + type: object + properties: + predicates: + type: array + description: List that contains the search criteria that the query uses. To use + the values in key-value pairs in these predicates requires **Project + Data Access Read Only** permissions or greater. Otherwise, MongoDB + Cloud redacts these values. + items: + type: object + description: List that contains the search criteria that the query uses. To use + the values in key-value pairs in these predicates requires + **Project Data Access Read Only** permissions or greater. + Otherwise, MongoDB Cloud redacts these values. + readOnly: true + readOnly: true + stats: + $ref: "#/components/schemas/PerformanceAdvisorOpStats" + PrivateIPMode: + type: object + properties: + enabled: + type: boolean + description: Flag that indicates whether someone enabled **Connect via Peering + Only** mode for the specified project. + required: + - enabled + ProjectSettingItem: + type: object + properties: + enabled: + type: boolean + description: >- + Flag that indicates whether someone enabled the regionalized private + endpoint setting for the specified project. + + + - Set this value to `true` to enable regionalized private endpoints. This allows you to create more than one private endpoint in a cloud provider region. You need to enable this setting to connect to multi-region and global MongoDB Cloud sharded clusters. Enabling regionalized private endpoints introduces the following limitations: + - Your applications must use the new connection strings for existing multi-region and global sharded clusters. This might cause downtime. + - Your MongoDB Cloud project can't contain replica sets nor can you create new replica sets in this project. + + - You can't disable this setting if you have: + - more than one private endpoint in more than one region + - more than one private endpoint in one region and one private endpoint in one or more regions. + + - Set this value to `false` to disable regionalized private endpoints. + required: + - enabled + ResourceEventType: + type: string + description: Unique identifier of event type. + example: TAGS_MODIFIED + title: Resource Event Types + ApiAtlasFTSAnalyzers: + type: object + description: Settings that describe one Atlas Search custom analyzer. + properties: + charFilters: + type: array + description: Filters that examine text one character at a time and perform + filtering operations. + items: {} + name: + type: string + description: >- + Human-readable name that identifies the custom analyzer. Names must + be unique within an index, and must not start with any of the + following strings: + + - `lucene.` + + - `builtin.` + + - `mongodb.` + tokenFilters: + type: array + description: >- + Filter that performs operations such as: + + + - Stemming, which reduces related words, such as "talking", "talked", and "talks" to their root word "talk". + + + - Redaction, the removal of sensitive information from public documents. + items: {} + tokenizer: + type: object + description: Tokenizer that you want to use to create tokens. Tokens determine + how Atlas Search splits up text into discrete chunks for indexing. + properties: + maxGram: + type: integer + description: Characters to include in the longest token that Atlas Search + creates. + minGram: + type: integer + description: Characters to include in the shortest token that Atlas Search + creates. + type: + type: string + description: Human-readable label that identifies this tokenizer type. + group: + type: integer + description: Index of the character group within the matching expression to + extract into tokens. Use `0` to extract all character groups. + pattern: + type: string + description: Regular expression to match against. + maxTokenLength: + type: integer + default: 255 + description: Maximum number of characters in a single token. Tokens greater than + this length are split at this length into multiple tokens. + required: + - name + - tokenizer + title: analyzers + ApiAtlasFTSMappings: + type: object + description: Index specifications for the collection's fields. + properties: + dynamic: + type: boolean + default: false + description: Flag that indicates whether the index uses dynamic or static + mappings. Required if **mappings.fields** is omitted. + externalDocs: + description: Dynamic or Static Mappings + url: https://www.mongodb.com/docs/atlas/atlas-search/index-definitions/#field-mapping-examples + fields: + type: object + additionalProperties: + externalDocs: + description: Atlas Search Field Mappings + url: https://www.mongodb.com/docs/atlas/atlas-search/define-field-mappings/#define-field-mappings + description: One or more field specifications for the Atlas Search index. + Required if **mappings.dynamic** is omitted or set to **false**. + externalDocs: + description: Atlas Search Index + url: https://www.mongodb.com/docs/atlas/atlas-search/index-definitions/ + title: mappings + securitySchemes: + DigestAuth: + scheme: digest + type: http diff --git a/tools/openapi-generator/config/config.yaml b/tools/openapi-generator/config/config.yaml index fcfe01bee4..2947180f5a 100644 --- a/tools/openapi-generator/config/config.yaml +++ b/tools/openapi-generator/config/config.yaml @@ -5,7 +5,7 @@ gitHost: github.com templateDir: config/go-templates isGoSubmodule: true packageName: api -inputSpec: https://github.com/mongodb/atlas-sdk-go/raw/v20230201008.0.0/openapi/atlas-api-transformed.yaml +inputSpec: config/atlas-api-transformed.yaml files: cmd.mustache: templateType: API diff --git a/tools/openapi-generator/merge.js b/tools/openapi-generator/merge.js new file mode 100644 index 0000000000..7682f6f75a --- /dev/null +++ b/tools/openapi-generator/merge.js @@ -0,0 +1,56 @@ +const fs = require('fs'); +const yaml = require('js-yaml'); + +var atlasApi, atlasApiChanges; + +try { + atlasApi = yaml.load(fs.readFileSync('config/atlas-api.yaml', 'utf8')); +} catch (err) { + console.error(err); + process.exit(1); +} + +try { + atlasApiChanges = yaml.load(fs.readFileSync('config/atlas-api-changes.yaml', 'utf8')); +} catch (err) { + console.error(err); + process.exit(1); +} + +function visit(o, fn) { + let toVisit = [{path: null, value: o}]; + while (toVisit.length > 0) { + const {path, value} = toVisit.pop() + if (typeof value !== 'object') { + fn(path, value); + continue; + } + + Object.entries(value).forEach(entry => { + const [key, value] = entry; + let newPath = [key]; + if (path != null) { + newPath = [...path, key]; + } + toVisit.push({path: newPath, value: value}); + }); + } +} + +visit(atlasApiChanges, function (k, v) { + let path = atlasApi; + k.forEach((key, i) => { + path[key] ||= {}; + if (i == (k.length - 1)) { + path[key] = v; + } + path = path[key]; + }); +}); + +try { + fs.writeFileSync('config/atlas-api-transformed.yaml', yaml.dump(atlasApi), 'utf8') +} catch (err) { + console.error(err); + process.exit(1); +} \ No newline at end of file diff --git a/tools/openapi-generator/package-lock.json b/tools/openapi-generator/package-lock.json index c7238e380d..a0a0f694b2 100644 --- a/tools/openapi-generator/package-lock.json +++ b/tools/openapi-generator/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "Apache-2.0", "dependencies": { - "@openapitools/openapi-generator-cli": "^2.6.0" + "@openapitools/openapi-generator-cli": "^2.6.0", + "js-yaml": "^4.1.0" } }, "node_modules/@babel/runtime": { @@ -250,6 +251,11 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -799,6 +805,17 @@ "node": ">=6" } }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -1388,6 +1405,11 @@ "color-convert": "^2.0.1" } }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1768,6 +1790,14 @@ "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==" }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "requires": { + "argparse": "^2.0.1" + } + }, "jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index cfc48c442c..2b40be0878 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -4,9 +4,11 @@ "description": "OpenAPI Generator for MongoDB Atlas CLI", "scripts": { "generate:clear": "rm -rf ../../internal/api", + "generate:download": "SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}') curl -L -o config/atlas-api.yaml https://github.com/mongodb/atlas-sdk-go/raw/$SDKVERSION/openapi/atlas-api-transformed.yaml", + "generate:transform": "node merge.js", "generate:init": "mkdir -p ../../internal/api && cp ./config/.openapi-generator-ignore ../../internal/api/.openapi-generator-ignore", "generate:run": "GO_POST_PROCESS_FILE='goimports -w' openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api", - "generate": "npm run generate:clear && npm run generate:init && npm run generate:run" + "generate": "npm run generate:clear && npm run generate:init && npm run generate:download && npm run generate:transform && npm run generate:run" }, "repository": { "type": "git", @@ -19,6 +21,7 @@ }, "homepage": "https://github.com/mongodb/mongodb-atlas-cli#readme", "dependencies": { - "@openapitools/openapi-generator-cli": "^2.6.0" + "@openapitools/openapi-generator-cli": "^2.6.0", + "js-yaml": "^4.1.0" } } From c4709590bc382818b6b46d3440b287878c3f8a12 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 29 Sep 2023 10:29:02 +0100 Subject: [PATCH 28/44] change in command description --- internal/api/api_clusters_cmd.go | 2 +- .../config/atlas-api-changes.yaml | 2 +- .../config/atlas-api-transformed.yaml | 17824 +++++++--------- tools/openapi-generator/merge.js | 8 +- tools/openapi-generator/package-lock.json | 44 +- tools/openapi-generator/package.json | 2 +- 6 files changed, 7701 insertions(+), 10181 deletions(-) diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index cda3408428..ae75945db8 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -93,7 +93,7 @@ func createClusterBuilder() *cobra.Command { } cmd := &cobra.Command{ Use: "createCluster", - Short: "Create One Multi-Cloud Cluster from One Project", + Short: "TEST DESCRIPTION", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.PreRunE( opts.initClient(), diff --git a/tools/openapi-generator/config/atlas-api-changes.yaml b/tools/openapi-generator/config/atlas-api-changes.yaml index 4a44c2cb0f..ba06789383 100644 --- a/tools/openapi-generator/config/atlas-api-changes.yaml +++ b/tools/openapi-generator/config/atlas-api-changes.yaml @@ -1,4 +1,4 @@ paths: "/api/atlas/v2/groups/{groupId}/clusters": post: - description: TEST DESCRIPTION + summary: TEST DESCRIPTION diff --git a/tools/openapi-generator/config/atlas-api-transformed.yaml b/tools/openapi-generator/config/atlas-api-transformed.yaml index dd2d78dc1a..b44538fffd 100644 --- a/tools/openapi-generator/config/atlas-api-transformed.yaml +++ b/tools/openapi-generator/config/atlas-api-transformed.yaml @@ -5,13 +5,7 @@ info: components in MongoDB Atlas. - The Atlas Administration API uses HTTP Digest Authentication to authenticate - requests. Provide a programmatic API public key and corresponding private - key as the username and password when constructing the HTTP request. For - example, to [return database access - history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with - [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the - terminal: + The Atlas Administration API uses HTTP Digest Authentication to authenticate requests. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request. For example, to [return database access history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the terminal: ``` @@ -23,9 +17,7 @@ info: ``` - To learn more, see [Get Started with the Atlas Administration - API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, - see [MongoDB Support](https://www.mongodb.com/support/get-started). + To learn more, see [Get Started with the Atlas Administration API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, see [MongoDB Support](https://www.mongodb.com/support/get-started). license: name: CC BY-NC-SA 3.0 US url: https://creativecommons.org/licenses/by-nc-sa/3.0/us/ @@ -36,90 +28,81 @@ info: servers: - url: https://cloud.mongodb.com tags: - - description: >- - Returns access logs for authentication attempts made to Atlas database - deployments. To view database access history, you must have either the - Project Owner or Organization Owner role. + - description: Returns access logs for authentication attempts made to Atlas + database deployments. To view database access history, you must have + either the Project Owner or Organization Owner role. name: Access Tracking - - description: >- - Returns and edits the conditions that trigger alerts and how MongoDB Cloud - notifies users. This collection remains under revision and may change. + - description: Returns and edits the conditions that trigger alerts and how + MongoDB Cloud notifies users. This collection remains under revision and + may change. name: Alert Configurations - - description: >- - Returns and acknowledges alerts that MongoDB Cloud triggers based on the - alert conditions that you define. This collection remains under revision - and may change. + - description: Returns and acknowledges alerts that MongoDB Cloud triggers based + on the alert conditions that you define. This collection remains under + revision and may change. name: Alerts - - description: >- - Returns, adds, edits, and removes Atlas Search indexes for the specified - cluster. Also returns and updates user-defined analyzers for the specified - cluster. + - description: Returns, adds, edits, and removes Atlas Search indexes for the + specified cluster. Also returns and updates user-defined analyzers for the + specified cluster. name: Atlas Search - description: Returns and edits database auditing settings for MongoDB Cloud projects. name: Auditing - - description: >- - Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and - schedules. This resource applies only to clusters that use Cloud Backups. + - description: Manages Cloud Backup snapshots, snapshot export buckets, restore + jobs, and schedules. This resource applies only to clusters that use Cloud + Backups. name: Cloud Backups - - description: >- - Manages the Cloud Migration Service. Source organizations, projects, and - MongoDB clusters reside on Cloud Manager or Ops Manager. Destination - organizations, projects, and MongoDB clusters reside on MongoDB Cloud. - Source databases can't use any authentication except SCRAM-SHA. + - description: Manages the Cloud Migration Service. Source organizations, + projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. + Destination organizations, projects, and MongoDB clusters reside on + MongoDB Cloud. Source databases can't use any authentication except + SCRAM-SHA. name: Cloud Migration Service - description: Returns, adds, authorizes, and removes AWS IAM roles in Atlas. name: Cloud Provider Access - description: Returns, starts, or ends a cluster outage simulation. name: Cluster Outage Simulation - - description: >- - Returns, adds, edits, and removes database deployments. Changes to cluster - configurations can affect costs. This resource requires your Project ID. + - description: Returns, adds, edits, and removes database deployments. Changes to + cluster configurations can affect costs. This resource requires your + Project ID. name: Clusters - - description: >- - Returns and edits custom DNS configurations for MongoDB Cloud database - deployments on AWS. The resource requires your Project ID. If you use the - VPC peering on AWS and you use your own DNS servers instead of Amazon - Route 53, enable custom DNS. Before 31 March 2020, applications deployed - within AWS using custom DNS services and VPC-peered with MongoDB Cloud - couldn't connect over private IP addresses. Custom DNS resolved to public - IP addresses. AWS internal DNS resolved to private IP addresses. + - description: Returns and edits custom DNS configurations for MongoDB Cloud + database deployments on AWS. The resource requires your Project ID. If you + use the VPC peering on AWS and you use your own DNS servers instead of + Amazon Route 53, enable custom DNS. Before 31 March 2020, applications + deployed within AWS using custom DNS services and VPC-peered with MongoDB + Cloud couldn't connect over private IP addresses. Custom DNS resolved to + public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings. name: AWS Clusters DNS - - description: >- - Returns, adds, edits, and removes custom database user privilege roles. - Use custom roles to specify custom sets of actions that the MongoDB Cloud - built-in roles can't describe. You define custom roles at the project - level, for all clusters in the project. This resource supports a subset of - MongoDB privilege actions. You can create a subset of custom role actions. - To create a wider list of custom role actions, use the MongoDB Cloud user - interface. Custom roles must include actions that all project's clusters - support, and that are compatible with each MongoDB version that your - project's clusters use. For example, if your project has MongoDB 4.2 - clusters, you can't create custom roles that use actions introduced in - MongoDB 4.4. + - description: Returns, adds, edits, and removes custom database user privilege + roles. Use custom roles to specify custom sets of actions that the MongoDB + Cloud built-in roles can't describe. You define custom roles at the + project level, for all clusters in the project. This resource supports a + subset of MongoDB privilege actions. You can create a subset of custom + role actions. To create a wider list of custom role actions, use the + MongoDB Cloud user interface. Custom roles must include actions that all + project's clusters support, and that are compatible with each MongoDB + version that your project's clusters use. For example, if your project has + MongoDB 4.2 clusters, you can't create custom roles that use actions + introduced in MongoDB 4.4. name: Custom Database Roles - description: Returns, adds, edits, and removes database users. name: Database Users - - description: >- - Returns, adds, edits, and removes Federated Database Instances. This - resource requires your project ID. Changes to federated database instance - configurations can affect costs. + - description: Returns, adds, edits, and removes Federated Database Instances. + This resource requires your project ID. Changes to federated database + instance configurations can affect costs. name: Data Federation - - description: >- - Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated - runs. + - description: Returns, adds, edits, and removes Atlas Data Lake Pipelines and + associated runs. name: Data Lake Pipelines - - description: >- - Returns and edits the Encryption at Rest using Customer Key Management - configuration. MongoDB Cloud encrypts all storage whether or not you use - your own key management. + - description: Returns and edits the Encryption at Rest using Customer Key + Management configuration. MongoDB Cloud encrypts all storage whether or + not you use your own key management. name: Encryption at Rest using Customer Key Management - description: Returns events. This collection remains under revision and may change. name: Events - - description: >- - Returns, adds, edits, and removes federation-related features such as role - mappings and connected organization configurations. + - description: Returns, adds, edits, and removes federation-related features such + as role mappings and connected organization configurations. name: Federated Authentication - description: >- Returns, adds, and removes Global Cluster managed namespaces and custom @@ -130,22 +113,11 @@ tags: Similarly, deleting a managed namespace doesn't delete the associated collection. - MongoDB Cloud shards the empty collection using the required location - field and a custom shard key. For example, if your custom shard key is - `city`, the compound shard key is `location, city`. Each Global Cluster is - also associated with one or more Global Writes Zones. When a user creates - a Global Cluster, MongoDB Cloud automatically maps each location code to - the closest geographical zone. Custom zone mappings allow administrators - to override these automatic mappings. For example, a use case might - require mapping a location code to a geographically distant zone. - Administrators can manage custom zone mappings with the APIs below and the - **Global Cluster Configuration** pane when you create or modify your - Global Cluster. + MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster. name: Global Clusters - description: Returns invoices. name: Invoices - - description: >- - Returns, edits, verifies, and removes LDAP configurations. An LDAP + - description: Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud @@ -158,13 +130,12 @@ tags: name: LDAP Configuration - description: Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints. name: Legacy Backup - - description: >- - Returns, edits, and removes maintenance windows. The maintenance procedure - that MongoDB Cloud performs requires at least one replica set election - during the maintenance window per replica set. You can defer a scheduled - maintenance event for a project up to two times. Deferred maintenance - events occur during your preferred maintenance window exactly one week - after the previously scheduled date and time. + - description: Returns, edits, and removes maintenance windows. The maintenance + procedure that MongoDB Cloud performs requires at least one replica set + election during the maintenance window per replica set. You can defer a + scheduled maintenance event for a project up to two times. Deferred + maintenance events occur during your preferred maintenance window exactly + one week after the previously scheduled date and time. name: Maintenance Windows - description: Returns, adds, and edits MongoDB Cloud users. name: MongoDB Cloud Users @@ -174,54 +145,46 @@ tags: Returns, adds, edits, and removes network peering containers and peering connections. - When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the - selected provider and region or regions if no existing VPC or VPC peering - connection exists for that provider and region. Atlas assigns the VPC a - Classless Inter-Domain Routing (CIDR) block. + When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block. name: Network Peering - description: Returns, adds, edits, or removes an online archive. name: Online Archive - description: Returns, adds, and edits organizational units in MongoDB Cloud. name: Organizations - - description: >- - Returns suggested indexes and slow query data for a database deployment. - Also enables or disables MongoDB Cloud-managed slow operation thresholds. - To view field values in a sample query, you must have the Project Data - Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted - data rather than the field values. + - description: Returns suggested indexes and slow query data for a database + deployment. Also enables or disables MongoDB Cloud-managed slow operation + thresholds. To view field values in a sample query, you must have the + Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud + returns redacted data rather than the field values. name: Performance Advisor - description: Returns, adds, edits, and removes private endpoint services. name: Private Endpoint Services - - description: >- - Returns, adds, edits, and removes access tokens to use the MongoDB Cloud - API. MongoDB Cloud applies these keys to organizations. These resources - can return, assign, or revoke use of these keys within a specified - project. + - description: Returns, adds, edits, and removes access tokens to use the MongoDB + Cloud API. MongoDB Cloud applies these keys to organizations. These + resources can return, assign, or revoke use of these keys within a + specified project. name: Programmatic API Keys - - description: >- - Returns, adds, edits, and removes network access limits to database + - description: Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period. name: Project IP Access List - - description: >- - Returns, adds, and edits collections of clusters and users in MongoDB - Cloud. + - description: Returns, adds, and edits collections of clusters and users in + MongoDB Cloud. name: Projects - - description: >- - Creates one index to a database deployment in a rolling manner. You can't - create a rolling index on an `M0` free cluster or `M2/M5` shared cluster. + - description: Creates one index to a database deployment in a rolling manner. You + can't create a rolling index on an `M0` free cluster or `M2/M5` shared + cluster. name: Rolling Index - - description: >- - Returns details that describe the MongoDB Cloud build and the access token - that requests this resource. This starts the MongoDB Cloud API. + - description: Returns details that describe the MongoDB Cloud build and the + access token that requests this resource. This starts the MongoDB Cloud + API. name: Root - description: Returns, adds, edits, and removes serverless instances. name: Serverless Instances - - description: >- - Returns, adds, edits, and removes private endpoints for serverless + - description: Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial. externalDocs: @@ -230,12 +193,9 @@ tags: name: Serverless Private Endpoints - description: Returns and adds restore jobs for shared-tier database deployments. name: Shared-Tier Restore Jobs - - description: >- - Returns and requests to download shared-tier database deployment - snapshots. + - description: Returns and requests to download shared-tier database deployment snapshots. name: Shared-Tier Snapshots - - description: >- - Returns, adds, edits, and removes Streams Instances. This resource + - description: Returns, adds, edits, and removes Streams Instances. This resource requires your project ID. name: Streams - description: Returns, adds, edits, or removes teams. @@ -246,11 +206,9 @@ tags: that you configure. - **IMPORTANT**: Each project can only have one configuration per - integrationType. + **IMPORTANT**: Each project can only have one configuration per integrationType. name: Third-Party Integrations - - description: >- - Returns, edits, and removes user-managed X.509 configurations. Also + - description: Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 @@ -267,51 +225,49 @@ tags: paths: /api/atlas/v2: get: - description: >- - This resource returns information about the MongoDB application along - with API key meta data. + description: This resource returns information about the MongoDB application + along with API key meta data. operationId: getSystemStatus parameters: [] responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/SystemStatus' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/SystemStatus" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" summary: Return the status of this MongoDB application tags: - Root x-xgen-experimental: true /api/atlas/v2/alertConfigs/matchers/fieldNames: get: - description: >- - Get all field names that the `matchers.fieldName` parameter accepts when - you create or update an Alert Configuration. You can successfully call - this endpoint with any assigned role. + description: Get all field names that the `matchers.fieldName` parameter accepts + when you create or update an Alert Configuration. You can successfully + call this endpoint with any assigned role. operationId: listAlertConfigurationMatchersFieldNames parameters: [] responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/MatcherField' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/MatcherField" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Get All Alert Configuration Matchers Field Names @@ -319,28 +275,27 @@ paths: - Alert Configurations /api/atlas/v2/clusters: get: - description: >- - Returns the details for all clusters in all projects to which you have - access. Clusters contain a group of hosts that maintain the same data - set. The response does not include multi-cloud clusters. To use this - resource, the requesting API Key can have any cluster-level role. + description: Returns the details for all clusters in all projects to which you + have access. Clusters contain a group of hosts that maintain the same + data set. The response does not include multi-cloud clusters. To use + this resource, the requesting API Key can have any cluster-level role. operationId: listClustersForAllProjects parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedOrgGroup' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedOrgGroup" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Authorized Clusters in All Projects @@ -349,30 +304,29 @@ paths: x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}: delete: - description: >- - Deletes the federation settings instance and all associated data, + description: "Deletes the federation settings instance and all associated data, including identity providers and domains. To use this resource, the requesting API Key must have the Organization Owner role in the last remaining connected organization. **Note**: requests to this resource will fail if there is more than one connected organization in the - federation. + federation." operationId: deleteFederationApp parameters: - - $ref: '#/components/parameters/federationSettingsId' + - $ref: "#/components/parameters/federationSettingsId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: No Content - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Delete the federation settings instance. @@ -381,47 +335,44 @@ paths: x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs: get: - description: >- - Returns all connected org configs in the specified federation. To use - this resource, the requesting API Key must have the Organization Owner - role in one of the connected orgs. + description: Returns all connected org configs in the specified federation. To + use this resource, the requesting API Key must have the Organization + Owner role in one of the connected orgs. operationId: listConnectedOrgConfigs parameters: - - $ref: '#/components/parameters/federationSettingsId' + - $ref: "#/components/parameters/federationSettingsId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/ConnectedOrgConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z - description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + $ref: "#/components/schemas/ConnectedOrgConfig" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" summary: Return All Connected Org Configs from the Federation tags: - Federated Authentication x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}: delete: - description: >- - Removes one connected organization configuration from the specified - federation. To use this resource, the requesting API Key must have the - Organization Owner role. Note: This request fails if only one connected - organization exists in the federation. + description: "Removes one connected organization configuration from the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. Note: This request fails if only one + connected organization exists in the federation." operationId: removeConnectedOrgConfig parameters: - - $ref: '#/components/parameters/federationSettingsId' - - description: >- - Unique 24-hexadecimal digit string that identifies the connected + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove. in: path name: orgId @@ -433,21 +384,21 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Org Config Connected to One Federation @@ -455,15 +406,13 @@ paths: - Federated Authentication x-xgen-experimental: true get: - description: >- - Returns the specified connected org config from the specified + description: Returns the specified connected org config from the specified federation. To use this resource, the requesting API Key must have the Organization Owner role in the connected org. operationId: getConnectedOrgConfig parameters: - - $ref: '#/components/parameters/federationSettingsId' - - description: >- - Unique 24-hexadecimal digit string that identifies the connected + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the connected organization configuration to return. in: path name: orgId @@ -475,21 +424,21 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ConnectedOrgConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ConnectedOrgConfig" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Org Config Connected to One Federation @@ -503,22 +452,17 @@ paths: Organization Owner role. - **Note** If the organization configuration has no associated identity - provider, you can't use this resource to update role mappings or post - authorization role grants. + **Note** If the organization configuration has no associated identity provider, you can't use this resource to update role mappings or post authorization role grants. - **Note**: The domainRestrictionEnabled field defaults to false if not - provided in the request. + **Note**: The domainRestrictionEnabled field defaults to false if not provided in the request. - **Note**: If the identityProviderId field is not provided, you will - disconnect the organization and the identity provider. + **Note**: If the identityProviderId field is not provided, you will disconnect the organization and the identity provider. operationId: updateConnectedOrgConfig parameters: - - $ref: '#/components/parameters/federationSettingsId' - - description: >- - Unique 24-hexadecimal digit string that identifies the connected + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the connected organization configuration to update. in: path name: orgId @@ -533,25 +477,25 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ConnectedOrgConfig' + $ref: "#/components/schemas/ConnectedOrgConfig" description: The connected organization configuration that you want to update. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ConnectedOrgConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ConnectedOrgConfig" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Org Config Connected to One Federation @@ -560,32 +504,31 @@ paths: x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings: get: - description: >- - Returns all role mappings from the specified organization in the + description: Returns all role mappings from the specified organization in the specified federation. To use this resource, the requesting API Key must have the Organization Owner role. operationId: listRoleMappings parameters: - - $ref: '#/components/parameters/federationSettingsId' - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/orgId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/AuthFederationRoleMapping' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AuthFederationRoleMapping" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Role Mappings from One Organization @@ -593,37 +536,36 @@ paths: - Federated Authentication x-xgen-experimental: true post: - description: >- - Adds one role mapping to the specified organization in the specified - federation. To use this resource, the requesting API Key must have the - Organization Owner role. + description: Adds one role mapping to the specified organization in the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. operationId: createRoleMapping parameters: - - $ref: '#/components/parameters/federationSettingsId' - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AuthFederationRoleMapping' + $ref: "#/components/schemas/AuthFederationRoleMapping" description: The role mapping that you want to create. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AuthFederationRoleMapping' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AuthFederationRoleMapping" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Add One Role Mapping to One Organization @@ -632,15 +574,13 @@ paths: x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}/roleMappings/{id}: delete: - description: >- - Removes one role mapping in the specified organization from the + description: Removes one role mapping in the specified organization from the specified federation. To use this resource, the requesting API Key must have the Organization Owner role. operationId: deleteRoleMapping parameters: - - $ref: '#/components/parameters/federationSettingsId' - - description: >- - Unique 24-hexadecimal digit string that identifies the role mapping + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove. in: path name: id @@ -651,21 +591,21 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: No Content - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Role Mapping from One Organization @@ -673,15 +613,13 @@ paths: - Federated Authentication x-xgen-experimental: true get: - description: >- - Returns one role mapping from the specified organization in the + description: Returns one role mapping from the specified organization in the specified federation. To use this resource, the requesting API Key must have the Organization Owner role. operationId: getRoleMapping parameters: - - $ref: '#/components/parameters/federationSettingsId' - - description: >- - Unique 24-hexadecimal digit string that identifies the role mapping + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the role mapping that you want to return. in: path name: id @@ -692,23 +630,23 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AuthFederationRoleMapping' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AuthFederationRoleMapping" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Role Mapping from One Organization @@ -716,15 +654,13 @@ paths: - Federated Authentication x-xgen-experimental: true put: - description: >- - Updates one role mapping in the specified organization in the specified - federation. To use this resource, the requesting API Key must have the - Organization Owner role. + description: Updates one role mapping in the specified organization in the + specified federation. To use this resource, the requesting API Key must + have the Organization Owner role. operationId: updateRoleMapping parameters: - - $ref: '#/components/parameters/federationSettingsId' - - description: >- - Unique 24-hexadecimal digit string that identifies the role mapping + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the role mapping that you want to update. in: path name: id @@ -735,30 +671,30 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AuthFederationRoleMapping' + $ref: "#/components/schemas/AuthFederationRoleMapping" description: The role mapping that you want to update. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AuthFederationRoleMapping' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AuthFederationRoleMapping" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Role Mapping in One Organization @@ -767,31 +703,30 @@ paths: x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders: get: - description: >- - Returns all identity providers in the specified federation. To use this - resource, the requesting API Key must have the Organization Owner role - in one of the connected organizations. + description: Returns all identity providers in the specified federation. To use + this resource, the requesting API Key must have the Organization Owner + role in one of the connected organizations. operationId: listIdentityProviders parameters: - - $ref: '#/components/parameters/federationSettingsId' + - $ref: "#/components/parameters/federationSettingsId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/FederationIdentityProvider' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/FederationIdentityProvider" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return all identity providers from the specified federation. @@ -800,30 +735,29 @@ paths: x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}: get: - description: >- - Returns one identity provider from the specified federation. To use this - resource, the requesting API Key must have the Organization Owner role - in one of the connected organizations. + description: Returns one identity provider from the specified federation. To use + this resource, the requesting API Key must have the Organization Owner + role in one of the connected organizations. operationId: getIdentityProvider parameters: - - $ref: '#/components/parameters/federationSettingsId' - - $ref: '#/components/parameters/identityProviderId' + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/identityProviderId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/FederationIdentityProvider' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/FederationIdentityProvider" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return one identity provider from the specified federation. @@ -831,37 +765,36 @@ paths: - Federated Authentication x-xgen-experimental: true patch: - description: >- - Updates one identity provider in the specified federation. To use this - resource, the requesting API Key must have the Organization Owner role - in one of the connected organizations. + description: Updates one identity provider in the specified federation. To use + this resource, the requesting API Key must have the Organization Owner + role in one of the connected organizations. operationId: updateIdentityProvider parameters: - - $ref: '#/components/parameters/federationSettingsId' - - $ref: '#/components/parameters/identityProviderId' + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/identityProviderId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/SamlIdentityProviderUpdate' + $ref: "#/components/schemas/SamlIdentityProviderUpdate" description: The identity provider that you want to update. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/FederationIdentityProvider' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/FederationIdentityProvider" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update the identity provider. @@ -870,79 +803,74 @@ paths: x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}/metadata.xml: get: - description: >- - Returns the metadata of one identity provider in the specified + description: Returns the metadata of one identity provider in the specified federation. To use this resource, the requesting API Key must have the Organization Owner role in one of the connected organizations. operationId: getIdentityProviderMetadata parameters: - - $ref: '#/components/parameters/federationSettingsId' - - $ref: '#/components/parameters/identityProviderId' + - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/identityProviderId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: string - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Return the metadata of one identity provider in the specified - federation. + summary: Return the metadata of one identity provider in the specified federation. tags: - Federated Authentication x-xgen-experimental: true /api/atlas/v2/groups: get: - description: >- - Returns details about all projects. Projects group clusters into logical - collections that support an application environment, workload, or both. - Each project can have its own users, teams, security, and alert + description: Returns details about all projects. Projects group clusters into + logical collections that support an application environment, workload, + or both. Each project can have its own users, teams, security, and alert settings. To use this resource, the requesting API Key must have the Read Write role. operationId: listProjects parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedAtlasGroup' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAtlasGroup" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" summary: Return All Projects tags: - Projects post: - description: >- - Creates one project. Projects group clusters into logical collections - that support an application environment, workload, or both. Each project - can have its own users, teams, security, and alert settings. To use this - resource, the requesting API Key must have the Read Write role. + description: Creates one project. Projects group clusters into logical + collections that support an application environment, workload, or both. + Each project can have its own users, teams, security, and alert + settings. To use this resource, the requesting API Key must have the + Read Write role. operationId: createProject parameters: - - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - user to whom to grant the Project Owner role on the specified + - description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. in: query @@ -956,29 +884,29 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Group' + $ref: "#/components/schemas/Group" description: Creates one project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Group' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/Group" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Project @@ -986,12 +914,11 @@ paths: - Projects /api/atlas/v2/groups/byName/{groupName}: get: - description: >- - Returns details about the specified project. Projects group clusters - into logical collections that support an application environment, - workload, or both. Each project can have its own users, teams, security, - and alert settings. To use this resource, the requesting API Key must - have the Project Read Only role. + description: Returns details about the specified project. Projects group + clusters into logical collections that support an application + environment, workload, or both. Each project can have its own users, + teams, security, and alert settings. To use this resource, the + requesting API Key must have the Project Read Only role. operationId: getProjectByName parameters: - description: Human-readable label that identifies this project. @@ -1003,30 +930,29 @@ paths: maxLength: 64 minLength: 1 responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Group' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/Group" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" summary: Return One Project using Its Name tags: - Projects /api/atlas/v2/groups/{groupId}: delete: - description: >- - Removes the specified project. Projects group clusters into logical + description: Removes the specified project. Projects group clusters into logical collections that support an application environment, workload, or both. Each project can have its own users, teams, security, and alert settings. You can delete a project only if there are no Online Archives @@ -1034,88 +960,86 @@ paths: API Key must have the Project Owner role. operationId: deleteProject parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Project tags: - Projects get: - description: >- - Returns details about the specified project. Projects group clusters - into logical collections that support an application environment, - workload, or both. Each project can have its own users, teams, security, - and alert settings. To use this resource, the requesting API Key must - have the Project Read Only role. + description: Returns details about the specified project. Projects group + clusters into logical collections that support an application + environment, workload, or both. Each project can have its own users, + teams, security, and alert settings. To use this resource, the + requesting API Key must have the Project Read Only role. operationId: getProject parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Group' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/Group" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Project tags: - Projects patch: - description: >- - Updates the human-readable label that identifies the specified project. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Updates the human-readable label that identifies the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. operationId: updateProject parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupName' + $ref: "#/components/schemas/GroupName" description: Project to update. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Group' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/Group" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Project Name @@ -1124,96 +1048,92 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/accessList: get: - description: >- - Returns all access list entries from the specified project's IP access - list. Each entry in the project's IP access list contains either one IP - address or one CIDR-notated block of IP addresses. MongoDB Cloud only - allows client connections to the cluster from entries in the project's - IP access list. To use this resource, the requesting API Key must have - the Project Read Only or Project Charts Admin roles. This resource - replaces the whitelist resource. MongoDB Cloud removed whitelists in - July 2021. Update your applications to use this new resource. The - `/groups/{GROUP-ID}/accessList` endpoint manages the database IP access - list. This endpoint is distinct from the + description: Returns all access list entries from the specified project's IP + access list. Each entry in the project's IP access list contains either + one IP address or one CIDR-notated block of IP addresses. MongoDB Cloud + only allows client connections to the cluster from entries in the + project's IP access list. To use this resource, the requesting API Key + must have the Project Read Only or Project Charts Admin roles. This + resource replaces the whitelist resource. MongoDB Cloud removed + whitelists in July 2021. Update your applications to use this new + resource. The `/groups/{GROUP-ID}/accessList` endpoint manages the + database IP access list. This endpoint is distinct from the `orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist` endpoint, which manages the access list for MongoDB Cloud organizations. externalDocs: description: IP access list - url: >- - https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + url: https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list operationId: listProjectIpAccessLists parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedNetworkAccess' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedNetworkAccess" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Project IP Access List tags: - Project IP Access List post: - description: >- - Adds one or more access list entries to the specified project. MongoDB - Cloud only allows client connections to the cluster from entries in the - project's IP access list. Write each entry as either one IP address or - one CIDR-notated block of IP addresses. To use this resource, the - requesting API Key must have the Project Owner or Project Charts Admin - roles. This resource replaces the whitelist resource. MongoDB Cloud - removed whitelists in July 2021. Update your applications to use this - new resource. The `/groups/{GROUP-ID}/accessList` endpoint manages the - database IP access list. This endpoint is distinct from the + description: Adds one or more access list entries to the specified project. + MongoDB Cloud only allows client connections to the cluster from entries + in the project's IP access list. Write each entry as either one IP + address or one CIDR-notated block of IP addresses. To use this resource, + the requesting API Key must have the Project Owner or Project Charts + Admin roles. This resource replaces the whitelist resource. MongoDB + Cloud removed whitelists in July 2021. Update your applications to use + this new resource. The `/groups/{GROUP-ID}/accessList` endpoint manages + the database IP access list. This endpoint is distinct from the `orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist` endpoint, which manages the access list for MongoDB Cloud organizations. This endpoint doesn't support concurrent `POST` requests. You must submit multiple `POST` requests synchronously. externalDocs: description: IP access list - url: >- - https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + url: https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list operationId: createProjectIpAccessList parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/NetworkPermissionEntry' + $ref: "#/components/schemas/NetworkPermissionEntry" description: One or more access list entries to add to the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedNetworkAccess' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedNetworkAccess" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Add Entries to Project IP Access List @@ -1221,9 +1141,8 @@ paths: - Project IP Access List /api/atlas/v2/groups/{groupId}/accessList/{entryValue}: delete: - description: >- - Removes one access list entry from the specified project's IP access - list. Each entry in the project's IP access list contains one IP + description: Removes one access list entry from the specified project's IP + access list. Each entry in the project's IP access list contains one IP address, one CIDR-notated block of IP addresses, or one AWS Security Group ID. MongoDB Cloud only allows client connections to the cluster from entries in the project's IP access list. To use this resource, the @@ -1236,11 +1155,10 @@ paths: the access list for MongoDB Cloud organizations. externalDocs: description: IP access list - url: >- - https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + url: https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list operationId: deleteProjectIpAccessList parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: >- Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS @@ -1263,86 +1181,79 @@ paths: required: true schema: type: string - example: >- - IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 - or IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or - AWS SG: sg-903004f8 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + example: "IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 or + IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or AWS + SG: sg-903004f8" + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Entry from One Project IP Access List tags: - Project IP Access List get: - description: >- - Returns one access list entry from the specified project's IP access - list. Each entry in the project's IP access list contains either one IP - address or one CIDR-notated block of IP addresses. MongoDB Cloud only - allows client connections to the cluster from entries in the project's - IP access list. To use this resource, the requesting API Key must have - the Project Read Only or Project Charts Admin roles. This resource - replaces the whitelist resource. MongoDB Cloud removed whitelists in - July 2021. Update your applications to use this new resource. This - endpoint (`/groups/{GROUP-ID}/accessList`) manages the Project IP Access - List. It doesn't manage the access list for MongoDB Cloud organizations. - TheProgrammatic API Keys endpoint + description: Returns one access list entry from the specified project's IP + access list. Each entry in the project's IP access list contains either + one IP address or one CIDR-notated block of IP addresses. MongoDB Cloud + only allows client connections to the cluster from entries in the + project's IP access list. To use this resource, the requesting API Key + must have the Project Read Only or Project Charts Admin roles. This + resource replaces the whitelist resource. MongoDB Cloud removed + whitelists in July 2021. Update your applications to use this new + resource. This endpoint (`/groups/{GROUP-ID}/accessList`) manages the + Project IP Access List. It doesn't manage the access list for MongoDB + Cloud organizations. TheProgrammatic API Keys endpoint (`/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist`) manages those access lists. externalDocs: description: IP access list - url: >- - https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list + url: https://docs.atlas.mongodb.com/security/ip-access-list/#std-label-access-list operationId: getProjectIpList parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Access list entry that you want to return from the project's IP + - $ref: "#/components/parameters/groupId" + - description: "Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash - (`/`) with its URL-encoded value (`%2F`). + (`/`) with its URL-encoded value (`%2F`)." in: path name: entryValue required: true schema: type: string - example: >- - IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 - or IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or - AWS SG: sg-903004f8 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + example: "IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 or + IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or AWS + SG: sg-903004f8" + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NetworkPermissionEntry' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NetworkPermissionEntry" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Project IP Access List Entry @@ -1350,45 +1261,41 @@ paths: - Project IP Access List /api/atlas/v2/groups/{groupId}/accessList/{entryValue}/status: get: - description: >- - Returns the status of one project IP access list entry. This resource - checks if the provided project IP access list entry applies to all cloud - providers serving clusters from the specified project. + description: Returns the status of one project IP access list entry. This + resource checks if the provided project IP access list entry applies to + all cloud providers serving clusters from the specified project. operationId: getProjectIpAccessListStatus parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Network address or cloud provider security construct that identifies - which project access list entry to be verified. + - $ref: "#/components/parameters/groupId" + - description: Network address or cloud provider security construct that + identifies which project access list entry to be verified. in: path name: entryValue required: true schema: type: string - example: >- - IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 - or IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or - AWS SG: sg-903004f8 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ + example: "IPv4: 192.0.2.0%2F24 or IPv6: 2001:db8:85a3:8d3:1319:8a2e:370:7348 or + IPv4 CIDR: 198.51.100.0%2f24 or IPv6 CIDR: 2001:db8::%2f58 or AWS + SG: sg-903004f8" + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})|(sg\-[a-f0-9]{8})?$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NetworkPermissionEntryStatus' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NetworkPermissionEntryStatus" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Status of One Project IP Access List Entry @@ -1408,22 +1315,22 @@ paths: This resource remains under revision and may change. operationId: listAlertConfigurations parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedAlertConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAlertConfig" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Alert Configurations for One Project @@ -1440,28 +1347,28 @@ paths: This resource remains under revision and may change. operationId: createAlertConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupAlertsConfig' + $ref: "#/components/schemas/GroupAlertsConfig" description: Creates one alert configuration for the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupAlertsConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupAlertsConfig" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Alert Configuration in One Project @@ -1478,9 +1385,8 @@ paths: This resource remains under revision and may change. operationId: deleteAlertConfiguration parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the alert + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the @@ -1495,17 +1401,17 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: No Content - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Alert Configuration from One Project @@ -1521,9 +1427,8 @@ paths: This resource remains under revision and may change. operationId: getAlertConfiguration parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the alert + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the @@ -1538,19 +1443,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupAlertsConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupAlertsConfig" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Alert Configuration from One Project @@ -1567,18 +1472,14 @@ paths: role. - **NOTE**: This endpoint updates only the enabled/disabled state for the - alert configuration. To update more than just this configuration, see - [Update One Alert - Configuration](#tag/Alert-Configurations/operation/updateAlertConfiguration). + **NOTE**: This endpoint updates only the enabled/disabled state for the alert configuration. To update more than just this configuration, see [Update One Alert Configuration](#tag/Alert-Configurations/operation/updateAlertConfiguration). This resource remains under revision and may change. operationId: toggleAlertConfiguration parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the alert + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the @@ -1596,25 +1497,24 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AlertsToggle' - description: >- - Enables or disables the specified alert configuration in the specified - project. + $ref: "#/components/schemas/AlertsToggle" + description: Enables or disables the specified alert configuration in the + specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupAlertsConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupAlertsConfig" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Toggle One State of One Alert Configuration in One Project @@ -1628,17 +1528,14 @@ paths: Owner or Project Owner role. - **NOTE**: To enable or disable the alert configuration, see [Toggle One - State of One Alert Configuration in One - Project](#tag/Alert-Configurations/operation/toggleAlertConfiguration). + **NOTE**: To enable or disable the alert configuration, see [Toggle One State of One Alert Configuration in One Project](#tag/Alert-Configurations/operation/toggleAlertConfiguration). This resource remains under revision and may change. operationId: updateAlertConfiguration parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the alert + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the @@ -1656,25 +1553,25 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupAlertsConfig' + $ref: "#/components/schemas/GroupAlertsConfig" description: Updates one alert configuration in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupAlertsConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupAlertsConfig" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Alert Configuration for One Project @@ -1693,12 +1590,11 @@ paths: This resource remains under revision and may change. operationId: listAlertsByAlertConfigurationId parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Unique 24-hexadecimal digit string that identifies the alert + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the @@ -1713,19 +1609,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedAlert' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAlert" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Open Alerts for Alert Configuration @@ -1744,31 +1640,30 @@ paths: This resource remains under revision and may change. operationId: listAlerts parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Status of the alerts to return. Omit to return all alerts in all + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Status of the alerts to return. Omit to return all alerts in all statuses. in: query name: status schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedAlert' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAlert" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Alerts from One Project @@ -1786,9 +1681,8 @@ paths: This resource remains under revision and may change. operationId: getAlert parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the alert. Use + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access. in: path @@ -1800,19 +1694,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AlertViewForNdsGroup' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AlertViewForNdsGroup" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Alert from One Project @@ -1831,9 +1725,8 @@ paths: This resource remains under revision and may change. operationId: acknowledgeAlert parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the alert. Use + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access. in: path @@ -1848,25 +1741,25 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AlertViewForNdsGroup' + $ref: "#/components/schemas/AlertViewForNdsGroup" description: Confirm one alert. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AlertViewForNdsGroup' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AlertViewForNdsGroup" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Acknowledge One Alert from One Project @@ -1883,12 +1776,11 @@ paths: This resource remains under revision and may change. operationId: listAlertConfigurationsByAlertId parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Unique 24-hexadecimal digit string that identifies the alert. Use + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access. in: path @@ -1900,19 +1792,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedAlertConfig' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAlertConfig" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Alert Configurations Set for One Alert @@ -1921,70 +1813,66 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/apiKeys: get: - description: >- - Returns all organization API keys that you assigned to the specified - project. Users with the Project Owner role in the project associated - with the API key can use the organization API key to access the - resources. To use this resource, the requesting API Key must have the - Project User Admin role. + description: Returns all organization API keys that you assigned to the + specified project. Users with the Project Owner role in the project + associated with the API key can use the organization API key to access + the resources. To use this resource, the requesting API Key must have + the Project User Admin role. externalDocs: description: Programmatic API Keys - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key operationId: listProjectApiKeys parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiApiUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiApiUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Organization API Keys Assigned to One Project tags: - Programmatic API Keys post: - description: >- - Creates and assigns the specified organization API key to the specified - project. Users with the Project Owner role in the project associated - with the API key can use the organization API key to access the - resources. To use this resource, the requesting API Key must have the - Project User Admin role. + description: Creates and assigns the specified organization API key to the + specified project. Users with the Project Owner role in the project + associated with the API key can use the organization API key to access + the resources. To use this resource, the requesting API Key must have + the Project User Admin role. operationId: createProjectApiKey parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CreateAtlasProjectApiKey' - description: >- - Organization API key to be created and assigned to the specified + $ref: "#/components/schemas/CreateAtlasProjectApiKey" + description: Organization API key to be created and assigned to the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiKeyUserDetails' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create and Assign One Organization API Key to One Project @@ -1992,19 +1880,17 @@ paths: - Programmatic API Keys /api/atlas/v2/groups/{groupId}/apiKeys/{apiUserId}: delete: - description: >- - Removes one organization API key from the specified project. To use this - resource, the requesting API Key must have the Project User Admin role. + description: Removes one organization API key from the specified project. To use + this resource, the requesting API Key must have the Project User Admin + role. externalDocs: description: Programmatic API Keys - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key operationId: removeProjectApiKey parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key that you want to unassign from one project. + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key that you want to unassign from one project. in: path name: apiUserId required: true @@ -2014,40 +1900,38 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Unassign One Organization API Key from One Project tags: - Programmatic API Keys patch: - description: >- - Updates the roles of the organization API key that you specify for the - project that you specify. You must specify at least one valid role for - the project. The application removes any roles that you do not include - in this request if they were previously set in the organization API key - that you specify for the project. + description: Updates the roles of the organization API key that you specify for + the project that you specify. You must specify at least one valid role + for the project. The application removes any roles that you do not + include in this request if they were previously set in the organization + API key that you specify for the project. operationId: updateApiKeyRoles parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/pageNum' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/includeCount' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key that you want to unassign from one project. + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/pageNum" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/includeCount" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key that you want to unassign from one project. in: path name: apiUserId required: true @@ -2060,43 +1944,40 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UpdateAtlasProjectApiKey' - description: >- - Organization API Key to be updated. This request requires a minimum of - one of the two body parameters. + $ref: "#/components/schemas/UpdateAtlasProjectApiKey" + description: Organization API Key to be updated. This request requires a minimum + of one of the two body parameters. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiKeyUserDetails' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Roles of One Organization API Key to One Project tags: - Programmatic API Keys post: - description: >- - Assigns the specified organization API key to the specified project. - Users with the Project Owner role in the project associated with the API - key can then use the organization API key to access the resources. To - use this resource, the requesting API Key must have the Project User - Admin role. + description: Assigns the specified organization API key to the specified + project. Users with the Project Owner role in the project associated + with the API key can then use the organization API key to access the + resources. To use this resource, the requesting API Key must have the + Project User Admin role. operationId: addProjectApiKey parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key that you want to assign to one project. + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key that you want to assign to one project. in: path name: apiUserId required: true @@ -2111,21 +1992,21 @@ paths: schema: type: array items: - $ref: '#/components/schemas/UserAccessRoleAssignment' + $ref: "#/components/schemas/UserAccessRoleAssignment" description: Organization API key to be assigned to the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiKeyUserDetails' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Assign One Organization API Key to One Project @@ -2134,63 +2015,61 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/auditLog: get: - description: >- - Returns the auditing configuration for the specified project. The + description: Returns the auditing configuration for the specified project. The auditing configuration defines the events that MongoDB Cloud records in the audit log. To use this resource, the requesting API Key must have the Project Owner role. This feature isn't available for `M0`, `M2`, `M5`, or serverless clusters. operationId: getAuditingConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AuditLog' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AuditLog" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return the Auditing Configuration for One Project tags: - Auditing patch: - description: >- - Updates the auditing configuration for the specified project. The + description: Updates the auditing configuration for the specified project. The auditing configuration defines the events that MongoDB Cloud records in the audit log. To use this resource, the requesting API Key must have the Project Owner role. This feature isn't available for `M0`, `M2`, `M5`, or serverless clusters. operationId: updateAuditingConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AuditLog' + $ref: "#/components/schemas/AuditLog" description: Updated auditing configuration for the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AuditLog' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AuditLog" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Auditing Configuration for One Project @@ -2198,60 +2077,57 @@ paths: - Auditing /api/atlas/v2/groups/{groupId}/awsCustomDNS: get: - description: >- - Returns the custom DNS configuration for AWS clusters in the specified - project. To use this resource, the requesting API Key must have the - Project Read Only role. + description: Returns the custom DNS configuration for AWS clusters in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. operationId: getAWSCustomDNS parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AWSCustomDNSEnabled' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AWSCustomDNSEnabled" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Custom DNS Configuration for Atlas Clusters on AWS tags: - AWS Clusters DNS patch: - description: >- - Enables or disables the custom DNS configuration for AWS clusters in the - specified project. Enable custom DNS if you use AWS VPC peering and use - your own DNS servers. To use this resource, the requesting API Key must - have the Project Atlas Admin role. + description: Enables or disables the custom DNS configuration for AWS clusters + in the specified project. Enable custom DNS if you use AWS VPC peering + and use your own DNS servers. To use this resource, the requesting API + Key must have the Project Atlas Admin role. operationId: toggleAWSCustomDNS parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AWSCustomDNSEnabled' - description: >- - Enables or disables the custom DNS configuration for AWS clusters in - the specified project. + $ref: "#/components/schemas/AWSCustomDNSEnabled" + description: Enables or disables the custom DNS configuration for AWS clusters + in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AWSCustomDNSEnabled' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AWSCustomDNSEnabled" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS @@ -2259,64 +2135,62 @@ paths: - AWS Clusters DNS /api/atlas/v2/groups/{groupId}/backup/exportBuckets: get: - description: >- - Returns all AWS S3 buckets associated with the specified project. To use - this resource, the requesting API Key must have the Project Read Only - role. + description: Returns all AWS S3 buckets associated with the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. operationId: listExportBuckets parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedBackupSnapshotExportBucket' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedBackupSnapshotExportBucket" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports tags: - Cloud Backups post: - description: >- - Grants MongoDB Cloud access to the specified AWS S3 bucket. This enables - this bucket to receive Atlas Cloud Backup snapshots. To use this + description: Grants MongoDB Cloud access to the specified AWS S3 bucket. This + enables this bucket to receive Atlas Cloud Backup snapshots. To use this resource, the requesting API Key must have the Project Owner role. operationId: createExportBucket parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotAWSExportBucket' + $ref: "#/components/schemas/DiskBackupSnapshotAWSExportBucket" description: Grants MongoDB Cloud access to the specified AWS S3 bucket. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotAWSExportBucket' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupSnapshotAWSExportBucket" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports @@ -2324,15 +2198,13 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/backup/exportBuckets/{exportBucketId}: delete: - description: >- - Revoke MongoDB Cloud access to the specified AWS S3 bucket. This + description: Revoke MongoDB Cloud access to the specified AWS S3 bucket. This prevents this bucket to receive Atlas Cloud Backup snapshots. To use this resource, the requesting API Key must have the Project Owner role. operationId: deleteExportBucket parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique string that identifies the AWS S3 bucket to which you export + - $ref: "#/components/parameters/groupId" + - description: Unique string that identifies the AWS S3 bucket to which you export your snapshots. in: path name: exportBucketId @@ -2343,36 +2215,34 @@ paths: minLength: 3 pattern: ^((?!xn--)(?!.*-s3alias)[a-z0-9][a-z0-9-]{1,61}[a-z0-9])$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports tags: - Cloud Backups get: - description: >- - Returns one AWS S3 bucket associated with the specified project. To use - this resource, the requesting API Key must have the Project Read Only - role. + description: Returns one AWS S3 bucket associated with the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. operationId: getExportBucket parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique string that identifies the AWS S3 bucket to which you export + - $ref: "#/components/parameters/groupId" + - description: Unique string that identifies the AWS S3 bucket to which you export your snapshots. in: path name: exportBucketId @@ -2383,19 +2253,19 @@ paths: minLength: 3 pattern: ^((?!xn--)(?!.*-s3alias)[a-z0-9][a-z0-9-]{1,61}[a-z0-9])$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotAWSExportBucket' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupSnapshotAWSExportBucket" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports @@ -2403,62 +2273,60 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/backupCompliancePolicy: get: - description: >- - Returns the Backup Compliance Policy settings with the specified + description: Returns the Backup Compliance Policy settings with the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: getDataProtectionSettings parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataProtectionSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataProtectionSettings" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return the Backup Compliance Policy settings tags: - Cloud Backups put: - description: >- - Updates the Backup Compliance Policy settings for the specified project. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Updates the Backup Compliance Policy settings for the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. operationId: updateDataProtectionSettings parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataProtectionSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataProtectionSettings" + x-xgen-version: 2023-01-01 description: The new Backup Compliance Policy settings. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataProtectionSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataProtectionSettings" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update or enable the Backup Compliance Policy settings @@ -2466,61 +2334,59 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/cloudProviderAccess: get: - description: >- - Returns all cloud provider access roles with access to the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + description: Returns all cloud provider access roles with access to the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. operationId: listCloudProviderAccessRoles parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderAccessRoles' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudProviderAccessRoles" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Cloud Provider Access Roles tags: - Cloud Provider Access post: - description: >- - Creates one access role for the specified cloud provider. Some MongoDB - Cloud features use these cloud provider access roles for authentication. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Creates one access role for the specified cloud provider. Some + MongoDB Cloud features use these cloud provider access roles for + authentication. To use this resource, the requesting API Key must have + the Project Owner role. externalDocs: description: Set Up Access to Cloud Providers url: https://www.mongodb.com/docs/atlas/security/cloud-provider-access/ operationId: createCloudProviderAccessRole parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderAccessRole' + $ref: "#/components/schemas/CloudProviderAccessRole" description: Creates one role for the specified cloud provider. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderAccessRole' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudProviderAccessRole" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Cloud Provider Access Role @@ -2528,15 +2394,13 @@ paths: - Cloud Provider Access /api/atlas/v2/groups/{groupId}/cloudProviderAccess/{cloudProvider}/{roleId}: delete: - description: >- - Revokes access to the specified project for the specified access role. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Revokes access to the specified project for the specified access + role. To use this resource, the requesting API Key must have the Project + Owner role. operationId: deauthorizeCloudProviderAccessRole parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cloud provider of the role + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cloud provider of the role to deauthorize. in: path name: cloudProvider @@ -2553,17 +2417,17 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: No Content - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Deauthorize One Cloud Provider Access Role @@ -2571,13 +2435,12 @@ paths: - Cloud Provider Access /api/atlas/v2/groups/{groupId}/cloudProviderAccess/{roleId}: get: - description: >- - Returns the access role with the specified id and with access to the - specified project. To use this resource, the requesting API Key must + description: Returns the access role with the specified id and with access to + the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: getCloudProviderAccessRole parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Unique 24-hexadecimal digit string that identifies the role. in: path name: roleId @@ -2588,17 +2451,17 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderAccessRole' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudProviderAccessRole" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return specified Cloud Provider Access Role @@ -2606,17 +2469,16 @@ paths: - Cloud Provider Access x-xgen-experimental: true patch: - description: >- - Grants access to the specified project for the specified access role. To - use this resource, the requesting API Key must have the Project Owner - role. This API endpoint is one step in a procedure to create unified - access for MongoDB Cloud services. + description: Grants access to the specified project for the specified access + role. To use this resource, the requesting API Key must have the Project + Owner role. This API endpoint is one step in a procedure to create + unified access for MongoDB Cloud services. externalDocs: description: Set Up Access to Cloud Providers url: https://www.mongodb.com/docs/atlas/security/cloud-provider-access/ operationId: authorizeCloudProviderAccessRole parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Unique 24-hexadecimal digit string that identifies the role. in: path name: roleId @@ -2630,25 +2492,25 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderAccessRole' + $ref: "#/components/schemas/CloudProviderAccessRole" description: Grants access to the specified project for the specified access role. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderAccessRole' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudProviderAccessRole" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Authorize One Cloud Provider Access Role @@ -2656,19 +2518,18 @@ paths: - Cloud Provider Access /api/atlas/v2/groups/{groupId}/clusters: get: - description: >- - Returns the details for all clusters in the specific project to which - you have access. Clusters contain a group of hosts that maintain the - same data set. The response includes multi-cloud clusters. To use this - resource, the requesting API Key must have the Project Read Only role. - This feature is not available for serverless clusters. Deprecated - versions: v2-{2023-01-01} + description: "Returns the details for all clusters in the specific project to + which you have access. Clusters contain a group of hosts that maintain + the same data set. The response includes multi-cloud clusters. To use + this resource, the requesting API Key must have the Project Read Only + role. This feature is not available for serverless clusters. Deprecated + versions: v2-{2023-01-01}" operationId: listClusters parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Flag that indicates whether to return Clusters with retain backups. in: query name: includeDeletedWithRetainedBackups @@ -2676,27 +2537,32 @@ paths: type: boolean default: false responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/PaginatedAdvancedClusterDescription' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAdvancedClusterDescription" + x-xgen-version: 2023-02-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Clusters in One Project tags: - Clusters post: - description: TEST DESCRIPTION + description: "Creates one cluster in the specified project. Clusters contain a + group of hosts that maintain the same data set. This resource can create + multi-cloud clusters. Each project supports up to 25 database + deployments. To use this resource, the requesting API Key must have the + Project Owner role. This feature is not available for serverless + clusters. Deprecated versions: v2-{2023-01-01}" operationId: createCluster parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-02-01+json: @@ -2782,50 +2648,48 @@ paths: regionName: EASTERN_US zoneName: Zone 1 schema: - $ref: '#/components/schemas/AdvancedClusterDescription' + $ref: "#/components/schemas/AdvancedClusterDescription" description: Cluster to create in the specific project. required: true responses: - '201': + "201": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/AdvancedClusterDescription' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/AdvancedClusterDescription" + x-xgen-version: 2023-02-01 description: Created - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '402': - $ref: '#/components/responses/paymentRequired' - '403': - $ref: '#/components/responses/forbidden' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' - security: - - DigestAuth: [] - summary: Create One Multi-Cloud Cluster from One Project + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "402": + $ref: "#/components/responses/paymentRequired" + "403": + $ref: "#/components/responses/forbidden" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: TEST DESCRIPTION tags: - Clusters /api/atlas/v2/groups/{groupId}/clusters/provider/regions: get: - description: >- - Returns the list of regions available for the specified cloud provider - at the specified tier. To use this resource, the requesting API Key must - have the Project Read Only role. + description: Returns the list of regions available for the specified cloud + provider at the specified tier. To use this resource, the requesting API + Key must have the Project Read Only role. operationId: listCloudProviderRegions parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Cloud providers whose regions to retrieve. When you specify multiple - providers, the response can return only tiers and regions that - support multi-cloud clusters. + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Cloud providers whose regions to retrieve. When you specify + multiple providers, the response can return only tiers and regions + that support multi-cloud clusters. in: query name: providers schema: @@ -2838,17 +2702,17 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiAtlasProviderRegions' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiAtlasProviderRegions" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Cloud Provider Regions @@ -2856,40 +2720,39 @@ paths: - Clusters /api/atlas/v2/groups/{groupId}/clusters/tenantUpgrade: post: - description: >- - Upgrades a shared-tier cluster in the specified project. To use this - resource, the requesting API key must have the Project Cluster Manager - role. Each project supports up to 25 clusters. + description: Upgrades a shared-tier cluster in the specified project. To use + this resource, the requesting API key must have the Project Cluster + Manager role. Each project supports up to 25 clusters. operationId: upgradeSharedCluster parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LegacyAtlasCluster' + $ref: "#/components/schemas/LegacyAtlasCluster" description: Details of the shared-tier cluster upgrade in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LegacyAtlasCluster' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/LegacyAtlasCluster" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '402': - $ref: '#/components/responses/paymentRequired' - '403': - $ref: '#/components/responses/forbidden' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "402": + $ref: "#/components/responses/paymentRequired" + "403": + $ref: "#/components/responses/forbidden" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Upgrade One Shared-tier Cluster @@ -2898,40 +2761,39 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/tenantUpgradeToServerless: post: - description: >- - Upgrades a shared-tier cluster to a serverless instance in the specified - project. To use this resource, the requesting API key must have the - Project Cluster Manager role. + description: Upgrades a shared-tier cluster to a serverless instance in the + specified project. To use this resource, the requesting API key must + have the Project Cluster Manager role. operationId: upgradeSharedClusterToServerless parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessInstanceDescription' + $ref: "#/components/schemas/ServerlessInstanceDescription" description: Details of the shared-tier cluster upgrade in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessInstanceDescription' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessInstanceDescription" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '402': - $ref: '#/components/responses/paymentRequired' - '403': - $ref: '#/components/responses/forbidden' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "402": + $ref: "#/components/responses/paymentRequired" + "403": + $ref: "#/components/responses/forbidden" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Upgrades One Shared-Tier Cluster to the Serverless Instance @@ -2940,15 +2802,14 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}: delete: - description: >- - Removes one cluster with advanced features from the specified project. - The cluster must have termination protection disabled in order to be - deleted. To use this resource, the requesting API Key must have the - Project Owner role. This feature is not available for serverless - clusters. Deprecated versions: v2-{2023-01-01} + description: "Removes one cluster with advanced features from the specified + project. The cluster must have termination protection disabled in order + to be deleted. To use this resource, the requesting API Key must have + the Project Owner role. This feature is not available for serverless + clusters. Deprecated versions: v2-{2023-01-01}" operationId: deleteCluster parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -2958,44 +2819,43 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Flag that indicates whether to retain backup snapshots for the + - description: Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster. in: query name: retainBackups schema: type: boolean responses: - '202': + "202": content: application/vnd.atlas.2023-02-01+json: - x-xgen-version: 2023-02-01T00:00:00.000Z + x-xgen-version: 2023-02-01 description: Accepted - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Multi-Cloud Cluster from One Project tags: - Clusters get: - description: >- - Returns the details for one cluster in the specified project. Clusters - contain a group of hosts that maintain the same data set. The response - includes multi-cloud clusters. To use this resource, the requesting API - Key must have the Project Read Only role. This feature is not available - for serverless clusters. Deprecated versions: v2-{2023-01-01} + description: "Returns the details for one cluster in the specified project. + Clusters contain a group of hosts that maintain the same data set. The + response includes multi-cloud clusters. To use this resource, the + requesting API Key must have the Project Read Only role. This feature is + not available for serverless clusters. Deprecated versions: + v2-{2023-01-01}" operationId: getCluster parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies this advanced cluster. in: path name: clusterName @@ -3006,41 +2866,40 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/AdvancedClusterDescription' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/AdvancedClusterDescription" + x-xgen-version: 2023-02-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Multi-Cloud Cluster from One Project tags: - Clusters patch: - description: >- - Updates the details for one cluster in the specified project. Clusters - contain a group of hosts that maintain the same data set. This resource - can update multi-cloud clusters. To update a cluster's termination - protection, the requesting API Key must have the Project Owner role. For - all other updates, the requesting API Key must have the Project Cluster - Manager role. You can't modify a paused cluster (`paused : true`). You - must call this endpoint to set `paused : false`. After this endpoint - responds with `paused : false`, you can call it again with the changes - you want to make to the cluster. This feature is not available for - serverless clusters. Deprecated versions: v2-{2023-01-01} + description: "Updates the details for one cluster in the specified project. + Clusters contain a group of hosts that maintain the same data set. This + resource can update multi-cloud clusters. To update a cluster's + termination protection, the requesting API Key must have the Project + Owner role. For all other updates, the requesting API Key must have the + Project Cluster Manager role. You can't modify a paused cluster (`paused + : true`). You must call this endpoint to set `paused : false`. After + this endpoint responds with `paused : false`, you can call it again with + the changes you want to make to the cluster. This feature is not + available for serverless clusters. Deprecated versions: v2-{2023-01-01}" operationId: updateCluster parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3054,27 +2913,27 @@ paths: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/AdvancedClusterDescription' + $ref: "#/components/schemas/AdvancedClusterDescription" description: Cluster to update in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/AdvancedClusterDescription' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/AdvancedClusterDescription" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Modify One Multi-Cloud Cluster from One Project @@ -3082,16 +2941,15 @@ paths: - Clusters /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/exports: get: - description: >- - Returns all Cloud Backup snapshot export jobs associated with the + description: Returns all Cloud Backup snapshot export jobs associated with the specified Atlas cluster. To use this resource, the requesting API Key must have the Project Atlas Admin role. operationId: listBackupExportJobs parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3102,30 +2960,29 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiAtlasDiskBackupExportJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiAtlasDiskBackupExportJob" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Cloud Backup Snapshot Export Jobs tags: - Cloud Backups post: - description: >- - Exports one backup snapshot for dedicated Atlas cluster using Cloud + description: Exports one backup snapshot for dedicated Atlas cluster using Cloud Backups to an AWS bucket. To use this resource, the requesting API Key must have the Project Atlas Admin role. operationId: createBackupExportJob parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3139,27 +2996,27 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupExportJobRequest' + $ref: "#/components/schemas/DiskBackupExportJobRequest" description: Information about the Cloud Backup Snapshot Export Job to create. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupExportJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupExportJob" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Cloud Backup Snapshot Export Job @@ -3167,13 +3024,12 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/exports/{exportId}: get: - description: >- - Returns one Cloud Backup snapshot export job associated with the + description: Returns one Cloud Backup snapshot export job associated with the specified Atlas cluster. To use this resource, the requesting API Key must have the Project Atlas Admin role. operationId: getBackupExportJob parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3183,8 +3039,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique string that identifies the AWS S3 bucket to which you export + - description: Unique string that identifies the AWS S3 bucket to which you export your snapshots. in: path name: exportId @@ -3192,17 +3047,17 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupExportJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupExportJob" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Cloud Backup Snapshot Export Job @@ -3210,18 +3065,16 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/restoreJobs: get: - description: >- - Returns all cloud backup restore jobs for one cluster from the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + description: Returns all cloud backup restore jobs for one cluster from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. operationId: listBackupRestoreJobs parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Human-readable label that identifies the cluster with the restore + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster with the restore jobs you want to return. in: path name: clusterName @@ -3232,17 +3085,17 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedCloudBackupRestoreJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedCloudBackupRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Restore Jobs for One Cluster @@ -3259,7 +3112,7 @@ paths: To use this resource, the requesting API Key must have the Project Owner role. operationId: createBackupRestoreJob parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3273,27 +3126,27 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotRestoreJob' + $ref: "#/components/schemas/DiskBackupSnapshotRestoreJob" description: Restores one snapshot of one cluster from the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotRestoreJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupSnapshotRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Restore One Snapshot of One Cluster @@ -3301,13 +3154,12 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/restoreJobs/{restoreJobId}: delete: - description: >- - Cancels one cloud backup restore job of one cluster from the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + description: Cancels one cloud backup restore job of one cluster from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. operationId: cancelBackupRestoreJob parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3317,8 +3169,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the restore job + - description: Unique 24-hexadecimal digit string that identifies the restore job to remove. in: path name: restoreJobId @@ -3329,19 +3180,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '405': - $ref: '#/components/responses/methodNotAllowed' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "405": + $ref: "#/components/responses/methodNotAllowed" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Cancel One Restore Job of One Cluster @@ -3349,15 +3200,13 @@ paths: - Cloud Backups x-xgen-experimental: true get: - description: >- - Returns one cloud backup restore job for one cluster from the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + description: Returns one cloud backup restore job for one cluster from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. operationId: getBackupRestoreJob parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster with the restore + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the restore jobs you want to return. in: path name: clusterName @@ -3367,8 +3216,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the restore job + - description: Unique 24-hexadecimal digit string that identifies the restore job to return. in: path name: restoreJobId @@ -3379,17 +3227,17 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotRestoreJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupSnapshotRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Restore Job of One Cluster @@ -3397,14 +3245,13 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/schedule: delete: - description: >- - Removes all cloud backup schedules for the specified cluster. This + description: Removes all cloud backup schedules for the specified cluster. This schedule defines when MongoDB Cloud takes scheduled snapshots and how long it stores those snapshots. To use this resource, the requesting API Key must have the Project Atlas Admin role. operationId: deleteAllBackupSchedules parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3415,33 +3262,32 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotSchedule' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupSnapshotSchedule" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove All Cloud Backup Schedules tags: - Cloud Backups get: - description: >- - Returns the cloud backup schedule for the specified cluster within the - specified project. This schedule defines when MongoDB Cloud takes + description: Returns the cloud backup schedule for the specified cluster within + the specified project. This schedule defines when MongoDB Cloud takes scheduled snapshots and how long it stores those snapshots. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getBackupSchedule parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3452,31 +3298,30 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotSchedule' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupSnapshotSchedule" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Cloud Backup Schedule tags: - Cloud Backups patch: - description: >- - Updates the cloud backup schedule for one cluster within the specified - project. This schedule defines when MongoDB Cloud takes scheduled - snapshots and how long it stores those snapshots. To use this resource, - the requesting API Key must have the Project Owner role. + description: Updates the cloud backup schedule for one cluster within the + specified project. This schedule defines when MongoDB Cloud takes + scheduled snapshots and how long it stores those snapshots. To use this + resource, the requesting API Key must have the Project Owner role. operationId: updateBackupSchedule parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3490,29 +3335,28 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotSchedule' + $ref: "#/components/schemas/DiskBackupSnapshotSchedule" description: >- Updates the cloud backup schedule for one cluster within the specified project. - **Note**: In the request body, provide only the fields that you want - to update. + **Note**: In the request body, provide only the fields that you want to update. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshotSchedule' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupSnapshotSchedule" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Cloud Backup Schedule for One Cluster @@ -3520,16 +3364,15 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots: get: - description: >- - Returns all snapshots of one cluster from the specified project. To use - this resource, the requesting API Key must have the Project Read Only - role. + description: Returns all snapshots of one cluster from the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. operationId: listReplicaSetBackups parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3540,19 +3383,19 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedCloudBackupReplicaSet' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedCloudBackupReplicaSet" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Replica Set Cloud Backups @@ -3569,7 +3412,7 @@ paths: To use this resource, the requesting API Key must have the Project Owner role. operationId: takeSnapshot parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3583,23 +3426,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupOnDemandSnapshotRequest' + $ref: "#/components/schemas/DiskBackupOnDemandSnapshotRequest" description: Takes one on-demand snapshot. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupSnapshot" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Take One On-Demand Snapshot @@ -3607,13 +3450,12 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/shardedCluster/{snapshotId}: delete: - description: >- - Removes one snapshot of one sharded cluster from the specified project. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Removes one snapshot of one sharded cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. operationId: deleteShardedClusterBackup parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3623,8 +3465,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -3635,17 +3476,17 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Sharded Cluster Cloud Backup @@ -3653,13 +3494,12 @@ paths: - Cloud Backups x-xgen-experimental: true get: - description: >- - Returns one snapshot of one sharded cluster from the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Returns one snapshot of one sharded cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: getShardedClusterBackup parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3669,8 +3509,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -3681,19 +3520,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupShardedClusterSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupShardedClusterSnapshot" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Sharded Cluster Cloud Backup @@ -3702,13 +3541,12 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/shardedClusters: get: - description: >- - Returns all snapshots of one sharded cluster from the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Returns all snapshots of one sharded cluster from the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: listShardedClusterBackups parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3719,20 +3557,19 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: >- - #/components/schemas/PaginatedCloudBackupShardedClusterSnapshot - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedCloudBackupShardedClusterSnapshot" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Sharded Cluster Cloud Backups @@ -3741,12 +3578,11 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/snapshots/{snapshotId}: delete: - description: >- - Removes the specified snapshot. To use this resource, the requesting API - Key must have the Project Owner role. + description: Removes the specified snapshot. To use this resource, the + requesting API Key must have the Project Owner role. operationId: deleteReplicaSetBackup parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3756,8 +3592,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -3768,31 +3603,30 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Replica Set Cloud Backup tags: - Cloud Backups get: - description: >- - Returns one snapshot from the specified cluster. To use this resource, - the requesting API Key must have the Project Read Only role. + description: Returns one snapshot from the specified cluster. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: getReplicaSetBackup parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3802,8 +3636,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -3814,31 +3647,30 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupReplicaSet' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupReplicaSet" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Replica Set Cloud Backup tags: - Cloud Backups patch: - description: >- - Changes the expiration date for one cloud backup snapshot for one + description: Changes the expiration date for one cloud backup snapshot for one cluster in the specified project. operationId: updateSnapshotRetention parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -3848,8 +3680,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -3863,25 +3694,24 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupSnapshotRetention' - description: >- - Changes the expiration date for one cloud backup snapshot for one + $ref: "#/components/schemas/BackupSnapshotRetention" + description: Changes the expiration date for one cloud backup snapshot for one cluster in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DiskBackupReplicaSet' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupReplicaSet" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Change Expiration Date for One Cloud Backup @@ -3890,12 +3720,11 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/download: post: - description: >- - Requests one snapshot for the specified shared cluster. This resource - returns a `snapshotURL` that you can use to download the snapshot. This - `snapshotURL` remains active for four hours after you make the request. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Requests one snapshot for the specified shared cluster. This + resource returns a `snapshotURL` that you can use to download the + snapshot. This `snapshotURL` remains active for four hours after you + make the request. To use this resource, the requesting API Key must have + the Project Owner role. operationId: downloadSharedClusterBackup parameters: - description: Human-readable label that identifies the cluster. @@ -3907,34 +3736,34 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TenantRestore' + $ref: "#/components/schemas/TenantRestore" description: Snapshot to be downloaded. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TenantRestore' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/TenantRestore" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Download One M2 or M5 Cluster Snapshot @@ -3943,9 +3772,8 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restore: post: - description: >- - Restores the specified cluster. MongoDB Cloud limits which clusters can - be the target clusters of a restore. The target cluster can't use + description: Restores the specified cluster. MongoDB Cloud limits which clusters + can be the target clusters of a restore. The target cluster can't use encryption at rest, run a major release MongoDB version different than the snapshot, or receive client requests during restores. MongoDB Cloud deletes all existing data on the target cluster prior to the restore @@ -3962,32 +3790,32 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TenantRestore' + $ref: "#/components/schemas/TenantRestore" description: The restore job details. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TenantRestore' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/TenantRestore" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Restore Job from One M2 or M5 Cluster @@ -3996,10 +3824,9 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restores: get: - description: >- - Returns all restore jobs for the specified M2 or M5 cluster. Restore - jobs restore a cluster using a snapshot. To use this resource, the - requesting API Key must have the Project Read Only role. + description: Returns all restore jobs for the specified M2 or M5 cluster. + Restore jobs restore a cluster using a snapshot. To use this resource, + the requesting API Key must have the Project Read Only role. operationId: listSharedClusterBackupRestoreJobs parameters: - description: Human-readable label that identifies the cluster. @@ -4011,21 +3838,21 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedTenantRestore' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedTenantRestore" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Restore Jobs for One M2 or M5 Cluster @@ -4034,9 +3861,8 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/restores/{restoreId}: get: - description: >- - Returns the specified restore job. To use this resource, the requesting - API Key must have the Project Read Only role. + description: Returns the specified restore job. To use this resource, the + requesting API Key must have the Project Read Only role. operationId: getSharedClusterBackupRestoreJob parameters: - description: Human-readable label that identifies the cluster. @@ -4048,9 +3874,8 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the restore job + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the restore job to return. in: path name: restoreId @@ -4061,19 +3886,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TenantRestore' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/TenantRestore" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Restore Job for One M2 or M5 Cluster @@ -4082,13 +3907,12 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/snapshots: get: - description: >- - Returns details for all snapshots for the specified shared cluster. To - use this resource, the requesting API Key must have the Project Read + description: Returns details for all snapshots for the specified shared cluster. + To use this resource, the requesting API Key must have the Project Read Only role. operationId: listSharedClusterBackups parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -4099,19 +3923,19 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedTenantSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedTenantSnapshot" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Snapshots for One M2 or M5 Cluster @@ -4120,13 +3944,12 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/tenant/snapshots/{snapshotId}: get: - description: >- - Returns details for one snapshot for the specified shared cluster. To - use this resource, the requesting API Key must have the Project Read + description: Returns details for one snapshot for the specified shared cluster. + To use this resource, the requesting API Key must have the Project Read Only role. operationId: getSharedClusterBackup parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -4136,8 +3959,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -4148,19 +3970,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupTenantSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BackupTenantSnapshot" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Snapshot for One M2 or M5 Cluster @@ -4170,18 +3992,16 @@ paths: /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backupCheckpoints: get: deprecated: true - description: >- - Returns all legacy backup checkpoints for one cluster in the specified - project. To use this resource, the requesting API Key must have the - Project Read Only role. + description: Returns all legacy backup checkpoints for one cluster in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. operationId: listLegacyBackupCheckpoints parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Human-readable label that identifies the cluster that contains the + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster that contains the checkpoints that you want to return. in: path name: clusterName @@ -4192,17 +4012,17 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiAtlasCheckpoint' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiAtlasCheckpoint" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Legacy Backup Checkpoints @@ -4212,13 +4032,12 @@ paths: /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backupCheckpoints/{checkpointId}: get: deprecated: true - description: >- - Returns one legacy backup checkpoint for one cluster in the specified - project. To use this resource, the requesting API Key must have the - Project Read Only role. + description: Returns one legacy backup checkpoint for one cluster in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. operationId: getLegacyBackupCheckpoint parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Unique 24-hexadecimal digit string that identifies the checkpoint. in: path name: checkpointId @@ -4228,8 +4047,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - Human-readable label that identifies the cluster that contains the + - description: Human-readable label that identifies the cluster that contains the checkpoints that you want to return. in: path name: clusterName @@ -4240,21 +4058,21 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiAtlasCheckpoint' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiAtlasCheckpoint" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Legacy Backup Checkpoint @@ -4263,21 +4081,18 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes: post: - description: >- - Creates one Atlas Search index on the specified collection. Atlas Search - indexes define the fields on which to create the index and the analyzers - to use when creating the index. Only clusters running MongoDB v4.2 or - later can use Atlas Search. To use this resource, the requesting API Key - must have the Project Data Access Admin role. + description: Creates one Atlas Search index on the specified collection. Atlas + Search indexes define the fields on which to create the index and the + analyzers to use when creating the index. Only clusters running MongoDB + v4.2 or later can use Atlas Search. To use this resource, the requesting + API Key must have the Project Data Access Admin role. externalDocs: description: Atlas Search Indexes - url: >- - https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ operationId: createAtlasSearchIndex parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Name of the cluster that contains the collection on which to create + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection on which to create an Atlas Search index. in: path name: clusterName @@ -4291,23 +4106,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterSearchIndex' + $ref: "#/components/schemas/ClusterSearchIndex" description: Creates one Atlas Search index on the specified collection. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterSearchIndex' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Atlas Search Index @@ -4315,20 +4130,17 @@ paths: - Atlas Search /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{databaseName}/{collectionName}: get: - description: >- - Returns all Atlas Search indexes on the specified collection. Atlas + description: Returns all Atlas Search indexes on the specified collection. Atlas Search indexes contain the indexed fields and the analyzers used to create the indexes. To use this resource, the requesting API Key must have the Project Data Access Read Write role. externalDocs: description: Atlas Search Indexes - url: >- - https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ operationId: listAtlasSearchIndexes parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Name of the cluster that contains the collection with one or more + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection with one or more Atlas Search indexes. in: path name: clusterName @@ -4338,16 +4150,14 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Name of the collection that contains one or more Atlas Search + - description: Name of the collection that contains one or more Atlas Search indexes. in: path name: collectionName required: true schema: type: string - - description: >- - Human-readable label that identifies the database that contains the + - description: Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes. in: path name: databaseName @@ -4355,19 +4165,19 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/ClusterSearchIndex' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Atlas Search Indexes for One Collection @@ -4375,19 +4185,16 @@ paths: - Atlas Search /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{indexId}: delete: - description: >- - Removes one Atlas Search index that you identified with its unique ID. - To use this resource, the requesting API Key must have the Project Data - Access Admin role. + description: Removes one Atlas Search index that you identified with its unique + ID. To use this resource, the requesting API Key must have the Project + Data Access Admin role. externalDocs: description: Atlas Search Indexes - url: >- - https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ operationId: deleteAtlasSearchIndex parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Name of the cluster that contains the database and collection with + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the database and collection with one or more Application Search indexes. in: path name: clusterName @@ -4397,8 +4204,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the Atlas Search + - description: Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes. @@ -4411,40 +4217,37 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Atlas Search Index tags: - Atlas Search get: - description: >- - Returns one Atlas Search index in the specified project. You identify - this index using its unique ID. Atlas Search index contains the indexed - fields and the analyzers used to create the index. To use this resource, - the requesting API Key must have the Project Data Access Read Write - role. + description: Returns one Atlas Search index in the specified project. You + identify this index using its unique ID. Atlas Search index contains the + indexed fields and the analyzers used to create the index. To use this + resource, the requesting API Key must have the Project Data Access Read + Write role. externalDocs: description: Atlas Search Indexes - url: >- - https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ operationId: getAtlasSearchIndex parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Name of the cluster that contains the collection with one or more + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection with one or more Atlas Search indexes. in: path name: clusterName @@ -4454,8 +4257,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the Application + - description: Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection @@ -4470,37 +4272,34 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterSearchIndex' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Atlas Search Index tags: - Atlas Search patch: - description: >- - Updates one Atlas Search index that you identified with its unique ID. - Atlas Search indexes define the fields on which to create the index and - the analyzers to use when creating the index. To use this resource, the - requesting API Key must have the Project Data Access Admin role. + description: Updates one Atlas Search index that you identified with its unique + ID. Atlas Search indexes define the fields on which to create the index + and the analyzers to use when creating the index. To use this resource, + the requesting API Key must have the Project Data Access Admin role. externalDocs: description: Atlas Search Indexes - url: >- - https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ operationId: updateAtlasSearchIndex parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Name of the cluster that contains the collection whose Atlas Search + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection whose Atlas Search index to update. in: path name: clusterName @@ -4510,8 +4309,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the Atlas Search + - description: Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) @@ -4528,23 +4326,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterSearchIndex' + $ref: "#/components/schemas/ClusterSearchIndex" description: Details to update on the Atlas Search index. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterSearchIndex' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Atlas Search Index @@ -4552,18 +4350,17 @@ paths: - Atlas Search /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites: get: - description: >- - Returns one managed namespace within the specified global cluster. A - managed namespace identifies a collection using the database name, the + description: "Returns one managed namespace within the specified global cluster. + A managed namespace identifies a collection using the database name, the dot separator, and the collection name. To use this resource, the requesting API Key must have the Project Read Only role. Deprecated - versions: v2-{2023-01-01} + versions: v2-{2023-01-01}" externalDocs: description: Global Clusters url: https://www.mongodb.com/docs/atlas/global-clusters/ operationId: getManagedNamespace parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies this advanced cluster. in: path name: clusterName @@ -4574,17 +4371,17 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/GeoSharding' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Managed Namespace in One Global Multi-Cloud Cluster @@ -4592,20 +4389,19 @@ paths: - Global Clusters /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/customZoneMapping: delete: - description: >- - Removes all custom zone mappings for the specified global cluster. A - custom zone mapping matches one ISO 3166-2 location code to a zone in + description: "Removes all custom zone mappings for the specified global cluster. + A custom zone mapping matches one ISO 3166-2 location code to a zone in your global cluster. Removing the custom zone mappings restores the default mapping. By default, MongoDB Cloud maps each location code to the closest geographical zone. To use this resource, the requesting API Key must have the Project Owner role. Deprecated versions: - v2-{2023-01-01} + v2-{2023-01-01}" externalDocs: description: Global Clusters url: https://www.mongodb.com/docs/atlas/global-clusters/ operationId: deleteAllCustomZoneMappings parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies this advanced cluster. in: path name: clusterName @@ -4616,17 +4412,17 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/GeoSharding' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster @@ -4634,19 +4430,18 @@ paths: - Global Clusters x-xgen-experimental: true post: - description: >- - Creates one custom zone mapping for the specified global cluster. A - custom zone mapping matches one ISO 3166-2 location code to a zone in + description: "Creates one custom zone mapping for the specified global cluster. + A custom zone mapping matches one ISO 3166-2 location code to a zone in your global cluster. By default, MongoDB Cloud maps each location code to the closest geographical zone. To use this resource, the requesting API Key must have the Project Owner role. Deprecated versions: - v2-{2023-01-01} + v2-{2023-01-01}" externalDocs: description: Global Clusters url: https://www.mongodb.com/docs/atlas/global-clusters/ operationId: createCustomZoneMapping parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies this advanced cluster. in: path name: clusterName @@ -4660,23 +4455,23 @@ paths: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/GeoSharding' + $ref: "#/components/schemas/GeoSharding" description: Custom zone mapping to add to the specified global cluster. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/GeoSharding' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Add One Entry to One Custom Zone Mapping @@ -4685,13 +4480,12 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/managedNamespaces: delete: - description: >- - Removes one managed namespace within the specified global cluster. A - managed namespace identifies a collection using the database name, the + description: "Removes one managed namespace within the specified global cluster. + A managed namespace identifies a collection using the database name, the dot separator, and the collection name. Deleting a managed namespace does not remove the associated collection or data. To use this resource, the requesting API Key must have the Project Data Access Admin role. - Deprecated versions: v2-{2023-01-01} + Deprecated versions: v2-{2023-01-01}" externalDocs: description: Global Clusters url: https://www.mongodb.com/docs/atlas/global-clusters/ @@ -4706,35 +4500,33 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the database that contains the + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database that contains the collection. in: query name: db schema: type: string - - description: >- - Human-readable label that identifies the collection associated with + - description: Human-readable label that identifies the collection associated with the managed namespace. in: query name: collection schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/GeoSharding' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Managed Namespace from One Global Multi-Cloud Cluster @@ -4742,18 +4534,17 @@ paths: - Global Clusters x-xgen-experimental: true post: - description: >- - Creates one managed namespace within the specified global cluster. A - managed namespace identifies a collection using the database name, the + description: "Creates one managed namespace within the specified global cluster. + A managed namespace identifies a collection using the database name, the dot separator, and the collection name. To use this resource, the requesting API Key must have the Project Data Access Admin role. - Deprecated versions: v2-{2023-01-01} + Deprecated versions: v2-{2023-01-01}" externalDocs: description: Global Clusters url: https://www.mongodb.com/docs/atlas/global-clusters/ operationId: createManagedNamespace parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies this advanced cluster. in: path name: clusterName @@ -4767,25 +4558,25 @@ paths: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/ManagedNamespace' + $ref: "#/components/schemas/ManagedNamespace" description: Managed namespace to create within the specified global cluster. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/GeoSharding' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/GeoSharding" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '405': - $ref: '#/components/responses/methodNotAllowed' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "405": + $ref: "#/components/responses/methodNotAllowed" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Managed Namespace in One Global Multi-Cloud Cluster @@ -4794,8 +4585,7 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/index: post: - description: >- - Creates an index on the cluster identified by its name in a rolling + description: Creates an index on the cluster identified by its name in a rolling manner. Creating the index in this way allows index builds on one replica set member as a standalone at a time, starting with the secondary members. Creating indexes in this way requires at least one @@ -4803,13 +4593,11 @@ paths: have the Project Data Access Admin role. externalDocs: description: Rolling Index Builds on Replica Sets - url: >- - https://docs.mongodb.com/manual/tutorial/build-indexes-on-replica-sets/ + url: https://docs.mongodb.com/manual/tutorial/build-indexes-on-replica-sets/ operationId: createRollingIndex parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster on which MongoDB + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster on which MongoDB Cloud creates an index. in: path name: clusterName @@ -4823,21 +4611,21 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DatabaseRollingIndexRequest' + $ref: "#/components/schemas/DatabaseRollingIndexRequest" description: Rolling index to create on the specified cluster. required: true responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: Accepted - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Rolling Index @@ -4845,22 +4633,19 @@ paths: - Rolling Index /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives: get: - description: >- - Returns details of all online archives. This archive stores data from - one cluster within one project. To use this resource, the requesting API - Key must have the Project Read Only role. + description: Returns details of all online archives. This archive stores data + from one cluster within one project. To use this resource, the + requesting API Key must have the Project Read Only role. externalDocs: description: Online Archive - url: >- - https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive operationId: listOnlineArchives parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Human-readable label that identifies the cluster that contains the + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives. in: path name: clusterName @@ -4871,36 +4656,33 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedOnlineArchive' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedOnlineArchive" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Online Archives for One Cluster tags: - Online Archive post: - description: >- - Creates one online archive. This archive stores data from one cluster - within one project. To use this resource, the requesting API Key must - have the Project Data Access Admin role. + description: Creates one online archive. This archive stores data from one + cluster within one project. To use this resource, the requesting API Key + must have the Project Data Access Admin role. externalDocs: description: Online Archive - url: >- - https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive operationId: createOnlineArchive parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster that contains the + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive. in: path name: clusterName @@ -4914,53 +4696,49 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupOnlineArchiveCreate' + $ref: "#/components/schemas/BackupOnlineArchiveCreate" description: Creates one online archive. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupOnlineArchive' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BackupOnlineArchive" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Online Archive tags: - Online Archive x-xgen-changelog: - Wed Aug 02 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - If 'criteria':'DATE' is specified, then you must specify 'DATE' values - in partition fields + 2023-08-02: If 'criteria':'DATE' is specified, then you must specify 'DATE' + values in partition fields /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives/queryLogs.gz: get: - description: >- - Downloads query logs for the specified online archive. To use this + description: Downloads query logs for the specified online archive. To use this resource, the requesting API Key must have the Project Data Access Read Only or higher role. externalDocs: description: Online Archive - url: >- - https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive operationId: downloadOnlineArchiveQueryLogs parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Date and time that specifies the starting point for the range of log - messages to return. This resource expresses this value in the number - of seconds that have elapsed since the [UNIX + - $ref: "#/components/parameters/groupId" + - description: Date and time that specifies the starting point for the range of + log messages to return. This resource expresses this value in the + number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). in: query name: startDate @@ -4969,8 +4747,7 @@ paths: format: int64 example: 1636481348 minimum: 1199145600 - - description: >- - Date and time that specifies the end point for the range of log + - description: Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). @@ -4981,8 +4758,7 @@ paths: format: int64 example: 1636481348 minimum: 1199145600 - - description: >- - Human-readable label that identifies the cluster that contains the + - description: Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive. in: path @@ -4993,8 +4769,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Flag that indicates whether to download logs for queries against + - description: Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster. in: query name: archiveOnly @@ -5002,29 +4777,28 @@ paths: type: boolean default: false responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+gzip: schema: type: string format: binary - description: >- - This resource downloads a compressed log file to your current + description: This resource downloads a compressed log file to your current working directory. You can specify its name using the `--output` option or use the default filename using the `-OJ` option. The default filename varies based on whether you download logs for queries of your online archive only or both your online archive and cluster. - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Download Online Archive Query Logs @@ -5033,19 +4807,16 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives/{archiveId}: delete: - description: >- - Removes one online archive. This archive stores data from one cluster - within one project. To use this resource, the requesting API Key must - have the Project Data Access Admin role. + description: Removes one online archive. This archive stores data from one + cluster within one project. To use this resource, the requesting API Key + must have the Project Data Access Admin role. externalDocs: description: Online Archive - url: >- - https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive operationId: deleteOnlineArchive parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the online + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the online archive to delete. in: path name: archiveId @@ -5055,8 +4826,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - Human-readable label that identifies the cluster that contains the + - description: Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive. in: path name: clusterName @@ -5067,38 +4837,35 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Online Archive tags: - Online Archive get: - description: >- - Returns one online archive for one cluster. This archive stores data - from one cluster within one project. To use this resource, the + description: Returns one online archive for one cluster. This archive stores + data from one cluster within one project. To use this resource, the requesting API Key must have the Project Read Only role. externalDocs: description: Online Archive - url: >- - https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive operationId: getOnlineArchive parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the online + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the online archive to return. in: path name: archiveId @@ -5108,8 +4875,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - Human-readable label that identifies the cluster that contains the + - description: Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive. in: path @@ -5121,40 +4887,37 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupOnlineArchive' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BackupOnlineArchive" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Online Archive tags: - Online Archive patch: - description: >- - Updates, pauses, or resumes one online archive. This archive stores data - from one cluster within one project. To use this resource, the + description: Updates, pauses, or resumes one online archive. This archive stores + data from one cluster within one project. To use this resource, the requesting API Key must have the Project Data Access Admin role. externalDocs: description: Online Archive - url: >- - https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive + url: https://docs.atlas.mongodb.com/online-archive/manage-online-archive/#std-label-manage-online-archive operationId: updateOnlineArchive parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the online + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the online archive to update. in: path name: archiveId @@ -5164,8 +4927,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - Human-readable label that identifies the cluster that contains the + - description: Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive. in: path @@ -5180,27 +4942,27 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupOnlineArchive' + $ref: "#/components/schemas/BackupOnlineArchive" description: Updates, pauses, or resumes one online archive. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupOnlineArchive' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BackupOnlineArchive" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Online Archive @@ -5214,9 +4976,8 @@ paths: url: https://dochub.mongodb.org/core/test-regional-outage operationId: endOutageSimulation parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster that is undergoing + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster that is undergoing outage simulation. in: path name: clusterName @@ -5227,21 +4988,21 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterOutageSimulation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterOutageSimulation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: End an Outage Simulation @@ -5255,9 +5016,8 @@ paths: url: https://dochub.mongodb.org/core/test-regional-outage operationId: getOutageSimulation parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster that is undergoing + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster that is undergoing outage simulation. in: path name: clusterName @@ -5268,21 +5028,21 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterOutageSimulation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterOutageSimulation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Outage Simulation @@ -5296,9 +5056,8 @@ paths: url: https://dochub.mongodb.org/core/test-regional-outage operationId: startOutageSimulation parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster to undergo an + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to undergo an outage simulation. in: path name: clusterName @@ -5312,23 +5071,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterOutageSimulation' + $ref: "#/components/schemas/ClusterOutageSimulation" description: Describes the outage simulation. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterOutageSimulation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterOutageSimulation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Start an Outage Simulation @@ -5337,8 +5096,7 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/processArgs: get: - description: >- - Returns the advanced configuration details for one cluster in the + description: Returns the advanced configuration details for one cluster in the specified project. Clusters contain a group of hosts that maintain the same data set. Advanced configuration details include the read/write concern, index and oplog limits, and other database settings. This @@ -5350,7 +5108,7 @@ paths: url: https://www.mongodb.com/docs/atlas/global-clusters/ operationId: getClusterAdvancedConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -5361,27 +5119,26 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterDescriptionProcessArgs' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterDescriptionProcessArgs" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Advanced Configuration Options for One Cluster tags: - Clusters patch: - description: >- - Updates the advanced configuration details for one cluster in the + description: Updates the advanced configuration details for one cluster in the specified project. Clusters contain a group of hosts that maintain the same data set. Advanced configuration details include the read/write concern, index and oplog limits, and other database settings. To use @@ -5393,7 +5150,7 @@ paths: url: https://www.mongodb.com/docs/atlas/global-clusters/ operationId: updateClusterAdvancedConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -5407,27 +5164,26 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterDescriptionProcessArgs' - description: >- - Advanced configuration details to add for one cluster in the specified - project. + $ref: "#/components/schemas/ClusterDescriptionProcessArgs" + description: Advanced configuration details to add for one cluster in the + specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterDescriptionProcessArgs' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterDescriptionProcessArgs" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Advanced Configuration Options for One Cluster @@ -5435,17 +5191,16 @@ paths: - Clusters /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restartPrimaries: post: - description: >- - Starts a failover test for the specified cluster in the specified + description: "Starts a failover test for the specified cluster in the specified project. Clusters contain a group of hosts that maintain the same data set. A failover test checks how MongoDB Cloud handles the failure of the cluster's primary node. During the test, MongoDB Cloud shuts down the primary node and elects a new primary. To use this resource, the requesting API Key must have the Project Cluster Manager role. - Deprecated versions: v2-{2023-01-01} + Deprecated versions: v2-{2023-01-01}" operationId: testFailover parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -5456,15 +5211,15 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: - x-xgen-version: 2023-02-01T00:00:00.000Z + x-xgen-version: 2023-02-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Test Failover for One Multi-Cloud Cluster @@ -5481,12 +5236,11 @@ paths: Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). If you use the `BATCH-ID` query parameter, you can retrieve all restore jobs in the specified batch. When creating a restore job for a sharded cluster, MongoDB Cloud creates a separate job for each shard, plus another for the config server. Each of those jobs are part of a batch. However, a batch can't include a restore job for a replica set. operationId: listLegacyBackupRestoreJobs parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Unique 24-hexadecimal digit string that identifies the batch of + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for @@ -5499,8 +5253,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - Human-readable label that identifies the cluster with the snapshot + - description: Human-readable label that identifies the cluster with the snapshot you want to return. in: path name: clusterName @@ -5511,19 +5264,19 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedRestoreJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Legacy Backup Restore Jobs @@ -5532,17 +5285,16 @@ paths: x-xgen-experimental: true post: deprecated: true - description: >- - Restores one legacy backup for one cluster in the specified project. To - use this resource, the requesting API Key must have the Project Owner - role. Effective 23 March 2020, all new clusters can use only Cloud - Backups. When you upgrade to 4.2, your backup system upgrades to cloud - backup if it is currently set to legacy backup. After this upgrade, all - your existing legacy backup snapshots remain available. They expire over - time in accordance with your retention policy. Your backup policy resets - to the default schedule. If you had a custom backup policy in place with - legacy backups, you must re-create it with the procedure outlined in the - [Cloud Backup + description: Restores one legacy backup for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. Effective 23 March 2020, all new clusters can use + only Cloud Backups. When you upgrade to 4.2, your backup system upgrades + to cloud backup if it is currently set to legacy backup. After this + upgrade, all your existing legacy backup snapshots remain available. + They expire over time in accordance with your retention policy. Your + backup policy resets to the default schedule. If you had a custom backup + policy in place with legacy backups, you must re-create it with the + procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). This endpoint doesn't support creating checkpoint restore jobs for sharded clusters, or creating restore jobs for queryable backup @@ -5552,9 +5304,8 @@ paths: the restore. operationId: createLegacyBackupRestoreJob parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster with the snapshot + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot you want to return. in: path name: clusterName @@ -5568,23 +5319,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupRestoreJob' + $ref: "#/components/schemas/BackupRestoreJob" description: Legacy backup to restore to one cluster in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedRestoreJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Legacy Backup Restore Job @@ -5602,9 +5353,8 @@ paths: Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). operationId: getLegacyBackupRestoreJob parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster with the snapshot + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot you want to return. in: path name: clusterName @@ -5624,19 +5374,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupRestoreJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BackupRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Legacy Backup Restore Job @@ -5654,9 +5404,8 @@ paths: Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). operationId: getLegacySnapshotSchedule parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster with the snapshot + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot you want to return. in: path name: clusterName @@ -5667,17 +5416,17 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiAtlasSnapshotSchedule' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Snapshot Schedule @@ -5694,9 +5443,8 @@ paths: Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). operationId: updateLegacySnapshotSchedule parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster with the snapshot + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot you want to return. in: path name: clusterName @@ -5710,21 +5458,21 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiAtlasSnapshotSchedule' + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" description: Update the snapshot schedule for one cluster in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiAtlasSnapshotSchedule' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Snapshot Schedule for One Cluster @@ -5734,24 +5482,23 @@ paths: /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots: get: deprecated: true - description: >- - Returns all legacy backup snapshots for one cluster in the specified - project. To use this resource, the requesting API Key must have the - Project Read Only role. Effective 23 March 2020, all new clusters can - use only Cloud Backups. When you upgrade to 4.2, your backup system - upgrades to cloud backup if it is currently set to legacy backup. After - this upgrade, all your existing legacy backup snapshots remain - available. They expire over time in accordance with your retention - policy. Your backup policy resets to the default schedule. If you had a - custom backup policy in place with legacy backups, you must re-create it - with the procedure outlined in the [Cloud Backup + description: Returns all legacy backup snapshots for one cluster in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. Effective 23 March 2020, all new + clusters can use only Cloud Backups. When you upgrade to 4.2, your + backup system upgrades to cloud backup if it is currently set to legacy + backup. After this upgrade, all your existing legacy backup snapshots + remain available. They expire over time in accordance with your + retention policy. Your backup policy resets to the default schedule. If + you had a custom backup policy in place with legacy backups, you must + re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). operationId: listLegacySnapshots parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -5761,27 +5508,26 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Human-readable label that specifies whether to return only + - description: Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots. in: query name: completed schema: type: string - default: 'true' + default: "true" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedSnapshot" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Legacy Backup Snapshots @@ -5791,8 +5537,7 @@ paths: /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots/{snapshotId}: delete: deprecated: true - description: >- - Removes one legacy backup snapshot for one cluster in the specified + description: Removes one legacy backup snapshot for one cluster in the specified project. To use this resource, the requesting API Key must have the Project Owner role. Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades @@ -5805,7 +5550,7 @@ paths: documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). operationId: deleteLegacySnapshot parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -5815,8 +5560,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -5827,19 +5571,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Legacy Backup Snapshot @@ -5848,8 +5592,7 @@ paths: x-xgen-experimental: true get: deprecated: true - description: >- - Returns one legacy backup snapshot for one cluster in the specified + description: Returns one legacy backup snapshot for one cluster in the specified project. To use this resource, the requesting API Key must have the Project Read Only role. Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system @@ -5862,7 +5605,7 @@ paths: documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). operationId: getLegacySnapshot parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -5872,8 +5615,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -5884,17 +5626,17 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BackupSnapshot" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Legacy Backup Snapshot @@ -5903,8 +5645,7 @@ paths: x-xgen-experimental: true patch: deprecated: true - description: >- - Changes the expiration date for one legacy backup snapshot for one + description: Changes the expiration date for one legacy backup snapshot for one cluster in the specified project. To use this resource, the requesting API Key must have the Project Owner role. Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your @@ -5917,7 +5658,7 @@ paths: documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). operationId: updateLegacySnapshotRetention parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -5927,8 +5668,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -5942,21 +5682,21 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupSnapshot' + $ref: "#/components/schemas/BackupSnapshot" description: Changes One Legacy Backup Snapshot Expiration. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BackupSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BackupSnapshot" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Change One Legacy Backup Snapshot Expiration @@ -5965,15 +5705,14 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/status: get: - description: >- - Returns the status of all changes that you made to the specified cluster - in the specified project. Use this resource to check the progress - MongoDB Cloud has made in processing your changes. The response does not - include the deployment of new dedicated clusters. To use this resource, - the requesting API Key must have the Project Read Only role. + description: Returns the status of all changes that you made to the specified + cluster in the specified project. Use this resource to check the + progress MongoDB Cloud has made in processing your changes. The response + does not include the deployment of new dedicated clusters. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: getClusterStatus parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the cluster. in: path name: clusterName @@ -5984,17 +5723,17 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ClusterStatus' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ClusterStatus" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Status of All Cluster Operations @@ -6003,8 +5742,7 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{hostName}/logs/{logName}.gz: get: - description: >- - Returns a compressed (.gz) log file that contains a range of log + description: "Returns a compressed (.gz) log file that contains a range of log messages for the specified host for the specified project. MongoDB updates process and audit logs from the cluster backend infrastructure every five minutes and contain log data from the previous five minutes. @@ -6014,22 +5752,19 @@ paths: UTC and 4:00 UTC. This feature isn't available for `M0` free clusters, `M2`, `M5`, or serverless clusters. To use this resource, the requesting API Key must have the Project Data Access Read Only or higher role. - Deprecated versions: v2-{2023-01-01} + Deprecated versions: v2-{2023-01-01}" operationId: getHostLogs parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the host that stores the log + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the host that stores the log files that you want to download. in: path name: hostName required: true schema: type: string - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ - - description: >- - Human-readable label that identifies the log file that you want to + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + - description: Human-readable label that identifies the log file that you want to return. To return audit logs, enable *Database Auditing* for the specified project. in: path @@ -6040,8 +5775,7 @@ paths: externalDocs: description: Set up Database Auditing url: https://docs.atlas.mongodb.com/database-auditing/ - - description: >- - Date and time when the period specifies the inclusive ending point + - description: Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch. @@ -6051,11 +5785,10 @@ paths: type: integer format: int64 minimum: 1199145600 - - description: >- - Date and time when the period specifies the inclusive starting point - for the range of log messages to retrieve. This parameter expresses - its value in the number of seconds that have elapsed since the UNIX - epoch. + - description: Date and time when the period specifies the inclusive starting + point for the range of log messages to retrieve. This parameter + expresses its value in the number of seconds that have elapsed since + the UNIX epoch. in: query name: startDate schema: @@ -6063,29 +5796,28 @@ paths: format: int64 minimum: 1199145600 responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+gzip: schema: type: string format: binary - description: >- - Compressed (.gz) log file that contains a range of log - messages for the specified host for the specified project - x-xgen-version: 2023-02-01T00:00:00.000Z - description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + description: Compressed (.gz) log file that contains a range of log messages for + the specified host for the specified project + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Download Logs for One Cluster Host in One Project @@ -6093,20 +5825,19 @@ paths: - Monitoring and Logs /api/atlas/v2/groups/{groupId}/containers: get: - description: >- - Returns details about all network peering containers in the specified - project for the specified cloud provider. If you do not specify the - cloud provider, MongoDB Cloud returns details about all network peering - containers in the project for Amazon Web Services (AWS). To use this - resource, the requesting API Key must have the Project Read Only role. + description: Returns details about all network peering containers in the + specified project for the specified cloud provider. If you do not + specify the cloud provider, MongoDB Cloud returns details about all + network peering containers in the project for Amazon Web Services (AWS). + To use this resource, the requesting API Key must have the Project Read + Only role. operationId: listPeeringContainerByCloudProvider parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Cloud service provider that serves the desired network peering + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Cloud service provider that serves the desired network peering containers. in: query name: providerName @@ -6115,63 +5846,61 @@ paths: type: string default: AWS responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedCloudProviderContainer' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedCloudProviderContainer" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Return All Network Peering Containers in One Project for One Cloud + summary: Return All Network Peering Containers in One Project for One Cloud Provider tags: - Network Peering post: - description: >- - Creates one new network peering container in the specified project. + description: Creates one new network peering container in the specified project. MongoDB Cloud can deploy Network Peering connections in a network peering container. GCP can have one container per project. AWS and Azure can have one container per cloud provider region. To use this resource, the requesting API Key must have the Project Owner role. operationId: createPeeringContainer parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderContainer' + $ref: "#/components/schemas/CloudProviderContainer" description: Creates one new network peering container in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderContainer' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudProviderContainer" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One New Network Peering Container @@ -6179,29 +5908,28 @@ paths: - Network Peering /api/atlas/v2/groups/{groupId}/containers/all: get: - description: >- - Returns details about all network peering containers in the specified - project. Network peering containers contain network peering connections. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Returns details about all network peering containers in the + specified project. Network peering containers contain network peering + connections. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: listPeeringContainers parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedCloudProviderContainer' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedCloudProviderContainer" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Network Peering Containers in One Project @@ -6209,15 +5937,14 @@ paths: - Network Peering /api/atlas/v2/groups/{groupId}/containers/{containerId}: delete: - description: >- - Removes one network peering container in the specified project. To use - this resource, the requesting API Key must have the Project Owner role. + description: Removes one network peering container in the specified project. To + use this resource, the requesting API Key must have the Project Owner + role. operationId: deletePeeringContainer parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - network container that you want to remove. + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud network container that you want to remove. in: path name: containerId required: true @@ -6228,40 +5955,38 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Network Peering Container tags: - Network Peering get: - description: >- - Returns details about one network peering container in one specified - project. Network peering containers contain network peering connections. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Returns details about one network peering container in one + specified project. Network peering containers contain network peering + connections. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: getPeeringContainer parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - network container that you want to remove. + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud network container that you want to remove. in: path name: containerId required: true @@ -6272,33 +5997,31 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderContainer' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudProviderContainer" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Network Peering Container tags: - Network Peering patch: - description: >- - Updates the network details and labels of one specified network peering - container in the specified project. To use this resource, the requesting - API Key must have the Project Owner role. + description: Updates the network details and labels of one specified network + peering container in the specified project. To use this resource, the + requesting API Key must have the Project Owner role. operationId: updatePeeringContainer parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - network container that you want to remove. + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud network container that you want to remove. in: path name: containerId required: true @@ -6312,31 +6035,30 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderContainer' - description: >- - Updates the network details and labels of one specified network + $ref: "#/components/schemas/CloudProviderContainer" + description: Updates the network details and labels of one specified network peering container in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderContainer' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudProviderContainer" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Network Peering Container @@ -6345,65 +6067,63 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/customDBRoles/roles: get: - description: >- - Returns all custom roles for the specified project. To use this + description: Returns all custom roles for the specified project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: listCustomDatabaseRoles parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/UserCustomDBRole' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UserCustomDBRole" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Custom Roles in One Project tags: - Custom Database Roles post: - description: >- - Creates one custom role in the specified project. To use this resource, - the requesting API Key must have the Project Owner role. + description: Creates one custom role in the specified project. To use this + resource, the requesting API Key must have the Project Owner role. operationId: createCustomDatabaseRole parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserCustomDBRole' + $ref: "#/components/schemas/UserCustomDBRole" description: Creates one custom role in the specified project. required: true responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserCustomDBRole' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UserCustomDBRole" + x-xgen-version: 2023-01-01 description: Accepted - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Custom Role @@ -6411,126 +6131,117 @@ paths: - Custom Database Roles /api/atlas/v2/groups/{groupId}/customDBRoles/roles/{roleName}: delete: - description: >- - Removes one custom role from the specified project. You can't remove a - custom role that would leave one or more child roles with no parent - roles or actions. You also can't remove a custom role that would leave - one or more database users without roles. To use this resource, the - requesting API Key must have the Project Atlas Admin role. + description: Removes one custom role from the specified project. You can't + remove a custom role that would leave one or more child roles with no + parent roles or actions. You also can't remove a custom role that would + leave one or more database users without roles. To use this resource, + the requesting API Key must have the Project Atlas Admin role. operationId: deleteCustomDatabaseRole parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the role for the request. This + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project. in: path name: roleName required: true schema: type: string - pattern: >- - ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- - Returns one custom role for the specified project. To use this resource, - the requesting API Key must have the Project Read Only role. + description: Returns one custom role for the specified project. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: getCustomDatabaseRole parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the role for the request. This + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project. in: path name: roleName required: true schema: type: string - pattern: >- - ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- - Updates one custom role in the specified project. To use this resource, - the requesting API Key must have the Project Owner role. + description: Updates one custom role in the specified project. To use this + resource, the requesting API Key must have the Project Owner role. operationId: updateCustomDatabaseRole parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the role for the request. This + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project. in: path name: roleName required: true schema: type: string - pattern: >- - ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- - Returns the details of all federated database instances in the specified - project. To use this resource, the requesting API Key must have the - Project Read Only or higher role. + description: Returns the details of all federated database instances in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only or higher role. operationId: listFederatedDatabases parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Type of Federated Database Instances to return. in: query name: type @@ -6552,34 +6262,32 @@ paths: type: string default: USER responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/DataLakeTenant' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeTenant" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Federated Database Instances in One Project tags: - Data Federation post: - description: >- - Creates one federated database instance in the specified project. To use - this resource, the requesting API Key must have the Project Owner or - Project Charts Admin roles. + description: Creates one federated database instance in the specified project. + To use this resource, the requesting API Key must have the Project Owner + or Project Charts Admin roles. operationId: createFederatedDatabase parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Flag that indicates whether this request should check if the + - $ref: "#/components/parameters/groupId" + - description: Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip @@ -6593,23 +6301,22 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeTenant' - description: >- - Details to create one federated database instance in the specified + $ref: "#/components/schemas/DataLakeTenant" + description: Details to create one federated database instance in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeTenant' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeTenant" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Federated Database Instance in One Project @@ -6617,48 +6324,44 @@ paths: - Data Federation /api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}: delete: - description: >- - Removes one federated database instance from the specified project. To - use this resource, the requesting API Key must have the Project Owner or - Project Charts Admin roles. + description: Removes one federated database instance from the specified project. + To use this resource, the requesting API Key must have the Project Owner + or Project Charts Admin roles. operationId: deleteFederatedDatabase parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the federated database instance - to remove. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the federated database + instance to remove. in: path name: tenantName required: true schema: type: string responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Federated Database Instance from One Project tags: - Data Federation get: - description: >- - Returns the details of one federated database instance within the + description: Returns the details of one federated database instance within the specified project. To use this resource, the requesting API Key must have the Project Read Only or Project Charts Admin roles. operationId: getFederatedDatabase parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the Federated Database to + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the Federated Database to return. in: path name: tenantName @@ -6666,44 +6369,41 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeTenant' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeTenant" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Federated Database Instance in One Project tags: - Data Federation patch: - description: >- - Updates the details of one federated database instance in the specified - project. To use this resource, the requesting API Key must have the - Project Owner or higher role. + description: Updates the details of one federated database instance in the + specified project. To use this resource, the requesting API Key must + have the Project Owner or higher role. operationId: updateFederatedDatabase parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the federated database instance - to update. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the federated database + instance to update. in: path name: tenantName required: true schema: type: string - - description: >- - Flag that indicates whether this request should check if the + - description: Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip @@ -6717,23 +6417,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeTenant' + $ref: "#/components/schemas/DataLakeTenant" description: Details of one Federated Database to update in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeTenant' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeTenant" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Federated Database Instance in One Project @@ -6741,37 +6441,35 @@ paths: - Data Federation /api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/limits: get: - description: >- - Returns query limits for a federated databases instance in the specified - project. To use this resource, the requesting API Key must have the - Project Read Only role. + description: Returns query limits for a federated databases instance in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. operationId: returnFederatedDatabaseQueryLimits parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the federated database instance - for which you want to retrieve query limits. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the federated database + instance for which you want to retrieve query limits. in: path name: tenantName required: true schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/DataFederationTenantQueryLimit' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataFederationTenantQueryLimit" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Query Limits for One Federated Database Instance @@ -6779,15 +6477,13 @@ paths: - Data Federation /api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/limits/{limitName}: delete: - description: >- - Deletes one query limit for one federated database instance. To use this - resource, the requesting API Key must have the Project Owner role. + description: Deletes one query limit for one federated database instance. To use + this resource, the requesting API Key must have the Project Owner role. operationId: deleteOneDataFederationInstanceQueryLimit parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the federated database instance - to which the query limit applies. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the federated database + instance to which the query limit applies. in: path name: tenantName required: true @@ -6802,50 +6498,44 @@ paths: | --- | --- | --- | - | bytesProcessed.query | Limit on the number of bytes processed - during a single data federation query | N/A | + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | - | bytesProcessed.daily | Limit on the number of bytes processed for - the data federation instance for the current day | N/A | + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | - | bytesProcessed.weekly | Limit on the number of bytes processed for - the data federation instance for the current week | N/A | + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | - | bytesProcessed.monthly | Limit on the number of bytes processed - for the data federation instance for the current month | N/A | + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | in: path name: limitName required: true schema: type: string responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Delete One Query Limit For One Federated Database Instance tags: - Data Federation get: - description: >- - Returns the details of one query limit for the specified federated + description: Returns the details of one query limit for the specified federated database instance in the specified project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: returnFederatedDatabaseQueryLimit parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the federated database instance - to which the query limit applies. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the federated database + instance to which the query limit applies. in: path name: tenantName required: true @@ -6860,50 +6550,44 @@ paths: | --- | --- | --- | - | bytesProcessed.query | Limit on the number of bytes processed - during a single data federation query | N/A | + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | - | bytesProcessed.daily | Limit on the number of bytes processed for - the data federation instance for the current day | N/A | + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | - | bytesProcessed.weekly | Limit on the number of bytes processed for - the data federation instance for the current week | N/A | + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | - | bytesProcessed.monthly | Limit on the number of bytes processed - for the data federation instance for the current month | N/A | + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | in: path name: limitName required: true schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataFederationTenantQueryLimit' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataFederationTenantQueryLimit" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Federated Database Instance Query Limit for One Project tags: - Data Federation patch: - description: >- - Creates or updates one query limit for one federated database instance. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Creates or updates one query limit for one federated database + instance. To use this resource, the requesting API Key must have the + Project Owner role. operationId: createOneDataFederationQueryLimit parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the federated database instance - to which the query limit applies. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the federated database + instance to which the query limit applies. in: path name: tenantName required: true @@ -6918,17 +6602,13 @@ paths: | --- | --- | --- | - | bytesProcessed.query | Limit on the number of bytes processed - during a single data federation query | N/A | + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | - | bytesProcessed.daily | Limit on the number of bytes processed for - the data federation instance for the current day | N/A | + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | - | bytesProcessed.weekly | Limit on the number of bytes processed for - the data federation instance for the current week | N/A | + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | - | bytesProcessed.monthly | Limit on the number of bytes processed - for the data federation instance for the current month | N/A | + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | in: path name: limitName required: true @@ -6938,27 +6618,25 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataFederationTenantQueryLimit' - description: >- - Creates or updates one query limit for one federated database - instance. + $ref: "#/components/schemas/DataFederationTenantQueryLimit" + description: Creates or updates one query limit for one federated database instance. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataFederationTenantQueryLimit' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataFederationTenantQueryLimit" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Configure One Query Limit for One Federated Database Instance @@ -6966,26 +6644,23 @@ paths: - Data Federation /api/atlas/v2/groups/{groupId}/dataFederation/{tenantName}/queryLogs.gz: get: - description: >- - Downloads the query logs for the specified federated database instance. - To use this resource, the requesting API Key must have the Project Owner - or Project Data Access Read Write roles. + description: Downloads the query logs for the specified federated database + instance. To use this resource, the requesting API Key must have the + Project Owner or Project Data Access Read Write roles. operationId: downloadFederatedDatabaseQueryLogs parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Timestamp that specifies the end point for the range of log messages - to download. MongoDB Cloud expresses this timestamp in the number - of seconds that have elapsed since the UNIX epoch. + - $ref: "#/components/parameters/groupId" + - description: Timestamp that specifies the end point for the range of log + messages to download. MongoDB Cloud expresses this timestamp in the + number of seconds that have elapsed since the UNIX epoch. in: query name: endDate schema: type: integer format: int64 example: 1636481348 - pattern: '1199145600' - - description: >- - Timestamp that specifies the starting point for the range of log + pattern: "1199145600" + - description: Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. in: query @@ -6994,37 +6669,36 @@ paths: type: integer format: int64 example: 1636466948 - pattern: '1199145600' - - description: >- - Human-readable label that identifies the federated database instance - for which you want to download query logs. + pattern: "1199145600" + - description: Human-readable label that identifies the federated database + instance for which you want to download query logs. in: path name: tenantName required: true schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+gzip: schema: type: string format: binary description: Compressed archive labeled `queryLogs.gz` downloads - x-xgen-version: 2023-01-01T00:00:00.000Z - description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Download Query Logs for One Federated Database Instance @@ -7032,44 +6706,42 @@ paths: - Data Federation /api/atlas/v2/groups/{groupId}/databaseUsers: get: - description: >- - Returns all database users that belong to the specified project. To use - this resource, the requesting API Key must have the Project Read Only - role. + description: Returns all database users that belong to the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. operationId: listDatabaseUsers parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiAtlasDatabaseUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiAtlasDatabaseUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Database Users from One Project tags: - Database Users post: - description: >- - Creates one database user in the specified project. This MongoDB Cloud - supports a maximum of 100 database users per project. If you require - more than 100 database users on a project, contact + description: Creates one database user in the specified project. This MongoDB + Cloud supports a maximum of 100 database users per project. If you + require more than 100 database users on a project, contact [Support](https://cloud.mongodb.com/support). To use this resource, the requesting API Key must have the Project Owner or Project Charts Admin roles. operationId: createDatabaseUser parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: @@ -7088,8 +6760,7 @@ paths: scopes: - name: myCluster type: CLUSTER - username: >- - arn:aws:iam::358363220050:user/mongodb-aws-iam-auth-test-user + username: arn:aws:iam::358363220050:user/mongodb-aws-iam-auth-test-user Federated Authentication: description: Federated Authentication value: @@ -7151,29 +6822,29 @@ paths: username: CN=david@example.com,OU=users,DC=example,DC=com x509Type: CUSTOMER schema: - $ref: '#/components/schemas/CloudDatabaseUser' + $ref: "#/components/schemas/CloudDatabaseUser" description: Creates one database user in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudDatabaseUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudDatabaseUser" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Database User in One Project @@ -7181,14 +6852,12 @@ paths: - Database Users /api/atlas/v2/groups/{groupId}/databaseUsers/{databaseName}/{username}: delete: - description: >- - Removes one database user from the specified project. To use this + description: Removes one database user from the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: deleteDatabaseUser parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the database against which the + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should @@ -7205,77 +6874,64 @@ paths: authentication: - | Authentication Method | Parameter Needed | Parameter Value | - username Format | + | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| - | AWS IAM | awsType | ROLE | ARN | + | AWS IAM | awsType | ROLE | ARN | - | AWS IAM | awsType | USER | ARN | + | AWS IAM | awsType | USER | ARN | - | x.509 | x509Type | CUSTOMER | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | x.509 | x509Type | MANAGED | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | LDAP | ldapAuthType | USER | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | LDAP | ldapAuthType | GROUP | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in - federation settings), followed by a '/', followed by the IdP group - name | + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | - | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | - Alphanumeric string | + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | in: path name: username required: true schema: type: string - example: >- - SCRAM-SHA: dylan or AWS IAM: + example: "SCRAM-SHA: dylan or AWS IAM: arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or x.509/LDAP: CN=Dylan Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: - IdPIdentifier/IdPGroupName + IdPIdentifier/IdPGroupName" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Database User from One Project tags: - Database Users get: - description: >- - Returns one database user that belong to the specified project. To use - this resource, the requesting API Key must have the Project Read Only - role. + description: Returns one database user that belong to the specified project. To + use this resource, the requesting API Key must have the Project Read + Only role. operationId: getDatabaseUser parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the database against which the + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should @@ -7292,75 +6948,62 @@ paths: authentication: - | Authentication Method | Parameter Needed | Parameter Value | - username Format | + | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| - | AWS IAM | awsType | ROLE | ARN | + | AWS IAM | awsType | ROLE | ARN | - | AWS IAM | awsType | USER | ARN | + | AWS IAM | awsType | USER | ARN | - | x.509 | x509Type | CUSTOMER | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | x.509 | x509Type | MANAGED | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | LDAP | ldapAuthType | USER | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | LDAP | ldapAuthType | GROUP | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in - federation settings), followed by a '/', followed by the IdP group - name | + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | - | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | - Alphanumeric string | + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | in: path name: username required: true schema: type: string - example: >- - SCRAM-SHA: dylan or AWS IAM: + example: "SCRAM-SHA: dylan or AWS IAM: arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or x.509/LDAP: CN=Dylan Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: - IdPIdentifier/IdPGroupName + IdPIdentifier/IdPGroupName" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudDatabaseUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudDatabaseUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Database User from One Project tags: - Database Users patch: - description: >- - Updates one database user that belongs to the specified project. To use - this resource, the requesting API Key must have the Project Owner or + description: Updates one database user that belongs to the specified project. To + use this resource, the requesting API Key must have the Project Owner or Project Charts Admin roles. operationId: updateDatabaseUser parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the database against which the + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should @@ -7377,73 +7020,62 @@ paths: authentication: - | Authentication Method | Parameter Needed | Parameter Value | - username Format | + | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| - | AWS IAM | awsType | ROLE | ARN | + | AWS IAM | awsType | ROLE | ARN | - | AWS IAM | awsType | USER | ARN | + | AWS IAM | awsType | USER | ARN | - | x.509 | x509Type | CUSTOMER | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | x.509 | x509Type | MANAGED | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | LDAP | ldapAuthType | USER | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | LDAP | ldapAuthType | GROUP | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in - federation settings), followed by a '/', followed by the IdP group - name | + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | - | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | - Alphanumeric string | + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | in: path name: username required: true schema: type: string - example: >- - SCRAM-SHA: dylan or AWS IAM: + example: "SCRAM-SHA: dylan or AWS IAM: arn:aws:iam::123456789012:user/sales/enterprise/DylanBloggs or x.509/LDAP: CN=Dylan Bloggs,OU=Enterprise,OU=Sales,DC=Example,DC=COM or OIDC: - IdPIdentifier/IdPGroupName + IdPIdentifier/IdPGroupName" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudDatabaseUser' + $ref: "#/components/schemas/CloudDatabaseUser" description: Updates one database user that belongs to the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudDatabaseUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudDatabaseUser" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Database User in One Project @@ -7451,19 +7083,17 @@ paths: - Database Users /api/atlas/v2/groups/{groupId}/databaseUsers/{username}/certs: get: - description: >- - Returns all unexpired X.509 certificates for the specified MongoDB user. - This MongoDB user belongs to one project. Atlas manages these + description: Returns all unexpired X.509 certificates for the specified MongoDB + user. This MongoDB user belongs to one project. Atlas manages these certificates and the MongoDB user. To use this resource, the requesting API Key must have the Project Read Only role. operationId: listDatabaseUserCertificates parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Human-readable label that represents the MongoDB database user + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that represents the MongoDB database user account whose certificates you want to return. in: path name: username @@ -7471,19 +7101,19 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedUserCert' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedUserCert" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All X.509 Certificates Assigned to One MongoDB User @@ -7497,22 +7127,17 @@ paths: role. - To get MongoDB Cloud to generate a managed certificate for a database - user, set `"x509Type" : "MANAGED"` on the desired MongoDB Database User. + To get MongoDB Cloud to generate a managed certificate for a database user, set `"x509Type" : "MANAGED"` on the desired MongoDB Database User. - If you are managing your own Certificate Authority (CA) in Self-Managed - X.509 mode, you must generate certificates for database users using your - own CA. + If you are managing your own Certificate Authority (CA) in Self-Managed X.509 mode, you must generate certificates for database users using your own CA. externalDocs: description: Self-Managed X.509 - url: >- - https://www.mongodb.com/docs/atlas/security-self-managed-x509/#std-label-self-managed-x509 + url: https://www.mongodb.com/docs/atlas/security-self-managed-x509/#std-label-self-managed-x509 operationId: createDatabaseUserCertificate parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that represents the MongoDB database user + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that represents the MongoDB database user account for whom to create a certificate. in: path name: username @@ -7523,34 +7148,32 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserCert' + $ref: "#/components/schemas/UserCert" description: Generates one X.509 certificate for the specified MongoDB user. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: string - description: >- - PEM file that contains the user's X.509 certificate and - private key. - x-xgen-version: 2023-01-01T00:00:00.000Z - description: >- - This endpoint returns a PEM file with the certificate and private + description: PEM file that contains the user's X.509 certificate and private + key. + x-xgen-version: 2023-01-01 + description: This endpoint returns a PEM file with the certificate and private key. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One X.509 Certificate for One MongoDB User @@ -7558,20 +7181,18 @@ paths: - X.509 Authentication /api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}: get: - description: >- - Returns the access logs of one cluster identified by the cluster's name. - Access logs contain a list of authentication requests made against your - cluster. You can't use this feature on tenant-tier clusters (M0, M2, - M5). To use this resource, the requesting API Key must have the Project - Monitoring Admin role. + description: Returns the access logs of one cluster identified by the cluster's + name. Access logs contain a list of authentication requests made against + your cluster. You can't use this feature on tenant-tier clusters (M0, + M2, M5). To use this resource, the requesting API Key must have the + Project Monitoring Admin role. externalDocs: description: Database Access History url: https://docs.atlas.mongodb.com/access-tracking/ operationId: listAccessLogsByClusterName parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Flag that indicates whether the response returns the successful + - $ref: "#/components/parameters/groupId" + - description: Flag that indicates whether the response returns the successful authentication attempts only. in: query name: authResult @@ -7586,8 +7207,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Date and time when to stop retrieving database history. If you + - description: Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds. in: query @@ -7595,15 +7215,13 @@ paths: schema: type: integer format: int64 - - description: >- - One Internet Protocol address that attempted to authenticate with + - description: One Internet Protocol address that attempted to authenticate with the database. in: query name: ipAddress schema: type: string - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ - description: Maximum number of lines from the log to return. in: query name: nLogs @@ -7613,29 +7231,28 @@ paths: default: 20000 maximum: 20000 minimum: 0 - - description: >- - Date and time when MongoDB Cloud begins retrieving database history. - If you specify **start**, you must also specify **end**. This - parameter uses UNIX epoch time in milliseconds. + - description: Date and time when MongoDB Cloud begins retrieving database + history. If you specify **start**, you must also specify **end**. + This parameter uses UNIX epoch time in milliseconds. in: query name: start schema: type: integer format: int64 responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/MongoDBAccessLogsList' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/MongoDBAccessLogsList" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Database Access History for One Cluster using Its Cluster Name @@ -7643,8 +7260,7 @@ paths: - Access Tracking /api/atlas/v2/groups/{groupId}/dbAccessHistory/processes/{hostname}: get: - description: >- - Returns the access logs of one cluster identified by the cluster's + description: Returns the access logs of one cluster identified by the cluster's hostname. Access logs contain a list of authentication requests made against your clusters. You can't use this feature on tenant-tier clusters (M0, M2, M5). To use this resource, the requesting API Key must @@ -7654,16 +7270,14 @@ paths: url: https://docs.atlas.mongodb.com/access-tracking/ operationId: listAccessLogsByHostname parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Flag that indicates whether the response returns the successful + - $ref: "#/components/parameters/groupId" + - description: Flag that indicates whether the response returns the successful authentication attempts only. in: query name: authResult schema: type: boolean - - description: >- - Date and time when to stop retrieving database history. If you + - description: Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds. in: query @@ -7671,23 +7285,20 @@ paths: schema: type: integer format: int64 - - description: >- - Fully qualified domain name or IP address of the MongoDB host that + - description: Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download. in: path name: hostname required: true schema: type: string - - description: >- - One Internet Protocol address that attempted to authenticate with + - description: One Internet Protocol address that attempted to authenticate with the database. in: query name: ipAddress schema: type: string - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ - description: Maximum number of lines from the log to return. in: query name: nLogs @@ -7697,29 +7308,28 @@ paths: default: 20000 maximum: 20000 minimum: 0 - - description: >- - Date and time when MongoDB Cloud begins retrieving database history. - If you specify **start**, you must also specify **end**. This - parameter uses UNIX epoch time in milliseconds. + - description: Date and time when MongoDB Cloud begins retrieving database + history. If you specify **start**, you must also specify **end**. + This parameter uses UNIX epoch time in milliseconds. in: query name: start schema: type: integer format: int64 responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/MongoDBAccessLogsList' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/MongoDBAccessLogsList" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Database Access History for One Cluster using Its Hostname @@ -7734,27 +7344,25 @@ paths: the requesting API Key to have the Project Owner role. - **LIMITED TO M10 OR GREATER:** MongoDB Cloud limits this feature to - dedicated cluster tiers of M10 and greater. + **LIMITED TO M10 OR GREATER:** MongoDB Cloud limits this feature to dedicated cluster tiers of M10 and greater. operationId: getEncryptionAtRest parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/EncryptionAtRest' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/EncryptionAtRest" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Return One Configuration for Encryption at Rest using Customer-Managed + summary: Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project tags: - Encryption at Rest using Customer Key Management @@ -7770,59 +7378,50 @@ paths: After you configure at least one Encryption at Rest using a Customer Key Management provider for the MongoDB Cloud project, Project Owners can enable Encryption at Rest using Customer Key Management for each MongoDB Cloud cluster for which they require encryption. The Encryption at Rest using Customer Key Management provider doesn't have to match the cluster cloud service provider. MongoDB Cloud doesn't automatically rotate user-managed encryption keys. Defer to your preferred Encryption at Rest using Customer Key Management provider's documentation and guidance for best practices on key rotation. MongoDB Cloud automatically creates a 90-day key rotation alert when you configure Encryption at Rest using Customer Key Management using your Key Management in an MongoDB Cloud project. MongoDB Cloud encrypts all storage whether or not you use your own key management. operationId: updateEncryptionAtRest parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/EncryptionAtRest' + $ref: "#/components/schemas/EncryptionAtRest" description: >- Required parameters depend on whether someone has enabled Encryption at Rest using Customer Key Management: - If you have enabled Encryption at Rest using Customer Key Management - (CMK), Atlas requires all of the parameters for the desired encryption - provider. + If you have enabled Encryption at Rest using Customer Key Management (CMK), Atlas requires all of the parameters for the desired encryption provider. - - To use AWS Key Management Service (KMS), MongoDB Cloud requires all - the fields in the **awsKms** object. + - To use AWS Key Management Service (KMS), MongoDB Cloud requires all the fields in the **awsKms** object. - - To use Azure Key Vault, MongoDB Cloud requires all the fields in the - **azureKeyVault** object. + - To use Azure Key Vault, MongoDB Cloud requires all the fields in the **azureKeyVault** object. - - To use Google Cloud Key Management Service (KMS), MongoDB Cloud - requires all the fields in the **googleCloudKms** object. + - To use Google Cloud Key Management Service (KMS), MongoDB Cloud requires all the fields in the **googleCloudKms** object. - If you enabled Encryption at Rest using Customer Key Management, - administrators can pass only the changed fields for the **awsKms**, - **azureKeyVault**, or **googleCloudKms** object to update the - configuration to this endpoint. + If you enabled Encryption at Rest using Customer Key Management, administrators can pass only the changed fields for the **awsKms**, **azureKeyVault**, or **googleCloudKms** object to update the configuration to this endpoint. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/EncryptionAtRest' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/EncryptionAtRest" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Update Configuration for Encryption at Rest using Customer-Managed Keys + summary: Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project tags: - Encryption at Rest using Customer Key Management @@ -7838,10 +7437,10 @@ paths: This resource remains under revision and may change. operationId: listProjectEvents parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Human-readable label that identifies the cluster. in: query name: clusterNames @@ -7857,30 +7456,26 @@ paths: Category of incident recorded at this moment in time. - **IMPORTANT**: The complete list of event type values changes - frequently. + **IMPORTANT**: The complete list of event type values changes frequently. in: query name: eventType schema: type: array items: - $ref: '#/components/schemas/EventTypeForNdsGroup' + $ref: "#/components/schemas/EventTypeForNdsGroup" - description: >- Category of event that you would like to exclude from query results, such as CLUSTER_CREATED - **IMPORTANT**: Event type names change frequently. Verify that you - specify the event type correctly by checking the complete list of - event types. + **IMPORTANT**: Event type names change frequently. Verify that you specify the event type correctly by checking the complete list of event types. in: query name: excludedEventType schema: type: array items: - $ref: '#/components/schemas/EventTypeForNdsGroup' - - description: >- - Flag that indicates whether to include the raw document in the + $ref: "#/components/schemas/EventTypeForNdsGroup" + - description: Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event. in: query @@ -7888,8 +7483,7 @@ paths: schema: type: boolean default: false - - description: >- - Date and time from when MongoDB Cloud stops returning events. This + - description: Date and time from when MongoDB Cloud stops returning events. This parameter uses the ISO 8601 timestamp format in UTC. @@ -7898,8 +7492,7 @@ paths: schema: type: string format: date-time - - description: >- - Date and time from when MongoDB Cloud starts returning events. This + - description: Date and time from when MongoDB Cloud starts returning events. This parameter uses the ISO 8601 timestamp format in UTC. @@ -7909,19 +7502,19 @@ paths: type: string format: date-time responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupPaginatedEvent' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupPaginatedEvent" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Events from One Project @@ -7938,9 +7531,8 @@ paths: This resource remains under revision and may change. operationId: getProjectEvent parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the event that + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access. @@ -7952,8 +7544,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - Flag that indicates whether to include the raw document in the + - description: Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event. in: query @@ -7962,19 +7553,19 @@ paths: type: boolean default: false responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/EventViewForNdsGroup' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/EventViewForNdsGroup" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Event from One Project @@ -7983,28 +7574,27 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics: get: - description: >- - Returns all Atlas Search metric types available for one process in the - specified project. You must have the Project Read Only or higher role to - view the Atlas Search metric types. + description: Returns all Atlas Search metric types available for one process in + the specified project. You must have the Project Read Only or higher + role to view the Atlas Search metric types. operationId: listMetricTypes parameters: - - $ref: '#/components/parameters/processId' - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudSearchMetrics' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudSearchMetrics" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Atlas Search Metric Types for One Process @@ -8013,29 +7603,26 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/indexes/{databaseName}/{collectionName}/measurements: get: - description: >- - Returns the Atlas Search index metrics within the specified time range - for one namespace in the specified process. + description: Returns the Atlas Search index metrics within the specified time + range for one namespace in the specified process. operationId: listIndexMetrics parameters: - - $ref: '#/components/parameters/processId' - - $ref: '#/components/parameters/databaseName' - - $ref: '#/components/parameters/collectionName' - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/granularity' - - $ref: '#/components/parameters/period' - - $ref: '#/components/parameters/start' - - $ref: '#/components/parameters/end' - - description: >- - List that contains the measurements that MongoDB Atlas reports for + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/databaseName" + - $ref: "#/components/parameters/collectionName" + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - description: List that contains the measurements that MongoDB Atlas reports for the associated data series. in: query name: metrics required: true schema: type: array - description: >- - List that contains the measurements that MongoDB Atlas reports for + description: List that contains the measurements that MongoDB Atlas reports for the associated data series. items: type: string @@ -8043,19 +7630,19 @@ paths: uniqueItems: true style: form responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/MeasurementsIndexes' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/MeasurementsIndexes" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Atlas Search Index Metrics for One Namespace @@ -8064,32 +7651,29 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/indexes/{databaseName}/{collectionName}/{indexName}/measurements: get: - description: >- - Returns the Atlas Search metrics data series within the provided time - range for one namespace and index name on the specified process. You - must have the Project Read Only or higher role to view the Atlas Search - metric types. + description: Returns the Atlas Search metrics data series within the provided + time range for one namespace and index name on the specified process. + You must have the Project Read Only or higher role to view the Atlas + Search metric types. operationId: getIndexMetrics parameters: - - $ref: '#/components/parameters/processId' - - $ref: '#/components/parameters/indexName' - - $ref: '#/components/parameters/databaseName' - - $ref: '#/components/parameters/collectionName' - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/granularity' - - $ref: '#/components/parameters/period' - - $ref: '#/components/parameters/start' - - $ref: '#/components/parameters/end' - - description: >- - List that contains the measurements that MongoDB Atlas reports for + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/indexName" + - $ref: "#/components/parameters/databaseName" + - $ref: "#/components/parameters/collectionName" + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - description: List that contains the measurements that MongoDB Atlas reports for the associated data series. in: query name: metrics required: true schema: type: array - description: >- - List that contains the measurements that MongoDB Atlas reports for + description: List that contains the measurements that MongoDB Atlas reports for the associated data series. items: type: string @@ -8097,19 +7681,19 @@ paths: uniqueItems: true style: form responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/MeasurementsIndexes' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/MeasurementsIndexes" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Atlas Search Metrics for One Index in One Specified Namespace @@ -8118,31 +7702,28 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/measurements: get: - description: >- - Returns the Atlas Search hardware and status data series within the + description: Returns the Atlas Search hardware and status data series within the provided time range for one process in the specified project. You must have the Project Read Only or higher role to view the Atlas Search metric types. operationId: getMeasurements parameters: - - $ref: '#/components/parameters/processId' - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/granularity' - - $ref: '#/components/parameters/period' - - $ref: '#/components/parameters/start' - - $ref: '#/components/parameters/end' - - description: >- - List that contains the metrics that you want MongoDB Atlas to report - for the associated data series. If you don't set this parameter, - this resource returns all hardware and status metrics for the - associated data series. + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - description: List that contains the metrics that you want MongoDB Atlas to + report for the associated data series. If you don't set this + parameter, this resource returns all hardware and status metrics for + the associated data series. in: query name: metrics required: true schema: type: array - description: >- - List that contains the metrics that you want MongoDB Atlas to + description: List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series. @@ -8152,19 +7733,19 @@ paths: uniqueItems: true style: form responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/MeasurementsNonIndex' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/MeasurementsNonIndex" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Atlas Search Hardware and Status Metrics @@ -8173,33 +7754,32 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/integrations: get: - description: >- - Returns the settings that permit integrations with all configured + description: Returns the settings that permit integrations with all configured third-party services. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting API Key must have the Organization Owner or Project Owner role. operationId: listThirdPartyIntegrations parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedIntegration' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedIntegration" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Active Third-Party Service Integrations @@ -8207,18 +7787,16 @@ paths: - Third-Party Integrations /api/atlas/v2/groups/{groupId}/integrations/{integrationType}: delete: - description: >- - Removes the settings that permit configuring one third-party service - integration. These settings apply to all databases managed in one - MongoDB Cloud project. If you delete an integration from a project, you - remove that integration configuration only for that project. This action - doesn't affect any other project or organization's configured + description: Removes the settings that permit configuring one third-party + service integration. These settings apply to all databases managed in + one MongoDB Cloud project. If you delete an integration from a project, + you remove that integration configuration only for that project. This + action doesn't affect any other project or organization's configured `{INTEGRATION-TYPE}` integrations. To use this resource, the requesting API Key must have the Organization Owner or Project Owner role. operationId: deleteThirdPartyIntegration parameters: - - description: >- - Human-readable label that identifies the service which you want to + - description: Human-readable label that identifies the service which you want to integrate with MongoDB Cloud. in: path name: integrationType @@ -8226,39 +7804,37 @@ paths: schema: type: string title: Integration Type - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Third-Party Service Integration tags: - Third-Party Integrations get: - description: >- - Returns the settings for configuring integration with one third-party - service. These settings apply to all databases managed in one MongoDB - Cloud project. To use this resource, the requesting API Key must have - the Organization Owner or Project Owner role. + description: Returns the settings for configuring integration with one + third-party service. These settings apply to all databases managed in + one MongoDB Cloud project. To use this resource, the requesting API Key + must have the Organization Owner or Project Owner role. operationId: getThirdPartyIntegration parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the service which you want to + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the service which you want to integrate with MongoDB Cloud. in: path name: integrationType @@ -8267,37 +7843,36 @@ paths: type: string title: Integration Type responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ThridPartyIntegration' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ThridPartyIntegration" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Third-Party Service Integration tags: - Third-Party Integrations post: - description: >- - Adds the settings for configuring one third-party service integration. - These settings apply to all databases managed in the specified MongoDB - Cloud project. Each project can have only one configuration per - `{INTEGRATION-TYPE}`. To use this resource, the requesting API Key must - have the Organization Owner or Project Owner role. + description: Adds the settings for configuring one third-party service + integration. These settings apply to all databases managed in the + specified MongoDB Cloud project. Each project can have only one + configuration per `{INTEGRATION-TYPE}`. To use this resource, the + requesting API Key must have the Organization Owner or Project Owner + role. operationId: createThirdPartyIntegration parameters: - - description: >- - Human-readable label that identifies the service which you want to + - description: Human-readable label that identifies the service which you want to integrate with MongoDB Cloud. in: path name: integrationType @@ -8305,50 +7880,48 @@ paths: schema: type: string title: Integration Type - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ThridPartyIntegration' + $ref: "#/components/schemas/ThridPartyIntegration" description: Third-party integration that you want to configure for your project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedIntegration' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedIntegration" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Configure One Third-Party Service Integration tags: - Third-Party Integrations put: - description: >- - Updates the settings for configuring integration with one third-party - service. These settings apply to all databases managed in one MongoDB - Cloud project. To use this resource, the requesting API Key must have - the Organization Owner or Project Owner role. + description: Updates the settings for configuring integration with one + third-party service. These settings apply to all databases managed in + one MongoDB Cloud project. To use this resource, the requesting API Key + must have the Organization Owner or Project Owner role. operationId: updateThirdPartyIntegration parameters: - - description: >- - Human-readable label that identifies the service which you want to + - description: Human-readable label that identifies the service which you want to integrate with MongoDB Cloud. in: path name: integrationType @@ -8356,33 +7929,33 @@ paths: schema: type: string title: Integration Type - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ThridPartyIntegration' + $ref: "#/components/schemas/ThridPartyIntegration" description: Third-party integration that you want to configure for your project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedIntegration' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedIntegration" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Third-Party Service Integration @@ -8391,12 +7964,11 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/invites: get: - description: >- - Returns all pending invitations to the specified project. To use this - resource, the requesting API Key must have the Project Owner role. + description: Returns all pending invitations to the specified project. To use + this resource, the requesting API Key must have the Project Owner role. operationId: listProjectInvitations parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Email address of the user account invited to this project. in: query name: username @@ -8404,91 +7976,87 @@ paths: type: string format: email responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/GroupInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Project Invitations tags: - Projects patch: - description: >- - Updates the details of one pending invitation to the specified project. - To specify which invitation to update, provide the username of the - invited user. To use this resource, the requesting API Key must have the - Project Owner role. + description: Updates the details of one pending invitation to the specified + project. To specify which invitation to update, provide the username of + the invited user. To use this resource, the requesting API Key must have + the Project Owner role. operationId: updateProjectInvitation parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupInvitationRequest' - description: >- - Updates the details of one pending invitation to the specified - project. + $ref: "#/components/schemas/GroupInvitationRequest" + description: Updates the details of one pending invitation to the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Project Invitation tags: - Projects post: - description: >- - Invites one MongoDB Cloud user to join the specified project. The + description: Invites one MongoDB Cloud user to join the specified project. The MongoDB Cloud user must accept the invitation to access information within the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: createProjectInvitation parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupInvitationRequest' + $ref: "#/components/schemas/GroupInvitationRequest" description: Invites one MongoDB Cloud user to join the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Invite One MongoDB Cloud User to Join One Project @@ -8496,14 +8064,13 @@ paths: - Projects /api/atlas/v2/groups/{groupId}/invites/{invitationId}: delete: - description: >- - Cancels one pending invitation sent to the specified MongoDB Cloud user - to join a project. You can't cancel an invitation that the user + description: Cancels one pending invitation sent to the specified MongoDB Cloud + user to join a project. You can't cancel an invitation that the user accepted. To use this resource, the requesting API Key must have the Project Owner role. operationId: deleteProjectInvitation parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Unique 24-hexadecimal digit string that identifies the invitation. in: path name: invitationId @@ -8514,30 +8081,29 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Cancel One Project Invitation tags: - Projects get: - description: >- - Returns the details of one pending invitation to the specified project. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Returns the details of one pending invitation to the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. operationId: getProjectInvitation parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Unique 24-hexadecimal digit string that identifies the invitation. in: path name: invitationId @@ -8548,34 +8114,34 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Project Invitation tags: - Projects patch: - description: >- - Updates the details of one pending invitation to the specified project. - To specify which invitation to update, provide the unique identification - string for that invitation. Use the Return All Project Invitations - endpoint to retrieve IDs for all pending project invitations. To use - this resource, the requesting API Key must have the Project Owner role. + description: Updates the details of one pending invitation to the specified + project. To specify which invitation to update, provide the unique + identification string for that invitation. Use the Return All Project + Invitations endpoint to retrieve IDs for all pending project + invitations. To use this resource, the requesting API Key must have the + Project Owner role. operationId: updateProjectInvitationById parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Unique 24-hexadecimal digit string that identifies the invitation. in: path name: invitationId @@ -8589,27 +8155,25 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupInvitationUpdateRequest' - description: >- - Updates the details of one pending invitation to the specified - project. + $ref: "#/components/schemas/GroupInvitationUpdateRequest" + description: Updates the details of one pending invitation to the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupInvitation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Project Invitation by Invitation ID @@ -8617,32 +8181,31 @@ paths: - Projects /api/atlas/v2/groups/{groupId}/limits: get: - description: >- - Returns all the limits for the specified project. To use this resource, - the requesting API Key must have the Project Read Only role. + description: Returns all the limits for the specified project. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: listProjectLimits parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/DataFederationLimit' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataFederationLimit" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Limits for One Project @@ -8651,8 +8214,7 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/limits/{limitName}: delete: - description: >- - Removes the specified project limit. Depending on the limit, Atlas + description: Removes the specified project limit. Depending on the limit, Atlas either resets the limit to its default value or removes the limit entirely. To use this resource, the requesting API Key must have the Project Owner role. @@ -8666,67 +8228,51 @@ paths: | --- | --- | --- | --- | - | atlas.project.deployment.clusters | Limit on the number of - clusters in this project | 25 | 90 | + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | - | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the - number of nodes per Private Link region in this project | 50 | 90 | + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | - | atlas.project.security.databaseAccess.customRoles | Limit on the - number of custom roles in this project | 100 | 1400 | + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | - | atlas.project.security.databaseAccess.users | Limit on the number - of database users in this project | 100 | 900 | + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | - | atlas.project.security.networkAccess.crossRegionEntries | Limit on - the number of cross-region network access entries in this project | - 40 | 220 | + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | - | atlas.project.security.networkAccess.entries | Limit on the number - of network access entries in this project | 200 | 20 | + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | - | dataFederation.bytesProcessed.query | Limit on the number of bytes - processed during a single Data Federation query | N/A | N/A | + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | - | dataFederation.bytesProcessed.daily | Limit on the number of bytes - processed across all Data Federation tenants for the current day | - N/A | N/A | + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | - | dataFederation.bytesProcessed.weekly | Limit on the number of - bytes processed across all Data Federation tenants for the current - week | N/A | N/A | + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | - | dataFederation.bytesProcessed.monthly | Limit on the number of - bytes processed across all Data Federation tenants for the current - month | N/A | N/A | + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | - | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | - Number of Private Serivce Connections per Region Group | 50 | 100| + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| - | atlas.project.deployment.privateServiceConnectionsSubnetMask | - Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| in: path name: limitName required: true schema: type: string - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Project Limit @@ -8734,8 +8280,7 @@ paths: - Projects x-xgen-experimental: true get: - description: >- - Returns the specified limit for the specified project. To use this + description: Returns the specified limit for the specified project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getProjectLimit parameters: @@ -8747,69 +8292,53 @@ paths: | --- | --- | --- | --- | - | atlas.project.deployment.clusters | Limit on the number of - clusters in this project | 25 | 90 | + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | - | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the - number of nodes per Private Link region in this project | 50 | 90 | + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | - | atlas.project.security.databaseAccess.customRoles | Limit on the - number of custom roles in this project | 100 | 1400 | + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | - | atlas.project.security.databaseAccess.users | Limit on the number - of database users in this project | 100 | 900 | + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | - | atlas.project.security.networkAccess.crossRegionEntries | Limit on - the number of cross-region network access entries in this project | - 40 | 220 | + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | - | atlas.project.security.networkAccess.entries | Limit on the number - of network access entries in this project | 200 | 20 | + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | - | dataFederation.bytesProcessed.query | Limit on the number of bytes - processed during a single Data Federation query | N/A | N/A | + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | - | dataFederation.bytesProcessed.daily | Limit on the number of bytes - processed across all Data Federation tenants for the current day | - N/A | N/A | + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | - | dataFederation.bytesProcessed.weekly | Limit on the number of - bytes processed across all Data Federation tenants for the current - week | N/A | N/A | + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | - | dataFederation.bytesProcessed.monthly | Limit on the number of - bytes processed across all Data Federation tenants for the current - month | N/A | N/A | + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | - | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | - Number of Private Serivce Connections per Region Group | 50 | 100| + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| - | atlas.project.deployment.privateServiceConnectionsSubnetMask | - Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| in: path name: limitName required: true schema: type: string - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataFederationLimit' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataFederationLimit" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Limit for One Project @@ -8822,12 +8351,7 @@ paths: API Key must have the Project Owner role. - **NOTE**: Increasing the following configuration limits might lead to - slower response times in the MongoDB Cloud UI or increased user - management overhead leading to authentication or authorization - re-architecture. If possible, we recommend that you create additional - projects to gain access to more of these resources for a more - sustainable growth pattern. + **NOTE**: Increasing the following configuration limits might lead to slower response times in the MongoDB Cloud UI or increased user management overhead leading to authentication or authorization re-architecture. If possible, we recommend that you create additional projects to gain access to more of these resources for a more sustainable growth pattern. operationId: setProjectLimit parameters: - description: > @@ -8838,76 +8362,60 @@ paths: | --- | --- | --- | --- | - | atlas.project.deployment.clusters | Limit on the number of - clusters in this project | 25 | 90 | + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | - | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the - number of nodes per Private Link region in this project | 50 | 90 | + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | - | atlas.project.security.databaseAccess.customRoles | Limit on the - number of custom roles in this project | 100 | 1400 | + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | - | atlas.project.security.databaseAccess.users | Limit on the number - of database users in this project | 100 | 900 | + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | - | atlas.project.security.networkAccess.crossRegionEntries | Limit on - the number of cross-region network access entries in this project | - 40 | 220 | + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | - | atlas.project.security.networkAccess.entries | Limit on the number - of network access entries in this project | 200 | 20 | + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | - | dataFederation.bytesProcessed.query | Limit on the number of bytes - processed during a single Data Federation query | N/A | N/A | + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | - | dataFederation.bytesProcessed.daily | Limit on the number of bytes - processed across all Data Federation tenants for the current day | - N/A | N/A | + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | - | dataFederation.bytesProcessed.weekly | Limit on the number of - bytes processed across all Data Federation tenants for the current - week | N/A | N/A | + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | - | dataFederation.bytesProcessed.monthly | Limit on the number of - bytes processed across all Data Federation tenants for the current - month | N/A | N/A | + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | - | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | - Number of Private Serivce Connections per Region Group | 50 | 100| + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| - | atlas.project.deployment.privateServiceConnectionsSubnetMask | - Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| in: path name: limitName required: true schema: type: string - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataFederationLimit' + $ref: "#/components/schemas/DataFederationLimit" description: Limit to update. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataFederationLimit' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataFederationLimit" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Set One Project Limit @@ -8916,7 +8424,7 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/liveMigrations: post: - description: |- + description: >- Migrate one cluster that Cloud or Ops Manager manages to MongoDB Atlas. Please make sure to [validate](#tag/Cloud-Migration-Service/operation/validateOneMigration) your migration before initiating it. @@ -8924,32 +8432,32 @@ paths: You can use this API endpoint for push live migrations only. Your API Key must have the Organization Owner role to successfully call this resource. operationId: createPushMigration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LiveMigrationRequest' + $ref: "#/components/schemas/LiveMigrationRequest" description: One migration to be created. required: true responses: - '201': + "201": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LiveMigrationResponse' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/LiveMigrationResponse" + x-xgen-version: 2023-01-01 description: Created - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Migrate One Local Managed Cluster to MongoDB Atlas @@ -8957,39 +8465,39 @@ paths: - Cloud Migration Service /api/atlas/v2/groups/{groupId}/liveMigrations/validate: post: - description: >- - Verifies whether the provided credentials, available disk space, MongoDB - versions, and so on meet the requirements of the migration request. If - the check passes, the migration can proceed. Your API Key must have the - Organization Owner role to successfully call this resource. + description: Verifies whether the provided credentials, available disk space, + MongoDB versions, and so on meet the requirements of the migration + request. If the check passes, the migration can proceed. Your API Key + must have the Organization Owner role to successfully call this + resource. operationId: validateMigration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LiveMigrationRequest' + $ref: "#/components/schemas/LiveMigrationRequest" description: One migration to be validated. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LiveImportValidation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/LiveImportValidation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Validate One Migration Request @@ -8997,14 +8505,13 @@ paths: - Cloud Migration Service /api/atlas/v2/groups/{groupId}/liveMigrations/validate/{validationId}: get: - description: >- - Return the status of one migration validation job. Your API Key must - have the Organization Owner role to successfully call this resource. + description: Return the status of one migration validation job. Your API Key + must have the Organization Owner role to successfully call this + resource. operationId: getValidationStatus parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the validation + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the validation job. in: path name: validationId @@ -9016,23 +8523,23 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LiveImportValidation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/LiveImportValidation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Migration Validation Job @@ -9040,30 +8547,29 @@ paths: - Cloud Migration Service /api/atlas/v2/groups/{groupId}/liveMigrations/{liveMigrationId}: get: - description: >- - Return details of one cluster migration job. Each push live migration - job uses one migration host. Your API Key must have the Organization - Member role to successfully call this resource. + description: Return details of one cluster migration job. Each push live + migration job uses one migration host. Your API Key must have the + Organization Member role to successfully call this resource. operationId: getPushMigration parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/liveMigrationId' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/liveMigrationId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LiveMigrationResponse' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/LiveMigrationResponse" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Migration Job @@ -9071,32 +8577,31 @@ paths: - Cloud Migration Service /api/atlas/v2/groups/{groupId}/liveMigrations/{liveMigrationId}/cutover: put: - description: >- - Cut over the migrated cluster to MongoDB Atlas. Confirm when the cut - over completes. When the cut over completes, MongoDB Atlas completes the - live migration process and stops synchronizing with the source cluster. - Your API Key must have the Organization Owner role to successfully call - this resource. + description: Cut over the migrated cluster to MongoDB Atlas. Confirm when the + cut over completes. When the cut over completes, MongoDB Atlas completes + the live migration process and stops synchronizing with the source + cluster. Your API Key must have the Organization Owner role to + successfully call this resource. operationId: cutoverMigration parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/liveMigrationId' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/liveMigrationId" responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: Accepted. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Cut Over the Migrated Cluster @@ -9104,9 +8609,8 @@ paths: - Cloud Migration Service /api/atlas/v2/groups/{groupId}/maintenanceWindow: delete: - description: >- - Resets the maintenance window for the specified project. To use this - resource, the requesting API Key must have the Project Owner role. + description: Resets the maintenance window for the specified project. To use + this resource, the requesting API Key must have the Project Owner role. Urgent maintenance activities such as security patches can't wait for your chosen window. MongoDB Cloud starts those maintenance activities when needed. After you schedule maintenance for your cluster, you can't @@ -9119,58 +8623,56 @@ paths: must have the Project Owner role. operationId: resetMaintenanceWindow parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Reset One Maintenance Window for One Project tags: - Maintenance Windows get: - description: >- - Returns the maintenance window for the specified project. MongoDB Cloud - starts those maintenance activities when needed. You can't change your - maintenance window until the current maintenance efforts complete. The - maintenance procedure that MongoDB Cloud performs requires at least one - replica set election during the maintenance window per replica set. + description: Returns the maintenance window for the specified project. MongoDB + Cloud starts those maintenance activities when needed. You can't change + your maintenance window until the current maintenance efforts complete. + The maintenance procedure that MongoDB Cloud performs requires at least + one replica set election during the maintenance window per replica set. Maintenance always begins as close to the scheduled hour as possible, but in-progress cluster updates or unexpected system issues could delay the start time. To use this resource, the requesting API Key must have the Project Owner role. operationId: getMaintenanceWindow parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupMaintenanceWindow' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupMaintenanceWindow" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Maintenance Window for One Project tags: - Maintenance Windows patch: - description: >- - Updates the maintenance window for the specified project. Urgent + description: Updates the maintenance window for the specified project. Urgent maintenance activities such as security patches can't wait for your chosen window. MongoDB Cloud starts those maintenance activities when needed. After you schedule maintenance for your cluster, you can't @@ -9183,28 +8685,28 @@ paths: must have the Project Owner role. operationId: updateMaintenanceWindow parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupMaintenanceWindow' + $ref: "#/components/schemas/GroupMaintenanceWindow" description: Updates the maintenance window for the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Maintenance Window for One Project @@ -9212,25 +8714,24 @@ paths: - Maintenance Windows /api/atlas/v2/groups/{groupId}/maintenanceWindow/autoDefer: post: - description: >- - Toggles automatic deferral of the maintenance window for the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + description: Toggles automatic deferral of the maintenance window for the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. operationId: toggleMaintenanceAutoDefer parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Toggle Automatic Deferral of Maintenance for One Project @@ -9239,8 +8740,7 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/maintenanceWindow/defer: post: - description: >- - Defers the maintenance window for the specified project. Urgent + description: Defers the maintenance window for the specified project. Urgent maintenance activities such as security patches can't wait for your chosen window. MongoDB Cloud starts those maintenance activities when needed. After you schedule maintenance for your cluster, you can't @@ -9253,19 +8753,19 @@ paths: must have the Project Owner role. operationId: deferMaintenanceWindow parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Defer One Maintenance Window for One Project @@ -9273,9 +8773,8 @@ paths: - Maintenance Windows /api/atlas/v2/groups/{groupId}/managedSlowMs/disable: delete: - description: >- - Disables the slow operation threshold that MongoDB Cloud calculated for - the specified project. The threshold determines which operations the + description: Disables the slow operation threshold that MongoDB Cloud calculated + for the specified project. The threshold determines which operations the Performance Advisor and Query Profiler considers slow. When enabled, MongoDB Cloud uses the average execution time for operations on your cluster to determine slow-running queries. As a result, the threshold is @@ -9286,19 +8785,19 @@ paths: Project Owner role. operationId: disableSlowOperationThresholding parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Disable Managed Slow Operation Threshold @@ -9306,8 +8805,7 @@ paths: - Performance Advisor /api/atlas/v2/groups/{groupId}/managedSlowMs/enable: post: - description: >- - Enables MongoDB Cloud to use its slow operation threshold for the + description: Enables MongoDB Cloud to use its slow operation threshold for the specified project. The threshold determines which operations the Performance Advisor and Query Profiler considers slow. When enabled, MongoDB Cloud uses the average execution time for operations on your @@ -9319,19 +8817,19 @@ paths: Project Owner role. operationId: enableSlowOperationThresholding parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Enable Managed Slow Operation Threshold @@ -9339,17 +8837,16 @@ paths: - Performance Advisor /api/atlas/v2/groups/{groupId}/peers: get: - description: >- - Returns details about all network peering connections in the specified - project. Network peering allows multiple cloud-hosted applications to - securely connect to the same project. To use this resource, the - requesting API Key must have the Project Read Only role. + description: Returns details about all network peering connections in the + specified project. Network peering allows multiple cloud-hosted + applications to securely connect to the same project. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: listPeeringConnections parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Cloud service provider to use for this VPC peering connection. in: query name: providerName @@ -9357,63 +8854,61 @@ paths: type: string default: AWS responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedContainerPeer' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedContainerPeer" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Network Peering Connections in One Project tags: - Network Peering post: - description: >- - Creates one new network peering connection in the specified project. - Network peering allows multiple cloud-hosted applications to securely - connect to the same project. To use this resource, the requesting API - Key must have the Project Owner role. To learn more about considerations - and prerequisites, see the Network Peering Documentation. + description: Creates one new network peering connection in the specified + project. Network peering allows multiple cloud-hosted applications to + securely connect to the same project. To use this resource, the + requesting API Key must have the Project Owner role. To learn more about + considerations and prerequisites, see the Network Peering Documentation. externalDocs: description: Azure Network Peering Prerequisites - url: >- - https://docs.atlas.mongodb.com/reference/api/vpc-create-peering-connection/#prerequisites + url: https://docs.atlas.mongodb.com/reference/api/vpc-create-peering-connection/#prerequisites operationId: createPeeringConnection parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" description: Create one network peering connection. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One New Network Peering Connection @@ -9421,17 +8916,15 @@ paths: - Network Peering /api/atlas/v2/groups/{groupId}/peers/{peerId}: delete: - description: >- - Removes one network peering connection in the specified project. If you - Removes the last network peering connection associated with a project, - MongoDB Cloud also removes any AWS security groups from the project IP - access list. To use this resource, the requesting API Key must have the - Project Owner role. + description: Removes one network peering connection in the specified project. If + you Removes the last network peering connection associated with a + project, MongoDB Cloud also removes any AWS security groups from the + project IP access list. To use this resource, the requesting API Key + must have the Project Owner role. operationId: deletePeeringConnection parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the network + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete. in: path name: peerId @@ -9442,34 +8935,32 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/RequestAccepted' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/RequestAccepted" + x-xgen-version: 2023-01-01 description: Accepted - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Existing Network Peering Connection tags: - Network Peering get: - description: >- - Returns details about one specified network peering connection in the - specified project. To use this resource, the requesting API Key must + description: Returns details about one specified network peering connection in + the specified project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getPeeringConnection parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the network + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve. in: path name: peerId @@ -9480,34 +8971,32 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Network Peering Connection in One Project tags: - Network Peering patch: - description: >- - Updates one specified network peering connection in the specified + description: Updates one specified network peering connection in the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: updatePeeringConnection parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the network + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update. in: path name: peerId @@ -9521,27 +9010,27 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" description: Modify one network peering connection. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One New Network Peering Connection @@ -9550,28 +9039,27 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/pipelines: get: - description: >- - Returns a list of Data Lake Pipelines. To use this resource, the + description: Returns a list of Data Lake Pipelines. To use this resource, the requesting API Key must have the Project Read Only role. operationId: listPipelines parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/DataLakeIngestionPipeline' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Data Lake Pipelines from One Project @@ -9581,30 +9069,30 @@ paths: description: Creates one Data Lake Pipeline. operationId: createPipeline parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeIngestionPipeline' + $ref: "#/components/schemas/DataLakeIngestionPipeline" description: Creates one Data Lake Pipeline. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeIngestionPipeline' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Data Lake Pipeline @@ -9615,7 +9103,7 @@ paths: description: Removes one Data Lake Pipeline. operationId: deletePipeline parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9626,32 +9114,31 @@ paths: minLength: 1 pattern: ^[^/\\ "$]{1,64}$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Data Lake Pipeline tags: - Data Lake Pipelines get: - description: >- - Returns the details of one Data Lake Pipeline within the specified + description: Returns the details of one Data Lake Pipeline within the specified project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getPipeline parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9662,19 +9149,19 @@ paths: minLength: 1 pattern: ^[^/\\ "$]{1,64}$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeIngestionPipeline' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Data Lake Pipeline @@ -9684,7 +9171,7 @@ paths: description: Updates one Data Lake Pipeline. operationId: updatePipeline parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9698,27 +9185,27 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeIngestionPipeline' + $ref: "#/components/schemas/DataLakeIngestionPipeline" description: Updates one Data Lake Pipeline. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeIngestionPipeline' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Data Lake Pipeline @@ -9726,13 +9213,12 @@ paths: - Data Lake Pipelines /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/availableSchedules: get: - description: >- - Returns a list of backup schedule policy items that you can use as a - Data Lake Pipeline source. To use this resource, the requesting API Key - must have the Project Read Only role. + description: Returns a list of backup schedule policy items that you can use as + a Data Lake Pipeline source. To use this resource, the requesting API + Key must have the Project Read Only role. operationId: listPipelineSchedules parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9743,21 +9229,21 @@ paths: minLength: 1 pattern: ^[^/\\ "$]{1,64}$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/DiskBackupApiPolicyItem' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DiskBackupApiPolicyItem" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Available Ingestion Schedules for One Data Lake Pipeline @@ -9765,18 +9251,16 @@ paths: - Data Lake Pipelines /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/availableSnapshots: get: - description: >- - Returns a list of backup snapshots that you can use to trigger an on - demand pipeline run. To use this resource, the requesting API Key must - have the Project Read Only role. + description: Returns a list of backup snapshots that you can use to trigger an + on demand pipeline run. To use this resource, the requesting API Key + must have the Project Read Only role. operationId: listPipelineSnapshots parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Date and time after which MongoDB Cloud created the snapshot. If + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC. @@ -9785,7 +9269,7 @@ paths: schema: type: string format: date-time - example: 2022-01-01T00:00:00.000Z + example: 2022-01-01T00:00:00Z - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9796,19 +9280,19 @@ paths: minLength: 1 pattern: ^[^/\\ "$]{1,64}$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedBackupSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedBackupSnapshot" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Available Backup Snapshots for One Data Lake Pipeline @@ -9816,13 +9300,12 @@ paths: - Data Lake Pipelines /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/pause: post: - description: >- - Pauses ingestion for a Data Lake Pipeline within the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Pauses ingestion for a Data Lake Pipeline within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: pausePipeline parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9833,19 +9316,19 @@ paths: minLength: 1 pattern: ^[^/\\ "$]{1,64}$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeIngestionPipeline' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Pause One Data Lake Pipeline @@ -9853,13 +9336,12 @@ paths: - Data Lake Pipelines /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/resume: post: - description: >- - Resumes ingestion for a Data Lake Pipeline within the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Resumes ingestion for a Data Lake Pipeline within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: resumePipeline parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9870,19 +9352,19 @@ paths: minLength: 1 pattern: ^[^/\\ "$]{1,64}$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/DataLakeIngestionPipeline' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/DataLakeIngestionPipeline" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Resume One Data Lake Pipeline @@ -9890,24 +9372,22 @@ paths: - Data Lake Pipelines /api/atlas/v2/groups/{groupId}/pipelines/{pipelineName}/runs: get: - description: >- - Returns a list of past Data Lake Pipeline runs. To use this resource, - the requesting API Key must have the Project Read Only role. + description: Returns a list of past Data Lake Pipeline runs. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: listPipelineRuns parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - If specified, Atlas returns only Data Lake Pipeline runs initiated + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date. in: query name: createdBefore schema: type: string format: date-time - example: 2022-01-01T00:00:00.000Z + example: 2022-01-01T00:00:00Z - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9918,19 +9398,19 @@ paths: minLength: 1 pattern: ^[^/\\ "$]{1,64}$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedPipelineRun' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedPipelineRun" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Data Lake Pipeline Runs from One Project @@ -9941,7 +9421,7 @@ paths: description: Deletes dataset that Atlas generated during the specified pipeline run. operationId: deletePipelineRunDataset parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9951,8 +9431,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[^/\\ "$]{1,64}$ - - description: >- - Unique 24-hexadecimal character string that identifies a Data Lake + - description: Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run. in: path name: pipelineRunId @@ -9964,32 +9443,31 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/RequestAccepted' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/RequestAccepted" + x-xgen-version: 2023-01-01 description: Accepted - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Delete Pipeline Run Dataset tags: - Data Lake Pipelines get: - description: >- - Returns the details of one Data Lake Pipeline run within the specified - project. To use this resource, the requesting API Key must have the - Project Read Only role. + description: Returns the details of one Data Lake Pipeline run within the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. operationId: getPipelineRun parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -9999,8 +9477,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[^/\\ "$]{1,64}$ - - description: >- - Unique 24-hexadecimal character string that identifies a Data Lake + - description: Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run. in: path name: pipelineRunId @@ -10012,19 +9489,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/IngestionPipelineRun' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/IngestionPipelineRun" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Data Lake Pipeline Run @@ -10035,7 +9512,7 @@ paths: description: Triggers a Data Lake Pipeline ingestion of a specified snapshot. operationId: triggerSnapshotIngestion parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the Data Lake Pipeline. in: path name: pipelineName @@ -10049,23 +9526,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TriggerIngestionPipelineRequest' + $ref: "#/components/schemas/TriggerIngestionPipelineRequest" description: Triggers a single ingestion run of a snapshot. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/IngestionPipelineRun' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/IngestionPipelineRun" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Trigger on demand snapshot ingestion @@ -10073,36 +9550,35 @@ paths: - Data Lake Pipelines /api/atlas/v2/groups/{groupId}/privateEndpoint/endpointService: post: - description: >- - Creates one private endpoint service for the specified cloud service - provider. This cloud service provider manages the private endpoint - service for the project. When you create a private endpoint service, - MongoDB Cloud creates a network container in the project for the cloud - provider for which you create the private endpoint service if one - doesn't already exist. To use this resource, the requesting API Key must - have the Project Owner role. + description: Creates one private endpoint service for the specified cloud + service provider. This cloud service provider manages the private + endpoint service for the project. When you create a private endpoint + service, MongoDB Cloud creates a network container in the project for + the cloud provider for which you create the private endpoint service if + one doesn't already exist. To use this resource, the requesting API Key + must have the Project Owner role. operationId: createPrivateEndpointService parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudProviderEndpointServiceRequest' + $ref: "#/components/schemas/CloudProviderEndpointServiceRequest" description: Creates one private endpoint for the specified cloud service provider. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/EndpointService' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/EndpointService" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Private Endpoint Service for One Provider @@ -10110,70 +9586,67 @@ paths: - Private Endpoint Services /api/atlas/v2/groups/{groupId}/privateEndpoint/regionalMode: get: - description: >- - Checks whether each region in the specified cloud service provider can - create multiple private endpoints per region. The cloud service provider - manages the private endpoint for the project. To use this resource, the - requesting API Key must have the Project Read Only role. + description: Checks whether each region in the specified cloud service provider + can create multiple private endpoints per region. The cloud service + provider manages the private endpoint for the project. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: getRegionalizedPrivateEndpointSetting parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ProjectSettingItem' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ProjectSettingItem" + x-xgen-version: 2023-01-01 description: OK - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Regionalized Private Endpoint Status tags: - Private Endpoint Services patch: - description: >- - Enables or disables the ability to create multiple private endpoints per - region in all cloud service providers in one project. The cloud service - provider manages the private endpoints for the project. Connection - strings to existing multi-region and global sharded clusters change when - you enable this setting. You must update your applications to use the - new connection strings. This might cause downtime. To use this resource, - the requesting API Key must have the Project Owner role and all clusters - in the deployment must be sharded clusters. Once enabled, you cannot - create replica sets. + description: Enables or disables the ability to create multiple private + endpoints per region in all cloud service providers in one project. The + cloud service provider manages the private endpoints for the project. + Connection strings to existing multi-region and global sharded clusters + change when you enable this setting. You must update your applications + to use the new connection strings. This might cause downtime. To use + this resource, the requesting API Key must have the Project Owner role + and all clusters in the deployment must be sharded clusters. Once + enabled, you cannot create replica sets. operationId: toggleRegionalizedPrivateEndpointSetting parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ProjectSettingItem' - description: >- - Enables or disables the ability to create multiple private endpoints - per region in all cloud service providers in one project. + $ref: "#/components/schemas/ProjectSettingItem" + description: Enables or disables the ability to create multiple private + endpoints per region in all cloud service providers in one project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ProjectSettingItem' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ProjectSettingItem" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Toggle Regionalized Private Endpoint Status @@ -10181,15 +9654,13 @@ paths: - Private Endpoint Services /api/atlas/v2/groups/{groupId}/privateEndpoint/serverless/instance/{instanceName}/endpoint: get: - description: >- - Returns all private endpoints for one serverless instance. You must have - at least the Project Read Only role for the project to successfully call - this resource. + description: Returns all private endpoints for one serverless instance. You must + have at least the Project Read Only role for the project to successfully + call this resource. operationId: listServerlessPrivateEndpoints parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the serverless instance + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance associated with the tenant endpoint. in: path name: instanceName @@ -10199,21 +9670,21 @@ paths: maxLength: 64 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/ServerlessTenantEndpoint' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessTenantEndpoint" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Private Endpoints for One Serverless Instance @@ -10230,9 +9701,8 @@ paths: url: https://dochub.mongodb.org/core/serverless-private-endpoint operationId: createServerlessPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the serverless instance for + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance for which the tenant endpoint will be created. in: path name: instanceName @@ -10245,25 +9715,24 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessTenantCreateRequest' - description: >- - Information about the Private Endpoint to create for the Serverless + $ref: "#/components/schemas/ServerlessTenantCreateRequest" + description: Information about the Private Endpoint to create for the Serverless Instance. required: true responses: - '201': + "201": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessTenantEndpoint' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessTenantEndpoint" + x-xgen-version: 2023-01-01 description: Created - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Private Endpoint for One Serverless Instance @@ -10272,14 +9741,12 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/privateEndpoint/serverless/instance/{instanceName}/endpoint/{endpointId}: delete: - description: >- - Remove one private endpoint from one serverless instance. To use this - resource, the requesting API Key must have the Project Owner role. + description: Remove one private endpoint from one serverless instance. To use + this resource, the requesting API Key must have the Project Owner role. operationId: deleteServerlessPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the serverless instance from + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed. in: path name: instanceName @@ -10288,8 +9755,7 @@ paths: type: string maxLength: 64 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the tenant + - description: Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed. in: path name: endpointId @@ -10300,19 +9766,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Private Endpoint for One Serverless Instance @@ -10320,15 +9786,13 @@ paths: - Serverless Private Endpoints x-xgen-experimental: true get: - description: >- - Return one private endpoint for one serverless instance. Identify this - endpoint using its unique ID. You must have at least the Project Read - Only role for the project to successfully call this resource. + description: Return one private endpoint for one serverless instance. Identify + this endpoint using its unique ID. You must have at least the Project + Read Only role for the project to successfully call this resource. operationId: getServerlessPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the serverless instance + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance associated with the tenant endpoint. in: path name: instanceName @@ -10337,8 +9801,7 @@ paths: type: string maxLength: 64 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the tenant + - description: Unique 24-hexadecimal digit string that identifies the tenant endpoint. in: path name: endpointId @@ -10349,19 +9812,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessTenantEndpoint' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessTenantEndpoint" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Private Endpoint for One Serverless Instance @@ -10369,14 +9832,12 @@ paths: - Serverless Private Endpoints x-xgen-experimental: true patch: - description: >- - Updates one private endpoint for one serverless instance. To use this - resource, the requesting API Key must have the Project Owner role. + description: Updates one private endpoint for one serverless instance. To use + this resource, the requesting API Key must have the Project Owner role. operationId: updateServerlessPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the serverless instance + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated. in: path name: instanceName @@ -10385,8 +9846,7 @@ paths: type: string maxLength: 64 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the tenant + - description: Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated. in: path name: endpointId @@ -10400,23 +9860,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessTenantEndpointUpdate' + $ref: "#/components/schemas/ServerlessTenantEndpointUpdate" description: Object used for update. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessTenantEndpoint' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessTenantEndpoint" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Private Endpoint for One Serverless Instance @@ -10425,14 +9885,14 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService: get: - description: >- - Returns the name, interfaces, and state of all private endpoint services - for the specified cloud service provider. This cloud service provider - manages the private endpoint service for the project. To use this - resource, the requesting API Key must have the Project Read Only role. + description: Returns the name, interfaces, and state of all private endpoint + services for the specified cloud service provider. This cloud service + provider manages the private endpoint service for the project. To use + this resource, the requesting API Key must have the Project Read Only + role. operationId: listPrivateEndpointServices parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Cloud service provider that manages this private endpoint service. in: path name: cloudProvider @@ -10441,19 +9901,19 @@ paths: type: string default: AWS responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/EndpointService' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/EndpointService" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Private Endpoint Services for One Provider @@ -10461,14 +9921,13 @@ paths: - Private Endpoint Services /api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}: delete: - description: >- - Removes one private endpoint service from the specified project. This - cloud service provider manages the private endpoint service that belongs - to the project. To use this resource, the requesting API Key must have - the Project Owner role. + description: Removes one private endpoint service from the specified project. + This cloud service provider manages the private endpoint service that + belongs to the project. To use this resource, the requesting API Key + must have the Project Owner role. operationId: deletePrivateEndpointService parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Cloud service provider that manages this private endpoint service. in: path name: cloudProvider @@ -10476,8 +9935,7 @@ paths: schema: type: string default: AWS - - description: >- - Unique 24-hexadecimal digit string that identifies the private + - description: Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete. in: path name: endpointServiceId @@ -10488,31 +9946,30 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Private Endpoint Service for One Provider tags: - Private Endpoint Services get: - description: >- - Returns the name, interfaces, and state of the specified private + description: Returns the name, interfaces, and state of the specified private endpoint service from one project. The cloud service provider hosted this private endpoint service that belongs to the project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getPrivateEndpointService parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Cloud service provider that manages this private endpoint service. in: path name: cloudProvider @@ -10520,8 +9977,7 @@ paths: schema: type: string default: AWS - - description: >- - Unique 24-hexadecimal digit string that identifies the private + - description: Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return. in: path name: endpointServiceId @@ -10532,19 +9988,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/EndpointService' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/EndpointService" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Private Endpoint Service for One Provider @@ -10552,16 +10008,16 @@ paths: - Private Endpoint Services /api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}/endpoint: post: - description: >- - Creates one private endpoint for the specified cloud service provider. - This cloud service provider manages the private endpoint service, which - in turn manages the private endpoints for the project. To use this - resource, the requesting API Key must have the Project Owner role. To - learn more about considerations, limitations, and prerequisites, see the - MongoDB documentation for setting up a private endpoint. + description: Creates one private endpoint for the specified cloud service + provider. This cloud service provider manages the private endpoint + service, which in turn manages the private endpoints for the project. To + use this resource, the requesting API Key must have the Project Owner + role. To learn more about considerations, limitations, and + prerequisites, see the MongoDB documentation for setting up a private + endpoint. operationId: createPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Cloud service provider that manages this private endpoint. in: path name: cloudProvider @@ -10569,8 +10025,7 @@ paths: schema: type: string default: AWS - - description: >- - Unique 24-hexadecimal digit string that identifies the private + - description: Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint. in: path name: endpointServiceId @@ -10584,27 +10039,27 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CreateEndpointRequest' + $ref: "#/components/schemas/CreateEndpointRequest" description: Creates one private endpoint for the specified cloud service provider. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PrivateLinkEndpoint' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PrivateLinkEndpoint" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '402': - $ref: '#/components/responses/paymentRequired' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "402": + $ref: "#/components/responses/paymentRequired" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Private Endpoint for One Provider @@ -10612,15 +10067,14 @@ paths: - Private Endpoint Services /api/atlas/v2/groups/{groupId}/privateEndpoint/{cloudProvider}/endpointService/{endpointServiceId}/endpoint/{endpointId}: delete: - description: >- - Removes one private endpoint from the specified project and private + description: Removes one private endpoint from the specified project and private endpoint service, as managed by the specified cloud service provider. When the last private endpoint is removed from a given private endpoint service, that private endpoint service is also removed. To use this resource, the requesting API Key must have the Project Owner role. operationId: deletePrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Cloud service provider that manages this private endpoint. in: path name: cloudProvider @@ -10628,8 +10082,7 @@ paths: schema: type: string default: AWS - - description: >- - Unique string that identifies the private endpoint you want to + - description: Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints. @@ -10638,10 +10091,8 @@ paths: required: true schema: type: string - pattern: >- - ^vpce-[0-9a-f]{17}|^%2[fF]subscriptions%2[fF][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]resource[gG]roups%2[fF]([-\w._()]+)%2[fF]providers%2[fF]Microsoft\.Network%2[fF]privateEndpoints%2[fF]([-\w._()]+) - - description: >- - Unique 24-hexadecimal digit string that identifies the private + pattern: ^vpce-[0-9a-f]{17}|^%2[fF]subscriptions%2[fF][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]resource[gG]roups%2[fF]([-\w._()]+)%2[fF]providers%2[fF]Microsoft\.Network%2[fF]privateEndpoints%2[fF]([-\w._()]+) + - description: Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint. in: path name: endpointServiceId @@ -10652,31 +10103,30 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Private Endpoint for One Provider tags: - Private Endpoint Services get: - description: >- - Returns the connection state of the specified private endpoint. The + description: Returns the connection state of the specified private endpoint. The private endpoint service manages this private endpoint which belongs to one project hosted from one cloud service provider. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Cloud service provider that manages this private endpoint. in: path name: cloudProvider @@ -10684,8 +10134,7 @@ paths: schema: type: string default: AWS - - description: >- - Unique string that identifies the private endpoint you want to + - description: Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints. @@ -10694,10 +10143,8 @@ paths: required: true schema: type: string - pattern: >- - ^vpce-[0-9a-f]{17}|^%2[fF]subscriptions%2[fF][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]resource[gG]roups%2[fF]([-\w._()]+)%2[fF]providers%2[fF]Microsoft\.Network%2[fF]privateEndpoints%2[fF]([-\w._()]+) - - description: >- - Unique 24-hexadecimal digit string that identifies the private + pattern: ^vpce-[0-9a-f]{17}|^%2[fF]subscriptions%2[fF][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]resource[gG]roups%2[fF]([-\w._()]+)%2[fF]providers%2[fF]Microsoft\.Network%2[fF]privateEndpoints%2[fF]([-\w._()]+) + - description: Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint. in: path name: endpointServiceId @@ -10708,19 +10155,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PrivateLinkEndpoint' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PrivateLinkEndpoint" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Private Endpoint for One Provider @@ -10729,28 +10176,27 @@ paths: /api/atlas/v2/groups/{groupId}/privateIpMode: get: deprecated: true - description: >- - Verifies if someone set the specified project to **Connect via Peering - Only** mode. To use this resource, the requesting API Key must have the - Project Read Only role. + description: Verifies if someone set the specified project to **Connect via + Peering Only** mode. To use this resource, the requesting API Key must + have the Project Read Only role. externalDocs: description: Changes to Connection Strings url: https://docs.atlas.mongodb.com/reference/faq/connection-changes/ operationId: verifyConnectViaPeeringOnlyModeForOneProject parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PrivateIPMode' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PrivateIPMode" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Verify Connect via Peering Only Mode for One Project @@ -10759,36 +10205,36 @@ paths: x-xgen-experimental: true patch: deprecated: true - description: >- - Disables Connect via Peering Only mode for the specified project. To use - this resource, the requesting API Key must have the Project Owner role. + description: Disables Connect via Peering Only mode for the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. externalDocs: description: Changes to Connection Strings url: https://docs.atlas.mongodb.com/reference/faq/connection-changes/ operationId: disablePeering parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PrivateIPMode' + $ref: "#/components/schemas/PrivateIPMode" description: Disables Connect via Peering Only mode for the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PrivateIPMode' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PrivateIPMode" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Disable Connect via Peering Only Mode for One Project @@ -10797,37 +10243,35 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/privateNetworkSettings/endpointIds: get: - description: >- - Returns all private endpoints for Federated Database Instances and + description: Returns all private endpoints for Federated Database Instances and Online Archives in the specified project. To use this resource, the requesting API Key must have the Project Read Only or Project Charts Admin roles. operationId: listDataFederationPrivateEndpoints parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedPrivateNetworkEndpointIdEntry' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedPrivateNetworkEndpointIdEntry" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Return All Federated Database Instance and Online Archive Private + summary: Return All Federated Database Instance and Online Archive Private Endpoints in One Project tags: - Data Federation @@ -10862,48 +10306,44 @@ paths: To use this resource, the requesting API Key must have the Project Owner or Project Charts Admin roles. operationId: createDataFederationPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PrivateNetworkEndpointIdEntry' - description: >- - Private endpoint for Federated Database Instances and Online Archives - to add to the specified project. + $ref: "#/components/schemas/PrivateNetworkEndpointIdEntry" + description: Private endpoint for Federated Database Instances and Online + Archives to add to the specified project. required: true responses: - '201': + "201": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedPrivateNetworkEndpointIdEntry' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedPrivateNetworkEndpointIdEntry" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Create One Federated Database Instance and Online Archive Private + summary: Create One Federated Database Instance and Online Archive Private Endpoint for One Project tags: - Data Federation /api/atlas/v2/groups/{groupId}/privateNetworkSettings/endpointIds/{endpointId}: delete: - description: >- - Removes one private endpoint for Federated Database Instances and Online - Archives in the specified project. To use this resource, the requesting - API Key must have the Project Owner role. + description: Removes one private endpoint for Federated Database Instances and + Online Archives in the specified project. To use this resource, the + requesting API Key must have the Project Owner role. operationId: deleteDataFederationPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 22-character alphanumeric string that identifies the private + - $ref: "#/components/parameters/groupId" + - description: Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature. in: path @@ -10915,37 +10355,34 @@ paths: minLength: 22 pattern: ^vpce-[0-9a-f]{17}$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Remove One Federated Database Instance and Online Archive Private + summary: Remove One Federated Database Instance and Online Archive Private Endpoint from One Project tags: - Data Federation get: - description: >- - Returns the specified private endpoint for Federated Database Instances - or Online Archives in the specified project. To use this resource, the - requesting API Key must have the Project Read Only or Project Charts - Admin roles. + description: Returns the specified private endpoint for Federated Database + Instances or Online Archives in the specified project. To use this + resource, the requesting API Key must have the Project Read Only or + Project Charts Admin roles. operationId: getDataFederationPrivateEndpoint parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 22-character alphanumeric string that identifies the private + - $ref: "#/components/parameters/groupId" + - description: Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature. in: path @@ -10957,52 +10394,50 @@ paths: minLength: 22 pattern: ^vpce-[0-9a-f]{17}$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PrivateNetworkEndpointIdEntry' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PrivateNetworkEndpointIdEntry" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Return One Federated Database Instance and Online Archive Private + summary: Return One Federated Database Instance and Online Archive Private Endpoint in One Project tags: - Data Federation /api/atlas/v2/groups/{groupId}/processes: get: - description: >- - Returns details of all processes for the specified project. A MongoDB - process can be either a `mongod` or `mongos`. To use this resource, the - requesting API Key must have the Project Read Only role. + description: Returns details of all processes for the specified project. A + MongoDB process can be either a `mongod` or `mongos`. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: listAtlasProcesses parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedHostView_Atlas' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedHostView_Atlas" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All MongoDB Processes in One Project @@ -11010,15 +10445,13 @@ paths: - Monitoring and Logs /api/atlas/v2/groups/{groupId}/processes/{processId}: get: - description: >- - Returns the processes for the specified host for the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Returns the processes for the specified host for the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: getAtlasProcess parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Combination of hostname and Internet Assigned Numbers Authority + - $ref: "#/components/parameters/groupId" + - description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process @@ -11030,20 +10463,19 @@ paths: schema: type: string example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiHostView_Atlas' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiHostView_Atlas" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One MongoDB Process by ID @@ -11051,8 +10483,7 @@ paths: - Monitoring and Logs /api/atlas/v2/groups/{groupId}/processes/{processId}/databases: get: - description: >- - Returns the list of databases running on the specified host for the + description: Returns the list of databases running on the specified host for the specified project. `M0` free clusters, `M2`, `M5`, and serverless clusters have some [operational limits](https://www.mongodb.com/docs/atlas/reference/free-shared-limitations/#operational-limitations). @@ -11060,12 +10491,11 @@ paths: requesting API Key must have the Project Read Only role. operationId: listDatabases parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Combination of hostname and Internet Assigned Numbers Authority + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process @@ -11077,20 +10507,19 @@ paths: schema: type: string example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedDatabase' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedDatabase" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Available Databases for One MongoDB Process @@ -11098,23 +10527,20 @@ paths: - Monitoring and Logs /api/atlas/v2/groups/{groupId}/processes/{processId}/databases/{databaseName}: get: - description: >- - Returns one database running on the specified host for the specified - project. To use this resource, the requesting API Key must have the - Project Read Only role. + description: Returns one database running on the specified host for the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. operationId: getDatabase parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the database that the specified - MongoDB process serves. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database that the + specified MongoDB process serves. in: path name: databaseName required: true schema: type: string - - description: >- - Combination of hostname and Internet Assigned Numbers Authority + - description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process @@ -11126,20 +10552,19 @@ paths: schema: type: string example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/MesurementsDatabase' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/MesurementsDatabase" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Database for a MongoDB Process @@ -11148,29 +10573,26 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/processes/{processId}/databases/{databaseName}/measurements: get: - description: >- - Returns the measurements of one database for the specified host for the - specified project. Returns the database's on-disk storage space based on - the MongoDB `dbStats` command output. To calculate some metric series, - Atlas takes the rate between every two adjacent points. For these metric - series, the first data point has a null value because Atlas can't - calculate a rate for the first data point given the query time range. - Atlas retrieves database metrics every 20 minutes but reduces frequency - when necessary to optimize database performance. To use this resource, - the requesting API Key must have the Project Read Only role. + description: Returns the measurements of one database for the specified host for + the specified project. Returns the database's on-disk storage space + based on the MongoDB `dbStats` command output. To calculate some metric + series, Atlas takes the rate between every two adjacent points. For + these metric series, the first data point has a null value because Atlas + can't calculate a rate for the first data point given the query time + range. Atlas retrieves database metrics every 20 minutes but reduces + frequency when necessary to optimize database performance. To use this + resource, the requesting API Key must have the Project Read Only role. operationId: getDatabaseMeasurements parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the database that the specified - MongoDB process serves. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the database that the + specified MongoDB process serves. in: path name: databaseName required: true schema: type: string - - description: >- - One or more types of measurement to request for this MongoDB + - description: One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. @@ -11187,8 +10609,7 @@ paths: minItems: 1 uniqueItems: true style: form - - description: >- - Combination of hostname and Internet Assigned Numbers Authority + - description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process @@ -11200,41 +10621,38 @@ paths: schema: type: string example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - - $ref: '#/components/parameters/granularity' - - $ref: '#/components/parameters/period' - - $ref: '#/components/parameters/start' - - $ref: '#/components/parameters/end' + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiMeasurementsGeneralView_Atlas' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiMeasurementsGeneralView_Atlas" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" summary: Return Measurements of One Database for One MongoDB Process tags: - Monitoring and Logs /api/atlas/v2/groups/{groupId}/processes/{processId}/disks: get: - description: >- - Returns the list of disks or partitions for the specified host for the - specified project. To use this resource, the requesting API Key must + description: Returns the list of disks or partitions for the specified host for + the specified project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: listDiskPartitions parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Combination of hostname and Internet Assigned Numbers Authority + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process @@ -11246,20 +10664,19 @@ paths: schema: type: string example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedDiskPartition' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedDiskPartition" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Available Disks for One MongoDB Process @@ -11267,23 +10684,20 @@ paths: - Monitoring and Logs /api/atlas/v2/groups/{groupId}/processes/{processId}/disks/{partitionName}: get: - description: >- - Returns measurement details for one disk or partition for the specified - host for the specified project. To use this resource, the requesting API - Key must have the Project Read Only role. + description: Returns measurement details for one disk or partition for the + specified host for the specified project. To use this resource, the + requesting API Key must have the Project Read Only role. operationId: listDiskMeasurements parameters: - - description: >- - Human-readable label of the disk or partition to which the + - description: Human-readable label of the disk or partition to which the measurements apply. in: path name: partitionName required: true schema: type: string - - $ref: '#/components/parameters/groupId' - - description: >- - Combination of hostname and Internet Assigned Numbers Authority + - $ref: "#/components/parameters/groupId" + - description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process @@ -11295,20 +10709,19 @@ paths: schema: type: string example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/MeasurementDiskPartition' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/MeasurementDiskPartition" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Measurements of One Disk @@ -11321,26 +10734,20 @@ paths: Returns the measurements of one disk or partition for the specified host for the specified project. Returned value can be one of the following: - - Throughput of I/O operations for the disk partition used for the - MongoDB process + - Throughput of I/O operations for the disk partition used for the MongoDB process - - Percentage of time during which requests the partition issued and - serviced + - Percentage of time during which requests the partition issued and serviced - - Latency per operation type of the disk partition used for the MongoDB - process + - Latency per operation type of the disk partition used for the MongoDB process - - Amount of free and used disk space on the disk partition used for the - MongoDB process + - Amount of free and used disk space on the disk partition used for the MongoDB process - To use this resource, the requesting API Key must have the Project Read - Only role. + To use this resource, the requesting API Key must have the Project Read Only role. operationId: getDiskMeasurements parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - One or more types of measurement to request for this MongoDB + - $ref: "#/components/parameters/groupId" + - description: One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. @@ -11357,16 +10764,14 @@ paths: minItems: 1 uniqueItems: true style: form - - description: >- - Human-readable label of the disk or partition to which the + - description: Human-readable label of the disk or partition to which the measurements apply. in: path name: partitionName required: true schema: type: string - - description: >- - Combination of hostname and Internet Assigned Numbers Authority + - description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process @@ -11378,24 +10783,23 @@ paths: schema: type: string example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - - $ref: '#/components/parameters/granularity' - - $ref: '#/components/parameters/period' - - $ref: '#/components/parameters/start' - - $ref: '#/components/parameters/end' + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/period" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiMeasurementsGeneralView_Atlas' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiMeasurementsGeneralView_Atlas" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Measurements of One Disk for One MongoDB Process @@ -11408,29 +10812,22 @@ paths: specified host for the specified project. Returned value can be one of the following: - - Throughput of I/O operations for the disk partition used for the - MongoDB process + - Throughput of I/O operations for the disk partition used for the MongoDB process - - Percentage of time during which requests the partition issued and - serviced + - Percentage of time during which requests the partition issued and serviced - - Latency per operation type of the disk partition used for the MongoDB - process + - Latency per operation type of the disk partition used for the MongoDB process - - Amount of free and used disk space on the disk partition used for the - MongoDB process + - Amount of free and used disk space on the disk partition used for the MongoDB process - - Measurements for the host, such as CPU usage or number of I/O - operations + - Measurements for the host, such as CPU usage or number of I/O operations - To use this resource, the requesting API Key must have the Project Read - Only role. + To use this resource, the requesting API Key must have the Project Read Only role. operationId: getHostMeasurements parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - One or more types of measurement to request for this MongoDB + - $ref: "#/components/parameters/groupId" + - description: One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. @@ -11447,9 +10844,8 @@ paths: minItems: 1 uniqueItems: true style: form - - $ref: '#/components/parameters/period' - - description: >- - Combination of hostname and Internet Assigned Numbers Authority + - $ref: "#/components/parameters/period" + - description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process @@ -11461,23 +10857,22 @@ paths: schema: type: string example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - - $ref: '#/components/parameters/granularity' - - $ref: '#/components/parameters/start' - - $ref: '#/components/parameters/end' + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + - $ref: "#/components/parameters/granularity" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiMeasurementsGeneralView_Atlas' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiMeasurementsGeneralView_Atlas" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Measurements for One MongoDB Process @@ -11485,33 +10880,29 @@ paths: - Monitoring and Logs /api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/namespaces: get: - description: >- - Returns up to 20 namespaces for collections experiencing slow queries on - the specified host. If you specify a secondary member of a replica set - that hasn't received any database read operations, the endpoint doesn't - return any namespaces. To use this resource, the requesting API Key must - have the Project Read Only role. + description: Returns up to 20 namespaces for collections experiencing slow + queries on the specified host. If you specify a secondary member of a + replica set that hasn't received any database read operations, the + endpoint doesn't return any namespaces. To use this resource, the + requesting API Key must have the Project Read Only role. operationId: listSlowQueryNamespaces parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: >- Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - - If you don't specify the **since** parameter, the endpoint returns - data covering the duration before the current time. + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - - If you specify neither the **duration** nor **since** parameters, - the endpoint returns data from the previous 24 hours. + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. in: query name: duration schema: type: integer format: int64 - - description: >- - Combination of host and port that serves the MongoDB process. The + - description: Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for @@ -11521,8 +10912,7 @@ paths: required: true schema: type: string - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that @@ -11530,11 +10920,9 @@ paths: epoch](https://en.wikipedia.org/wiki/Unix_time). - - If you don't specify the **duration** parameter, the endpoint - returns data covering from the **since** value and the current time. + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - - If you specify neither the **duration** nor the **since** - parameters, the endpoint returns data from the previous 24 hours. + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. in: query name: since schema: @@ -11542,17 +10930,17 @@ paths: format: int64 minimum: 1199145600 responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Namespaces' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/Namespaces" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Namespaces for One Host @@ -11560,8 +10948,7 @@ paths: - Performance Advisor /api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/slowQueryLogs: get: - description: >- - Returns log lines for slow queries that the Performance Advisor and + description: Returns log lines for slow queries that the Performance Advisor and Query Profiler identified. The Performance Advisor monitors queries that MongoDB considers slow and suggests new indexes to improve query performance. MongoDB Cloud bases the threshold for slow queries on the @@ -11570,30 +10957,27 @@ paths: API Key must have the Project Data Access Read Write role. operationId: listSlowQueries parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: >- Length of time expressed during which the query finds slow queries among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - - If you don't specify the **since** parameter, the endpoint returns - data covering the duration before the current time. + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - - If you specify neither the **duration** nor **since** parameters, - the endpoint returns data from the previous 24 hours. + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. in: query name: duration schema: type: integer format: int64 - - description: >- - Namespaces from which to retrieve slow queries. A namespace consists - of one database and one collection resource written as `.`: + - description: "Namespaces from which to retrieve slow queries. A namespace + consists of one database and one collection resource written as `.`: `.`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all - namespaces. + namespaces." in: query name: namespaces schema: @@ -11610,8 +10994,7 @@ paths: default: 20000 maximum: 20000 minimum: 0 - - description: >- - Combination of host and port that serves the MongoDB process. The + - description: Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for @@ -11621,8 +11004,7 @@ paths: required: true schema: type: string - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the slow queries. This parameter expresses its value in the number of seconds that have @@ -11630,11 +11012,9 @@ paths: epoch](https://en.wikipedia.org/wiki/Unix_time). - - If you don't specify the **duration** parameter, the endpoint - returns data covering from the **since** value and the current time. + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - - If you specify neither the **duration** nor the **since** - parameters, the endpoint returns data from the previous 24 hours. + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. in: query name: since schema: @@ -11642,17 +11022,17 @@ paths: format: int64 minimum: 1199145600 responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PerformanceAdvisorSlowQueryList' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PerformanceAdvisorSlowQueryList" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Slow Queries @@ -11660,40 +11040,36 @@ paths: - Performance Advisor /api/atlas/v2/groups/{groupId}/processes/{processId}/performanceAdvisor/suggestedIndexes: get: - description: >- - Returns the indexes that the Performance Advisor suggests. The + description: Returns the indexes that the Performance Advisor suggests. The Performance Advisor monitors queries that MongoDB considers slow and suggests new indexes to improve query performance. To use this resource, the requesting API Key must have the Project Read Only role. operationId: listSuggestedIndexes parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: >- Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. - - If you don't specify the **since** parameter, the endpoint returns - data covering the duration before the current time. + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - - If you specify neither the **duration** nor **since** parameters, - the endpoint returns data from the previous 24 hours. + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. in: query name: duration schema: type: integer format: int64 - - description: >- - Namespaces from which to retrieve suggested indexes. A namespace + - description: "Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `.`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all - namespaces. + namespaces." in: query name: namespaces schema: @@ -11701,8 +11077,7 @@ paths: items: type: string style: form - - description: >- - Maximum number of example queries that benefit from the suggested + - description: Maximum number of example queries that benefit from the suggested index. in: query name: nExamples @@ -11716,8 +11091,7 @@ paths: schema: type: integer format: int64 - - description: >- - Combination of host and port that serves the MongoDB process. The + - description: Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for @@ -11727,8 +11101,7 @@ paths: required: true schema: type: string - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that @@ -11736,28 +11109,26 @@ paths: epoch](https://en.wikipedia.org/wiki/Unix_time). - - If you don't specify the **duration** parameter, the endpoint - returns data covering from the **since** value and the current time. + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - - If you specify neither the **duration** nor the **since** - parameters, the endpoint returns data from the previous 24 hours. + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. in: query name: since schema: type: integer format: int64 responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PerformanceAdvisorResponse' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PerformanceAdvisorResponse" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Suggested Indexes @@ -11765,28 +11136,27 @@ paths: - Performance Advisor /api/atlas/v2/groups/{groupId}/pushBasedLogExport: delete: - description: >- - Disables the push-based log export feature by resetting the project + description: Disables the push-based log export feature by resetting the project level settings to its default configuration. operationId: deletePushBasedLogConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Disable the push-based log export feature for a project @@ -11794,28 +11164,27 @@ paths: - Push-Based Log Export x-xgen-experimental: true get: - description: >- - Fetches the current project level settings for the push-based log export - feature. + description: Fetches the current project level settings for the push-based log + export feature. operationId: getPushBasedLogConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PushBasedLogExportProject' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PushBasedLogExportProject" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Get the push-based log export configuration for a project @@ -11823,39 +11192,36 @@ paths: - Push-Based Log Export x-xgen-experimental: true patch: - description: >- - Updates the project level settings for the push-based log export - feature. + description: Updates the project level settings for the push-based log export feature. operationId: updatePushBasedLogConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PushBasedLogExportProject' - x-xgen-version: 2023-01-01T00:00:00.000Z - description: >- - The project configuration details. The S3 bucket name, IAM role ID, + $ref: "#/components/schemas/PushBasedLogExportProject" + x-xgen-version: 2023-01-01 + description: The project configuration details. The S3 bucket name, IAM role ID, and prefix path fields are the only fields that may be specified. Fields left unspecified will not be modified. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update the push-based log export feature for a project @@ -11863,38 +11229,36 @@ paths: - Push-Based Log Export x-xgen-experimental: true post: - description: >- - Configures the project level settings for the push-based log export + description: Configures the project level settings for the push-based log export feature. operationId: createPushBasedLogConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PushBasedLogExportProject' - x-xgen-version: 2023-01-01T00:00:00.000Z - description: >- - The project configuration details. The S3 bucket name, IAM role ID, + $ref: "#/components/schemas/PushBasedLogExportProject" + x-xgen-version: 2023-01-01 + description: The project configuration details. The S3 bucket name, IAM role ID, and prefix path fields are required. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Enable the push-based log export feature for a project @@ -11903,16 +11267,14 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/sampleDatasetLoad/{name}: post: - description: >- - Requests loading the MongoDB sample dataset into the specified cluster. - To use this resource, the requesting API Key must have the Project Owner - role. + description: Requests loading the MongoDB sample dataset into the specified + cluster. To use this resource, the requesting API Key must have the + Project Owner role. operationId: loadSampleDataset parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the cluster into which you load - the sample dataset. + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster into which you + load the sample dataset. in: path name: name required: true @@ -11922,21 +11284,21 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '201': + "201": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/SampleDatasetStatus' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/SampleDatasetStatus" + x-xgen-version: 2023-01-01 description: Created - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Load Sample Dataset Request into Cluster @@ -11944,16 +11306,14 @@ paths: - Clusters /api/atlas/v2/groups/{groupId}/sampleDatasetLoad/{sampleDatasetId}: get: - description: >- - Checks the progress of loading the sample dataset into one cluster. To - use this resource, the requesting API Key must have the Project Owner + description: Checks the progress of loading the sample dataset into one cluster. + To use this resource, the requesting API Key must have the Project Owner role. operationId: getSampleDatasetLoadStatus parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the loaded sample - dataset. + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the loaded + sample dataset. in: path name: sampleDatasetId required: true @@ -11963,17 +11323,17 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/SampleDatasetStatus' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/SampleDatasetStatus" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Check Status of Cluster Sample Dataset Request @@ -11981,63 +11341,61 @@ paths: - Clusters /api/atlas/v2/groups/{groupId}/serverless: get: - description: >- - Returns details for all serverless instances in the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Returns details for all serverless instances in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: listServerlessInstances parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedServerlessInstanceDescription' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedServerlessInstanceDescription" + x-xgen-version: 2023-01-01 description: OK - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Serverless Instances from One Project tags: - Serverless Instances post: - description: >- - Creates one serverless instance in the specified project. To use this - resource, the requesting API Key must have the Project Owner role. + description: Creates one serverless instance in the specified project. To use + this resource, the requesting API Key must have the Project Owner role. operationId: createServerlessInstance parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessInstanceDescriptionCreate' + $ref: "#/components/schemas/ServerlessInstanceDescriptionCreate" description: Create One Serverless Instance in One Project. required: true responses: - '201': + "201": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessInstanceDescription' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessInstanceDescription" + x-xgen-version: 2023-01-01 description: Created - '400': - $ref: '#/components/responses/badRequest' - '402': - $ref: '#/components/responses/paymentRequired' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "402": + $ref: "#/components/responses/paymentRequired" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Serverless Instance in One Project @@ -12045,16 +11403,15 @@ paths: - Serverless Instances /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/restoreJobs: get: - description: >- - Returns all restore jobs for one serverless instance from the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + description: Returns all restore jobs for one serverless instance from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. operationId: listServerlessBackupRestoreJobs parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Human-readable label that identifies the serverless instance. in: path name: clusterName @@ -12065,35 +11422,32 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: >- - #/components/schemas/PaginatedApiAtlasServerlessBackupRestoreJob - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiAtlasServerlessBackupRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Restore Jobs for One Serverless Instance tags: - Cloud Backups post: - description: >- - Restores one snapshot of one serverless instance from the specified + description: Restores one snapshot of one serverless instance from the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: createServerlessBackupRestoreJob parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Human-readable label that identifies the serverless instance whose + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the serverless instance whose snapshot you want to restore. in: path name: clusterName @@ -12107,29 +11461,28 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessBackupRestoreJob' - description: >- - Restores one snapshot of one serverless instance from the specified + $ref: "#/components/schemas/ServerlessBackupRestoreJob" + description: Restores one snapshot of one serverless instance from the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessBackupRestoreJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessBackupRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Restore One Snapshot of One Serverless Instance @@ -12137,13 +11490,12 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/restoreJobs/{restoreJobId}: get: - description: >- - Returns one restore job for one serverless instance from the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + description: Returns one restore job for one serverless instance from the + specified project. To use this resource, the requesting API Key must + have the Project Owner role. operationId: getServerlessBackupRestoreJob parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the serverless instance. in: path name: clusterName @@ -12153,8 +11505,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the restore job + - description: Unique 24-hexadecimal digit string that identifies the restore job to return. in: path name: restoreJobId @@ -12165,19 +11516,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessBackupRestoreJob' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessBackupRestoreJob" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Restore Job for One Serverless Instance @@ -12185,16 +11536,15 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/snapshots: get: - description: >- - Returns all snapshots of one serverless instance from the specified + description: Returns all snapshots of one serverless instance from the specified project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: listServerlessBackups parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Human-readable label that identifies the serverless instance. in: path name: clusterName @@ -12205,19 +11555,19 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiAtlasServerlessBackupSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiAtlasServerlessBackupSnapshot" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Snapshots of One Serverless Instance @@ -12225,13 +11575,12 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/backup/snapshots/{snapshotId}: get: - description: >- - Returns one snapshot of one serverless instance from the specified + description: Returns one snapshot of one serverless instance from the specified project. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getServerlessBackup parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the serverless instance. in: path name: clusterName @@ -12241,8 +11590,7 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: >- - Unique 24-hexadecimal digit string that identifies the desired + - description: Unique 24-hexadecimal digit string that identifies the desired snapshot. in: path name: snapshotId @@ -12254,19 +11602,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessBackupSnapshot' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessBackupSnapshot" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Snapshot of One Serverless Instance @@ -12274,14 +11622,13 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/serverless/{name}: delete: - description: >- - Removes one serverless instance from the specified project. The + description: Removes one serverless instance from the specified project. The serverless instance must have termination protection disabled in order to be deleted. To use this resource, the requesting API Key must have the Project Owner role. operationId: deleteServerlessInstance parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the serverless instance. in: path name: name @@ -12292,34 +11639,33 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Serverless Instance from One Project tags: - Serverless Instances get: - description: >- - Returns details for one serverless instance in the specified project. To - use this resource, the requesting API Key must have the Project Read - Only role. + description: Returns details for one serverless instance in the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: getServerlessInstance parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the serverless instance. in: path name: name @@ -12330,33 +11676,32 @@ paths: minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessInstanceDescription' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessInstanceDescription" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Serverless Instance from One Project tags: - Serverless Instances patch: - description: >- - Updates one serverless instance in the specified project. To use this - resource, the requesting API Key must have the Project Owner role. + description: Updates one serverless instance in the specified project. To use + this resource, the requesting API Key must have the Project Owner role. operationId: updateServerlessInstance parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the serverless instance. in: path name: name @@ -12370,23 +11715,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessInstanceDescriptionUpdate' + $ref: "#/components/schemas/ServerlessInstanceDescriptionUpdate" description: Update One Serverless Instance in One Project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ServerlessInstanceDescription' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ServerlessInstanceDescription" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '402': - $ref: '#/components/responses/paymentRequired' - '409': - $ref: '#/components/responses/conflict' + "400": + $ref: "#/components/responses/badRequest" + "402": + $ref: "#/components/responses/paymentRequired" + "409": + $ref: "#/components/responses/conflict" security: - DigestAuth: [] summary: Update One Serverless Instance in One Project @@ -12394,65 +11739,63 @@ paths: - Serverless Instances /api/atlas/v2/groups/{groupId}/settings: get: - description: >- - Returns details about the specified project's settings. To use this + description: Returns details about the specified project's settings. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getProjectSettings parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupSettings" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Project Settings tags: - Projects patch: - description: >- - Updates the settings of the specified project. You can update any of the - options available. MongoDB cloud only updates the options provided in - the request. To use this resource, the requesting API Key must have the - Project Owner role. + description: Updates the settings of the specified project. You can update any + of the options available. MongoDB cloud only updates the options + provided in the request. To use this resource, the requesting API Key + must have the Project Owner role. operationId: updateProjectSettings parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupSettings' + $ref: "#/components/schemas/GroupSettings" description: Settings to update. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/GroupSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/GroupSettings" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Project Settings @@ -12463,77 +11806,73 @@ paths: description: Returns all stream instances for the specified project. operationId: listStreamInstances parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/PaginatedApiStreamsTenant' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiStreamsTenant" + x-xgen-version: 2023-02-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Project Stream Instances tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true post: - description: >- - Creates one stream instance in the specified project. To use this + description: Creates one stream instance in the specified project. To use this resource, the requesting API Key must have the Project Owner roles. operationId: createStreamInstance parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsTenant' + $ref: "#/components/schemas/StreamsTenant" description: Details to create one streams instance in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsTenant' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/StreamsTenant" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Stream Instance tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/streams/{tenantName}: delete: - description: >- - Delete one stream instance in the specified project. To use this + description: Delete one stream instance in the specified project. To use this resource, the requesting API Key must have the Project Owner roles. operationId: deleteStreamInstance parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the stream instance to delete. in: path name: tenantName @@ -12541,85 +11880,80 @@ paths: schema: type: string responses: - '202': + "202": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-02-01 description: Accepted - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Delete One Stream Instance tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true get: - description: >- - Returns the details of one stream instance within the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. + description: Returns the details of one stream instance within the specified + project. To use this resource, the requesting API Key must have the + Project Read Only role. operationId: getStreamInstance parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the stream instance to return. in: path name: tenantName required: true schema: type: string - - description: >- - Flag to indicate whether connections information should be included + - description: Flag to indicate whether connections information should be included in the stream instance. in: query name: includeConnections schema: type: boolean responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsTenant' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/StreamsTenant" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Stream Instance tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true patch: - description: >- - Update one stream instance in the specified project. To use this + description: Update one stream instance in the specified project. To use this resource, the requesting API Key must have the Project Owner roles. operationId: updateStreamInstance parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the stream instance to update. in: path name: tenantName @@ -12630,49 +11964,45 @@ paths: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsDataProcessRegion' - description: >- - Details of the new data process region to update in the streams + $ref: "#/components/schemas/StreamsDataProcessRegion" + description: Details of the new data process region to update in the streams instance. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsTenant' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/StreamsTenant" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Stream Instance tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections: get: - description: >- - Returns all connections of the stream instance for the specified - project. + description: Returns all connections of the stream instance for the specified project. operationId: listStreamConnections parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" - description: Human-readable label that identifies the stream instance. in: path name: tenantName @@ -12680,37 +12010,35 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/PaginatedApiStreamsConnection' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiStreamsConnection" + x-xgen-version: 2023-02-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Connections Of The Stream Instances tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true post: - description: >- - Creates one connection for a stream instance in the specified project. - To use this resource, the requesting API Key must have the Project Owner - roles. + description: Creates one connection for a stream instance in the specified + project. To use this resource, the requesting API Key must have the + Project Owner roles. operationId: createStreamConnection parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the stream instance. in: path name: tenantName @@ -12721,45 +12049,42 @@ paths: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsConnection' - description: >- - Details to create one connection for a streams instance in the + $ref: "#/components/schemas/StreamsConnection" + description: Details to create one connection for a streams instance in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsConnection' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/StreamsConnection" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '409': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "409": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Connection tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}: delete: - description: >- - Delete one connection of the specified stream instance. To use this + description: Delete one connection of the specified stream instance. To use this resource, the requesting API Key must have the Project Owner roles. operationId: deleteStreamConnection parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the stream instance. in: path name: tenantName @@ -12773,85 +12098,79 @@ paths: schema: type: string responses: - '202': + "202": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-02-01 description: Accepted - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Delete One Stream Connection tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true get: - description: >- - Returns the details of one stream connection within the specified stream - instance. To use this resource, the requesting API Key must have the - Project Read Only role. + description: Returns the details of one stream connection within the specified + stream instance. To use this resource, the requesting API Key must have + the Project Read Only role. operationId: getStreamConnection parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the stream instance to return. in: path name: tenantName required: true schema: type: string - - description: >- - Human-readable label that identifies the stream connection to - return. + - description: Human-readable label that identifies the stream connection to return. in: path name: connectionName required: true schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsConnection' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/StreamsConnection" + x-xgen-version: 2023-02-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Stream Connection tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true patch: - description: >- - Update one connection for the specified stream instance in the specified - project. To use this resource, the requesting API Key must have the - Project Owner roles. + description: Update one connection for the specified stream instance in the + specified project. To use this resource, the requesting API Key must + have the Project Owner roles. operationId: updateStreamConnection parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the stream instance. in: path name: tenantName @@ -12868,116 +12187,111 @@ paths: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsConnection' - description: >- - Details to update one connection for a streams instance in the + $ref: "#/components/schemas/StreamsConnection" + description: Details to update one connection for a streams instance in the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-02-01+json: schema: - $ref: '#/components/schemas/StreamsConnection' - x-xgen-version: 2023-02-01T00:00:00.000Z + $ref: "#/components/schemas/StreamsConnection" + x-xgen-version: 2023-02-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Stream Connection tags: - Streams x-xgen-changelog: - Mon Sep 11 2023 01:00:00 GMT+0100 (Irish Standard Time): >- - The MongoDB Atlas Streams Processing API is now exposed as part of + 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/teams: get: - description: >- - Returns all teams to which the authenticated user has access in the + description: Returns all teams to which the authenticated user has access in the project specified using its unique 24-hexadecimal digit identifier. All members of the team share the same project access. To use this resource, the requesting API Key must have the Project Read Only role. operationId: listProjectTeams parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedTeamRole' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedTeamRole" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Teams in One Project tags: - Teams post: - description: >- - Adds one team to the specified project. All members of the team share - the same project access. MongoDB Cloud limits the number of users to a - maximum of 100 teams per project and a maximum of 250 teams per + description: Adds one team to the specified project. All members of the team + share the same project access. MongoDB Cloud limits the number of users + to a maximum of 100 teams per project and a maximum of 250 teams per organization. To use this resource, the requesting API Key must have the Project Owner role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: addAllTeamsToProject parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/TeamRole' + $ref: "#/components/schemas/TeamRole" description: Team to add to the specified project. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedTeamRole' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedTeamRole" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Add One or More Teams to One Project @@ -12985,21 +12299,18 @@ paths: - Teams /api/atlas/v2/groups/{groupId}/teams/{teamId}: delete: - description: >- - Removes one team specified using its unique 24-hexadecimal digit + description: Removes one team specified using its unique 24-hexadecimal digit identifier from the project specified using its unique 24-hexadecimal digit identifier. To use this resource, the requesting API Key must have the Project Owner role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: removeProjectTeam parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the team that you - want to remove from the specified project. + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the team that + you want to remove from the specified project. in: path name: teamId required: true @@ -13009,42 +12320,39 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Team from One Project tags: - Teams patch: - description: >- - Updates the project roles assigned to the specified team. You can grant - team roles for specific projects and grant project access roles to users - in the team. All members of the team share the same project access. To - use this resource, the requesting API Key must have the Project Owner - role. + description: Updates the project roles assigned to the specified team. You can + grant team roles for specific projects and grant project access roles to + users in the team. All members of the team share the same project + access. To use this resource, the requesting API Key must have the + Project Owner role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: updateTeamRoles parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the team for + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the team for which you want to update roles. in: path name: teamId @@ -13058,27 +12366,27 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TeamRole' + $ref: "#/components/schemas/TeamRole" description: The project roles assigned to the specified team. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedTeamRole' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedTeamRole" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Team Roles in One Project @@ -13086,24 +12394,24 @@ paths: - Teams /api/atlas/v2/groups/{groupId}/userSecurity: get: - description: >- - Returns the current LDAP configuration for the specified project. To use - this resource, the requesting API Key must have the Project Owner role. + description: Returns the current LDAP configuration for the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. operationId: getLDAPConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserSecurity' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UserSecurity" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return the Current LDAP or X.509 Configuration @@ -13118,28 +12426,28 @@ paths: Updating this configuration triggers a rolling restart of the database. operationId: saveLDAPConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserSecurity' + $ref: "#/components/schemas/UserSecurity" description: Updates the LDAP configuration for the specified project. required: true responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserSecurity' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UserSecurity" + x-xgen-version: 2023-01-01 description: Accepted - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Edit the LDAP or X.509 Configuration @@ -13154,19 +12462,19 @@ paths: Updating this configuration triggers a rolling restart of the database. You must have the Project Owner role to use this endpoint. operationId: disableCustomerManagedX509 parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserSecurity' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UserSecurity" + x-xgen-version: 2023-01-01 description: Accepted - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Disable Customer-Managed X.509 @@ -13174,26 +12482,25 @@ paths: - X.509 Authentication /api/atlas/v2/groups/{groupId}/userSecurity/ldap/userToDNMapping: delete: - description: >- - Removes the current LDAP Distinguished Name mapping captured in the + description: Removes the current LDAP Distinguished Name mapping captured in the ``userToDNMapping`` document from the LDAP configuration for the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: deleteLDAPConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserSecurity' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UserSecurity" + x-xgen-version: 2023-01-01 description: Accepted - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove the Current LDAP User to DN Mapping @@ -13201,35 +12508,33 @@ paths: - LDAP Configuration /api/atlas/v2/groups/{groupId}/userSecurity/ldap/verify: post: - description: >- - Verifies the LDAP configuration for the specified project. To use this - resource, the requesting API Key must have the Project Owner role. + description: Verifies the LDAP configuration for the specified project. To use + this resource, the requesting API Key must have the Project Owner role. operationId: verifyLDAPConfiguration parameters: - - $ref: '#/components/parameters/groupId' + - $ref: "#/components/parameters/groupId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequestParams' - description: >- - The LDAP configuration for the specified project that you want to + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequestParams" + description: The LDAP configuration for the specified project that you want to verify. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequest' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequest" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Verify the LDAP Configuration in One Project @@ -13237,15 +12542,13 @@ paths: - LDAP Configuration /api/atlas/v2/groups/{groupId}/userSecurity/ldap/verify/{requestId}: get: - description: >- - Returns the status of one request to verify one LDAP configuration for - the specified project. To use this resource, the requesting API Key must - have the Project Owner role. + description: Returns the status of one request to verify one LDAP configuration + for the specified project. To use this resource, the requesting API Key + must have the Project Owner role. operationId: getLDAPConfigurationStatus parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique string that identifies the request to verify an LDAP configuration. in: path @@ -13257,17 +12560,17 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequest' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequest" + x-xgen-version: 2023-01-01 description: OK - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return the Status of One Verify LDAP Configuration Request @@ -13275,55 +12578,52 @@ paths: - LDAP Configuration /api/atlas/v2/groups/{groupId}/users: get: - description: >- - Returns details about all users in the specified project. Users belong - to an organization. To use this resource, the requesting API Key must - have the Project Read Only role. + description: Returns details about all users in the specified project. Users + belong to an organization. To use this resource, the requesting API Key + must have the Project Read Only role. operationId: listProjectUsers parameters: - - $ref: '#/components/parameters/groupId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Flag that indicates whether the returned list should include users + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: 'Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `"flattenTeams" : false`, this resource returns only users with a role in the project. If `"flattenTeams" : true`, this resource returns both users with roles in the project and users who belong to - teams with roles in the project. + teams with roles in the project.' in: query name: flattenTeams schema: type: boolean default: false - - description: >- - Flag that indicates whether the returned list should include users + - description: 'Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `"includeOrgUsers": false`, this resource returns only users with a role in the project. If `"includeOrgUsers": true`, this resource returns both users with roles in the project and users who have implicit access to the - project through their organization role. + project through their organization role.' in: query name: includeOrgUsers schema: type: boolean default: false responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedAppUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAppUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Users in One Project @@ -13331,14 +12631,12 @@ paths: - Projects /api/atlas/v2/groups/{groupId}/users/{userId}: delete: - description: >- - Removes the specified user from the specified project. To use this + description: Removes the specified user from the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: removeProjectUser parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal string that identifies MongoDB Cloud user you + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint. @@ -13351,19 +12649,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One User from One Project @@ -13371,16 +12669,14 @@ paths: - Projects /api/atlas/v2/groups/{groupId}/users/{userId}/roles: put: - description: >- - Updates the roles of the specified user in the specified project. To - specify the user to update, provide the unique 24-hexadecimal digit + description: Updates the roles of the specified user in the specified project. + To specify the user to update, provide the unique 24-hexadecimal digit string that identifies the user in the specified project. To use this resource, the requesting API Key must have the Group User Admin role. operationId: updateProjectRoles parameters: - - $ref: '#/components/parameters/groupId' - - description: >- - Unique 24-hexadecimal digit string that identifies the user to + - $ref: "#/components/parameters/groupId" + - description: Unique 24-hexadecimal digit string that identifies the user to modify. in: path name: userId @@ -13394,25 +12690,25 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UpdateGroupRolesForUser' + $ref: "#/components/schemas/UpdateGroupRolesForUser" description: Roles to update for the specified user. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UpdateGroupRolesForUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UpdateGroupRolesForUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Project Roles for One MongoDB Cloud User @@ -13421,17 +12717,15 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs: get: - description: >- - Returns all organizations to which the requesting API Key has access. To - use this resource, the requesting API Key must have the Organization - Member role. + description: Returns all organizations to which the requesting API Key has + access. To use this resource, the requesting API Key must have the + Organization Member role. operationId: listOrganizations parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' - - description: >- - Human-readable label of the organization to use to filter the + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name. in: query @@ -13439,33 +12733,32 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedOrganization' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedOrganization" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Organizations tags: - Organizations post: - description: >- - Creates one organization in MongoDB Cloud and links it to the requesting - API Key's organization. To use this resource, the requesting API Key - must have the Organization Owner role. The requesting API Key's + description: Creates one organization in MongoDB Cloud and links it to the + requesting API Key's organization. To use this resource, the requesting + API Key must have the Organization Owner role. The requesting API Key's organization must be a paying organization. To learn more, see [Configure a Paying Organization](https://www.mongodb.com/docs/atlas/billing/#configure-a-paying-organization) @@ -13476,29 +12769,29 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CreateOrganizationRequest' + $ref: "#/components/schemas/CreateOrganizationRequest" description: Organization that you want to create. required: true responses: - '201': + "201": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CreateOrganizationResponse' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CreateOrganizationResponse" + x-xgen-version: 2023-01-01 description: Created - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Organization @@ -13515,95 +12808,93 @@ paths: To use this resource, the requesting API Key must have the Organization Owner role. operationId: deleteOrganization parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '402': - $ref: '#/components/responses/paymentRequired' - '403': - $ref: '#/components/responses/forbidden' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "402": + $ref: "#/components/responses/paymentRequired" + "403": + $ref: "#/components/responses/forbidden" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Organization tags: - Organizations get: - description: >- - Returns one organization to which the requesting API key has access. To - use this resource, the requesting API Key must have the Organization - Member role. + description: Returns one organization to which the requesting API key has + access. To use this resource, the requesting API Key must have the + Organization Member role. operationId: getOrganization parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AtlasOrganization' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AtlasOrganization" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Organization tags: - Organizations patch: - description: >- - Renames one organization. To use this resource, the requesting API Key - must have the Organization Owner role. + description: Renames one organization. To use this resource, the requesting API + Key must have the Organization Owner role. operationId: renameOrganization parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AtlasOrganization' + $ref: "#/components/schemas/AtlasOrganization" description: Details to update on the specified organization. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/AtlasOrganization' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/AtlasOrganization" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Rename One Organization @@ -13612,71 +12903,67 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/apiKeys: get: - description: >- - Returns all organization API keys for the specified organization. The - organization API keys grant programmatic access to an organization. You - can't use the API key to log into MongoDB Cloud through the console. To - use this resource, the requesting API Key must have the Organization + description: Returns all organization API keys for the specified organization. + The organization API keys grant programmatic access to an organization. + You can't use the API key to log into MongoDB Cloud through the console. + To use this resource, the requesting API Key must have the Organization Member role. externalDocs: description: Programmatic API Keys - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key operationId: listApiKeys parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/orgId' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiApiUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiApiUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Organization API Keys tags: - Programmatic API Keys post: - description: >- - Creates one API key for the specified organization. An organization API - key grants programmatic access to an organization. You can't use the API - key to log into the console. To use this resource, the requesting API - Key must have the Organization Owner role. + description: Creates one API key for the specified organization. An organization + API key grants programmatic access to an organization. You can't use the + API key to log into the console. To use this resource, the requesting + API Key must have the Organization Owner role. externalDocs: description: Programmatic API Keys - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key operationId: createApiKey parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CreateAtlasOrganizationApiKey' + $ref: "#/components/schemas/CreateAtlasOrganizationApiKey" description: Organization API Key to be created. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiKeyUserDetails' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Organization API Key @@ -13684,21 +12971,18 @@ paths: - Programmatic API Keys /api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}: delete: - description: >- - Removes one organization API key from the specified organization. When - you remove an API key from an organization, MongoDB Cloud also removes - that key from any projects that use that key. To use this resource, the - requesting API Key must have the Organization Owner role. + description: Removes one organization API key from the specified organization. + When you remove an API key from an organization, MongoDB Cloud also + removes that key from any projects that use that key. To use this + resource, the requesting API Key must have the Organization Owner role. externalDocs: description: Configure Atlas API Access - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list operationId: deleteApiKey parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key. + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key. in: path name: apiUserId required: true @@ -13708,38 +12992,35 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Organization API Key tags: - Programmatic API Keys get: - description: >- - Returns one organization API key. The organization API keys grant + description: Returns one organization API key. The organization API keys grant programmatic access to an organization. You can't use the API key to log into MongoDB Cloud through the user interface. To use this resource, the requesting API Key must have the Organization Member role. externalDocs: description: Programmatic API Keys - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key operationId: getApiKey parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key that you want to update. + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key that you want to update. in: path name: apiUserId required: true @@ -13749,38 +13030,35 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiKeyUserDetails' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Organization API Key tags: - Programmatic API Keys patch: - description: >- - Updates one organization API key in the specified organization. The + description: Updates one organization API key in the specified organization. The organization API keys grant programmatic access to an organization. To use this resource, the requesting API Key must have the Organization Owner role. externalDocs: description: Programmatic API Keys - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key operationId: updateApiKey parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key you want to update. + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key you want to update. in: path name: apiUserId required: true @@ -13793,25 +13071,24 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UpdateAtlasOrganizationApiKey' - description: >- - Organization API key to be updated. This request requires a minimum of - one of the two body parameters. + $ref: "#/components/schemas/UpdateAtlasOrganizationApiKey" + description: Organization API key to be updated. This request requires a minimum + of one of the two body parameters. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/ApiKeyUserDetails' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/ApiKeyUserDetails" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Organization API Key @@ -13819,23 +13096,21 @@ paths: - Programmatic API Keys /api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}/accessList: get: - description: >- - Returns all access list entries that you configured for the specified - organization API key. To use this resource, the requesting API Key must - have the Organization Member role. + description: Returns all access list entries that you configured for the + specified organization API key. To use this resource, the requesting API + Key must have the Organization Member role. externalDocs: description: Programmatic API Keys - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#view-the-details-of-one-api-key-in-one-organization + url: https://docs.atlas.mongodb.com/configure-api-access/#view-the-details-of-one-api-key-in-one-organization operationId: listApiKeyAccessListsEntries parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/orgId' - - $ref: '#/components/parameters/pageNum' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key for which you want to return access list entries. + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key for which you want to return access list + entries. in: path name: apiUserId required: true @@ -13845,37 +13120,36 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiUserAccessList' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiUserAccessList" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Access List Entries for One Organization API Key tags: - Programmatic API Keys post: - description: >- - Creates the access list entries for the specified organization API key. - Resources require all API requests originate from IP addresses on the - API access list. To use this resource, the requesting API Key must have - the Read Write role. + description: Creates the access list entries for the specified organization API + key. Resources require all API requests originate from IP addresses on + the API access list. To use this resource, the requesting API Key must + have the Read Write role. operationId: createApiKeyAccessList parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/orgId' - - $ref: '#/components/parameters/pageNum' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key for which you want to create a new access list entry. + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key for which you want to create a new access list + entry. in: path name: apiUserId required: true @@ -13890,27 +13164,26 @@ paths: schema: type: array items: - $ref: '#/components/schemas/UserAccessList' - description: >- - Access list entries to be created for the specified organization API - key. + $ref: "#/components/schemas/UserAccessList" + description: Access list entries to be created for the specified organization + API key. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiUserAccessList' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiUserAccessList" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create Access List Entries for One Organization API Key @@ -13918,22 +13191,21 @@ paths: - Programmatic API Keys /api/atlas/v2/orgs/{orgId}/apiKeys/{apiUserId}/accessList/{ipAddress}: delete: - description: >- - Removes the specified access list entry from the specified organization - API key. Resources require all API requests originate from the IP - addresses on the API access list. To use this resource, the requesting - API Key must have the Read Write role. In addition, you cannot remove - the requesting IP address from the requesting organization API key. + description: Removes the specified access list entry from the specified + organization API key. Resources require all API requests originate from + the IP addresses on the API access list. To use this resource, the + requesting API Key must have the Read Write role. In addition, you + cannot remove the requesting IP address from the requesting organization + API key. externalDocs: description: Configure Atlas API Access - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list operationId: deleteApiKeyAccessListEntry parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key for which you want to remove access list entries. + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies this + organization API key for which you want to remove access list + entries. in: path name: apiUserId required: true @@ -13942,8 +13214,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - One IP address or multiple IP addresses represented as one CIDR + - description: One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /. @@ -13953,58 +13224,54 @@ paths: schema: type: string example: 192.0.2.0%2F24 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Access List Entry for One Organization API Key tags: - Programmatic API Keys get: - description: >- - Returns one access list entry for the specified organization API key. - Resources require all API requests originate from IP addresses on the - API access list. To use this resource, the requesting API Key must have - the Organization Member role. + description: Returns one access list entry for the specified organization API + key. Resources require all API requests originate from IP addresses on + the API access list. To use this resource, the requesting API Key must + have the Organization Member role. externalDocs: description: Configure Atlas API Access - url: >- - https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list + url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-enable-api-access-list operationId: getApiKeyAccessList parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - One IP address or multiple IP addresses represented as one CIDR + - $ref: "#/components/parameters/orgId" + - description: One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified - organization. When adding a CIDR block with a subnet mask, such as - 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /. + organization. When adding a CIDR block with a subnet mask, such + as 192.0.2.0/24, use the URL-encoded value %2F for the forward + slash /. in: path name: ipAddress required: true schema: type: string example: 192.0.2.0%2F24 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ - - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key for which you want to return access list entries. + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + - description: Unique 24-hexadecimal digit string that identifies this + organization API key for which you want to return access list + entries. in: path name: apiUserId required: true @@ -14014,19 +13281,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UserAccessList' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UserAccessList" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Access List Entry for One Organization API Key @@ -14035,34 +13302,33 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/billing/costExplorer/usage: post: - description: >- - Creates a query process within the Cost Explorer for the given + description: Creates a query process within the Cost Explorer for the given parameters. A token is returned that can be used to poll the status of the query and eventually retrievethe results. operationId: createCostExplorerQueryProcess parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CostExplorerFilterRequestBody' + $ref: "#/components/schemas/CostExplorerFilterRequestBody" description: Filter parameters for the Cost Explorer query. required: true responses: - '202': + "202": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CostExplorerFilterResponse' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CostExplorerFilterResponse" + x-xgen-version: 2023-01-01 description: Accepted - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create Cost Explorer query process @@ -14071,14 +13337,13 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/billing/costExplorer/usage/{token}: get: - description: >- - Returns the usage details for a Cost Explorer query, if the query is - finished and the data is ready to be viewed. If the data is not ready, a - 'processing' response willindicate that another request should be sent - later to view the data. + description: Returns the usage details for a Cost Explorer query, if the query + is finished and the data is ready to be viewed. If the data is not + ready, a 'processing' response willindicate that another request should + be sent later to view the data. operationId: createCostExplorerQueryProcess_1 parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" - description: Unique 64 digit string that identifies the Cost Explorer query. in: path name: token @@ -14089,31 +13354,30 @@ paths: maxLength: 64 minLength: 64 responses: - '102': + "102": description: Processing - '200': + "200": content: application/vnd.atlas.2023-01-01+csv: schema: type: string - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CostExplorerQueryResult' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CostExplorerQueryResult" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: >- - Return results from a given Cost Explorer query, or notify that the + summary: Return results from a given Cost Explorer query, or notify that the results are not ready yet. tags: - Invoices @@ -14130,24 +13394,22 @@ paths: This resource remains under revision and may change. operationId: listOrganizationEvents parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/orgId' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" - description: >- Category of incident recorded at this moment in time. - **IMPORTANT**: The complete list of event type values changes - frequently. + **IMPORTANT**: The complete list of event type values changes frequently. in: query name: eventType schema: type: array items: - $ref: '#/components/schemas/EventTypeForOrg' - - description: >- - Flag that indicates whether to include the raw document in the + $ref: "#/components/schemas/EventTypeForOrg" + - description: Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event. in: query @@ -14155,8 +13417,7 @@ paths: schema: type: boolean default: false - - description: >- - Date and time from when MongoDB Cloud stops returning events. This + - description: Date and time from when MongoDB Cloud stops returning events. This parameter uses the ISO 8601 timestamp format in UTC. @@ -14165,8 +13426,7 @@ paths: schema: type: string format: date-time - - description: >- - Date and time from when MongoDB Cloud starts returning events. This + - description: Date and time from when MongoDB Cloud starts returning events. This parameter uses the ISO 8601 timestamp format in UTC. @@ -14175,19 +13435,19 @@ paths: schema: type: string format: date-time - example: 2021-11-17T23:15:00.060Z + example: 2021-11-17T23:15:00.06Z responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrgPaginatedEvent' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrgPaginatedEvent" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Events from One Organization @@ -14205,9 +13465,8 @@ paths: This resource remains under revision and may change. operationId: getOrganizationEvent parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the event that + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access. @@ -14219,8 +13478,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - Flag that indicates whether to include the raw document in the + - description: Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event. in: query @@ -14229,19 +13487,19 @@ paths: type: boolean default: false responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/EventViewForOrg' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/EventViewForOrg" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Event from One Organization @@ -14250,29 +13508,28 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/federationSettings: get: - description: >- - Returns information about the federation settings for the specified + description: Returns information about the federation settings for the specified organization. To use this resource, the requesting API Key must have the Organization Owner role in the connected org. operationId: getFederationSettings parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrgFederationSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrgFederationSettings" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Federation Settings for One Organization @@ -14286,28 +13543,23 @@ paths: organization can have multiple projects. Use projects to: - - Isolate different environments, such as development, test, or - production environments, from each other. + - Isolate different environments, such as development, test, or production environments, from each other. - - Associate different MongoDB Cloud users or teams with different - environments, or give different permission to MongoDB Cloud users in - different environments. + - Associate different MongoDB Cloud users or teams with different environments, or give different permission to MongoDB Cloud users in different environments. - Maintain separate cluster security configurations. - Create different alert settings. - To use this resource, the requesting API Key must have the Organization - Member role. + To use this resource, the requesting API Key must have the Organization Member role. operationId: listOrganizationProjects parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/orgId' - - $ref: '#/components/parameters/pageNum' - - description: >- - Human-readable label of the project to use to filter the returned + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name. in: query @@ -14315,21 +13567,21 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedAtlasGroup' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAtlasGroup" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One or More Projects in One Organization @@ -14337,15 +13589,13 @@ paths: - Organizations /api/atlas/v2/orgs/{orgId}/invites: get: - description: >- - Returns all pending invitations to the specified organization. To use - this resource, the requesting API Key must have the Organization Owner - role. + description: Returns all pending invitations to the specified organization. To + use this resource, the requesting API Key must have the Organization + Owner role. operationId: listOrganizationInvitations parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Email address of the user account invited to this organization. If + - $ref: "#/components/parameters/orgId" + - description: Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations. in: query @@ -14354,99 +13604,96 @@ paths: type: string format: email responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/OrganizationInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Organization Invitations tags: - Organizations patch: - description: >- - Updates the details of one pending invitation to the specified + description: Updates the details of one pending invitation to the specified organization. To specify which invitation, provide the username of the invited user. To use this resource, the requesting API Key must have the Organization Owner role. operationId: updateOrganizationInvitation parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationInvitationRequest' - description: >- - Updates the details of one pending invitation to the specified + $ref: "#/components/schemas/OrganizationInvitationRequest" + description: Updates the details of one pending invitation to the specified organization. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Organization Invitation tags: - Organizations post: - description: >- - Invites one MongoDB Cloud user to join the specified organization. The - user must accept the invitation to access information within the + description: Invites one MongoDB Cloud user to join the specified organization. + The user must accept the invitation to access information within the specified organization. To use this resource, the requesting API Key must have the Organization Owner role. operationId: createOrganizationInvitation parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationInvitationRequest' + $ref: "#/components/schemas/OrganizationInvitationRequest" description: Invites one MongoDB Cloud user to join the specified organization. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Invite One MongoDB Cloud User to Join One Atlas Organization @@ -14454,14 +13701,13 @@ paths: - Organizations /api/atlas/v2/orgs/{orgId}/invites/{invitationId}: delete: - description: >- - Cancels one pending invitation sent to the specified MongoDB Cloud user - to join an organization. You can't cancel an invitation that the user - accepted. To use this resource, the requesting API Key must have the - Organization Owner role. + description: Cancels one pending invitation sent to the specified MongoDB Cloud + user to join an organization. You can't cancel an invitation that the + user accepted. To use this resource, the requesting API Key must have + the Organization Owner role. operationId: deleteOrganizationInvitation parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" - description: Unique 24-hexadecimal digit string that identifies the invitation. in: path name: invitationId @@ -14469,34 +13715,33 @@ paths: schema: type: string responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Cancel One Organization Invitation tags: - Organizations get: - description: >- - Returns the details of one pending invitation to the specified + description: Returns the details of one pending invitation to the specified organization. To use this resource, the requesting API Key must have the Organization Owner role. operationId: getOrganizationInvitation parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" - description: Unique 24-hexadecimal digit string that identifies the invitation. in: path name: invitationId @@ -14507,29 +13752,28 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Organization Invitation tags: - Organizations patch: - description: >- - Updates the details of one pending invitation to the specified + description: Updates the details of one pending invitation to the specified organization. To specify which invitation, provide the unique identification string for that invitation. Use the Return All Organization Invitations endpoint to retrieve IDs for all pending @@ -14537,7 +13781,7 @@ paths: must have the Organization Owner role. operationId: updateOrganizationInvitationById parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" - description: Unique 24-hexadecimal digit string that identifies the invitation. in: path name: invitationId @@ -14551,27 +13795,26 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationInvitationUpdateRequest' - description: >- - Updates the details of one pending invitation to the specified + $ref: "#/components/schemas/OrganizationInvitationUpdateRequest" + description: Updates the details of one pending invitation to the specified organization. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationInvitation' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update One Organization Invitation by Invitation ID @@ -14579,33 +13822,33 @@ paths: - Organizations /api/atlas/v2/orgs/{orgId}/invoices: get: - description: >- - Returns all invoices that MongoDB issued to the specified organization. - This list includes all invoices regardless of invoice status. To use - this resource, the requesting API Key must have the Organization Billing - Viewer, Organization Billing Admin, or Organization Owner role. If you - have a cross-organization setup, you can view linked invoices if you - have the Organization Billing Admin or Organization Owner role. + description: Returns all invoices that MongoDB issued to the specified + organization. This list includes all invoices regardless of invoice + status. To use this resource, the requesting API Key must have the + Organization Billing Viewer, Organization Billing Admin, or Organization + Owner role. If you have a cross-organization setup, you can view linked + invoices if you have the Organization Billing Admin or Organization + Owner role. operationId: listInvoices parameters: - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/orgId' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiInvoice' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiInvoice" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Invoices for One Organization @@ -14614,30 +13857,29 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/invoices/pending: get: - description: >- - Returns all invoices accruing charges for the current billing cycle for - the specified organization. To use this resource, the requesting API Key - must have the Organization Billing Viewer, Organization Billing Admin, - or Organization Owner role. If you have a cross-organization setup, you - can view linked invoices if you have the Organization Billing Admin or - Organization Owner Role. + description: Returns all invoices accruing charges for the current billing cycle + for the specified organization. To use this resource, the requesting API + Key must have the Organization Billing Viewer, Organization Billing + Admin, or Organization Owner role. If you have a cross-organization + setup, you can view linked invoices if you have the Organization Billing + Admin or Organization Owner Role. operationId: listPendingInvoices parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiInvoice' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiInvoice" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Pending Invoices for One Organization @@ -14646,19 +13888,18 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/invoices/{invoiceId}: get: - description: >- - Returns one invoice that MongoDB issued to the specified organization. A - unique 24-hexadecimal digit string identifies the invoice. You can - choose to receive this invoice in JSON or CSV format. To use this - resource, the requesting API Key must have the Organization Billing - Viewer, Organization Billing Admin, or Organization Owner role. If you - have a cross-organization setup, you can query for a linked invoice if - you have the Organization Billing Admin or Organization Owner role. + description: Returns one invoice that MongoDB issued to the specified + organization. A unique 24-hexadecimal digit string identifies the + invoice. You can choose to receive this invoice in JSON or CSV format. + To use this resource, the requesting API Key must have the Organization + Billing Viewer, Organization Billing Admin, or Organization Owner role. + If you have a cross-organization setup, you can query for a linked + invoice if you have the Organization Billing Admin or Organization Owner + role. operationId: getInvoice parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the invoice + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day. in: path @@ -14670,23 +13911,23 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+csv: schema: type: string - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/BillingInvoice' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/BillingInvoice" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Organization Invoice @@ -14695,19 +13936,17 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/invoices/{invoiceId}/csv: get: - description: >- - Returns one invoice that MongoDB issued to the specified organization in - CSV format. A unique 24-hexadecimal digit string identifies the invoice. - To use this resource, the requesting API Key have at least the - Organization Billing Viewer, Organization Billing Admin, or Organization - Owner role. If you have a cross-organization setup, you can query for a - linked invoice if you have the Organization Billing Admin or - Organization Owner Role. + description: Returns one invoice that MongoDB issued to the specified + organization in CSV format. A unique 24-hexadecimal digit string + identifies the invoice. To use this resource, the requesting API Key + have at least the Organization Billing Viewer, Organization Billing + Admin, or Organization Owner role. If you have a cross-organization + setup, you can query for a linked invoice if you have the Organization + Billing Admin or Organization Owner Role. operationId: downloadInvoiceCSV parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the invoice + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day. in: path @@ -14715,19 +13954,19 @@ paths: required: true schema: type: string - pattern: '[0-9a-f]+' + pattern: "[0-9a-f]+" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+csv: schema: type: string - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Organization Invoice as CSV @@ -14739,23 +13978,23 @@ paths: description: Return all projects that you can migrate to the specified organization. operationId: listSourceProjects parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: type: array items: - $ref: '#/components/schemas/LiveImportAvailableProject' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/LiveImportAvailableProject" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Projects Available for Migration @@ -14764,65 +14003,63 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/liveMigrations/linkTokens: delete: - description: >- - Remove one organization link and its associated public API key. MongoDB - Atlas uses the link-token for push live migrations only. Live migrations - (push) let you securely push data from Cloud Manager or Ops Manager into - MongoDB Atlas. Your API Key must have the Organization Owner role to - successfully call this resource. + description: Remove one organization link and its associated public API key. + MongoDB Atlas uses the link-token for push live migrations only. Live + migrations (push) let you securely push data from Cloud Manager or Ops + Manager into MongoDB Atlas. Your API Key must have the Organization + Owner role to successfully call this resource. operationId: deleteLinkToken parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Link-Token tags: - Cloud Migration Service post: - description: >- - Create one link-token that contains all the information required to + description: Create one link-token that contains all the information required to complete the link. MongoDB Atlas uses the link-token for push live migrations only. Live migration (push) allows you to securely push data from Cloud Manager or Ops Manager into MongoDB Atlas. Your API Key must have the Organization Owner role to successfully call this resource. operationId: createLinkToken parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TargetOrgRequest' + $ref: "#/components/schemas/TargetOrgRequest" description: IP address access list entries associated with the migration. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TargetOrg' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/TargetOrg" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Link-Token @@ -14830,28 +14067,28 @@ paths: - Cloud Migration Service /api/atlas/v2/orgs/{orgId}/settings: get: - description: >- - Returns details about the specified organization's settings. To use this - resource, the requesting API Key must have the Organization Owner role. + description: Returns details about the specified organization's settings. To use + this resource, the requesting API Key must have the Organization Owner + role. operationId: getOrganizationSettings parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrganizationSettings" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return Settings for One Organization @@ -14859,35 +14096,34 @@ paths: - Organizations x-xgen-experimental: true patch: - description: >- - Updates the organization's settings. To use this resource, the + description: Updates the organization's settings. To use this resource, the requesting API Key must have the Organization Owner role. operationId: updateOrganizationSettings parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationSettings' + $ref: "#/components/schemas/OrganizationSettings" description: Details to update on the specified organization's settings. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/OrganizationSettings' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/OrganizationSettings" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Settings for One Organization @@ -14896,81 +14132,77 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/teams: get: - description: >- - Returns all teams that belong to the specified organization. Teams + description: Returns all teams that belong to the specified organization. Teams enable you to grant project access roles to MongoDB Cloud users. MongoDB Cloud only returns teams for which you have access. To use this resource, the requesting API Key must have the Organization Member role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: listOrganizationTeams parameters: - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/pageNum' - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/pageNum" + - $ref: "#/components/parameters/orgId" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedTeam' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedTeam" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All Teams in One Organization tags: - Teams post: - description: >- - Creates one team in the specified organization. Teams enable you to + description: Creates one team in the specified organization. Teams enable you to grant project access roles to MongoDB Cloud users. MongoDB Cloud limits the number of teams to a maximum of 250 teams per organization. To use this resource, the requesting API Key must have the Organization Owner role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: createTeam parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" requestBody: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Team' + $ref: "#/components/schemas/Team" description: Team that you want to create in the specified organization. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Team' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/Team" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One Team in One Organization @@ -14978,18 +14210,16 @@ paths: - Teams /api/atlas/v2/orgs/{orgId}/teams/byName/{teamName}: get: - description: >- - Returns one team that you identified using its human-readable name. This - team belongs to one organization. Teams enable you to grant project + description: Returns one team that you identified using its human-readable name. + This team belongs to one organization. Teams enable you to grant project access roles to MongoDB Cloud users. To use this resource, the requesting API Key must have the Organization Member role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: getTeamByName parameters: - - $ref: '#/components/parameters/orgId' + - $ref: "#/components/parameters/orgId" - description: Name of the team whose information you want to return. in: path name: teamName @@ -14997,21 +14227,21 @@ paths: schema: type: string responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TeamResponse' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/TeamResponse" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Team using its Name @@ -15019,21 +14249,18 @@ paths: - Teams /api/atlas/v2/orgs/{orgId}/teams/{teamId}: delete: - description: >- - Removes one team specified using its unique 24-hexadecimal digit + description: Removes one team specified using its unique 24-hexadecimal digit identifier from the organization specified using its unique 24-hexadecimal digit identifier. To use this resource, the requesting API Key must have the Organization Owner role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: deleteTeam parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the team that you - want to delete. + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the team that + you want to delete. in: path name: teamId required: true @@ -15043,41 +14270,39 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One Team from One Organization tags: - Teams get: - description: >- - Returns one team that you identified using its unique 24-hexadecimal - digit ID. This team belongs to one organization. Teams enable you to - grant project access roles to MongoDB Cloud users. To use this resource, - the requesting API Key must have the Organization Member role. + description: Returns one team that you identified using its unique + 24-hexadecimal digit ID. This team belongs to one organization. Teams + enable you to grant project access roles to MongoDB Cloud users. To use + this resource, the requesting API Key must have the Organization Member + role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: getTeamById parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the team whose + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the team whose information you want to return. in: path name: teamId @@ -15088,41 +14313,38 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TeamResponse' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/TeamResponse" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One Team using its ID tags: - Teams patch: - description: >- - Renames one team in the specified organization. Teams enable you to + description: Renames one team in the specified organization. Teams enable you to grant project access roles to MongoDB Cloud users. To use this resource, the requesting API Key must have the Organization Owner role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: renameTeam parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the team that you - want to rename. + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the team that + you want to rename. in: path name: teamId required: true @@ -15135,27 +14357,27 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/Team' + $ref: "#/components/schemas/Team" description: Details to update on the specified team. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/TeamResponse' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/TeamResponse" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Rename One Team @@ -15164,23 +14386,20 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/teams/{teamId}/users: get: - description: >- - Returns all MongoDB Cloud users assigned to the team specified using its - unique 24-hexadecimal digit identifier. This team belongs to one - organization. Teams enable you to grant project access roles to MongoDB - Cloud users. To use this resource, the requesting API Key must have the - Organization Member role. + description: Returns all MongoDB Cloud users assigned to the team specified + using its unique 24-hexadecimal digit identifier. This team belongs to + one organization. Teams enable you to grant project access roles to + MongoDB Cloud users. To use this resource, the requesting API Key must + have the Organization Member role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: listTeamUsers parameters: - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/orgId' - - $ref: '#/components/parameters/pageNum' - - description: >- - Unique 24-hexadecimal digit string that identifies the team whose + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/pageNum" + - description: Unique 24-hexadecimal digit string that identifies the team whose application users you want to return. in: path name: teamId @@ -15191,44 +14410,41 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiAppUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiAppUser" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All MongoDB Cloud Users Assigned to One Team tags: - Teams post: - description: >- - Adds one or more MongoDB Cloud users from the specified organization to - the specified team. Teams enable you to grant project access roles to - MongoDB Cloud users. You can assign up to 250 MongoDB Cloud users from - one organization to one team. To use this resource, the requesting API - Key must have the Organization Owner role. + description: Adds one or more MongoDB Cloud users from the specified + organization to the specified team. Teams enable you to grant project + access roles to MongoDB Cloud users. You can assign up to 250 MongoDB + Cloud users from one organization to one team. To use this resource, the + requesting API Key must have the Organization Owner role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: addTeamUser parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal character string that identifies the team to + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users. in: path name: teamId @@ -15244,29 +14460,28 @@ paths: schema: type: array items: - $ref: '#/components/schemas/AddUserToTeam' - description: >- - One or more MongoDB Cloud users that you want to add to the specified - team. + $ref: "#/components/schemas/AddUserToTeam" + description: One or more MongoDB Cloud users that you want to add to the + specified team. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedApiAppUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedApiAppUser" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '409': - $ref: '#/components/responses/conflict' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Assign MongoDB Cloud Users from One Organization to One Team @@ -15274,20 +14489,17 @@ paths: - Teams /api/atlas/v2/orgs/{orgId}/teams/{teamId}/users/{userId}: delete: - description: >- - Removes one MongoDB Cloud user from the specified team. This team + description: Removes one MongoDB Cloud user from the specified team. This team belongs to one organization. Teams enable you to grant project access roles to MongoDB Cloud users. To use this resource, the requesting API Key must have the Organization Owner role. externalDocs: description: Manage Organization Teams - url: >- - https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams + url: https://docs.atlas.mongodb.com/access/manage-teams-in-orgs/#std-label-manage-teams operationId: removeTeamUser parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the team from + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user. in: path name: teamId @@ -15297,8 +14509,7 @@ paths: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ - - description: >- - Unique 24-hexadecimal digit string that identifies MongoDB Cloud + - description: Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team. in: path name: userId @@ -15309,19 +14520,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: - x-xgen-version: 2023-01-01T00:00:00.000Z + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One MongoDB Cloud User from One Team @@ -15329,34 +14540,33 @@ paths: - Teams /api/atlas/v2/orgs/{orgId}/users: get: - description: >- - Returns details about the MongoDB Cloud users associated with the + description: Returns details about the MongoDB Cloud users associated with the specified organization. Each MongoDB Cloud user returned must belong to the specified organization or to a project within the specified organization. To use this resource, the requesting API Key must have the Organization Member role. operationId: listOrganizationUsers parameters: - - $ref: '#/components/parameters/orgId' - - $ref: '#/components/parameters/includeCount' - - $ref: '#/components/parameters/itemsPerPage' - - $ref: '#/components/parameters/pageNum' + - $ref: "#/components/parameters/orgId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/PaginatedAppUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/PaginatedAppUser" + x-xgen-version: 2023-01-01 description: OK - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return All MongoDB Cloud Users in One Organization @@ -15364,15 +14574,13 @@ paths: - Organizations /api/atlas/v2/orgs/{orgId}/users/{userId}: delete: - description: >- - Removes one MongoDB Cloud user from the specified organization. To use - this resource, the requesting API Key must have the Organization User - Admin role. + description: Removes one MongoDB Cloud user from the specified organization. To + use this resource, the requesting API Key must have the Organization + User Admin role. operationId: removeOrganizationUser parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the user to be + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the user to be deleted. in: path name: userId @@ -15383,23 +14591,23 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '204': + "204": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/NoBody' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 description: This endpoint does not return a response body. - '400': - $ref: '#/components/responses/badRequest' - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Remove One MongoDB Cloud User from One Organization @@ -15408,17 +14616,15 @@ paths: x-xgen-experimental: true /api/atlas/v2/orgs/{orgId}/users/{userId}/roles: put: - description: >- - Updates the roles of the specified user in the specified organization. - To specify the user to update, provide the unique 24-hexadecimal digit - string that identifies the user in the specified organization. To use - this resource, the requesting API Key must have the Organization User - Admin role. + description: Updates the roles of the specified user in the specified + organization. To specify the user to update, provide the unique + 24-hexadecimal digit string that identifies the user in the specified + organization. To use this resource, the requesting API Key must have the + Organization User Admin role. operationId: updateOrganizationRoles parameters: - - $ref: '#/components/parameters/orgId' - - description: >- - Unique 24-hexadecimal digit string that identifies the user to + - $ref: "#/components/parameters/orgId" + - description: Unique 24-hexadecimal digit string that identifies the user to modify. in: path name: userId @@ -15432,25 +14638,25 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UpdateOrgRolesForUser' + $ref: "#/components/schemas/UpdateOrgRolesForUser" description: Roles to update for the specified user. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/UpdateOrgRolesForUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/UpdateOrgRolesForUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '403': - $ref: '#/components/responses/forbidden' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Update Organization Roles for One MongoDB Cloud User @@ -15476,23 +14682,23 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudAppUser' + $ref: "#/components/schemas/CloudAppUser" description: MongoDB Cloud user account to create. required: true responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudAppUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudAppUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Create One MongoDB Cloud User @@ -15500,8 +14706,7 @@ paths: - MongoDB Cloud Users /api/atlas/v2/users/byName/{userName}: get: - description: >- - Returns the details for one MongoDB Cloud user account with the + description: Returns the details for one MongoDB Cloud user account with the specified username. You can't use this endpoint to return information about an API Key. To return information about an API Key, use the [Return One Organization](#tag/Organizations/operation/getOrganization) @@ -15509,30 +14714,28 @@ paths: any role. operationId: getUserByUsername parameters: - - description: >- - Email address that belongs to the MongoDB Cloud user account. You + - description: Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user. in: path name: userName required: true schema: type: string - pattern: >- - ^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$ + pattern: ^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudAppUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudAppUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One MongoDB Cloud User using Their Username @@ -15540,8 +14743,7 @@ paths: - MongoDB Cloud Users /api/atlas/v2/users/{userId}: get: - description: >- - Returns the details for one MongoDB Cloud user account with the + description: Returns the details for one MongoDB Cloud user account with the specified unique identifier for the user. You can't use this endpoint to return information on an API Key. To return information about an API Key, use the [Return One @@ -15562,19 +14764,19 @@ paths: minLength: 24 pattern: ^([a-f0-9]{24})$ responses: - '200': + "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: '#/components/schemas/CloudAppUser' - x-xgen-version: 2023-01-01T00:00:00.000Z + $ref: "#/components/schemas/CloudAppUser" + x-xgen-version: 2023-01-01 description: OK - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/notFound' - '500': - $ref: '#/components/responses/internalServerError' + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] summary: Return One MongoDB Cloud User using Its ID @@ -15599,8 +14801,7 @@ components: type: string example: mydb end: - description: >- - Date and time when MongoDB Cloud stops reporting the metrics. This + description: Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. in: query @@ -15610,8 +14811,7 @@ components: type: string format: date-time envelope: - description: >- - Flag that indicates whether Application wraps the response in an + description: Flag that indicates whether Application wraps the response in an `envelope` JSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as @@ -15635,10 +14835,9 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ granularity: - description: >- - Duration that specifies the interval at which Atlas reports the metrics. - This parameter expresses its value in the ISO 8601 duration format in - UTC. + description: Duration that specifies the interval at which Atlas reports the + metrics. This parameter expresses its value in the ISO 8601 duration + format in UTC. in: query name: granularity required: true @@ -15652,10 +14851,7 @@ components: projects to which the authenticated user has access. - **NOTE**: Groups and projects are synonymous terms. Your group id is the - same as your project id. For existing groups, your group/project id - remains the same. The resource and corresponding endpoints use the term - groups. + **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups. in: path name: groupId required: true @@ -15666,9 +14862,7 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ identityProviderId: - description: >- - Unique 20-hexadecimal digit string that identifies the identity - provider. + description: Unique 20-hexadecimal digit string that identifies the identity provider. in: path name: identityProviderId required: true @@ -15679,9 +14873,8 @@ components: minLength: 20 pattern: ^([a-f0-9]{20})$ includeCount: - description: >- - Flag that indicates whether the response returns the total number of - items (**totalCount**) in the response. + description: Flag that indicates whether the response returns the total number + of items (**totalCount**) in the response. in: query name: includeCount required: false @@ -15720,9 +14913,8 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ orgId: - description: >- - Unique 24-hexadecimal digit string that identifies the organization that - contains your projects. Use the + description: Unique 24-hexadecimal digit string that identifies the organization + that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access. in: path @@ -15735,9 +14927,8 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ pageNum: - description: >- - Number of the page that displays the current set of the total objects - that the response returns. + description: Number of the page that displays the current set of the total + objects that the response returns. in: query name: pageNum required: false @@ -15747,10 +14938,9 @@ components: example: 1 minimum: 1 period: - description: >- - Duration over which Atlas reports the metrics. This parameter expresses - its value in the ISO 8601 duration format in UTC. Include this parameter - when you do not set **start** and **end**. + description: Duration over which Atlas reports the metrics. This parameter + expresses its value in the ISO 8601 duration format in UTC. Include this + parameter when you do not set **start** and **end**. in: query name: period required: false @@ -15758,8 +14948,7 @@ components: type: string example: PT10H pretty: - description: >- - Flag that indicates whether the response body should be in the prettyprint format. in: query @@ -15770,23 +14959,20 @@ components: default: false example: false processId: - description: >- - Combination of hostname and IANA port that serves the MongoDB process. - The host must be the hostname, fully qualified domain name (FQDN), or - Internet Protocol address (IPv4 or IPv6) of the host that runs the - MongoDB process (mongod or mongos). The port must be the IANA port on - which the MongoDB process listens for requests. + description: Combination of hostname and IANA port that serves the MongoDB + process. The host must be the hostname, fully qualified domain name + (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that + runs the MongoDB process (mongod or mongos). The port must be the IANA + port on which the MongoDB process listens for requests. in: path name: processId required: true schema: type: string example: my.host.name.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ start: - description: >- - Date and time when MongoDB Cloud begins reporting the metrics. This + description: Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. in: query @@ -15802,8 +14988,7 @@ components: content: application/json: example: - detail: >- - (This is just an example, the exception may not be related to this + detail: (This is just an example, the exception may not be related to this endpoint) No provider AWS exists. error: 400 errorCode: INVALID_PROVIDER @@ -15811,30 +14996,28 @@ components: - AWS reason: Bad Request schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Bad Request. conflict: content: application/json: example: - detail: >- - (This is just an example, the exception may not be related to this + detail: "(This is just an example, the exception may not be related to this endpoint) Cannot delete organization link while there is active - migration in following project ids: 60c4fd418ebe251047c50554 + migration in following project ids: 60c4fd418ebe251047c50554" error: 409 errorCode: CANNOT_DELETE_ORG_LINK_WITH_RUNNING_LIVE_EXPORT parameters: - 60c4fd418ebe251047c50554 reason: Conflict schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Conflict. forbidden: content: application/json: example: - detail: >- - (This is just an example, the exception may not be related to this + detail: (This is just an example, the exception may not be related to this endpoint) error: 403 errorCode: CANNOT_CHANGE_GROUP_NAME @@ -15842,29 +15025,27 @@ components: - EXAMPLE reason: Forbidden schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Forbidden. gone: content: application/json: example: - detail: >- - This happens when a resource is marked for sunset and the sunset - date is in the past. + detail: This happens when a resource is marked for sunset and the sunset date is + in the past. error: 410 errorCode: VERSION_GONE parameters: - EXAMPLE reason: Gone schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Gone. internalServerError: content: application/json: example: - detail: >- - (This is just an example, the exception may not be related to this + detail: (This is just an example, the exception may not be related to this endpoint) error: 500 errorCode: UNEXPECTED_ERROR @@ -15872,14 +15053,13 @@ components: - EXAMPLE reason: Internal Server Error schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Internal Server Error. methodNotAllowed: content: application/json: example: - detail: >- - (This is just an example, the exception may not be related to this + detail: (This is just an example, the exception may not be related to this endpoint) error: 405 errorCode: ATLAS_BACKUP_CANCEL_SHARD_RESTORE_JOB_NOT_ALLOWED @@ -15887,7 +15067,7 @@ components: - EXAMPLE reason: Method Not Allowed schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Method Not Allowed. noBody: description: This endpoint does not return a response body. @@ -15895,8 +15075,7 @@ components: content: application/json: example: - detail: >- - (This is just an example, the exception may not be related to this + detail: (This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS error: 404 errorCode: RESOURCE_NOT_FOUND @@ -15904,14 +15083,13 @@ components: - AWS reason: Not Found schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Not Found. paymentRequired: content: application/json: example: - detail: >- - (This is just an example, the exception may not be related to this + detail: (This is just an example, the exception may not be related to this endpoint) error: 402 errorCode: NO_PAYMENT_INFORMATION_FOUND @@ -15919,14 +15097,13 @@ components: - EXAMPLE reason: Payment Required schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Payment Required. unauthorized: content: application/json: example: - detail: >- - (This is just an example, the exception may not be related to this + detail: (This is just an example, the exception may not be related to this endpoint) error: 401 errorCode: NOT_ORG_GROUP_CREATOR @@ -15934,22 +15111,20 @@ components: - EXAMPLE reason: Unauthorized schema: - $ref: '#/components/schemas/ApiError' + $ref: "#/components/schemas/ApiError" description: Unauthorized. schemas: AWSKMSConfiguration: type: object - description: >- - Amazon Web Services (AWS) KMS configuration details and encryption at - rest configuration set for the specified project. + description: Amazon Web Services (AWS) KMS configuration details and encryption + at rest configuration set for the specified project. externalDocs: description: Amazon Web Services Key Management Service url: https://www.mongodb.com/docs/atlas/security-aws-kms/ properties: accessKeyID: type: string - description: >- - Unique alphanumeric string that identifies an Identity and Access + description: Unique alphanumeric string that identifies an Identity and Access Management (IAM) access key with permissions required to access your Amazon Web Services (AWS) Customer Master Key (CMK). example: 019dd98d94b4bb778e7552e4 @@ -15957,24 +15132,21 @@ components: minLength: 16 customerMasterKeyID: type: string - description: >- - Unique alphanumeric string that identifies the Amazon Web Services + description: Unique alphanumeric string that identifies the Amazon Web Services (AWS) Customer Master Key (CMK) you used to encrypt and decrypt the MongoDB master keys. maxLength: 2048 minLength: 1 enabled: type: boolean - description: >- - Flag that indicates whether someone enabled encryption at rest for + description: Flag that indicates whether someone enabled encryption at rest for the specified project through Amazon Web Services (AWS) Key Management Service (KMS). To disable encryption at rest using customer key management and remove the configuration details, pass only this parameter with a value of `false`. region: type: string - description: >- - Physical location where MongoDB Cloud deploys your AWS-hosted + description: Physical location where MongoDB Cloud deploys your AWS-hosted MongoDB cluster nodes. The region you choose can affect network latency for clients accessing your databases. When MongoDB Cloud deploys a dedicated cluster, it checks if a VPC or VPC connection @@ -15986,8 +15158,7 @@ components: title: AWS Regions roleId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies an Amazon Web + description: Unique 24-hexadecimal digit string that identifies an Amazon Web Services (AWS) Identity and Access Management (IAM) role. This IAM role has the permissions required to manage your AWS customer master key. @@ -15998,15 +15169,13 @@ components: writeOnly: true secretAccessKey: type: string - description: >- - Human-readable label of the Identity and Access Management (IAM) + description: Human-readable label of the Identity and Access Management (IAM) secret access key with permissions required to access your Amazon Web Services (AWS) customer master key. writeOnly: true valid: type: boolean - description: >- - Flag that indicates whether the Amazon Web Services (AWS) Key + description: Flag that indicates whether the Amazon Web Services (AWS) Key Management Service (KMS) encryption key can encrypt and decrypt data. readOnly: true @@ -16015,9 +15184,8 @@ components: properties: id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - user. + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -16029,9 +15197,9 @@ components: description: Options that determine how this cluster handles resource scaling. properties: compute: - $ref: '#/components/schemas/AdvancedComputeAutoScaling' + $ref: "#/components/schemas/AdvancedComputeAutoScaling" diskGB: - $ref: '#/components/schemas/DiskGBAutoScaling' + $ref: "#/components/schemas/DiskGBAutoScaling" title: Automatic Scaling Settings AdvancedClusterDescription: type: object @@ -16039,8 +15207,7 @@ components: acceptDataRisksAndForceReplicaSetReconfig: type: string format: date-time - description: >- - If reconfiguration is necessary to regain a primary due to a + description: If reconfiguration is necessary to regain a primary due to a regional outage, submit this field alongside your topology reconfiguration to request a new regional outage resistant topology. Forced reconfigurations during an outage of the majority of @@ -16051,13 +15218,11 @@ components: **acceptDataRisksAndForceReplicaSetReconfig** to the current date. externalDocs: description: Reconfiguring a Replica Set during a regional outage - url: >- - https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set + url: https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set backupEnabled: type: boolean default: false - description: >- - Flag that indicates whether the cluster can perform backups. If set + description: Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses [Cloud Backups](https://docs.atlas.mongodb.com/backup/cloud-backup/overview/) @@ -16066,43 +15231,40 @@ components: for tenant clusters. If set to `false`, the cluster doesn't use backups. biConnector: - $ref: '#/components/schemas/BiConnector' + $ref: "#/components/schemas/BiConnector" clusterType: type: string description: Configuration of nodes that comprise the cluster. connectionStrings: - $ref: '#/components/schemas/ClusterConnectionStrings' + $ref: "#/components/schemas/ClusterConnectionStrings" createDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this cluster. This + description: Date and time when MongoDB Cloud created this cluster. This parameter expresses its value in ISO 8601 format in UTC. readOnly: true diskSizeGB: type: number format: double - description: >- - Storage capacity that the host's root volume possesses expressed in + description: Storage capacity that the host's root volume possesses expressed in gigabytes. Increase this number to add capacity. MongoDB Cloud requires this parameter if you set **replicationSpecs**. If you specify a disk size below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations - depend on whether you choose the default value or a custom value. - The maximum value for disk storage cannot exceed 50 times the - maximum RAM for the selected cluster. If you require more storage - space, consider upgrading your cluster to a higher tier. + depend on whether you choose the default value or a custom + value. The maximum value for disk storage cannot exceed 50 times + the maximum RAM for the selected cluster. If you require more + storage space, consider upgrading your cluster to a higher tier. maximum: 4096 minimum: 10 encryptionAtRestProvider: type: string - description: >- - Cloud service provider that manages your customer keys to provide an - additional layer of encryption at rest for the cluster. To enable + description: 'Cloud service provider that manages your customer keys to provide + an additional layer of encryption at rest for the cluster. To enable customer key management for encryption at rest, the cluster **replicationSpecs[n].regionConfigs[m].{type}Specs.instanceSize** setting must be `M10` or higher and `"backupEnabled" : false` or - omitted entirely. + omitted entirely.' externalDocs: description: Encryption at Rest using Customer Key Management url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ @@ -16116,8 +15278,7 @@ components: readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the replication + description: Unique 24-hexadecimal digit string that identifies the replication object for a zone in a Global Cluster. If you include existing zones in the request, you must specify this parameter. If you add a new zone to an existing Global Cluster, you may specify this parameter. @@ -16136,29 +15297,24 @@ components: doesn't display your labels. - Cluster labels will be deprecated in a future release. We strongly - recommend that you use [resource - tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) - instead. + Cluster labels will be deprecated in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. items: - $ref: '#/components/schemas/ComponentLabel' + $ref: "#/components/schemas/ComponentLabel" links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true mongoDBMajorVersion: type: string - default: '6.0' - description: >- - Major MongoDB version of the cluster. MongoDB Cloud deploys the + default: "6.0" + description: Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version. mongoDBVersion: type: string @@ -16176,57 +15332,50 @@ components: description: Flag that indicates whether the cluster is paused. pitEnabled: type: boolean - description: >- - Flag that indicates whether the cluster uses continuous cloud + description: Flag that indicates whether the cluster uses continuous cloud backups. externalDocs: description: Continuous Cloud Backups url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ replicationSpecs: type: array - description: >- - List of settings that configure your cluster regions. For Global + description: List of settings that configure your cluster regions. For Global Clusters, each object in the array represents a zone where your clusters nodes deploy. For non-Global sharded clusters and replica sets, this array has one object representing where your clusters nodes deploy. items: - $ref: '#/components/schemas/ReplicationSpec' + $ref: "#/components/schemas/ReplicationSpec" rootCertType: type: string default: ISRGROOTX1 - description: >- - Root Certificate Authority that MongoDB Cloud cluster uses. MongoDB + description: Root Certificate Authority that MongoDB Cloud cluster uses. MongoDB Cloud supports Internet Security Research Group. stateName: type: string - description: >- - Human-readable label that indicates the current operating condition + description: Human-readable label that indicates the current operating condition of this cluster. readOnly: true tags: type: array - description: >- - List that contains key-value pairs between 1 to 255 characters in + description: List that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster. externalDocs: description: Resource Tags url: https://dochub.mongodb.org/core/add-cluster-tag-atlas items: - $ref: '#/components/schemas/ResourceTag' + $ref: "#/components/schemas/ResourceTag" terminationProtectionEnabled: type: boolean default: false - description: >- - Flag that indicates whether termination protection is enabled on the - cluster. If set to `true`, MongoDB Cloud won't delete the cluster. - If set to `false`, MongoDB Cloud will delete the cluster. + description: Flag that indicates whether termination protection is enabled on + the cluster. If set to `true`, MongoDB Cloud won't delete the + cluster. If set to `false`, MongoDB Cloud will delete the cluster. versionReleaseSystem: type: string default: LTS - description: >- - Method by which the cluster maintains the MongoDB versions. If value - is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. + description: Method by which the cluster maintains the MongoDB versions. If + value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. AdvancedComputeAutoScaling: type: object description: Options that determine how this cluster handles CPU scaling. @@ -16238,34 +15387,29 @@ components: auto-scaling. - - Set to `true` to enable instance size auto-scaling. If enabled, - you must specify a value for - **replicationSpecs[n].regionConfigs[m].autoScaling.compute.maxInstanceSize**. + - Set to `true` to enable instance size auto-scaling. If enabled, you must specify a value for **replicationSpecs[n].regionConfigs[m].autoScaling.compute.maxInstanceSize**. - Set to `false` to disable instance size automatic scaling. maxInstanceSize: - $ref: '#/components/schemas/BaseCloudProviderInstanceSize' + $ref: "#/components/schemas/BaseCloudProviderInstanceSize" minInstanceSize: - $ref: '#/components/schemas/BaseCloudProviderInstanceSize' + $ref: "#/components/schemas/BaseCloudProviderInstanceSize" scaleDownEnabled: type: boolean - description: >- - Flag that indicates whether the instance size may scale down. + description: 'Flag that indicates whether the instance size may scale down. MongoDB Cloud requires this parameter if `"replicationSpecs[n].regionConfigs[m].autoScaling.compute.enabled" : true`. If you enable this option, specify a value for - **replicationSpecs[n].regionConfigs[m].autoScaling.compute.minInstanceSize**. + **replicationSpecs[n].regionConfigs[m].autoScaling.compute.minInstanceSize**.' title: Automatic Compute Scaling Settings AdvancedDiskBackupSnapshotSchedulePolicy: type: object - description: >- - List that contains a document for each backup policy item in the desired - backup policy. + description: List that contains a document for each backup policy item in the + desired backup policy. properties: id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this backup + description: Unique 24-hexadecimal digit string that identifies this backup policy. maxLength: 24 minLength: 24 @@ -16274,7 +15418,7 @@ components: type: array description: List that contains the specifications for one policy. items: - $ref: '#/components/schemas/DiskBackupApiPolicyItem' + $ref: "#/components/schemas/DiskBackupApiPolicyItem" AlertViewForNdsGroup: type: object properties: @@ -16290,31 +15434,26 @@ components: acknowledged this alert. - - To acknowledge this alert forever, set the parameter value to 100 - years in the future. + - To acknowledge this alert forever, set the parameter value to 100 years in the future. - - To unacknowledge a previously acknowledged alert, set the - parameter value to a date in the past. + - To unacknowledge a previously acknowledged alert, set the parameter value to a date in the past. acknowledgementComment: type: string - description: >- - Comment that a MongoDB Cloud user submitted when acknowledging the + description: Comment that a MongoDB Cloud user submitted when acknowledging the alert. example: Expiration on 3/19. Silencing for 7days. maxLength: 200 acknowledgingUsername: type: string format: email - description: >- - MongoDB Cloud username of the person who acknowledged the alert. The - response returns this parameter if a MongoDB Cloud user previously - acknowledged this alert. + description: MongoDB Cloud username of the person who acknowledged the alert. + The response returns this parameter if a MongoDB Cloud user + previously acknowledged this alert. readOnly: true alertConfigId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the alert + description: Unique 24-hexadecimal digit string that identifies the alert configuration that sets this alert. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -16324,8 +15463,7 @@ components: created: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this alert. This parameter + description: Date and time when MongoDB Cloud created this alert. This parameter expresses its value in the ISO 8601 timestamp format in UTC. @@ -16336,8 +15474,7 @@ components: readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that owns this alert. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -16355,8 +15492,7 @@ components: lastNotified: type: string format: date-time - description: >- - Date and time that any notifications were last sent for this alert. + description: Date and time that any notifications were last sent for this alert. This parameter expresses its value in the ISO 8601 timestamp format in UTC. The @@ -16365,20 +15501,18 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true orgId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the + description: Unique 24-hexadecimal character string that identifies the organization that owns the project to which this alert applies. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -16388,12 +15522,11 @@ components: resolved: type: string format: date-time - description: >- - Date and time that this alert changed to `"status" : "CLOSED"`. This - parameter expresses its value in the ISO 8601 timestamp format in UTC. The - resource returns this parameter once `"status" : "CLOSED"`. + resource returns this parameter once `"status" : "CLOSED"`.' readOnly: true status: type: string @@ -16403,18 +15536,16 @@ components: updated: type: string format: date-time - description: >- - Date and time when someone last updated this alert. This parameter + description: Date and time when someone last updated this alert. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true clusterName: type: string - description: >- - Human-readable label that identifies the cluster to which this alert - applies. This resource returns this parameter for alerts of events - impacting backups, replica sets, or sharded clusters. + description: Human-readable label that identifies the cluster to which this + alert applies. This resource returns this parameter for alerts of + events impacting backups, replica sets, or sharded clusters. example: cluster1 maxLength: 64 minLength: 1 @@ -16422,22 +15553,20 @@ components: readOnly: true hostnameAndPort: type: string - description: >- - Hostname and port of the host to which this alert applies. The + description: Hostname and port of the host to which this alert applies. The resource returns this parameter for alerts of events impacting hosts or replica sets. example: cloud-test.mongodb.com:27017 readOnly: true replicaSetName: type: string - description: >- - Name of the replica set to which this alert applies. The response + description: Name of the replica set to which this alert applies. The response returns this parameter for alerts of events impacting backups, hosts, or replica sets. example: event-replica-set readOnly: true currentValue: - $ref: '#/components/schemas/NumberMetricValue' + $ref: "#/components/schemas/NumberMetricValue" metricName: type: string description: >- @@ -16445,22 +15574,15 @@ components: `metricThreshold.threshold`. - To learn more about the available metrics, see Host Metrics. + To learn more about the available metrics, see Host Metrics. - **NOTE**: If you set eventTypeName to - OUTSIDE_SERVERLESS_METRIC_THRESHOLD, you can specify only metrics - available for serverless. To learn more, see Serverless Measurements. + **NOTE**: If you set eventTypeName to OUTSIDE_SERVERLESS_METRIC_THRESHOLD, you can specify only metrics available for serverless. To learn more, see Serverless Measurements. example: ASSERT_USER readOnly: true nonRunningHostIds: type: array - description: >- - List of unique 24-hexadecimal character strings that identify the + description: List of unique 24-hexadecimal character strings that identify the replica set members that are not in PRIMARY nor SECONDARY state. items: type: string @@ -16472,8 +15594,7 @@ components: readOnly: true parentClusterId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the parent + description: Unique 24-hexadecimal character string that identifies the parent cluster to which this alert applies. The parent cluster contains the sharded nodes. MongoDB Cloud returns this parameter only for alerts of events impacting sharded clusters. @@ -16484,9 +15605,7 @@ components: readOnly: true AlertsNotificationRootForGroup: type: object - description: >- - One target that MongoDB Cloud sends notifications when an alert - triggers. + description: One target that MongoDB Cloud sends notifications when an alert triggers. properties: datadogApiKey: type: string @@ -16497,16 +15616,14 @@ components: : "DATADOG"`. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. - example: '****************************a23c' + * Query the alert for the notification through the Atlas Administration API. + example: "****************************a23c" datadogRegion: type: string default: US @@ -16516,14 +15633,11 @@ components: `"notifications.[n].typeName" : "DATADOG"`. - To learn more about Datadog's regions, see Datadog Sites. + To learn more about Datadog's regions, see Datadog Sites. delayMin: type: integer format: int32 - description: >- - Number of minutes that MongoDB Cloud waits after detecting an alert + description: Number of minutes that MongoDB Cloud waits after detecting an alert condition before it sends out the first notification. intervalMin: type: integer @@ -16534,14 +15648,11 @@ components: unacknowledged alert. - PagerDuty, VictorOps, and OpsGenie notifications don't return this - element. Configure and manage the notification interval within each - of those services. + PagerDuty, VictorOps, and OpsGenie notifications don't return this element. Configure and manage the notification interval within each of those services. minimum: 5 notifierId: type: string - description: >- - The notifierId is a system-generated unique identifier assigned to + description: The notifierId is a system-generated unique identifier assigned to each notification method. This is needed when updating third-party notifications without requiring explicit authentication credentials. example: 6462742adc47d365036da07c @@ -16558,20 +15669,16 @@ components: individual or groups of MongoDB Cloud users including: - - specific MongoDB Cloud users (`"notifications.[n].typeName" : - "USER"`) + - specific MongoDB Cloud users (`"notifications.[n].typeName" : "USER"`) - - MongoDB Cloud users with specific project roles - (`"notifications.[n].typeName" : "GROUP"`) + - MongoDB Cloud users with specific project roles (`"notifications.[n].typeName" : "GROUP"`) - - MongoDB Cloud users with specific organization roles - (`"notifications.[n].typeName" : "ORG"`) + - MongoDB Cloud users with specific organization roles (`"notifications.[n].typeName" : "ORG"`) - MongoDB Cloud teams (`"notifications.[n].typeName" : "TEAM"`) - To send emails to one MongoDB Cloud user or grouping of users, set - the `notifications.[n].emailEnabled` parameter. + To send emails to one MongoDB Cloud user or grouping of users, set the `notifications.[n].emailEnabled` parameter. emailEnabled: type: boolean description: >- @@ -16587,8 +15694,7 @@ components: - `"notifications.[n].typeName" : "USER"` roles: type: array - description: >- - List that contains the one or more + description: 'List that contains the one or more [organization](https://dochub.mongodb.org/core/atlas-org-roles) or [project roles](https://dochub.mongodb.org/core/atlas-proj-roles) that receive the configured alert. The resource requires this @@ -16596,12 +15702,10 @@ components: `"notifications.[n].typeName" : "ORG"`. If you include this parameter, MongoDB Cloud sends alerts only to users assigned the roles you specify in the array. If you omit this parameter, MongoDB - Cloud sends alerts to users assigned any role. + Cloud sends alerts to users assigned any role.' items: type: string - description: >- - One organization or project role that receive the configured - alert. + description: One organization or project role that receive the configured alert. smsEnabled: type: boolean description: >- @@ -16625,22 +15729,19 @@ components: If the token remains invalid, MongoDB Cloud removes it. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. - example: '************************************1234' + * Query the alert for the notification through the Atlas Administration API. + example: "************************************1234" roomName: type: string - description: >- - HipChat API room name to which MongoDB Cloud sends alert + description: 'HipChat API room name to which MongoDB Cloud sends alert notifications. The resource requires this parameter when - `"notifications.[n].typeName" : "HIP_CHAT"`". + `"notifications.[n].typeName" : "HIP_CHAT"`".' example: test room microsoftTeamsWebhookUrl: type: string @@ -16653,8 +15754,7 @@ components: invalid, MongoDB Cloud removes it. - **NOTE**: When you view or edit the alert for a Microsoft Teams - notification, the URL appears partially redacted. + **NOTE**: When you view or edit the alert for a Microsoft Teams notification, the URL appears partially redacted. example: https://webhook.com/**** opsGenieApiKey: type: string @@ -16666,27 +15766,23 @@ components: If the key remains invalid, MongoDB Cloud removes it. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. - example: '********************************a111' + * Query the alert for the notification through the Atlas Administration API. + example: "********************************a111" opsGenieRegion: type: string default: US - description: >- - Opsgenie region that indicates which API Uniform Resource Locator + description: Opsgenie region that indicates which API Uniform Resource Locator (URL) to use. region: type: string default: US - description: >- - PagerDuty region that indicates which API Uniform Resource Locator + description: PagerDuty region that indicates which API Uniform Resource Locator (URL) to use. serviceKey: type: string @@ -16698,16 +15794,14 @@ components: If the key remains invalid, MongoDB Cloud removes it. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. - example: '****************************7890' + * Query the alert for the notification through the Atlas Administration API. + example: "****************************7890" apiToken: type: string description: >- @@ -16718,56 +15812,49 @@ components: token remains invalid, MongoDB Cloud removes the token. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. - example: >- - **********************************************************************abcd + * Query the alert for the notification through the Atlas Administration API. + example: "*********************************************************************\ + *abcd" channelName: type: string - description: >- - Name of the Slack channel to which MongoDB Cloud sends alert + description: 'Name of the Slack channel to which MongoDB Cloud sends alert notifications. The resource requires this parameter when - `"notifications.[n].typeName" : "SLACK"`. + `"notifications.[n].typeName" : "SLACK"`.' example: alerts mobileNumber: type: string - description: >- - Mobile phone number to which MongoDB Cloud sends alert + description: 'Mobile phone number to which MongoDB Cloud sends alert notifications. The resource requires this parameter when - `"notifications.[n].typeName" : "SMS"`. - example: '1233337892' + `"notifications.[n].typeName" : "SMS"`.' + example: "1233337892" teamId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies one MongoDB Cloud - team. The resource requires this parameter when - `"notifications.[n].typeName" : "TEAM"`. + description: 'Unique 24-hexadecimal digit string that identifies one MongoDB + Cloud team. The resource requires this parameter when + `"notifications.[n].typeName" : "TEAM"`.' example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ teamName: type: string - description: >- - Name of the MongoDB Cloud team that receives this notification. The - resource requires this parameter when `"notifications.[n].typeName" - : "TEAM"`. + description: 'Name of the MongoDB Cloud team that receives this notification. + The resource requires this parameter when + `"notifications.[n].typeName" : "TEAM"`.' example: Atlas username: type: string format: email - description: >- - MongoDB Cloud username of the person to whom MongoDB Cloud sends + description: 'MongoDB Cloud username of the person to whom MongoDB Cloud sends notifications. Specify only MongoDB Cloud users who belong to the project that owns the alert configuration. The resource requires - this parameter when `"notifications.[n].typeName" : "USER"`. + this parameter when `"notifications.[n].typeName" : "USER"`.' victorOpsApiKey: type: string description: >- @@ -16778,24 +15865,21 @@ components: If the key remains invalid, MongoDB Cloud removes it. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. - example: '********************************9abc' + * Query the alert for the notification through the Atlas Administration API. + example: "********************************9abc" victorOpsRoutingKey: type: string - description: >- - Routing key that MongoDB Cloud needs to send alert notifications to - Splunk On-Call. The resource requires this parameter when + description: 'Routing key that MongoDB Cloud needs to send alert notifications + to Splunk On-Call. The resource requires this parameter when `"notifications.[n].typeName" : "VICTOR_OPS"`. If the key later becomes invalid, MongoDB Cloud sends an email to the project owners. - If the key remains invalid, MongoDB Cloud removes it. + If the key remains invalid, MongoDB Cloud removes it.' example: test routing webhookSecret: type: string @@ -16803,60 +15887,47 @@ components: Authentication secret for a webhook-based alert. - Atlas returns this value if you set `"notifications.[n].typeName" - :"WEBHOOK"` and either: + Atlas returns this value if you set `"notifications.[n].typeName" :"WEBHOOK"` and either: * You set `notification.[n].webhookSecret` to a non-empty string - * You set a default webhookSecret either on the - [Integrations](https://www.mongodb.com/docs/atlas/tutorial/third-party-service-integrations/#std-label-third-party-integrations) - page, or with the [Integrations - API](#tag/Third-Party-Service-Integrations/operation/createIntegration) + * You set a default webhookSecret either on the [Integrations](https://www.mongodb.com/docs/atlas/tutorial/third-party-service-integrations/#std-label-third-party-integrations) page, or with the [Integrations API](#tag/Third-Party-Service-Integrations/operation/createIntegration) - **NOTE**: When you view or edit the alert for a webhook - notification, the secret appears completely redacted. - example: '******' + **NOTE**: When you view or edit the alert for a webhook notification, the secret appears completely redacted. + example: "******" webhookUrl: type: string description: >- Target URL for a webhook-based alert. - Atlas returns this value if you set `"notifications.[n].typeName" - :"WEBHOOK"` and either: + Atlas returns this value if you set `"notifications.[n].typeName" :"WEBHOOK"` and either: * You set `notification.[n].webhookURL` to a non-empty string - * You set a default webhookUrl either on the - [Integrations](https://www.mongodb.com/docs/atlas/tutorial/third-party-service-integrations/#std-label-third-party-integrations) - page, or with the [Integrations - API](#tag/Third-Party-Service-Integrations/operation/createIntegration) + * You set a default webhookUrl either on the [Integrations](https://www.mongodb.com/docs/atlas/tutorial/third-party-service-integrations/#std-label-third-party-integrations) page, or with the [Integrations API](#tag/Third-Party-Service-Integrations/operation/createIntegration) - **NOTE**: When you view or edit the alert for a Webhook URL - notification, the URL appears partially redacted. + **NOTE**: When you view or edit the alert for a Webhook URL notification, the URL appears partially redacted. example: https://webhook.com/**** AlertsToggle: type: object - description: >- - Enables or disables the specified alert configuration in the specified - project. + description: Enables or disables the specified alert configuration in the + specified project. properties: enabled: type: boolean - description: >- - Flag that indicates whether to enable or disable the specified alert - configuration in the specified project. + description: Flag that indicates whether to enable or disable the specified + alert configuration in the specified project. title: Toggle Request ApiError: type: object properties: detail: type: string - description: >- - Describes the specific conditions or reasons that cause each type of - error. + description: Describes the specific conditions or reasons that cause each type + of error. error: type: integer format: int32 @@ -16874,8 +15945,7 @@ components: reason: type: string description: Application error message returned with this error. - example: >- - At most one group notification can be specified for an alert + example: At most one group notification can be specified for an alert configuration. ApiHostView_Atlas: type: object @@ -16883,15 +15953,13 @@ components: created: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this MongoDB process. This + description: Date and time when MongoDB Cloud created this MongoDB process. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project. The + description: Unique 24-hexadecimal digit string that identifies the project. The project contains MongoDB processes that you want to return. The MongoDB process can be either the `mongod` or `mongos`. example: 32b6e34b3d91647abb20e7b8 @@ -16901,80 +15969,69 @@ components: readOnly: true hostname: type: string - description: >- - Hostname, fully qualified domain name (FQDN), or Internet Protocol + description: Hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ readOnly: true id: type: string - description: >- - Combination of hostname and Internet Assigned Numbers Authority + description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ readOnly: true lastPing: type: string format: date-time - description: >- - Date and time when MongoDB Cloud received the last ping for this + description: Date and time when MongoDB Cloud received the last ping for this MongoDB process. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link_Atlas' + $ref: "#/components/schemas/Link_Atlas" readOnly: true port: type: integer format: int32 - description: >- - Internet Assigned Numbers Authority (IANA) port on which the MongoDB - process listens for requests. + description: Internet Assigned Numbers Authority (IANA) port on which the + MongoDB process listens for requests. readOnly: true replicaSetName: type: string - description: >- - Human-readable label that identifies the replica set that contains + description: Human-readable label that identifies the replica set that contains this process. This resource returns this parameter if this process belongs to a replica set. readOnly: true shardName: type: string - description: >- - Human-readable label that identifies the shard that contains this + description: Human-readable label that identifies the shard that contains this process. This resource returns this value only if this process belongs to a sharded cluster. readOnly: true typeName: type: string - description: >- - Type of MongoDB process that MongoDB Cloud tracks. MongoDB Cloud + description: Type of MongoDB process that MongoDB Cloud tracks. MongoDB Cloud returns new processes as **NO_DATA** until MongoDB Cloud completes deploying the process. readOnly: true userAlias: type: string - description: >- - Human-readable label that identifies the cluster node. MongoDB Cloud - sets this hostname usually to the standard hostname for the cluster - node. It appears in the connection string for a cluster instead of - the value of the hostname parameter. + description: Human-readable label that identifies the cluster node. MongoDB + Cloud sets this hostname usually to the standard hostname for the + cluster node. It appears in the connection string for a cluster + instead of the value of the hostname parameter. readOnly: true version: type: string @@ -16987,17 +16044,15 @@ components: properties: accessList: type: array - description: >- - List of network addresses granted access to this API using this API + description: List of network addresses granted access to this API using this API key. items: - $ref: '#/components/schemas/AccessListItem' + $ref: "#/components/schemas/AccessListItem" readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key. + description: Unique 24-hexadecimal digit string that identifies this + organization API key. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -17011,14 +16066,13 @@ components: readOnly: true roles: type: array - description: >- - List that contains roles that the API key needs to have. All roles + description: List that contains roles that the API key needs to have. All roles you provide must be valid for the specified project or organization. Each request must include a minimum of one valid role. The resource returns all project and organization roles assigned to the Cloud user. items: - $ref: '#/components/schemas/CloudAccessRoleAssignment' + $ref: "#/components/schemas/CloudAccessRoleAssignment" readOnly: true readOnly: true required: @@ -17029,16 +16083,14 @@ components: properties: desc: type: string - description: >- - Purpose or explanation provided when someone created this + description: Purpose or explanation provided when someone created this organization API key. maxLength: 250 minLength: 1 id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this organization - API key assigned to this project. + description: Unique 24-hexadecimal digit string that identifies this + organization API key assigned to this project. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -17046,20 +16098,18 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true privateKey: type: string - description: >- - Redacted private key returned for this organization API key. This + description: Redacted private key returned for this organization API key. This key displays unredacted when first created. example: 55c3bbb6-b4bb-0be1-e66d20841f3e readOnly: true @@ -17072,44 +16122,39 @@ components: readOnly: true roles: type: array - description: >- - List that contains the roles that the API key needs to have. All + description: List that contains the roles that the API key needs to have. All roles you provide must be valid for the specified project or organization. Each request must include a minimum of one valid role. The resource returns all project and organization roles assigned to the API key. items: - $ref: '#/components/schemas/CloudAccessRoleAssignment' + $ref: "#/components/schemas/CloudAccessRoleAssignment" ApiMeasurementsGeneralView_Atlas: type: object properties: databaseName: type: string - description: >- - Human-readable label that identifies the database that the specified - MongoDB process serves. + description: Human-readable label that identifies the database that the + specified MongoDB process serves. readOnly: true end: type: string format: date-time - description: >- - Date and time that specifies when to stop retrieving measurements. + description: Date and time that specifies when to stop retrieving measurements. If you set **end**, you must set **start**. You can't set this parameter and **period** in the same request. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true granularity: type: string - description: >- - Duration that specifies the interval between measurement data + description: Duration that specifies the interval between measurement data points. The parameter expresses its value in ISO 8601 timestamp format in UTC. If you set this parameter, you must set either **period** or **start** and **end**. readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project. The + description: Unique 24-hexadecimal digit string that identifies the project. The project contains MongoDB processes that you want to return. The MongoDB process can be either the `mongod` or `mongos`. example: 32b6e34b3d91647abb20e7b8 @@ -17119,59 +16164,52 @@ components: readOnly: true hostId: type: string - description: >- - Combination of hostname and Internet Assigned Numbers Authority + description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link_Atlas' + $ref: "#/components/schemas/Link_Atlas" readOnly: true measurements: type: array description: List that contains measurements and their data points. items: - $ref: '#/components/schemas/MetricsMeasurement_Atlas' + $ref: "#/components/schemas/MetricsMeasurement_Atlas" readOnly: true partitionName: type: string - description: >- - Human-readable label of the disk or partition to which the + description: Human-readable label of the disk or partition to which the measurements apply. readOnly: true processId: type: string - description: >- - Combination of hostname and Internet Assigned Numbers Authority + description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ readOnly: true start: type: string format: date-time - description: >- - Date and time that specifies when to start retrieving measurements. + description: Date and time that specifies when to start retrieving measurements. If you set **start**, you must set **end**. You can't set this parameter and **period** in the same request. This parameter expresses its value in the ISO 8601 timestamp format in UTC. @@ -17181,8 +16219,7 @@ components: properties: cloudProvider: type: string - description: >- - The cloud provider of the region that undergoes the outage + description: The cloud provider of the region that undergoes the outage simulation. regionName: type: string @@ -17212,15 +16249,14 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true name: type: string @@ -17236,19 +16272,16 @@ components: auditAuthorizationSuccess: type: boolean default: false - description: >- - Flag that indicates whether someone set auditing to track successful - authentications. This only applies to the `"atype" : "authCheck"` - audit filter. Setting this parameter to `true` degrades cluster - performance. + description: 'Flag that indicates whether someone set auditing to track + successful authentications. This only applies to the `"atype" : + "authCheck"` audit filter. Setting this parameter to `true` degrades + cluster performance.' externalDocs: description: System Auditing Messages - url: >- - https://docs.mongodb.com/manual/reference/audit-message/#audit-event-actions-details-and-results + url: https://docs.mongodb.com/manual/reference/audit-message/#audit-event-actions-details-and-results auditFilter: type: string - description: >- - JSON document that specifies which events to record. Escape any + description: JSON document that specifies which events to record. Escape any characters that may prevent parsing, such as single or double quotes, using a backslash (`\`). externalDocs: @@ -17256,15 +16289,12 @@ components: url: https://docs.atlas.mongodb.com/tutorial/auditing-custom-filter/ configurationType: type: string - description: >- - Human-readable label that displays how to configure the audit - filter. + description: Human-readable label that displays how to configure the audit filter. readOnly: true enabled: type: boolean default: false - description: >- - Flag that indicates whether someone enabled database auditing for + description: Flag that indicates whether someone enabled database auditing for the specified project. required: - auditAuthorizationSuccess @@ -17276,16 +16306,13 @@ components: properties: externalGroupName: type: string - description: >- - Unique human-readable label that identifies the identity provider + description: Unique human-readable label that identifies the identity provider group to whichthis role mapping applies. maxLength: 200 minLength: 1 id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this role - mapping. + description: Unique 24-hexadecimal digit string that identifies this role mapping. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -17293,25 +16320,21 @@ components: readOnly: true roleAssignments: type: array - description: >- - Atlas roles and the unique identifiers of the groups and + description: Atlas roles and the unique identifiers of the groups and organizations associated with each role. items: - $ref: '#/components/schemas/RoleAssignment' + $ref: "#/components/schemas/RoleAssignment" uniqueItems: true required: - externalGroupName title: Federated Authentication Role Mapping AvailableCloudProviderRegion: type: object - description: >- - List of regions that this cloud provider supports for this instance - size. + description: List of regions that this cloud provider supports for this instance size. properties: default: type: boolean - description: >- - Flag that indicates whether the cloud provider sets this region as + description: Flag that indicates whether the cloud provider sets this region as its default. AWS defaults to US_EAST_1, GCP defaults to CENTRAL_US, and AZURE defaults to US_WEST_2. readOnly: true @@ -17339,15 +16362,13 @@ components: dbSizeBytes: type: integer format: int64 - description: >- - Size of this database on disk at the time of the request expressed + description: Size of this database on disk at the time of the request expressed in bytes. example: 8192 readOnly: true featureCompatibilityVersion: type: string - description: >- - Version of MongoDB + description: Version of MongoDB [features](https://docs.mongodb.com/manual/reference/command/setFeatureCompatibilityVersion) that this cluster supports. readOnly: true @@ -17367,9 +16388,7 @@ components: oplogSizeMB: type: integer format: int32 - description: >- - Size of the Oplog on disk at the time of the request expressed in - MB. + description: Size of the Oplog on disk at the time of the request expressed in MB. example: 3 readOnly: true sharded: @@ -17403,9 +16422,8 @@ components: title: Available Clusters AzureKeyVault: type: object - description: >- - Details that define the configuration of Encryption at Rest using Azure - Key Vault (AKV). + description: Details that define the configuration of Encryption at Rest using + Azure Key Vault (AKV). externalDocs: description: Azure Key Vault url: https://www.mongodb.com/docs/atlas/security-azure-kms/ @@ -17416,86 +16434,72 @@ components: clientID: type: string format: uuid - description: >- - Unique 36-hexadecimal character string that identifies an Azure + description: Unique 36-hexadecimal character string that identifies an Azure application associated with your Azure Active Directory tenant. enabled: type: boolean - description: >- - Flag that indicates whether someone enabled encryption at rest for + description: Flag that indicates whether someone enabled encryption at rest for the specified project. To disable encryption at rest using customer key management and remove the configuration details, pass only this parameter with a value of `false`. keyIdentifier: type: string - description: >- - Web address with a unique key that identifies for your Azure Key + description: Web address with a unique key that identifies for your Azure Key Vault. - example: >- - https://EXAMPLEKeyVault.vault.azure.net/keys/EXAMPLEKey/d891821e3d364e9eb88fbd3d11807b86 + example: https://EXAMPLEKeyVault.vault.azure.net/keys/EXAMPLEKey/d891821e3d364e9eb88fbd3d11807b86 keyVaultName: type: string - description: >- - Unique string that identifies the Azure Key Vault that contains your - key. + description: Unique string that identifies the Azure Key Vault that contains + your key. resourceGroupName: type: string description: Name of the Azure resource group that contains your Azure Key Vault. secret: type: string - description: >- - Private data that you need secured and that belongs to the specified - Azure Key Vault (AKV) tenant (**azureKeyVault.tenantID**). This data - can include any type of sensitive data such as passwords, database - connection strings, API keys, and the like. AKV stores this + description: Private data that you need secured and that belongs to the + specified Azure Key Vault (AKV) tenant (**azureKeyVault.tenantID**). + This data can include any type of sensitive data such as passwords, + database connection strings, API keys, and the like. AKV stores this information as encrypted binary data. externalDocs: description: Azure Key Vault Secrets - url: >- - https://docs.microsoft.com/en-us/azure/key-vault/secrets/about-secrets + url: https://docs.microsoft.com/en-us/azure/key-vault/secrets/about-secrets writeOnly: true subscriptionID: type: string format: uuid - description: >- - Unique 36-hexadecimal character string that identifies your Azure + description: Unique 36-hexadecimal character string that identifies your Azure subscription. tenantID: type: string format: uuid - description: >- - Unique 36-hexadecimal character string that identifies the Azure + description: Unique 36-hexadecimal character string that identifies the Azure Active Directory tenant within your Azure subscription. valid: type: boolean - description: >- - Flag that indicates whether the Azure encryption key can encrypt and - decrypt data. + description: Flag that indicates whether the Azure encryption key can encrypt + and decrypt data. readOnly: true BackupLabel: type: object - description: >- - Collection of key-value pairs that represent custom data to add to the - metadata file that MongoDB Cloud uploads to the bucket when the export - job finishes. + description: Collection of key-value pairs that represent custom data to add to + the metadata file that MongoDB Cloud uploads to the bucket when the + export job finishes. properties: key: type: string - description: >- - Key for the metadata file that MongoDB Cloud uploads to the bucket + description: Key for the metadata file that MongoDB Cloud uploads to the bucket when the export job finishes. value: type: string - description: >- - Value for the key to include in file that MongoDB Cloud uploads to + description: Value for the key to include in file that MongoDB Cloud uploads to the bucket when the export job finishes. BackupOnlineArchive: type: object properties: _id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the online + description: Unique 24-hexadecimal digit string that identifies the online archive. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -17504,8 +16508,7 @@ components: readOnly: true clusterName: type: string - description: >- - Human-readable label that identifies the cluster that contains the + description: Human-readable label that identifies the cluster that contains the collection for which you want to create an online archive. maxLength: 64 minLength: 1 @@ -17513,8 +16516,7 @@ components: readOnly: true collName: type: string - description: >- - Human-readable label that identifies the collection for which you + description: Human-readable label that identifies the collection for which you created the online archive. collectionType: type: string @@ -17524,27 +16526,23 @@ components: return. - If you set this parameter to `TIMESERIES`, set `"criteria.type" : - "date"` and `"criteria.dateFormat" : "ISODATE"`. + If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`. criteria: - $ref: '#/components/schemas/Criteria' + $ref: "#/components/schemas/Criteria" dataProcessRegion: - $ref: '#/components/schemas/DataProcessRegion' + $ref: "#/components/schemas/DataProcessRegion" dataSetName: type: string - description: >- - Human-readable label that identifies the dataset that Atlas + description: Human-readable label that identifies the dataset that Atlas generates for this online archive. readOnly: true dbName: type: string - description: >- - Human-readable label of the database that contains the collection + description: Human-readable label of the database that contains the collection that contains the online archive. groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that contains the specified cluster. The specified cluster contains the collection for which to create the online archive. example: 32b6e34b3d91647abb20e7b8 @@ -17554,34 +16552,32 @@ components: readOnly: true partitionFields: type: array - description: >- - List that contains document parameters to use to logically divide + description: "List that contains document parameters to use to logically divide data within a collection. Partitions provide a coarse level of filtering of the underlying collection data. To divide your data, - specify parameters that you frequently query. If you "specified - :criteria.type": "DATE" in the CREATE ONE ONLINE ARCHIVE endpoint, - then you can specify up to three parameters by which to query. One - of these parameters must be the DATE value, which is required in - this case. If you "specified :criteria.type": "CUSTOM" in the CREATE - ONE ONLINE ARCHIVE endpoint, then you can specify up to two - parameters by which to query. Queries that don't use - ":criteria.type": "DATE" or ":criteria.type": "CUSTOM" parameters - cause MongoDB to scan a full collection of all archived documents. - This takes more time and increases your costs. - items: - $ref: '#/components/schemas/PartitionField' + specify parameters that you frequently query. If you \"specified + :criteria.type\": \"DATE\" in the CREATE ONE ONLINE ARCHIVE + endpoint, then you can specify up to three parameters by which to + query. One of these parameters must be the DATE value, which is + required in this case. If you \"specified :criteria.type\": + \"CUSTOM\" in the CREATE ONE ONLINE ARCHIVE endpoint, then you can + specify up to two parameters by which to query. Queries that don't + use \":criteria.type\": \"DATE\" or \":criteria.type\": \"CUSTOM\" + parameters cause MongoDB to scan a full collection of all archived + documents. This takes more time and increases your costs." + items: + $ref: "#/components/schemas/PartitionField" minItems: 1 paused: type: boolean - description: >- - Flag that indicates whether this online archive exists in the paused - state. A request to resume fails if the collection has another - active online archive. To pause an active online archive or resume a - paused online archive, you must include this parameter. To pause an - active archive, set this to **true**. To resume a paused archive, - set this to **false**. + description: Flag that indicates whether this online archive exists in the + paused state. A request to resume fails if the collection has + another active online archive. To pause an active online archive or + resume a paused online archive, you must include this parameter. To + pause an active archive, set this to **true**. To resume a paused + archive, set this to **false**. schedule: - $ref: '#/components/schemas/OnlineArchiveSchedule' + $ref: "#/components/schemas/OnlineArchiveSchedule" state: type: string description: >- @@ -17593,40 +16589,26 @@ components: |-------------|------------| - | `PENDING` | MongoDB Cloud has queued documents for archive. - Archiving hasn't started. | + | `PENDING` | MongoDB Cloud has queued documents for archive. Archiving hasn't started. | - | `ARCHIVING` | MongoDB Cloud started archiving documents that meet - the archival criteria. | + | `ARCHIVING` | MongoDB Cloud started archiving documents that meet the archival criteria. | - | `IDLE` | MongoDB Cloud waits to start the next archival job. - | + | `IDLE` | MongoDB Cloud waits to start the next archival job. | - | `PAUSING` | Someone chose to stop archiving. MongoDB Cloud - finishes the running archival job then changes the state to `PAUSED` - when that job completes. | + | `PAUSING` | Someone chose to stop archiving. MongoDB Cloud finishes the running archival job then changes the state to `PAUSED` when that job completes. | - | `PAUSED` | MongoDB Cloud has stopped archiving. Archived - documents can be queried. The specified archiving operation on the - active cluster cannot archive additional documents. You can resume - archiving for paused archives at any time. | + | `PAUSED` | MongoDB Cloud has stopped archiving. Archived documents can be queried. The specified archiving operation on the active cluster cannot archive additional documents. You can resume archiving for paused archives at any time. | - | `ORPHANED` | Someone has deleted the collection associated with - an active or paused archive. MongoDB Cloud doesn't delete the - archived data. You must manually delete the online archives - associated with the deleted collection. | + | `ORPHANED` | Someone has deleted the collection associated with an active or paused archive. MongoDB Cloud doesn't delete the archived data. You must manually delete the online archives associated with the deleted collection. | - | `DELETED` | Someone has deleted the archive was deleted. When - someone deletes an online archive, MongoDB Cloud removes all - associated archived documents from the cloud object storage. | + | `DELETED` | Someone has deleted the archive was deleted. When someone deletes an online archive, MongoDB Cloud removes all associated archived documents from the cloud object storage. | readOnly: true BackupOnlineArchiveCreate: type: object properties: _id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the online + description: Unique 24-hexadecimal digit string that identifies the online archive. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -17635,8 +16617,7 @@ components: readOnly: true clusterName: type: string - description: >- - Human-readable label that identifies the cluster that contains the + description: Human-readable label that identifies the cluster that contains the collection for which you want to create an online archive. maxLength: 64 minLength: 1 @@ -17644,8 +16625,7 @@ components: readOnly: true collName: type: string - description: >- - Human-readable label that identifies the collection for which you + description: Human-readable label that identifies the collection for which you created the online archive. collectionType: type: string @@ -17655,27 +16635,23 @@ components: return. - If you set this parameter to `TIMESERIES`, set `"criteria.type" : - "date"` and `"criteria.dateFormat" : "ISODATE"`. + If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`. criteria: - $ref: '#/components/schemas/Criteria' + $ref: "#/components/schemas/Criteria" dataProcessRegion: - $ref: '#/components/schemas/DataProcessRegion' + $ref: "#/components/schemas/DataProcessRegion" dataSetName: type: string - description: >- - Human-readable label that identifies the dataset that Atlas + description: Human-readable label that identifies the dataset that Atlas generates for this online archive. readOnly: true dbName: type: string - description: >- - Human-readable label of the database that contains the collection + description: Human-readable label of the database that contains the collection that contains the online archive. groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that contains the specified cluster. The specified cluster contains the collection for which to create the online archive. example: 32b6e34b3d91647abb20e7b8 @@ -17685,34 +16661,32 @@ components: readOnly: true partitionFields: type: array - description: >- - List that contains document parameters to use to logically divide + description: "List that contains document parameters to use to logically divide data within a collection. Partitions provide a coarse level of filtering of the underlying collection data. To divide your data, - specify parameters that you frequently query. If you "specified - :criteria.type": "DATE" in the CREATE ONE ONLINE ARCHIVE endpoint, - then you can specify up to three parameters by which to query. One - of these parameters must be the DATE value, which is required in - this case. If you "specified :criteria.type": "CUSTOM" in the CREATE - ONE ONLINE ARCHIVE endpoint, then you can specify up to two - parameters by which to query. Queries that don't use - ":criteria.type": "DATE" or ":criteria.type": "CUSTOM" parameters - cause MongoDB to scan a full collection of all archived documents. - This takes more time and increases your costs. - items: - $ref: '#/components/schemas/PartitionField' + specify parameters that you frequently query. If you \"specified + :criteria.type\": \"DATE\" in the CREATE ONE ONLINE ARCHIVE + endpoint, then you can specify up to three parameters by which to + query. One of these parameters must be the DATE value, which is + required in this case. If you \"specified :criteria.type\": + \"CUSTOM\" in the CREATE ONE ONLINE ARCHIVE endpoint, then you can + specify up to two parameters by which to query. Queries that don't + use \":criteria.type\": \"DATE\" or \":criteria.type\": \"CUSTOM\" + parameters cause MongoDB to scan a full collection of all archived + documents. This takes more time and increases your costs." + items: + $ref: "#/components/schemas/PartitionField" minItems: 1 paused: type: boolean - description: >- - Flag that indicates whether this online archive exists in the paused - state. A request to resume fails if the collection has another - active online archive. To pause an active online archive or resume a - paused online archive, you must include this parameter. To pause an - active archive, set this to **true**. To resume a paused archive, - set this to **false**. + description: Flag that indicates whether this online archive exists in the + paused state. A request to resume fails if the collection has + another active online archive. To pause an active online archive or + resume a paused online archive, you must include this parameter. To + pause an active archive, set this to **true**. To resume a paused + archive, set this to **false**. schedule: - $ref: '#/components/schemas/OnlineArchiveSchedule' + $ref: "#/components/schemas/OnlineArchiveSchedule" state: type: string description: >- @@ -17724,32 +16698,19 @@ components: |-------------|------------| - | `PENDING` | MongoDB Cloud has queued documents for archive. - Archiving hasn't started. | + | `PENDING` | MongoDB Cloud has queued documents for archive. Archiving hasn't started. | - | `ARCHIVING` | MongoDB Cloud started archiving documents that meet - the archival criteria. | + | `ARCHIVING` | MongoDB Cloud started archiving documents that meet the archival criteria. | - | `IDLE` | MongoDB Cloud waits to start the next archival job. - | + | `IDLE` | MongoDB Cloud waits to start the next archival job. | - | `PAUSING` | Someone chose to stop archiving. MongoDB Cloud - finishes the running archival job then changes the state to `PAUSED` - when that job completes. | + | `PAUSING` | Someone chose to stop archiving. MongoDB Cloud finishes the running archival job then changes the state to `PAUSED` when that job completes. | - | `PAUSED` | MongoDB Cloud has stopped archiving. Archived - documents can be queried. The specified archiving operation on the - active cluster cannot archive additional documents. You can resume - archiving for paused archives at any time. | + | `PAUSED` | MongoDB Cloud has stopped archiving. Archived documents can be queried. The specified archiving operation on the active cluster cannot archive additional documents. You can resume archiving for paused archives at any time. | - | `ORPHANED` | Someone has deleted the collection associated with - an active or paused archive. MongoDB Cloud doesn't delete the - archived data. You must manually delete the online archives - associated with the deleted collection. | + | `ORPHANED` | Someone has deleted the collection associated with an active or paused archive. MongoDB Cloud doesn't delete the archived data. You must manually delete the online archives associated with the deleted collection. | - | `DELETED` | Someone has deleted the archive was deleted. When - someone deletes an online archive, MongoDB Cloud removes all - associated archived documents from the cloud object storage. | + | `DELETED` | Someone has deleted the archive was deleted. When someone deletes an online archive, MongoDB Cloud removes all associated archived documents from the cloud object storage. | readOnly: true required: - collName @@ -17760,8 +16721,7 @@ components: properties: batchId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the batch to + description: Unique 24-hexadecimal digit string that identifies the batch to which this restore job belongs. This parameter exists only for a sharded cluster restore. example: 32b6e34b3d91647abb20e7b8 @@ -17779,12 +16739,9 @@ components: with sharded clusters only. - - If you set **checkpointId**, you can't set **oplogInc**, - **oplogTs**, **snapshotId**, or **pointInTimeUTCMillis**. + - If you set **checkpointId**, you can't set **oplogInc**, **oplogTs**, **snapshotId**, or **pointInTimeUTCMillis**. - - If you provide this parameter, this endpoint restores all data up - to this checkpoint to the database you specify in the **delivery** - object. + - If you provide this parameter, this endpoint restores all data up to this checkpoint to the database you specify in the **delivery** object. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -17792,8 +16749,7 @@ components: writeOnly: true clusterId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the cluster with + description: Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return. This parameter returns for restore clusters. example: 32b6e34b3d91647abb20e7b8 @@ -17803,8 +16759,7 @@ components: readOnly: true clusterName: type: string - description: >- - Human-readable label that identifies the cluster containing the + description: Human-readable label that identifies the cluster containing the snapshots you want to retrieve. maxLength: 64 minLength: 1 @@ -17813,23 +16768,20 @@ components: created: type: string format: date-time - description: >- - Date and time when someone requested this restore job. This + description: Date and time when someone requested this restore job. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true delivery: - $ref: '#/components/schemas/BackupRestoreJobDelivery' + $ref: "#/components/schemas/BackupRestoreJobDelivery" encryptionEnabled: type: boolean - description: >- - Flag that indicates whether someone encrypted the data in the + description: Flag that indicates whether someone encrypted the data in the restored snapshot. readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that owns the snapshots. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -17838,14 +16790,13 @@ components: readOnly: true hashes: type: array - description: >- - List that contains documents mapping each restore file to a hashed + description: 'List that contains documents mapping each restore file to a hashed checksum. This parameter applies after you download the corresponding **delivery.url**. If `"methodName" : "HTTP"`, this list contains one object that represents the hash of the **.tar.gz** - file. + file.' items: - $ref: '#/components/schemas/RestoreJobFileHash' + $ref: "#/components/schemas/RestoreJobFileHash" readOnly: true id: type: string @@ -17857,24 +16808,22 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true masterKeyUUID: type: string format: uuid - description: >- - Universally Unique Identifier (UUID) that identifies the Key + description: 'Universally Unique Identifier (UUID) that identifies the Key Management Interoperability (KMIP) master key used to encrypt the snapshot data. This parameter applies only when `"encryptionEnabled" - : "true"`. + : "true"`.' readOnly: true oplogInc: type: integer @@ -17887,12 +16836,9 @@ components: "AUTOMATED_RESTORE"`. - - If you set **oplogInc**, you must set **oplogTs**, and can't set - **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. + - If you set **oplogInc**, you must set **oplogTs**, and can't set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. - - If you provide this parameter, this endpoint restores all data up - to and including this Oplog timestamp to the database you specified - in the **delivery** object. + - If you provide this parameter, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the **delivery** object. minimum: 1 writeOnly: true oplogTs: @@ -17908,14 +16854,10 @@ components: timestamp. - - If you set **oplogTs**, you must set **oplogInc**, and you can't - set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. + - If you set **oplogTs**, you must set **oplogInc**, and you can't set **checkpointId**, **snapshotId**, or **pointInTimeUTCMillis**. - - If you provide this parameter, this endpoint restores all data up - to and including this Oplog timestamp to the database you specified - in the **delivery** object. - pattern: >- - ^(?:[1-9]\\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d{1,9})?(?:Z|[+-][01]\\d:[0-5]\\d)$ + - If you provide this parameter, this endpoint restores all data up to and including this Oplog timestamp to the database you specified in the **delivery** object. + pattern: ^(?:[1-9]\\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d{1,9})?(?:Z|[+-][01]\\d:[0-5]\\d)$ writeOnly: true pointInTimeUTCMillis: type: integer @@ -17929,18 +16871,14 @@ components: "AUTOMATED_RESTORE"`. - - If you provide this parameter, this endpoint restores all data up - to this point in time to the database you specified in the - **delivery** object. + - If you provide this parameter, this endpoint restores all data up to this point in time to the database you specified in the **delivery** object. - - If you set **pointInTimeUTCMillis**, you can't set **oplogInc**, - **oplogTs**, **snapshotId**, or **checkpointId**. + - If you set **pointInTimeUTCMillis**, you can't set **oplogInc**, **oplogTs**, **snapshotId**, or **checkpointId**. minimum: 1199145600000 writeOnly: true snapshotId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the snapshot to + description: Unique 24-hexadecimal digit string that identifies the snapshot to restore. If you set **snapshotId**, you can't set **oplogInc**, **oplogTs**, **pointInTimeUTCMillis**, or **checkpointId**. example: 32b6e34b3d91647abb20e7b8 @@ -17949,73 +16887,64 @@ components: pattern: ^([a-f0-9]{24})$ statusName: type: string - description: >- - Human-readable label that identifies the status of the downloadable + description: Human-readable label that identifies the status of the downloadable file at the time of the request. readOnly: true timestamp: - $ref: '#/components/schemas/ApiBSONTimestamp' + $ref: "#/components/schemas/ApiBSONTimestamp" required: - delivery BackupRestoreJobDelivery: type: object - description: >- - Method and details that indicate how to deliver the restored snapshot - data. + description: Method and details that indicate how to deliver the restored + snapshot data. properties: authHeader: type: string - description: >- - Header name to use when downloading the restore, used with - `"delivery.methodName" : "HTTP"`. + description: 'Header name to use when downloading the restore, used with + `"delivery.methodName" : "HTTP"`.' readOnly: true authValue: type: string - description: >- - Header value to use when downloading the restore, used with - `"delivery.methodName" : "HTTP"`. + description: 'Header value to use when downloading the restore, used with + `"delivery.methodName" : "HTTP"`.' readOnly: true expirationHours: type: integer format: int32 - description: >- - Number of hours after the restore job completes that indicates when - the Uniform Resource Locator (URL) for the snapshot download file - expires. The resource returns this parameter when - `"delivery.methodName" : "HTTP"`. + description: 'Number of hours after the restore job completes that indicates + when the Uniform Resource Locator (URL) for the snapshot download + file expires. The resource returns this parameter when + `"delivery.methodName" : "HTTP"`.' minimum: 1 expires: type: string format: date-time - description: >- - Date and time when the Uniform Resource Locator (URL) for the + description: 'Date and time when the Uniform Resource Locator (URL) for the snapshot download file expires. This parameter expresses its value in the ISO 8601 timestamp format in UTC. The resource returns this - parameter when `"delivery.methodName" : "HTTP"`. + parameter when `"delivery.methodName" : "HTTP"`.' readOnly: true maxDownloads: type: integer format: int32 - description: >- - Positive integer that indicates how many times you can use the + description: 'Positive integer that indicates how many times you can use the Uniform Resource Locator (URL) for the snapshot download file. The resource returns this parameter when `"delivery.methodName" : - "HTTP"`. + "HTTP"`.' minimum: 1 methodName: type: string - description: >- - Human-readable label that identifies the means for delivering the + description: 'Human-readable label that identifies the means for delivering the data. If you set `"delivery.methodName" : "AUTOMATED_RESTORE"`, you must also set: **delivery.targetGroupId** and **delivery.targetClusterName** or **delivery.targetClusterId**. The response returns `"delivery.methodName" : "HTTP"` as an automated restore uses HyperText Transport Protocol (HTTP) to deliver the - restore job to the target host. + restore job to the target host.' statusName: type: string - description: >- - State of the downloadable snapshot file when MongoDB Cloud received + description: State of the downloadable snapshot file when MongoDB Cloud received this request. readOnly: true targetClusterId: @@ -18029,16 +16958,12 @@ components: If the target cluster doesn't have backup enabled, two resources return parameters with empty values: - - **Get All Snapshots** endpoint returns an empty results array - without **clusterId** elements + - **Get All Snapshots** endpoint returns an empty results array without **clusterId** elements - - **Get a Snapshot** endpoint doesn't return a **clusterId** - parameter. + - **Get a Snapshot** endpoint doesn't return a **clusterId** parameter. - To return a response with the **clusterId** parameter, either use - the **delivery.targetClusterName** parameter or enable backup on the - target cluster. + To return a response with the **clusterId** parameter, either use the **delivery.targetClusterName** parameter or enable backup on the target cluster. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -18052,30 +16977,24 @@ components: applies when `"delivery.methodName" : "AUTOMATED_RESTORE"`. - If the target cluster doesn't have backup enabled, two resources - return parameters with empty values: + If the target cluster doesn't have backup enabled, two resources return parameters with empty values: - - **Get All Snapshots** endpoint returns an empty results array - without **clusterId** elements + - **Get All Snapshots** endpoint returns an empty results array without **clusterId** elements - - **Get a Snapshot** endpoint doesn't return a **clusterId** - parameter. + - **Get a Snapshot** endpoint doesn't return a **clusterId** parameter. - To return a response with the **clusterId** parameter, either use - the **delivery.targetClusterName** parameter or enable backup on the - target cluster. + To return a response with the **clusterId** parameter, either use the **delivery.targetClusterName** parameter or enable backup on the target cluster. maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ targetGroupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that - contains the destination cluster for the restore job. The resource - returns this parameter when `"delivery.methodName" : - "AUTOMATED_RESTORE"`. + description: 'Unique 24-hexadecimal digit string that identifies the project + that contains the destination cluster for the restore job. The + resource returns this parameter when `"delivery.methodName" : + "AUTOMATED_RESTORE"`.' example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -18083,19 +17002,17 @@ components: url: type: string deprecated: true - description: >- - Uniform Resource Locator (URL) from which you can download the + description: 'Uniform Resource Locator (URL) from which you can download the restored snapshot data. Url includes the verification key. The resource returns this parameter when `"delivery.methodName" : - "HTTP"`. + "HTTP"`.' readOnly: true urlV2: type: string - description: >- - Uniform Resource Locator (URL) from which you can download the + description: 'Uniform Resource Locator (URL) from which you can download the restored snapshot data. This should be preferred over **url**. The verification key must be sent as an HTTP header. The resource - returns this parameter when `"delivery.methodName" : "HTTP"`. + returns this parameter when `"delivery.methodName" : "HTTP"`.' readOnly: true required: - methodName @@ -18105,8 +17022,7 @@ components: properties: clusterId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the cluster with + description: Unique 24-hexadecimal digit string that identifies the cluster with the snapshots you want to return. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -18115,29 +17031,25 @@ components: readOnly: true complete: type: boolean - description: >- - Flag that indicates whether the snapshot exists. This flag returns + description: Flag that indicates whether the snapshot exists. This flag returns `false` while MongoDB Cloud creates the snapshot. readOnly: true created: - $ref: '#/components/schemas/ApiBSONTimestamp' + $ref: "#/components/schemas/ApiBSONTimestamp" doNotDelete: type: boolean - description: >- - Flag that indicates whether someone can delete this snapshot. You - can't set `"doNotDelete" : true` and set a timestamp for **expires** - in the same request. + description: "Flag that indicates whether someone can delete this snapshot. You + can't set `\"doNotDelete\" : true` and set a timestamp for + **expires** in the same request." expires: type: string format: date-time - description: >- - Date and time when MongoDB Cloud deletes the snapshot. If + description: 'Date and time when MongoDB Cloud deletes the snapshot. If `"doNotDelete" : true`, MongoDB Cloud removes any value set for this - parameter. + parameter.' groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that owns the snapshots. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -18157,18 +17069,17 @@ components: description: Flag indicating if this is an incremental or a full snapshot. readOnly: true lastOplogAppliedTimestamp: - $ref: '#/components/schemas/ApiBSONTimestamp' + $ref: "#/components/schemas/ApiBSONTimestamp" links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true parts: type: array @@ -18178,10 +17089,9 @@ components: - For a replica set, this array contains a single document. - - For a sharded cluster, this array contains one document for each - shard plus one document for the config host. + - For a sharded cluster, this array contains one document for each shard plus one document for the config host. items: - $ref: '#/components/schemas/BackupSnapshotPart' + $ref: "#/components/schemas/BackupSnapshotPart" readOnly: true BackupSnapshotPart: type: object @@ -18189,8 +17099,7 @@ components: properties: clusterId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the cluster with + description: Unique 24-hexadecimal digit string that identifies the cluster with the snapshots you want to return. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -18199,15 +17108,13 @@ components: readOnly: true compressionSetting: type: string - description: >- - Human-readable label that identifies the method of compression for + description: Human-readable label that identifies the method of compression for the snapshot. readOnly: true dataSizeBytes: type: integer format: int64 - description: >- - Total size of the data stored on each node in the cluster. This + description: Total size of the data stored on each node in the cluster. This parameter expresses its value in bytes. readOnly: true encryptionEnabled: @@ -18222,15 +17129,13 @@ components: masterKeyUUID: type: string format: uuid - description: >- - Unique string that identifies the Key Management Interoperability + description: 'Unique string that identifies the Key Management Interoperability (KMIP) master key used to encrypt the snapshot data. The resource - returns this parameter when `"parts.encryptionEnabled" : true`. + returns this parameter when `"parts.encryptionEnabled" : true`.' readOnly: true mongodVersion: type: string - description: >- - Number that indicates the version of MongoDB that the replica set + description: Number that indicates the version of MongoDB that the replica set primary ran when MongoDB Cloud created the snapshot. pattern: ([\d]+\.[\d]+\.[\d]+) readOnly: true @@ -18241,14 +17146,12 @@ components: storageSizeBytes: type: integer format: int64 - description: >- - Number that indicates the total size of space allocated for document - storage. + description: Number that indicates the total size of space allocated for + document storage. readOnly: true typeName: type: string - description: >- - Human-readable label that identifies the type of server from which + description: Human-readable label that identifies the type of server from which MongoDB Cloud took this snapshot. readOnly: true readOnly: true @@ -18258,15 +17161,14 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true retentionUnit: type: string @@ -18274,8 +17176,7 @@ components: retentionValue: type: integer format: int32 - description: >- - Number that indicates the amount of days, weeks, or months that + description: Number that indicates the amount of days, weeks, or months that MongoDB Cloud retains the snapshot. For less frequent policy items, MongoDB Cloud requires that you specify a value greater than or equal to the value specified for more frequent policy items. If the @@ -18291,15 +17192,14 @@ components: expiration: type: string format: date-time - description: >- - Date and time when the download link no longer works. This parameter - expresses its value in the ISO 8601 timestamp format in UTC. + description: Date and time when the download link no longer works. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. readOnly: true finishTime: type: string format: date-time - description: >- - Date and time when MongoDB Cloud completed writing this snapshot. + description: Date and time when MongoDB Cloud completed writing this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -18313,15 +17213,14 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true mongoDBVersion: type: string @@ -18330,23 +17229,20 @@ components: scheduledTime: type: string format: date-time - description: >- - Date and time when MongoDB Cloud will take the snapshot. This + description: Date and time when MongoDB Cloud will take the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true startTime: type: string format: date-time - description: >- - Date and time when MongoDB Cloud began taking the snapshot. This + description: Date and time when MongoDB Cloud began taking the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true status: type: string - description: >- - Phase of the workflow for this snapshot at the time this resource + description: Phase of the workflow for this snapshot at the time this resource made this request. readOnly: true BaseAtlasDataLakeRegion: @@ -18354,19 +17250,17 @@ components: description: Name of the region to which the data lake routes client connections. BaseCloudProviderInstanceSize: type: string - description: >- - Minimum instance size to which your cluster can automatically scale. - MongoDB Cloud requires this parameter if + description: 'Minimum instance size to which your cluster can automatically + scale. MongoDB Cloud requires this parameter if `"replicationSpecs[n].regionConfigs[m].autoScaling.compute.scaleDownEnabled" - : true`. + : true`.' BaseNetworkPeeringConnectionSettings: type: object properties: containerId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - network container that contains the specified network peering + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud network container that contains the specified network peering connection. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -18374,8 +17268,7 @@ components: pattern: ^([a-f0-9]{24})$ id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the network + description: Unique 24-hexadecimal digit string that identifies the network peering connection. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -18384,20 +17277,17 @@ components: readOnly: true providerName: type: string - description: >- - Cloud service provider that serves the requested network peering + description: Cloud service provider that serves the requested network peering connection. accepterRegionName: type: string - description: >- - Amazon Web Services (AWS) region where the Virtual Peering + description: Amazon Web Services (AWS) region where the Virtual Peering Connection (VPC) that you peered with the MongoDB Cloud VPC resides. The resource returns `null` if your VPC and the MongoDB Cloud VPC reside in the same region. awsAccountId: type: string - description: >- - Unique twelve-digit string that identifies the Amazon Web Services + description: Unique twelve-digit string that identifies the Amazon Web Services (AWS) account that owns the VPC that you peered with the MongoDB Cloud VPC. maxLength: 12 @@ -18409,97 +17299,81 @@ components: readOnly: true errorStateName: type: string - description: >- - Type of error that can be returned when requesting an Amazon Web + description: Type of error that can be returned when requesting an Amazon Web Services (AWS) peering connection. The resource returns `null` if the request succeeded. readOnly: true routeTableCidrBlock: type: string - description: >- - Internet Protocol (IP) addresses expressed in Classless Inter-Domain - Routing (CIDR) notation of the VPC's subnet that you want to peer - with the MongoDB Cloud VPC. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + description: Internet Protocol (IP) addresses expressed in Classless + Inter-Domain Routing (CIDR) notation of the VPC's subnet that you + want to peer with the MongoDB Cloud VPC. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ statusName: type: string - description: >- - State of the network peering connection at the time you made the + description: State of the network peering connection at the time you made the request. readOnly: true vpcId: type: string - description: >- - Unique string that identifies the VPC on Amazon Web Services (AWS) + description: Unique string that identifies the VPC on Amazon Web Services (AWS) that you want to peer with the MongoDB Cloud VPC. minLength: 5 pattern: ^vpc-[0-9a-f]{17}$ azureDirectoryId: type: string - description: >- - Unique string that identifies the Azure AD directory in which the + description: Unique string that identifies the Azure AD directory in which the VNet peered with the MongoDB Cloud VNet resides. maxLength: 32 minLength: 32 - pattern: >- - ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ azureSubscriptionId: type: string - description: >- - Unique string that identifies the Azure subscription in which the + description: Unique string that identifies the Azure subscription in which the VNet you peered with the MongoDB Cloud VNet resides. maxLength: 32 minLength: 32 - pattern: >- - ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ errorState: type: string - description: >- - Error message returned when a requested Azure network peering + description: 'Error message returned when a requested Azure network peering resource returns `"status" : "FAILED"`. The resource returns `null` - if the request succeeded. + if the request succeeded.' readOnly: true resourceGroupName: type: string - description: >- - Human-readable label that identifies the resource group in which the - VNet to peer with the MongoDB Cloud VNet resides. + description: Human-readable label that identifies the resource group in which + the VNet to peer with the MongoDB Cloud VNet resides. pattern: ^([-\w._()])+$ status: type: string - description: >- - State of the network peering connection at the time you made the + description: State of the network peering connection at the time you made the request. readOnly: true vnetName: type: string - description: >- - Human-readable label that identifies the VNet that you want to peer + description: Human-readable label that identifies the VNet that you want to peer with the MongoDB Cloud VNet. pattern: ^([-\w._()])+$ errorMessage: type: string - description: >- - Details of the error returned when requesting a GCP network peering + description: Details of the error returned when requesting a GCP network peering resource. The resource returns `null` if the request succeeded. readOnly: true gcpProjectId: type: string - description: >- - Human-readable label that identifies the GCP project that contains + description: Human-readable label that identifies the GCP project that contains the network that you want to peer with the MongoDB Cloud VPC. maxLength: 30 minLength: 6 pattern: ^[a-z][0-9a-z-]{4,28}[0-9a-z]{1} networkName: type: string - description: >- - Human-readable label that identifies the network to peer with the + description: Human-readable label that identifies the network to peer with the MongoDB Cloud VPC. maxLength: 63 minLength: 1 - pattern: '[a-z]([-a-z0-9]{0,62}[a-z0-9]{0,1})?' + pattern: "[a-z]([-a-z0-9]{0,62}[a-z0-9]{0,1})?" required: - containerId BaseStreamsRegion: @@ -18507,8 +17381,7 @@ components: description: Name of the cloud provider region hosting Atlas Stream Processing. BiConnector: type: object - description: >- - Settings needed to configure the MongoDB Connector for Business + description: Settings needed to configure the MongoDB Connector for Business Intelligence for this cluster. externalDocs: description: MongoDB Connector for Business Intelligence @@ -18516,13 +17389,11 @@ components: properties: enabled: type: boolean - description: >- - Flag that indicates whether MongoDB Connector for Business + description: Flag that indicates whether MongoDB Connector for Business Intelligence is enabled on the specified cluster. readPreference: type: string - description: >- - Data source node designated for the MongoDB Connector for Business + description: Data source node designated for the MongoDB Connector for Business Intelligence on MongoDB Cloud. The MongoDB Connector for Business Intelligence on MongoDB Cloud reads data from the primary, secondary, or analytics node based on your read preferences. @@ -18530,8 +17401,7 @@ components: `ANALYTICS` nodes. externalDocs: description: Read preferences for BI Connector - url: >- - https://docs.atlas.mongodb.com/cluster-config/enable-bic/#std-label-bic-read-preferences + url: https://docs.atlas.mongodb.com/cluster-config/enable-bic/#std-label-bic-read-preferences title: MongoDB Connector for Business Intelligence Settings BillingInvoice: type: object @@ -18539,8 +17409,7 @@ components: amountBilledCents: type: integer format: int64 - description: >- - Sum of services that the specified organization consumed in the + description: Sum of services that the specified organization consumed in the period covered in this invoice. This parameter expresses its value in cents (100ths of one US Dollar) and calculates its value as **subtotalCents** + **salesTaxCents** - **startingBalanceCents**. @@ -18548,38 +17417,33 @@ components: amountPaidCents: type: integer format: int64 - description: >- - Sum that the specified organization paid toward this invoice. This + description: Sum that the specified organization paid toward this invoice. This parameter expresses its value in cents (100ths of one US Dollar). readOnly: true created: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this invoice. This + description: Date and time when MongoDB Cloud created this invoice. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true creditsCents: type: integer format: int64 - description: >- - Sum that MongoDB credited the specified organization toward this + description: Sum that MongoDB credited the specified organization toward this invoice. This parameter expresses its value in cents (100ths of one US Dollar). readOnly: true endDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud finished the billing period that + description: Date and time when MongoDB Cloud finished the billing period that this invoice covers. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project + description: Unique 24-hexadecimal digit string that identifies the project associated to this invoice. This identifying string doesn't appear on all invoices. example: 32b6e34b3d91647abb20e7b8 @@ -18589,8 +17453,7 @@ components: readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the invoice + description: Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day. example: 32b6e34b3d91647abb20e7b8 @@ -18602,32 +17465,29 @@ components: type: array description: List that contains individual services included in this invoice. items: - $ref: '#/components/schemas/InvoiceLineItem' + $ref: "#/components/schemas/InvoiceLineItem" readOnly: true linkedInvoices: type: array - description: >- - List that contains the invoices for organizations linked to the + description: List that contains the invoices for organizations linked to the paying organization. items: - $ref: '#/components/schemas/BillingInvoice' + $ref: "#/components/schemas/BillingInvoice" readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true orgId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization charged for services consumed from MongoDB Cloud. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -18636,40 +17496,35 @@ components: readOnly: true payments: type: array - description: >- - List that contains funds transferred to MongoDB to cover the + description: List that contains funds transferred to MongoDB to cover the specified service noted in this invoice. items: - $ref: '#/components/schemas/BillingPayment' + $ref: "#/components/schemas/BillingPayment" readOnly: true refunds: type: array - description: >- - List that contains payments that MongoDB returned to the + description: List that contains payments that MongoDB returned to the organization for this invoice. items: - $ref: '#/components/schemas/BillingRefund' + $ref: "#/components/schemas/BillingRefund" readOnly: true salesTaxCents: type: integer format: int64 - description: >- - Sum of sales tax applied to this invoice. This parameter expresses + description: Sum of sales tax applied to this invoice. This parameter expresses its value in cents (100ths of one US Dollar). readOnly: true startDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud began the billing period that this + description: Date and time when MongoDB Cloud began the billing period that this invoice covers. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true startingBalanceCents: type: integer format: int64 - description: >- - Sum that the specified organization owed to MongoDB when MongoDB + description: Sum that the specified organization owed to MongoDB when MongoDB issued this invoice. This parameter expresses its value in US Dollars. readOnly: true @@ -18684,54 +17539,44 @@ components: |---|---| - | CLOSED | MongoDB finalized all charges in the billing cycle but - has yet to charge the customer. | + | CLOSED | MongoDB finalized all charges in the billing cycle but has yet to charge the customer. | - | FAILED | MongoDB attempted to charge the provided credit card but - charge for that amount failed. | + | FAILED | MongoDB attempted to charge the provided credit card but charge for that amount failed. | - | FORGIVEN | Customer initiated payment which MongoDB later forgave. - | + | FORGIVEN | Customer initiated payment which MongoDB later forgave. | - | FREE | All charges totalled zero so the customer won't be charged. - | + | FREE | All charges totalled zero so the customer won't be charged. | - | INVOICED | MongoDB handled these charges using elastic invoicing. - | + | INVOICED | MongoDB handled these charges using elastic invoicing. | | PAID | MongoDB succeeded in charging the provided credit card. | - | PENDING | Invoice includes charges for the current billing cycle. - | + | PENDING | Invoice includes charges for the current billing cycle. | | PREPAID | Customer has a pre-paid plan so they won't be charged. | subtotalCents: type: integer format: int64 - description: >- - Sum of all positive invoice line items contained in this invoice. + description: Sum of all positive invoice line items contained in this invoice. This parameter expresses its value in cents (100ths of one US Dollar). readOnly: true updated: type: string format: date-time - description: >- - Date and time when MongoDB Cloud last updated the value of this + description: Date and time when MongoDB Cloud last updated the value of this payment. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true BillingPayment: type: object - description: >- - Funds transferred to MongoDB to cover the specified service in this + description: Funds transferred to MongoDB to cover the specified service in this invoice. properties: amountBilledCents: type: integer format: int64 - description: >- - Sum of services that the specified organization consumed in the + description: Sum of services that the specified organization consumed in the period covered in this invoice. This parameter expresses its value in cents (100ths of one US Dollar) and calculates its value as **subtotalCents** + **salesTaxCents** - **startingBalanceCents**. @@ -18739,23 +17584,20 @@ components: amountPaidCents: type: integer format: int64 - description: >- - Sum that the specified organization paid toward the associated + description: Sum that the specified organization paid toward the associated invoice. This parameter expresses its value in cents (100ths of one US Dollar). readOnly: true created: type: string format: date-time - description: >- - Date and time when the customer made this payment attempt. This + description: Date and time when the customer made this payment attempt. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this payment + description: Unique 24-hexadecimal digit string that identifies this payment toward the associated invoice. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -18765,8 +17607,7 @@ components: salesTaxCents: type: integer format: int64 - description: >- - Sum of sales tax applied to this invoice. This parameter expresses + description: Sum of sales tax applied to this invoice. This parameter expresses its value in cents (100ths of one US Dollar). readOnly: true statusName: @@ -18787,20 +17628,15 @@ components: | `ERROR` | Issue arose when attempting to complete payment. | - | `FAILED` | MongoDB tried to charge the credit card without - success. | + | `FAILED` | MongoDB tried to charge the credit card without success. | - | `FAILED_AUTHENTICATION` | Strong Customer Authentication has - failed. Confirm that your payment method is authenticated. | + | `FAILED_AUTHENTICATION` | Strong Customer Authentication has failed. Confirm that your payment method is authenticated. | - | `FORGIVEN` | Customer initiated payment which MongoDB later - forgave. | + | `FORGIVEN` | Customer initiated payment which MongoDB later forgave. | - | `INVOICED` | MongoDB issued an invoice that included this line - item. | + | `INVOICED` | MongoDB issued an invoice that included this line item. | - | `NEW` | Customer provided a method of payment, but MongoDB hasn't - tried to charge the credit card. | + | `NEW` | Customer provided a method of payment, but MongoDB hasn't tried to charge the credit card. | | `PAID` | Customer submitted a successful payment. | @@ -18808,16 +17644,14 @@ components: subtotalCents: type: integer format: int64 - description: >- - Sum of all positive invoice line items contained in this invoice. + description: Sum of all positive invoice line items contained in this invoice. This parameter expresses its value in cents (100ths of one US Dollar). readOnly: true updated: type: string format: date-time - description: >- - Date and time when the customer made an update to this payment + description: Date and time when the customer made an update to this payment attempt. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -18829,21 +17663,19 @@ components: amountCents: type: integer format: int64 - description: >- - Sum of the funds returned to the specified organization expressed in - cents (100th of US Dollar). + description: Sum of the funds returned to the specified organization expressed + in cents (100th of US Dollar). readOnly: true created: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this refund. This parameter - expresses its value in the ISO 8601 timestamp format in UTC. + description: Date and time when MongoDB Cloud created this refund. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. readOnly: true paymentId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the payment that + description: Unique 24-hexadecimal digit string that identifies the payment that the organization had made. maxLength: 24 minLength: 24 @@ -18851,22 +17683,19 @@ components: readOnly: true reason: type: string - description: >- - Justification that MongoDB accepted to return funds to the + description: Justification that MongoDB accepted to return funds to the organization. readOnly: true title: Refund CloudAccessRoleAssignment: type: object - description: >- - MongoDB Cloud user's roles and the corresponding organization or project - to which that role applies. Each role can apply to one organization or - one project but not both. + description: MongoDB Cloud user's roles and the corresponding organization or + project to which that role applies. Each role can apply to one + organization or one project but not both. properties: groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project to + description: Unique 24-hexadecimal digit string that identifies the project to which this role belongs. You can set a value for this parameter or **orgId** but not both in the same request. example: 32b6e34b3d91647abb20e7b8 @@ -18875,8 +17704,7 @@ components: pattern: ^([a-f0-9]{24})$ orgId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization to which this role belongs. You can set a value for this parameter or **groupId** but not both in the same request. example: 32b6e34b3d91647abb20e7b8 @@ -18929,16 +17757,14 @@ components: properties: country: type: string - description: >- - Two alphabet characters that identifies MongoDB Cloud user's + description: Two alphabet characters that identifies MongoDB Cloud user's geographic location. This parameter uses the ISO 3166-1a2 code format. pattern: ^([A-Z]{2})$ createdAt: type: string format: date-time - description: >- - Date and time when the current account is created. This value is in + description: Date and time when the current account is created. This value is in the ISO 8601 timestamp format in UTC. readOnly: true emailAddress: @@ -18950,9 +17776,8 @@ components: description: First or given name that belongs to the MongoDB Cloud user. id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - user. + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -18961,36 +17786,31 @@ components: lastAuth: type: string format: date-time - description: >- - Date and time when the current account last authenticated. This + description: Date and time when the current account last authenticated. This value is in the ISO 8601 timestamp format in UTC. readOnly: true lastName: type: string - description: >- - Last name, family name, or surname that belongs to the MongoDB Cloud - user. + description: Last name, family name, or surname that belongs to the MongoDB + Cloud user. links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true mobileNumber: type: string description: Mobile phone number that belongs to the MongoDB Cloud user. - pattern: >- - (?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})$ + pattern: (?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})$ password: type: string - description: >- - Password applied with the username to log in to MongoDB Cloud. + description: Password applied with the username to log in to MongoDB Cloud. MongoDB Cloud does not return this parameter except in response to creating a new MongoDB Cloud user. Only the MongoDB Cloud user can update their password after it has been set from the MongoDB Cloud @@ -18998,21 +17818,18 @@ components: minLength: 8 roles: type: array - description: >- - List of objects that display the MongoDB Cloud user's roles and the + description: List of objects that display the MongoDB Cloud user's roles and the corresponding organization or project to which that role applies. A role can apply to one organization or one project but not both. items: - $ref: '#/components/schemas/CloudAccessRoleAssignment' + $ref: "#/components/schemas/CloudAccessRoleAssignment" teamIds: type: array - description: >- - List of unique 24-hexadecimal digit strings that identifies the + description: List of unique 24-hexadecimal digit strings that identifies the teams to which this MongoDB Cloud user belongs. items: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the team to + description: Unique 24-hexadecimal digit string that identifies the team to which this MongoDB Cloud user belongs. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -19023,9 +17840,7 @@ components: username: type: string format: email - description: >- - Email address that represents the username of the MongoDB Cloud - user. + description: Email address that represents the username of the MongoDB Cloud user. required: - country - emailAddress @@ -19036,27 +17851,23 @@ components: - username CloudCluster: type: object - description: >- - Settings that describe the clusters in each project that the API key is - authorized to view. + description: Settings that describe the clusters in each project that the API + key is authorized to view. properties: alertCount: type: integer format: int32 - description: >- - Whole number that indicates the quantity of alerts open on the + description: Whole number that indicates the quantity of alerts open on the cluster. readOnly: true authEnabled: type: boolean - description: >- - Flag that indicates whether authentication is required to access the - nodes in this cluster. + description: Flag that indicates whether authentication is required to access + the nodes in this cluster. readOnly: true availability: type: string - description: >- - Term that expresses how many nodes of the cluster can be accessed + description: Term that expresses how many nodes of the cluster can be accessed when MongoDB Cloud receives this request. This parameter returns `available` when all nodes are accessible, `warning` only when some nodes in the cluster can be accessed, `unavailable` when the cluster @@ -19064,8 +17875,7 @@ components: readOnly: true backupEnabled: type: boolean - description: >- - Flag that indicates whether the cluster can perform backups. If set + description: Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated clusters and Shared Cluster Backups for tenant clusters. If set to @@ -19081,8 +17891,7 @@ components: dataSizeBytes: type: integer format: int64 - description: >- - Total size of the data stored on each node in the cluster. The + description: Total size of the data stored on each node in the cluster. The resource expresses this value in bytes. readOnly: true name: @@ -19095,15 +17904,13 @@ components: nodeCount: type: integer format: int32 - description: >- - Whole number that indicates the quantity of nodes that comprise the + description: Whole number that indicates the quantity of nodes that comprise the cluster. readOnly: true sslEnabled: type: boolean - description: >- - Flag that indicates whether TLS authentication is required to access - the nodes in this cluster. + description: Flag that indicates whether TLS authentication is required to + access the nodes in this cluster. readOnly: true type: type: string @@ -19111,8 +17918,7 @@ components: readOnly: true versions: type: array - description: >- - List that contains the versions of MongoDB that each node in the + description: List that contains the versions of MongoDB that each node in the cluster runs. items: type: string @@ -19125,23 +17931,20 @@ components: awsIAMType: type: string default: NONE - description: >- - Human-readable label that indicates whether the new database user + description: Human-readable label that indicates whether the new database user authenticates with the Amazon Web Services (AWS) Identity and Access Management (IAM) credentials associated with the user or the user's role. databaseName: type: string default: admin - description: >- - Database against which the database user authenticates. Database + description: Database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. deleteAfterDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud deletes the user. This parameter + description: Date and time when MongoDB Cloud deletes the user. This parameter expresses its value in the ISO 8601 timestamp format in UTC and can include the time zone designation. You must specify a future date that falls within one week of making the Application Programming @@ -19156,43 +17959,38 @@ components: writeOnly: true labels: type: array - description: >- - List that contains the key-value pairs for tagging and categorizing + description: List that contains the key-value pairs for tagging and categorizing the MongoDB database user. The labels that you define do not appear in the console. items: - $ref: '#/components/schemas/ComponentLabel' + $ref: "#/components/schemas/ComponentLabel" ldapAuthType: type: string default: NONE - description: >- - Part of the Lightweight Directory Access Protocol (LDAP) record that - the database uses to authenticate this database user on the LDAP - host. + description: Part of the Lightweight Directory Access Protocol (LDAP) record + that the database uses to authenticate this database user on the + LDAP host. links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true oidcAuthType: type: string default: NONE - description: >- - Human-readable label that indicates whether the new database user + description: Human-readable label that indicates whether the new database user authenticates with OIDC federated authentication. To create a federated authentication user, specify the value of IDP_GROUP for this field. password: type: string - description: >- - Alphanumeric string that authenticates this database user against + description: Alphanumeric string that authenticates this database user against the database specified in `databaseName`. To authenticate with SCRAM-SHA, you must specify this parameter. This parameter doesn't appear in this response. @@ -19203,20 +18001,18 @@ components: writeOnly: true roles: type: array - description: >- - List that provides the pairings of one role with one applicable + description: List that provides the pairings of one role with one applicable database. items: - $ref: '#/components/schemas/DatabaseUserRole' + $ref: "#/components/schemas/DatabaseUserRole" scopes: type: array - description: >- - List that contains clusters and MongoDB Atlas Data Lakes that this + description: List that contains clusters and MongoDB Atlas Data Lakes that this database user can access. If omitted, MongoDB Cloud grants the database user access to all the clusters and MongoDB Atlas Data Lakes in the project. items: - $ref: '#/components/schemas/UserScope' + $ref: "#/components/schemas/UserScope" username: type: string description: > @@ -19225,35 +18021,25 @@ components: authentication: - | Authentication Method | Parameter Needed | Parameter Value | - username Format | + | Authentication Method | Parameter Needed | Parameter Value | username Format | |---|---|---|---| - | AWS IAM | awsType | ROLE | ARN | + | AWS IAM | awsType | ROLE | ARN | - | AWS IAM | awsType | USER | ARN | + | AWS IAM | awsType | USER | ARN | - | x.509 | x509Type | CUSTOMER | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | x.509 | x509Type | MANAGED | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | LDAP | ldapAuthType | USER | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | LDAP | ldapAuthType | GROUP | [RFC - 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | - | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in - federation settings), followed by a '/', followed by the IdP group - name | + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | - | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | - Alphanumeric string | + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | maxLength: 1024 x509Type: type: string @@ -19268,9 +18054,7 @@ components: - For self-managed X.509, specify `CUSTOMER`. - Users created with the `CUSTOMER` method require a Common Name (CN) - in the **username** parameter. You must create externally - authenticated users on the `$external` database. + Users created with the `CUSTOMER` method require a Common Name (CN) in the **username** parameter. You must create externally authenticated users on the `$external` database. required: - databaseName - groupId @@ -19278,14 +18062,13 @@ components: CloudProviderAccessAWSIAMRole: type: object allOf: - - $ref: '#/components/schemas/CloudProviderAccessRole' + - $ref: "#/components/schemas/CloudProviderAccessRole" - type: object properties: atlasAWSAccountArn: type: string - description: >- - Amazon Resource Name that identifies the Amazon Web Services - (AWS) user account that MongoDB Cloud uses when it assumes the + description: Amazon Resource Name that identifies the Amazon Web Services (AWS) + user account that MongoDB Cloud uses when it assumes the Identity and Access Management (IAM) role. example: arn:aws:iam::772401394250:role/my-test-aws-role maxLength: 2048 @@ -19294,42 +18077,35 @@ components: atlasAssumedRoleExternalId: type: string format: uuid - description: >- - Unique external ID that MongoDB Cloud uses when it assumes the - IAM role in your Amazon Web Services (AWS) account. + description: Unique external ID that MongoDB Cloud uses when it assumes the IAM + role in your Amazon Web Services (AWS) account. readOnly: true authorizedDate: type: string format: date-time - description: >- - Date and time when someone authorized this role for the - specified cloud service provider. This parameter expresses its - value in the ISO 8601 timestamp format in UTC. + description: Date and time when someone authorized this role for the specified + cloud service provider. This parameter expresses its value in + the ISO 8601 timestamp format in UTC. readOnly: true createdDate: type: string format: date-time - description: >- - Date and time when someone created this role for the specified + description: Date and time when someone created this role for the specified cloud service provider. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true featureUsages: type: array - description: >- - List that contains application features associated with this - Amazon Web Services (AWS) Identity and Access Management (IAM) - role. + description: List that contains application features associated with this Amazon + Web Services (AWS) Identity and Access Management (IAM) role. items: - $ref: '#/components/schemas/CloudProviderAccessFeatureUsage' + $ref: "#/components/schemas/CloudProviderAccessFeatureUsage" readOnly: true iamAssumedRoleArn: type: string - description: >- - Amazon Resource Name (ARN) that identifies the Amazon Web - Services (AWS) Identity and Access Management (IAM) role that - MongoDB Cloud assumes when it accesses resources in your AWS - account. + description: Amazon Resource Name (ARN) that identifies the Amazon Web Services + (AWS) Identity and Access Management (IAM) role that MongoDB + Cloud assumes when it accesses resources in your AWS account. example: arn:aws:iam::123456789012:root maxLength: 2048 minLength: 20 @@ -19341,16 +18117,14 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ readOnly: true - description: >- - Details that describe the features linked to the Amazon Web Services - (AWS) Identity and Access Management (IAM) role. + description: Details that describe the features linked to the Amazon Web + Services (AWS) Identity and Access Management (IAM) role. required: - providerName properties: atlasAWSAccountArn: type: string - description: >- - Amazon Resource Name that identifies the Amazon Web Services (AWS) + description: Amazon Resource Name that identifies the Amazon Web Services (AWS) user account that MongoDB Cloud uses when it assumes the Identity and Access Management (IAM) role. example: arn:aws:iam::772401394250:role/my-test-aws-role @@ -19360,38 +18134,33 @@ components: atlasAssumedRoleExternalId: type: string format: uuid - description: >- - Unique external ID that MongoDB Cloud uses when it assumes the IAM + description: Unique external ID that MongoDB Cloud uses when it assumes the IAM role in your Amazon Web Services (AWS) account. readOnly: true authorizedDate: type: string format: date-time - description: >- - Date and time when someone authorized this role for the specified + description: Date and time when someone authorized this role for the specified cloud service provider. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true createdDate: type: string format: date-time - description: >- - Date and time when someone created this role for the specified cloud - service provider. This parameter expresses its value in the ISO 8601 - timestamp format in UTC. + description: Date and time when someone created this role for the specified + cloud service provider. This parameter expresses its value in the + ISO 8601 timestamp format in UTC. readOnly: true featureUsages: type: array - description: >- - List that contains application features associated with this Amazon + description: List that contains application features associated with this Amazon Web Services (AWS) Identity and Access Management (IAM) role. items: - $ref: '#/components/schemas/CloudProviderAccessFeatureUsage' + $ref: "#/components/schemas/CloudProviderAccessFeatureUsage" readOnly: true iamAssumedRoleArn: type: string - description: >- - Amazon Resource Name (ARN) that identifies the Amazon Web Services + description: Amazon Resource Name (ARN) that identifies the Amazon Web Services (AWS) Identity and Access Management (IAM) role that MongoDB Cloud assumes when it accesses resources in your AWS account. example: arn:aws:iam::123456789012:root @@ -19407,26 +18176,23 @@ components: readOnly: true CloudProviderAccessFeatureUsage: type: object - description: >- - MongoDB Cloud features associated with this Amazon Web Services (AWS) - Identity and Access Management (IAM) role. + description: MongoDB Cloud features associated with this Amazon Web Services + (AWS) Identity and Access Management (IAM) role. properties: featureType: type: string - description: >- - Human-readable label that describes one MongoDB Cloud feature linked - to this Amazon Web Services (AWS) Identity and Access Management - (IAM) role. + description: Human-readable label that describes one MongoDB Cloud feature + linked to this Amazon Web Services (AWS) Identity and Access + Management (IAM) role. readOnly: true featureId: - $ref: >- - #/components/schemas/CloudProviderAccessFeatureUsagePushBasedLogExportFeatureId + $ref: "#/components/schemas/CloudProviderAccessFeatureUsagePushBasedLogExportFe\ + atureId" CloudProviderAccessFeatureUsagePushBasedLogExportFeatureId: type: object - description: >- - Identifying characteristics about the Amazon Web Services (AWS) Simple - Storage Service (S3) export bucket linked to this AWS Identity and - Access Management (IAM) role. + description: Identifying characteristics about the Amazon Web Services (AWS) + Simple Storage Service (S3) export bucket linked to this AWS Identity + and Access Management (IAM) role. properties: bucketName: type: string @@ -19449,8 +18215,7 @@ components: description: Human-readable label that identifies the cloud provider of the role. atlasAWSAccountArn: type: string - description: >- - Amazon Resource Name that identifies the Amazon Web Services (AWS) + description: Amazon Resource Name that identifies the Amazon Web Services (AWS) user account that MongoDB Cloud uses when it assumes the Identity and Access Management (IAM) role. example: arn:aws:iam::772401394250:role/my-test-aws-role @@ -19460,15 +18225,13 @@ components: atlasAssumedRoleExternalId: type: string format: uuid - description: >- - Unique external ID that MongoDB Cloud uses when it assumes the IAM + description: Unique external ID that MongoDB Cloud uses when it assumes the IAM role in your Amazon Web Services (AWS) account. readOnly: true authorizedDate: type: string format: date-time - description: >- - Date and time when someone authorized this role for the specified + description: Date and time when someone authorized this role for the specified cloud service provider. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -19483,9 +18246,7 @@ components: Alternatively: - Date and time when this Azure Service Principal was created. This - parameter expresses its value in the ISO 8601 timestamp format in - UTC. + Date and time when this Azure Service Principal was created. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true featureUsages: type: array @@ -19496,15 +18257,13 @@ components: Alternatively: - List that contains application features associated with this Azure - Service Principal. + List that contains application features associated with this Azure Service Principal. items: - $ref: '#/components/schemas/CloudProviderAccessFeatureUsage' + $ref: "#/components/schemas/CloudProviderAccessFeatureUsage" readOnly: true iamAssumedRoleArn: type: string - description: >- - Amazon Resource Name (ARN) that identifies the Amazon Web Services + description: Amazon Resource Name (ARN) that identifies the Amazon Web Services (AWS) Identity and Access Management (IAM) role that MongoDB Cloud assumes when it accesses resources in your AWS account. example: arn:aws:iam::123456789012:root @@ -19520,9 +18279,8 @@ components: readOnly: true _id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the Azure Service - Principal in Atlas. + description: Unique 24-hexadecimal digit string that identifies the Azure + Service Principal in Atlas. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -19533,13 +18291,11 @@ components: description: Azure Active Directory Application ID of Atlas. maxLength: 36 minLength: 32 - pattern: >- - ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ lastUpdatedDate: type: string format: date-time - description: >- - Date and time when this Azure Service Principal was last updated. + description: Date and time when this Azure Service Principal was last updated. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -19548,15 +18304,13 @@ components: description: UUID string that identifies the Azure Service Principal. maxLength: 36 minLength: 32 - pattern: >- - ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ tenantId: type: string description: UUID String that identifies the Azure Active Directory Tenant ID. maxLength: 36 minLength: 32 - pattern: >- - ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ + pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$ required: - providerName CloudProviderAccessRoles: @@ -19564,21 +18318,18 @@ components: properties: awsIamRoles: type: array - description: >- - List that contains the Amazon Web Services (AWS) IAM roles + description: List that contains the Amazon Web Services (AWS) IAM roles registered and authorized with MongoDB Cloud. items: - $ref: '#/components/schemas/CloudProviderAccessAWSIAMRole' + $ref: "#/components/schemas/CloudProviderAccessAWSIAMRole" CloudProviderContainer: type: object - description: >- - Collection of settings that configures the network container for a + description: Collection of settings that configures the network container for a virtual private connection on Amazon Web Services. properties: id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the network + description: Unique 24-hexadecimal digit string that identifies the network peering container. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -19587,13 +18338,11 @@ components: readOnly: true providerName: type: string - description: >- - Cloud service provider that serves the requested network peering + description: Cloud service provider that serves the requested network peering containers. provisioned: type: boolean - description: >- - Flag that indicates whether MongoDB Cloud clusters exist in the + description: Flag that indicates whether MongoDB Cloud clusters exist in the specified network peering container. readOnly: true atlasCidrBlock: @@ -19607,9 +18356,7 @@ components: network peering connection exists in this project. - These CIDR blocks must fall within the ranges reserved per RFC 1918. - AWS and Azure further limit the block to between the `/24` and - `/21` ranges. + These CIDR blocks must fall within the ranges reserved per RFC 1918. AWS and Azure further limit the block to between the `/24` and `/21` ranges. To modify the CIDR block, the target project cannot have: @@ -19625,16 +18372,10 @@ components: Alternatively: - IP addresses expressed in Classless Inter-Domain Routing (CIDR) - notation that MongoDB Cloud uses for the network peering containers - in your project. MongoDB Cloud assigns all of the project's clusters - deployed to this cloud provider an IP address from this range. - MongoDB Cloud locks this value if an M10 or greater cluster or a - network peering connection exists in this project. + IP addresses expressed in Classless Inter-Domain Routing (CIDR) notation that MongoDB Cloud uses for the network peering containers in your project. MongoDB Cloud assigns all of the project's clusters deployed to this cloud provider an IP address from this range. MongoDB Cloud locks this value if an M10 or greater cluster or a network peering connection exists in this project. - These CIDR blocks must fall within the ranges reserved per RFC 1918. - GCP further limits the block to a lower bound of the `/18` range. + These CIDR blocks must fall within the ranges reserved per RFC 1918. GCP further limits the block to a lower bound of the `/18` range. To modify the CIDR block, the target project cannot have: @@ -19650,17 +18391,10 @@ components: Alternatively: - IP addresses expressed in Classless Inter-Domain Routing (CIDR) - notation that MongoDB Cloud uses for the network peering containers - in your project. MongoDB Cloud assigns all of the project's clusters - deployed to this cloud provider an IP address from this range. - MongoDB Cloud locks this value if an M10 or greater cluster or a - network peering connection exists in this project. + IP addresses expressed in Classless Inter-Domain Routing (CIDR) notation that MongoDB Cloud uses for the network peering containers in your project. MongoDB Cloud assigns all of the project's clusters deployed to this cloud provider an IP address from this range. MongoDB Cloud locks this value if an M10 or greater cluster or a network peering connection exists in this project. - These CIDR blocks must fall within the ranges reserved per RFC 1918. - AWS and Azure further limit the block to between the `/24` and - `/21` ranges. + These CIDR blocks must fall within the ranges reserved per RFC 1918. AWS and Azure further limit the block to between the `/24` and `/21` ranges. To modify the CIDR block, the target project cannot have: @@ -19673,25 +18407,21 @@ components: You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. **Example:** A project in an Amazon Web Services (AWS) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. - pattern: >- - ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ azureSubscriptionId: type: string - description: >- - Unique string that identifies the Azure subscription in which the + description: Unique string that identifies the Azure subscription in which the MongoDB Cloud VNet resides. example: 32b6e34b3d91647abb20e7b8 pattern: ^([a-f0-9]{24})$ readOnly: true region: type: string - description: >- - Azure region to which MongoDB Cloud deployed this network peering + description: Azure region to which MongoDB Cloud deployed this network peering container. vnetName: type: string - description: >- - Unique string that identifies the Azure VNet in which MongoDB Cloud + description: Unique string that identifies the Azure VNet in which MongoDB Cloud clusters in this network peering container exist. The response returns **null** if no clusters exist in this network peering container. @@ -19701,9 +18431,8 @@ components: readOnly: true gcpProjectId: type: string - description: >- - Unique string that identifies the GCP project in which MongoDB Cloud - clusters in this network peering container exist. The response + description: Unique string that identifies the GCP project in which MongoDB + Cloud clusters in this network peering container exist. The response returns **null** if no clusters exist in this network peering container. maxLength: 26 @@ -19712,8 +18441,7 @@ components: readOnly: true networkName: type: string - description: >- - Human-readable label that identifies the network in which MongoDB + description: Human-readable label that identifies the network in which MongoDB Cloud clusters in this network peering container exist. MongoDB Cloud returns **null** if no clusters exist in this network peering container. @@ -19723,24 +18451,21 @@ components: readOnly: true regions: type: array - description: >- - List of GCP regions to which you want to deploy this MongoDB Cloud + description: List of GCP regions to which you want to deploy this MongoDB Cloud network peering container. In this MongoDB Cloud project, you can deploy clusters only to the GCP regions in this list. To deploy MongoDB Cloud clusters to other GCP regions, create additional projects. items: type: string - description: >- - List of GCP regions to which you want to deploy this MongoDB Cloud + description: List of GCP regions to which you want to deploy this MongoDB Cloud network peering container. In this MongoDB Cloud project, you can deploy clusters only to the GCP regions in this list. To deploy MongoDB Cloud clusters to other GCP regions, create additional projects. regionName: type: string - description: >- - Geographic area that Amazon Web Services (AWS) defines to which + description: Geographic area that Amazon Web Services (AWS) defines to which MongoDB Cloud deployed this network peering container. vpcId: type: string @@ -19754,14 +18479,12 @@ components: properties: providerName: type: string - description: >- - Human-readable label that identifies the cloud service provider for + description: Human-readable label that identifies the cloud service provider for which you want to create the private endpoint service. writeOnly: true region: type: string - description: >- - Cloud provider region in which you want to create the private + description: Cloud provider region in which you want to create the private endpoint service. Regions accepted as values differ for [Amazon Web Services](https://docs.atlas.mongodb.com/reference/amazon-aws/), [Google Cloud @@ -19779,7 +18502,7 @@ components: type: array description: List of instances sizes that this cloud provider supports. items: - $ref: '#/components/schemas/ClusterCloudProviderInstanceSize' + $ref: "#/components/schemas/ClusterCloudProviderInstanceSize" readOnly: true provider: type: string @@ -19789,7 +18512,7 @@ components: description: Cloud service provider on which MongoDB Cloud provisions the hosts. properties: electableSpecs: - $ref: '#/components/schemas/HardwareSpec' + $ref: "#/components/schemas/HardwareSpec" priority: type: integer format: int32 @@ -19802,21 +18525,16 @@ components: highest priority is `7`. - **Example:** If you have three regions, their priorities would be - `7`, `6`, and `5` respectively. If you added two more regions for - supporting electable nodes, the priorities of those regions would be - `4` and `3` respectively. + **Example:** If you have three regions, their priorities would be `7`, `6`, and `5` respectively. If you added two more regions for supporting electable nodes, the priorities of those regions would be `4` and `3` respectively. maximum: 7 minimum: 0 providerName: type: string - description: >- - Cloud service provider on which MongoDB Cloud provisions the hosts. + description: Cloud service provider on which MongoDB Cloud provisions the hosts. Set dedicated clusters to `AWS`, `GCP`, `AZURE` or `TENANT`. regionName: type: string - description: >- - Physical location of your MongoDB cluster nodes. The region you + description: Physical location of your MongoDB cluster nodes. The region you choose can affect network latency for clients accessing your databases. When MongoDB Cloud deploys a dedicated cluster, it checks if a VPC or VPC connection exists for that provider and region. If @@ -19830,17 +18548,16 @@ components: resides in the same region as the nodes to communicate with the peered VPC. analyticsAutoScaling: - $ref: '#/components/schemas/AdvancedAutoScalingSettings' + $ref: "#/components/schemas/AdvancedAutoScalingSettings" analyticsSpecs: - $ref: '#/components/schemas/DedicatedHardwareSpec' + $ref: "#/components/schemas/DedicatedHardwareSpec" autoScaling: - $ref: '#/components/schemas/AdvancedAutoScalingSettings' + $ref: "#/components/schemas/AdvancedAutoScalingSettings" readOnlySpecs: - $ref: '#/components/schemas/DedicatedHardwareSpec' + $ref: "#/components/schemas/DedicatedHardwareSpec" backingProviderName: type: string - description: >- - Cloud service provider on which MongoDB Cloud provisioned the + description: Cloud service provider on which MongoDB Cloud provisioned the multi-tenant cluster. The resource returns this parameter when **providerSettings.providerName** is `TENANT` and **providerSetting.instanceSizeName** is `M2` or `M5`. @@ -19858,47 +18575,43 @@ components: readOnly: true hardwareMetrics: type: array - description: >- - List that contains all host compute, memory, and storage utilization - dedicated to Atlas Search when MongoDB Atlas received this request. + description: List that contains all host compute, memory, and storage + utilization dedicated to Atlas Search when MongoDB Atlas received + this request. items: - $ref: '#/components/schemas/FTSMetric' + $ref: "#/components/schemas/FTSMetric" readOnly: true indexMetrics: type: array - description: >- - List that contains all performance and utilization measurements that - Atlas Search index performed by the time MongoDB Atlas received this - request. + description: List that contains all performance and utilization measurements + that Atlas Search index performed by the time MongoDB Atlas received + this request. items: - $ref: '#/components/schemas/FTSMetric' + $ref: "#/components/schemas/FTSMetric" readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true processId: type: string description: Hostname and port that identifies the process. example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ readOnly: true statusMetrics: type: array - description: >- - List that contains all available Atlas Search status metrics when + description: List that contains all available Atlas Search status metrics when MongoDB Atlas received this request. items: - $ref: '#/components/schemas/FTSMetric' + $ref: "#/components/schemas/FTSMetric" readOnly: true required: - groupId @@ -19911,11 +18624,10 @@ components: url: https://docs.atlas.mongodb.com/cluster-autoscaling/ properties: compute: - $ref: '#/components/schemas/ClusterComputeAutoScaling' + $ref: "#/components/schemas/ClusterComputeAutoScaling" diskGBEnabled: type: boolean - description: >- - Flag that indicates whether someone enabled disk auto-scaling for + description: Flag that indicates whether someone enabled disk auto-scaling for this cluster. title: Automatic Cluster Scaling Settings ClusterCloudProviderInstanceSize: @@ -19924,46 +18636,40 @@ components: properties: availableRegions: type: array - description: >- - List of regions that this cloud provider supports for this instance + description: List of regions that this cloud provider supports for this instance size. items: - $ref: '#/components/schemas/AvailableCloudProviderRegion' + $ref: "#/components/schemas/AvailableCloudProviderRegion" readOnly: true name: type: string - description: >- - Human-readable label that identifies the instance size or cluster + description: Human-readable label that identifies the instance size or cluster tier. readOnly: true readOnly: true ClusterComputeAutoScaling: type: object - description: >- - Collection of settings that configures how a cluster might scale its - cluster tier and whether the cluster can scale down. Cluster tier + description: Collection of settings that configures how a cluster might scale + its cluster tier and whether the cluster can scale down. Cluster tier auto-scaling is unavailable for clusters using Low CPU or NVME storage classes. properties: enabled: type: boolean - description: >- - Flag that indicates whether cluster tier auto-scaling is enabled. + description: Flag that indicates whether cluster tier auto-scaling is enabled. Set to `true` to enable cluster tier auto-scaling. If enabled, you must specify a value for **providerSettings.autoScaling.compute.maxInstanceSize** also. Set to `false` to disable cluster tier auto-scaling. scaleDownEnabled: type: boolean - description: >- - Flag that indicates whether the cluster tier can scale down. This is - required if **autoScaling.compute.enabled** is `true`. If you enable - this option, specify a value for + description: Flag that indicates whether the cluster tier can scale down. This + is required if **autoScaling.compute.enabled** is `true`. If you + enable this option, specify a value for **providerSettings.autoScaling.compute.minInstanceSize**. ClusterConnectionStrings: type: object - description: >- - Collection of Uniform Resource Locators that point to the MongoDB + description: Collection of Uniform Resource Locators that point to the MongoDB database. externalDocs: description: Connection string URI format. @@ -19973,8 +18679,7 @@ components: type: object additionalProperties: type: string - description: >- - Private endpoint-aware connection strings that use AWS-hosted + description: Private endpoint-aware connection strings that use AWS-hosted clusters with Amazon Web Services (AWS) PrivateLink. Each key identifies an Amazon Web Services (AWS) interface endpoint. Each value identifies the related `mongodb://` connection string that @@ -19982,11 +18687,9 @@ components: that the key names. externalDocs: description: Network Peering Connection - url: >- - https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ readOnly: true - description: >- - Private endpoint-aware connection strings that use AWS-hosted + description: Private endpoint-aware connection strings that use AWS-hosted clusters with Amazon Web Services (AWS) PrivateLink. Each key identifies an Amazon Web Services (AWS) interface endpoint. Each value identifies the related `mongodb://` connection string that you @@ -19994,15 +18697,13 @@ components: the key names. externalDocs: description: Network Peering Connection - url: >- - https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ readOnly: true awsPrivateLinkSrv: type: object additionalProperties: type: string - description: >- - Private endpoint-aware connection strings that use AWS-hosted + description: Private endpoint-aware connection strings that use AWS-hosted clusters with Amazon Web Services (AWS) PrivateLink. Each key identifies an Amazon Web Services (AWS) interface endpoint. Each value identifies the related `mongodb://` connection string that @@ -20010,11 +18711,9 @@ components: the key names. externalDocs: description: Network Peering Connection - url: >- - https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ readOnly: true - description: >- - Private endpoint-aware connection strings that use AWS-hosted + description: Private endpoint-aware connection strings that use AWS-hosted clusters with Amazon Web Services (AWS) PrivateLink. Each key identifies an Amazon Web Services (AWS) interface endpoint. Each value identifies the related `mongodb://` connection string that you @@ -20022,13 +18721,11 @@ components: names. externalDocs: description: Network Peering Connection - url: >- - https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ readOnly: true private: type: string - description: >- - Network peering connection strings for each interface Virtual + description: Network peering connection strings for each interface Virtual Private Cloud (VPC) endpoint that you configured to connect to this cluster. This connection string uses the `mongodb+srv://` protocol. The resource returns this parameter once someone creates a network @@ -20043,24 +18740,20 @@ components: enable custom DNS. externalDocs: description: Network Peering Connection - url: >- - https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ readOnly: true privateEndpoint: type: array - description: >- - List of private endpoint-aware connection strings that you can use + description: List of private endpoint-aware connection strings that you can use to connect to this cluster through a private endpoint. This parameter returns only if you deployed a private endpoint to all regions to which you deployed this clusters' nodes. items: - $ref: >- - #/components/schemas/ClusterDescriptionConnectionStringsPrivateEndpoint + $ref: "#/components/schemas/ClusterDescriptionConnectionStringsPrivateEndpoint" readOnly: true privateSrv: type: string - description: >- - Network peering connection strings for each interface Virtual + description: Network peering connection strings for each interface Virtual Private Cloud (VPC) endpoint that you configured to connect to this cluster. This connection string uses the `mongodb+srv://` protocol. The resource returns this parameter when someone creates a network @@ -20076,13 +18769,11 @@ components: DNS](https://docs.atlas.mongodb.com/reference/api/aws-custom-dns-update/). externalDocs: description: Network Peering Connection - url: >- - https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ + url: https://docs.atlas.mongodb.com/security-vpc-peering/#std-label-vpc-peering/ readOnly: true standard: type: string - description: >- - Public connection string that you can use to connect to this + description: Public connection string that you can use to connect to this cluster. This connection string uses the `mongodb://` protocol. externalDocs: description: Connection String URI Format @@ -20090,8 +18781,7 @@ components: readOnly: true standardSrv: type: string - description: >- - Public connection string that you can use to connect to this + description: Public connection string that you can use to connect to this cluster. This connection string uses the `mongodb+srv://` protocol. externalDocs: description: Connection String URI Format @@ -20101,34 +18791,30 @@ components: title: Cluster Connection Strings ClusterDescriptionConnectionStringsPrivateEndpoint: type: object - description: >- - Private endpoint-aware connection string that you can use to connect to - this cluster through a private endpoint. + description: Private endpoint-aware connection string that you can use to + connect to this cluster through a private endpoint. externalDocs: description: Private Endpoint for Dedicated Cluster url: https://docs.atlas.mongodb.com/security-private-endpoint/ properties: connectionString: type: string - description: >- - Private endpoint-aware connection string that uses the `mongodb://` + description: Private endpoint-aware connection string that uses the `mongodb://` protocol to connect to MongoDB Cloud through a private endpoint. readOnly: true endpoints: type: array - description: >- - List that contains the private endpoints through which you connect + description: List that contains the private endpoints through which you connect to MongoDB Cloud when you use **connectionStrings.privateEndpoint[n].connectionString** or **connectionStrings.privateEndpoint[n].srvConnectionString**. items: - $ref: >- - #/components/schemas/ClusterDescriptionConnectionStringsPrivateEndpointEndpoint + $ref: "#/components/schemas/ClusterDescriptionConnectionStringsPrivateEndpointE\ + ndpoint" readOnly: true srvConnectionString: type: string - description: >- - Private endpoint-aware connection string that uses the + description: Private endpoint-aware connection string that uses the `mongodb+srv://` protocol to connect to MongoDB Cloud through a private endpoint. The `mongodb+srv` protocol tells the driver to look up the seed list of hosts in the Domain Name System (DNS). This @@ -20141,8 +18827,7 @@ components: readOnly: true srvShardOptimizedConnectionString: type: string - description: >- - Private endpoint-aware connection string optimized for sharded + description: Private endpoint-aware connection string optimized for sharded clusters that uses the `mongodb+srv://` protocol to connect to MongoDB Cloud through a private endpoint. If the connection string uses this Uniform Resource Identifier (URI) format, you don't need @@ -20154,8 +18839,7 @@ components: readOnly: true type: type: string - description: >- - MongoDB process type to which your application connects. Use + description: MongoDB process type to which your application connects. Use `MONGOD` for replica sets and `MONGOS` for sharded clusters. readOnly: true title: Cluster Private Endpoint Connection String @@ -20165,8 +18849,7 @@ components: properties: endpointId: type: string - description: >- - Unique string that the cloud provider uses to identify the private + description: Unique string that the cloud provider uses to identify the private endpoint. readOnly: true providerName: @@ -20185,16 +18868,13 @@ components: type: integer format: int32 default: 1 - description: >- - Number of threads on the source shard and the receiving shard for + description: Number of threads on the source shard and the receiving shard for chunk migration. The number of threads should not exceed the half the total number of CPU cores in the sharded cluster. externalDocs: - description: >- - This option corresponds to the `chunkMigrationConcurrency` - `mongod` configuration file option. - url: >- - https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.chunkMigrationConcurrency + description: This option corresponds to the `chunkMigrationConcurrency` `mongod` + configuration file option. + url: https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.chunkMigrationConcurrency defaultReadConcern: type: string default: available @@ -20203,146 +18883,118 @@ components: operations set for this cluster. - MongoDB 4.4 clusters default to `available`. MongoDB 5.0 and later - clusters default to `local`. + MongoDB 4.4 clusters default to `available`. MongoDB 5.0 and later clusters default to `local`. externalDocs: description: This option corresponds to the global default read concern. url: https://docs.mongodb.com/manual/reference/read-concern/ defaultWriteConcern: type: string - default: '1' + default: "1" description: >- Default level of acknowledgment requested from MongoDB for write operations set for this cluster. - MongoDB 4.4 clusters default to `1`. MongoDB 5.0 and later clusters - default to `majority`. + MongoDB 4.4 clusters default to `1`. MongoDB 5.0 and later clusters default to `majority`. externalDocs: description: This option corresponds to the the implicit default write concern. url: https://docs.mongodb.com/manual/reference/write-concern/ failIndexKeyTooLong: type: boolean default: true - description: >- - Flag that indicates whether you can insert or update documents where - all indexed entries don't exceed 1024 bytes. If you set this to - false, + description: Flag that indicates whether you can insert or update documents + where all indexed entries don't exceed 1024 bytes. If you set this + to false, [mongod](https://docs.mongodb.com/upcoming/reference/program/mongod/#mongodb-binary-bin.mongod) writes documents that exceed this limit but doesn't index them. externalDocs: - description: >- - This option corresponds to the `failIndexKeyTooLong` `mongod` + description: This option corresponds to the `failIndexKeyTooLong` `mongod` configuration file option. - url: >- - https://docs.mongodb.com/upcoming/reference/parameters/#mongodb-parameter-param.failIndexKeyTooLong + url: https://docs.mongodb.com/upcoming/reference/parameters/#mongodb-parameter-param.failIndexKeyTooLong javascriptEnabled: type: boolean default: true - description: >- - Flag that indicates whether the cluster allows execution of + description: Flag that indicates whether the cluster allows execution of operations that perform server-side executions of JavaScript. externalDocs: - description: >- - If your cluster runs a MongoDB version less than 4.4, this option + description: If your cluster runs a MongoDB version less than 4.4, this option corresponds to modifying the `security.javascriptEnabled` configuration file option for each `mongod` in the cluster. If your cluster runs MongoDB version 4.4 or greater, this option corresponds to modifying the `security.javascriptEnabled` configuration file option for each `mongod` and `mongos` in the cluster. - url: >- - https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-security.javascriptEnabled + url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-security.javascriptEnabled minimumEnabledTlsProtocol: type: string - description: >- - Minimum Transport Layer Security (TLS) version that the cluster + description: Minimum Transport Layer Security (TLS) version that the cluster accepts for incoming connections. Clusters using TLS 1.0 or 1.1 should consider setting TLS 1.2 as the minimum TLS protocol version. externalDocs: - description: >- - This option corresponds to the `net.ssl.disabledProtocols` - `mongod` configuration file option. - url: >- - https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-net.ssl.disabledProtocols + description: This option corresponds to the `net.ssl.disabledProtocols` `mongod` + configuration file option. + url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-net.ssl.disabledProtocols noTableScan: type: boolean default: false - description: >- - Flag that indicates whether the cluster disables executing any query - that requires a collection scan to return results. + description: Flag that indicates whether the cluster disables executing any + query that requires a collection scan to return results. externalDocs: - description: >- - This option corresponds to the `notablescan` `mongod` - configuration file option. - url: >- - https://docs.mongodb.com/upcoming/reference/parameters/#mongodb-parameter-param.notablescan + description: This option corresponds to the `notablescan` `mongod` configuration + file option. + url: https://docs.mongodb.com/upcoming/reference/parameters/#mongodb-parameter-param.notablescan oplogMinRetentionHours: type: number format: double - description: >- - Minimum retention window for cluster's oplog expressed in hours. A + description: Minimum retention window for cluster's oplog expressed in hours. A value of null indicates that the cluster uses the default minimum oplog window that MongoDB Cloud calculates. externalDocs: - description: >- - This option corresponds to the `storage.oplogMinRetentionHours` + description: This option corresponds to the `storage.oplogMinRetentionHours` `mongod` configuration file option. - url: >- - https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-storage.oplogMinRetentionHours + url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-storage.oplogMinRetentionHours oplogSizeMB: type: integer format: int32 - description: >- - Storage limit of cluster's oplog expressed in megabytes. A value of + description: Storage limit of cluster's oplog expressed in megabytes. A value of null indicates that the cluster uses the default oplog size that MongoDB Cloud calculates. externalDocs: - description: >- - This option corresponds to the `replication.oplogSizeMB` `mongod` + description: This option corresponds to the `replication.oplogSizeMB` `mongod` configuration file option. - url: >- - https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-replication.oplogSizeMB + url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-replication.oplogSizeMB sampleRefreshIntervalBIConnector: type: integer format: int32 default: 0 - description: >- - Interval in seconds at which the mongosqld process re-samples data + description: Interval in seconds at which the mongosqld process re-samples data to create its relational schema. externalDocs: - description: >- - This option corresponds to the `sampleRefreshIntervalSecs` + description: This option corresponds to the `sampleRefreshIntervalSecs` `mongosqld` option. - url: >- - https://docs.mongodb.com/bi-connector/current/reference/mongosqld/#std-option-mongosqld.--schemaRefreshIntervalSecs + url: https://docs.mongodb.com/bi-connector/current/reference/mongosqld/#std-option-mongosqld.--schemaRefreshIntervalSecs minimum: 0 sampleSizeBIConnector: type: integer format: int32 default: 1000 - description: >- - Number of documents per database to sample when gathering schema + description: Number of documents per database to sample when gathering schema information. externalDocs: description: This option corresponds to the `sampleSize` `mongosqld` option. - url: >- - https://docs.mongodb.com/bi-connector/current/reference/mongosqld/#std-option-mongosqld.--sampleSize + url: https://docs.mongodb.com/bi-connector/current/reference/mongosqld/#std-option-mongosqld.--sampleSize minimum: 0 transactionLifetimeLimitSeconds: type: integer format: int64 default: 60 - description: >- - Lifetime, in seconds, of multi-document transactions. Atlas + description: Lifetime, in seconds, of multi-document transactions. Atlas considers the transactions that exceed this limit as expired and so aborts them through a periodic cleanup process. externalDocs: - description: >- - This option corresponds to the `transactionLifetimeLimitSeconds` + description: This option corresponds to the `transactionLifetimeLimitSeconds` `mongod` configuration file option. - url: >- - https://www.mongodb.com/docs/upcoming/reference/parameters/#mongodb-parameter-param.transactionLifetimeLimitSeconds + url: https://www.mongodb.com/docs/upcoming/reference/parameters/#mongodb-parameter-param.transactionLifetimeLimitSeconds minimum: 1 ClusterFreeAutoScaling: type: object @@ -20350,17 +19002,15 @@ components: properties: compute: type: string - description: >- - Collection of settings that configures how a cluster might scale its - cluster tier and whether the cluster can scale down. + description: Collection of settings that configures how a cluster might scale + its cluster tier and whether the cluster can scale down. title: Tenant ClusterOutageSimulation: type: object properties: clusterName: type: string - description: >- - Human-readable label that identifies the cluster that undergoes + description: Human-readable label that identifies the cluster that undergoes outage simulation. maxLength: 64 minLength: 1 @@ -20368,8 +19018,7 @@ components: readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the project + description: Unique 24-hexadecimal character string that identifies the project that contains the cluster to undergo outage simulation. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -20378,8 +19027,7 @@ components: readOnly: true id: type: string - description: >- - Unique 24-hexadecimal character string that identifies the outage + description: Unique 24-hexadecimal character string that identifies the outage simulation. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -20390,15 +19038,14 @@ components: type: array description: List of settings that specify the type of cluster outage simulation. items: - $ref: '#/components/schemas/AtlasClusterOutageSimulationOutageFilter' + $ref: "#/components/schemas/AtlasClusterOutageSimulationOutageFilter" minItems: 1 startRequestDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud started the regional outage + description: Date and time when MongoDB Cloud started the regional outage simulation. - example: 2022-01-01T00:00:00.000Z + example: 2022-01-01T00:00:00Z readOnly: true state: type: string @@ -20410,46 +19057,37 @@ components: |-------------|------------| - | `START_REQUESTED` | User has requested cluster outage - simulation.| + | `START_REQUESTED` | User has requested cluster outage simulation.| - | `STARTING` | MongoDB Cloud is starting cluster outage - simulation.| + | `STARTING` | MongoDB Cloud is starting cluster outage simulation.| - | `SIMULATING` | MongoDB Cloud is simulating cluster - outage.| + | `SIMULATING` | MongoDB Cloud is simulating cluster outage.| - | `RECOVERY_REQUESTED` | User has requested recovery from the - simulated outage.| + | `RECOVERY_REQUESTED` | User has requested recovery from the simulated outage.| - | `RECOVERING` | MongoDB Cloud is recovering the cluster - from the simulated outage.| + | `RECOVERING` | MongoDB Cloud is recovering the cluster from the simulated outage.| - | `COMPLETE` | MongoDB Cloud has completed the cluster - outage simulation.| + | `COMPLETE` | MongoDB Cloud has completed the cluster outage simulation.| readOnly: true ClusterProviderSettings: type: object - description: >- - Group of cloud provider settings that configure the provisioned MongoDB - hosts. + description: Group of cloud provider settings that configure the provisioned + MongoDB hosts. properties: providerName: type: string autoScaling: - $ref: '#/components/schemas/ClusterFreeAutoScaling' + $ref: "#/components/schemas/ClusterFreeAutoScaling" diskIOPS: type: integer format: int32 - description: >- - Maximum Disk Input/Output Operations per Second (IOPS) that the + description: Maximum Disk Input/Output Operations per Second (IOPS) that the database host can perform. encryptEBSVolume: type: boolean default: true deprecated: true - description: >- - Flag that indicates whether the Amazon Elastic Block Store (EBS) + description: Flag that indicates whether the Amazon Elastic Block Store (EBS) encryption feature encrypts the host's root volume for both data at rest within the volume and for data moving between the volume and the cluster. Clusters always have this setting enabled. @@ -20462,10 +19100,7 @@ components: Alternatively: - Cluster tier, with a default storage and memory capacity, that - applies to all the data-bearing hosts in your cluster. You must set - **providerSettings.providerName** to `TENANT` and specify the cloud - service provider in **providerSettings.backingProviderName**. + Cluster tier, with a default storage and memory capacity, that applies to all the data-bearing hosts in your cluster. You must set **providerSettings.providerName** to `TENANT` and specify the cloud service provider in **providerSettings.backingProviderName**. title: Tenant Instance Sizes regionName: type: string @@ -20493,18 +19128,10 @@ components: Alternatively: - Human-readable label that identifies the geographic location of your - MongoDB cluster. The region you choose can affect network latency - for clients accessing your databases. For a complete list of region - names, see - [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), - [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and - [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). - For multi-region clusters, see **replicationSpec.{region}**. + Human-readable label that identifies the geographic location of your MongoDB cluster. The region you choose can affect network latency for clients accessing your databases. For a complete list of region names, see [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), and [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/). For multi-region clusters, see **replicationSpec.{region}**. volumeType: type: string - description: >- - Disk Input/Output Operations per Second (IOPS) setting for Amazon + description: Disk Input/Output Operations per Second (IOPS) setting for Amazon Web Services (AWS) storage that you configure only for abbr title="Amazon Web Services">AWS. Specify whether Disk Input/Output Operations per Second (IOPS) must not exceed the @@ -20514,18 +19141,15 @@ components: volume size (`PROVISIONED`). diskTypeName: type: string - description: >- - Disk type that corresponds to the host's root volume for Azure + description: Disk type that corresponds to the host's root volume for Azure instances. If omitted, the default disk type for the selected **providerSettings.instanceSizeName** applies. externalDocs: description: Disk type - url: >- - https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#premium-storage-disk-sizes + url: https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#premium-storage-disk-sizes backingProviderName: type: string - description: >- - Cloud service provider on which MongoDB Cloud provisioned the + description: Cloud service provider on which MongoDB Cloud provisioned the multi-tenant host. The resource returns this parameter when **providerSettings.providerName** is `TENANT` and **providerSetting.instanceSizeName** is `M2` or `M5`. @@ -20565,40 +19189,35 @@ components: url: https://docs.atlas.mongodb.com/atlas-search/analyzers/ analyzers: type: array - description: >- - List of user-defined methods to convert database field text into + description: List of user-defined methods to convert database field text into searchable words. externalDocs: description: Custom Atlas Search Analyzers url: https://docs.atlas.mongodb.com/atlas-search/analyzers/custom/ items: - $ref: '#/components/schemas/ApiAtlasFTSAnalyzers' + $ref: "#/components/schemas/ApiAtlasFTSAnalyzers" collectionName: type: string - description: >- - Human-readable label that identifies the collection that contains + description: Human-readable label that identifies the collection that contains one or more Atlas Search indexes. database: type: string - description: >- - Human-readable label that identifies the database that contains the + description: Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes. indexID: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this Atlas Search - index. + description: Unique 24-hexadecimal digit string that identifies this Atlas + Search index. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ readOnly: true mappings: - $ref: '#/components/schemas/ApiAtlasFTSMappings' + $ref: "#/components/schemas/ApiAtlasFTSMappings" name: type: string - description: >- - Human-readable label that identifies this index. Within each + description: Human-readable label that identifies this index. Within each namespace, names of all indexes in the namespace must be unique. searchAnalyzer: type: string @@ -20606,9 +19225,10 @@ components: description: Method applied to identify words when searching this index. status: type: string - description: | + description: > Condition of the search index when you made this request. + | Status | Index Condition | |---|---| | IN_PROGRESS | Atlas is building or re-building the index after an edit. | @@ -20624,7 +19244,7 @@ components: description: Synonym Mapping url: https://docs.atlas.mongodb.com/atlas-search/synonyms/ items: - $ref: '#/components/schemas/SearchSynonymMappingDefinition' + $ref: "#/components/schemas/SearchSynonymMappingDefinition" required: - collectionName - database @@ -20651,33 +19271,29 @@ components: properties: changeStatus: type: string - description: >- - State of cluster at the time of this request. Atlas returns + description: State of cluster at the time of this request. Atlas returns **Applied** if it completed adding a user to, or removing a user from, your cluster. Atlas returns **Pending** if it's still making the requested user changes. When status is **Pending**, new users can't log in. links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true Collation: type: object - description: >- - One or more settings that specify language-specific rules to compare - strings within this index. + description: One or more settings that specify language-specific rules to + compare strings within this index. externalDocs: description: Collation Options - url: >- - https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options + url: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options properties: alternate: type: string @@ -20693,8 +19309,7 @@ components: | `"non-ignorable"` | Yes | - | `"shifted"` | No. MongoDB Cloud distinguishes these characters - when `"strength" > 3`. | + | `"shifted"` | No. MongoDB Cloud distinguishes these characters when `"strength" > 3`. | backwards: type: boolean default: false @@ -20710,7 +19325,7 @@ components: | `false` | Compare from front to back. | caseFirst: type: string - default: 'off' + default: off description: > Method to handle sort order of case differences during tertiary level comparisons. @@ -20729,18 +19344,16 @@ components: `"strength" : 1` or `"strength" : 2`. - | Value | Compare case at level 1 or 2? | Strength Level | - Comparisons Include | + | Value | Compare case at level 1 or 2? | Strength Level | Comparisons Include | |---|---|---|---| | true | Yes | 1 | Base characters and case. | | | | 2 | Base characters, diacritics (and possible other secondary differences), and case. | | false | No | | | locale: type: string - description: >- - International Components for Unicode (ICU) code that represents a + description: 'International Components for Unicode (ICU) code that represents a localized language. To specify simple binary comparison, set - `"locale" : "simple"`. + `"locale" : "simple"`.' maxVariable: type: string description: > @@ -20765,8 +19378,7 @@ components: | Value | Normalization Method | |---|---| - | `true` | Yes, check if fully normalized and perform normalization - to compare text. | + | `true` | Yes, check if fully normalized and perform normalization to compare text. | | `false` | No, don't check. | numericOrdering: @@ -20795,24 +19407,15 @@ components: |---|---|---| - | 1 | Primary | Compares the base characters only, ignoring other - differences such as diacritics and case. | + | 1 | Primary | Compares the base characters only, ignoring other differences such as diacritics and case. | - | 2 | Secondary | Compares base characters (primary) and diacritics - (secondary). Primary differences take precedence over secondary - differences. | + | 2 | Secondary | Compares base characters (primary) and diacritics (secondary). Primary differences take precedence over secondary differences. | - | 3 | Tertiary | Compares base characters (primary), diacritics - (secondary), and case and variants (tertiary). Differences between - base characters takes precedence over secondary differences which - take precedence over tertiary differences. | + | 3 | Tertiary | Compares base characters (primary), diacritics (secondary), and case and variants (tertiary). Differences between base characters takes precedence over secondary differences which take precedence over tertiary differences. | - | 4 | Quaternary | Compares for the specific use case to consider - punctuation when levels 1 through 3 ignore punctuation or for - processing Japanese text. | + | 4 | Quaternary | Compares for the specific use case to consider punctuation when levels 1 through 3 ignore punctuation or for processing Japanese text. | - | 5 | Identical | Compares for the specific use case of tie breaker. - | + | 5 | Identical | Compares for the specific use case of tie breaker. | maximum: 5 minimum: 1 required: @@ -20838,13 +19441,11 @@ components: properties: dataAccessIdentityProviderIds: type: array - description: >- - The collection of unique ids of the identity providers for org's + description: The collection of unique ids of the identity providers for org's data access. items: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the id of the + description: Unique 24-hexadecimal digit string that identifies the id of the identity provider for org's data access. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -20853,29 +19454,25 @@ components: uniqueItems: true domainAllowList: type: array - description: >- - Approved domains that restrict users who can join the organization + description: Approved domains that restrict users who can join the organization based on their email address. items: type: string uniqueItems: true domainRestrictionEnabled: type: boolean - description: >- - Value that indicates whether domain restriction is enabled for this + description: Value that indicates whether domain restriction is enabled for this connected org. identityProviderId: type: string - description: >- - Unique 20-hexadecimal digit string that identifies the identity + description: Unique 20-hexadecimal digit string that identifies the identity provider that this connected org config is associated with. maxLength: 20 minLength: 20 pattern: ^([a-f0-9]{20})$ orgId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the connected + description: Unique 24-hexadecimal digit string that identifies the connected organization configuration. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -20884,8 +19481,7 @@ components: readOnly: true postAuthRoleGrants: type: array - description: >- - Atlas roles that are granted to a user in this organization after + description: Atlas roles that are granted to a user in this organization after authenticating. items: type: string @@ -20895,15 +19491,14 @@ components: type: array description: Role mappings that are configured in this organization. items: - $ref: '#/components/schemas/AuthFederationRoleMapping' + $ref: "#/components/schemas/AuthFederationRoleMapping" uniqueItems: true userConflicts: type: array - description: >- - List that contains the users who have an email address that doesn't + description: List that contains the users who have an email address that doesn't match any domain on the allowed list. items: - $ref: '#/components/schemas/FederatedUser' + $ref: "#/components/schemas/FederatedUser" required: - domainRestrictionEnabled - identityProviderId @@ -20923,19 +19518,16 @@ components: endDate: type: string format: date - description: >- - The exclusive ending date for the Cost Explorer query. The date must - be the start of a month. - example: 2022-02-01T00:00:00.000Z + description: The exclusive ending date for the Cost Explorer query. The date + must be the start of a month. + example: 2022-02-01 groupBy: type: string - description: >- - The dimension to group the returned usage results by. At least one + description: The dimension to group the returned usage results by. At least one filter value needs to be provided for a dimension to be used. includePartialMatches: type: boolean - description: >- - Flag to control whether usage that matches the filter criteria, but + description: Flag to control whether usage that matches the filter criteria, but does not have values for all filter criteria is included in response. Default is false, which excludes the partially matching data. @@ -20966,10 +19558,9 @@ components: startDate: type: string format: date - description: >- - The inclusive starting date for the Cost Explorer query. The date + description: The inclusive starting date for the Cost Explorer query. The date must be the start of a month. - example: 2022-02-01T00:00:00.000Z + example: 2022-02-01 required: - endDate - startDate @@ -20980,15 +19571,13 @@ components: properties: desc: type: string - description: >- - Purpose or explanation provided when someone created this + description: Purpose or explanation provided when someone created this organization API key. maxLength: 250 minLength: 1 roles: type: array - description: >- - List of roles to grant this API key. If you provide this list, + description: List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization. items: @@ -21002,15 +19591,13 @@ components: properties: desc: type: string - description: >- - Purpose or explanation provided when someone created this project + description: Purpose or explanation provided when someone created this project API key. maxLength: 250 minLength: 1 roles: type: array - description: >- - List of roles to grant this API key. If you provide this list, + description: List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this project. items: @@ -21024,44 +19611,36 @@ components: properties: id: type: string - description: >- - Unique string that identifies the private endpoint's network + description: Unique string that identifies the private endpoint's network interface that someone added to this private endpoint service. - example: >- - /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln + example: /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln writeOnly: true privateEndpointIPAddress: type: string - description: >- - IPv4 address of the private endpoint in your Azure VNet that someone - added to this private endpoint service. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ endpointGroupName: type: string description: Human-readable label that identifies a set of endpoints. writeOnly: true endpoints: type: array - description: >- - List of individual private endpoints that comprise this endpoint + description: List of individual private endpoints that comprise this endpoint group. externalDocs: description: Google Cloud Forwarding Rule Concepts - url: >- - https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts items: - $ref: '#/components/schemas/CreateGCPForwardingRuleRequest' + $ref: "#/components/schemas/CreateGCPForwardingRuleRequest" gcpProjectId: type: string - description: >- - Unique string that identifies the Google Cloud project in which you + description: Unique string that identifies the Google Cloud project in which you created the endpoints. example: p-fdeeb3e43b8e733e5ab627b1 externalDocs: description: Google Cloud Creating and Managing Projects - url: >- - https://cloud.google.com/resource-manager/docs/creating-managing-projects + url: https://cloud.google.com/resource-manager/docs/creating-managing-projects pattern: ^p-[0-9a-z]{24}$ writeOnly: true CreateGCPForwardingRuleRequest: @@ -21069,34 +19648,29 @@ components: properties: endpointName: type: string - description: >- - Human-readable label that identifies the Google Cloud consumer + description: Human-readable label that identifies the Google Cloud consumer forwarding rule that you created. externalDocs: description: Google Cloud Forwarding Rule Concepts - url: >- - https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts writeOnly: true ipAddress: type: string - description: >- - One Private Internet Protocol version 4 (IPv4) address to which this - Google Cloud consumer forwarding rule resolves. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + description: One Private Internet Protocol version 4 (IPv4) address to which + this Google Cloud consumer forwarding rule resolves. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ writeOnly: true title: GCP Forwarding Rules CreateOrganizationRequest: type: object properties: apiKey: - $ref: '#/components/schemas/CreateAtlasOrganizationApiKey' + $ref: "#/components/schemas/CreateAtlasOrganizationApiKey" federationSettingsId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the federation to - link the newly created organization to. If specified, the proposed - Organization Owner of the new organization must have the + description: Unique 24-hexadecimal digit string that identifies the federation + to link the newly created organization to. If specified, the + proposed Organization Owner of the new organization must have the Organization Owner role in an organization associated with the federation. example: 32b6e34b3d91647abb20e7b8 @@ -21111,12 +19685,11 @@ components: pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ orgOwnerId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - user that you want to assign the Organization Owner role. This user - must be a member of the same organization as the calling API key. If - you provide `federationSettingsId`, this user must instead have the - Organization Owner role on an organization in the specified + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user that you want to assign the Organization Owner role. This + user must be a member of the same organization as the calling API + key. If you provide `federationSettingsId`, this user must instead + have the Organization Owner role on an organization in the specified federation. This parameter is required only when you authenticate with Programmatic API Keys. example: 32b6e34b3d91647abb20e7b8 @@ -21129,11 +19702,10 @@ components: type: object properties: apiKey: - $ref: '#/components/schemas/ApiKeyUserDetails' + $ref: "#/components/schemas/ApiKeyUserDetails" federationSettingsId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the federation + description: Unique 24-hexadecimal digit string that identifies the federation that you linked the newly created organization to. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -21142,9 +19714,8 @@ components: readOnly: true orgOwnerId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - user that you assigned the Organization Owner role in the new + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud user that you assigned the Organization Owner role in the new organization. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -21152,28 +19723,26 @@ components: pattern: ^([a-f0-9]{24})$ readOnly: true organization: - $ref: '#/components/schemas/AtlasOrganization' + $ref: "#/components/schemas/AtlasOrganization" DBUserTLSX509Settings: type: object description: Settings to configure TLS Certificates for database users. properties: cas: type: string - description: >- - Concatenated list of customer certificate authority (CA) + description: Concatenated list of customer certificate authority (CA) certificates needed to authenticate database users. MongoDB Cloud expects this as a PEM-formatted certificate. links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true title: Database User TLS Certificate Settings DataFederationLimit: @@ -21197,8 +19766,7 @@ components: readOnly: true name: type: string - description: >- - Human-readable label that identifies the user-managed limit to + description: Human-readable label that identifies the user-managed limit to modify. readOnly: true value: @@ -21208,15 +19776,13 @@ components: lastModifiedDate: type: string format: date-time - description: >- - Only used for Data Federation limits. Timestamp that indicates when + description: Only used for Data Federation limits. Timestamp that indicates when this usage limit was last modified. This field uses the ISO 8601 timestamp format in UTC. readOnly: true overrunPolicy: type: string - description: >- - Only used for Data Federation limits. Action to take when the usage + description: Only used for Data Federation limits. Action to take when the usage limit is exceeded. If limit span is set to QUERY, this is ignored because MongoDB Cloud stops the query when it exceeds the usage limit. @@ -21226,9 +19792,9 @@ components: title: Limits DataFederationTenantQueryLimit: type: object - description: >- - Details of a tenant-level query limit for Data Federation. Query limit - is the limit on the amount of usage during a time period based on cost. + description: Details of a tenant-level query limit for Data Federation. Query + limit is the limit on the amount of usage during a time period based on + cost. properties: currentUsage: type: integer @@ -21243,8 +19809,7 @@ components: lastModifiedDate: type: string format: date-time - description: >- - Only used for Data Federation limits. Timestamp that indicates when + description: Only used for Data Federation limits. Timestamp that indicates when this usage limit was last modified. This field uses the ISO 8601 timestamp format in UTC. readOnly: true @@ -21255,21 +19820,18 @@ components: readOnly: true name: type: string - description: >- - Human-readable label that identifies the user-managed limit to + description: Human-readable label that identifies the user-managed limit to modify. readOnly: true overrunPolicy: type: string - description: >- - Only used for Data Federation limits. Action to take when the usage + description: Only used for Data Federation limits. Action to take when the usage limit is exceeded. If limit span is set to QUERY, this is ignored because MongoDB Cloud stops the query when it exceeds the usage limit. tenantName: type: string - description: >- - Human-readable label that identifies the Federated Database + description: Human-readable label that identifies the Federated Database Instance. If specified, the usage limit is for the specified federated database instance only. If omitted, the usage limit is for all federated database instances in the project. @@ -21288,15 +19850,13 @@ components: properties: externalId: type: string - description: >- - Unique identifier associated with the Identity and Access Management - (IAM) role that the data lake assumes when accessing the data - stores. + description: Unique identifier associated with the Identity and Access + Management (IAM) role that the data lake assumes when accessing the + data stores. readOnly: true iamAssumedRoleARN: type: string - description: >- - Amazon Resource Name (ARN) of the Identity and Access Management + description: Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role that the data lake assumes when accessing data stores. example: arn:aws:iam::123456789012:root maxLength: 2048 @@ -21304,19 +19864,16 @@ components: readOnly: true iamUserARN: type: string - description: >- - Amazon Resource Name (ARN) of the user that the data lake assumes + description: Amazon Resource Name (ARN) of the user that the data lake assumes when accessing data stores. readOnly: true roleId: type: string - description: >- - Unique identifier of the role that the data lake can use to access + description: Unique identifier of the role that the data lake can use to access the data stores.Required if specifying cloudProviderConfig. testS3Bucket: type: string - description: >- - Name of the S3 data bucket that the provided role ID is authorized + description: Name of the S3 data bucket that the provided role ID is authorized to access.Required if specifying cloudProviderConfig. writeOnly: true required: @@ -21328,8 +19885,7 @@ components: properties: name: type: string - description: >- - Human-readable label that identifies the view, which corresponds to + description: Human-readable label that identifies the view, which corresponds to an aggregation pipeline on a collection. pipeline: type: string @@ -21339,46 +19895,40 @@ components: url: https://docs.mongodb.com/manual/core/aggregation-pipeline/ source: type: string - description: >- - Human-readable label that identifies the source collection for the + description: Human-readable label that identifies the source collection for the view. DataLakeAtlasStoreReadConcern: type: object - description: >- - MongoDB Cloud cluster read concern, which determines the consistency and - isolation properties of the data read from an Atlas cluster. + description: MongoDB Cloud cluster read concern, which determines the + consistency and isolation properties of the data read from an Atlas + cluster. properties: level: type: string - description: >- - [Read Concern - level](https://www.mongodb.com/docs/manual/reference/read-concern/#read-concern-levels) - that specifies the consistency and availability of the data read. + description: "[Read Concern + level](https://www.mongodb.com/docs/manual/reference/read-concern/#\ + read-concern-levels) that specifies the consistency and availability + of the data read." DataLakeAtlasStoreReadPreference: type: object - description: >- - MongoDB Cloud cluster read preference, which describes how to route read - requests to the cluster. + description: MongoDB Cloud cluster read preference, which describes how to route + read requests to the cluster. properties: maxStalenessSeconds: type: integer format: int32 - description: >- - Maximum replication lag, or **staleness**, for reads from + description: Maximum replication lag, or **staleness**, for reads from secondaries. mode: type: string - description: >- - Read preference mode that specifies to which replica set member to + description: Read preference mode that specifies to which replica set member to route the read requests. externalDocs: description: Read Preference Modes - url: >- - https://docs.mongodb.com/manual/core/read-preference/#read-preference-modes + url: https://docs.mongodb.com/manual/core/read-preference/#read-preference-modes tagSets: type: array - description: >- - List that contains tag sets or tag specification documents. If + description: List that contains tag sets or tag specification documents. If specified, Atlas Data Lake routes read requests to replica set member or members that are associated with the specified tags. externalDocs: @@ -21387,7 +19937,7 @@ components: items: type: array items: - $ref: '#/components/schemas/DataLakeAtlasStoreReadPreferenceTag' + $ref: "#/components/schemas/DataLakeAtlasStoreReadPreferenceTag" DataLakeAtlasStoreReadPreferenceTag: type: object properties: @@ -21402,21 +19952,20 @@ components: description: Cloud provider linked to this data lake. properties: aws: - $ref: '#/components/schemas/DataLakeAWSCloudProviderConfig' + $ref: "#/components/schemas/DataLakeAWSCloudProviderConfig" required: - aws title: Data Lake Cloud Provider DataLakeDataProcessRegion: type: object - description: >- - Information about the cloud provider region to which the data lake + description: Information about the cloud provider region to which the data lake routes client connections. properties: cloudProvider: type: string description: Name of the cloud service that hosts the data lake's data stores. region: - $ref: '#/components/schemas/BaseAtlasDataLakeRegion' + $ref: "#/components/schemas/BaseAtlasDataLakeRegion" required: - cloudProvider - region @@ -21426,16 +19975,14 @@ components: properties: dataSources: type: array - description: >- - Array that contains the data stores that map to a collection for + description: Array that contains the data stores that map to a collection for this data lake. items: - $ref: '#/components/schemas/DataLakeDatabaseDataSourceSettings' + $ref: "#/components/schemas/DataLakeDatabaseDataSourceSettings" name: type: string - description: >- - Human-readable label that identifies the collection to which MongoDB - Cloud maps the data in the data stores. + description: Human-readable label that identifies the collection to which + MongoDB Cloud maps the data in the data stores. DataLakeDatabaseDataSourceSettings: type: object description: Data store that maps to a collection for this data lake. @@ -21443,82 +19990,69 @@ components: allowInsecure: type: boolean default: false - description: >- - Flag that validates the scheme in the specified URLs. If `true`, + description: Flag that validates the scheme in the specified URLs. If `true`, allows insecure `HTTP` scheme, doesn't verify the server's certificate chain and hostname, and accepts any certificate with any hostname presented by the server. If `false`, allows secure `HTTPS` scheme only. collection: type: string - description: >- - Human-readable label that identifies the collection in the database. - For creating a wildcard (`*`) collection, you must omit this - parameter. + description: Human-readable label that identifies the collection in the + database. For creating a wildcard (`*`) collection, you must omit + this parameter. collectionRegex: type: string - description: >- - Regex pattern to use for creating the wildcard (*) collection. To + description: Regex pattern to use for creating the wildcard (*) collection. To learn more about the regex syntax, see [Go programming language](https://pkg.go.dev/regexp). database: type: string - description: >- - Human-readable label that identifies the database, which contains + description: Human-readable label that identifies the database, which contains the collection in the cluster. You must omit this parameter to generate wildcard (`*`) collections for dynamically generated databases. databaseRegex: type: string - description: >- - Regex pattern to use for creating the wildcard (*) database. To + description: Regex pattern to use for creating the wildcard (*) database. To learn more about the regex syntax, see [Go programming language](https://pkg.go.dev/regexp). datasetName: type: string - description: >- - Human-readable label that identifies the dataset that Atlas + description: Human-readable label that identifies the dataset that Atlas generates for an ingestion pipeline run or Online Archive. example: v1$atlas$snapshot$Cluster0$myDatabase$myCollection$19700101T000000Z datasetPrefix: type: string - description: >- - Human-readable label that matches against the dataset names for + description: Human-readable label that matches against the dataset names for ingestion pipeline runs or Online Archives. defaultFormat: type: string - description: >- - File format that MongoDB Cloud uses if it encounters a file without + description: File format that MongoDB Cloud uses if it encounters a file without a file extension while searching **storeName**. path: type: string - description: >- - File path that controls how MongoDB Cloud searches for and parses + description: File path that controls how MongoDB Cloud searches for and parses files in the **storeName** before mapping them to a collection.Specify ``/`` to capture all files and folders from the ``prefix`` path. provenanceFieldName: type: string - description: >- - Name for the field that includes the provenance of the documents in + description: Name for the field that includes the provenance of the documents in the results. MongoDB Cloud returns different fields in the results for each supported provider. storeName: type: string - description: >- - Human-readable label that identifies the data store that MongoDB + description: Human-readable label that identifies the data store that MongoDB Cloud maps to the collection. trimLevel: type: integer format: int32 - description: >- - Unsigned integer that specifies how many fields of the dataset name + description: Unsigned integer that specifies how many fields of the dataset name to trim from the left of the dataset name before mapping the remaining fields to a wildcard collection name. urls: type: array - description: >- - URLs of the publicly accessible data files. You can't specify URLs + description: URLs of the publicly accessible data files. You can't specify URLs that require authentication. Atlas Data Lake creates a partition for each URL. If empty or omitted, Data Lake uses the URLs from the store specified in the **dataSources.storeName** parameter. @@ -21526,46 +20060,40 @@ components: type: string DataLakeDatabaseInstance: type: object - description: >- - Database associated with this data lake. Databases contain collections - and views. + description: Database associated with this data lake. Databases contain + collections and views. properties: collections: type: array - description: >- - Array of collections and data sources that map to a ``stores`` data + description: Array of collections and data sources that map to a ``stores`` data store. items: - $ref: '#/components/schemas/DataLakeDatabaseCollection' + $ref: "#/components/schemas/DataLakeDatabaseCollection" maxWildcardCollections: type: integer format: int32 default: 100 - description: >- - Maximum number of wildcard collections in the database. This only + description: Maximum number of wildcard collections in the database. This only applies to S3 data sources. maximum: 1000 minimum: 1 name: type: string - description: >- - Human-readable label that identifies the database to which the data + description: Human-readable label that identifies the database to which the data lake maps data. views: type: array - description: >- - Array of aggregation pipelines that apply to the collection. This + description: Array of aggregation pipelines that apply to the collection. This only applies to S3 data sources. items: - $ref: '#/components/schemas/DataLakeApiBase' + $ref: "#/components/schemas/DataLakeApiBase" DataLakeIngestionPipeline: type: object description: Details of a Data Lake Pipeline. properties: _id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the Data Lake + description: Unique 24-hexadecimal digit string that identifies the Data Lake Pipeline. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -21588,17 +20116,16 @@ components: lastUpdatedDate: type: string format: date-time - description: >- - Timestamp that indicates the last time that the Data Lake Pipeline + description: Timestamp that indicates the last time that the Data Lake Pipeline was updated. readOnly: true name: type: string description: Name of this Data Lake Pipeline. sink: - $ref: '#/components/schemas/IngestionSink' + $ref: "#/components/schemas/IngestionSink" source: - $ref: '#/components/schemas/IngestionSource' + $ref: "#/components/schemas/IngestionSource" state: type: string description: State of this Data Lake Pipeline. @@ -21607,57 +20134,52 @@ components: type: array description: Fields to be excluded for this Data Lake Pipeline. items: - $ref: '#/components/schemas/FieldTransformation' + $ref: "#/components/schemas/FieldTransformation" title: Data Lake Pipeline DataLakePipelinesPartitionField: type: object - description: >- - Partition Field in the Data Lake Storage provider for a Data Lake + description: Partition Field in the Data Lake Storage provider for a Data Lake Pipeline. properties: fieldName: type: string - description: >- - Human-readable label that identifies the field name used to + description: Human-readable label that identifies the field name used to partition data. maxLength: 700 order: type: integer format: int32 default: 0 - description: >- - Sequence in which MongoDB Cloud slices the collection data to create - partitions. The resource expresses this sequence starting with zero. + description: Sequence in which MongoDB Cloud slices the collection data to + create partitions. The resource expresses this sequence starting + with zero. required: - fieldName - order title: Partition Field DataLakeStorage: type: object - description: >- - Configuration information for each data store and its mapping to MongoDB - Cloud databases. + description: Configuration information for each data store and its mapping to + MongoDB Cloud databases. properties: databases: type: array - description: >- - Array that contains the queryable databases and collections for this - data lake. + description: Array that contains the queryable databases and collections for + this data lake. items: - $ref: '#/components/schemas/DataLakeDatabaseInstance' + $ref: "#/components/schemas/DataLakeDatabaseInstance" stores: type: array description: Array that contains the data stores for the data lake. items: - $ref: '#/components/schemas/DataLakeStoreSettings' + $ref: "#/components/schemas/DataLakeStoreSettings" DataLakeStoreSettings: type: object description: Group of settings that define where the data is stored. properties: name: type: string - description: >- - Human-readable label that identifies the data store. The + description: Human-readable label that identifies the data store. The **databases.[n].collections.[n].dataSources.[n].storeName** field references this values as part of the mapping configuration. To use MongoDB Cloud as a data store, the data lake requires a serverless @@ -21666,27 +20188,23 @@ components: type: string additionalStorageClasses: type: array - description: >- - Collection of AWS S3 [storage + description: Collection of AWS S3 [storage classes](https://aws.amazon.com/s3/storage-classes/). Atlas Data Lake includes the files in these storage classes in the query results. items: type: string - description: >- - AWS S3 [storage class](https://aws.amazon.com/s3/storage-classes/) + description: AWS S3 [storage class](https://aws.amazon.com/s3/storage-classes/) where the files to include in the results are stored. bucket: type: string - description: >- - Human-readable label that identifies the AWS S3 bucket. This label + description: Human-readable label that identifies the AWS S3 bucket. This label must exactly match the name of an S3 bucket that the data lake can access with the configured AWS Identity and Access Management (IAM) credentials. delimiter: type: string - description: >- - The delimiter that separates + description: The delimiter that separates **databases.[n].collections.[n].dataSources.[n].path** segments in the data store. MongoDB Cloud uses the delimiter to efficiently traverse S3 buckets with a hierarchical directory structure. You can @@ -21697,24 +20215,22 @@ components: includeTags: type: boolean default: false - description: >- - Flag that indicates whether to use S3 tags on the files in the given - path as additional partition attributes. If set to `true`, data lake - adds the S3 tags as additional partition attributes and adds new - top-level BSON elements associating each tag to each document. + description: Flag that indicates whether to use S3 tags on the files in the + given path as additional partition attributes. If set to `true`, + data lake adds the S3 tags as additional partition attributes and + adds new top-level BSON elements associating each tag to each + document. prefix: type: string - description: >- - Prefix that MongoDB Cloud applies when searching for files in the S3 - bucket. The data store prepends the value of prefix to the + description: Prefix that MongoDB Cloud applies when searching for files in the + S3 bucket. The data store prepends the value of prefix to the **databases.[n].collections.[n].dataSources.[n].path** to create the full path for files to ingest. If omitted, MongoDB Cloud searches all files from the root of the S3 bucket. public: type: boolean default: false - description: >- - Flag that indicates whether the bucket is public. If set to `true`, + description: Flag that indicates whether the bucket is public. If set to `true`, MongoDB Cloud doesn't use the configured AWS Identity and Access Management (IAM) role to access the S3 bucket. If set to `false`, the configured AWS IAM role must include permissions to access the @@ -21739,9 +20255,8 @@ components: title: Azure Regions clusterName: type: string - description: >- - Human-readable label of the MongoDB Cloud cluster on which the store - is based. + description: Human-readable label of the MongoDB Cloud cluster on which the + store is based. projectId: type: string description: Unique 24-hexadecimal digit string that identifies the project. @@ -21750,45 +20265,41 @@ components: pattern: ^([a-f0-9]{24})$ readOnly: true readConcern: - $ref: '#/components/schemas/DataLakeAtlasStoreReadConcern' + $ref: "#/components/schemas/DataLakeAtlasStoreReadConcern" readPreference: - $ref: '#/components/schemas/DataLakeAtlasStoreReadPreference' + $ref: "#/components/schemas/DataLakeAtlasStoreReadPreference" allowInsecure: type: boolean default: false - description: >- - Flag that validates the scheme in the specified URLs. If `true`, + description: Flag that validates the scheme in the specified URLs. If `true`, allows insecure `HTTP` scheme, doesn't verify the server's certificate chain and hostname, and accepts any certificate with any hostname presented by the server. If `false`, allows secure `HTTPS` scheme only. defaultFormat: type: string - description: >- - Default format that Data Lake assumes if it encounters a file + description: Default format that Data Lake assumes if it encounters a file without an extension while searching the `storeName`. If omitted, Data Lake attempts to detect the file type by processing a few bytes of the file. The specified format only applies to the URLs specified in the **databases.[n].collections.[n].dataSources** object. urls: type: array - description: >- - Comma-separated list of publicly accessible HTTP URLs where data is + description: Comma-separated list of publicly accessible HTTP URLs where data is stored. You can't specify URLs that require authentication. items: type: string - description: >- - Comma-separated list of publicly accessible HTTP URLs where data - is stored. You can't specify URLs that require authentication. + description: Comma-separated list of publicly accessible HTTP URLs where data is + stored. You can't specify URLs that require authentication. required: - provider DataLakeTenant: type: object properties: cloudProviderConfig: - $ref: '#/components/schemas/DataLakeCloudProviderConfig' + $ref: "#/components/schemas/DataLakeCloudProviderConfig" dataProcessRegion: - $ref: '#/components/schemas/DataLakeDataProcessRegion' + $ref: "#/components/schemas/DataLakeDataProcessRegion" groupId: type: string description: Unique 24-hexadecimal character string that identifies the project. @@ -21813,39 +20324,35 @@ components: description: Label that indicates the status of the Data Lake instance. readOnly: true storage: - $ref: '#/components/schemas/DataLakeStorage' + $ref: "#/components/schemas/DataLakeStorage" DataProtectionSettings: type: object properties: authorizedEmail: type: string format: email - description: >- - Email address of the user who authorized to updated the Backup + description: Email address of the user who authorized to updated the Backup Compliance Policy settings. copyProtectionEnabled: type: boolean default: false - description: >- - Flag that indicates whether to enable additional backup copies for + description: Flag that indicates whether to enable additional backup copies for the cluster. If unspecified, this value defaults to false. encryptionAtRestEnabled: type: boolean default: false - description: >- - Flag that indicates whether Encryption at Rest using Customer Key - Management is required for all clusters with a Backup Compliance - Policy. If unspecified, this value defaults to false. + description: Flag that indicates whether Encryption at Rest using Customer + Key Management is required for all clusters with a Backup + Compliance Policy. If unspecified, this value defaults to false. externalDocs: description: Encryption at Rest using Customer Key Management url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ onDemandPolicyItem: - $ref: '#/components/schemas/DiskBackupApiPolicyItem' + $ref: "#/components/schemas/DiskBackupApiPolicyItem" pitEnabled: type: boolean default: false - description: >- - Flag that indicates whether the cluster uses Continuous Cloud + description: Flag that indicates whether the cluster uses Continuous Cloud Backups with a Backup Compliance Policy. If unspecified, this value defaults to false. externalDocs: @@ -21853,8 +20360,7 @@ components: url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ projectId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project for + description: Unique 24-hexadecimal digit string that identifies the project for the Backup Compliance Policy. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -21863,29 +20369,27 @@ components: restoreWindowDays: type: integer format: int32 - description: >- - Number of previous days that you can restore back to with Continuous - Cloud Backup with a Backup Compliance Policy. You must specify a - positive, non-zero integer, and the maximum retention window can't - exceed the hourly retention time. This parameter applies only to - Continuous Cloud Backups with a Backup Compliance Policy. + description: Number of previous days that you can restore back to with + Continuous Cloud Backup with a Backup Compliance Policy. You must + specify a positive, non-zero integer, and the maximum retention + window can't exceed the hourly retention time. This parameter + applies only to Continuous Cloud Backups with a Backup Compliance + Policy. scheduledPolicyItems: type: array description: List that contains the specifications for one scheduled policy. items: - $ref: '#/components/schemas/DiskBackupApiPolicyItem' + $ref: "#/components/schemas/DiskBackupApiPolicyItem" state: type: string - description: >- - Label that indicates the state of the Backup Compliance Policy + description: Label that indicates the state of the Backup Compliance Policy settings. MongoDB Cloud ignores this setting when you enable or update the Backup Compliance Policy settings. readOnly: true updatedDate: type: string format: date-time - description: >- - ISO 8601 timestamp format in UTC that indicates when the user + description: ISO 8601 timestamp format in UTC that indicates when the user updated the Data Protection Policy settings. MongoDB Cloud ignores this setting when you enable or update the Backup Compliance Policy settings. @@ -21893,8 +20397,7 @@ components: updatedUser: type: string format: email - description: >- - Email address that identifies the user who updated the Backup + description: Email address that identifies the user who updated the Backup Compliance Policy settings. MongoDB Cloud ignores this email setting when you enable or update the Backup Compliance Policy settings. readOnly: true @@ -21909,19 +20412,16 @@ components: properties: db: type: string - description: >- - Human-readable label that identifies the database on which someone + description: Human-readable label that identifies the database on which someone grants the action to one MongoDB user. role: type: string - description: >- - Human-readable label that identifies the role inherited. Set this + description: Human-readable label that identifies the role inherited. Set this value to `admin` for every role except `read` or `readWrite`. externalDocs: description: MongoDB Built-In Roles url: https://docs.mongodb.com/manual/reference/built-in-roles/ - pattern: >- - ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- - https://docs.mongodb.com/manual/reference/resource-document/#cluster-resource + url: https://docs.mongodb.com/manual/reference/resource-document/#cluster-resource properties: cluster: type: boolean - description: >- - Flag that indicates whether to grant the action on the cluster + description: Flag that indicates whether to grant the action on the cluster resource. If `true`, MongoDB Cloud ignores the **actions.resources.collection** and **actions.resources.db** parameters. collection: type: string - description: >- - Human-readable label that identifies the collection on which you + description: "Human-readable label that identifies the collection on which you grant the action to one MongoDB user. If you don't set this parameter, you grant the action to all collections in the database specified in the **actions.resources.db** parameter. If you set - `"actions.resources.cluster" : true`, MongoDB Cloud ignores this - parameter. + `\"actions.resources.cluster\" : true`, MongoDB Cloud ignores this + parameter." db: type: string - description: >- - Human-readable label that identifies the database on which you grant - the action to one MongoDB user. If you set + description: 'Human-readable label that identifies the database on which you + grant the action to one MongoDB user. If you set `"actions.resources.cluster" : true`, MongoDB Cloud ignores this - parameter. + parameter.' required: - cluster - collection @@ -21973,7 +20469,7 @@ components: type: array description: List of resources on which you grant the action. items: - $ref: '#/components/schemas/DatabasePermittedNamespaceResource' + $ref: "#/components/schemas/DatabasePermittedNamespaceResource" required: - action title: Database Privilege Action @@ -21981,31 +20477,27 @@ components: type: object properties: collation: - $ref: '#/components/schemas/Collation' + $ref: "#/components/schemas/Collation" collection: type: string - description: >- - Human-readable label of the collection for which MongoDB Cloud + description: Human-readable label of the collection for which MongoDB Cloud creates an index. writeOnly: true db: type: string - description: >- - Human-readable label of the database that holds the collection on + description: Human-readable label of the database that holds the collection on which MongoDB Cloud creates an index. writeOnly: true keys: type: array - description: >- - List that contains one or more objects that describe the parameters + description: List that contains one or more objects that describe the parameters that you want to index. items: type: object additionalProperties: type: string - description: >- - Key-value pair that sets the parameter to index as the key and - the type of index as its value. To create a [multikey + description: Key-value pair that sets the parameter to index as the key and the + type of index as its value. To create a [multikey index](https://docs.mongodb.com/manual/core/index-multikey/), list each parameter in its own object within this array. externalDocs: @@ -22014,8 +20506,7 @@ components: maxProperties: 1 minProperties: 1 writeOnly: true - description: >- - Key-value pair that sets the parameter to index as the key and the + description: Key-value pair that sets the parameter to index as the key and the type of index as its value. To create a [multikey index](https://docs.mongodb.com/manual/core/index-multikey/), list each parameter in its own object within this array. @@ -22027,7 +20518,7 @@ components: writeOnly: true writeOnly: true options: - $ref: '#/components/schemas/IndexOptions' + $ref: "#/components/schemas/IndexOptions" required: - collection - db @@ -22040,14 +20531,12 @@ components: description: Collection on which this role applies. databaseName: type: string - description: >- - Database against which the database user authenticates. Database + description: Database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. roleName: type: string - description: >- - Human-readable label that identifies a group of privileges assigned + description: Human-readable label that identifies a group of privileges assigned to a database user. This value can either be a built-in role or a custom role. required: @@ -22056,18 +20545,16 @@ components: title: Database User Role DedicatedHardwareSpec: type: object - description: >- - Hardware specifications for read-only nodes in the region. Read-only - nodes can never become the primary member, but can enable local reads.If - you don't specify this parameter, no read-only nodes are deployed to the - region. + description: Hardware specifications for read-only nodes in the region. + Read-only nodes can never become the primary member, but can enable + local reads.If you don't specify this parameter, no read-only nodes are + deployed to the region. properties: nodeCount: type: integer format: int32 - description: >- - Number of nodes of the given type for MongoDB Cloud to deploy to the - region. + description: Number of nodes of the given type for MongoDB Cloud to deploy to + the region. diskIOPS: type: integer format: int32 @@ -22078,25 +20565,19 @@ components: - set `"replicationSpecs[n].regionConfigs[m].providerName" : "AWS"`. - - set - `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" - : "M30"` or greater not including `Mxx_NVME` tiers. + - set `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" : "M30"` or greater not including `Mxx_NVME` tiers. - The maximum input/output operations per second (IOPS) depend on the - selected **.instanceSize** and **.diskSizeGB**. + The maximum input/output operations per second (IOPS) depend on the selected **.instanceSize** and **.diskSizeGB**. This parameter defaults to the cluster tier's standard IOPS value. Changing this value impacts cluster cost. - MongoDB Cloud enforces minimum ratios of storage capacity to system - memory for given cluster tiers. This keeps cluster performance - consistent with large datasets. + MongoDB Cloud enforces minimum ratios of storage capacity to system memory for given cluster tiers. This keeps cluster performance consistent with large datasets. - - Instance sizes `M10` to `M40` have a ratio of disk capacity to - system memory of 60:1. + - Instance sizes `M10` to `M40` have a ratio of disk capacity to system memory of 60:1. - Instance sizes greater than `M40` have a ratio of 120:1. ebsVolumeType: @@ -22106,16 +20587,13 @@ components: Type of storage you want to attach to your AWS-provisioned cluster. - - `STANDARD` volume types can't exceed the default input/output - operations per second (IOPS) rate for the selected volume size. + - `STANDARD` volume types can't exceed the default input/output operations per second (IOPS) rate for the selected volume size. - - `PROVISIONED` volume types must fall within the allowable IOPS - range for the selected volume size. + - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. instanceSize: type: string - description: >- - Hardware specification for the instance sizes in this region. Each + description: Hardware specification for the instance sizes in this region. Each instance size has a default storage and memory capacity. The instance size you select applies to all the data-bearing hosts in your instance size. @@ -22126,14 +20604,12 @@ components: properties: cloudProvider: type: string - description: >- - Human-readable label that identifies the cloud provider for the + description: Human-readable label that identifies the cloud provider for the deleted copy setting whose backup copies you want to delete. writeOnly: true regionName: type: string - description: >- - Target region for the deleted copy setting whose backup copies you + description: Target region for the deleted copy setting whose backup copies you want to delete. Please supply the 'Atlas Region' which can be found under [Cloud Providers](https://www.mongodb.com/docs/atlas/reference/cloud-providers/) @@ -22141,8 +20617,7 @@ components: writeOnly: true replicationSpecId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the replication + description: Unique 24-hexadecimal digit string that identifies the replication object for a zone in a cluster. For global clusters, there can be multiple zones to choose from. For sharded clusters and replica setclusters, there is only one zone in the cluster. To find the @@ -22160,8 +20635,7 @@ components: description: Label that identifies the destination cluster. groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the destination + description: Unique 24-hexadecimal digit string that identifies the destination project. example: 9b43a5b329223c3a1591a678 maxLength: 24 @@ -22170,13 +20644,11 @@ components: hostnameSchemaType: type: string default: PUBLIC - description: >- - The network type to use between the migration host and the target + description: The network type to use between the migration host and the target cluster. privateLinkId: type: string - description: >- - Represents the endpoint to use when the host schema type is + description: Represents the endpoint to use when the host schema type is `PRIVATE_LINK`. required: - clusterName @@ -22195,30 +20667,22 @@ components: `frequencyType`. - - In a monthly policy item, `1` indicates that the monthly snapshot - occurs on the first day of the month and `40` indicates the last day - of the month. + - In a monthly policy item, `1` indicates that the monthly snapshot occurs on the first day of the month and `40` indicates the last day of the month. - - In a weekly policy item, `1` indicates that the weekly snapshot - occurs on Monday and `7` indicates Sunday. + - In a weekly policy item, `1` indicates that the weekly snapshot occurs on Monday and `7` indicates Sunday. - - In an hourly policy item, you can set the frequency interval to - `1`, `2`, `4`, `6`, `8`, or `12`. For hourly policy items for NVMe - clusters, MongoDB Cloud accepts only `12` as the frequency interval - value. + - In an hourly policy item, you can set the frequency interval to `1`, `2`, `4`, `6`, `8`, or `12`. For hourly policy items for NVMe clusters, MongoDB Cloud accepts only `12` as the frequency interval value. MongoDB Cloud ignores this setting for non-hourly policy items in Backup Compliance Policy settings. frequencyType: type: string - description: >- - Human-readable label that identifies the frequency type associated + description: Human-readable label that identifies the frequency type associated with the backup policy. id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this backup + description: Unique 24-hexadecimal digit string that identifies this backup policy item. maxLength: 24 minLength: 24 @@ -22237,9 +20701,7 @@ components: specified for more frequent policy items. - For example: If the hourly policy item specifies a retention of two - days, you must specify two days or greater for the retention of the - weekly policy item. + For example: If the hourly policy item specifies a retention of two days, you must specify two days or greater for the retention of the weekly policy item. required: - frequencyInterval - frequencyType @@ -22250,8 +20712,7 @@ components: properties: replicaSetName: type: string - description: >- - Human-readable label that identifies the replica set on the sharded + description: Human-readable label that identifies the replica set on the sharded cluster. readOnly: true DiskBackupCopySetting: @@ -22260,8 +20721,7 @@ components: properties: cloudProvider: type: string - description: >- - Human-readable label that identifies the cloud provider that stores + description: Human-readable label that identifies the cloud provider that stores the snapshot copy. frequencies: type: array @@ -22270,15 +20730,13 @@ components: type: string regionName: type: string - description: >- - Target region to copy snapshots belonging to replicationSpecId to. + description: Target region to copy snapshots belonging to replicationSpecId to. Please supply the 'Atlas Region' which can be found under [Cloud Providers](https://www.mongodb.com/docs/atlas/reference/cloud-providers/) 'regions' link. replicationSpecId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the replication + description: Unique 24-hexadecimal digit string that identifies the replication object for a zone in a cluster. For global clusters, there can be multiple zones to choose from. For sharded clusters and replica set clusters, there is only one zone in the cluster. To find the @@ -22287,51 +20745,44 @@ components: in One Project](#operation/getLegacyCluster). shouldCopyOplogs: type: boolean - description: >- - Flag that indicates whether to copy the oplogs to the target region. - You can use the oplogs to perform point-in-time restores. + description: Flag that indicates whether to copy the oplogs to the target + region. You can use the oplogs to perform point-in-time restores. DiskBackupExportJob: type: object properties: components: type: array - description: >- - Information on the export job for each replica set in the sharded + description: Information on the export job for each replica set in the sharded cluster. items: - $ref: '#/components/schemas/DiskBackupBaseRestoreMember' + $ref: "#/components/schemas/DiskBackupBaseRestoreMember" readOnly: true createdAt: type: string format: date-time - description: >- - Date and time when someone created this export job. MongoDB Cloud + description: Date and time when someone created this export job. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true customData: type: array - description: >- - Collection of key-value pairs that represent custom data for the + description: Collection of key-value pairs that represent custom data for the metadata file that MongoDB Cloud uploads to the bucket when the export job finishes. items: - $ref: '#/components/schemas/BackupLabel' + $ref: "#/components/schemas/BackupLabel" deliveryUrl: type: array - description: >- - One or more Uniform Resource Locators (URLs) that point to the + description: 'One or more Uniform Resource Locators (URLs) that point to the compressed snapshot files for manual download. MongoDB Cloud returns - this parameter when `"deliveryType" : "download"`. + this parameter when `"deliveryType" : "download"`.' items: type: string - description: >- - One Uniform Resource Locator that point to the compressed snapshot + description: One Uniform Resource Locator that point to the compressed snapshot files for manual download. readOnly: true exportBucketId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the AWS + description: Unique 24-hexadecimal character string that identifies the AWS bucket to which MongoDB Cloud exports the Cloud Backup snapshot. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -22339,18 +20790,16 @@ components: pattern: ^([a-f0-9]{24})$ readOnly: true exportStatus: - $ref: '#/components/schemas/ExportStatus' + $ref: "#/components/schemas/ExportStatus" finishedAt: type: string format: date-time - description: >- - Date and time when this export job completed. MongoDB Cloud + description: Date and time when this export job completed. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true id: type: string - description: >- - Unique 24-hexadecimal character string that identifies the restore + description: Unique 24-hexadecimal character string that identifies the restore job. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -22359,23 +20808,20 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true prefix: type: string - description: >- - Full path on the cloud provider bucket to the folder where the + description: Full path on the cloud provider bucket to the folder where the snapshot is exported. - pattern: >- - /exported_snapshots/\{ORG-NAME\}/\{PROJECT-NAME\}/\{CLUSTER-NAME\}/\{SNAPSHOT-INITIATION-DATE\}/\{TIMESTAMP\} + pattern: /exported_snapshots/\{ORG-NAME\}/\{PROJECT-NAME\}/\{CLUSTER-NAME\}/\{SNAPSHOT-INITIATION-DATE\}/\{TIMESTAMP\} readOnly: true snapshotId: type: string @@ -22395,16 +20841,14 @@ components: properties: customData: type: array - description: >- - Collection of key-value pairs that represent custom data to add to + description: Collection of key-value pairs that represent custom data to add to the metadata file that MongoDB Cloud uploads to the bucket when the export job finishes. items: - $ref: '#/components/schemas/BackupLabel' + $ref: "#/components/schemas/BackupLabel" exportBucketId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the AWS + description: Unique 24-hexadecimal character string that identifies the AWS bucket to which MongoDB Cloud exports the Cloud Backup snapshot. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -22413,20 +20857,18 @@ components: writeOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true snapshotId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the Cloud + description: Unique 24-hexadecimal character string that identifies the Cloud Backup snasphot to export. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -22441,27 +20883,24 @@ components: properties: description: type: string - description: >- - Human-readable phrase or sentence that explains the purpose of the + description: 'Human-readable phrase or sentence that explains the purpose of the snapshot. The resource returns this parameter when `"status" : - "onDemand"`. + "onDemand"`.' links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true retentionInDays: type: integer format: int32 - description: >- - Number of days that MongoDB Cloud should retain the on-demand + description: Number of days that MongoDB Cloud should retain the on-demand snapshot. Must be at least **1**. minimum: 1 DiskBackupReplicaSet: @@ -22470,15 +20909,13 @@ components: properties: cloudProvider: type: string - description: >- - Human-readable label that identifies the cloud provider that stores - this snapshot. The resource returns this parameter when `"type": - "replicaSet"`. + description: 'Human-readable label that identifies the cloud provider that + stores this snapshot. The resource returns this parameter when + `"type": "replicaSet"`.' readOnly: true copyRegions: type: array - description: >- - List that identifies the regions to which MongoDB Cloud copies the + description: List that identifies the regions to which MongoDB Cloud copies the snapshot. items: type: string @@ -22486,29 +20923,25 @@ components: createdAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud took the snapshot. This parameter + description: Date and time when MongoDB Cloud took the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true description: type: string - description: >- - Human-readable phrase or sentence that explains the purpose of the + description: 'Human-readable phrase or sentence that explains the purpose of the snapshot. The resource returns this parameter when `"status": - "onDemand"`. + "onDemand"`.' readOnly: true expiresAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud deletes the snapshot. This + description: Date and time when MongoDB Cloud deletes the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true frequencyType: type: string - description: >- - Human-readable label that identifies how often this snapshot + description: Human-readable label that identifies how often this snapshot triggers. readOnly: true id: @@ -22521,24 +20954,22 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true masterKeyUUID: type: string format: uuid - description: >- - Unique string that identifies the Amazon Web Services (AWS) Key + description: 'Unique string that identifies the Amazon Web Services (AWS) Key Management Service (KMS) Customer Master Key (CMK) used to encrypt the snapshot. The resource returns this value when - `"encryptionEnabled" : true`. + `"encryptionEnabled" : true`.' readOnly: true mongodVersion: type: string @@ -22550,9 +20981,7 @@ components: description: List that contains unique identifiers for the policy items. items: type: string - description: >- - Unique 24-hexadecimal digit string that identifies one policy - item. + description: Unique 24-hexadecimal digit string that identifies one policy item. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -22560,10 +20989,9 @@ components: readOnly: true replicaSetName: type: string - description: >- - Human-readable label that identifies the replica set from which + description: 'Human-readable label that identifies the replica set from which MongoDB Cloud took this snapshot. The resource returns this - parameter when `"type": "replicaSet"`. + parameter when `"type": "replicaSet"`.' readOnly: true snapshotType: type: string @@ -22571,8 +20999,7 @@ components: readOnly: true status: type: string - description: >- - Human-readable label that indicates the stage of the backup process + description: Human-readable label that indicates the stage of the backup process for this snapshot. readOnly: true storageSizeBytes: @@ -22582,8 +21009,7 @@ components: readOnly: true type: type: string - description: >- - Human-readable label that categorizes the cluster as a replica set + description: Human-readable label that categorizes the cluster as a replica set or sharded cluster. readOnly: true title: Replica Set Snapshot @@ -22594,29 +21020,25 @@ components: createdAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud took the snapshot. This parameter + description: Date and time when MongoDB Cloud took the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true description: type: string - description: >- - Human-readable phrase or sentence that explains the purpose of the + description: 'Human-readable phrase or sentence that explains the purpose of the snapshot. The resource returns this parameter when `"status": - "onDemand"`. + "onDemand"`.' readOnly: true expiresAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud deletes the snapshot. This + description: Date and time when MongoDB Cloud deletes the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true frequencyType: type: string - description: >- - Human-readable label that identifies how often this snapshot + description: Human-readable label that identifies how often this snapshot triggers. readOnly: true id: @@ -22629,33 +21051,30 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true masterKeyUUID: type: string format: uuid - description: >- - Unique string that identifies the Amazon Web Services (AWS) Key + description: 'Unique string that identifies the Amazon Web Services (AWS) Key Management Service (KMS) Customer Master Key (CMK) used to encrypt the snapshot. The resource returns this value when - `"encryptionEnabled" : true`. + `"encryptionEnabled" : true`.' readOnly: true members: type: array - description: >- - List that includes the snapshots and the cloud provider that stores - the snapshots. The resource returns this parameter when `"type" : - "SHARDED_CLUSTER"`. + description: 'List that includes the snapshots and the cloud provider that + stores the snapshots. The resource returns this parameter when + `"type" : "SHARDED_CLUSTER"`.' items: - $ref: '#/components/schemas/DiskBackupShardedClusterSnapshotMember' + $ref: "#/components/schemas/DiskBackupShardedClusterSnapshotMember" readOnly: true mongodVersion: type: string @@ -22667,9 +21086,7 @@ components: description: List that contains unique identifiers for the policy items. items: type: string - description: >- - Unique 24-hexadecimal digit string that identifies one policy - item. + description: Unique 24-hexadecimal digit string that identifies one policy item. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -22677,18 +21094,16 @@ components: readOnly: true snapshotIds: type: array - description: >- - List that contains the unique identifiers of the snapshots created + description: 'List that contains the unique identifiers of the snapshots created for the shards and config host for a sharded cluster. The resource returns this parameter when `"type": "SHARDED_CLUSTER"`. These identifiers should match the ones specified in the **members[n].id** parameters. This allows you to map a snapshot to its shard or config - host name. + host name.' items: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the snapshot - for part of the sharded cluster. + description: Unique 24-hexadecimal digit string that identifies the snapshot for + part of the sharded cluster. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -22701,8 +21116,7 @@ components: readOnly: true status: type: string - description: >- - Human-readable label that indicates the stage of the backup process + description: Human-readable label that indicates the stage of the backup process for this snapshot. readOnly: true storageSizeBytes: @@ -22712,8 +21126,7 @@ components: readOnly: true type: type: string - description: >- - Human-readable label that categorizes the cluster as a replica set + description: Human-readable label that categorizes the cluster as a replica set or sharded cluster. readOnly: true title: Sharded Cluster Snapshot @@ -22722,10 +21135,9 @@ components: properties: cloudProvider: type: string - description: >- - Human-readable label that identifies the cloud provider that stores - this snapshot. The resource returns this parameter when `"type": - "replicaSet"`. + description: 'Human-readable label that identifies the cloud provider that + stores this snapshot. The resource returns this parameter when + `"type": "replicaSet"`.' readOnly: true id: type: string @@ -22737,8 +21149,7 @@ components: readOnly: true replicaSetName: type: string - description: >- - Human-readable label that identifies the shard or config host from + description: Human-readable label that identifies the shard or config host from which MongoDB Cloud took this snapshot. readOnly: true required: @@ -22751,29 +21162,25 @@ components: createdAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud took the snapshot. This parameter + description: Date and time when MongoDB Cloud took the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true description: type: string - description: >- - Human-readable phrase or sentence that explains the purpose of the + description: 'Human-readable phrase or sentence that explains the purpose of the snapshot. The resource returns this parameter when `"status": - "onDemand"`. + "onDemand"`.' readOnly: true expiresAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud deletes the snapshot. This + description: Date and time when MongoDB Cloud deletes the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true frequencyType: type: string - description: >- - Human-readable label that identifies how often this snapshot + description: Human-readable label that identifies how often this snapshot triggers. readOnly: true id: @@ -22786,24 +21193,22 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true masterKeyUUID: type: string format: uuid - description: >- - Unique string that identifies the Amazon Web Services (AWS) Key + description: 'Unique string that identifies the Amazon Web Services (AWS) Key Management Service (KMS) Customer Master Key (CMK) used to encrypt the snapshot. The resource returns this value when - `"encryptionEnabled" : true`. + `"encryptionEnabled" : true`.' readOnly: true mongodVersion: type: string @@ -22815,9 +21220,7 @@ components: description: List that contains unique identifiers for the policy items. items: type: string - description: >- - Unique 24-hexadecimal digit string that identifies one policy - item. + description: Unique 24-hexadecimal digit string that identifies one policy item. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -22829,8 +21232,7 @@ components: readOnly: true status: type: string - description: >- - Human-readable label that indicates the stage of the backup process + description: Human-readable label that indicates the stage of the backup process for this snapshot. readOnly: true storageSizeBytes: @@ -22840,55 +21242,48 @@ components: readOnly: true type: type: string - description: >- - Human-readable label that categorizes the cluster as a replica set + description: Human-readable label that categorizes the cluster as a replica set or sharded cluster. readOnly: true cloudProvider: type: string - description: >- - Human-readable label that identifies the cloud provider that stores - this snapshot. The resource returns this parameter when `"type": - "replicaSet"`. + description: 'Human-readable label that identifies the cloud provider that + stores this snapshot. The resource returns this parameter when + `"type": "replicaSet"`.' readOnly: true copyRegions: type: array - description: >- - List that identifies the regions to which MongoDB Cloud copies the + description: List that identifies the regions to which MongoDB Cloud copies the snapshot. items: type: string readOnly: true replicaSetName: type: string - description: >- - Human-readable label that identifies the replica set from which + description: 'Human-readable label that identifies the replica set from which MongoDB Cloud took this snapshot. The resource returns this - parameter when `"type": "replicaSet"`. + parameter when `"type": "replicaSet"`.' readOnly: true members: type: array - description: >- - List that includes the snapshots and the cloud provider that stores - the snapshots. The resource returns this parameter when `"type" : - "SHARDED_CLUSTER"`. + description: 'List that includes the snapshots and the cloud provider that + stores the snapshots. The resource returns this parameter when + `"type" : "SHARDED_CLUSTER"`.' items: - $ref: '#/components/schemas/DiskBackupShardedClusterSnapshotMember' + $ref: "#/components/schemas/DiskBackupShardedClusterSnapshotMember" readOnly: true snapshotIds: type: array - description: >- - List that contains the unique identifiers of the snapshots created + description: 'List that contains the unique identifiers of the snapshots created for the shards and config host for a sharded cluster. The resource returns this parameter when `"type": "SHARDED_CLUSTER"`. These identifiers should match the ones specified in the **members[n].id** parameters. This allows you to map a snapshot to its shard or config - host name. + host name.' items: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the snapshot - for part of the sharded cluster. + description: Unique 24-hexadecimal digit string that identifies the snapshot for + part of the sharded cluster. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -22900,8 +21295,7 @@ components: properties: _id: type: string - description: >- - Unique 24-hexadecimal character string that identifies the Amazon + description: Unique 24-hexadecimal character string that identifies the Amazon Web Services (AWS) Simple Storage Service (S3) export bucket. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -22910,18 +21304,15 @@ components: readOnly: true bucketName: type: string - description: >- - Human-readable label that identifies the AWS bucket that the role is - authorized to access. + description: Human-readable label that identifies the AWS bucket that the role + is authorized to access. cloudProvider: type: string - description: >- - Human-readable label that identifies the cloud provider that stores + description: Human-readable label that identifies the cloud provider that stores this snapshot. iamRoleId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the AWS IAM + description: Unique 24-hexadecimal character string that identifies the AWS IAM role that MongoDB Cloud uses to access the AWS S3 bucket. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -22929,15 +21320,14 @@ components: pattern: ^([a-f0-9]{24})$ links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true DiskBackupSnapshotRestoreJob: type: object @@ -22948,29 +21338,26 @@ components: readOnly: true components: type: array - description: >- - Information on the restore job for each replica set in the sharded + description: Information on the restore job for each replica set in the sharded cluster. items: - $ref: '#/components/schemas/DiskBackupBaseRestoreMember' + $ref: "#/components/schemas/DiskBackupBaseRestoreMember" readOnly: true deliveryType: type: string description: Human-readable label that categorizes the restore job to create. deliveryUrl: type: array - description: >- - One or more Uniform Resource Locators (URLs) that point to the + description: 'One or more Uniform Resource Locators (URLs) that point to the compressed snapshot files for manual download. MongoDB Cloud returns - this parameter when `"deliveryType" : "download"`. + this parameter when `"deliveryType" : "download"`.' items: type: string - description: >- - One Uniform Resource Locator that point to the compressed snapshot + description: One Uniform Resource Locator that point to the compressed snapshot files for manual download. readOnly: true desiredTimestamp: - $ref: '#/components/schemas/ApiBSONTimestamp' + $ref: "#/components/schemas/ApiBSONTimestamp" expired: type: boolean description: Flag that indicates whether the restore job expired. @@ -22978,9 +21365,8 @@ components: expiresAt: type: string format: date-time - description: >- - Date and time when the restore job expires. This parameter expresses - its value in the ISO 8601 timestamp format in UTC. + description: Date and time when the restore job expires. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true failed: type: boolean @@ -22989,14 +21375,12 @@ components: finishedAt: type: string format: date-time - description: >- - Date and time when the restore job completed. This parameter + description: Date and time when the restore job completed. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true id: type: string - description: >- - Unique 24-hexadecimal character string that identifies the restore + description: Unique 24-hexadecimal character string that identifies the restore job. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23005,45 +21389,41 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true oplogInc: type: integer format: int32 - description: >- - Oplog operation number from which you want to restore this snapshot. - This number represents the second part of an Oplog timestamp. The - resource returns this parameter when `"deliveryType" : - "pointInTime"` and **oplogTs** exceeds `0`. + description: 'Oplog operation number from which you want to restore this + snapshot. This number represents the second part of an Oplog + timestamp. The resource returns this parameter when `"deliveryType" + : "pointInTime"` and **oplogTs** exceeds `0`.' example: 1 minimum: 1 oplogTs: type: integer format: int32 - description: >- - Date and time from which you want to restore this snapshot. This + description: 'Date and time from which you want to restore this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. This number represents the first part of an Oplog timestamp. The resource returns this parameter when - `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`. + `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.' minimum: 1199145600 pointInTimeUTCSeconds: type: integer format: int32 - description: >- - Date and time from which MongoDB Cloud restored this snapshot. This - parameter expresses this timestamp in the number of seconds that - have elapsed since the UNIX epoch. The resource returns this + description: 'Date and time from which MongoDB Cloud restored this snapshot. + This parameter expresses this timestamp in the number of seconds + that have elapsed since the UNIX epoch. The resource returns this parameter when `"deliveryType" : "pointInTime"` and - **pointInTimeUTCSeconds** exceeds `0`. + **pointInTimeUTCSeconds** exceeds `0`.' minimum: 1199145600 snapshotId: type: string @@ -23054,9 +21434,8 @@ components: pattern: ^([a-f0-9]{24})$ targetClusterName: type: string - description: >- - Human-readable label that identifies the target cluster to which the - restore job restores the snapshot. The resource returns this + description: Human-readable label that identifies the target cluster to which + the restore job restores the snapshot. The resource returns this parameter when `"deliveryType":` `"automated"`. Required for `automated` and `pointInTime` restore types. maxLength: 64 @@ -23064,8 +21443,7 @@ components: pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ targetGroupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the target + description: Unique 24-hexadecimal digit string that identifies the target project for the specified **targetClusterName**. Required for `automated` and `pointInTime` restore types. example: 32b6e34b3d91647abb20e7b8 @@ -23075,8 +21453,7 @@ components: timestamp: type: string format: date-time - description: >- - Date and time when MongoDB Cloud took the snapshot associated with + description: Date and time when MongoDB Cloud took the snapshot associated with **snapshotId**. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -23087,13 +21464,11 @@ components: properties: autoExportEnabled: type: boolean - description: >- - Flag that indicates whether MongoDB Cloud automatically exports + description: Flag that indicates whether MongoDB Cloud automatically exports cloud backup snapshots to the AWS bucket. clusterId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the cluster with + description: Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23102,8 +21477,7 @@ components: readOnly: true clusterName: type: string - description: >- - Human-readable label that identifies the cluster with the snapshot + description: Human-readable label that identifies the cluster with the snapshot you want to return. maxLength: 64 minLength: 1 @@ -23111,38 +21485,34 @@ components: readOnly: true copySettings: type: array - description: >- - List that contains a document for each copy setting item in the + description: List that contains a document for each copy setting item in the desired backup policy. items: - $ref: '#/components/schemas/DiskBackupCopySetting' + $ref: "#/components/schemas/DiskBackupCopySetting" deleteCopiedBackups: type: array - description: >- - List that contains a document for each deleted copy setting whose + description: List that contains a document for each deleted copy setting whose backup copies you want to delete. items: - $ref: '#/components/schemas/DeleteCopiedBackups' + $ref: "#/components/schemas/DeleteCopiedBackups" writeOnly: true export: - $ref: '#/components/schemas/AutoExportPolicy' + $ref: "#/components/schemas/AutoExportPolicy" links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true nextSnapshot: type: string format: date-time - description: >- - Date and time when MongoDB Cloud takes the next snapshot. This + description: Date and time when MongoDB Cloud takes the next snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -23150,38 +21520,34 @@ components: type: array description: Rules set for this backup schedule. items: - $ref: '#/components/schemas/AdvancedDiskBackupSnapshotSchedulePolicy' + $ref: "#/components/schemas/AdvancedDiskBackupSnapshotSchedulePolicy" maxItems: 1 referenceHourOfDay: type: integer format: int32 - description: >- - Hour of day in Coordinated Universal Time (UTC) that represents when - MongoDB Cloud takes the snapshot. + description: Hour of day in Coordinated Universal Time (UTC) that represents + when MongoDB Cloud takes the snapshot. referenceMinuteOfHour: type: integer format: int32 - description: >- - Minute of the **referenceHourOfDay** that represents when MongoDB + description: Minute of the **referenceHourOfDay** that represents when MongoDB Cloud takes the snapshot. restoreWindowDays: type: integer format: int32 - description: >- - Number of previous days that you can restore back to with Continuous - Cloud Backup accuracy. You must specify a positive, non-zero - integer. This parameter applies to continuous cloud backups only. + description: Number of previous days that you can restore back to with + Continuous Cloud Backup accuracy. You must specify a positive, + non-zero integer. This parameter applies to continuous cloud backups + only. updateSnapshots: type: boolean - description: >- - Flag that indicates whether to apply the retention changes in the + description: Flag that indicates whether to apply the retention changes in the updated backup policy to snapshots that MongoDB Cloud took previously. writeOnly: true useOrgAndGroupNamesInExportPrefix: type: boolean - description: >- - Flag that indicates whether to use organization and project names + description: Flag that indicates whether to use organization and project names instead of organization and project UUIDs in the path to the metadata files that MongoDB Cloud uploads to your AWS bucket. DiskGBAutoScaling: @@ -23190,19 +21556,18 @@ components: properties: enabled: type: boolean - description: >- - Flag that indicates whether this cluster enables disk auto-scaling. + description: Flag that indicates whether this cluster enables disk auto-scaling. The maximum memory allowed for the selected cluster tier and the oplog size can limit storage auto-scaling. EncryptionAtRest: type: object properties: awsKms: - $ref: '#/components/schemas/AWSKMSConfiguration' + $ref: "#/components/schemas/AWSKMSConfiguration" azureKeyVault: - $ref: '#/components/schemas/AzureKeyVault' + $ref: "#/components/schemas/AzureKeyVault" googleCloudKms: - $ref: '#/components/schemas/GoogleCloudKMS' + $ref: "#/components/schemas/GoogleCloudKMS" EndpointService: type: object properties: @@ -23212,14 +21577,12 @@ components: readOnly: true errorMessage: type: string - description: >- - Error message returned when requesting private connection resource. + description: Error message returned when requesting private connection resource. The resource returns `null` if the request succeeded. readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the Private + description: Unique 24-hexadecimal digit string that identifies the Private Endpoint Service. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23232,27 +21595,23 @@ components: readOnly: true status: type: string - description: >- - State of the Private Endpoint Service connection when MongoDB Cloud + description: State of the Private Endpoint Service connection when MongoDB Cloud received this request. readOnly: true endpointServiceName: type: string - description: >- - Unique string that identifies the Amazon Web Services (AWS) + description: Unique string that identifies the Amazon Web Services (AWS) PrivateLink endpoint service. MongoDB Cloud returns null while it creates the endpoint service. pattern: ^com\.amazonaws\.vpce\.[a-z-0-9]+\.vpce-svc-[0-9a-f]{17} readOnly: true interfaceEndpoints: type: array - description: >- - List of strings that identify private endpoint interfaces applied to - the specified project. + description: List of strings that identify private endpoint interfaces applied + to the specified project. items: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the interface + description: Unique 24-hexadecimal digit string that identifies the interface endpoint. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23262,22 +21621,18 @@ components: readOnly: true privateEndpoints: type: array - description: >- - List of private endpoints assigned to this Azure Private Link + description: List of private endpoints assigned to this Azure Private Link Service. items: type: string - description: >- - Root-relative path to one private endpoint assigned to this Azure + description: Root-relative path to one private endpoint assigned to this Azure Private Link Service. - pattern: >- - ^\/subscriptions\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/resource[gG]roups\/([-\w._()]+)\/providers\/Microsoft\.Network\/privateEndpoints\/([-\w._()]+) + pattern: ^\/subscriptions\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/resource[gG]roups\/([-\w._()]+)\/providers\/Microsoft\.Network\/privateEndpoints\/([-\w._()]+) readOnly: true readOnly: true privateLinkServiceName: type: string - description: >- - Unique string that identifies the Azure Private Link Service that + description: Unique string that identifies the Azure Private Link Service that MongoDB Cloud manages. maxLength: 24 minLength: 24 @@ -23285,45 +21640,36 @@ components: readOnly: true privateLinkServiceResourceId: type: string - description: >- - Root-relative path that identifies of the Azure Private Link Service - that MongoDB Cloud manages. Use this value to create a private - endpoint connection to an Azure VNet. - example: >- - /subscriptions/ae349d51-d12b-ee3d-2a27-7d53f6479cf0/resourcegroups/KObGGz/providers/Microsoft.Network/privateLinkServices/pls_d1820713f8153388d533e9de + description: Root-relative path that identifies of the Azure Private Link + Service that MongoDB Cloud manages. Use this value to create a + private endpoint connection to an Azure VNet. + example: /subscriptions/ae349d51-d12b-ee3d-2a27-7d53f6479cf0/resourcegroups/KObGGz/providers/Microsoft.Network/privateLinkServices/pls_d1820713f8153388d533e9de readOnly: true endpointGroupNames: type: array - description: >- - List of Google Cloud network endpoint groups that corresponds to the - Private Service Connect endpoint service. + description: List of Google Cloud network endpoint groups that corresponds to + the Private Service Connect endpoint service. externalDocs: description: Google Cloud Forwarding Rule Concepts - url: >- - https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts items: type: string - description: >- - One Google Cloud network endpoint group that corresponds to the + description: One Google Cloud network endpoint group that corresponds to the Private Service Connect endpoint service. serviceAttachmentNames: type: array - description: >- - List of Uniform Resource Locators (URLs) that identifies endpoints + description: List of Uniform Resource Locators (URLs) that identifies endpoints that MongoDB Cloud can use to access one Google Cloud Service across a Google Cloud Virtual Private Connection (VPC) network. externalDocs: description: Google Cloud Private Service Connect Service Attachments - url: >- - https://cloud.google.com/vpc/docs/private-service-connect#service-attachments + url: https://cloud.google.com/vpc/docs/private-service-connect#service-attachments items: type: string - description: >- - Uniform Resource Locator (URL) that identifies one endpoint that + description: Uniform Resource Locator (URL) that identifies one endpoint that MongoDB Cloud can use to access one Google Cloud Service across a Google Cloud Virtual Private Connection (VPC) network. - pattern: >- - https:\/\/([a-z0-9\.]+)+\.[a-z]{2,}(\/[a-z0-9\-]+)+\/projects\/p-[a-z0-9]+\/regions\/[a-z\-0-9]+\/serviceAttachments\/[a-z0-9\-]+ + pattern: https:\/\/([a-z0-9\.]+)+\.[a-z]{2,}(\/[a-z0-9\-]+)+\/projects\/p-[a-z0-9]+\/regions\/[a-z\-0-9]+\/serviceAttachments\/[a-z0-9\-]+ required: - cloudProvider EventTypeForNdsGroup: @@ -23335,8 +21681,7 @@ components: properties: apiKeyId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the [API + description: Unique 24-hexadecimal digit string that identifies the [API Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that triggered the event. If this resource returns this parameter, it doesn't return the **userId** parameter. @@ -23348,18 +21693,16 @@ components: created: type: string format: date-time - description: >- - Date and time when this event occurred. This parameter expresses its - value in the ISO 8601 timestamp format in UTC. readOnly: true eventTypeName: - $ref: '#/components/schemas/ResourceEventType' + $ref: "#/components/schemas/ResourceEventType" groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project in + description: Unique 24-hexadecimal digit string that identifies the project in which the event occurred. The **eventId** identifies the specific event. example: 32b6e34b3d91647abb20e7b8 @@ -23378,26 +21721,23 @@ components: isGlobalAdmin: type: boolean default: false - description: >- - Flag that indicates whether a MongoDB employee triggered the + description: Flag that indicates whether a MongoDB employee triggered the specified event. readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true orgId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization to which these events apply. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23407,26 +21747,23 @@ components: publicKey: type: string format: email - description: >- - Public part of the [API + description: Public part of the [API Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that triggered the event. If this resource returns this parameter, it doesn't return the **username** parameter. example: test.user@mongodb.com readOnly: true raw: - $ref: '#/components/schemas/raw' + $ref: "#/components/schemas/raw" remoteAddress: type: string description: IPv4 or IPv6 address from which the user triggered this event. example: 216.172.40.186 - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ readOnly: true userId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the console user + description: Unique 24-hexadecimal digit string that identifies the console user who triggered the event. If this resource returns this parameter, it doesn't return the **apiKeyId** parameter. example: 32b6e34b3d91647abb20e7b8 @@ -23437,16 +21774,14 @@ components: username: type: string format: email - description: >- - Email address for the user who triggered this event. If this + description: Email address for the user who triggered this event. If this resource returns this parameter, it doesn't return the **publicApiKey** parameter. example: test.user@mongodb.com readOnly: true alertId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the alert + description: Unique 24-hexadecimal digit string that identifies the alert associated with the event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23455,8 +21790,7 @@ components: readOnly: true alertConfigId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the alert + description: Unique 24-hexadecimal digit string that identifies the alert configuration associated with the **alertId**. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23465,8 +21799,7 @@ components: readOnly: true invoiceId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies of the invoice + description: Unique 24-hexadecimal digit string that identifies of the invoice associated with the event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23475,8 +21808,7 @@ components: readOnly: true paymentId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the invoice + description: Unique 24-hexadecimal digit string that identifies the invoice payment associated with this event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23490,26 +21822,23 @@ components: readOnly: true collection: type: string - description: >- - Human-readable label of the collection on which the event occurred. + description: Human-readable label of the collection on which the event occurred. The resource returns this parameter when the **eventTypeName** includes `DATA_EXPLORER`. example: test_collection readOnly: true database: type: string - description: >- - Human-readable label of the database on which this incident + description: 'Human-readable label of the database on which this incident occurred. The resource returns this parameter when `"eventTypeName" - : "DATA_EXPLORER"` or `"eventTypeName" : "DATA_EXPLORER_CRUD"`. + : "DATA_EXPLORER"` or `"eventTypeName" : "DATA_EXPLORER_CRUD"`.' example: test_db readOnly: true opType: type: string - description: >- - Action that the database attempted to execute when the event + description: 'Action that the database attempted to execute when the event triggered. The response returns this parameter when `eventTypeName" - : "DATA_EXPLORER"`. + : "DATA_EXPLORER"`.' example: insertDocument readOnly: true port: @@ -23524,31 +21853,27 @@ components: example: event-replica-set readOnly: true currentValue: - $ref: '#/components/schemas/NumberMetricValue' + $ref: "#/components/schemas/NumberMetricValue" metricName: type: string - description: >- - Human-readable label of the metric associated with the **alertId**. + description: Human-readable label of the metric associated with the **alertId**. This field may change type of **currentValue** field. readOnly: true dbUserUsername: type: string - description: >- - The username of the MongoDB User that was created, deleted, or + description: The username of the MongoDB User that was created, deleted, or edited. example: user1 readOnly: true whitelistEntry: type: string - description: >- - Entry in the list of source host addresses that the API key accepts + description: Entry in the list of source host addresses that the API key accepts and this event targets. example: 0.0.0.0 readOnly: true endpointId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the endpoint + description: Unique 24-hexadecimal digit string that identifies the endpoint associated with this event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23557,15 +21882,13 @@ components: readOnly: true providerEndpointId: type: string - description: >- - Unique identification string that the cloud provider uses to + description: Unique identification string that the cloud provider uses to identify the private endpoint. example: vpce-0d6c248dedef65a25 readOnly: true teamId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization team associated with this event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23575,15 +21898,13 @@ components: targetUsername: type: string format: email - description: >- - Email address for the console user that this event targets. The - resource returns this parameter when `"eventTypeName" : "USER"`. + description: 'Email address for the console user that this event targets. The + resource returns this parameter when `"eventTypeName" : "USER"`.' example: test.user@mongodb.com readOnly: true resourceId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the resource + description: Unique 24-hexadecimal digit string that identifies the resource associated with the event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23599,8 +21920,7 @@ components: properties: apiKeyId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the [API + description: Unique 24-hexadecimal digit string that identifies the [API Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that triggered the event. If this resource returns this parameter, it doesn't return the **userId** parameter. @@ -23612,18 +21932,16 @@ components: created: type: string format: date-time - description: >- - Date and time when this event occurred. This parameter expresses its - value in the ISO 8601 timestamp format in UTC. readOnly: true eventTypeName: - $ref: '#/components/schemas/ResourceEventTypeViewForOrg' + $ref: "#/components/schemas/ResourceEventTypeViewForOrg" groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project in + description: Unique 24-hexadecimal digit string that identifies the project in which the event occurred. The **eventId** identifies the specific event. example: 32b6e34b3d91647abb20e7b8 @@ -23642,26 +21960,23 @@ components: isGlobalAdmin: type: boolean default: false - description: >- - Flag that indicates whether a MongoDB employee triggered the + description: Flag that indicates whether a MongoDB employee triggered the specified event. readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true orgId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization to which these events apply. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23671,26 +21986,23 @@ components: publicKey: type: string format: email - description: >- - Public part of the [API + description: Public part of the [API Key](https://dochub.mongodb.org/core/atlas-create-prog-api-key) that triggered the event. If this resource returns this parameter, it doesn't return the **username** parameter. example: test.user@mongodb.com readOnly: true raw: - $ref: '#/components/schemas/raw' + $ref: "#/components/schemas/raw" remoteAddress: type: string description: IPv4 or IPv6 address from which the user triggered this event. example: 216.172.40.186 - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ readOnly: true userId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the console user + description: Unique 24-hexadecimal digit string that identifies the console user who triggered the event. If this resource returns this parameter, it doesn't return the **apiKeyId** parameter. example: 32b6e34b3d91647abb20e7b8 @@ -23701,16 +22013,14 @@ components: username: type: string format: email - description: >- - Email address for the user who triggered this event. If this + description: Email address for the user who triggered this event. If this resource returns this parameter, it doesn't return the **publicApiKey** parameter. example: test.user@mongodb.com readOnly: true alertId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the alert + description: Unique 24-hexadecimal digit string that identifies the alert associated with the event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23719,8 +22029,7 @@ components: readOnly: true alertConfigId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the alert + description: Unique 24-hexadecimal digit string that identifies the alert configuration associated with the **alertId**. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23729,8 +22038,7 @@ components: readOnly: true invoiceId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies of the invoice + description: Unique 24-hexadecimal digit string that identifies of the invoice associated with the event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23739,8 +22047,7 @@ components: readOnly: true paymentId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the invoice + description: Unique 24-hexadecimal digit string that identifies the invoice payment associated with this event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23749,22 +22056,19 @@ components: readOnly: true dbUserUsername: type: string - description: >- - The username of the MongoDB User that was created, deleted, or + description: The username of the MongoDB User that was created, deleted, or edited. example: user1 readOnly: true whitelistEntry: type: string - description: >- - Entry in the list of source host addresses that the API key accepts + description: Entry in the list of source host addresses that the API key accepts and this event targets. example: 0.0.0.0 readOnly: true teamId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization team associated with this event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23774,15 +22078,13 @@ components: targetUsername: type: string format: email - description: >- - Email address for the console user that this event targets. The - resource returns this parameter when `"eventTypeName" : "USER"`. + description: 'Email address for the console user that this event targets. The + resource returns this parameter when `"eventTypeName" : "USER"`.' example: test.user@mongodb.com readOnly: true resourceId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the resource + description: Unique 24-hexadecimal digit string that identifies the resource associated with the event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -23800,9 +22102,7 @@ components: exportedCollections: type: integer format: int32 - description: >- - Number of collections on the replica set that MongoDB Cloud - exported. + description: Number of collections on the replica set that MongoDB Cloud exported. readOnly: true totalCollections: type: integer @@ -23811,14 +22111,12 @@ components: readOnly: true FTSMetric: type: object - description: >- - Measurement of one Atlas Search status when MongoDB Atlas received this - request. + description: Measurement of one Atlas Search status when MongoDB Atlas received + this request. properties: metricName: type: string - description: >- - Human-readable label that identifies this Atlas Search hardware, + description: Human-readable label that identifies this Atlas Search hardware, status, or index measurement. readOnly: true units: @@ -23836,14 +22134,12 @@ components: emailAddress: type: string format: email - description: >- - Email address of the MongoDB Cloud user linked to the federated + description: Email address of the MongoDB Cloud user linked to the federated organization. federationSettingsId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the federation to - which this MongoDB Cloud user belongs. + description: Unique 24-hexadecimal digit string that identifies the federation + to which this MongoDB Cloud user belongs. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -23853,9 +22149,8 @@ components: description: First or given name that belongs to the MongoDB Cloud user. lastName: type: string - description: >- - Last name, family name, or surname that belongs to the MongoDB Cloud - user. + description: Last name, family name, or surname that belongs to the MongoDB + Cloud user. userId: type: string description: Unique 24-hexadecimal digit string that identifies this user. @@ -23877,24 +22172,20 @@ components: description: URL that points to where to send the SAML response. associatedDomains: type: array - description: >- - List that contains the domains associated with the identity - provider. + description: List that contains the domains associated with the identity provider. items: type: string uniqueItems: true associatedOrgs: type: array - description: >- - List that contains the connected organization configurations + description: List that contains the connected organization configurations associated with the identity provider. items: - $ref: '#/components/schemas/ConnectedOrgConfig' + $ref: "#/components/schemas/ConnectedOrgConfig" uniqueItems: true audienceUri: type: string - description: >- - Unique string that identifies the intended audience of the SAML + description: Unique string that identifies the intended audience of the SAML assertion. displayName: type: string @@ -23904,29 +22195,25 @@ components: description: Unique string that identifies the issuer of the SAML Assertion. oktaIdpId: type: string - description: >- - Unique 20-hexadecimal digit string that identifies the identity + description: Unique 20-hexadecimal digit string that identifies the identity provider. maxLength: 20 minLength: 20 pattern: ^([a-f0-9]{20})$ pemFileInfo: - $ref: '#/components/schemas/PemFileInfo' + $ref: "#/components/schemas/PemFileInfo" requestBinding: type: string - description: >- - SAML Authentication Request Protocol HTTP method binding (POST or + description: SAML Authentication Request Protocol HTTP method binding (POST or REDIRECT) that Federated Authentication uses to send the authentication request. responseSignatureAlgorithm: type: string - description: >- - Signature algorithm that Federated Authentication uses to encrypt + description: Signature algorithm that Federated Authentication uses to encrypt the identity provider signature. ssoDebugEnabled: type: boolean - description: >- - Flag that indicates whether the identity provider has SSO debug + description: Flag that indicates whether the identity provider has SSO debug enabled. ssoUrl: type: string @@ -23945,35 +22232,29 @@ components: description: Key in the document. type: type: string - description: >- - Type of transformation applied during the export of the namespace in - a Data Lake Pipeline. + description: Type of transformation applied during the export of the namespace + in a Data Lake Pipeline. title: Field Transformation GCPConsumerForwardingRule: type: object properties: endpointName: type: string - description: >- - Human-readable label that identifies the Google Cloud consumer + description: Human-readable label that identifies the Google Cloud consumer forwarding rule that you created. externalDocs: description: Google Cloud Forwarding Rule Concepts - url: >- - https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts readOnly: true ipAddress: type: string - description: >- - One Private Internet Protocol version 4 (IPv4) address to which this - Google Cloud consumer forwarding rule resolves. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + description: One Private Internet Protocol version 4 (IPv4) address to which + this Google Cloud consumer forwarding rule resolves. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ readOnly: true status: type: string - description: >- - State of the MongoDB Cloud endpoint group when MongoDB Cloud + description: State of the MongoDB Cloud endpoint group when MongoDB Cloud received this request. readOnly: true GeoSharding: @@ -24003,39 +22284,33 @@ components: readOnly: true managedNamespaces: type: array - description: >- - List that contains a namespace for a Global Cluster. MongoDB Cloud + description: List that contains a namespace for a Global Cluster. MongoDB Cloud manages this cluster. items: - $ref: '#/components/schemas/ManagedNamespaces' + $ref: "#/components/schemas/ManagedNamespaces" readOnly: true GoogleCloudKMS: type: object - description: >- - Details that define the configuration of Encryption at Rest using Google - Cloud Key Management Service (KMS). + description: Details that define the configuration of Encryption at Rest using + Google Cloud Key Management Service (KMS). externalDocs: description: Google Cloud Key Management Service url: https://www.mongodb.com/docs/atlas/security-gcp-kms/ properties: enabled: type: boolean - description: >- - Flag that indicates whether someone enabled encryption at rest for + description: Flag that indicates whether someone enabled encryption at rest for the specified project. To disable encryption at rest using customer key management and remove the configuration details, pass only this parameter with a value of `false`. keyVersionResourceID: type: string - description: >- - Resource path that displays the key version resource ID for your + description: Resource path that displays the key version resource ID for your Google Cloud KMS. - example: >- - projects/my-project-common-0/locations/us-east4/keyRings/my-key-ring-0/cryptoKeys/my-key-0/cryptoKeyVersions/1 + example: projects/my-project-common-0/locations/us-east4/keyRings/my-key-ring-0/cryptoKeys/my-key-0/cryptoKeyVersions/1 serviceAccountKey: type: string - description: >- - JavaScript Object Notation (JSON) object that contains the Google + description: JavaScript Object Notation (JSON) object that contains the Google Cloud Key Management Service (KMS). Format the JSON as a string and not as an object. externalDocs: @@ -24044,8 +22319,7 @@ components: writeOnly: true valid: type: boolean - description: >- - Flag that indicates whether the Google Cloud Key Management Service + description: Flag that indicates whether the Google Cloud Key Management Service (KMS) encryption key can encrypt and decrypt data. readOnly: true GreaterThanRawThreshold: @@ -24060,7 +22334,7 @@ components: format: int32 description: Value of metric that, when exceeded, triggers an alert. units: - $ref: '#/components/schemas/RawMetricUnits' + $ref: "#/components/schemas/RawMetricUnits" title: Greater Than Raw Threshold Group: type: object @@ -24073,16 +22347,14 @@ components: created: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this project. This + description: Date and time when MongoDB Cloud created this project. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - project. + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud project. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -24090,29 +22362,26 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true name: type: string - description: >- - Human-readable label that identifies the project included in the + description: Human-readable label that identifies the project included in the MongoDB Cloud organization. maxLength: 64 minLength: 1 pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ orgId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud - organization to which the project belongs. + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud organization to which the project belongs. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -24123,9 +22392,8 @@ components: description: Region usage restrictions that designate the project's AWS region. withDefaultAlertsSettings: type: boolean - description: >- - Flag that indicates whether to create the project with default alert - settings. + description: Flag that indicates whether to create the project with default + alert settings. writeOnly: true required: - clusterCount @@ -24138,8 +22406,7 @@ components: created: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created the alert configuration. + description: Date and time when MongoDB Cloud created the alert configuration. This parameter expresses its value in the ISO 8601 timestamp format in UTC. @@ -24147,15 +22414,13 @@ components: enabled: type: boolean default: false - description: >- - Flag that indicates whether someone enabled this alert configuration - for the specified project. + description: Flag that indicates whether someone enabled this alert + configuration for the specified project. eventTypeName: - $ref: '#/components/schemas/ServerlessEventTypeViewAlertable' + $ref: "#/components/schemas/ServerlessEventTypeViewAlertable" groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that owns this alert configuration. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -24164,8 +22429,7 @@ components: readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this alert + description: Unique 24-hexadecimal digit string that identifies this alert configuration. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -24174,15 +22438,14 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true matchers: type: array @@ -24193,126 +22456,96 @@ components: Alternatively: - List of rules that determine whether MongoDB Cloud checks an object - for the alert configuration. You can filter using the matchers array - if the **eventTypeName** specifies an event for a host, replica set, - or sharded cluster. + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. Alternatively: - List of rules that determine whether MongoDB Cloud checks an object - for the alert configuration. You can filter using the matchers array - if the **eventTypeName** specifies an event for a host, replica set, - or sharded cluster. + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. Alternatively: - No matchers are available for these alert types. The list is always - empty. + No matchers are available for these alert types. The list is always empty. Alternatively: - List of rules that determine whether MongoDB Cloud checks an object - for the alert configuration. You can filter using the matchers array - if the **eventTypeName** specifies an event for a host, replica set, - or sharded cluster. + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. Alternatively: - No matchers are available for these alert types. The list is always - empty. + No matchers are available for these alert types. The list is always empty. Alternatively: - No matchers are available for these alert types. The list is always - empty. + No matchers are available for these alert types. The list is always empty. Alternatively: - List of rules that determine whether MongoDB Cloud checks an object - for the alert configuration. You can filter using the matchers array - if the **eventTypeName** specifies an event for a host, replica set, - or sharded cluster. + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. Alternatively: - List of rules that determine whether MongoDB Cloud checks an object - for the alert configuration. You can filter using the matchers array - if the **eventTypeName** specifies an event for a host, replica set, - or sharded cluster. + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. Alternatively: - No matchers are available for these alert types. The list is always - empty. + No matchers are available for these alert types. The list is always empty. Alternatively: - List of rules that determine whether MongoDB Cloud checks an object - for the alert configuration. You can filter using the matchers array - if the **eventTypeName** specifies an event for a host, replica set, - or sharded cluster. + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. Alternatively: - List of rules that determine whether MongoDB Cloud checks an object - for the alert configuration. You can filter using the matchers array - if the **eventTypeName** specifies an event for a host, replica set, - or sharded cluster. + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. You can filter using the matchers array if the **eventTypeName** specifies an event for a host, replica set, or sharded cluster. Alternatively: - No matchers are available for these alert types. The list is always - empty. + No matchers are available for these alert types. The list is always empty. items: type: object readOnly: true notifications: type: array - description: >- - List that contains the targets that MongoDB Cloud sends + description: List that contains the targets that MongoDB Cloud sends notifications. items: - $ref: '#/components/schemas/AlertsNotificationRootForGroup' + $ref: "#/components/schemas/AlertsNotificationRootForGroup" updated: type: string format: date-time - description: >- - Date and time when someone last updated this alert configuration. + description: Date and time when someone last updated this alert configuration. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true metricThreshold: - $ref: '#/components/schemas/ServerlessMetricThreshold' + $ref: "#/components/schemas/ServerlessMetricThreshold" threshold: - $ref: '#/components/schemas/GreaterThanRawThreshold' + $ref: "#/components/schemas/GreaterThanRawThreshold" GroupInvitation: type: object properties: createdAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud sent the invitation. This parameter - expresses its value in ISO 8601 format in UTC. + description: Date and time when MongoDB Cloud sent the invitation. This + parameter expresses its value in ISO 8601 format in UTC. readOnly: true expiresAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud expires the invitation. This + description: Date and time when MongoDB Cloud expires the invitation. This parameter expresses its value in ISO 8601 format in UTC. readOnly: true groupId: @@ -24325,8 +22558,7 @@ components: readOnly: true groupName: type: string - description: >- - Human-readable label that identifies the project to which you + description: Human-readable label that identifies the project to which you invited the MongoDB Cloud user. maxLength: 64 minLength: 1 @@ -24334,8 +22566,7 @@ components: readOnly: true id: type: string - description: >- - Unique 24-hexadecimal character string that identifies the + description: Unique 24-hexadecimal character string that identifies the invitation. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -24349,20 +22580,18 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true roles: type: array - description: >- - One or more organization or project level roles to assign to the + description: One or more organization or project level roles to assign to the MongoDB Cloud user. items: type: string @@ -24377,8 +22606,7 @@ components: properties: roles: type: array - description: >- - One or more organization or project level roles to assign to the + description: One or more organization or project level roles to assign to the MongoDB Cloud user. items: type: string @@ -24386,16 +22614,14 @@ components: username: type: string format: email - description: >- - Email address of the MongoDB Cloud user invited to the specified + description: Email address of the MongoDB Cloud user invited to the specified project. GroupInvitationUpdateRequest: type: object properties: roles: type: array - description: >- - One or more organization or project level roles to assign to the + description: One or more organization or project level roles to assign to the MongoDB Cloud user. items: type: string @@ -24405,8 +22631,7 @@ components: properties: autoDeferOnceEnabled: type: boolean - description: >- - Flag that indicates whether MongoDB Cloud should defer all + description: Flag that indicates whether MongoDB Cloud should defer all maintenance windows for one week after you enable them. dayOfWeek: type: integer @@ -24438,16 +22663,14 @@ components: hourOfDay: type: integer format: int32 - description: >- - Zero-based integer that represents the hour of the of the day that + description: Zero-based integer that represents the hour of the of the day that the maintenance window starts according to a 24-hour clock. Use `0` for midnight and `12` for noon. maximum: 23 minimum: 0 startASAP: type: boolean - description: >- - Flag that indicates whether MongoDB Cloud starts the maintenance + description: Flag that indicates whether MongoDB Cloud starts the maintenance window immediately upon receiving this request. To start the maintenance window immediately for your project, MongoDB Cloud must have maintenance scheduled and you must set a maintenance window. @@ -24462,8 +22685,7 @@ components: properties: name: type: string - description: >- - Human-readable label that identifies the project included in the + description: Human-readable label that identifies the project included in the MongoDB Cloud organization. GroupSettings: type: object @@ -24471,41 +22693,34 @@ components: properties: isCollectDatabaseSpecificsStatisticsEnabled: type: boolean - description: >- - Flag that indicates whether to collect database-specific metrics - for the specified project. + description: Flag that indicates whether to collect database-specific + metrics for the specified project. isDataExplorerEnabled: type: boolean - description: >- - Flag that indicates whether to enable the Data Explorer for the + description: Flag that indicates whether to enable the Data Explorer for the specified project. isExtendedStorageSizesEnabled: type: boolean - description: >- - Flag that indicates whether to enable extended storage sizes for + description: Flag that indicates whether to enable extended storage sizes for the specified project. isPerformanceAdvisorEnabled: type: boolean - description: >- - Flag that indicates whether to enable the Performance Advisor and + description: Flag that indicates whether to enable the Performance Advisor and Profiler for the specified project. isRealtimePerformancePanelEnabled: type: boolean - description: >- - Flag that indicates whether to enable the Real Time Performance + description: Flag that indicates whether to enable the Real Time Performance Panel for the specified project. isSchemaAdvisorEnabled: type: boolean - description: >- - Flag that indicates whether to enable the Schema Advisor for the + description: Flag that indicates whether to enable the Schema Advisor for the specified project. HardwareSpec: type: object - description: >- - Hardware specifications for all electable nodes deployed in the region. - Electable nodes can become the primary and can enable local reads. If - you don't specify this option, MongoDB Cloud deploys no electable nodes - to the region. + description: Hardware specifications for all electable nodes deployed in the + region. Electable nodes can become the primary and can enable local + reads. If you don't specify this option, MongoDB Cloud deploys no + electable nodes to the region. properties: diskIOPS: type: integer @@ -24517,25 +22732,19 @@ components: - set `"replicationSpecs[n].regionConfigs[m].providerName" : "AWS"`. - - set - `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" - : "M30"` or greater not including `Mxx_NVME` tiers. + - set `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" : "M30"` or greater not including `Mxx_NVME` tiers. - The maximum input/output operations per second (IOPS) depend on the - selected **.instanceSize** and **.diskSizeGB**. + The maximum input/output operations per second (IOPS) depend on the selected **.instanceSize** and **.diskSizeGB**. This parameter defaults to the cluster tier's standard IOPS value. Changing this value impacts cluster cost. - MongoDB Cloud enforces minimum ratios of storage capacity to system - memory for given cluster tiers. This keeps cluster performance - consistent with large datasets. + MongoDB Cloud enforces minimum ratios of storage capacity to system memory for given cluster tiers. This keeps cluster performance consistent with large datasets. - - Instance sizes `M10` to `M40` have a ratio of disk capacity to - system memory of 60:1. + - Instance sizes `M10` to `M40` have a ratio of disk capacity to system memory of 60:1. - Instance sizes greater than `M40` have a ratio of 120:1. ebsVolumeType: @@ -24545,16 +22754,13 @@ components: Type of storage you want to attach to your AWS-provisioned cluster. - - `STANDARD` volume types can't exceed the default input/output - operations per second (IOPS) rate for the selected volume size. + - `STANDARD` volume types can't exceed the default input/output operations per second (IOPS) rate for the selected volume size. - - `PROVISIONED` volume types must fall within the allowable IOPS - range for the selected volume size. + - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. instanceSize: type: string - description: >- - Hardware specification for the instance sizes in this region. Each + description: Hardware specification for the instance sizes in this region. Each instance size has a default storage and memory capacity. The instance size you select applies to all the data-bearing hosts in your instance size. @@ -24562,32 +22768,27 @@ components: nodeCount: type: integer format: int32 - description: >- - Number of nodes of the given type for MongoDB Cloud to deploy to the - region. + description: Number of nodes of the given type for MongoDB Cloud to deploy to + the region. IndexOptions: type: object - description: >- - One or more settings that determine how the MongoDB Cloud creates this - MongoDB index. + description: One or more settings that determine how the MongoDB Cloud creates + this MongoDB index. externalDocs: description: Index Options - url: >- - https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options + url: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options properties: 2dsphereIndexVersion: type: integer format: int32 default: 3 - description: >- - Index version number applied to the 2dsphere index. MongoDB 3.2 and + description: Index version number applied to the 2dsphere index. MongoDB 3.2 and later use version 3. Use this option to override the default version number. This option applies to the **2dsphere** index type only. background: type: boolean default: false - description: >- - Flag that indicates whether MongoDB should build the index in the + description: Flag that indicates whether MongoDB should build the index in the background. This applies to MongoDB databases running feature compatibility version 4.0 or earlier. MongoDB databases running FCV 4.2 or later build indexes using an optimized build process. This @@ -24600,8 +22801,7 @@ components: type: integer format: int32 default: 26 - description: >- - Number of precision applied to the stored geohash value of the + description: Number of precision applied to the stored geohash value of the location data. This option applies to the **2d** index type only. bucketSize: type: integer @@ -24625,26 +22825,21 @@ components: statements. Accordingly, the can be either of the following: - 1 or true to include the field and recursively all fields it is a - prefix of in the index + 1 or true to include the field and recursively all fields it is a prefix of in the index - 0 or false to exclude the field and recursively all fields it is a - prefix of from the index. + 0 or false to exclude the field and recursively all fields it is a prefix of from the index. description: >- The columnstoreProjection document allows to include or exclude subschemas schema. One cannot combine inclusion and exclusion statements. Accordingly, the can be either of the following: - 1 or true to include the field and recursively all fields it is a - prefix of in the index + 1 or true to include the field and recursively all fields it is a prefix of in the index - 0 or false to exclude the field and recursively all fields it is a - prefix of from the index. + 0 or false to exclude the field and recursively all fields it is a prefix of from the index. default_language: type: string default: english - description: >- - Human language that determines the list of stop words and the rules + description: Human language that determines the list of stop words and the rules for the stemmer and tokenizer. This option accepts the supported languages using its name in lowercase english or the ISO 639-2 code. If you set this parameter to `"none"`, then the text search uses @@ -24653,42 +22848,36 @@ components: expireAfterSeconds: type: integer format: int32 - description: >- - Number of seconds that MongoDB retains documents in a Time To Live + description: Number of seconds that MongoDB retains documents in a Time To Live (TTL) index. hidden: type: boolean default: false - description: >- - Flag that determines whether the index is hidden from the query + description: Flag that determines whether the index is hidden from the query planner. A hidden index is not evaluated as part of the query plan selection. language_override: type: string default: language - description: >- - Human-readable label that identifies the document parameter that + description: Human-readable label that identifies the document parameter that contains the override language for the document. This option applies to the **text** index type only. max: type: integer format: int32 default: 180 - description: >- - Upper inclusive boundary to limit the longitude and latitude values. - This option applies to the 2d index type only. + description: Upper inclusive boundary to limit the longitude and latitude + values. This option applies to the 2d index type only. min: type: integer format: int32 default: -180 - description: >- - Lower inclusive boundary to limit the longitude and latitude values. - This option applies to the 2d index type only. + description: Lower inclusive boundary to limit the longitude and latitude + values. This option applies to the 2d index type only. name: type: string - description: >- - Human-readable label that identifies this index. This option applies - to all index types. + description: Human-readable label that identifies this index. This option + applies to all index types. partialFilterExpression: type: object additionalProperties: @@ -24737,33 +22926,27 @@ components: `2dsphere`, `2d`, `geoHaystack`, `text`. - Compound indexes that includes one or more indexes with `2dsphere` - keys alongside other key types, only the `2dsphere` index parameters - determine which documents the index references. If you run MongoDB - 3.2 or later, use partial indexes. This option applies to all index - types. + Compound indexes that includes one or more indexes with `2dsphere` keys alongside other key types, only the `2dsphere` index parameters determine which documents the index references. If you run MongoDB 3.2 or later, use partial indexes. This option applies to all index types. storageEngine: type: object additionalProperties: - description: >- - Storage engine set for the specific index. This value can be set + description: 'Storage engine set for the specific index. This value can be set only at creation. This option uses the following format: `"storageEngine" : { "" : "" }` MongoDB validates storage engine configuration options when creating indexes. To support replica sets with members with different storage engines, MongoDB logs these options to the oplog - during replication. This option applies to all index types. + during replication. This option applies to all index types.' externalDocs: description: MongoDB Server Storage Engines url: https://docs.mongodb.com/manual/core/storage-engines/ - description: >- - Storage engine set for the specific index. This value can be set + description: 'Storage engine set for the specific index. This value can be set only at creation. This option uses the following format: `"storageEngine" : { "" : "" }` MongoDB validates storage engine configuration options when creating indexes. To support replica sets with members with different storage engines, MongoDB logs these options to the oplog during replication. - This option applies to all index types. + This option applies to all index types.' externalDocs: description: MongoDB Server Storage Engines url: https://docs.mongodb.com/manual/core/storage-engines/ @@ -24771,31 +22954,28 @@ components: type: integer format: int32 default: 3 - description: >- - Version applied to this text index. MongoDB 3.2 and later use + description: Version applied to this text index. MongoDB 3.2 and later use version `3`. Use this option to override the default version number. This option applies to the **text** index type only. unique: type: boolean default: false - description: >- - Flag that indicates whether this index can accept insertion or + description: "Flag that indicates whether this index can accept insertion or update of documents when the index key value matches an existing - index key value. Set `"unique" : true` to set this index as unique. - You can't set a hashed index to be unique. This option applies to - all index types. This option is unsupported for rolling indexes. + index key value. Set `\"unique\" : true` to set this index as + unique. You can't set a hashed index to be unique. This option + applies to all index types. This option is unsupported for rolling + indexes." weights: type: object additionalProperties: - description: >- - Relative importance to place upon provided index parameters. This + description: Relative importance to place upon provided index parameters. This object expresses this as key/value pairs of index parameter and weight to apply to that parameter. You can specify weights for some or all the indexed parameters. The weight must be an integer between 1 and 99,999. MongoDB 5.0 and later can apply **weights** to **text** indexes only. - description: >- - Relative importance to place upon provided index parameters. This + description: Relative importance to place upon provided index parameters. This object expresses this as key/value pairs of index parameter and weight to apply to that parameter. You can specify weights for some or all the indexed parameters. The weight must be an integer between @@ -24808,8 +22988,7 @@ components: properties: _id: type: string - description: >- - Unique 24-hexadecimal character string that identifies a Data Lake + description: Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -24827,8 +23006,7 @@ components: readOnly: true datasetName: type: string - description: >- - Human-readable label that identifies the dataset that Atlas + description: Human-readable label that identifies the dataset that Atlas generates during this pipeline run. You can use this dataset as a `dataSource` in a Federated Database collection. example: v1$atlas$snapshot$Cluster0$myDatabase$myCollection$19700101T000000Z @@ -24844,8 +23022,7 @@ components: lastUpdatedDate: type: string format: date-time - description: >- - Timestamp that indicates the last time that the pipeline run was + description: Timestamp that indicates the last time that the pipeline run was updated. readOnly: true phase: @@ -24854,8 +23031,7 @@ components: readOnly: true pipelineId: type: string - description: >- - Unique 24-hexadecimal character string that identifies a Data Lake + description: Unique 24-hexadecimal character string that identifies a Data Lake Pipeline. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -24864,8 +23040,7 @@ components: readOnly: true snapshotId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the snapshot + description: Unique 24-hexadecimal character string that identifies the snapshot of a cluster. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -24877,7 +23052,7 @@ components: description: State of the pipeline run. readOnly: true stats: - $ref: '#/components/schemas/PipelineRunStats' + $ref: "#/components/schemas/PipelineRunStats" title: Data Lake Pipeline Run IngestionSink: type: object @@ -24900,7 +23075,7 @@ components: type: array description: Ordered fields used to physically organize data in the destination. items: - $ref: '#/components/schemas/DataLakePipelinesPartitionField' + $ref: "#/components/schemas/DataLakePipelinesPartitionField" title: Ingestion Destination IngestionSource: type: object @@ -24928,9 +23103,7 @@ components: readOnly: true policyItemId: type: string - description: >- - Unique 24-hexadecimal character string that identifies a policy - item. + description: Unique 24-hexadecimal character string that identifies a policy item. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -24942,8 +23115,7 @@ components: properties: clusterName: type: string - description: >- - Human-readable label that identifies the cluster that incurred the + description: Human-readable label that identifies the cluster that incurred the charge. maxLength: 64 minLength: 1 @@ -24952,31 +23124,27 @@ components: created: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this line item. This + description: Date and time when MongoDB Cloud created this line item. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true discountCents: type: integer format: int64 - description: >- - Sum by which MongoDB discounted this line item. MongoDB Cloud + description: Sum by which MongoDB discounted this line item. MongoDB Cloud expresses this value in cents (100ths of one US Dollar). The resource returns this parameter when a discount applies. readOnly: true endDate: type: string format: date-time - description: >- - Date and time when when MongoDB Cloud finished charging for this + description: Date and time when when MongoDB Cloud finished charging for this line item. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project + description: Unique 24-hexadecimal digit string that identifies the project associated to this line item. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -24993,58 +23161,49 @@ components: percentDiscount: type: number format: float - description: >- - Percentage by which MongoDB discounted this line item. The resource + description: Percentage by which MongoDB discounted this line item. The resource returns this parameter when a discount applies. readOnly: true quantity: type: number format: double - description: >- - Number of units included for the line item. These can be expressions - of storage (GB), time (hours), or other units. + description: Number of units included for the line item. These can be + expressions of storage (GB), time (hours), or other units. readOnly: true sku: type: string - description: >- - Human-readable description of the service that this line item + description: Human-readable description of the service that this line item provided. This Stock Keeping Unit (SKU) could be the instance type, a support charge, advanced security, or another service. readOnly: true startDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud began charging for this line item. + description: Date and time when MongoDB Cloud began charging for this line item. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true stitchAppName: type: string - description: >- - Human-readable label that identifies the Atlas App Services + description: Human-readable label that identifies the Atlas App Services application associated with this line item. externalDocs: description: Create a new Atlas App Service - url: >- - https://www.mongodb.com/docs/atlas/app-services/manage-apps/create/create-with-ui/ + url: https://www.mongodb.com/docs/atlas/app-services/manage-apps/create/create-with-ui/ readOnly: true tags: type: object additionalProperties: type: array - description: >- - A map of key-value pairs corresponding to the tags associated with + description: A map of key-value pairs corresponding to the tags associated with the line item resource. items: type: string - description: >- - A map of key-value pairs corresponding to the tags associated - with the line item resource. + description: A map of key-value pairs corresponding to the tags associated with + the line item resource. readOnly: true readOnly: true - description: >- - A map of key-value pairs corresponding to the tags associated with + description: A map of key-value pairs corresponding to the tags associated with the line item resource. readOnly: true tierLowerBound: @@ -25054,8 +23213,7 @@ components: Lower bound for usage amount range in current SKU tier. - **NOTE**: **lineItems[n].tierLowerBound** appears only if your - **lineItems[n].sku** is tiered. + **NOTE**: **lineItems[n].tierLowerBound** appears only if your **lineItems[n].sku** is tiered. readOnly: true tierUpperBound: type: number @@ -25064,21 +23222,18 @@ components: Upper bound for usage amount range in current SKU tier. - **NOTE**: **lineItems[n].tierUpperBound** appears only if your - **lineItems[n].sku** is tiered. + **NOTE**: **lineItems[n].tierUpperBound** appears only if your **lineItems[n].sku** is tiered. readOnly: true totalPriceCents: type: integer format: int64 - description: >- - Sum of the cost set for this line item. MongoDB Cloud expresses this - value in cents (100ths of one US Dollar) and calculates this value - as **unitPriceDollars** × **quantity** × 100. + description: Sum of the cost set for this line item. MongoDB Cloud expresses + this value in cents (100ths of one US Dollar) and calculates this + value as **unitPriceDollars** × **quantity** × 100. readOnly: true unit: type: string - description: >- - Element used to express what **quantity** this line item measures. + description: Element used to express what **quantity** this line item measures. This value can be elements of time, storage capacity, and the like. readOnly: true unitPriceDollars: @@ -25089,27 +23244,23 @@ components: title: Line Item LDAPSecuritySettings: type: object - description: >- - Lightweight Directory Access Protocol (LDAP) over Transport Layer + description: Lightweight Directory Access Protocol (LDAP) over Transport Layer Security (TLS) configuration details that apply to the specified project. properties: authenticationEnabled: type: boolean - description: >- - Flag that indicates whether users can authenticate using an + description: Flag that indicates whether users can authenticate using an Lightweight Directory Access Protocol (LDAP) host. authorizationEnabled: type: boolean - description: >- - Flag that indicates whether users can authorize access to MongoDB + description: Flag that indicates whether users can authorize access to MongoDB Cloud resources using an Lightweight Directory Access Protocol (LDAP) host. authzQueryTemplate: type: string - default: '{USER}?memberOf?base' - description: >- - Lightweight Directory Access Protocol (LDAP) query template that + default: "{USER}?memberOf?base" + description: Lightweight Directory Access Protocol (LDAP) query template that MongoDB Cloud runs to obtain the LDAP groups associated with the authenticated user. MongoDB Cloud uses this parameter only for user authorization. Use the `{USER}` placeholder in the Uniform Resource @@ -25117,17 +23268,15 @@ components: relates to the host specified with the hostname. Format this query according to [RFC 4515](https://tools.ietf.org/search/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). - example: '{USER}?memberOf?base' + example: "{USER}?memberOf?base" bindPassword: type: string - description: >- - Password that MongoDB Cloud uses to authenticate the + description: Password that MongoDB Cloud uses to authenticate the **bindUsername**. writeOnly: true bindUsername: type: string - description: >- - Full Distinguished Name (DN) of the Lightweight Directory Access + description: Full Distinguished Name (DN) of the Lightweight Directory Access Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP host. LDAP distinguished names must be formatted according to RFC 2253. @@ -25135,60 +23284,52 @@ components: externalDocs: description: RFC 2253 url: https://tools.ietf.org/html/2253 - pattern: >- - ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ caCertificate: type: string - description: >- - Certificate Authority (CA) certificate that MongoDB Cloud uses to + description: 'Certificate Authority (CA) certificate that MongoDB Cloud uses to verify the identity of the Lightweight Directory Access Protocol (LDAP) host. MongoDB Cloud allows self-signed certificates. To delete an assigned value, pass an empty string: `"caCertificate": - ""`. + ""`.' hostname: type: string - description: >- - Human-readable label that identifies the hostname or Internet + description: Human-readable label that identifies the hostname or Internet Protocol (IP) address of the Lightweight Directory Access Protocol (LDAP) host. This host must have access to the internet or have a Virtual Private Cloud (VPC) peering connection to your cluster. - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true port: type: integer format: int32 default: 636 - description: >- - Port to which the Lightweight Directory Access Protocol (LDAP) host + description: Port to which the Lightweight Directory Access Protocol (LDAP) host listens for client connections. userToDNMapping: type: array - description: >- - User-to-Distinguished Name (DN) map that MongoDB Cloud uses to + description: User-to-Distinguished Name (DN) map that MongoDB Cloud uses to transform a Lightweight Directory Access Protocol (LDAP) username into an LDAP DN. items: - $ref: '#/components/schemas/UserToDNMapping' + $ref: "#/components/schemas/UserToDNMapping" title: LDAP Security Settings LDAPVerifyConnectivityJobRequest: type: object properties: groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project + description: Unique 24-hexadecimal digit string that identifies the project associated with this Lightweight Directory Access Protocol (LDAP) over Transport Layer Security (TLS) configuration. example: 32b6e34b3d91647abb20e7b8 @@ -25198,22 +23339,20 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true request: - $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequestParams' + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequestParams" requestId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this request to + description: Unique 24-hexadecimal digit string that identifies this request to verify an Lightweight Directory Access Protocol (LDAP) configuration. example: 32b6e34b3d91647abb20e7b8 @@ -25223,32 +23362,29 @@ components: readOnly: true status: type: string - description: >- - Human-readable string that indicates the status of the Lightweight + description: Human-readable string that indicates the status of the Lightweight Directory Access Protocol (LDAP) over Transport Layer Security (TLS) configuration. readOnly: true validations: type: array - description: >- - List that contains the validation messages related to the + description: List that contains the validation messages related to the verification of the provided Lightweight Directory Access Protocol (LDAP) over Transport Layer Security (TLS) configuration details. The list contains a document for each test that MongoDB Cloud runs. MongoDB Cloud stops running tests after the first failure. items: - $ref: '#/components/schemas/LDAPVerifyConnectivityJobRequestValidation' + $ref: "#/components/schemas/LDAPVerifyConnectivityJobRequestValidation" readOnly: true LDAPVerifyConnectivityJobRequestParams: type: object - description: >- - Request information needed to verify an Lightweight Directory Access - Protocol (LDAP) over Transport Layer Security (TLS) configuration. The - response does not return the **bindPassword**. + description: Request information needed to verify an Lightweight Directory + Access Protocol (LDAP) over Transport Layer Security (TLS) + configuration. The response does not return the **bindPassword**. properties: authzQueryTemplate: type: string - default: '{USER}?memberOf?base' + default: "{USER}?memberOf?base" description: >- Lightweight Directory Access Protocol (LDAP) query template that MongoDB Cloud applies to create an LDAP query to return the LDAP @@ -25256,23 +23392,17 @@ components: uses this parameter only for user authorization. - Use the `{USER}` placeholder in the Uniform Resource Locator (URL) - to substitute the authenticated username. The query relates to the - host specified with the hostname. Format this query per [RFC - 4515](https://tools.ietf.org/search/rfc4515) and [RFC - 4516](https://datatracker.ietf.org/doc/html/rfc4516). - example: '{USER}?memberOf?base' + Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query per [RFC 4515](https://tools.ietf.org/search/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). + example: "{USER}?memberOf?base" writeOnly: true bindPassword: type: string - description: >- - Password that MongoDB Cloud uses to authenticate the + description: Password that MongoDB Cloud uses to authenticate the **bindUsername**. writeOnly: true bindUsername: type: string - description: >- - Full Distinguished Name (DN) of the Lightweight Directory Access + description: Full Distinguished Name (DN) of the Lightweight Directory Access Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP host. LDAP distinguished names must be formatted according to RFC 2253. @@ -25280,43 +23410,37 @@ components: externalDocs: description: RFC 2253 url: https://tools.ietf.org/html/2253 - pattern: >- - ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ caCertificate: type: string - description: >- - Certificate Authority (CA) certificate that MongoDB Cloud uses to + description: 'Certificate Authority (CA) certificate that MongoDB Cloud uses to verify the identity of the Lightweight Directory Access Protocol (LDAP) host. MongoDB Cloud allows self-signed certificates. To delete an assigned value, pass an empty string: `"caCertificate": - ""`. + ""`.' hostname: type: string - description: >- - Human-readable label that identifies the hostname or Internet + description: Human-readable label that identifies the hostname or Internet Protocol (IP) address of the Lightweight Directory Access Protocol (LDAP) host. This host must have access to the internet or have a Virtual Private Cloud (VPC) peering connection to your cluster. - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true port: type: integer format: int32 default: 636 - description: >- - IANA port to which the Lightweight Directory Access Protocol (LDAP) + description: IANA port to which the Lightweight Directory Access Protocol (LDAP) host listens for client connections. required: - bindPassword @@ -25325,21 +23449,18 @@ components: - port LDAPVerifyConnectivityJobRequestValidation: type: object - description: >- - One test that MongoDB Cloud runs to test verification of the provided - Lightweight Directory Access Protocol (LDAP) over Transport Layer - Security (TLS) configuration details. + description: One test that MongoDB Cloud runs to test verification of the + provided Lightweight Directory Access Protocol (LDAP) over Transport + Layer Security (TLS) configuration details. properties: status: type: string - description: >- - Human-readable string that indicates the result of this verification - test. + description: Human-readable string that indicates the result of this + verification test. readOnly: true validationType: type: string - description: >- - Human-readable label that identifies this verification test that + description: Human-readable label that identifies this verification test that MongoDB Cloud runs. readOnly: true readOnly: true @@ -25350,8 +23471,7 @@ components: acceptDataRisksAndForceReplicaSetReconfig: type: string format: date-time - description: >- - If reconfiguration is necessary to regain a primary due to a + description: If reconfiguration is necessary to regain a primary due to a regional outage, submit this field alongside your topology reconfiguration to request a new regional outage resistant topology. Forced reconfigurations during an outage of the majority of @@ -25362,52 +23482,47 @@ components: **acceptDataRisksAndForceReplicaSetReconfig** to the current date. externalDocs: description: Reconfiguring a Replica Set during a regional outage - url: >- - https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set + url: https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set autoScaling: - $ref: '#/components/schemas/ClusterAutoScalingSettings' + $ref: "#/components/schemas/ClusterAutoScalingSettings" backupEnabled: type: boolean - description: >- - Flag that indicates whether the cluster can perform backups. If set + description: Flag that indicates whether the cluster can perform backups. If set to `true`, the cluster can perform backups. You must set this value to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated clusters and Shared Cluster Backups for tenant clusters. If set to `false`, the cluster doesn't use MongoDB Cloud backups. biConnector: - $ref: '#/components/schemas/BiConnector' + $ref: "#/components/schemas/BiConnector" clusterType: type: string description: Configuration of nodes that comprise the cluster. connectionStrings: - $ref: '#/components/schemas/ClusterConnectionStrings' + $ref: "#/components/schemas/ClusterConnectionStrings" createDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this serverless instance. + description: Date and time when MongoDB Cloud created this serverless instance. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true diskSizeGB: type: number format: double - description: >- - Storage capacity that the host's root volume possesses expressed in + description: Storage capacity that the host's root volume possesses expressed in gigabytes. Increase this number to add capacity. MongoDB Cloud requires this parameter if you set **replicationSpecs**. If you specify a disk size below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations - depend on whether you choose the default value or a custom value. - The maximum value for disk storage cannot exceed 50 times the - maximum RAM for the selected cluster. If you require more storage - space, consider upgrading your cluster to a higher tier. + depend on whether you choose the default value or a custom + value. The maximum value for disk storage cannot exceed 50 times + the maximum RAM for the selected cluster. If you require more + storage space, consider upgrading your cluster to a higher tier. maximum: 4096 minimum: 10 encryptionAtRestProvider: type: string - description: >- - Cloud service provider that manages your customer keys to provide an - additional layer of Encryption at Rest for the cluster. + description: Cloud service provider that manages your customer keys to provide + an additional layer of Encryption at Rest for the cluster. externalDocs: description: Encryption at Rest using Customer Key Management url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ @@ -25435,29 +23550,24 @@ components: doesn't display your labels. - Cluster labels will be deprecated in a future release. We strongly - recommend that you use [resource - tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) - instead. + Cluster labels will be deprecated in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. items: - $ref: '#/components/schemas/ComponentLabel' + $ref: "#/components/schemas/ComponentLabel" links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true mongoDBMajorVersion: type: string - default: '6.0' - description: >- - Major MongoDB version of the cluster. MongoDB Cloud deploys the + default: "6.0" + description: Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version. mongoDBVersion: type: string @@ -25465,8 +23575,7 @@ components: pattern: ([\d]+\.[\d]+\.[\d]+) mongoURI: type: string - description: >- - Base connection string that you can use to connect to the cluster. + description: Base connection string that you can use to connect to the cluster. MongoDB Cloud displays the string only after the cluster starts, not while it builds the cluster. externalDocs: @@ -25476,14 +23585,12 @@ components: mongoURIUpdated: type: string format: date-time - description: >- - Date and time when someone last updated the connection string. + description: Date and time when someone last updated the connection string. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true mongoURIWithOptions: type: string - description: >- - Connection string that you can use to connect to the cluster + description: Connection string that you can use to connect to the cluster including the `replicaSet`, `ssl`, and `authSource` query parameters with values appropriate for the cluster. You may need to add MongoDB database users. The response returns this parameter once the cluster @@ -25502,8 +23609,7 @@ components: type: integer format: int32 default: 1 - description: >- - Number of shards up to 50 to deploy for a sharded cluster. The + description: Number of shards up to 50 to deploy for a sharded cluster. The resource returns `1` to indicate a replica set and values of `2` and higher to indicate a sharded cluster. The returned value equals the number of shards in the cluster. @@ -25517,34 +23623,31 @@ components: description: Flag that indicates whether the cluster is paused. pitEnabled: type: boolean - description: >- - Flag that indicates whether the cluster uses continuous cloud + description: Flag that indicates whether the cluster uses continuous cloud backups. externalDocs: description: Continuous Cloud Backups url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ providerBackupEnabled: type: boolean - description: >- - Flag that indicates whether the M10 or higher cluster can perform + description: Flag that indicates whether the M10 or higher cluster can perform Cloud Backups. If set to `true`, the cluster can perform backups. If this and **backupEnabled** are set to `false`, the cluster doesn't use MongoDB Cloud backups. providerSettings: - $ref: '#/components/schemas/ClusterProviderSettings' + $ref: "#/components/schemas/ClusterProviderSettings" replicationFactor: type: integer format: int32 default: 3 deprecated: true - description: >- - Number of members that belong to the replica set. Each member + description: Number of members that belong to the replica set. Each member retains a copy of your databases, providing high availability and data redundancy. Use **replicationSpecs** instead. replicationSpec: type: object additionalProperties: - $ref: '#/components/schemas/RegionSpec' + $ref: "#/components/schemas/RegionSpec" description: Physical location where MongoDB Cloud provisions cluster nodes. title: Region Configuration replicationSpecs: @@ -25553,23 +23656,19 @@ components: List of settings that configure your cluster regions. - - For Global Clusters, each object in the array represents one zone - where MongoDB Cloud deploys your clusters nodes. + - For Global Clusters, each object in the array represents one zone where MongoDB Cloud deploys your clusters nodes. - - For non-Global sharded clusters and replica sets, the single - object represents where MongoDB Cloud deploys your clusters nodes. + - For non-Global sharded clusters and replica sets, the single object represents where MongoDB Cloud deploys your clusters nodes. items: - $ref: '#/components/schemas/LegacyReplicationSpec' + $ref: "#/components/schemas/LegacyReplicationSpec" rootCertType: type: string default: ISRGROOTX1 - description: >- - Root Certificate Authority that MongoDB Atlas clusters uses. MongoDB - Cloud supports Internet Security Research Group. + description: Root Certificate Authority that MongoDB Atlas clusters uses. + MongoDB Cloud supports Internet Security Research Group. srvAddress: type: string - description: >- - Connection string that you can use to connect to the cluster. The + description: Connection string that you can use to connect to the cluster. The `+srv` modifier forces the connection to use Transport Layer Security (TLS). The `mongoURI` parameter lists additional options. externalDocs: @@ -25578,33 +23677,29 @@ components: readOnly: true stateName: type: string - description: >- - Human-readable label that indicates the current operating condition + description: Human-readable label that indicates the current operating condition of the cluster. readOnly: true tags: type: array - description: >- - List that contains key-value pairs between 1 to 255 characters in + description: List that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster. externalDocs: description: Resource Tags url: https://dochub.mongodb.org/core/add-cluster-tag-atlas items: - $ref: '#/components/schemas/ResourceTag' + $ref: "#/components/schemas/ResourceTag" terminationProtectionEnabled: type: boolean default: false - description: >- - Flag that indicates whether termination protection is enabled on the - cluster. If set to `true`, MongoDB Cloud won't delete the cluster. - If set to `false`, MongoDB Cloud will delete the cluster. + description: Flag that indicates whether termination protection is enabled on + the cluster. If set to `true`, MongoDB Cloud won't delete the + cluster. If set to `false`, MongoDB Cloud will delete the cluster. versionReleaseSystem: type: string default: LTS - description: >- - Method by which the cluster maintains the MongoDB versions. If value - is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. + description: Method by which the cluster maintains the MongoDB versions. If + value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. title: Cluster Description LegacyReplicationSpec: type: object @@ -25616,13 +23711,10 @@ components: object for a zone in a Global Cluster. - - If you include existing zones in the request, you must specify - this parameter. + - If you include existing zones in the request, you must specify this parameter. - - If you add a new zone to an existing Global Cluster, you may - specify this parameter. The request deletes any existing zones in a - Global Cluster that you exclude from the request. + - If you add a new zone to an existing Global Cluster, you may specify this parameter. The request deletes any existing zones in a Global Cluster that you exclude from the request. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -25631,8 +23723,7 @@ components: type: integer format: int32 default: 1 - description: >- - Positive integer that specifies the number of shards to deploy in + description: Positive integer that specifies the number of shards to deploy in each specified zone If you set this value to `1` and **clusterType** is `SHARDED`, MongoDB Cloud deploys a single-shard sharded cluster. Don't create a sharded cluster with a single shard for production @@ -25641,28 +23732,25 @@ components: regionsConfig: type: object additionalProperties: - $ref: '#/components/schemas/RegionSpec' + $ref: "#/components/schemas/RegionSpec" description: Physical location where MongoDB Cloud provisions cluster nodes. title: Region Configuration zoneName: type: string - description: >- - Human-readable label that identifies the zone in a Global Cluster. + description: Human-readable label that identifies the zone in a Global Cluster. Provide this value only if **clusterType** is `GEOSHARDED`. Link: type: object properties: href: type: string - description: >- - Uniform Resource Locator (URL) that points another API resource to + description: Uniform Resource Locator (URL) that points another API resource to which this response has some relationship. This URL often begins with `https://cloud.mongodb.com/api/atlas`. example: https://cloud.mongodb.com/api/atlas rel: type: string - description: >- - Uniform Resource Locator (URL) that defines the semantic + description: Uniform Resource Locator (URL) that defines the semantic relationship between this resource and another API resource. This URL often begins with `https://cloud.mongodb.com/api/atlas`. example: self @@ -25671,15 +23759,13 @@ components: properties: href: type: string - description: >- - Uniform Resource Locator (URL) that points another API resource to + description: Uniform Resource Locator (URL) that points another API resource to which this response has some relationship. This URL often begins with `https://cloud.mongodb.com/api/atlas`. example: https://cloud.mongodb.com/api/atlas rel: type: string - description: >- - Uniform Resource Locator (URL) that defines the semantic + description: Uniform Resource Locator (URL) that defines the semantic relationship between this resource and another API resource. This URL often begins with `https://cloud.mongodb.com/api/atlas`. example: self @@ -25690,16 +23776,14 @@ components: type: array description: List of clusters that can be migrated to MongoDB Cloud. items: - $ref: '#/components/schemas/AvailableClustersDeployment' + $ref: "#/components/schemas/AvailableClustersDeployment" migrationHosts: type: array - description: >- - Hostname of MongoDB Agent list that you configured to perform a + description: Hostname of MongoDB Agent list that you configured to perform a migration. items: type: string - description: >- - Hostname of MongoDB Agent that you configured to perform a + description: Hostname of MongoDB Agent that you configured to perform a migration. name: type: string @@ -25709,9 +23793,8 @@ components: readOnly: true projectId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project to be - migrated. + description: Unique 24-hexadecimal digit string that identifies the project to + be migrated. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -25737,8 +23820,7 @@ components: readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project to + description: Unique 24-hexadecimal digit string that identifies the project to validate. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -25747,8 +23829,7 @@ components: readOnly: true sourceGroupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the source + description: Unique 24-hexadecimal digit string that identifies the source project. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -25756,8 +23837,7 @@ components: pattern: ^([a-f0-9]{24})$ status: type: string - description: >- - State of the specified validation job returned at the time of the + description: State of the specified validation job returned at the time of the request. readOnly: true LiveMigrationRequest: @@ -25765,8 +23845,7 @@ components: properties: _id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the migration + description: Unique 24-hexadecimal digit string that identifies the migration request. example: 507f1f77bcf86cd799439011 maxLength: 24 @@ -25774,11 +23853,10 @@ components: pattern: ^([a-f0-9]{24})$ readOnly: true destination: - $ref: '#/components/schemas/Destination' + $ref: "#/components/schemas/Destination" dropEnabled: type: boolean - description: >- - Flag that indicates whether the migration process drops all + description: Flag that indicates whether the migration process drops all collections from the destination cluster before the migration starts. writeOnly: true @@ -25791,7 +23869,7 @@ components: maxItems: 1 minItems: 1 source: - $ref: '#/components/schemas/Source' + $ref: "#/components/schemas/Source" required: - destination - dropEnabled @@ -25801,9 +23879,7 @@ components: properties: _id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the migration - job. + description: Unique 24-hexadecimal digit string that identifies the migration job. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -25812,29 +23888,24 @@ components: lagTimeSeconds: type: integer format: int64 - description: >- - Replication lag between the source and destination clusters. Atlas + description: Replication lag between the source and destination clusters. Atlas returns this setting only during an active migration, before the cutover phase. readOnly: true migrationHosts: type: array - description: >- - List of hosts running MongoDB Agents. These Agents can transfer your - MongoDB data between one source and one target cluster. + description: List of hosts running MongoDB Agents. These Agents can transfer + your MongoDB data between one source and one target cluster. items: type: string - description: >- - One host running a MongoDB Agent. This Agent can transfer your + description: One host running a MongoDB Agent. This Agent can transfer your MongoDB data between one source and one target cluster. example: vm001.example.com - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ readOnly: true readyForCutover: type: boolean - description: >- - Flag that indicates the migrated cluster can be cut over to MongoDB + description: Flag that indicates the migrated cluster can be cut over to MongoDB Atlas. readOnly: true status: @@ -25847,65 +23918,48 @@ components: |----------|-------------| - | NEW | Someone scheduled a local cluster migration to MongoDB - Atlas. | + | NEW | Someone scheduled a local cluster migration to MongoDB Atlas. | - | FAILED | The cluster migration to MongoDB Atlas - failed. | + | FAILED | The cluster migration to MongoDB Atlas failed. | - | COMPLETE | The cluster migration to MongoDB Atlas - succeeded. | + | COMPLETE | The cluster migration to MongoDB Atlas succeeded. | - | EXPIRED | MongoDB Atlas prepares to begin the cut over of the - migrating cluster when source and target clusters have almost - synchronized. If `"readyForCutover" : true`, this synchronization - starts a timer of 120 hours. You can extend this timer. If the timer - expires, MongoDB Atlas returns this status. | + | EXPIRED | MongoDB Atlas prepares to begin the cut over of the migrating cluster when source and target clusters have almost synchronized. If `"readyForCutover" : true`, this synchronization starts a timer of 120 hours. You can extend this timer. If the timer expires, MongoDB Atlas returns this status. | - | WORKING | The cluster migration to MongoDB Atlas is performing - one of the following tasks:
  • Preparing connections to source - and target clusters
  • Replicating data from source to - target
  • Verifying MongoDB Atlas connection - settings
  • Stopping replication after the cut over
| + | WORKING | The cluster migration to MongoDB Atlas is performing one of the following tasks:
  • Preparing connections to source and target clusters
  • Replicating data from source to target
  • Verifying MongoDB Atlas connection settings
  • Stopping replication after the cut over
| readOnly: true ManagedNamespaces: type: object properties: collection: type: string - description: >- - Human-readable label of the collection to manage for this Global + description: Human-readable label of the collection to manage for this Global Cluster. customShardKey: type: string - description: >- - Database parameter used to divide the *collection* into shards. + description: Database parameter used to divide the *collection* into shards. Global clusters require a compound shard key. This compound shard key combines the location parameter and the user-selected custom key. readOnly: true db: type: string - description: >- - Human-readable label of the database to manage for this Global + description: Human-readable label of the database to manage for this Global Cluster. isCustomShardKeyHashed: type: boolean default: false - description: >- - Flag that indicates whether someone hashed the custom shard key for + description: Flag that indicates whether someone hashed the custom shard key for the specified collection. If you set this value to `false`, MongoDB Cloud uses ranged sharding. externalDocs: description: Hashed Shard Keys - url: >- - https://www.mongodb.com/docs/manual/reference/method/sh.shardCollection/#hashed-shard-keys + url: https://www.mongodb.com/docs/manual/reference/method/sh.shardCollection/#hashed-shard-keys writeOnly: true isShardKeyUnique: type: boolean default: false - description: >- - Flag that indicates whether someone + description: Flag that indicates whether someone [hashed](https://www.mongodb.com/docs/manual/reference/method/sh.shardCollection/#hashed-shard-keys) the custom shard key. If this parameter returns `false`, this cluster uses [ranged @@ -25914,8 +23968,7 @@ components: numInitialChunks: type: integer format: int64 - description: >- - Minimum number of chunks to create initially when sharding an empty + description: Minimum number of chunks to create initially when sharding an empty collection with a [hashed shard key](https://www.mongodb.com/docs/manual/core/hashed-sharding/). externalDocs: @@ -25926,8 +23979,7 @@ components: presplitHashedZones: type: boolean default: false - description: >- - Flag that indicates whether MongoDB Cloud should create and + description: Flag that indicates whether MongoDB Cloud should create and distribute initial chunks for an empty or non-existing collection. MongoDB Cloud distributes data based on the defined zones and zone ranges for the collection. @@ -25944,20 +23996,18 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true partitionName: type: string - description: >- - Human-readable label of the disk or partition to which the + description: Human-readable label of the disk or partition to which the measurements apply. readOnly: true MeasurementsIndexes: @@ -25969,31 +24019,27 @@ components: readOnly: true databaseName: type: string - description: >- - Human-readable label that identifies the database that the specified - MongoDB process serves. + description: Human-readable label that identifies the database that the + specified MongoDB process serves. readOnly: true end: type: string format: date-time - description: >- - Date and time that specifies when to stop retrieving measurements. + description: Date and time that specifies when to stop retrieving measurements. If you set **end**, you must set **start**. You can't set this parameter and **period** in the same request. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true granularity: type: string - description: >- - Duration that specifies the interval between measurement data + description: Duration that specifies the interval between measurement data points. The parameter expresses its value in ISO 8601 timestamp format in UTC. If you set this parameter, you must set either **period** or **start** and **end**. readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project. The + description: Unique 24-hexadecimal digit string that identifies the project. The project contains MongoDB processes that you want to return. The MongoDB process can be either the `mongod` or `mongos`. example: 32b6e34b3d91647abb20e7b8 @@ -26016,38 +24062,34 @@ components: type: array description: List that contains the Atlas Search index stats measurements. items: - $ref: '#/components/schemas/MetricsMeasurement' + $ref: "#/components/schemas/MetricsMeasurement" readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true processId: type: string - description: >- - Combination of hostname and Internet Assigned Numbers Authority + description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ readOnly: true start: type: string format: date-time - description: >- - Date and time that specifies when to start retrieving measurements. + description: Date and time that specifies when to start retrieving measurements. If you set **start**, you must set **end**. You can't set this parameter and **period** in the same request. This parameter expresses its value in the ISO 8601 timestamp format in UTC. @@ -26058,24 +24100,21 @@ components: end: type: string format: date-time - description: >- - Date and time that specifies when to stop retrieving measurements. + description: Date and time that specifies when to stop retrieving measurements. If you set **end**, you must set **start**. You can't set this parameter and **period** in the same request. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true granularity: type: string - description: >- - Duration that specifies the interval between measurement data + description: Duration that specifies the interval between measurement data points. The parameter expresses its value in ISO 8601 timestamp format in UTC. If you set this parameter, you must set either **period** or **start** and **end**. readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project. The + description: Unique 24-hexadecimal digit string that identifies the project. The project contains MongoDB processes that you want to return. The MongoDB process can be either the `mongod` or `mongos`. example: 32b6e34b3d91647abb20e7b8 @@ -26087,38 +24126,34 @@ components: type: array description: List that contains the Atlas Search hardware measurements. items: - $ref: '#/components/schemas/MetricsMeasurement' + $ref: "#/components/schemas/MetricsMeasurement" readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true processId: type: string - description: >- - Combination of hostname and Internet Assigned Numbers Authority + description: Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. example: mongodb.example.com:27017 - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ readOnly: true start: type: string format: date-time - description: >- - Date and time that specifies when to start retrieving measurements. + description: Date and time that specifies when to start retrieving measurements. If you set **start**, you must set **end**. You can't set this parameter and **period** in the same request. This parameter expresses its value in the ISO 8601 timestamp format in UTC. @@ -26127,40 +24162,36 @@ components: type: array description: List that contains the Atlas Search status measurements. items: - $ref: '#/components/schemas/MetricsMeasurement' + $ref: "#/components/schemas/MetricsMeasurement" readOnly: true MesurementsDatabase: type: object properties: databaseName: type: string - description: >- - Human-readable label that identifies the database that the specified - MongoDB process serves. + description: Human-readable label that identifies the database that the + specified MongoDB process serves. links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true MetricDataPoint: type: object - description: >- - value of, and metadata provided for, one data point generated at a + description: value of, and metadata provided for, one data point generated at a particular moment in time. If no data point exists for a particular moment in time, the `value` parameter returns `null`. properties: timestamp: type: string format: date-time - description: >- - Date and time when this data point occurred. This parameter + description: Date and time when this data point occurred. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true value: @@ -26170,16 +24201,14 @@ components: readOnly: true MetricDataPoint_Atlas: type: object - description: >- - value of, and metadata provided for, one data point generated at a + description: value of, and metadata provided for, one data point generated at a particular moment in time. If no data point exists for a particular moment in time, the `value` parameter returns `null`. properties: timestamp: type: string format: date-time - description: >- - Date and time when this data point occurred. This parameter + description: Date and time when this data point occurred. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true value: @@ -26192,13 +24221,12 @@ components: properties: dataPoints: type: array - description: >- - List that contains the value of, and metadata provided for, one data - point generated at a particular moment in time. If no data point - exists for a particular moment in time, the `value` parameter + description: List that contains the value of, and metadata provided for, one + data point generated at a particular moment in time. If no data + point exists for a particular moment in time, the `value` parameter returns `null`. items: - $ref: '#/components/schemas/MetricDataPoint' + $ref: "#/components/schemas/MetricDataPoint" readOnly: true name: type: string @@ -26206,22 +24234,20 @@ components: readOnly: true units: type: string - description: >- - Element used to quantify the measurement. The resource returns units - of throughput, storage, and time. + description: Element used to quantify the measurement. The resource returns + units of throughput, storage, and time. readOnly: true MetricsMeasurement_Atlas: type: object properties: dataPoints: type: array - description: >- - List that contains the value of, and metadata provided for, one data - point generated at a particular moment in time. If no data point - exists for a particular moment in time, the `value` parameter + description: List that contains the value of, and metadata provided for, one + data point generated at a particular moment in time. If no data + point exists for a particular moment in time, the `value` parameter returns `null`. items: - $ref: '#/components/schemas/MetricDataPoint_Atlas' + $ref: "#/components/schemas/MetricDataPoint_Atlas" readOnly: true name: type: string @@ -26229,9 +24255,8 @@ components: readOnly: true units: type: string - description: >- - Element used to quantify the measurement. The resource returns units - of throughput, storage, and time. + description: Element used to quantify the measurement. The resource returns + units of throughput, storage, and time. readOnly: true MongoDBAccessLogs: type: object @@ -26239,8 +24264,7 @@ components: properties: authResult: type: boolean - description: >- - Flag that indicates whether the response should return successful + description: Flag that indicates whether the response should return successful authentication attempts only. authSource: type: string @@ -26248,8 +24272,7 @@ components: readOnly: true failureReason: type: string - description: >- - Reason that the authentication failed. Null if authentication + description: Reason that the authentication failed. Null if authentication succeeded. readOnly: true groupId: @@ -26262,17 +24285,14 @@ components: readOnly: true hostname: type: string - description: >- - Human-readable label that identifies the hostname of the target node - that received the authentication attempt. + description: Human-readable label that identifies the hostname of the target + node that received the authentication attempt. readOnly: true ipAddress: type: string - description: >- - Internet Protocol address that attempted to authenticate with the + description: Internet Protocol address that attempted to authenticate with the database. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ readOnly: true logLine: type: string @@ -26280,9 +24300,8 @@ components: readOnly: true timestamp: type: string - description: >- - Date and time when someone made this authentication attempt. MongoDB - Cloud represents this timestamp in ISO 8601 format in UTC. + description: Date and time when someone made this authentication attempt. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true username: type: string @@ -26295,19 +24314,17 @@ components: type: array description: Authentication attempt, one per object, made against the cluster. items: - $ref: '#/components/schemas/MongoDBAccessLogs' + $ref: "#/components/schemas/MongoDBAccessLogs" readOnly: true NamespaceObj: type: object - description: >- - Human-readable label that identifies the namespace on the specified + description: Human-readable label that identifies the namespace on the specified host. The resource expresses this parameter value as `.`. properties: namespace: type: string - description: >- - Human-readable label that identifies the namespace on the specified + description: Human-readable label that identifies the namespace on the specified host. The resource expresses this parameter value as `.`. readOnly: true @@ -26322,11 +24339,10 @@ components: properties: namespaces: type: array - description: >- - List that contains each combination of database, collection, and + description: List that contains each combination of database, collection, and type on the specified host. items: - $ref: '#/components/schemas/NamespaceObj' + $ref: "#/components/schemas/NamespaceObj" readOnly: true uniqueItems: true NetworkPermissionEntry: @@ -26334,8 +24350,7 @@ components: properties: awsSecurityGroup: type: string - description: >- - Unique string of the Amazon Web Services (AWS) security group that + description: Unique string of the Amazon Web Services (AWS) security group that you want to add to the project's IP access list. Your IP access list entry can be one **awsSecurityGroup**, one **cidrBlock**, or one **ipAddress**. You must configure Virtual Private Connection (VPC) @@ -26346,35 +24361,30 @@ components: pattern: ^([0-9]*\/)?sg-([0-9]*) cidrBlock: type: string - description: >- - Range of IP addresses in Classless Inter-Domain Routing (CIDR) + description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) notation that you want to add to the project's IP access list. Your IP access list entry can be one **awsSecurityGroup**, one **cidrBlock**, or one **ipAddress**. Don't set this parameter if you set **awsSecurityGroup** or **ipAddress**. - pattern: >- - ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}(%2[fF][0-9]{1,3})?|([0-9a-f]{1,4}\:){1,6}\:(%2[fF][0-9]{1,3})?$ comment: type: string - description: >- - Remark that explains the purpose or scope of this IP access list + description: Remark that explains the purpose or scope of this IP access list entry. maxLength: 80 deleteAfterDate: type: string format: date-time - description: >- - Date and time after which MongoDB Cloud deletes the temporary access - list entry. This parameter expresses its value in the ISO 8601 - timestamp format in UTC and can include the time zone designation. - The date must be later than the current date but no later than one - week after you submit this request. The resource returns this - parameter if you specified an expiration date when creating this IP - access list entry. + description: Date and time after which MongoDB Cloud deletes the temporary + access list entry. This parameter expresses its value in the ISO + 8601 timestamp format in UTC and can include the time zone + designation. The date must be later than the current date but no + later than one week after you submit this request. The resource + returns this parameter if you specified an expiration date when + creating this IP access list entry. groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that contains the IP access list to which you want to add one or more entries. example: 32b6e34b3d91647abb20e7b8 @@ -26384,24 +24394,21 @@ components: readOnly: true ipAddress: type: string - description: >- - IP address that you want to add to the project's IP access list. + description: IP address that you want to add to the project's IP access list. Your IP access list entry can be one **awsSecurityGroup**, one **cidrBlock**, or one **ipAddress**. Don't set this parameter if you set **awsSecurityGroup** or **cidrBlock**. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true NetworkPermissionEntryStatus: type: object @@ -26416,15 +24423,11 @@ components: |---|---| - | `ACTIVE` | This access list entry applies to all relevant cloud - providers. | + | `ACTIVE` | This access list entry applies to all relevant cloud providers. | - | `PENDING` | MongoDB Cloud has started to add access list entry. - This access list entry may not apply to all cloud providers at the - time of this request. | + | `PENDING` | MongoDB Cloud has started to add access list entry. This access list entry may not apply to all cloud providers at the time of this request. | - | `FAILED` | MongoDB Cloud didn't succeed in adding this access list - entry. | + | `FAILED` | MongoDB Cloud didn't succeed in adding this access list entry. | readOnly: true required: - STATUS @@ -26433,9 +24436,8 @@ components: description: Endpoint does not return a response body. NumberMetricUnits: type: string - description: >- - Element used to express the quantity. This can be an element of time, - storage capacity, and the like. + description: Element used to express the quantity. This can be an element of + time, storage capacity, and the like. example: COUNT title: Number Metric Units OnlineArchiveSchedule: @@ -26448,40 +24450,35 @@ components: endHour: type: integer format: int32 - description: >- - Hour of the day when the scheduled window to run one online archive + description: Hour of the day when the scheduled window to run one online archive ends. maximum: 23 minimum: 0 endMinute: type: integer format: int32 - description: >- - Minute of the hour when the scheduled window to run one online + description: Minute of the hour when the scheduled window to run one online archive ends. maximum: 59 minimum: 0 startHour: type: integer format: int32 - description: >- - Hour of the day when the when the scheduled window to run one online - archive starts. + description: Hour of the day when the when the scheduled window to run one + online archive starts. maximum: 23 minimum: 0 startMinute: type: integer format: int32 - description: >- - Minute of the hour when the scheduled window to run one online + description: Minute of the hour when the scheduled window to run one online archive starts. maximum: 59 minimum: 0 dayOfWeek: type: integer format: int32 - description: >- - Day of the week when the scheduled archive starts. The week starts + description: Day of the week when the scheduled archive starts. The week starts with Monday (`1`) and ends with Sunday (`7`). maximum: 7 minimum: 1 @@ -26499,22 +24496,18 @@ components: description: Comparison operator to apply when checking the current metric value. OrgFederationSettings: type: object - description: >- - Details that define how to connect one MongoDB Cloud organization to one - federated authentication service. + description: Details that define how to connect one MongoDB Cloud organization + to one federated authentication service. properties: federatedDomains: type: array - description: >- - List of domains associated with the organization's identity - provider. + description: List of domains associated with the organization's identity provider. items: type: string uniqueItems: true hasRoleMappings: type: boolean - description: >- - Flag that indicates whether this organization has role mappings + description: Flag that indicates whether this organization has role mappings configured. id: type: string @@ -26526,8 +24519,7 @@ components: readOnly: true identityProviderId: type: string - description: >- - Unique 20-hexadecimal digit string that identifies the identity + description: Unique 20-hexadecimal digit string that identifies the identity provider connected to this organization. example: c2777a9eca931f29fc2f maxLength: 20 @@ -26542,11 +24534,10 @@ components: properties: clusters: type: array - description: >- - Settings that describe the clusters in each project that the API key - is authorized to view. + description: Settings that describe the clusters in each project that the API + key is authorized to view. items: - $ref: '#/components/schemas/CloudCluster' + $ref: "#/components/schemas/CloudCluster" readOnly: true groupId: type: string @@ -26563,8 +24554,7 @@ components: pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ orgId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the + description: Unique 24-hexadecimal character string that identifies the organization that contains the project. maxLength: 24 minLength: 24 @@ -26572,8 +24562,7 @@ components: readOnly: true orgName: type: string - description: >- - Human-readable label that identifies the organization that contains + description: Human-readable label that identifies the organization that contains the project. maxLength: 64 minLength: 1 @@ -26584,9 +24573,8 @@ components: readOnly: true tags: type: array - description: >- - List of human-readable labels that categorize the specified project. - MongoDB Cloud returns an empty array. + description: List of human-readable labels that categorize the specified + project. MongoDB Cloud returns an empty array. items: type: string readOnly: true @@ -26597,22 +24585,18 @@ components: createdAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud sent the invitation. MongoDB Cloud + description: Date and time when MongoDB Cloud sent the invitation. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true expiresAt: type: string format: date-time - description: >- - Date and time when the invitation from MongoDB Cloud expires. + description: Date and time when the invitation from MongoDB Cloud expires. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this - organization. + description: Unique 24-hexadecimal digit string that identifies this organization. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -26621,21 +24605,19 @@ components: inviterUsername: type: string format: email - description: >- - Email address of the MongoDB Cloud user who sent the invitation to + description: Email address of the MongoDB Cloud user who sent the invitation to join the organization. readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true orgId: type: string @@ -26651,16 +24633,14 @@ components: pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ roles: type: array - description: >- - One or more organization or project level roles to assign to the + description: One or more organization or project level roles to assign to the MongoDB Cloud user. items: type: string uniqueItems: true teamIds: type: array - description: >- - List of unique 24-hexadecimal digit strings that identifies each + description: List of unique 24-hexadecimal digit strings that identifies each team. items: type: string @@ -26674,8 +24654,7 @@ components: username: type: string format: email - description: >- - Email address of the MongoDB Cloud user invited to join the + description: Email address of the MongoDB Cloud user invited to join the organization. required: - orgName @@ -26684,16 +24663,14 @@ components: properties: roles: type: array - description: >- - One or more organization or project level roles to assign to the + description: One or more organization or project level roles to assign to the MongoDB Cloud user. items: type: string uniqueItems: true teamIds: type: array - description: >- - List of teams to which you want to invite the desired MongoDB Cloud + description: List of teams to which you want to invite the desired MongoDB Cloud user. items: type: string @@ -26712,16 +24689,14 @@ components: properties: roles: type: array - description: >- - One or more organization or project level roles to assign to the + description: One or more organization or project level roles to assign to the MongoDB Cloud user. items: type: string uniqueItems: true teamIds: type: array - description: >- - List of teams to which you want to invite the desired MongoDB Cloud + description: List of teams to which you want to invite the desired MongoDB Cloud user. items: type: string @@ -26737,48 +24712,45 @@ components: properties: apiAccessListRequired: type: boolean - description: >- - Flag that indicates whether to require API operations to originate + description: Flag that indicates whether to require API operations to originate from an IP Address added to the API access list for the specified organization. multiFactorAuthRequired: type: boolean - description: >- - Flag that indicates whether to require users to set up Multi-Factor - Authentication (MFA) before accessing the specified organization. To - learn more, see: - https://www.mongodb.com/docs/atlas/security-multi-factor-authentication/. + description: "Flag that indicates whether to require users to set up + Multi-Factor Authentication (MFA) before accessing the specified + organization. To learn more, see: + https://www.mongodb.com/docs/atlas/security-multi-factor-authentica\ + tion/." restrictEmployeeAccess: type: boolean - description: >- - Flag that indicates whether to block MongoDB Support from accessing - Atlas infrastructure for any deployment in the specified + description: "Flag that indicates whether to block MongoDB Support from + accessing Atlas infrastructure for any deployment in the specified organization without explicit permission. Once this setting is turned on, you can grant MongoDB Support a 24-hour bypass access to the Atlas deployment to resolve support issues. To learn more, see: - https://www.mongodb.com/docs/atlas/security-restrict-support-access/. + https://www.mongodb.com/docs/atlas/security-restrict-support-access\ + /." PaginatedHostView_Atlas: type: object properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link_Atlas' + $ref: "#/components/schemas/Link_Atlas" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/ApiHostView_Atlas' + $ref: "#/components/schemas/ApiHostView_Atlas" readOnly: true totalCount: type: integer @@ -26793,7 +24765,7 @@ components: certificates: type: array items: - $ref: '#/components/schemas/X509Certificate' + $ref: "#/components/schemas/X509Certificate" fileName: type: string PerformanceAdvisorIndex: @@ -26813,14 +24785,12 @@ components: readOnly: true impact: type: array - description: >- - List that contains unique 24-hexadecimal character string that + description: List that contains unique 24-hexadecimal character string that identifies the query shapes in this response that the Performance Advisor suggests. items: type: string - description: >- - One unique 24-hexadecimal character string that identifies one + description: One unique 24-hexadecimal character string that identifies one query shape. maxLength: 24 minLength: 24 @@ -26828,39 +24798,34 @@ components: readOnly: true index: type: array - description: >- - List that contains documents that specify a key in the index and its - sort order. + description: List that contains documents that specify a key in the index and + its sort order. items: type: object additionalProperties: type: integer format: int32 - description: >- - One index key paired with its sort order. A value of `1` - indicates an ascending sort order. A value of `-1` indicates a - descending sort order. Keys in indexes with multiple keys appear - in the same order that they appear in the index. - description: >- - One index key paired with its sort order. A value of `1` indicates + description: One index key paired with its sort order. A value of `1` indicates + an ascending sort order. A value of `-1` indicates a descending + sort order. Keys in indexes with multiple keys appear in the + same order that they appear in the index. + description: One index key paired with its sort order. A value of `1` indicates an ascending sort order. A value of `-1` indicates a descending sort order. Keys in indexes with multiple keys appear in the same order that they appear in the index. readOnly: true namespace: type: string - description: >- - Human-readable label that identifies the namespace on the specified + description: Human-readable label that identifies the namespace on the specified host. The resource expresses this parameter value as `.`. readOnly: true weight: type: number format: double - description: >- - Estimated performance improvement that the suggested index provides. - This value corresponds to **Impact** in the Performance Advisor user - interface. + description: Estimated performance improvement that the suggested index + provides. This value corresponds to **Impact** in the Performance + Advisor user interface. readOnly: true PerformanceAdvisorOpStats: type: object @@ -26869,8 +24834,7 @@ components: ms: type: integer format: int64 - description: >- - Length of time expressed during which the query finds suggested + description: Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. This parameter relates to the **duration** query parameter. @@ -26888,8 +24852,7 @@ components: ts: type: integer format: int64 - description: >- - Date and time from which the query retrieves the suggested indexes. + description: Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). This parameter @@ -26901,19 +24864,17 @@ components: properties: shapes: type: array - description: >- - List of query predicates, sorts, and projections that the + description: List of query predicates, sorts, and projections that the Performance Advisor suggests. items: - $ref: '#/components/schemas/PerformanceAdvisorShape' + $ref: "#/components/schemas/PerformanceAdvisorShape" readOnly: true suggestedIndexes: type: array - description: >- - List that contains the documents with information about the indexes + description: List that contains the documents with information about the indexes that the Performance Advisor suggests. items: - $ref: '#/components/schemas/PerformanceAdvisorIndex' + $ref: "#/components/schemas/PerformanceAdvisorIndex" readOnly: true PerformanceAdvisorShape: type: object @@ -26921,9 +24882,8 @@ components: avgMs: type: integer format: int64 - description: >- - Average duration in milliseconds for the queries examined that match - this shape. + description: Average duration in milliseconds for the queries examined that + match this shape. readOnly: true count: type: integer @@ -26932,8 +24892,7 @@ components: readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies this shape. This + description: Unique 24-hexadecimal digit string that identifies this shape. This string exists only for the duration of this API request. maxLength: 24 minLength: 24 @@ -26942,18 +24901,15 @@ components: inefficiencyScore: type: integer format: int64 - description: >- - Average number of documents read for every document that the query + description: Average number of documents read for every document that the query returns. externalDocs: description: Understanding the Query Inefficiency Score - url: >- - https://www.mongodb.com/docs/atlas/performance-advisor/#std-label-query-inefficiency-score + url: https://www.mongodb.com/docs/atlas/performance-advisor/#std-label-query-inefficiency-score readOnly: true namespace: type: string - description: >- - Human-readable label that identifies the namespace on the specified + description: Human-readable label that identifies the namespace on the specified host. The resource expresses this parameter value as `.`. readOnly: true @@ -26961,7 +24917,7 @@ components: type: array description: List that contains specific about individual queries. items: - $ref: '#/components/schemas/PerformanceAdvisorOperation' + $ref: "#/components/schemas/PerformanceAdvisorOperation" readOnly: true PerformanceAdvisorSlowQuery: type: object @@ -26973,8 +24929,7 @@ components: readOnly: true namespace: type: string - description: >- - Human-readable label that identifies the namespace on the specified + description: Human-readable label that identifies the namespace on the specified host. The resource expresses this parameter value as `.`. readOnly: true @@ -26984,11 +24939,10 @@ components: properties: slowQueries: type: array - description: >- - List of operations that the Performance Advisor detected that took + description: List of operations that the Performance Advisor detected that took longer to execute than a specified threshold. items: - $ref: '#/components/schemas/PerformanceAdvisorSlowQuery' + $ref: "#/components/schemas/PerformanceAdvisorSlowQuery" readOnly: true PipelineRunStats: type: object @@ -27015,27 +24969,23 @@ components: readOnly: true deleteRequested: type: boolean - description: >- - Flag that indicates whether MongoDB Cloud received a request to + description: Flag that indicates whether MongoDB Cloud received a request to remove the specified private endpoint from the private endpoint service. readOnly: true errorMessage: type: string - description: >- - Error message returned when requesting private connection resource. + description: Error message returned when requesting private connection resource. The resource returns `null` if the request succeeded. readOnly: true connectionStatus: type: string - description: >- - State of the Amazon Web Service PrivateLink connection when MongoDB + description: State of the Amazon Web Service PrivateLink connection when MongoDB Cloud received this request. readOnly: true interfaceEndpointId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the interface + description: Unique 24-hexadecimal digit string that identifies the interface endpoint. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -27047,20 +24997,17 @@ components: description: Human-readable label that identifies a set of endpoints. externalDocs: description: Google Cloud Forwarding Rule Concepts - url: >- - https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts readOnly: true endpoints: type: array - description: >- - List of individual private endpoints that comprise this endpoint + description: List of individual private endpoints that comprise this endpoint group. externalDocs: description: Google Cloud Forwarding Rule Concepts - url: >- - https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts + url: https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts items: - $ref: '#/components/schemas/GCPConsumerForwardingRule' + $ref: "#/components/schemas/GCPConsumerForwardingRule" readOnly: true status: type: string @@ -27071,31 +25018,24 @@ components: Alternatively: - State of the Azure Private Link Service connection when MongoDB - Cloud received this request. + State of the Azure Private Link Service connection when MongoDB Cloud received this request. readOnly: true privateEndpointConnectionName: type: string - description: >- - Human-readable label that MongoDB Cloud generates that identifies + description: Human-readable label that MongoDB Cloud generates that identifies the private endpoint connection. - pattern: >- - ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]([-\w._()]+)%2[fF]([-\w._()]+) + pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]([-\w._()]+)%2[fF]([-\w._()]+) readOnly: true privateEndpointIPAddress: type: string - description: >- - IPv4 address of the private endpoint in your Azure VNet that someone - added to this private endpoint service. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ privateEndpointResourceId: type: string - description: >- - Unique string that identifies the Azure private endpoint's network + description: Unique string that identifies the Azure private endpoint's network interface that someone added to this private endpoint service. - example: >- - /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln + example: /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln readOnly: true required: - cloudProvider @@ -27107,30 +25047,25 @@ components: description: Human-readable string to associate with this private endpoint. endpointId: type: string - description: >- - Unique 22-character alphanumeric string that identifies the private + description: Unique 22-character alphanumeric string that identifies the private endpoint. example: vpce-3bf78b0ddee411ba1 externalDocs: - description: >- - Atlas Data Lake supports Amazon Web Services private endpoints + description: Atlas Data Lake supports Amazon Web Services private endpoints using the AWS PrivateLink feature. - url: >- - https://aws.amazon.com/privatelink/?privatelink-blogs.sort-by=item.additionalFields.createdDate&privatelink-blogs.sort-order=desc + url: https://aws.amazon.com/privatelink/?privatelink-blogs.sort-by=item.additionalFields.createdDate&privatelink-blogs.sort-order=desc maxLength: 22 minLength: 22 pattern: ^vpce-[0-9a-f]{17}$ provider: type: string default: AWS - description: >- - Human-readable label that identifies the cloud service provider. + description: Human-readable label that identifies the cloud service provider. Atlas Data Lake supports Amazon Web Services only. type: type: string default: DATA_LAKE - description: >- - Human-readable label that identifies the resource type associated + description: Human-readable label that identifies the resource type associated with this private endpoint. required: - endpointId @@ -27150,32 +25085,28 @@ components: description: ID of the AWS IAM role that will be used to write to the S3 bucket. links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true prefixPath: type: string - description: >- - S3 directory in which vector will write to in order to store the + description: S3 directory in which vector will write to in order to store the logs. state: type: string - description: >- - Describes whether or not the feature is enabled and what status it + description: Describes whether or not the feature is enabled and what status it is in. RawMetricUnits: type: string default: RAW - description: >- - Element used to express the quantity. This can be an element of time, - storage capacity, and the like. + description: Element used to express the quantity. This can be an element of + time, storage capacity, and the like. title: Raw Metric Units RegionSpec: type: object @@ -27184,8 +25115,7 @@ components: analyticsNodes: type: integer format: int32 - description: >- - Number of analytics nodes in the region. Analytics nodes handle + description: Number of analytics nodes in the region. Analytics nodes handle analytic data such as reporting queries from MongoDB Connector for Business Intelligence on MongoDB Cloud. Analytics nodes are read-only, and can never become the primary. Use @@ -27193,15 +25123,13 @@ components: electableNodes: type: integer format: int32 - description: >- - Number of electable nodes to deploy in the specified region. + description: Number of electable nodes to deploy in the specified region. Electable nodes can become the primary and can facilitate local reads. Use **replicationSpecs[n].{region}.electableNodes** instead. priority: type: integer format: int32 - description: >- - Number that indicates the election priority of the region. To + description: Number that indicates the election priority of the region. To identify the Preferred Region of the cluster, set this parameter to `7`. The primary node runs in the **Preferred Region**. To identify a read-only region, set this parameter to `0`. @@ -27210,21 +25138,18 @@ components: readOnlyNodes: type: integer format: int32 - description: >- - Number of read-only nodes in the region. Read-only nodes can never + description: Number of read-only nodes in the region. Read-only nodes can never become the primary member, but can facilitate local reads. Use **replicationSpecs[n].{region}.readOnlyNodes** instead. title: Region Configuration ReplicationSpec: type: object - description: >- - Details that explain how MongoDB Cloud replicates data on the specified - MongoDB database. + description: Details that explain how MongoDB Cloud replicates data on the + specified MongoDB database. properties: id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the replication + description: Unique 24-hexadecimal digit string that identifies the replication object for a zone in a Multi-Cloud Cluster. If you include existing zones in the request, you must specify this parameter. If you add a new zone to an existing Multi-Cloud Cluster, you may specify this @@ -27238,8 +25163,7 @@ components: numShards: type: integer format: int32 - description: >- - Positive integer that specifies the number of shards to deploy in + description: Positive integer that specifies the number of shards to deploy in each specified zone. If you set this value to `1` and **clusterType** is `SHARDED`, MongoDB Cloud deploys a single-shard sharded cluster. Don't create a sharded cluster with a single shard @@ -27264,20 +25188,13 @@ components: **Example:** - If you set - `"replicationSpecs[n].regionConfigs[m].analyticsSpecs.instanceSize" - : "M30"`, set - `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" - : `"M30"` if you have electable nodes and - `"replicationSpecs[n].regionConfigs[m].readOnlySpecs.instanceSize" : - `"M30"` if you have read-only nodes. + If you set `"replicationSpecs[n].regionConfigs[m].analyticsSpecs.instanceSize" : "M30"`, set `"replicationSpecs[n].regionConfigs[m].electableSpecs.instanceSize" : `"M30"` if you have electable nodes and `"replicationSpecs[n].regionConfigs[m].readOnlySpecs.instanceSize" : `"M30"` if you have read-only nodes. items: - $ref: '#/components/schemas/CloudRegionConfig' + $ref: "#/components/schemas/CloudRegionConfig" zoneName: type: string - description: >- - Human-readable label that identifies the zone in a Global Cluster. - Provide this value only if `"clusterType" : "GEOSHARDED"`. + description: 'Human-readable label that identifies the zone in a Global Cluster. + Provide this value only if `"clusterType" : "GEOSHARDED"`.' title: Replication Specifications RequestAccepted: type: object @@ -27289,30 +25206,27 @@ components: title: Resource Event Types ResourceTag: type: object - description: >- - Key-value pair that tags and categorizes a MongoDB Cloud organization, - project, or cluster. For example, `environment : production`. + description: "Key-value pair that tags and categorizes a MongoDB Cloud + organization, project, or cluster. For example, `environment : + production`." properties: key: type: string - description: >- - Constant that defines the set of the tag. For example, `environment` - in the `environment : production` tag. + description: "Constant that defines the set of the tag. For example, + `environment` in the `environment : production` tag." maxLength: 255 minLength: 1 value: type: string - description: >- - Variable that belongs to the set of the tag. For example, - `production` in the `environment : production` tag. + description: "Variable that belongs to the set of the tag. For example, + `production` in the `environment : production` tag." maxLength: 255 minLength: 1 title: Resource Tag RestoreJobFileHash: type: object - description: >- - Key and value pair that map one restore file to one hashed checksum. - This parameter applies after you download the corresponding + description: Key and value pair that map one restore file to one hashed + checksum. This parameter applies after you download the corresponding **delivery.url**. properties: fileName: @@ -27325,20 +25239,18 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true typeName: type: string - description: >- - Human-readable label that identifies the hashing algorithm used to + description: Human-readable label that identifies the hashing algorithm used to compute the hash value. readOnly: true readOnly: true @@ -27347,8 +25259,7 @@ components: properties: groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project to + description: Unique 24-hexadecimal digit string that identifies the project to which this role belongs. You can set a value for this parameter or **orgId** but not both in the same request. example: 32b6e34b3d91647abb20e7b8 @@ -27357,8 +25268,7 @@ components: pattern: ^([a-f0-9]{24})$ orgId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization to which this role belongs. You can set a value for this parameter or **groupId** but not both in the same request. example: 32b6e34b3d91647abb20e7b8 @@ -27410,9 +25320,7 @@ components: properties: associatedDomains: type: array - description: >- - List that contains the domains associated with the identity - provider. + description: List that contains the domains associated with the identity provider. items: type: string uniqueItems: true @@ -27429,30 +25337,26 @@ components: description: Unique string that identifies the issuer of the SAML Assertion. example: urn:idp:default pemFileInfo: - $ref: '#/components/schemas/PemFileInfo' + $ref: "#/components/schemas/PemFileInfo" protocol: type: string description: The protocol for the identity provider. requestBinding: type: string - description: >- - SAML Authentication Request Protocol HTTP method binding (POST or + description: SAML Authentication Request Protocol HTTP method binding (POST or REDIRECT) that Federated Authentication uses to send the authentication request. responseSignatureAlgorithm: type: string - description: >- - Signature algorithm that Federated Authentication uses to encrypt + description: Signature algorithm that Federated Authentication uses to encrypt the identity provider signature. ssoDebugEnabled: type: boolean - description: >- - Flag that indicates whether the identity provider has SSO debug + description: Flag that indicates whether the identity provider has SSO debug enabled. ssoUrl: type: string - description: >- - Unique string that identifies the intended audience of the SAML + description: Unique string that identifies the intended audience of the SAML assertion. example: https://example.com status: @@ -27465,8 +25369,7 @@ components: properties: _id: type: string - description: >- - Unique 24-hexadecimal character string that identifies this sample + description: Unique 24-hexadecimal character string that identifies this sample dataset. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -27475,8 +25378,7 @@ components: readOnly: true clusterName: type: string - description: >- - Human-readable label that identifies the cluster into which you + description: Human-readable label that identifies the cluster into which you loaded the sample dataset. maxLength: 64 minLength: 1 @@ -27485,21 +25387,18 @@ components: completeDate: type: string format: date-time - description: >- - Date and time when the sample dataset load job completed. MongoDB + description: Date and time when the sample dataset load job completed. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true createDate: type: string format: date-time - description: >- - Date and time when you started the sample dataset load job. MongoDB + description: Date and time when you started the sample dataset load job. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true errorMessage: type: string - description: >- - Details of the error returned when MongoDB Cloud loads the sample + description: Details of the error returned when MongoDB Cloud loads the sample dataset. This endpoint returns null if state has a value other than FAILED. readOnly: true @@ -27514,16 +25413,14 @@ components: analyzer: type: string default: lucene.standard - description: >- - Specific pre-defined method chosen to apply to the synonyms to be + description: Specific pre-defined method chosen to apply to the synonyms to be searched. name: type: string - description: >- - Human-readable label that identifies the synonym definition. Each + description: Human-readable label that identifies the synonym definition. Each **synonym.name** must be unique within the same index definition. source: - $ref: '#/components/schemas/SynonymSource' + $ref: "#/components/schemas/SynonymSource" required: - analyzer - name @@ -27541,18 +25438,16 @@ components: description: Human-readable label that categorizes the restore job to create. deliveryUrl: type: array - description: >- - One or more Uniform Resource Locators (URLs) that point to the + description: 'One or more Uniform Resource Locators (URLs) that point to the compressed snapshot files for manual download. MongoDB Cloud returns - this parameter when `"deliveryType" : "download"`. + this parameter when `"deliveryType" : "download"`.' items: type: string - description: >- - One Uniform Resource Locator that point to the compressed snapshot + description: One Uniform Resource Locator that point to the compressed snapshot files for manual download. readOnly: true desiredTimestamp: - $ref: '#/components/schemas/ApiBSONTimestamp' + $ref: "#/components/schemas/ApiBSONTimestamp" expired: type: boolean description: Flag that indicates whether the restore job expired. @@ -27560,9 +25455,8 @@ components: expiresAt: type: string format: date-time - description: >- - Date and time when the restore job expires. This parameter expresses - its value in the ISO 8601 timestamp format in UTC. + description: Date and time when the restore job expires. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true failed: type: boolean @@ -27571,14 +25465,12 @@ components: finishedAt: type: string format: date-time - description: >- - Date and time when the restore job completed. This parameter + description: Date and time when the restore job completed. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true id: type: string - description: >- - Unique 24-hexadecimal character string that identifies the restore + description: Unique 24-hexadecimal character string that identifies the restore job. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -27587,45 +25479,41 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true oplogInc: type: integer format: int32 - description: >- - Oplog operation number from which you want to restore this snapshot. - This number represents the second part of an Oplog timestamp. The - resource returns this parameter when `"deliveryType" : - "pointInTime"` and **oplogTs** exceeds `0`. + description: 'Oplog operation number from which you want to restore this + snapshot. This number represents the second part of an Oplog + timestamp. The resource returns this parameter when `"deliveryType" + : "pointInTime"` and **oplogTs** exceeds `0`.' example: 1 minimum: 1 oplogTs: type: integer format: int32 - description: >- - Date and time from which you want to restore this snapshot. This + description: 'Date and time from which you want to restore this snapshot. This parameter expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. This number represents the first part of an Oplog timestamp. The resource returns this parameter when - `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`. + `"deliveryType" : "pointInTime"` and **oplogTs** exceeds `0`.' minimum: 1199145600 pointInTimeUTCSeconds: type: integer format: int32 - description: >- - Date and time from which MongoDB Cloud restored this snapshot. This - parameter expresses this timestamp in the number of seconds that - have elapsed since the UNIX epoch. The resource returns this + description: 'Date and time from which MongoDB Cloud restored this snapshot. + This parameter expresses this timestamp in the number of seconds + that have elapsed since the UNIX epoch. The resource returns this parameter when `"deliveryType" : "pointInTime"` and - **pointInTimeUTCSeconds** exceeds `0`. + **pointInTimeUTCSeconds** exceeds `0`.' minimum: 1199145600 snapshotId: type: string @@ -27636,17 +25524,15 @@ components: pattern: ^([a-f0-9]{24})$ targetClusterName: type: string - description: >- - Human-readable label that identifies the target cluster to which the - restore job restores the snapshot. The resource returns this + description: Human-readable label that identifies the target cluster to which + the restore job restores the snapshot. The resource returns this parameter when `"deliveryType":` `"automated"`. maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ targetGroupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the target + description: Unique 24-hexadecimal digit string that identifies the target project for the specified **targetClusterName**. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -27655,8 +25541,7 @@ components: timestamp: type: string format: date-time - description: >- - Date and time when MongoDB Cloud took the snapshot associated with + description: Date and time when MongoDB Cloud took the snapshot associated with **snapshotId**. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -27670,22 +25555,19 @@ components: createdAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud took the snapshot. This parameter + description: Date and time when MongoDB Cloud took the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true expiresAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud deletes the snapshot. This + description: Date and time when MongoDB Cloud deletes the snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true frequencyType: type: string - description: >- - Human-readable label that identifies how often this snapshot + description: Human-readable label that identifies how often this snapshot triggers. readOnly: true id: @@ -27698,15 +25580,14 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true mongodVersion: type: string @@ -27715,8 +25596,7 @@ components: readOnly: true serverlessInstanceName: type: string - description: >- - Human-readable label given to the serverless instance from which + description: Human-readable label given to the serverless instance from which MongoDB Cloud took this snapshot. maxLength: 64 minLength: 1 @@ -27728,8 +25608,7 @@ components: readOnly: true status: type: string - description: >- - Human-readable label that indicates the stage of the backup process + description: Human-readable label that indicates the stage of the backup process for this snapshot. readOnly: true storageSizeBytes: @@ -27743,8 +25622,7 @@ components: properties: endpointId: type: string - description: >- - Unique string that the cloud provider uses to identify the private + description: Unique string that the cloud provider uses to identify the private endpoint. readOnly: true providerName: @@ -27758,27 +25636,23 @@ components: title: Serverless Instance Private Endpoint Connection Strings Endpoint ServerlessConnectionStringsPrivateEndpointList: type: object - description: >- - Private endpoint connection string that you can use to connect to this - serverless instance through a private endpoint. + description: Private endpoint connection string that you can use to connect to + this serverless instance through a private endpoint. externalDocs: description: Private Endpoint for Serverless Instance url: https://docs.atlas.mongodb.com/security-serverless-private-endpoint/ properties: endpoints: type: array - description: >- - List that contains the private endpoints through which you connect + description: List that contains the private endpoints through which you connect to MongoDB Cloud when you use **connectionStrings.privateEndpoint[n].srvConnectionString**. items: - $ref: >- - #/components/schemas/ServerlessConnectionStringsPrivateEndpointItem + $ref: "#/components/schemas/ServerlessConnectionStringsPrivateEndpointItem" readOnly: true srvConnectionString: type: string - description: >- - Private endpoint-aware connection string that uses the + description: Private endpoint-aware connection string that uses the `mongodb+srv://` protocol to connect to MongoDB Cloud through a private endpoint. The `mongodb+srv` protocol tells the driver to look up the seed list of hosts in the Domain Name System (DNS). @@ -27798,12 +25672,11 @@ components: description: Group of settings that configure a MongoDB serverless instance. properties: connectionStrings: - $ref: '#/components/schemas/ServerlessInstanceDescriptionConnectionStrings' + $ref: "#/components/schemas/ServerlessInstanceDescriptionConnectionStrings" createDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this serverless instance. + description: Date and time when MongoDB Cloud created this serverless instance. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true groupId: @@ -27816,8 +25689,7 @@ components: readOnly: true id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the serverless + description: Unique 24-hexadecimal digit string that identifies the serverless instance. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -27826,15 +25698,14 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true mongoDBVersion: type: string @@ -27849,37 +25720,33 @@ components: pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ readOnly: true providerSettings: - $ref: '#/components/schemas/ServerlessProviderSettings' + $ref: "#/components/schemas/ServerlessProviderSettings" serverlessBackupOptions: - $ref: '#/components/schemas/ClusterServerlessBackupOptions' + $ref: "#/components/schemas/ClusterServerlessBackupOptions" stateName: type: string - description: >- - Human-readable label that indicates the current operating condition + description: Human-readable label that indicates the current operating condition of the serverless instance. readOnly: true tags: type: array - description: >- - List that contains key-value pairs between 1 to 255 characters in + description: List that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the serverless instance. items: - $ref: '#/components/schemas/ResourceTag' + $ref: "#/components/schemas/ResourceTag" terminationProtectionEnabled: type: boolean default: false - description: >- - Flag that indicates whether termination protection is enabled on the - serverless instance. If set to `true`, MongoDB Cloud won't delete - the serverless instance. If set to `false`, MongoDB Cloud will - delete the serverless instance. + description: Flag that indicates whether termination protection is enabled on + the serverless instance. If set to `true`, MongoDB Cloud won't + delete the serverless instance. If set to `false`, MongoDB Cloud + will delete the serverless instance. required: - providerSettings title: Serverless Instance Description ServerlessInstanceDescriptionConnectionStrings: type: object - description: >- - Collection of Uniform Resource Locators that point to the MongoDB + description: Collection of Uniform Resource Locators that point to the MongoDB database. externalDocs: description: Connection string URI format. @@ -27887,19 +25754,16 @@ components: properties: privateEndpoint: type: array - description: >- - List of private endpoint-aware connection strings that you can use + description: List of private endpoint-aware connection strings that you can use to connect to this serverless instance through a private endpoint. This parameter returns only if you created a private endpoint for this serverless instance and it is AVAILABLE. items: - $ref: >- - #/components/schemas/ServerlessConnectionStringsPrivateEndpointList + $ref: "#/components/schemas/ServerlessConnectionStringsPrivateEndpointList" readOnly: true standardSrv: type: string - description: >- - Public connection string that you can use to connect to this + description: Public connection string that you can use to connect to this serverless instance. This connection string uses the `mongodb+srv://` protocol. externalDocs: @@ -27920,101 +25784,90 @@ components: pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ writeOnly: true providerSettings: - $ref: '#/components/schemas/ServerlessProviderSettings' + $ref: "#/components/schemas/ServerlessProviderSettings" serverlessBackupOptions: - $ref: '#/components/schemas/ClusterServerlessBackupOptions' + $ref: "#/components/schemas/ClusterServerlessBackupOptions" stateName: type: string - description: >- - Human-readable label that indicates the current operating condition + description: Human-readable label that indicates the current operating condition of the serverless instance. readOnly: true tags: type: array - description: >- - List that contains key-value pairs between 1 to 255 characters in + description: List that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the serverless instance. items: - $ref: '#/components/schemas/ResourceTag' + $ref: "#/components/schemas/ResourceTag" terminationProtectionEnabled: type: boolean default: false - description: >- - Flag that indicates whether termination protection is enabled on the - serverless instance. If set to `true`, MongoDB Cloud won't delete - the serverless instance. If set to `false`, MongoDB Cloud will - delete the serverless instance. + description: Flag that indicates whether termination protection is enabled on + the serverless instance. If set to `true`, MongoDB Cloud won't + delete the serverless instance. If set to `false`, MongoDB Cloud + will delete the serverless instance. required: - name - providerSettings title: Serverless Instance Description Create ServerlessInstanceDescriptionUpdate: type: object - description: >- - Settings that you can update when you request a serverless cluster + description: Settings that you can update when you request a serverless cluster update. properties: serverlessBackupOptions: - $ref: '#/components/schemas/ClusterServerlessBackupOptions' + $ref: "#/components/schemas/ClusterServerlessBackupOptions" tags: type: array - description: >- - List that contains key-value pairs between 1 to 255 characters in + description: List that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the serverless instance. items: - $ref: '#/components/schemas/ResourceTag' + $ref: "#/components/schemas/ResourceTag" terminationProtectionEnabled: type: boolean default: false - description: >- - Flag that indicates whether termination protection is enabled on the - serverless instance. If set to `true`, MongoDB Cloud won't delete - the serverless instance. If set to `false`, MongoDB Cloud will - delete the serverless instance. + description: Flag that indicates whether termination protection is enabled on + the serverless instance. If set to `true`, MongoDB Cloud won't + delete the serverless instance. If set to `false`, MongoDB Cloud + will delete the serverless instance. title: Serverless Instance Description Update ServerlessMetricThreshold: type: object - description: >- - Threshold for the metric that, when exceeded, triggers an alert. The - metric threshold pertains to event types which reflects changes of + description: Threshold for the metric that, when exceeded, triggers an alert. + The metric threshold pertains to event types which reflects changes of measurements and metrics about the serverless database. properties: metricName: type: string - description: >- - Human-readable label that identifies the metric against which + description: Human-readable label that identifies the metric against which MongoDB Cloud checks the configured **metricThreshold.threshold**. mode: type: string description: MongoDB Cloud computes the current metric value as an average. operator: - $ref: '#/components/schemas/Operator' + $ref: "#/components/schemas/Operator" threshold: type: number format: double description: Value of metric that, when exceeded, triggers an alert. units: - $ref: '#/components/schemas/ServerlessMetricUnits' + $ref: "#/components/schemas/ServerlessMetricUnits" required: - metricName title: Serverless Metric Threshold ServerlessMetricUnits: type: string - description: >- - Element used to express the quantity. This can be an element of time, - storage capacity, and the like. + description: Element used to express the quantity. This can be an element of + time, storage capacity, and the like. example: RPU title: Serverless Metric Units ServerlessProviderSettings: type: object - description: >- - Group of cloud provider settings that configure the provisioned MongoDB - serverless instance. + description: Group of cloud provider settings that configure the provisioned + MongoDB serverless instance. properties: backingProviderName: type: string - description: >- - Cloud service provider on which MongoDB Cloud provisioned the + description: Cloud service provider on which MongoDB Cloud provisioned the serverless instance. providerName: type: string @@ -28022,9 +25875,8 @@ components: description: Human-readable label that identifies the cloud service provider. regionName: type: string - description: >- - Human-readable label that identifies the geographic location of your - MongoDB serverless instance. The region you choose can affect + description: Human-readable label that identifies the geographic location of + your MongoDB serverless instance. The region you choose can affect network latency for clients accessing your databases. For a complete list of region names, see [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/#std-label-amazon-aws), @@ -28047,8 +25899,7 @@ components: properties: _id: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the private + description: Unique 24-hexadecimal digit string that identifies the private endpoint. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -28064,10 +25915,8 @@ components: Alternatively: - Unique string that identifies the Azure private endpoint's network - interface that someone added to this private endpoint service. - pattern: >- - ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + Unique string that identifies the Azure private endpoint's network interface that someone added to this private endpoint service. + pattern: ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ readOnly: true comment: type: string @@ -28083,27 +25932,22 @@ components: Alternatively: - Unique string that identifies the Amazon Web Services (AWS) - PrivateLink endpoint service. MongoDB Cloud returns null while it - creates the endpoint service. + Unique string that identifies the Amazon Web Services (AWS) PrivateLink endpoint service. MongoDB Cloud returns null while it creates the endpoint service. Alternatively: - Unique string that identifies the Azure private endpoint service. - MongoDB Cloud returns null while it creates the endpoint service. + Unique string that identifies the Azure private endpoint service. MongoDB Cloud returns null while it creates the endpoint service. pattern: ^pls_[0-9a-f]{24}$ readOnly: true errorMessage: type: string - description: >- - Human-readable error message that indicates error condition + description: Human-readable error message that indicates error condition associated with establishing the private endpoint connection. readOnly: true status: type: string - description: >- - Human-readable label that indicates the current operating status of + description: Human-readable label that indicates the current operating status of the private endpoint. readOnly: true providerName: @@ -28112,18 +25956,15 @@ components: readOnly: true privateEndpointIpAddress: type: string - description: >- - IPv4 address of the private endpoint in your Azure VNet that someone - added to this private endpoint service. + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. maxLength: 24 minLength: 24 - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ readOnly: true privateLinkServiceResourceId: type: string - description: >- - Root-relative path that identifies the Azure Private Link Service + description: Root-relative path that identifies the Azure Private Link Service that MongoDB Cloud manages. MongoDB Cloud returns null while it creates the endpoint service. readOnly: true @@ -28138,8 +25979,7 @@ components: writeOnly: true providerName: type: string - description: >- - Human-readable label that identifies the cloud provider of the + description: Human-readable label that identifies the cloud provider of the tenant endpoint. writeOnly: true cloudProviderEndpointId: @@ -28151,18 +25991,14 @@ components: Alternatively: - Unique string that identifies the Azure private endpoint's network - interface for this private endpoint service. - pattern: >- - ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + Unique string that identifies the Azure private endpoint's network interface for this private endpoint service. + pattern: ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ writeOnly: true privateEndpointIpAddress: type: string - description: >- - IPv4 address of the private endpoint in your Azure VNet that someone - added to this private endpoint service. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ writeOnly: true required: - providerName @@ -28172,16 +26008,14 @@ components: properties: caCertificatePath: type: string - description: >- - Path to the CA certificate that signed SSL certificates use to + description: Path to the CA certificate that signed SSL certificates use to authenticate to the source cluster. clusterName: type: string description: Label that identifies the source cluster name. groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the source + description: Unique 24-hexadecimal digit string that identifies the source project. example: 9b43a5b329223c3a1591a678 maxLength: 24 @@ -28189,8 +26023,7 @@ components: pattern: ^([a-f0-9]{24})$ managedAuthentication: type: boolean - description: >- - Flag that indicates whether MongoDB Automation manages + description: Flag that indicates whether MongoDB Automation manages authentication to the source cluster. If true, do not provide values for username and password. password: @@ -28202,9 +26035,8 @@ components: description: Flag that indicates whether you have SSL enabled. username: type: string - description: >- - Label that identifies the SCRAM-SHA user that connects to the source - cluster. + description: Label that identifies the SCRAM-SHA user that connects to the + source cluster. writeOnly: true required: - clusterName @@ -28217,15 +26049,14 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true name: type: string @@ -28237,7 +26068,7 @@ components: type: string description: Name of the cluster configured for this connection. authentication: - $ref: '#/components/schemas/StreamsKafkaAuthentication' + $ref: "#/components/schemas/StreamsKafkaAuthentication" bootstrapServers: type: string description: Comma separated list of server addresses. @@ -28245,68 +26076,61 @@ components: type: object additionalProperties: type: string - description: >- - A map of Kafka key-value pairs for optional configuration. This is + description: A map of Kafka key-value pairs for optional configuration. This is a flat object, and keys can have '.' characters. example: '{"group.protocol.type":"consumer","debug":"queue, msg, protocol"}' - description: >- - A map of Kafka key-value pairs for optional configuration. This is a - flat object, and keys can have '.' characters. + description: A map of Kafka key-value pairs for optional configuration. This is + a flat object, and keys can have '.' characters. example: debug: queue, msg, protocol group.protocol.type: consumer security: - $ref: '#/components/schemas/StreamsKafkaSecurity' + $ref: "#/components/schemas/StreamsKafkaSecurity" readOnly: true StreamsDataProcessRegion: type: object properties: cloudProvider: type: string - description: >- - Label that identifies the cloud service provider where MongoDB Cloud - performs stream processing. Currently, this parameter supports AWS - only. + description: Label that identifies the cloud service provider where MongoDB + Cloud performs stream processing. Currently, this parameter supports + AWS only. links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true region: - $ref: '#/components/schemas/BaseStreamsRegion' + $ref: "#/components/schemas/BaseStreamsRegion" required: - cloudProvider - region StreamsKafkaAuthentication: type: object - description: >- - User credentials required to connect to a Kafka Cluster. Includes the - authentication type, as well as the parameters for that authentication - mode. + description: User credentials required to connect to a Kafka Cluster. Includes + the authentication type, as well as the parameters for that + authentication mode. properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true mechanism: type: string - description: >- - Style of authentication. Can be one of PLAIN, SCRAM-256, or + description: Style of authentication. Can be one of PLAIN, SCRAM-256, or SCRAM-512. password: type: string @@ -28318,24 +26142,22 @@ components: description: Username of the account to connect to the Kafka cluster. StreamsKafkaSecurity: type: object - description: >- - Properties for the secure transport connection to Kafka. For SSL, this - can include the trusted certificate to use. + description: Properties for the secure transport connection to Kafka. For SSL, + this can include the trusted certificate to use. properties: brokerPublicCertificate: type: string description: A trusted, public x509 certificate for connecting to Kafka over SSL. links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true protocol: type: string @@ -28355,10 +26177,10 @@ components: type: array description: List of connections configured in the stream instance. items: - $ref: '#/components/schemas/StreamsConnection' + $ref: "#/components/schemas/StreamsConnection" readOnly: true dataProcessRegion: - $ref: '#/components/schemas/StreamsDataProcessRegion' + $ref: "#/components/schemas/StreamsDataProcessRegion" groupId: type: string description: Unique 24-hexadecimal character string that identifies the project. @@ -28377,29 +26199,26 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true name: type: string description: Human-readable label that identifies the stream instance. SynonymSource: type: object - description: >- - Data set that stores the mapping one or more words map to one or more - synonyms of those words. + description: Data set that stores the mapping one or more words map to one or + more synonyms of those words. properties: collection: type: string - description: >- - Human-readable label that identifies the MongoDB collection that + description: Human-readable label that identifies the MongoDB collection that stores words and their applicable synonyms. required: - collection @@ -28407,36 +26226,32 @@ components: type: object properties: apiKey: - $ref: '#/components/schemas/ApiKey' + $ref: "#/components/schemas/ApiKey" appName: type: string - description: >- - Human-readable label that identifies the service from which you + description: Human-readable label that identifies the service from which you requested this response. readOnly: true build: type: string - description: >- - Unique 40-hexadecimal digit hash that identifies the latest git + description: Unique 40-hexadecimal digit hash that identifies the latest git commit merged for this application. example: 83be55e140f493c88e7f578aae96548dd881587b readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true throttling: type: boolean - description: >- - Flag that indicates whether someone enabled throttling on this + description: Flag that indicates whether someone enabled throttling on this service. readOnly: true required: @@ -28449,8 +26264,7 @@ components: properties: linkToken: type: string - description: >- - Link token that contains all the information required to complete + description: Link token that contains all the information required to complete the link. required: - linkToken @@ -28476,15 +26290,14 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true name: type: string @@ -28495,8 +26308,7 @@ components: items: type: string format: email - description: >- - List that contains email addresses that identify MongoDB Cloud + description: List that contains email addresses that identify MongoDB Cloud users to in this team. uniqueItems: true required: @@ -28514,15 +26326,14 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true name: type: string @@ -28532,20 +26343,18 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true roleNames: type: array - description: >- - One or more organization- or project-level roles to assign to the + description: One or more organization- or project-level roles to assign to the MongoDB Cloud user. items: type: string @@ -28569,16 +26378,15 @@ components: readOnly: true deliveryType: type: string - description: >- - Means by which this resource returns the snapshot to the requesting + description: Means by which this resource returns the snapshot to the requesting MongoDB Cloud user. readOnly: true expirationDate: type: string format: date-time - description: >- - Date and time when the download link no longer works. This parameter - expresses its value in the ISO 8601 timestamp format in UTC. + description: Date and time when the download link no longer works. This + parameter expresses its value in the ISO 8601 timestamp format in + UTC. readOnly: true id: type: string @@ -28590,20 +26398,18 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true projectId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project from + description: Unique 24-hexadecimal digit string that identifies the project from which the restore job originated. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -28613,8 +26419,7 @@ components: restoreFinishedDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud completed writing this snapshot. + description: Date and time when MongoDB Cloud completed writing this snapshot. MongoDB Cloud changes the status of the restore job to `CLOSED`. This parameter expresses its value in the ISO 8601 timestamp format in UTC. @@ -28622,23 +26427,20 @@ components: restoreScheduledDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud will restore this snapshot. This + description: Date and time when MongoDB Cloud will restore this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true snapshotFinishedDate: type: string format: date-time - description: >- - Date and time when MongoDB Cloud completed writing this snapshot. + description: Date and time when MongoDB Cloud completed writing this snapshot. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true snapshotId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the snapshot to + description: Unique 24-hexadecimal digit string that identifies the snapshot to restore. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -28646,21 +26448,18 @@ components: pattern: ^([a-f0-9]{24})$ snapshotUrl: type: string - description: >- - Internet address from which you can download the compressed snapshot - files. The resource returns this parameter when `"deliveryType" : - "DOWNLOAD"`. + description: 'Internet address from which you can download the compressed + snapshot files. The resource returns this parameter + when `"deliveryType" : "DOWNLOAD"`.' readOnly: true status: type: string - description: >- - Phase of the restore workflow for this job at the time this resource - made this request. + description: Phase of the restore workflow for this job at the time this + resource made this request. readOnly: true targetDeploymentItemName: type: string - description: >- - Human-readable label that identifies the cluster on the target + description: Human-readable label that identifies the cluster on the target project to which you want to restore the snapshot. You can restore the snapshot to a cluster tier *M2* or greater. maxLength: 64 @@ -28668,8 +26467,7 @@ components: pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ targetProjectId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that contains the cluster to which you want to restore the snapshot. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -28690,80 +26488,60 @@ components: Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. Alternatively: - Human-readable label that identifies the service to which you want - to integrate with MongoDB Cloud. The value must match the - third-party service integration type. + Human-readable label that identifies the service to which you want to integrate with MongoDB Cloud. The value must match the third-party service integration type. apiKey: type: string description: >- Key that allows MongoDB Cloud to access your Datadog account. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. + * Query the alert for the notification through the Atlas Administration API. Alternatively: @@ -28771,15 +26549,13 @@ components: Key that allows MongoDB Cloud to access your Opsgenie account. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. + * Query the alert for the notification through the Atlas Administration API. Alternatively: @@ -28787,16 +26563,14 @@ components: Key that allows MongoDB Cloud to access your VictorOps account. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. - example: '********************************9abc' + * Query the alert for the notification through the Atlas Administration API. + example: "********************************9abc" region: type: string description: >- @@ -28804,21 +26578,17 @@ components: access the Datadog API. - To learn more about Datadog's regions, see Datadog Sites. + To learn more about Datadog's regions, see Datadog Sites. Alternatively: - Two-letter code that indicates which regional URL MongoDB uses to - access the Opsgenie API. + Two-letter code that indicates which regional URL MongoDB uses to access the Opsgenie API. Alternatively: - PagerDuty region that indicates the API Uniform Resource Locator - (URL) to use. + PagerDuty region that indicates the API Uniform Resource Locator (URL) to use. microsoftTeamsWebhookUrl: type: string description: >- @@ -28826,13 +26596,11 @@ components: Cloud sends notifications. - **NOTE**: When you view or edit the alert for a Microsoft Teams - notification, the URL appears partially redacted. + **NOTE**: When you view or edit the alert for a Microsoft Teams notification, the URL appears partially redacted. example: https://webhook.com/**** accountId: type: string - description: >- - Unique 40-hexadecimal digit string that identifies your New Relic + description: Unique 40-hexadecimal digit string that identifies your New Relic account. example: bcc3c81b344a6030a3935c2527e2216535af7718 maxLength: 40 @@ -28845,15 +26613,9 @@ components: license. - **IMPORTANT**: Effective Wednesday, June 16th, 2021, New Relic no - longer supports the plugin-based integration with MongoDB. We do not - recommend that you sign up for the plugin-based integration. + **IMPORTANT**: Effective Wednesday, June 16th, 2021, New Relic no longer supports the plugin-based integration with MongoDB. We do not recommend that you sign up for the plugin-based integration. - To learn more, see the New Relic Plugin EOL Statement Consider - configuring an alternative monitoring integration before June 16th - to maintain visibility into your MongoDB deployments. + To learn more, see the New Relic Plugin EOL Statement Consider configuring an alternative monitoring integration before June 16th to maintain visibility into your MongoDB deployments. example: bc3768f44193c282b2688ab39e00f8e4fc8d75ea maxLength: 40 minLength: 40 @@ -28872,26 +26634,22 @@ components: Service key associated with your PagerDuty account. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. - example: '****************************7890' + * Query the alert for the notification through the Atlas Administration API. + example: "****************************7890" enabled: type: boolean - description: >- - Flag that indicates whether someone has activated the Prometheus + description: Flag that indicates whether someone has activated the Prometheus integration. listenAddress: type: string - default: ':9216' - description: >- - Combination of IPv4 address and Internet Assigned Numbers Authority + default: :9216 + description: Combination of IPv4 address and Internet Assigned Numbers Authority (IANA) port or the IANA port alone to which Prometheus binds to ingest MongoDB metrics. password: @@ -28903,22 +26661,19 @@ components: writeOnly: true scheme: type: string - description: >- - Security Scheme to apply to HyperText Transfer Protocol (HTTP) + description: Security Scheme to apply to HyperText Transfer Protocol (HTTP) traffic between Prometheus and MongoDB Cloud. serviceDiscovery: type: string description: Desired method to discover the Prometheus service. tlsPemPath: type: string - description: >- - Root-relative path to the Transport Layer Security (TLS) Privacy + description: Root-relative path to the Transport Layer Security (TLS) Privacy Enhanced Mail (PEM) key and certificate file on the host. example: /path/to/file username: type: string - description: >- - Human-readable label that identifies your Prometheus incoming + description: Human-readable label that identifies your Prometheus incoming webhook. example: prom_user_618d48e05277a606ed2496fe apiToken: @@ -28927,35 +26682,28 @@ components: Key that allows MongoDB Cloud to access your Slack account. - **NOTE**: After you create a notification which requires an API or - integration key, the key appears partially redacted when you: + **NOTE**: After you create a notification which requires an API or integration key, the key appears partially redacted when you: * View or edit the alert through the Atlas UI. - * Query the alert for the notification through the Atlas - Administration API. + * Query the alert for the notification through the Atlas Administration API. - **IMPORTANT**: Slack integrations now use the OAuth2 verification - method and must be initially configured, or updated from a legacy - integration, through the Atlas third-party service integrations - page. Legacy tokens will soon no longer be supported. - example: >- - **********************************************************************abcd + **IMPORTANT**: Slack integrations now use the OAuth2 verification method and must be initially configured, or updated from a legacy integration, through the Atlas third-party service integrations page. Legacy tokens will soon no longer be supported. + example: "*********************************************************************\ + *abcd" channelName: type: string - description: >- - Name of the Slack channel to which MongoDB Cloud sends alert + description: Name of the Slack channel to which MongoDB Cloud sends alert notifications. example: alerts maxLength: 80 minLength: 1 teamName: type: string - description: >- - Human-readable label that identifies your Slack team. Set this + description: Human-readable label that identifies your Slack team. Set this parameter when you configure a legacy Slack integration. example: MongoDB routingKey: @@ -28969,17 +26717,15 @@ components: secret. - **NOTE**: When you view or edit the alert for a webhook - notification, the secret appears completely redacted. - example: '******' + **NOTE**: When you view or edit the alert for a webhook notification, the secret appears completely redacted. + example: "******" url: type: string description: >- Endpoint web address to which MongoDB Cloud sends notifications. - **NOTE**: When you view or edit the alert for a webhook - notification, the URL appears partially redacted. + **NOTE**: When you view or edit the alert for a webhook notification, the URL appears partially redacted. example: https://webhook.com/**** title: Third-Party Integration TriggerIngestionPipelineRequest: @@ -29000,15 +26746,13 @@ components: properties: desc: type: string - description: >- - Purpose or explanation provided when someone creates this + description: Purpose or explanation provided when someone creates this organization API key. maxLength: 250 minLength: 1 roles: type: array - description: >- - List of roles to grant this API key. If you provide this list, + description: List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization. items: @@ -29018,15 +26762,13 @@ components: properties: desc: type: string - description: >- - Purpose or explanation provided when someone creates this project + description: Purpose or explanation provided when someone creates this project API key. maxLength: 250 minLength: 1 roles: type: array - description: >- - List of roles to grant this API key. If you provide this list, + description: List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this project. items: @@ -29038,12 +26780,12 @@ components: type: array description: List of the individual privilege actions that the role grants. items: - $ref: '#/components/schemas/DatabasePrivilegeAction' + $ref: "#/components/schemas/DatabasePrivilegeAction" inheritedRoles: type: array description: List of the built-in roles that this custom role inherits. items: - $ref: '#/components/schemas/DatabaseInheritedRole' + $ref: "#/components/schemas/DatabaseInheritedRole" uniqueItems: true UpdateGroupRolesForUser: type: object @@ -29056,35 +26798,32 @@ components: uniqueItems: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true UpdateOrgRolesForUser: type: object properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true orgRoles: type: array - description: >- - One or more organization level roles to assign to the MongoDB Cloud + description: One or more organization level roles to assign to the MongoDB Cloud user. items: type: string @@ -29094,20 +26833,17 @@ components: properties: cidrBlock: type: string - description: >- - Range of network addresses that you want to add to the access list + description: Range of network addresses that you want to add to the access list for the API key. This parameter requires the range to be expressed in classless inter-domain routing (CIDR) notation of Internet Protocol version 4 or version 6 addresses. You can set a value for this parameter or **ipAddress** but not both in the same request. example: 203.0.113.0/24 - pattern: >- - ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ count: type: integer format: int32 - description: >- - Total number of requests that have originated from the Internet + description: Total number of requests that have originated from the Internet Protocol (IP) address given as the value of the *lastUsedAddress* parameter. minimum: 1 @@ -29115,27 +26851,23 @@ components: created: type: string format: date-time - description: >- - Date and time when someone added the network addresses to the + description: Date and time when someone added the network addresses to the specified API access list. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true ipAddress: type: string - description: >- - Network address that you want to add to the access list for the API + description: Network address that you want to add to the access list for the API key. This parameter requires the address to be expressed as one Internet Protocol version 4 or version 6 address. You can set a value for this parameter or **cidrBlock** but not both in the same request. example: 203.0.113.10 - pattern: >- - ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ lastUsed: type: string format: date-time - description: >- - Date and time when MongoDB Cloud received the most recent request + description: Date and time when MongoDB Cloud received the most recent request that originated from this Internet Protocol version 4 or version 6 address. The resource returns this parameter when at least one request has originated from this IP address. MongoDB Cloud updates @@ -29145,34 +26877,30 @@ components: readOnly: true lastUsedAddress: type: string - description: >- - Network address that issued the most recent request to the API. This - parameter requires the address to be expressed as one Internet + description: Network address that issued the most recent request to the API. + This parameter requires the address to be expressed as one Internet Protocol version 4 or version 6 address. The resource returns this parameter after this IP address made at least one request. example: 203.0.113.10 - pattern: >- - ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true UserAccessRoleAssignment: type: object properties: apiUserId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization API key. maxLength: 24 minLength: 24 @@ -29180,8 +26908,7 @@ components: readOnly: true roles: type: array - description: >- - List of roles to grant this API key. If you provide this list, + description: List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this project. items: @@ -29192,15 +26919,13 @@ components: _id: type: integer format: int64 - description: >- - Unique 24-hexadecimal character string that identifies this + description: Unique 24-hexadecimal character string that identifies this certificate. readOnly: true createdAt: type: string format: date-time - description: >- - Date and time when MongoDB Cloud created this certificate. This + description: Date and time when MongoDB Cloud created this certificate. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -29214,41 +26939,35 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true monthsUntilExpiration: type: integer format: int32 default: 3 - description: >- - Number of months that the certificate remains valid until it - expires. + description: Number of months that the certificate remains valid until it expires. maximum: 24 writeOnly: true notAfter: type: string format: date-time - description: >- - Date and time when this certificate expires. This parameter + description: Date and time when this certificate expires. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true subject: type: string - description: >- - Subject Alternative Name associated with this certificate. This + description: Subject Alternative Name associated with this certificate. This parameter expresses its value as a distinguished name as defined in [RFC 2253](https://tools.ietf.org/html/2253). example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com - pattern: >- - ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ readOnly: true UserCustomDBRole: type: object @@ -29257,20 +26976,18 @@ components: type: array description: List of the individual privilege actions that the role grants. items: - $ref: '#/components/schemas/DatabasePrivilegeAction' + $ref: "#/components/schemas/DatabasePrivilegeAction" inheritedRoles: type: array description: List of the built-in roles that this custom role inherits. items: - $ref: '#/components/schemas/DatabaseInheritedRole' + $ref: "#/components/schemas/DatabaseInheritedRole" uniqueItems: true roleName: type: string - description: >- - Human-readable label that identifies the role for the request. This + description: Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project. - pattern: >- - ^\b(?!xgen-)([0-9A-Za-z_\-]+)\b(?- - Human-readable label that identifies the cluster or MongoDB Atlas + description: Human-readable label that identifies the cluster or MongoDB Atlas Data Lake that this database user can access. maxLength: 64 minLength: 1 @@ -29296,31 +27012,29 @@ components: type: object properties: customerX509: - $ref: '#/components/schemas/DBUserTLSX509Settings' + $ref: "#/components/schemas/DBUserTLSX509Settings" ldap: - $ref: '#/components/schemas/LDAPSecuritySettings' + $ref: "#/components/schemas/LDAPSecuritySettings" links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true UserToDNMapping: type: object - description: >- - User-to-Distinguished Name (DN) map that MongoDB Cloud uses to transform - a Lightweight Directory Access Protocol (LDAP) username into an LDAP DN. + description: User-to-Distinguished Name (DN) map that MongoDB Cloud uses to + transform a Lightweight Directory Access Protocol (LDAP) username into + an LDAP DN. properties: ldapQuery: type: string - description: >- - Lightweight Directory Access Protocol (LDAP) query template that + description: Lightweight Directory Access Protocol (LDAP) query template that inserts the LDAP name that the regular expression matches into an LDAP query Uniform Resource Identifier (URI). The formatting for the query must conform to [RFC @@ -29328,17 +27042,15 @@ components: 4516](https://datatracker.ietf.org/doc/html/rfc4516). match: type: string - description: >- - Regular expression that MongoDB Cloud uses to match against the + description: Regular expression that MongoDB Cloud uses to match against the provided Lightweight Directory Access Protocol (LDAP) username. Each parenthesis-enclosed section represents a regular expression capture group that the substitution or `ldapQuery` template uses. example: (.*) substitution: type: string - description: >- - Lightweight Directory Access Protocol (LDAP) Distinguished Name (DN) - template that converts the LDAP username that matches regular + description: Lightweight Directory Access Protocol (LDAP) Distinguished Name + (DN) template that converts the LDAP username that matches regular expression in the *match* parameter into an LDAP Distinguished Name (DN). example: CN={0},CN=Users,DC=my-atlas-ldap-server,DC=example,DC=com @@ -29358,8 +27070,7 @@ components: format: date-time raw: type: object - description: >- - Additional meta information captured about this event. The response + description: Additional meta information captured about this event. The response returns this parameter as a JSON object when the query parameter `includeRaw=true`. The list of fields in the raw document may change. Don't rely on raw values for formal monitoring. @@ -29370,8 +27081,7 @@ components: example: ALERT_AUDIT alertConfigId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the alert + description: Unique 24-hexadecimal digit string that identifies the alert configuration related to the event. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -29380,8 +27090,7 @@ components: readOnly: true cid: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project in + description: Unique 24-hexadecimal digit string that identifies the project in which the event occurred. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -29391,9 +27100,8 @@ components: cre: type: string format: date-time - description: >- - Date and time when this event occurred. This parameter expresses its - value in the ISO 8601 timestamp format in UTC. readOnly: true @@ -29417,8 +27125,7 @@ components: readOnly: true orgId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the organization + description: Unique 24-hexadecimal digit string that identifies the organization to which these events apply. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -29427,8 +27134,7 @@ components: readOnly: true orgName: type: string - description: >- - Human-readable label that identifies the organization that contains + description: Human-readable label that identifies the organization that contains the project. example: Test Organization maxLength: 64 @@ -29445,14 +27151,11 @@ components: Flag that indicates whether the project's clusters deployed to Amazon Web Services (AWS) use a custom Domain Name System (DNS). - When `"enabled": true`, connect to your cluster using Private IP for - Peering connection strings. + When `"enabled": true`, connect to your cluster using Private IP for Peering connection strings. externalDocs: - description: >- - To learn more, see FAQ: Connection String Options in the MongoDB - Atlas documentation. - url: >- - https://www.mongodb.com/docs/atlas/reference/faq/connection-changes/#how-does-this-affect-aws-vpc-peering-when-i-use-custom-dns- + description: "To learn more, see FAQ: Connection String Options in the MongoDB + Atlas documentation." + url: https://www.mongodb.com/docs/atlas/reference/faq/connection-changes/#how-does-this-affect-aws-vpc-peering-when-i-use-custom-dns- required: - enabled AccessListItem: @@ -29460,17 +27163,14 @@ components: properties: cidrBlock: type: string - description: >- - Range of IP addresses in Classless Inter-Domain Routing (CIDR) + description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) notation that found in this project's access list. - pattern: >- - ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ readOnly: true ipAddress: type: string description: IP address included in the API access list. - pattern: >- - ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ readOnly: true required: - ipAddress @@ -29479,8 +27179,7 @@ components: properties: clusterId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the cluster that + description: Unique 24-hexadecimal digit string that identifies the cluster that contains the checkpoint. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -29490,15 +27189,13 @@ components: completed: type: string format: date-time - description: >- - Date and time when the checkpoint completed and the balancer + description: Date and time when the checkpoint completed and the balancer restarted. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that owns the checkpoints. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -29515,15 +27212,14 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true parts: type: array @@ -29533,30 +27229,26 @@ components: - For a replica set, this array contains a single document. - - For a sharded cluster, this array contains one document for each - shard plus one document for the config host. + - For a sharded cluster, this array contains one document for each shard plus one document for the config host. items: - $ref: '#/components/schemas/ApiCheckpointPart' + $ref: "#/components/schemas/ApiCheckpointPart" readOnly: true restorable: type: boolean - description: >- - Flag that indicates whether MongoDB Cloud can use the checkpoint for - a restore. + description: Flag that indicates whether MongoDB Cloud can use the checkpoint + for a restore. readOnly: true started: type: string format: date-time - description: >- - Date and time when the balancer stopped and began the checkpoint. + description: Date and time when the balancer stopped and began the checkpoint. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true timestamp: type: string format: date-time - description: >- - Date and time to which the checkpoint restores. This parameter + description: Date and time to which the checkpoint restores. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true ApiAtlasSnapshotSchedule: @@ -29565,15 +27257,13 @@ components: clusterCheckpointIntervalMin: type: integer format: int32 - description: >- - Quantity of time expressed in minutes between successive cluster + description: Quantity of time expressed in minutes between successive cluster checkpoints. This parameter applies only to sharded clusters. This number determines the granularity of continuous cloud backups for sharded clusters. clusterId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the cluster with + description: Unique 24-hexadecimal digit string that identifies the cluster with the snapshot you want to return. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -29582,14 +27272,12 @@ components: dailySnapshotRetentionDays: type: integer format: int32 - description: >- - Quantity of time to keep daily snapshots. MongoDB Cloud expresses + description: Quantity of time to keep daily snapshots. MongoDB Cloud expresses this value in days. Set this value to `0` to disable daily snapshot retention. groupId: type: string - description: >- - Unique 24-hexadecimal digit string that identifies the project that + description: Unique 24-hexadecimal digit string that identifies the project that contains the cluster. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -29598,28 +27286,25 @@ components: readOnly: true links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true monthlySnapshotRetentionMonths: type: integer format: int32 - description: >- - Number of months that MongoDB Cloud must keep monthly snapshots. Set - this value to `0` to disable monthly snapshot retention. + description: Number of months that MongoDB Cloud must keep monthly snapshots. + Set this value to `0` to disable monthly snapshot retention. pointInTimeWindowHours: type: integer format: int32 - description: >- - Number of hours before the current time from which MongoDB Cloud can - create a Continuous Cloud Backup snapshot. + description: Number of hours before the current time from which MongoDB Cloud + can create a Continuous Cloud Backup snapshot. snapshotIntervalHours: type: integer format: int32 @@ -29631,8 +27316,7 @@ components: weeklySnapshotRetentionWeeks: type: integer format: int32 - description: >- - Number of weeks that MongoDB Cloud must keep weekly snapshots. Set + description: Number of weeks that MongoDB Cloud must keep weekly snapshots. Set this value to `0` to disable weekly snapshot retention. required: - clusterCheckpointIntervalMin @@ -29646,23 +27330,20 @@ components: - weeklySnapshotRetentionWeeks ApiBSONTimestamp: type: object - description: >- - BSON timestamp that indicates when the checkpoint token entry in the - oplog occurred. + description: BSON timestamp that indicates when the checkpoint token entry in + the oplog occurred. properties: date: type: string format: date-time - description: >- - Date and time when the oplog recorded this database operation. This + description: Date and time when the oplog recorded this database operation. This parameter expresses its value in the ISO 8601 timestamp format in UTC. readOnly: true increment: type: integer format: int32 - description: >- - Order of the database operation that the oplog recorded at specific + description: Order of the database operation that the oplog recorded at specific date and time. example: 1199145600 minimum: 1199145600 @@ -29671,20 +27352,17 @@ components: title: BSON Timestamp ApiCheckpointPart: type: object - description: >- - Metadata contained in one document that describes the complete snapshot - taken for this node. + description: Metadata contained in one document that describes the complete + snapshot taken for this node. properties: replicaSetName: type: string - description: >- - Human-readable label that identifies the replica set to which this + description: Human-readable label that identifies the replica set to which this checkpoint applies. readOnly: true shardName: type: string - description: >- - Human-readable label that identifies the shard to which this + description: Human-readable label that identifies the shard to which this checkpoint applies. readOnly: true tokenDiscovered: @@ -29692,11 +27370,10 @@ components: description: Flag that indicates whether the token exists. readOnly: true tokenTimestamp: - $ref: '#/components/schemas/ApiBSONTimestamp' + $ref: "#/components/schemas/ApiBSONTimestamp" typeName: type: string - description: >- - Human-readable label that identifies the type of host that the part + description: Human-readable label that identifies the type of host that the part represents. readOnly: true readOnly: true @@ -29706,8 +27383,7 @@ components: properties: exportBucketId: type: string - description: >- - Unique 24-hexadecimal character string that identifies the AWS + description: Unique 24-hexadecimal character string that identifies the AWS Bucket. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 @@ -29715,8 +27391,7 @@ components: pattern: ^([a-f0-9]{24})$ frequencyType: type: string - description: >- - Human-readable label that indicates the rate at which the export + description: Human-readable label that indicates the rate at which the export policy item occurs. title: export CostExplorerFilterResponse: @@ -29735,15 +27410,11 @@ components: Rules by which MongoDB MongoDB Cloud archives data. - Use the **criteria.type** field to choose how MongoDB Cloud selects data - to archive. Choose data using the age of the data or a MongoDB query. + Use the **criteria.type** field to choose how MongoDB Cloud selects data to archive. Choose data using the age of the data or a MongoDB query. - **"criteria.type": "DATE"** selects documents to archive based on a - date. + **"criteria.type": "DATE"** selects documents to archive based on a date. - **"criteria.type": "CUSTOM"** selects documents to archive based on a - custom JSON query. MongoDB Cloud doesn't support **"criteria.type": - "CUSTOM"** when **"collectionType": "TIMESERIES"**. + **"criteria.type": "CUSTOM"** selects documents to archive based on a custom JSON query. MongoDB Cloud doesn't support **"criteria.type": "CUSTOM"** when **"collectionType": "TIMESERIES"**. properties: type: type: string @@ -29753,25 +27424,22 @@ components: **DATE** selects documents to archive based on a date. - **CUSTOM** selects documents to archive based on a custom JSON - query. MongoDB Cloud doesn't support **CUSTOM** when - `"collectionType": "TIMESERIES"`. + **CUSTOM** selects documents to archive based on a custom JSON query. MongoDB Cloud doesn't support **CUSTOM** when `"collectionType": "TIMESERIES"`. query: type: string - description: >- - MongoDB find query that selects documents to archive. The specified - query follows the syntax of the `db.collection.find(query)` command. - This query can't use the empty document (`{}`) to return all - documents. Set this parameter when **"criteria.type" : "CUSTOM"**. + description: "MongoDB find query that selects documents to archive. The + specified query follows the syntax of the + `db.collection.find(query)` command. This query can't use the empty + document (`{}`) to return all documents. Set this parameter when + **\"criteria.type\" : \"CUSTOM\"**." dateField: type: string - description: >- - Indexed database parameter that stores the date that determines when - data moves to the online archive. MongoDB Cloud archives the data - when the current date exceeds the date in this database parameter - plus the number of days specified through the **expireAfterDays** - parameter. Set this parameter when you set `"criteria.type" : - "DATE"`. + description: 'Indexed database parameter that stores the date that determines + when data moves to the online archive. MongoDB Cloud archives the + data when the current date exceeds the date in this database + parameter plus the number of days specified through the + **expireAfterDays** parameter. Set this parameter when you set + `"criteria.type" : "DATE"`.' dateFormat: type: string default: ISODATE @@ -29781,59 +27449,51 @@ components: Epoch timestamp can be expressed as nanoseconds, milliseconds, or seconds. Set this parameter when **"criteria.type" : "DATE"**. - You must set **"criteria.type" : "DATE"** if **"collectionType": - "TIMESERIES"**. + You must set **"criteria.type" : "DATE"** if **"collectionType": "TIMESERIES"**. expireAfterDays: type: integer format: int32 - description: >- - Number of days after the value in the **criteria.dateField** when + description: 'Number of days after the value in the **criteria.dateField** when MongoDB Cloud archives data in the specified cluster. Set this - parameter when you set **"criteria.type" : "DATE"**. + parameter when you set **"criteria.type" : "DATE"**.' DataProcessRegion: type: object - description: >- - Settings to configure the region where you wish to store your archived - data. + description: Settings to configure the region where you wish to store your + archived data. properties: cloudProvider: type: string - description: >- - Human-readable label that identifies the Cloud service provider + description: Human-readable label that identifies the Cloud service provider where you wish to store your archived data. region: type: string - description: >- - Human-readable label that identifies the geographic location of the + description: Human-readable label that identifies the geographic location of the region where you wish to store your archived data. GroupPaginatedEvent: type: object properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/EventViewForNdsGroup' + $ref: "#/components/schemas/EventViewForNdsGroup" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -29842,44 +27502,37 @@ components: properties: collection: type: string - description: >- - Human-readable label of the collection to manage for this Global + description: Human-readable label of the collection to manage for this Global Cluster. customShardKey: type: string - description: >- - Database parameter used to divide the *collection* into shards. + description: Database parameter used to divide the *collection* into shards. Global clusters require a compound shard key. This compound shard key combines the location parameter and the user-selected custom key. db: type: string - description: >- - Human-readable label of the database to manage for this Global + description: Human-readable label of the database to manage for this Global Cluster. isCustomShardKeyHashed: type: boolean default: false - description: >- - Flag that indicates whether someone hashed the custom shard key. If + description: Flag that indicates whether someone hashed the custom shard key. If this parameter returns `false`, this cluster uses ranged sharding. isShardKeyUnique: type: boolean default: false - description: >- - Flag that indicates whether the underlying index enforces unique + description: Flag that indicates whether the underlying index enforces unique values. numInitialChunks: type: integer format: int64 - description: >- - Minimum number of chunks to create initially when sharding an empty + description: Minimum number of chunks to create initially when sharding an empty collection with a hashed shard key. presplitHashedZones: type: boolean default: false - description: >- - Flag that indicates whether MongoDB Cloud should create and + description: Flag that indicates whether MongoDB Cloud should create and distribute initial chunks for an empty or non-existing collection. MongoDB Cloud distributes data based on the defined zones and zone ranges for the collection. @@ -29892,12 +27545,11 @@ components: number: type: number format: double - description: >- - Amount of the **metricName** recorded at the time of the event. This - value triggered the alert. + description: Amount of the **metricName** recorded at the time of the event. + This value triggered the alert. readOnly: true units: - $ref: '#/components/schemas/NumberMetricUnits' + $ref: "#/components/schemas/NumberMetricUnits" readOnly: true title: Number Metric Value OrgPaginatedEvent: @@ -29905,29 +27557,26 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/EventViewForOrg' + $ref: "#/components/schemas/EventViewForOrg" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -29936,23 +27585,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/AdvancedClusterDescription' + $ref: "#/components/schemas/AdvancedClusterDescription" readOnly: true totalCount: type: integer @@ -29965,29 +27612,26 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/GroupAlertsConfig' + $ref: "#/components/schemas/GroupAlertsConfig" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -29996,29 +27640,26 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/AlertViewForNdsGroup' + $ref: "#/components/schemas/AlertViewForNdsGroup" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -30027,23 +27668,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/ApiKeyUserDetails' + $ref: "#/components/schemas/ApiKeyUserDetails" readOnly: true totalCount: type: integer @@ -30056,23 +27695,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/CloudAppUser' + $ref: "#/components/schemas/CloudAppUser" readOnly: true totalCount: type: integer @@ -30085,23 +27722,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/ApiAtlasCheckpoint' + $ref: "#/components/schemas/ApiAtlasCheckpoint" readOnly: true totalCount: type: integer @@ -30111,29 +27746,26 @@ components: readOnly: true PaginatedApiAtlasDatabaseUser: type: object - description: >- - List of MongoDB Database users granted access to databases in the + description: List of MongoDB Database users granted access to databases in the specified project. properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/CloudDatabaseUser' + $ref: "#/components/schemas/CloudDatabaseUser" readOnly: true totalCount: type: integer @@ -30146,23 +27778,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/DiskBackupExportJob' + $ref: "#/components/schemas/DiskBackupExportJob" readOnly: true totalCount: type: integer @@ -30175,23 +27805,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/CloudProviderRegions' + $ref: "#/components/schemas/CloudProviderRegions" readOnly: true totalCount: type: integer @@ -30204,23 +27832,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/ServerlessBackupRestoreJob' + $ref: "#/components/schemas/ServerlessBackupRestoreJob" readOnly: true totalCount: type: integer @@ -30233,23 +27859,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/ServerlessBackupSnapshot' + $ref: "#/components/schemas/ServerlessBackupSnapshot" readOnly: true totalCount: type: integer @@ -30262,23 +27886,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/BillingInvoice' + $ref: "#/components/schemas/BillingInvoice" readOnly: true totalCount: type: integer @@ -30291,29 +27913,26 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/StreamsConnection' + $ref: "#/components/schemas/StreamsConnection" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -30322,29 +27941,26 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/StreamsTenant' + $ref: "#/components/schemas/StreamsTenant" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -30353,23 +27969,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/UserAccessList' + $ref: "#/components/schemas/UserAccessList" readOnly: true totalCount: type: integer @@ -30382,23 +27996,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/CloudAppUser' + $ref: "#/components/schemas/CloudAppUser" readOnly: true totalCount: type: integer @@ -30411,23 +28023,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/Group' + $ref: "#/components/schemas/Group" readOnly: true totalCount: type: integer @@ -30440,23 +28050,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/DiskBackupSnapshotAWSExportBucket' + $ref: "#/components/schemas/DiskBackupSnapshotAWSExportBucket" readOnly: true totalCount: type: integer @@ -30469,23 +28077,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/DiskBackupSnapshot' + $ref: "#/components/schemas/DiskBackupSnapshot" readOnly: true totalCount: type: integer @@ -30498,23 +28104,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/DiskBackupReplicaSet' + $ref: "#/components/schemas/DiskBackupReplicaSet" readOnly: true totalCount: type: integer @@ -30527,23 +28131,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/DiskBackupSnapshotRestoreJob' + $ref: "#/components/schemas/DiskBackupSnapshotRestoreJob" readOnly: true totalCount: type: integer @@ -30556,23 +28158,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/DiskBackupShardedClusterSnapshot' + $ref: "#/components/schemas/DiskBackupShardedClusterSnapshot" readOnly: true totalCount: type: integer @@ -30586,23 +28186,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/CloudProviderContainer' + $ref: "#/components/schemas/CloudProviderContainer" readOnly: true totalCount: type: integer @@ -30617,29 +28215,26 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/BaseNetworkPeeringConnectionSettings' + $ref: "#/components/schemas/BaseNetworkPeeringConnectionSettings" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -30648,23 +28243,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/MesurementsDatabase' + $ref: "#/components/schemas/MesurementsDatabase" readOnly: true totalCount: type: integer @@ -30677,23 +28270,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/MeasurementDiskPartition' + $ref: "#/components/schemas/MeasurementDiskPartition" readOnly: true totalCount: type: integer @@ -30706,29 +28297,26 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/ThridPartyIntegration' + $ref: "#/components/schemas/ThridPartyIntegration" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -30737,23 +28325,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/NetworkPermissionEntry' + $ref: "#/components/schemas/NetworkPermissionEntry" readOnly: true totalCount: type: integer @@ -30766,23 +28352,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/BackupOnlineArchive' + $ref: "#/components/schemas/BackupOnlineArchive" readOnly: true totalCount: type: integer @@ -30795,23 +28379,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/OrgGroup' + $ref: "#/components/schemas/OrgGroup" readOnly: true totalCount: type: integer @@ -30824,23 +28406,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/AtlasOrganization' + $ref: "#/components/schemas/AtlasOrganization" readOnly: true totalCount: type: integer @@ -30853,23 +28433,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/IngestionPipelineRun' + $ref: "#/components/schemas/IngestionPipelineRun" readOnly: true totalCount: type: integer @@ -30882,29 +28460,26 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/PrivateNetworkEndpointIdEntry' + $ref: "#/components/schemas/PrivateNetworkEndpointIdEntry" readOnly: true totalCount: type: integer format: int32 - description: >- - Number of documents returned in this response if **includeCount** + description: Number of documents returned in this response if **includeCount** query param is true. minimum: 0 readOnly: true @@ -30913,23 +28488,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/BackupRestoreJob' + $ref: "#/components/schemas/BackupRestoreJob" readOnly: true totalCount: type: integer @@ -30942,23 +28515,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/ServerlessInstanceDescription' + $ref: "#/components/schemas/ServerlessInstanceDescription" readOnly: true totalCount: type: integer @@ -30971,23 +28542,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/BackupSnapshot' + $ref: "#/components/schemas/BackupSnapshot" readOnly: true totalCount: type: integer @@ -31000,23 +28569,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/TeamRole' + $ref: "#/components/schemas/TeamRole" readOnly: true totalCount: type: integer @@ -31029,23 +28596,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/TeamResponse' + $ref: "#/components/schemas/TeamResponse" readOnly: true totalCount: type: integer @@ -31058,23 +28623,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/TenantRestore' + $ref: "#/components/schemas/TenantRestore" readOnly: true totalCount: type: integer @@ -31087,23 +28650,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/BackupTenantSnapshot' + $ref: "#/components/schemas/BackupTenantSnapshot" readOnly: true totalCount: type: integer @@ -31116,23 +28677,21 @@ components: properties: links: type: array - description: >- - List of one or more Uniform Resource Locators (URLs) that point to + description: List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships. externalDocs: description: Web Linking Specification (RFC 5988) url: https://datatracker.ietf.org/doc/html/rfc5988 items: - $ref: '#/components/schemas/Link' + $ref: "#/components/schemas/Link" readOnly: true results: type: array - description: >- - List of returned documents that MongoDB Cloud providers when + description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: '#/components/schemas/UserCert' + $ref: "#/components/schemas/UserCert" readOnly: true totalCount: type: integer @@ -31146,16 +28705,14 @@ components: properties: fieldName: type: string - description: >- - Human-readable label that identifies the parameter that MongoDB + description: Human-readable label that identifies the parameter that MongoDB Cloud uses to partition data. To specify a nested parameter, use the dot notation. maxLength: 700 fieldType: type: string - description: >- - Data type of the parameter that that MongoDB Cloud uses to partition - data. Partition parameters of type + description: Data type of the parameter that that MongoDB Cloud uses to + partition data. Partition parameters of type [UUID](http://bsonspec.org/spec.html) must be of binary subtype 4. MongoDB Cloud skips partition parameters of type UUID with subtype 3. @@ -31164,11 +28721,10 @@ components: type: integer format: int32 default: 0 - description: >- - Sequence in which MongoDB Cloud slices the collection data to create - partitions. The resource expresses this sequence starting with zero. - The value of the **criteria.dateField** parameter defaults as the - first item in the partition sequence. + description: Sequence in which MongoDB Cloud slices the collection data to + create partitions. The resource expresses this sequence starting + with zero. The value of the **criteria.dateField** parameter + defaults as the first item in the partition sequence. required: - fieldName - order @@ -31178,29 +28734,26 @@ components: properties: predicates: type: array - description: >- - List that contains the search criteria that the query uses. To use + description: List that contains the search criteria that the query uses. To use the values in key-value pairs in these predicates requires **Project Data Access Read Only** permissions or greater. Otherwise, MongoDB Cloud redacts these values. items: type: object - description: >- - List that contains the search criteria that the query uses. To use + description: List that contains the search criteria that the query uses. To use the values in key-value pairs in these predicates requires **Project Data Access Read Only** permissions or greater. Otherwise, MongoDB Cloud redacts these values. readOnly: true readOnly: true stats: - $ref: '#/components/schemas/PerformanceAdvisorOpStats' + $ref: "#/components/schemas/PerformanceAdvisorOpStats" PrivateIPMode: type: object properties: enabled: type: boolean - description: >- - Flag that indicates whether someone enabled **Connect via Peering + description: Flag that indicates whether someone enabled **Connect via Peering Only** mode for the specified project. required: - enabled @@ -31214,11 +28767,7 @@ components: endpoint setting for the specified project. - - Set this value to `true` to enable regionalized private endpoints. - This allows you to create more than one private endpoint in a cloud - provider region. You need to enable this setting to connect to - multi-region and global MongoDB Cloud sharded clusters. Enabling - regionalized private endpoints introduces the following limitations: + - Set this value to `true` to enable regionalized private endpoints. This allows you to create more than one private endpoint in a cloud provider region. You need to enable this setting to connect to multi-region and global MongoDB Cloud sharded clusters. Enabling regionalized private endpoints introduces the following limitations: - Your applications must use the new connection strings for existing multi-region and global sharded clusters. This might cause downtime. - Your MongoDB Cloud project can't contain replica sets nor can you create new replica sets in this project. @@ -31226,8 +28775,7 @@ components: - more than one private endpoint in more than one region - more than one private endpoint in one region and one private endpoint in one or more regions. - - Set this value to `false` to disable regionalized private - endpoints. + - Set this value to `false` to disable regionalized private endpoints. required: - enabled ResourceEventType: @@ -31241,8 +28789,7 @@ components: properties: charFilters: type: array - description: >- - Filters that examine text one character at a time and perform + description: Filters that examine text one character at a time and perform filtering operations. items: {} name: @@ -31263,36 +28810,30 @@ components: Filter that performs operations such as: - - Stemming, which reduces related words, such as "talking", - "talked", and "talks" to their root word "talk". + - Stemming, which reduces related words, such as "talking", "talked", and "talks" to their root word "talk". - - Redaction, the removal of sensitive information from public - documents. + - Redaction, the removal of sensitive information from public documents. items: {} tokenizer: type: object - description: >- - Tokenizer that you want to use to create tokens. Tokens determine + description: Tokenizer that you want to use to create tokens. Tokens determine how Atlas Search splits up text into discrete chunks for indexing. properties: maxGram: type: integer - description: >- - Characters to include in the longest token that Atlas Search + description: Characters to include in the longest token that Atlas Search creates. minGram: type: integer - description: >- - Characters to include in the shortest token that Atlas Search + description: Characters to include in the shortest token that Atlas Search creates. type: type: string description: Human-readable label that identifies this tokenizer type. group: type: integer - description: >- - Index of the character group within the matching expression to + description: Index of the character group within the matching expression to extract into tokens. Use `0` to extract all character groups. pattern: type: string @@ -31300,9 +28841,8 @@ components: maxTokenLength: type: integer default: 255 - description: >- - Maximum number of characters in a single token. Tokens greater - than this length are split at this length into multiple tokens. + description: Maximum number of characters in a single token. Tokens greater than + this length are split at this length into multiple tokens. required: - name - tokenizer @@ -31314,22 +28854,18 @@ components: dynamic: type: boolean default: false - description: >- - Flag that indicates whether the index uses dynamic or static + description: Flag that indicates whether the index uses dynamic or static mappings. Required if **mappings.fields** is omitted. externalDocs: description: Dynamic or Static Mappings - url: >- - https://www.mongodb.com/docs/atlas/atlas-search/index-definitions/#field-mapping-examples + url: https://www.mongodb.com/docs/atlas/atlas-search/index-definitions/#field-mapping-examples fields: type: object additionalProperties: externalDocs: description: Atlas Search Field Mappings - url: >- - https://www.mongodb.com/docs/atlas/atlas-search/define-field-mappings/#define-field-mappings - description: >- - One or more field specifications for the Atlas Search index. + url: https://www.mongodb.com/docs/atlas/atlas-search/define-field-mappings/#define-field-mappings + description: One or more field specifications for the Atlas Search index. Required if **mappings.dynamic** is omitted or set to **false**. externalDocs: description: Atlas Search Index diff --git a/tools/openapi-generator/merge.js b/tools/openapi-generator/merge.js index 7682f6f75a..f3092bde74 100644 --- a/tools/openapi-generator/merge.js +++ b/tools/openapi-generator/merge.js @@ -1,17 +1,17 @@ const fs = require('fs'); -const yaml = require('js-yaml'); +const yaml = require('yaml'); var atlasApi, atlasApiChanges; try { - atlasApi = yaml.load(fs.readFileSync('config/atlas-api.yaml', 'utf8')); + atlasApi = yaml.parse(fs.readFileSync('config/atlas-api.yaml', 'utf8')); } catch (err) { console.error(err); process.exit(1); } try { - atlasApiChanges = yaml.load(fs.readFileSync('config/atlas-api-changes.yaml', 'utf8')); + atlasApiChanges = yaml.parse(fs.readFileSync('config/atlas-api-changes.yaml', 'utf8')); } catch (err) { console.error(err); process.exit(1); @@ -49,7 +49,7 @@ visit(atlasApiChanges, function (k, v) { }); try { - fs.writeFileSync('config/atlas-api-transformed.yaml', yaml.dump(atlasApi), 'utf8') + fs.writeFileSync('config/atlas-api-transformed.yaml', yaml.stringify(atlasApi), 'utf8') } catch (err) { console.error(err); process.exit(1); diff --git a/tools/openapi-generator/package-lock.json b/tools/openapi-generator/package-lock.json index a0a0f694b2..abffaff5b0 100644 --- a/tools/openapi-generator/package-lock.json +++ b/tools/openapi-generator/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@openapitools/openapi-generator-cli": "^2.6.0", - "js-yaml": "^4.1.0" + "yaml": "^2.3.2" } }, "node_modules/@babel/runtime": { @@ -251,11 +251,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -805,17 +800,6 @@ "node": ">=6" } }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -1244,6 +1228,14 @@ "node": ">=10" } }, + "node_modules/yaml": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz", + "integrity": "sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==", + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -1405,11 +1397,6 @@ "color-convert": "^2.0.1" } }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1790,14 +1777,6 @@ "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==" }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "requires": { - "argparse": "^2.0.1" - } - }, "jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -2114,6 +2093,11 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" }, + "yaml": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz", + "integrity": "sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==" + }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index 2b40be0878..d2aad9516c 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -22,6 +22,6 @@ "homepage": "https://github.com/mongodb/mongodb-atlas-cli#readme", "dependencies": { "@openapitools/openapi-generator-cli": "^2.6.0", - "js-yaml": "^4.1.0" + "yaml": "^2.3.2" } } From 648fcf5e1cb9603f707df3782cfd7bf76db23df2 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 29 Sep 2023 16:22:56 +0100 Subject: [PATCH 29/44] clean code --- internal/api/api.go | 12 - internal/api/api_access_tracking_cmd.go | 60 +- internal/api/api_alert_configurations_cmd.go | 224 ++--- internal/api/api_alerts_cmd.go | 114 +-- internal/api/api_atlas_search_cmd.go | 142 +-- internal/api/api_auditing_cmd.go | 58 +- internal/api/api_aws_clusters_dns_cmd.go | 58 +- internal/api/api_cloud_backups_cmd.go | 814 ++++++++++-------- .../api/api_cloud_migration_service_cmd.go | 224 ++--- internal/api/api_cloud_provider_access_cmd.go | 140 ++- .../api/api_cluster_outage_simulation_cmd.go | 86 +- internal/api/api_clusters_cmd.go | 418 ++++----- internal/api/api_custom_database_roles_cmd.go | 140 ++- internal/api/api_data_federation_cmd.go | 394 +++++---- internal/api/api_data_lake_pipelines_cmd.go | 389 +++++---- internal/api/api_database_users_cmd.go | 142 +-- ..._rest_using_customer_key_management_cmd.go | 58 +- internal/api/api_events_cmd.go | 161 ++-- .../api/api_federated_authentication_cmd.go | 418 ++++----- internal/api/api_global_clusters_cmd.go | 142 +-- internal/api/api_invoices_cmd.go | 170 ++-- internal/api/api_ldap_configuration_cmd.go | 142 +-- internal/api/api_legacy_backup_cmd.go | 282 +++--- .../api/api_legacy_backup_restore_jobs_cmd.go | 30 +- internal/api/api_maintenance_windows__cmd.go | 136 ++- internal/api/api_mongo_db_cloud_users_cmd.go | 86 +- internal/api/api_monitoring_and_logs_cmd.go | 529 +++++++----- internal/api/api_network_peering_cmd.go | 366 ++++---- internal/api/api_online_archive_cmd.go | 170 ++-- internal/api/api_organizations_cmd.go | 478 +++++----- internal/api/api_performance_advisor_cmd.go | 140 ++- .../api/api_private_endpoint_services_cmd.go | 254 +++--- internal/api/api_programmatic_api_keys_cmd.go | 394 +++++---- .../api/api_project_ip_access_list_cmd.go | 142 +-- internal/api/api_projects_cmd.go | 588 +++++++------ internal/api/api_push_based_log_export_cmd.go | 108 +-- internal/api/api_rolling_index_cmd.go | 27 +- internal/api/api_root_cmd.go | 32 +- internal/api/api_serverless_instances_cmd.go | 142 +-- .../api_serverless_private_endpoints_cmd.go | 142 +-- .../api/api_shared_tier_restore_jobs_cmd.go | 86 +- internal/api/api_shared_tier_snapshots_cmd.go | 86 +- internal/api/api_streams_cmd.go | 282 +++--- internal/api/api_teams_cmd.go | 362 ++++---- .../api/api_third_party_integrations_cmd.go | 142 +-- internal/api/api_x509_authentication_cmd.go | 86 +- .../config/go-templates/api.mustache | 12 - .../config/go-templates/cmd.mustache | 45 +- 48 files changed, 5097 insertions(+), 4556 deletions(-) diff --git a/internal/api/api.go b/internal/api/api.go index 822ed5ff45..03a4827516 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -122,18 +122,6 @@ func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { return tr.base.RoundTrip(req) } -func convertTime(s *string) *time.Time { - if s == nil { - return nil - } - - r, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil - } - return &r -} - func Builder() *cobra.Command { const use = "api" cmd := &cobra.Command{ diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index 733afdc9d3..7c7f38d692 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -18,16 +18,15 @@ package api import ( "context" + "encoding/json" + "fmt" "io" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type listAccessLogsByClusterNameOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -38,15 +37,13 @@ type listAccessLogsByClusterNameOpts struct { start int64 } -func (opts *listAccessLogsByClusterNameOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAccessLogsByClusterNameOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAccessLogsByClusterNameOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAccessLogsByClusterNameApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -56,12 +53,19 @@ func (opts *listAccessLogsByClusterNameOpts) Run(ctx context.Context, w io.Write NLogs: &opts.nLogs, Start: &opts.start, } + resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAccessLogsByClusterNameBuilder() *cobra.Command { @@ -70,12 +74,10 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { Use: "listAccessLogsByClusterName", Short: "Return Database Access History for One Cluster using Its Cluster Name", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -94,7 +96,6 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { } type listAccessLogsByHostnameOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string hostname string @@ -105,15 +106,13 @@ type listAccessLogsByHostnameOpts struct { start int64 } -func (opts *listAccessLogsByHostnameOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAccessLogsByHostnameOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAccessLogsByHostnameOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAccessLogsByHostnameApiParams{ GroupId: opts.groupId, Hostname: opts.hostname, @@ -123,12 +122,19 @@ func (opts *listAccessLogsByHostnameOpts) Run(ctx context.Context, w io.Writer) NLogs: &opts.nLogs, Start: &opts.start, } + resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByHostnameWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAccessLogsByHostnameBuilder() *cobra.Command { @@ -137,12 +143,10 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { Use: "listAccessLogsByHostname", Short: "Return Database Access History for One Cluster using Its Hostname", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index 50d115a048..0722f74b6d 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createAlertConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type createAlertConfigurationOpts struct { fs afero.Fs } -func (opts *createAlertConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createAlertConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, error) { @@ -69,22 +63,30 @@ func (opts *createAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, return out, nil } -func (opts *createAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, GroupAlertsConfig: data, } + resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createAlertConfigurationBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createAlertConfigurationBuilder() *cobra.Command { Use: "createAlertConfiguration", Short: "Create One Alert Configuration in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,31 +114,25 @@ func createAlertConfigurationBuilder() *cobra.Command { } type deleteAlertConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string alertConfigId string } -func (opts *deleteAlertConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteAlertConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteAlertConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deleteAlertConfigurationOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DeleteAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params).Execute() + return err } func deleteAlertConfigurationBuilder() *cobra.Command { @@ -147,12 +141,10 @@ func deleteAlertConfigurationBuilder() *cobra.Command { Use: "deleteAlertConfiguration", Short: "Remove One Alert Configuration from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -166,31 +158,35 @@ func deleteAlertConfigurationBuilder() *cobra.Command { } type getAlertConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string alertConfigId string } -func (opts *getAlertConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getAlertConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } + resp, _, err := opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getAlertConfigurationBuilder() *cobra.Command { @@ -199,12 +195,10 @@ func getAlertConfigurationBuilder() *cobra.Command { Use: "getAlertConfiguration", Short: "Return One Alert Configuration from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -218,26 +212,30 @@ func getAlertConfigurationBuilder() *cobra.Command { } type listAlertConfigurationMatchersFieldNamesOpts struct { - cli.GlobalOpts client *admin.APIClient } -func (opts *listAlertConfigurationMatchersFieldNamesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAlertConfigurationMatchersFieldNamesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAlertConfigurationMatchersFieldNamesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAlertConfigurationMatchersFieldNamesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{} + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { @@ -246,12 +244,10 @@ func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { Use: "listAlertConfigurationMatchersFieldNames", Short: "Get All Alert Configuration Matchers Field Names", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } @@ -259,7 +255,6 @@ func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { } type listAlertConfigurationsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -267,27 +262,32 @@ type listAlertConfigurationsOpts struct { pageNum int } -func (opts *listAlertConfigurationsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAlertConfigurationsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAlertConfigurationsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAlertConfigurationsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAlertConfigurationsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAlertConfigurationsBuilder() *cobra.Command { @@ -296,12 +296,10 @@ func listAlertConfigurationsBuilder() *cobra.Command { Use: "listAlertConfigurations", Short: "Return All Alert Configurations for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -316,7 +314,6 @@ func listAlertConfigurationsBuilder() *cobra.Command { } type listAlertConfigurationsByAlertIdOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string alertId string @@ -325,15 +322,13 @@ type listAlertConfigurationsByAlertIdOpts struct { pageNum int } -func (opts *listAlertConfigurationsByAlertIdOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAlertConfigurationsByAlertIdOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAlertConfigurationsByAlertIdOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAlertConfigurationsByAlertIdApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, @@ -341,12 +336,19 @@ func (opts *listAlertConfigurationsByAlertIdOpts) Run(ctx context.Context, w io. ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { @@ -355,12 +357,10 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { Use: "listAlertConfigurationsByAlertId", Short: "Return All Alert Configurations Set for One Alert", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -377,7 +377,6 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { } type toggleAlertConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string alertConfigId string @@ -386,12 +385,9 @@ type toggleAlertConfigurationOpts struct { fs afero.Fs } -func (opts *toggleAlertConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *toggleAlertConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *toggleAlertConfigurationOpts) readData() (*admin.AlertsToggle, error) { @@ -416,23 +412,31 @@ func (opts *toggleAlertConfigurationOpts) readData() (*admin.AlertsToggle, error return out, nil } -func (opts *toggleAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.ToggleAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, AlertsToggle: data, } + resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func toggleAlertConfigurationBuilder() *cobra.Command { @@ -443,12 +447,10 @@ func toggleAlertConfigurationBuilder() *cobra.Command { Use: "toggleAlertConfiguration", Short: "Toggle One State of One Alert Configuration in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -464,7 +466,6 @@ func toggleAlertConfigurationBuilder() *cobra.Command { } type updateAlertConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string alertConfigId string @@ -473,12 +474,9 @@ type updateAlertConfigurationOpts struct { fs afero.Fs } -func (opts *updateAlertConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateAlertConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, error) { @@ -503,23 +501,31 @@ func (opts *updateAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, return out, nil } -func (opts *updateAlertConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, GroupAlertsConfig: data, } + resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateAlertConfigurationBuilder() *cobra.Command { @@ -530,12 +536,10 @@ func updateAlertConfigurationBuilder() *cobra.Command { Use: "updateAlertConfiguration", Short: "Update One Alert Configuration for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index 6e00f66a56..077d521936 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type acknowledgeAlertOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string alertId string @@ -40,12 +37,9 @@ type acknowledgeAlertOpts struct { fs afero.Fs } -func (opts *acknowledgeAlertOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *acknowledgeAlertOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *acknowledgeAlertOpts) readData() (*admin.AlertViewForNdsGroup, error) { @@ -70,23 +64,31 @@ func (opts *acknowledgeAlertOpts) readData() (*admin.AlertViewForNdsGroup, error return out, nil } -func (opts *acknowledgeAlertOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *acknowledgeAlertOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.AcknowledgeAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, AlertViewForNdsGroup: data, } + resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func acknowledgeAlertBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func acknowledgeAlertBuilder() *cobra.Command { Use: "acknowledgeAlert", Short: "Acknowledge One Alert from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,31 +118,35 @@ func acknowledgeAlertBuilder() *cobra.Command { } type getAlertOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string alertId string } -func (opts *getAlertOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getAlertOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getAlertOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getAlertOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, } + resp, _, err := opts.client.AlertsApi.GetAlertWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getAlertBuilder() *cobra.Command { @@ -151,12 +155,10 @@ func getAlertBuilder() *cobra.Command { Use: "getAlert", Short: "Return One Alert from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -170,7 +172,6 @@ func getAlertBuilder() *cobra.Command { } type listAlertsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -179,15 +180,13 @@ type listAlertsOpts struct { status string } -func (opts *listAlertsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAlertsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAlertsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAlertsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAlertsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -195,12 +194,19 @@ func (opts *listAlertsOpts) Run(ctx context.Context, w io.Writer) error { PageNum: &opts.pageNum, Status: &opts.status, } + resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAlertsBuilder() *cobra.Command { @@ -209,12 +215,10 @@ func listAlertsBuilder() *cobra.Command { Use: "listAlerts", Short: "Return All Alerts from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -230,7 +234,6 @@ func listAlertsBuilder() *cobra.Command { } type listAlertsByAlertConfigurationIdOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string alertConfigId string @@ -239,15 +242,13 @@ type listAlertsByAlertConfigurationIdOpts struct { pageNum int } -func (opts *listAlertsByAlertConfigurationIdOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAlertsByAlertConfigurationIdOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAlertsByAlertConfigurationIdOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAlertsByAlertConfigurationIdApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, @@ -255,12 +256,19 @@ func (opts *listAlertsByAlertConfigurationIdOpts) Run(ctx context.Context, w io. ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { @@ -269,12 +277,10 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { Use: "listAlertsByAlertConfigurationId", Short: "Return All Open Alerts for Alert Configuration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index 5508c9fc31..67a57e6da1 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createAtlasSearchIndexOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -40,12 +37,9 @@ type createAtlasSearchIndexOpts struct { fs afero.Fs } -func (opts *createAtlasSearchIndexOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createAtlasSearchIndexOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, error) { @@ -70,23 +64,31 @@ func (opts *createAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, e return out, nil } -func (opts *createAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, ClusterSearchIndex: data, } + resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createAtlasSearchIndexBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createAtlasSearchIndexBuilder() *cobra.Command { Use: "createAtlasSearchIndex", Short: "Create One Atlas Search Index", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,33 +118,37 @@ func createAtlasSearchIndexBuilder() *cobra.Command { } type deleteAtlasSearchIndexOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string indexId string } -func (opts *deleteAtlasSearchIndexOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteAtlasSearchIndexOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IndexId: opts.indexId, } + resp, _, err := opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteAtlasSearchIndexBuilder() *cobra.Command { @@ -153,12 +157,10 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { Use: "deleteAtlasSearchIndex", Short: "Remove One Atlas Search Index", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -174,33 +176,37 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { } type getAtlasSearchIndexOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string indexId string } -func (opts *getAtlasSearchIndexOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getAtlasSearchIndexOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, IndexId: opts.indexId, } + resp, _, err := opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getAtlasSearchIndexBuilder() *cobra.Command { @@ -209,12 +215,10 @@ func getAtlasSearchIndexBuilder() *cobra.Command { Use: "getAtlasSearchIndex", Short: "Return One Atlas Search Index", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -230,7 +234,6 @@ func getAtlasSearchIndexBuilder() *cobra.Command { } type listAtlasSearchIndexesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -238,27 +241,32 @@ type listAtlasSearchIndexesOpts struct { databaseName string } -func (opts *listAtlasSearchIndexesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAtlasSearchIndexesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAtlasSearchIndexesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAtlasSearchIndexesApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, CollectionName: opts.collectionName, DatabaseName: opts.databaseName, } + resp, _, err := opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAtlasSearchIndexesBuilder() *cobra.Command { @@ -267,12 +275,10 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { Use: "listAtlasSearchIndexes", Short: "Return All Atlas Search Indexes for One Collection", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -290,7 +296,6 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { } type updateAtlasSearchIndexOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -300,12 +305,9 @@ type updateAtlasSearchIndexOpts struct { fs afero.Fs } -func (opts *updateAtlasSearchIndexOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateAtlasSearchIndexOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, error) { @@ -330,11 +332,12 @@ func (opts *updateAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, e return out, nil } -func (opts *updateAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateAtlasSearchIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -342,12 +345,19 @@ func (opts *updateAtlasSearchIndexOpts) Run(ctx context.Context, w io.Writer) er ClusterSearchIndex: data, } + resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateAtlasSearchIndexBuilder() *cobra.Command { @@ -358,12 +368,10 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { Use: "updateAtlasSearchIndex", Short: "Update One Atlas Search Index", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 3092847e12..5fbd6c08c9 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -23,37 +23,39 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getAuditingConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getAuditingConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getAuditingConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getAuditingConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getAuditingConfigurationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.AuditingApi.GetAuditingConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getAuditingConfigurationBuilder() *cobra.Command { @@ -62,12 +64,10 @@ func getAuditingConfigurationBuilder() *cobra.Command { Use: "getAuditingConfiguration", Short: "Return the Auditing Configuration for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -79,7 +79,6 @@ func getAuditingConfigurationBuilder() *cobra.Command { } type updateAuditingConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -87,12 +86,9 @@ type updateAuditingConfigurationOpts struct { fs afero.Fs } -func (opts *updateAuditingConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateAuditingConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateAuditingConfigurationOpts) readData() (*admin.AuditLog, error) { @@ -117,22 +113,30 @@ func (opts *updateAuditingConfigurationOpts) readData() (*admin.AuditLog, error) return out, nil } -func (opts *updateAuditingConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateAuditingConfigurationApiParams{ GroupId: opts.groupId, AuditLog: data, } + resp, _, err := opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateAuditingConfigurationBuilder() *cobra.Command { @@ -143,12 +147,10 @@ func updateAuditingConfigurationBuilder() *cobra.Command { Use: "updateAuditingConfiguration", Short: "Update Auditing Configuration for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index da671e5780..fc158020db 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -23,37 +23,39 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getAWSCustomDNSOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getAWSCustomDNSOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getAWSCustomDNSOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getAWSCustomDNSOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.AWSClustersDNSApi.GetAWSCustomDNSWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getAWSCustomDNSBuilder() *cobra.Command { @@ -62,12 +64,10 @@ func getAWSCustomDNSBuilder() *cobra.Command { Use: "getAWSCustomDNS", Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -79,7 +79,6 @@ func getAWSCustomDNSBuilder() *cobra.Command { } type toggleAWSCustomDNSOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -87,12 +86,9 @@ type toggleAWSCustomDNSOpts struct { fs afero.Fs } -func (opts *toggleAWSCustomDNSOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *toggleAWSCustomDNSOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *toggleAWSCustomDNSOpts) readData() (*admin.AWSCustomDNSEnabled, error) { @@ -117,22 +113,30 @@ func (opts *toggleAWSCustomDNSOpts) readData() (*admin.AWSCustomDNSEnabled, erro return out, nil } -func (opts *toggleAWSCustomDNSOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.ToggleAWSCustomDNSApiParams{ GroupId: opts.groupId, AWSCustomDNSEnabled: data, } + resp, _, err := opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func toggleAWSCustomDNSBuilder() *cobra.Command { @@ -143,12 +147,10 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { Use: "toggleAWSCustomDNS", Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 409c7e3629..a361d705f1 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -23,41 +23,43 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type cancelBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string restoreJobId string } -func (opts *cancelBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *cancelBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *cancelBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.CancelBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } + resp, _, err := opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func cancelBackupRestoreJobBuilder() *cobra.Command { @@ -66,12 +68,10 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { Use: "cancelBackupRestoreJob", Short: "Cancel One Restore Job of One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -87,7 +87,6 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { } type createBackupExportJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -96,12 +95,9 @@ type createBackupExportJobOpts struct { fs afero.Fs } -func (opts *createBackupExportJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createBackupExportJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createBackupExportJobOpts) readData() (*admin.DiskBackupExportJobRequest, error) { @@ -126,23 +122,31 @@ func (opts *createBackupExportJobOpts) readData() (*admin.DiskBackupExportJobReq return out, nil } -func (opts *createBackupExportJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createBackupExportJobOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateBackupExportJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, DiskBackupExportJobRequest: data, } + resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createBackupExportJobBuilder() *cobra.Command { @@ -153,12 +157,10 @@ func createBackupExportJobBuilder() *cobra.Command { Use: "createBackupExportJob", Short: "Create One Cloud Backup Snapshot Export Job", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -174,7 +176,6 @@ func createBackupExportJobBuilder() *cobra.Command { } type createBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -183,12 +184,9 @@ type createBackupRestoreJobOpts struct { fs afero.Fs } -func (opts *createBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createBackupRestoreJobOpts) readData() (*admin.DiskBackupSnapshotRestoreJob, error) { @@ -213,23 +211,31 @@ func (opts *createBackupRestoreJobOpts) readData() (*admin.DiskBackupSnapshotRes return out, nil } -func (opts *createBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, DiskBackupSnapshotRestoreJob: data, } + resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createBackupRestoreJobBuilder() *cobra.Command { @@ -240,12 +246,10 @@ func createBackupRestoreJobBuilder() *cobra.Command { Use: "createBackupRestoreJob", Short: "Restore One Snapshot of One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -261,7 +265,6 @@ func createBackupRestoreJobBuilder() *cobra.Command { } type createExportBucketOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -269,12 +272,9 @@ type createExportBucketOpts struct { fs afero.Fs } -func (opts *createExportBucketOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createExportBucketOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createExportBucketOpts) readData() (*admin.DiskBackupSnapshotAWSExportBucket, error) { @@ -299,22 +299,30 @@ func (opts *createExportBucketOpts) readData() (*admin.DiskBackupSnapshotAWSExpo return out, nil } -func (opts *createExportBucketOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createExportBucketOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, DiskBackupSnapshotAWSExportBucket: data, } + resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createExportBucketBuilder() *cobra.Command { @@ -325,12 +333,10 @@ func createExportBucketBuilder() *cobra.Command { Use: "createExportBucket", Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -344,7 +350,6 @@ func createExportBucketBuilder() *cobra.Command { } type createServerlessBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -353,12 +358,9 @@ type createServerlessBackupRestoreJobOpts struct { fs afero.Fs } -func (opts *createServerlessBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createServerlessBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createServerlessBackupRestoreJobOpts) readData() (*admin.ServerlessBackupRestoreJob, error) { @@ -383,23 +385,31 @@ func (opts *createServerlessBackupRestoreJobOpts) readData() (*admin.ServerlessB return out, nil } -func (opts *createServerlessBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, ServerlessBackupRestoreJob: data, } + resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createServerlessBackupRestoreJobBuilder() *cobra.Command { @@ -410,12 +420,10 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { Use: "createServerlessBackupRestoreJob", Short: "Restore One Snapshot of One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -431,31 +439,35 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { } type deleteAllBackupSchedulesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *deleteAllBackupSchedulesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteAllBackupSchedulesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteAllBackupSchedulesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteAllBackupSchedulesApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteAllBackupSchedulesBuilder() *cobra.Command { @@ -464,12 +476,10 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { Use: "deleteAllBackupSchedules", Short: "Remove All Cloud Backup Schedules", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -483,31 +493,35 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { } type deleteExportBucketOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string exportBucketId string } -func (opts *deleteExportBucketOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteExportBucketOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteExportBucketOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteExportBucketOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteExportBucketApiParams{ GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } + resp, _, err := opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteExportBucketBuilder() *cobra.Command { @@ -516,12 +530,10 @@ func deleteExportBucketBuilder() *cobra.Command { Use: "deleteExportBucket", Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -535,33 +547,37 @@ func deleteExportBucketBuilder() *cobra.Command { } type deleteReplicaSetBackupOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string snapshotId string } -func (opts *deleteReplicaSetBackupOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteReplicaSetBackupOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteReplicaSetBackupOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteReplicaSetBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } + resp, _, err := opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteReplicaSetBackupBuilder() *cobra.Command { @@ -570,12 +586,10 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { Use: "deleteReplicaSetBackup", Short: "Remove One Replica Set Cloud Backup", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -591,33 +605,37 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { } type deleteShardedClusterBackupOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string snapshotId string } -func (opts *deleteShardedClusterBackupOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteShardedClusterBackupOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteShardedClusterBackupOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteShardedClusterBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } + resp, _, err := opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteShardedClusterBackupBuilder() *cobra.Command { @@ -626,12 +644,10 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { Use: "deleteShardedClusterBackup", Short: "Remove One Sharded Cluster Cloud Backup", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -647,33 +663,37 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { } type getBackupExportJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string exportId string } -func (opts *getBackupExportJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getBackupExportJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getBackupExportJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getBackupExportJobOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetBackupExportJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, ExportId: opts.exportId, } + resp, _, err := opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getBackupExportJobBuilder() *cobra.Command { @@ -682,12 +702,10 @@ func getBackupExportJobBuilder() *cobra.Command { Use: "getBackupExportJob", Short: "Return One Cloud Backup Snapshot Export Job", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -703,33 +721,37 @@ func getBackupExportJobBuilder() *cobra.Command { } type getBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string restoreJobId string } -func (opts *getBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } + resp, _, err := opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getBackupRestoreJobBuilder() *cobra.Command { @@ -738,12 +760,10 @@ func getBackupRestoreJobBuilder() *cobra.Command { Use: "getBackupRestoreJob", Short: "Return One Restore Job of One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -759,31 +779,35 @@ func getBackupRestoreJobBuilder() *cobra.Command { } type getBackupScheduleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *getBackupScheduleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getBackupScheduleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getBackupScheduleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getBackupScheduleOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetBackupScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getBackupScheduleBuilder() *cobra.Command { @@ -792,12 +816,10 @@ func getBackupScheduleBuilder() *cobra.Command { Use: "getBackupSchedule", Short: "Return One Cloud Backup Schedule", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -811,29 +833,33 @@ func getBackupScheduleBuilder() *cobra.Command { } type getDataProtectionSettingsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getDataProtectionSettingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getDataProtectionSettingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getDataProtectionSettingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.CloudBackupsApi.GetDataProtectionSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getDataProtectionSettingsBuilder() *cobra.Command { @@ -842,12 +868,10 @@ func getDataProtectionSettingsBuilder() *cobra.Command { Use: "getDataProtectionSettings", Short: "Return the Backup Compliance Policy settings", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -859,31 +883,35 @@ func getDataProtectionSettingsBuilder() *cobra.Command { } type getExportBucketOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string exportBucketId string } -func (opts *getExportBucketOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getExportBucketOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getExportBucketOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getExportBucketOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetExportBucketApiParams{ GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } + resp, _, err := opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getExportBucketBuilder() *cobra.Command { @@ -892,12 +920,10 @@ func getExportBucketBuilder() *cobra.Command { Use: "getExportBucket", Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -911,33 +937,37 @@ func getExportBucketBuilder() *cobra.Command { } type getReplicaSetBackupOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string snapshotId string } -func (opts *getReplicaSetBackupOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getReplicaSetBackupOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getReplicaSetBackupOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetReplicaSetBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } + resp, _, err := opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getReplicaSetBackupBuilder() *cobra.Command { @@ -946,12 +976,10 @@ func getReplicaSetBackupBuilder() *cobra.Command { Use: "getReplicaSetBackup", Short: "Return One Replica Set Cloud Backup", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -967,33 +995,37 @@ func getReplicaSetBackupBuilder() *cobra.Command { } type getServerlessBackupOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string snapshotId string } -func (opts *getServerlessBackupOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getServerlessBackupOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getServerlessBackupOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getServerlessBackupOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetServerlessBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } + resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getServerlessBackupBuilder() *cobra.Command { @@ -1002,12 +1034,10 @@ func getServerlessBackupBuilder() *cobra.Command { Use: "getServerlessBackup", Short: "Return One Snapshot of One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1023,33 +1053,37 @@ func getServerlessBackupBuilder() *cobra.Command { } type getServerlessBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string restoreJobId string } -func (opts *getServerlessBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getServerlessBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getServerlessBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, RestoreJobId: opts.restoreJobId, } + resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getServerlessBackupRestoreJobBuilder() *cobra.Command { @@ -1058,12 +1092,10 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { Use: "getServerlessBackupRestoreJob", Short: "Return One Restore Job for One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1079,33 +1111,37 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { } type getShardedClusterBackupOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string snapshotId string } -func (opts *getShardedClusterBackupOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getShardedClusterBackupOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getShardedClusterBackupOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetShardedClusterBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } + resp, _, err := opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getShardedClusterBackupBuilder() *cobra.Command { @@ -1114,12 +1150,10 @@ func getShardedClusterBackupBuilder() *cobra.Command { Use: "getShardedClusterBackup", Short: "Return One Sharded Cluster Cloud Backup", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1135,7 +1169,6 @@ func getShardedClusterBackupBuilder() *cobra.Command { } type listBackupExportJobsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -1144,15 +1177,13 @@ type listBackupExportJobsOpts struct { pageNum int } -func (opts *listBackupExportJobsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listBackupExportJobsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listBackupExportJobsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listBackupExportJobsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListBackupExportJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -1160,12 +1191,19 @@ func (opts *listBackupExportJobsOpts) Run(ctx context.Context, w io.Writer) erro ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listBackupExportJobsBuilder() *cobra.Command { @@ -1174,12 +1212,10 @@ func listBackupExportJobsBuilder() *cobra.Command { Use: "listBackupExportJobs", Short: "Return All Cloud Backup Snapshot Export Jobs", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1196,7 +1232,6 @@ func listBackupExportJobsBuilder() *cobra.Command { } type listBackupRestoreJobsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -1205,15 +1240,13 @@ type listBackupRestoreJobsOpts struct { pageNum int } -func (opts *listBackupRestoreJobsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listBackupRestoreJobsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -1221,12 +1254,19 @@ func (opts *listBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) err ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listBackupRestoreJobsBuilder() *cobra.Command { @@ -1235,12 +1275,10 @@ func listBackupRestoreJobsBuilder() *cobra.Command { Use: "listBackupRestoreJobs", Short: "Return All Restore Jobs for One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1257,7 +1295,6 @@ func listBackupRestoreJobsBuilder() *cobra.Command { } type listExportBucketsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -1265,27 +1302,32 @@ type listExportBucketsOpts struct { pageNum int } -func (opts *listExportBucketsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listExportBucketsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listExportBucketsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listExportBucketsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListExportBucketsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listExportBucketsBuilder() *cobra.Command { @@ -1294,12 +1336,10 @@ func listExportBucketsBuilder() *cobra.Command { Use: "listExportBuckets", Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1314,7 +1354,6 @@ func listExportBucketsBuilder() *cobra.Command { } type listReplicaSetBackupsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -1323,15 +1362,13 @@ type listReplicaSetBackupsOpts struct { pageNum int } -func (opts *listReplicaSetBackupsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listReplicaSetBackupsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listReplicaSetBackupsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListReplicaSetBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -1339,12 +1376,19 @@ func (opts *listReplicaSetBackupsOpts) Run(ctx context.Context, w io.Writer) err ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listReplicaSetBackupsBuilder() *cobra.Command { @@ -1353,12 +1397,10 @@ func listReplicaSetBackupsBuilder() *cobra.Command { Use: "listReplicaSetBackups", Short: "Return All Replica Set Cloud Backups", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1375,7 +1417,6 @@ func listReplicaSetBackupsBuilder() *cobra.Command { } type listServerlessBackupRestoreJobsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -1384,15 +1425,13 @@ type listServerlessBackupRestoreJobsOpts struct { pageNum int } -func (opts *listServerlessBackupRestoreJobsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listServerlessBackupRestoreJobsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listServerlessBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListServerlessBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -1400,12 +1439,19 @@ func (opts *listServerlessBackupRestoreJobsOpts) Run(ctx context.Context, w io.W ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listServerlessBackupRestoreJobsBuilder() *cobra.Command { @@ -1414,12 +1460,10 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { Use: "listServerlessBackupRestoreJobs", Short: "Return All Restore Jobs for One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1436,7 +1480,6 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { } type listServerlessBackupsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -1445,15 +1488,13 @@ type listServerlessBackupsOpts struct { pageNum int } -func (opts *listServerlessBackupsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listServerlessBackupsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listServerlessBackupsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listServerlessBackupsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListServerlessBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -1461,12 +1502,19 @@ func (opts *listServerlessBackupsOpts) Run(ctx context.Context, w io.Writer) err ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listServerlessBackupsBuilder() *cobra.Command { @@ -1475,12 +1523,10 @@ func listServerlessBackupsBuilder() *cobra.Command { Use: "listServerlessBackups", Short: "Return All Snapshots of One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1497,31 +1543,35 @@ func listServerlessBackupsBuilder() *cobra.Command { } type listShardedClusterBackupsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *listShardedClusterBackupsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listShardedClusterBackupsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listShardedClusterBackupsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListShardedClusterBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listShardedClusterBackupsBuilder() *cobra.Command { @@ -1530,12 +1580,10 @@ func listShardedClusterBackupsBuilder() *cobra.Command { Use: "listShardedClusterBackups", Short: "Return All Sharded Cluster Cloud Backups", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1549,7 +1597,6 @@ func listShardedClusterBackupsBuilder() *cobra.Command { } type takeSnapshotOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -1558,12 +1605,9 @@ type takeSnapshotOpts struct { fs afero.Fs } -func (opts *takeSnapshotOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *takeSnapshotOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *takeSnapshotOpts) readData() (*admin.DiskBackupOnDemandSnapshotRequest, error) { @@ -1588,23 +1632,31 @@ func (opts *takeSnapshotOpts) readData() (*admin.DiskBackupOnDemandSnapshotReque return out, nil } -func (opts *takeSnapshotOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *takeSnapshotOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.TakeSnapshotApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, DiskBackupOnDemandSnapshotRequest: data, } + resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func takeSnapshotBuilder() *cobra.Command { @@ -1615,12 +1667,10 @@ func takeSnapshotBuilder() *cobra.Command { Use: "takeSnapshot", Short: "Take One On-Demand Snapshot", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1636,7 +1686,6 @@ func takeSnapshotBuilder() *cobra.Command { } type updateBackupScheduleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -1645,12 +1694,9 @@ type updateBackupScheduleOpts struct { fs afero.Fs } -func (opts *updateBackupScheduleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateBackupScheduleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateBackupScheduleOpts) readData() (*admin.DiskBackupSnapshotSchedule, error) { @@ -1675,23 +1721,31 @@ func (opts *updateBackupScheduleOpts) readData() (*admin.DiskBackupSnapshotSched return out, nil } -func (opts *updateBackupScheduleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateBackupScheduleOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateBackupScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, DiskBackupSnapshotSchedule: data, } + resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateBackupScheduleBuilder() *cobra.Command { @@ -1702,12 +1756,10 @@ func updateBackupScheduleBuilder() *cobra.Command { Use: "updateBackupSchedule", Short: "Update Cloud Backup Schedule for One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1723,7 +1775,6 @@ func updateBackupScheduleBuilder() *cobra.Command { } type updateDataProtectionSettingsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -1731,12 +1782,9 @@ type updateDataProtectionSettingsOpts struct { fs afero.Fs } -func (opts *updateDataProtectionSettingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateDataProtectionSettingsOpts) readData() (*admin.DataProtectionSettings, error) { @@ -1761,22 +1809,30 @@ func (opts *updateDataProtectionSettingsOpts) readData() (*admin.DataProtectionS return out, nil } -func (opts *updateDataProtectionSettingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, DataProtectionSettings: data, } + resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateDataProtectionSettingsBuilder() *cobra.Command { @@ -1787,12 +1843,10 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { Use: "updateDataProtectionSettings", Short: "Update or enable the Backup Compliance Policy settings", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1806,7 +1860,6 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { } type updateSnapshotRetentionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -1816,12 +1869,9 @@ type updateSnapshotRetentionOpts struct { fs afero.Fs } -func (opts *updateSnapshotRetentionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateSnapshotRetentionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateSnapshotRetentionOpts) readData() (*admin.BackupSnapshotRetention, error) { @@ -1846,11 +1896,12 @@ func (opts *updateSnapshotRetentionOpts) readData() (*admin.BackupSnapshotRetent return out, nil } -func (opts *updateSnapshotRetentionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateSnapshotRetentionApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -1858,12 +1909,19 @@ func (opts *updateSnapshotRetentionOpts) Run(ctx context.Context, w io.Writer) e BackupSnapshotRetention: data, } + resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateSnapshotRetentionBuilder() *cobra.Command { @@ -1874,12 +1932,10 @@ func updateSnapshotRetentionBuilder() *cobra.Command { Use: "updateSnapshotRetention", Short: "Change Expiration Date for One Cloud Backup", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 8241448740..8c17997aaa 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createLinkTokenOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string @@ -39,12 +36,9 @@ type createLinkTokenOpts struct { fs afero.Fs } -func (opts *createLinkTokenOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createLinkTokenOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createLinkTokenOpts) readData() (*admin.TargetOrgRequest, error) { @@ -69,22 +63,30 @@ func (opts *createLinkTokenOpts) readData() (*admin.TargetOrgRequest, error) { return out, nil } -func (opts *createLinkTokenOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createLinkTokenOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, TargetOrgRequest: data, } + resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createLinkTokenBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createLinkTokenBuilder() *cobra.Command { Use: "createLinkToken", Short: "Create One Link-Token", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -112,7 +112,6 @@ func createLinkTokenBuilder() *cobra.Command { } type createPushMigrationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -120,12 +119,9 @@ type createPushMigrationOpts struct { fs afero.Fs } -func (opts *createPushMigrationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createPushMigrationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createPushMigrationOpts) readData() (*admin.LiveMigrationRequest, error) { @@ -150,22 +146,30 @@ func (opts *createPushMigrationOpts) readData() (*admin.LiveMigrationRequest, er return out, nil } -func (opts *createPushMigrationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createPushMigrationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, LiveMigrationRequest: data, } + resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createPushMigrationBuilder() *cobra.Command { @@ -176,12 +180,10 @@ func createPushMigrationBuilder() *cobra.Command { Use: "createPushMigration", Short: "Migrate One Local Managed Cluster to MongoDB Atlas", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -195,31 +197,25 @@ func createPushMigrationBuilder() *cobra.Command { } type cutoverMigrationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string liveMigrationId string } -func (opts *cutoverMigrationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *cutoverMigrationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *cutoverMigrationOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *cutoverMigrationOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.CutoverMigrationApiParams{ GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } - _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params).Execute() + return err } func cutoverMigrationBuilder() *cobra.Command { @@ -228,12 +224,10 @@ func cutoverMigrationBuilder() *cobra.Command { Use: "cutoverMigration", Short: "Cut Over the Migrated Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -247,29 +241,33 @@ func cutoverMigrationBuilder() *cobra.Command { } type deleteLinkTokenOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string } -func (opts *deleteLinkTokenOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteLinkTokenOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteLinkTokenOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteLinkTokenOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, } + resp, _, err := opts.client.CloudMigrationServiceApi.DeleteLinkTokenWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteLinkTokenBuilder() *cobra.Command { @@ -278,12 +276,10 @@ func deleteLinkTokenBuilder() *cobra.Command { Use: "deleteLinkToken", Short: "Remove One Link-Token", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -293,31 +289,35 @@ func deleteLinkTokenBuilder() *cobra.Command { } type getPushMigrationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string liveMigrationId string } -func (opts *getPushMigrationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getPushMigrationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getPushMigrationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getPushMigrationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetPushMigrationApiParams{ GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } + resp, _, err := opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getPushMigrationBuilder() *cobra.Command { @@ -326,12 +326,10 @@ func getPushMigrationBuilder() *cobra.Command { Use: "getPushMigration", Short: "Return One Migration Job", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -345,31 +343,35 @@ func getPushMigrationBuilder() *cobra.Command { } type getValidationStatusOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string validationId string } -func (opts *getValidationStatusOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getValidationStatusOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getValidationStatusOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getValidationStatusOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetValidationStatusApiParams{ GroupId: opts.groupId, ValidationId: opts.validationId, } + resp, _, err := opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getValidationStatusBuilder() *cobra.Command { @@ -378,12 +380,10 @@ func getValidationStatusBuilder() *cobra.Command { Use: "getValidationStatus", Short: "Return One Migration Validation Job", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -397,29 +397,33 @@ func getValidationStatusBuilder() *cobra.Command { } type listSourceProjectsOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string } -func (opts *listSourceProjectsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listSourceProjectsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listSourceProjectsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listSourceProjectsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, } + resp, _, err := opts.client.CloudMigrationServiceApi.ListSourceProjectsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listSourceProjectsBuilder() *cobra.Command { @@ -428,12 +432,10 @@ func listSourceProjectsBuilder() *cobra.Command { Use: "listSourceProjects", Short: "Return All Projects Available for Migration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -443,7 +445,6 @@ func listSourceProjectsBuilder() *cobra.Command { } type validateMigrationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -451,12 +452,9 @@ type validateMigrationOpts struct { fs afero.Fs } -func (opts *validateMigrationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *validateMigrationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *validateMigrationOpts) readData() (*admin.LiveMigrationRequest, error) { @@ -481,22 +479,30 @@ func (opts *validateMigrationOpts) readData() (*admin.LiveMigrationRequest, erro return out, nil } -func (opts *validateMigrationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *validateMigrationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, LiveMigrationRequest: data, } + resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func validateMigrationBuilder() *cobra.Command { @@ -507,12 +513,10 @@ func validateMigrationBuilder() *cobra.Command { Use: "validateMigration", Short: "Validate One Migration Request", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index 74267649bd..ef36105c42 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type authorizeCloudProviderAccessRoleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string roleId string @@ -40,12 +37,9 @@ type authorizeCloudProviderAccessRoleOpts struct { fs afero.Fs } -func (opts *authorizeCloudProviderAccessRoleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *authorizeCloudProviderAccessRoleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *authorizeCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderAccessRole, error) { @@ -70,23 +64,31 @@ func (opts *authorizeCloudProviderAccessRoleOpts) readData() (*admin.CloudProvid return out, nil } -func (opts *authorizeCloudProviderAccessRoleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.AuthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, RoleId: opts.roleId, CloudProviderAccessRole: data, } + resp, _, err := opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { Use: "authorizeCloudProviderAccessRole", Short: "Authorize One Cloud Provider Access Role", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,7 +118,6 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { } type createCloudProviderAccessRoleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -126,12 +125,9 @@ type createCloudProviderAccessRoleOpts struct { fs afero.Fs } -func (opts *createCloudProviderAccessRoleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createCloudProviderAccessRoleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderAccessRole, error) { @@ -156,22 +152,30 @@ func (opts *createCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderA return out, nil } -func (opts *createCloudProviderAccessRoleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, CloudProviderAccessRole: data, } + resp, _, err := opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createCloudProviderAccessRoleBuilder() *cobra.Command { @@ -182,12 +186,10 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { Use: "createCloudProviderAccessRole", Short: "Create One Cloud Provider Access Role", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -201,33 +203,27 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { } type deauthorizeCloudProviderAccessRoleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string cloudProvider string roleId string } -func (opts *deauthorizeCloudProviderAccessRoleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deauthorizeCloudProviderAccessRoleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deauthorizeCloudProviderAccessRoleOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DeauthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, RoleId: opts.roleId, } - _, err := opts.client.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() + return err } func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { @@ -236,12 +232,10 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { Use: "deauthorizeCloudProviderAccessRole", Short: "Deauthorize One Cloud Provider Access Role", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -257,31 +251,35 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { } type getCloudProviderAccessRoleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string roleId string } -func (opts *getCloudProviderAccessRoleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getCloudProviderAccessRoleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getCloudProviderAccessRoleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, RoleId: opts.roleId, } + resp, _, err := opts.client.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getCloudProviderAccessRoleBuilder() *cobra.Command { @@ -290,12 +288,10 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { Use: "getCloudProviderAccessRole", Short: "Return specified Cloud Provider Access Role", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -309,29 +305,33 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { } type listCloudProviderAccessRolesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *listCloudProviderAccessRolesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listCloudProviderAccessRolesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listCloudProviderAccessRolesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.CloudProviderAccessApi.ListCloudProviderAccessRolesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listCloudProviderAccessRolesBuilder() *cobra.Command { @@ -340,12 +340,10 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { Use: "listCloudProviderAccessRoles", Short: "Return All Cloud Provider Access Roles", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index 36bed3c9c3..eeff2369fd 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -23,39 +23,41 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type endOutageSimulationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *endOutageSimulationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *endOutageSimulationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *endOutageSimulationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *endOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.EndOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.ClusterOutageSimulationApi.EndOutageSimulationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func endOutageSimulationBuilder() *cobra.Command { @@ -64,12 +66,10 @@ func endOutageSimulationBuilder() *cobra.Command { Use: "endOutageSimulation", Short: "End an Outage Simulation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -83,31 +83,35 @@ func endOutageSimulationBuilder() *cobra.Command { } type getOutageSimulationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *getOutageSimulationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getOutageSimulationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getOutageSimulationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.ClusterOutageSimulationApi.GetOutageSimulationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getOutageSimulationBuilder() *cobra.Command { @@ -116,12 +120,10 @@ func getOutageSimulationBuilder() *cobra.Command { Use: "getOutageSimulation", Short: "Return One Outage Simulation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -135,7 +137,6 @@ func getOutageSimulationBuilder() *cobra.Command { } type startOutageSimulationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -144,12 +145,9 @@ type startOutageSimulationOpts struct { fs afero.Fs } -func (opts *startOutageSimulationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *startOutageSimulationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *startOutageSimulationOpts) readData() (*admin.ClusterOutageSimulation, error) { @@ -174,23 +172,31 @@ func (opts *startOutageSimulationOpts) readData() (*admin.ClusterOutageSimulatio return out, nil } -func (opts *startOutageSimulationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *startOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.StartOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, ClusterOutageSimulation: data, } + resp, _, err := opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func startOutageSimulationBuilder() *cobra.Command { @@ -201,12 +207,10 @@ func startOutageSimulationBuilder() *cobra.Command { Use: "startOutageSimulation", Short: "Start an Outage Simulation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index ae75945db8..6b2cd021d4 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createClusterOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type createClusterOpts struct { fs afero.Fs } -func (opts *createClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createClusterOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createClusterOpts) readData() (*admin.AdvancedClusterDescription, error) { @@ -69,22 +63,30 @@ func (opts *createClusterOpts) readData() (*admin.AdvancedClusterDescription, er return out, nil } -func (opts *createClusterOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createClusterOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, AdvancedClusterDescription: data, } + resp, _, err := opts.client.ClustersApi.CreateClusterWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createClusterBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createClusterBuilder() *cobra.Command { Use: "createCluster", Short: "TEST DESCRIPTION", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,33 +114,27 @@ func createClusterBuilder() *cobra.Command { } type deleteClusterOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string retainBackups bool } -func (opts *deleteClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteClusterOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteClusterOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DeleteClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, RetainBackups: &opts.retainBackups, } - _, err := opts.client.ClustersApi.DeleteClusterWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.ClustersApi.DeleteClusterWithParams(ctx, params).Execute() + return err } func deleteClusterBuilder() *cobra.Command { @@ -149,12 +143,10 @@ func deleteClusterBuilder() *cobra.Command { Use: "deleteCluster", Short: "Remove One Multi-Cloud Cluster from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -169,31 +161,35 @@ func deleteClusterBuilder() *cobra.Command { } type getClusterOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *getClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getClusterOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getClusterOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getClusterOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.ClustersApi.GetClusterWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getClusterBuilder() *cobra.Command { @@ -202,12 +198,10 @@ func getClusterBuilder() *cobra.Command { Use: "getCluster", Short: "Return One Multi-Cloud Cluster from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -221,31 +215,35 @@ func getClusterBuilder() *cobra.Command { } type getClusterAdvancedConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *getClusterAdvancedConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getClusterAdvancedConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getClusterAdvancedConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getClusterAdvancedConfigurationBuilder() *cobra.Command { @@ -254,12 +252,10 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { Use: "getClusterAdvancedConfiguration", Short: "Return One Advanced Configuration Options for One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -273,31 +269,35 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { } type getClusterStatusOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *getClusterStatusOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getClusterStatusOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getClusterStatusOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getClusterStatusOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetClusterStatusApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getClusterStatusBuilder() *cobra.Command { @@ -306,12 +306,10 @@ func getClusterStatusBuilder() *cobra.Command { Use: "getClusterStatus", Short: "Return Status of All Cluster Operations", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -325,31 +323,35 @@ func getClusterStatusBuilder() *cobra.Command { } type getSampleDatasetLoadStatusOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string sampleDatasetId string } -func (opts *getSampleDatasetLoadStatusOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getSampleDatasetLoadStatusOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getSampleDatasetLoadStatusOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetSampleDatasetLoadStatusApiParams{ GroupId: opts.groupId, SampleDatasetId: opts.sampleDatasetId, } + resp, _, err := opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getSampleDatasetLoadStatusBuilder() *cobra.Command { @@ -358,12 +360,10 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { Use: "getSampleDatasetLoadStatus", Short: "Check Status of Cluster Sample Dataset Request", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -377,7 +377,6 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { } type listCloudProviderRegionsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -387,15 +386,13 @@ type listCloudProviderRegionsOpts struct { tier string } -func (opts *listCloudProviderRegionsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listCloudProviderRegionsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listCloudProviderRegionsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListCloudProviderRegionsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -404,12 +401,19 @@ func (opts *listCloudProviderRegionsOpts) Run(ctx context.Context, w io.Writer) Providers: &opts.providers, Tier: &opts.tier, } + resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listCloudProviderRegionsBuilder() *cobra.Command { @@ -418,12 +422,10 @@ func listCloudProviderRegionsBuilder() *cobra.Command { Use: "listCloudProviderRegions", Short: "Return All Cloud Provider Regions", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -440,7 +442,6 @@ func listCloudProviderRegionsBuilder() *cobra.Command { } type listClustersOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -449,15 +450,13 @@ type listClustersOpts struct { includeDeletedWithRetainedBackups bool } -func (opts *listClustersOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listClustersOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listClustersOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listClustersOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListClustersApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -465,12 +464,19 @@ func (opts *listClustersOpts) Run(ctx context.Context, w io.Writer) error { PageNum: &opts.pageNum, IncludeDeletedWithRetainedBackups: &opts.includeDeletedWithRetainedBackups, } + resp, _, err := opts.client.ClustersApi.ListClustersWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listClustersBuilder() *cobra.Command { @@ -479,12 +485,10 @@ func listClustersBuilder() *cobra.Command { Use: "listClusters", Short: "Return All Clusters in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -500,33 +504,37 @@ func listClustersBuilder() *cobra.Command { } type listClustersForAllProjectsOpts struct { - cli.GlobalOpts client *admin.APIClient includeCount bool itemsPerPage int pageNum int } -func (opts *listClustersForAllProjectsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listClustersForAllProjectsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listClustersForAllProjectsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listClustersForAllProjectsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListClustersForAllProjectsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listClustersForAllProjectsBuilder() *cobra.Command { @@ -535,12 +543,10 @@ func listClustersForAllProjectsBuilder() *cobra.Command { Use: "listClustersForAllProjects", Short: "Return All Authorized Clusters in All Projects", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -551,31 +557,35 @@ func listClustersForAllProjectsBuilder() *cobra.Command { } type loadSampleDatasetOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string name string } -func (opts *loadSampleDatasetOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *loadSampleDatasetOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *loadSampleDatasetOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *loadSampleDatasetOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, Name: opts.name, } + resp, _, err := opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func loadSampleDatasetBuilder() *cobra.Command { @@ -584,12 +594,10 @@ func loadSampleDatasetBuilder() *cobra.Command { Use: "loadSampleDataset", Short: "Load Sample Dataset Request into Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -603,31 +611,25 @@ func loadSampleDatasetBuilder() *cobra.Command { } type testFailoverOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *testFailoverOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *testFailoverOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *testFailoverOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *testFailoverOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.TestFailoverApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - _, err := opts.client.ClustersApi.TestFailoverWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.ClustersApi.TestFailoverWithParams(ctx, params).Execute() + return err } func testFailoverBuilder() *cobra.Command { @@ -636,12 +638,10 @@ func testFailoverBuilder() *cobra.Command { Use: "testFailover", Short: "Test Failover for One Multi-Cloud Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -655,7 +655,6 @@ func testFailoverBuilder() *cobra.Command { } type updateClusterOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -664,12 +663,9 @@ type updateClusterOpts struct { fs afero.Fs } -func (opts *updateClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateClusterOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateClusterOpts) readData() (*admin.AdvancedClusterDescription, error) { @@ -694,23 +690,31 @@ func (opts *updateClusterOpts) readData() (*admin.AdvancedClusterDescription, er return out, nil } -func (opts *updateClusterOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateClusterOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, AdvancedClusterDescription: data, } + resp, _, err := opts.client.ClustersApi.UpdateClusterWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateClusterBuilder() *cobra.Command { @@ -721,12 +725,10 @@ func updateClusterBuilder() *cobra.Command { Use: "updateCluster", Short: "Modify One Multi-Cloud Cluster from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -742,7 +744,6 @@ func updateClusterBuilder() *cobra.Command { } type updateClusterAdvancedConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -751,12 +752,9 @@ type updateClusterAdvancedConfigurationOpts struct { fs afero.Fs } -func (opts *updateClusterAdvancedConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateClusterAdvancedConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateClusterAdvancedConfigurationOpts) readData() (*admin.ClusterDescriptionProcessArgs, error) { @@ -781,23 +779,31 @@ func (opts *updateClusterAdvancedConfigurationOpts) readData() (*admin.ClusterDe return out, nil } -func (opts *updateClusterAdvancedConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, ClusterDescriptionProcessArgs: data, } + resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateClusterAdvancedConfigurationBuilder() *cobra.Command { @@ -808,12 +814,10 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { Use: "updateClusterAdvancedConfiguration", Short: "Update Advanced Configuration Options for One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -829,7 +833,6 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { } type upgradeSharedClusterOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -837,12 +840,9 @@ type upgradeSharedClusterOpts struct { fs afero.Fs } -func (opts *upgradeSharedClusterOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *upgradeSharedClusterOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *upgradeSharedClusterOpts) readData() (*admin.LegacyAtlasCluster, error) { @@ -867,22 +867,30 @@ func (opts *upgradeSharedClusterOpts) readData() (*admin.LegacyAtlasCluster, err return out, nil } -func (opts *upgradeSharedClusterOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *upgradeSharedClusterOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, LegacyAtlasCluster: data, } + resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func upgradeSharedClusterBuilder() *cobra.Command { @@ -893,12 +901,10 @@ func upgradeSharedClusterBuilder() *cobra.Command { Use: "upgradeSharedCluster", Short: "Upgrade One Shared-tier Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -912,7 +918,6 @@ func upgradeSharedClusterBuilder() *cobra.Command { } type upgradeSharedClusterToServerlessOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -920,12 +925,9 @@ type upgradeSharedClusterToServerlessOpts struct { fs afero.Fs } -func (opts *upgradeSharedClusterToServerlessOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *upgradeSharedClusterToServerlessOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *upgradeSharedClusterToServerlessOpts) readData() (*admin.ServerlessInstanceDescription, error) { @@ -950,22 +952,30 @@ func (opts *upgradeSharedClusterToServerlessOpts) readData() (*admin.ServerlessI return out, nil } -func (opts *upgradeSharedClusterToServerlessOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, ServerlessInstanceDescription: data, } + resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func upgradeSharedClusterToServerlessBuilder() *cobra.Command { @@ -976,12 +986,10 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { Use: "upgradeSharedClusterToServerless", Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 99b8fc66b1..c0a3531a68 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createCustomDatabaseRoleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type createCustomDatabaseRoleOpts struct { fs afero.Fs } -func (opts *createCustomDatabaseRoleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createCustomDatabaseRoleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createCustomDatabaseRoleOpts) readData() (*admin.UserCustomDBRole, error) { @@ -69,22 +63,30 @@ func (opts *createCustomDatabaseRoleOpts) readData() (*admin.UserCustomDBRole, e return out, nil } -func (opts *createCustomDatabaseRoleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, UserCustomDBRole: data, } + resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createCustomDatabaseRoleBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { Use: "createCustomDatabaseRole", Short: "Create One Custom Role", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,31 +114,25 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { } type deleteCustomDatabaseRoleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string roleName string } -func (opts *deleteCustomDatabaseRoleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteCustomDatabaseRoleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteCustomDatabaseRoleOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deleteCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DeleteCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, } - _, err := opts.client.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(ctx, params).Execute() + return err } func deleteCustomDatabaseRoleBuilder() *cobra.Command { @@ -147,12 +141,10 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { Use: "deleteCustomDatabaseRole", Short: "Remove One Custom Role from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -166,31 +158,35 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { } type getCustomDatabaseRoleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string roleName string } -func (opts *getCustomDatabaseRoleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getCustomDatabaseRoleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getCustomDatabaseRoleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, } + resp, _, err := opts.client.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getCustomDatabaseRoleBuilder() *cobra.Command { @@ -199,12 +195,10 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { Use: "getCustomDatabaseRole", Short: "Return One Custom Role in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -218,29 +212,33 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { } type listCustomDatabaseRolesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *listCustomDatabaseRolesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listCustomDatabaseRolesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listCustomDatabaseRolesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.CustomDatabaseRolesApi.ListCustomDatabaseRolesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listCustomDatabaseRolesBuilder() *cobra.Command { @@ -249,12 +247,10 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { Use: "listCustomDatabaseRoles", Short: "Return All Custom Roles in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -266,7 +262,6 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { } type updateCustomDatabaseRoleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string roleName string @@ -275,12 +270,9 @@ type updateCustomDatabaseRoleOpts struct { fs afero.Fs } -func (opts *updateCustomDatabaseRoleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateCustomDatabaseRoleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateCustomDatabaseRoleOpts) readData() (*admin.UpdateCustomDBRole, error) { @@ -305,23 +297,31 @@ func (opts *updateCustomDatabaseRoleOpts) readData() (*admin.UpdateCustomDBRole, return out, nil } -func (opts *updateCustomDatabaseRoleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, UpdateCustomDBRole: data, } + resp, _, err := opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateCustomDatabaseRoleBuilder() *cobra.Command { @@ -332,12 +332,10 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { Use: "updateCustomDatabaseRole", Short: "Update One Custom Role in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index aa668ddaf5..761846d161 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createDataFederationPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type createDataFederationPrivateEndpointOpts struct { fs afero.Fs } -func (opts *createDataFederationPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createDataFederationPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createDataFederationPrivateEndpointOpts) readData() (*admin.PrivateNetworkEndpointIdEntry, error) { @@ -69,22 +63,30 @@ func (opts *createDataFederationPrivateEndpointOpts) readData() (*admin.PrivateN return out, nil } -func (opts *createDataFederationPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, PrivateNetworkEndpointIdEntry: data, } + resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createDataFederationPrivateEndpointBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { Use: "createDataFederationPrivateEndpoint", Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,7 +114,6 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { } type createFederatedDatabaseOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -123,12 +122,9 @@ type createFederatedDatabaseOpts struct { fs afero.Fs } -func (opts *createFederatedDatabaseOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createFederatedDatabaseOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, error) { @@ -153,11 +149,12 @@ func (opts *createFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, erro return out, nil } -func (opts *createFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -165,12 +162,19 @@ func (opts *createFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) e DataLakeTenant: data, } + resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createFederatedDatabaseBuilder() *cobra.Command { @@ -181,12 +185,10 @@ func createFederatedDatabaseBuilder() *cobra.Command { Use: "createFederatedDatabase", Short: "Create One Federated Database Instance in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -201,7 +203,6 @@ func createFederatedDatabaseBuilder() *cobra.Command { } type createOneDataFederationQueryLimitOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string @@ -211,12 +212,9 @@ type createOneDataFederationQueryLimitOpts struct { fs afero.Fs } -func (opts *createOneDataFederationQueryLimitOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createOneDataFederationQueryLimitOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createOneDataFederationQueryLimitOpts) readData() (*admin.DataFederationTenantQueryLimit, error) { @@ -241,11 +239,12 @@ func (opts *createOneDataFederationQueryLimitOpts) readData() (*admin.DataFedera return out, nil } -func (opts *createOneDataFederationQueryLimitOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateOneDataFederationQueryLimitApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, @@ -253,12 +252,19 @@ func (opts *createOneDataFederationQueryLimitOpts) Run(ctx context.Context, w io DataFederationTenantQueryLimit: data, } + resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createOneDataFederationQueryLimitBuilder() *cobra.Command { @@ -269,12 +275,10 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { Use: "createOneDataFederationQueryLimit", Short: "Configure One Query Limit for One Federated Database Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -300,31 +304,35 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { } type deleteDataFederationPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string endpointId string } -func (opts *deleteDataFederationPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteDataFederationPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteDataFederationPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, EndpointId: opts.endpointId, } + resp, _, err := opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { @@ -333,12 +341,10 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { Use: "deleteDataFederationPrivateEndpoint", Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -352,31 +358,35 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { } type deleteFederatedDatabaseOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string } -func (opts *deleteFederatedDatabaseOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteFederatedDatabaseOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteFederatedDatabaseApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } + resp, _, err := opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteFederatedDatabaseBuilder() *cobra.Command { @@ -385,12 +395,10 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { Use: "deleteFederatedDatabase", Short: "Remove One Federated Database Instance from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -404,33 +412,37 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { } type deleteOneDataFederationInstanceQueryLimitOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string limitName string } -func (opts *deleteOneDataFederationInstanceQueryLimitOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteOneDataFederationInstanceQueryLimitOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, LimitName: opts.limitName, } + resp, _, err := opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { @@ -439,12 +451,10 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { Use: "deleteOneDataFederationInstanceQueryLimit", Short: "Delete One Query Limit For One Federated Database Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -468,7 +478,6 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { } type downloadFederatedDatabaseQueryLogsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string @@ -476,27 +485,32 @@ type downloadFederatedDatabaseQueryLogsOpts struct { startDate int64 } -func (opts *downloadFederatedDatabaseQueryLogsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *downloadFederatedDatabaseQueryLogsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, EndDate: &opts.endDate, StartDate: &opts.startDate, } + resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { @@ -505,12 +519,10 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { Use: "downloadFederatedDatabaseQueryLogs", Short: "Download Query Logs for One Federated Database Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -526,31 +538,35 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { } type getDataFederationPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string endpointId string } -func (opts *getDataFederationPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getDataFederationPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getDataFederationPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, EndpointId: opts.endpointId, } + resp, _, err := opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getDataFederationPrivateEndpointBuilder() *cobra.Command { @@ -559,12 +575,10 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { Use: "getDataFederationPrivateEndpoint", Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -578,31 +592,35 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { } type getFederatedDatabaseOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string } -func (opts *getFederatedDatabaseOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getFederatedDatabaseOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetFederatedDatabaseApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } + resp, _, err := opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getFederatedDatabaseBuilder() *cobra.Command { @@ -611,12 +629,10 @@ func getFederatedDatabaseBuilder() *cobra.Command { Use: "getFederatedDatabase", Short: "Return One Federated Database Instance in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -630,7 +646,6 @@ func getFederatedDatabaseBuilder() *cobra.Command { } type listDataFederationPrivateEndpointsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -638,27 +653,32 @@ type listDataFederationPrivateEndpointsOpts struct { pageNum int } -func (opts *listDataFederationPrivateEndpointsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listDataFederationPrivateEndpointsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listDataFederationPrivateEndpointsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListDataFederationPrivateEndpointsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listDataFederationPrivateEndpointsBuilder() *cobra.Command { @@ -667,12 +687,10 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { Use: "listDataFederationPrivateEndpoints", Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -687,31 +705,35 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { } type listFederatedDatabasesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string type_ string } -func (opts *listFederatedDatabasesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listFederatedDatabasesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listFederatedDatabasesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listFederatedDatabasesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, Type_: &opts.type_, } + resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listFederatedDatabasesBuilder() *cobra.Command { @@ -720,12 +742,10 @@ func listFederatedDatabasesBuilder() *cobra.Command { Use: "listFederatedDatabases", Short: "Return All Federated Database Instances in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -738,33 +758,37 @@ func listFederatedDatabasesBuilder() *cobra.Command { } type returnFederatedDatabaseQueryLimitOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string limitName string } -func (opts *returnFederatedDatabaseQueryLimitOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *returnFederatedDatabaseQueryLimitOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *returnFederatedDatabaseQueryLimitOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, LimitName: opts.limitName, } + resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { @@ -773,12 +797,10 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { Use: "returnFederatedDatabaseQueryLimit", Short: "Return One Federated Database Instance Query Limit for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -802,31 +824,35 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { } type returnFederatedDatabaseQueryLimitsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string } -func (opts *returnFederatedDatabaseQueryLimitsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *returnFederatedDatabaseQueryLimitsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *returnFederatedDatabaseQueryLimitsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } + resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { @@ -835,12 +861,10 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { Use: "returnFederatedDatabaseQueryLimits", Short: "Return All Query Limits for One Federated Database Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -854,7 +878,6 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { } type updateFederatedDatabaseOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string @@ -864,12 +887,9 @@ type updateFederatedDatabaseOpts struct { fs afero.Fs } -func (opts *updateFederatedDatabaseOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateFederatedDatabaseOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, error) { @@ -894,11 +914,12 @@ func (opts *updateFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, erro return out, nil } -func (opts *updateFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateFederatedDatabaseApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, @@ -906,12 +927,19 @@ func (opts *updateFederatedDatabaseOpts) Run(ctx context.Context, w io.Writer) e DataLakeTenant: data, } + resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateFederatedDatabaseBuilder() *cobra.Command { @@ -922,12 +950,10 @@ func updateFederatedDatabaseBuilder() *cobra.Command { Use: "updateFederatedDatabase", Short: "Update One Federated Database Instance in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 817029d07b..8da3edb181 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -22,16 +22,14 @@ import ( "fmt" "io" "os" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createPipelineOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +37,9 @@ type createPipelineOpts struct { fs afero.Fs } -func (opts *createPipelineOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createPipelineOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createPipelineOpts) readData() (*admin.DataLakeIngestionPipeline, error) { @@ -69,22 +64,30 @@ func (opts *createPipelineOpts) readData() (*admin.DataLakeIngestionPipeline, er return out, nil } -func (opts *createPipelineOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createPipelineOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, DataLakeIngestionPipeline: data, } + resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createPipelineBuilder() *cobra.Command { @@ -95,12 +98,10 @@ func createPipelineBuilder() *cobra.Command { Use: "createPipeline", Short: "Create One Data Lake Pipeline", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,31 +115,35 @@ func createPipelineBuilder() *cobra.Command { } type deletePipelineOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string } -func (opts *deletePipelineOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deletePipelineOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deletePipelineOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deletePipelineOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeletePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } + resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deletePipelineBuilder() *cobra.Command { @@ -147,12 +152,10 @@ func deletePipelineBuilder() *cobra.Command { Use: "deletePipeline", Short: "Remove One Data Lake Pipeline", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -166,33 +169,37 @@ func deletePipelineBuilder() *cobra.Command { } type deletePipelineRunDatasetOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string pipelineRunId string } -func (opts *deletePipelineRunDatasetOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deletePipelineRunDatasetOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deletePipelineRunDatasetOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeletePipelineRunDatasetApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } + resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deletePipelineRunDatasetBuilder() *cobra.Command { @@ -201,12 +208,10 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { Use: "deletePipelineRunDataset", Short: "Delete Pipeline Run Dataset", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -222,31 +227,35 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { } type getPipelineOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string } -func (opts *getPipelineOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getPipelineOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getPipelineOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getPipelineOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetPipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } + resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getPipelineBuilder() *cobra.Command { @@ -255,12 +264,10 @@ func getPipelineBuilder() *cobra.Command { Use: "getPipeline", Short: "Return One Data Lake Pipeline", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -274,33 +281,37 @@ func getPipelineBuilder() *cobra.Command { } type getPipelineRunOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string pipelineRunId string } -func (opts *getPipelineRunOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getPipelineRunOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getPipelineRunOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getPipelineRunOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetPipelineRunApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, PipelineRunId: opts.pipelineRunId, } + resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getPipelineRunBuilder() *cobra.Command { @@ -309,12 +320,10 @@ func getPipelineRunBuilder() *cobra.Command { Use: "getPipelineRun", Short: "Return One Data Lake Pipeline Run", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -330,7 +339,6 @@ func getPipelineRunBuilder() *cobra.Command { } type listPipelineRunsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string @@ -340,29 +348,43 @@ type listPipelineRunsOpts struct { createdBefore string } -func (opts *listPipelineRunsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPipelineRunsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPipelineRunsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPipelineRunsOpts) run(ctx context.Context, w io.Writer) error { + + var createdBefore *time.Time + var errCreatedBefore error + if opts.createdBefore != "" { + *createdBefore, errCreatedBefore = time.Parse(time.RFC3339, opts.createdBefore) + if errCreatedBefore != nil { + return errCreatedBefore + } + } + params := &admin.ListPipelineRunsApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, - CreatedBefore: convertTime(&opts.createdBefore), + CreatedBefore: createdBefore, } + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPipelineRunsBuilder() *cobra.Command { @@ -371,12 +393,10 @@ func listPipelineRunsBuilder() *cobra.Command { Use: "listPipelineRuns", Short: "Return All Data Lake Pipeline Runs from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -394,31 +414,35 @@ func listPipelineRunsBuilder() *cobra.Command { } type listPipelineSchedulesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string } -func (opts *listPipelineSchedulesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPipelineSchedulesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPipelineSchedulesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPipelineSchedulesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListPipelineSchedulesApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPipelineSchedulesBuilder() *cobra.Command { @@ -427,12 +451,10 @@ func listPipelineSchedulesBuilder() *cobra.Command { Use: "listPipelineSchedules", Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -446,7 +468,6 @@ func listPipelineSchedulesBuilder() *cobra.Command { } type listPipelineSnapshotsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string @@ -456,29 +477,43 @@ type listPipelineSnapshotsOpts struct { completedAfter string } -func (opts *listPipelineSnapshotsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPipelineSnapshotsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPipelineSnapshotsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, w io.Writer) error { + + var completedAfter *time.Time + var errCompletedAfter error + if opts.completedAfter != "" { + *completedAfter, errCompletedAfter = time.Parse(time.RFC3339, opts.completedAfter) + if errCompletedAfter != nil { + return errCompletedAfter + } + } + params := &admin.ListPipelineSnapshotsApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, - CompletedAfter: convertTime(&opts.completedAfter), + CompletedAfter: completedAfter, } + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPipelineSnapshotsBuilder() *cobra.Command { @@ -487,12 +522,10 @@ func listPipelineSnapshotsBuilder() *cobra.Command { Use: "listPipelineSnapshots", Short: "Return Available Backup Snapshots for One Data Lake Pipeline", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -510,29 +543,33 @@ func listPipelineSnapshotsBuilder() *cobra.Command { } type listPipelinesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *listPipelinesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPipelinesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPipelinesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPipelinesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.DataLakePipelinesApi.ListPipelinesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPipelinesBuilder() *cobra.Command { @@ -541,12 +578,10 @@ func listPipelinesBuilder() *cobra.Command { Use: "listPipelines", Short: "Return All Data Lake Pipelines from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -558,31 +593,35 @@ func listPipelinesBuilder() *cobra.Command { } type pausePipelineOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string } -func (opts *pausePipelineOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *pausePipelineOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *pausePipelineOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *pausePipelineOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.PausePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } + resp, _, err := opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func pausePipelineBuilder() *cobra.Command { @@ -591,12 +630,10 @@ func pausePipelineBuilder() *cobra.Command { Use: "pausePipeline", Short: "Pause One Data Lake Pipeline", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -610,31 +647,35 @@ func pausePipelineBuilder() *cobra.Command { } type resumePipelineOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string } -func (opts *resumePipelineOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *resumePipelineOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *resumePipelineOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *resumePipelineOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ResumePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } + resp, _, err := opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func resumePipelineBuilder() *cobra.Command { @@ -643,12 +684,10 @@ func resumePipelineBuilder() *cobra.Command { Use: "resumePipeline", Short: "Resume One Data Lake Pipeline", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -662,7 +701,6 @@ func resumePipelineBuilder() *cobra.Command { } type triggerSnapshotIngestionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string @@ -671,12 +709,9 @@ type triggerSnapshotIngestionOpts struct { fs afero.Fs } -func (opts *triggerSnapshotIngestionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *triggerSnapshotIngestionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *triggerSnapshotIngestionOpts) readData() (*admin.TriggerIngestionPipelineRequest, error) { @@ -701,23 +736,31 @@ func (opts *triggerSnapshotIngestionOpts) readData() (*admin.TriggerIngestionPip return out, nil } -func (opts *triggerSnapshotIngestionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.TriggerSnapshotIngestionApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, TriggerIngestionPipelineRequest: data, } + resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func triggerSnapshotIngestionBuilder() *cobra.Command { @@ -728,12 +771,10 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { Use: "triggerSnapshotIngestion", Short: "Trigger on demand snapshot ingestion", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -749,7 +790,6 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { } type updatePipelineOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string pipelineName string @@ -758,12 +798,9 @@ type updatePipelineOpts struct { fs afero.Fs } -func (opts *updatePipelineOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updatePipelineOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updatePipelineOpts) readData() (*admin.DataLakeIngestionPipeline, error) { @@ -788,23 +825,31 @@ func (opts *updatePipelineOpts) readData() (*admin.DataLakeIngestionPipeline, er return out, nil } -func (opts *updatePipelineOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updatePipelineOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdatePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, DataLakeIngestionPipeline: data, } + resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updatePipelineBuilder() *cobra.Command { @@ -815,12 +860,10 @@ func updatePipelineBuilder() *cobra.Command { Use: "updatePipeline", Short: "Update One Data Lake Pipeline", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index 4399528c3e..f4a62cb6d2 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createDatabaseUserOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type createDatabaseUserOpts struct { fs afero.Fs } -func (opts *createDatabaseUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createDatabaseUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) { @@ -69,22 +63,30 @@ func (opts *createDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) return out, nil } -func (opts *createDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, CloudDatabaseUser: data, } + resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createDatabaseUserBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createDatabaseUserBuilder() *cobra.Command { Use: "createDatabaseUser", Short: "Create One Database User in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,33 +114,37 @@ func createDatabaseUserBuilder() *cobra.Command { } type deleteDatabaseUserOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string databaseName string username string } -func (opts *deleteDatabaseUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteDatabaseUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, Username: opts.username, } + resp, _, err := opts.client.DatabaseUsersApi.DeleteDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteDatabaseUserBuilder() *cobra.Command { @@ -149,12 +153,10 @@ func deleteDatabaseUserBuilder() *cobra.Command { Use: "deleteDatabaseUser", Short: "Remove One Database User from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -182,33 +184,37 @@ func deleteDatabaseUserBuilder() *cobra.Command { } type getDatabaseUserOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string databaseName string username string } -func (opts *getDatabaseUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getDatabaseUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, Username: opts.username, } + resp, _, err := opts.client.DatabaseUsersApi.GetDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getDatabaseUserBuilder() *cobra.Command { @@ -217,12 +223,10 @@ func getDatabaseUserBuilder() *cobra.Command { Use: "getDatabaseUser", Short: "Return One Database User from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -250,7 +254,6 @@ func getDatabaseUserBuilder() *cobra.Command { } type listDatabaseUsersOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -258,27 +261,32 @@ type listDatabaseUsersOpts struct { pageNum int } -func (opts *listDatabaseUsersOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listDatabaseUsersOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listDatabaseUsersOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listDatabaseUsersOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListDatabaseUsersApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.DatabaseUsersApi.ListDatabaseUsersWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listDatabaseUsersBuilder() *cobra.Command { @@ -287,12 +295,10 @@ func listDatabaseUsersBuilder() *cobra.Command { Use: "listDatabaseUsers", Short: "Return All Database Users from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -307,7 +313,6 @@ func listDatabaseUsersBuilder() *cobra.Command { } type updateDatabaseUserOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string databaseName string @@ -317,12 +322,9 @@ type updateDatabaseUserOpts struct { fs afero.Fs } -func (opts *updateDatabaseUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateDatabaseUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) { @@ -347,11 +349,12 @@ func (opts *updateDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) return out, nil } -func (opts *updateDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateDatabaseUserApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, @@ -359,12 +362,19 @@ func (opts *updateDatabaseUserOpts) Run(ctx context.Context, w io.Writer) error CloudDatabaseUser: data, } + resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateDatabaseUserBuilder() *cobra.Command { @@ -375,12 +385,10 @@ func updateDatabaseUserBuilder() *cobra.Command { Use: "updateDatabaseUser", Short: "Update One Database User in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index a5716ed973..d570824bdc 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -23,37 +23,39 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getEncryptionAtRestOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getEncryptionAtRestOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getEncryptionAtRestOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getEncryptionAtRestOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRestWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getEncryptionAtRestBuilder() *cobra.Command { @@ -62,12 +64,10 @@ func getEncryptionAtRestBuilder() *cobra.Command { Use: "getEncryptionAtRest", Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -79,7 +79,6 @@ func getEncryptionAtRestBuilder() *cobra.Command { } type updateEncryptionAtRestOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -87,12 +86,9 @@ type updateEncryptionAtRestOpts struct { fs afero.Fs } -func (opts *updateEncryptionAtRestOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateEncryptionAtRestOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateEncryptionAtRestOpts) readData() (*admin.EncryptionAtRest, error) { @@ -117,22 +113,30 @@ func (opts *updateEncryptionAtRestOpts) readData() (*admin.EncryptionAtRest, err return out, nil } -func (opts *updateEncryptionAtRestOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, EncryptionAtRest: data, } + resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateEncryptionAtRestBuilder() *cobra.Command { @@ -143,12 +147,10 @@ func updateEncryptionAtRestBuilder() *cobra.Command { Use: "updateEncryptionAtRest", Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 0fc40a7d6d..01984fe34f 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -18,42 +18,47 @@ package api import ( "context" + "encoding/json" + "fmt" "io" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getOrganizationEventOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string eventId string includeRaw bool } -func (opts *getOrganizationEventOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getOrganizationEventOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getOrganizationEventOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getOrganizationEventOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetOrganizationEventApiParams{ OrgId: opts.orgId, EventId: opts.eventId, IncludeRaw: &opts.includeRaw, } + resp, _, err := opts.client.EventsApi.GetOrganizationEventWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getOrganizationEventBuilder() *cobra.Command { @@ -62,12 +67,10 @@ func getOrganizationEventBuilder() *cobra.Command { Use: "getOrganizationEvent", Short: "Return One Event from One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -80,33 +83,37 @@ func getOrganizationEventBuilder() *cobra.Command { } type getProjectEventOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string eventId string includeRaw bool } -func (opts *getProjectEventOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getProjectEventOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getProjectEventOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getProjectEventOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetProjectEventApiParams{ GroupId: opts.groupId, EventId: opts.eventId, IncludeRaw: &opts.includeRaw, } + resp, _, err := opts.client.EventsApi.GetProjectEventWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getProjectEventBuilder() *cobra.Command { @@ -115,12 +122,10 @@ func getProjectEventBuilder() *cobra.Command { Use: "getProjectEvent", Short: "Return One Event from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -135,7 +140,6 @@ func getProjectEventBuilder() *cobra.Command { } type listOrganizationEventsOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string includeCount bool @@ -147,15 +151,31 @@ type listOrganizationEventsOpts struct { minDate string } -func (opts *listOrganizationEventsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listOrganizationEventsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listOrganizationEventsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationEventsOpts) run(ctx context.Context, w io.Writer) error { + + var maxDate *time.Time + var errMaxDate error + if opts.maxDate != "" { + *maxDate, errMaxDate = time.Parse(time.RFC3339, opts.maxDate) + if errMaxDate != nil { + return errMaxDate + } + } + + var minDate *time.Time + var errMinDate error + if opts.minDate != "" { + *minDate, errMinDate = time.Parse(time.RFC3339, opts.minDate) + if errMinDate != nil { + return errMinDate + } + } + params := &admin.ListOrganizationEventsApiParams{ OrgId: opts.orgId, IncludeCount: &opts.includeCount, @@ -163,15 +183,22 @@ func (opts *listOrganizationEventsOpts) Run(ctx context.Context, w io.Writer) er PageNum: &opts.pageNum, EventType: &opts.eventType, IncludeRaw: &opts.includeRaw, - MaxDate: convertTime(&opts.maxDate), - MinDate: convertTime(&opts.minDate), + MaxDate: maxDate, + MinDate: minDate, } + resp, _, err := opts.client.EventsApi.ListOrganizationEventsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listOrganizationEventsBuilder() *cobra.Command { @@ -180,12 +207,10 @@ func listOrganizationEventsBuilder() *cobra.Command { Use: "listOrganizationEvents", Short: "Return All Events from One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -204,7 +229,6 @@ func listOrganizationEventsBuilder() *cobra.Command { } type listProjectEventsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -218,15 +242,31 @@ type listProjectEventsOpts struct { minDate string } -func (opts *listProjectEventsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listProjectEventsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listProjectEventsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listProjectEventsOpts) run(ctx context.Context, w io.Writer) error { + + var maxDate *time.Time + var errMaxDate error + if opts.maxDate != "" { + *maxDate, errMaxDate = time.Parse(time.RFC3339, opts.maxDate) + if errMaxDate != nil { + return errMaxDate + } + } + + var minDate *time.Time + var errMinDate error + if opts.minDate != "" { + *minDate, errMinDate = time.Parse(time.RFC3339, opts.minDate) + if errMinDate != nil { + return errMinDate + } + } + params := &admin.ListProjectEventsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -236,15 +276,22 @@ func (opts *listProjectEventsOpts) Run(ctx context.Context, w io.Writer) error { EventType: &opts.eventType, ExcludedEventType: &opts.excludedEventType, IncludeRaw: &opts.includeRaw, - MaxDate: convertTime(&opts.maxDate), - MinDate: convertTime(&opts.minDate), + MaxDate: maxDate, + MinDate: minDate, } + resp, _, err := opts.client.EventsApi.ListProjectEventsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listProjectEventsBuilder() *cobra.Command { @@ -253,12 +300,10 @@ func listProjectEventsBuilder() *cobra.Command { Use: "listProjectEvents", Short: "Return All Events from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index a753e952dd..e358f7f967 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createRoleMappingOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string orgId string @@ -40,12 +37,9 @@ type createRoleMappingOpts struct { fs afero.Fs } -func (opts *createRoleMappingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createRoleMappingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, error) { @@ -70,23 +64,31 @@ func (opts *createRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, return out, nil } -func (opts *createRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createRoleMappingOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, AuthFederationRoleMapping: data, } + resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createRoleMappingBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createRoleMappingBuilder() *cobra.Command { Use: "createRoleMapping", Short: "Add One Role Mapping to One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -116,29 +116,23 @@ func createRoleMappingBuilder() *cobra.Command { } type deleteFederationAppOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string } -func (opts *deleteFederationAppOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteFederationAppOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteFederationAppOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deleteFederationAppOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DeleteFederationAppApiParams{ FederationSettingsId: opts.federationSettingsId, } - _, err := opts.client.FederatedAuthenticationApi.DeleteFederationAppWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.FederatedAuthenticationApi.DeleteFederationAppWithParams(ctx, params).Execute() + return err } func deleteFederationAppBuilder() *cobra.Command { @@ -147,12 +141,10 @@ func deleteFederationAppBuilder() *cobra.Command { Use: "deleteFederationApp", Short: "Delete the federation settings instance.", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -162,33 +154,27 @@ func deleteFederationAppBuilder() *cobra.Command { } type deleteRoleMappingOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string id string orgId string } -func (opts *deleteRoleMappingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteRoleMappingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteRoleMappingOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, Id: opts.id, OrgId: opts.orgId, } - _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params).Execute() + return err } func deleteRoleMappingBuilder() *cobra.Command { @@ -197,12 +183,10 @@ func deleteRoleMappingBuilder() *cobra.Command { Use: "deleteRoleMapping", Short: "Remove One Role Mapping from One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -216,31 +200,35 @@ func deleteRoleMappingBuilder() *cobra.Command { } type getConnectedOrgConfigOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string orgId string } -func (opts *getConnectedOrgConfigOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getConnectedOrgConfigOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getConnectedOrgConfigOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } + resp, _, err := opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getConnectedOrgConfigBuilder() *cobra.Command { @@ -249,12 +237,10 @@ func getConnectedOrgConfigBuilder() *cobra.Command { Use: "getConnectedOrgConfig", Short: "Return One Org Config Connected to One Federation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -266,29 +252,33 @@ func getConnectedOrgConfigBuilder() *cobra.Command { } type getFederationSettingsOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string } -func (opts *getFederationSettingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getFederationSettingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getFederationSettingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getFederationSettingsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, } + resp, _, err := opts.client.FederatedAuthenticationApi.GetFederationSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getFederationSettingsBuilder() *cobra.Command { @@ -297,12 +287,10 @@ func getFederationSettingsBuilder() *cobra.Command { Use: "getFederationSettings", Short: "Return Federation Settings for One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -312,31 +300,35 @@ func getFederationSettingsBuilder() *cobra.Command { } type getIdentityProviderOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string identityProviderId string } -func (opts *getIdentityProviderOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getIdentityProviderOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getIdentityProviderOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getIdentityProviderOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } + resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getIdentityProviderBuilder() *cobra.Command { @@ -345,12 +337,10 @@ func getIdentityProviderBuilder() *cobra.Command { Use: "getIdentityProvider", Short: "Return one identity provider from the specified federation.", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -362,31 +352,35 @@ func getIdentityProviderBuilder() *cobra.Command { } type getIdentityProviderMetadataOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string identityProviderId string } -func (opts *getIdentityProviderMetadataOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getIdentityProviderMetadataOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getIdentityProviderMetadataOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getIdentityProviderMetadataOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetIdentityProviderMetadataApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } + resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getIdentityProviderMetadataBuilder() *cobra.Command { @@ -395,12 +389,10 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { Use: "getIdentityProviderMetadata", Short: "Return the metadata of one identity provider in the specified federation.", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -412,33 +404,37 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { } type getRoleMappingOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string id string orgId string } -func (opts *getRoleMappingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getRoleMappingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getRoleMappingOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, Id: opts.id, OrgId: opts.orgId, } + resp, _, err := opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getRoleMappingBuilder() *cobra.Command { @@ -447,12 +443,10 @@ func getRoleMappingBuilder() *cobra.Command { Use: "getRoleMapping", Short: "Return One Role Mapping from One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -466,29 +460,33 @@ func getRoleMappingBuilder() *cobra.Command { } type listConnectedOrgConfigsOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string } -func (opts *listConnectedOrgConfigsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listConnectedOrgConfigsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listConnectedOrgConfigsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listConnectedOrgConfigsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListConnectedOrgConfigsApiParams{ FederationSettingsId: opts.federationSettingsId, } + resp, _, err := opts.client.FederatedAuthenticationApi.ListConnectedOrgConfigsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listConnectedOrgConfigsBuilder() *cobra.Command { @@ -497,12 +495,10 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { Use: "listConnectedOrgConfigs", Short: "Return All Connected Org Configs from the Federation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -512,29 +508,33 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { } type listIdentityProvidersOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string } -func (opts *listIdentityProvidersOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listIdentityProvidersOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listIdentityProvidersOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listIdentityProvidersOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListIdentityProvidersApiParams{ FederationSettingsId: opts.federationSettingsId, } + resp, _, err := opts.client.FederatedAuthenticationApi.ListIdentityProvidersWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listIdentityProvidersBuilder() *cobra.Command { @@ -543,12 +543,10 @@ func listIdentityProvidersBuilder() *cobra.Command { Use: "listIdentityProviders", Short: "Return all identity providers from the specified federation.", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -558,31 +556,35 @@ func listIdentityProvidersBuilder() *cobra.Command { } type listRoleMappingsOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string orgId string } -func (opts *listRoleMappingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listRoleMappingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listRoleMappingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listRoleMappingsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } + resp, _, err := opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listRoleMappingsBuilder() *cobra.Command { @@ -591,12 +593,10 @@ func listRoleMappingsBuilder() *cobra.Command { Use: "listRoleMappings", Short: "Return All Role Mappings from One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -608,31 +608,35 @@ func listRoleMappingsBuilder() *cobra.Command { } type removeConnectedOrgConfigOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string orgId string } -func (opts *removeConnectedOrgConfigOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *removeConnectedOrgConfigOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *removeConnectedOrgConfigOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *removeConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.RemoveConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } + resp, _, err := opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func removeConnectedOrgConfigBuilder() *cobra.Command { @@ -641,12 +645,10 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { Use: "removeConnectedOrgConfig", Short: "Remove One Org Config Connected to One Federation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -658,7 +660,6 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { } type updateConnectedOrgConfigOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string orgId string @@ -667,12 +668,9 @@ type updateConnectedOrgConfigOpts struct { fs afero.Fs } -func (opts *updateConnectedOrgConfigOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateConnectedOrgConfigOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateConnectedOrgConfigOpts) readData() (*admin.ConnectedOrgConfig, error) { @@ -697,23 +695,31 @@ func (opts *updateConnectedOrgConfigOpts) readData() (*admin.ConnectedOrgConfig, return out, nil } -func (opts *updateConnectedOrgConfigOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, ConnectedOrgConfig: data, } + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateConnectedOrgConfigBuilder() *cobra.Command { @@ -724,12 +730,10 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { Use: "updateConnectedOrgConfig", Short: "Update One Org Config Connected to One Federation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -743,7 +747,6 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { } type updateIdentityProviderOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string identityProviderId string @@ -752,12 +755,9 @@ type updateIdentityProviderOpts struct { fs afero.Fs } -func (opts *updateIdentityProviderOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateIdentityProviderOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateIdentityProviderOpts) readData() (*admin.SamlIdentityProviderUpdate, error) { @@ -782,23 +782,31 @@ func (opts *updateIdentityProviderOpts) readData() (*admin.SamlIdentityProviderU return out, nil } -func (opts *updateIdentityProviderOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateIdentityProviderOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, SamlIdentityProviderUpdate: data, } + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateIdentityProviderBuilder() *cobra.Command { @@ -809,12 +817,10 @@ func updateIdentityProviderBuilder() *cobra.Command { Use: "updateIdentityProvider", Short: "Update the identity provider.", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -828,7 +834,6 @@ func updateIdentityProviderBuilder() *cobra.Command { } type updateRoleMappingOpts struct { - cli.GlobalOpts client *admin.APIClient federationSettingsId string id string @@ -838,12 +843,9 @@ type updateRoleMappingOpts struct { fs afero.Fs } -func (opts *updateRoleMappingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateRoleMappingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, error) { @@ -868,11 +870,12 @@ func (opts *updateRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, return out, nil } -func (opts *updateRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateRoleMappingOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, Id: opts.id, @@ -880,12 +883,19 @@ func (opts *updateRoleMappingOpts) Run(ctx context.Context, w io.Writer) error { AuthFederationRoleMapping: data, } + resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateRoleMappingBuilder() *cobra.Command { @@ -896,12 +906,10 @@ func updateRoleMappingBuilder() *cobra.Command { Use: "updateRoleMapping", Short: "Update One Role Mapping in One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 7adc13b4bb..089cc5e8c9 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createCustomZoneMappingOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -40,12 +37,9 @@ type createCustomZoneMappingOpts struct { fs afero.Fs } -func (opts *createCustomZoneMappingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createCustomZoneMappingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createCustomZoneMappingOpts) readData() (*admin.GeoSharding, error) { @@ -70,23 +64,31 @@ func (opts *createCustomZoneMappingOpts) readData() (*admin.GeoSharding, error) return out, nil } -func (opts *createCustomZoneMappingOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createCustomZoneMappingOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateCustomZoneMappingApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, GeoSharding: data, } + resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createCustomZoneMappingBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createCustomZoneMappingBuilder() *cobra.Command { Use: "createCustomZoneMapping", Short: "Add One Entry to One Custom Zone Mapping", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,7 +118,6 @@ func createCustomZoneMappingBuilder() *cobra.Command { } type createManagedNamespaceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -127,12 +126,9 @@ type createManagedNamespaceOpts struct { fs afero.Fs } -func (opts *createManagedNamespaceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createManagedNamespaceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createManagedNamespaceOpts) readData() (*admin.ManagedNamespace, error) { @@ -157,23 +153,31 @@ func (opts *createManagedNamespaceOpts) readData() (*admin.ManagedNamespace, err return out, nil } -func (opts *createManagedNamespaceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateManagedNamespaceApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, ManagedNamespace: data, } + resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createManagedNamespaceBuilder() *cobra.Command { @@ -184,12 +188,10 @@ func createManagedNamespaceBuilder() *cobra.Command { Use: "createManagedNamespace", Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -205,31 +207,35 @@ func createManagedNamespaceBuilder() *cobra.Command { } type deleteAllCustomZoneMappingsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *deleteAllCustomZoneMappingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteAllCustomZoneMappingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteAllCustomZoneMappingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteAllCustomZoneMappingsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteAllCustomZoneMappingsBuilder() *cobra.Command { @@ -238,12 +244,10 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { Use: "deleteAllCustomZoneMappings", Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -257,7 +261,6 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { } type deleteManagedNamespaceOpts struct { - cli.GlobalOpts client *admin.APIClient clusterName string groupId string @@ -265,27 +268,32 @@ type deleteManagedNamespaceOpts struct { collection string } -func (opts *deleteManagedNamespaceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteManagedNamespaceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteManagedNamespaceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, Db: &opts.db, Collection: &opts.collection, } + resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteManagedNamespaceBuilder() *cobra.Command { @@ -294,12 +302,10 @@ func deleteManagedNamespaceBuilder() *cobra.Command { Use: "deleteManagedNamespace", Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) @@ -315,31 +321,35 @@ func deleteManagedNamespaceBuilder() *cobra.Command { } type getManagedNamespaceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *getManagedNamespaceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getManagedNamespaceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getManagedNamespaceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetManagedNamespaceApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getManagedNamespaceBuilder() *cobra.Command { @@ -348,12 +358,10 @@ func getManagedNamespaceBuilder() *cobra.Command { Use: "getManagedNamespace", Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index 38ab47c8c0..fa2c63b0c0 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createCostExplorerQueryProcessOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string @@ -39,12 +36,9 @@ type createCostExplorerQueryProcessOpts struct { fs afero.Fs } -func (opts *createCostExplorerQueryProcessOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createCostExplorerQueryProcessOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createCostExplorerQueryProcessOpts) readData() (*admin.CostExplorerFilterRequestBody, error) { @@ -69,22 +63,30 @@ func (opts *createCostExplorerQueryProcessOpts) readData() (*admin.CostExplorerF return out, nil } -func (opts *createCostExplorerQueryProcessOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateCostExplorerQueryProcessApiParams{ OrgId: opts.orgId, CostExplorerFilterRequestBody: data, } + resp, _, err := opts.client.InvoicesApi.CreateCostExplorerQueryProcessWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createCostExplorerQueryProcessBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { Use: "createCostExplorerQueryProcess", Short: "Create Cost Explorer query process", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -112,31 +112,35 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { } type createCostExplorerQueryProcess1Opts struct { - cli.GlobalOpts client *admin.APIClient orgId string token string } -func (opts *createCostExplorerQueryProcess1Opts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createCostExplorerQueryProcess1Opts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *createCostExplorerQueryProcess1Opts) Run(ctx context.Context, w io.Writer) error { +func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, w io.Writer) error { + params := &admin.CreateCostExplorerQueryProcess1ApiParams{ OrgId: opts.orgId, Token: opts.token, } + resp, _, err := opts.client.InvoicesApi.CreateCostExplorerQueryProcess1WithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createCostExplorerQueryProcess1Builder() *cobra.Command { @@ -145,12 +149,10 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { Use: "createCostExplorerQueryProcess1", Short: "Return results from a given Cost Explorer query, or notify that the results are not ready yet.", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -162,31 +164,35 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { } type downloadInvoiceCSVOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string invoiceId string } -func (opts *downloadInvoiceCSVOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *downloadInvoiceCSVOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *downloadInvoiceCSVOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DownloadInvoiceCSVApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, } + resp, _, err := opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func downloadInvoiceCSVBuilder() *cobra.Command { @@ -195,12 +201,10 @@ func downloadInvoiceCSVBuilder() *cobra.Command { Use: "downloadInvoiceCSV", Short: "Return One Organization Invoice as CSV", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -212,31 +216,35 @@ func downloadInvoiceCSVBuilder() *cobra.Command { } type getInvoiceOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string invoiceId string } -func (opts *getInvoiceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getInvoiceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getInvoiceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getInvoiceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetInvoiceApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, } + resp, _, err := opts.client.InvoicesApi.GetInvoiceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getInvoiceBuilder() *cobra.Command { @@ -245,12 +253,10 @@ func getInvoiceBuilder() *cobra.Command { Use: "getInvoice", Short: "Return One Organization Invoice", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -262,7 +268,6 @@ func getInvoiceBuilder() *cobra.Command { } type listInvoicesOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string includeCount bool @@ -270,27 +275,32 @@ type listInvoicesOpts struct { pageNum int } -func (opts *listInvoicesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listInvoicesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listInvoicesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listInvoicesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListInvoicesApiParams{ OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.InvoicesApi.ListInvoicesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listInvoicesBuilder() *cobra.Command { @@ -299,12 +309,10 @@ func listInvoicesBuilder() *cobra.Command { Use: "listInvoices", Short: "Return All Invoices for One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -317,29 +325,33 @@ func listInvoicesBuilder() *cobra.Command { } type listPendingInvoicesOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string } -func (opts *listPendingInvoicesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPendingInvoicesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPendingInvoicesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPendingInvoicesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, } + resp, _, err := opts.client.InvoicesApi.ListPendingInvoicesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPendingInvoicesBuilder() *cobra.Command { @@ -348,12 +360,10 @@ func listPendingInvoicesBuilder() *cobra.Command { Use: "listPendingInvoices", Short: "Return All Pending Invoices for One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index c5b4a9e544..b2f5b5508b 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -23,37 +23,39 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type deleteLDAPConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *deleteLDAPConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteLDAPConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteLDAPConfigurationBuilder() *cobra.Command { @@ -62,12 +64,10 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { Use: "deleteLDAPConfiguration", Short: "Remove the Current LDAP User to DN Mapping", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -79,29 +79,33 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { } type getLDAPConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getLDAPConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getLDAPConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getLDAPConfigurationBuilder() *cobra.Command { @@ -110,12 +114,10 @@ func getLDAPConfigurationBuilder() *cobra.Command { Use: "getLDAPConfiguration", Short: "Return the Current LDAP or X.509 Configuration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -127,31 +129,35 @@ func getLDAPConfigurationBuilder() *cobra.Command { } type getLDAPConfigurationStatusOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string requestId string } -func (opts *getLDAPConfigurationStatusOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getLDAPConfigurationStatusOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getLDAPConfigurationStatusOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetLDAPConfigurationStatusApiParams{ GroupId: opts.groupId, RequestId: opts.requestId, } + resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getLDAPConfigurationStatusBuilder() *cobra.Command { @@ -160,12 +166,10 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { Use: "getLDAPConfigurationStatus", Short: "Return the Status of One Verify LDAP Configuration Request", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -179,7 +183,6 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { } type saveLDAPConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -187,12 +190,9 @@ type saveLDAPConfigurationOpts struct { fs afero.Fs } -func (opts *saveLDAPConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *saveLDAPConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *saveLDAPConfigurationOpts) readData() (*admin.UserSecurity, error) { @@ -217,22 +217,30 @@ func (opts *saveLDAPConfigurationOpts) readData() (*admin.UserSecurity, error) { return out, nil } -func (opts *saveLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, UserSecurity: data, } + resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func saveLDAPConfigurationBuilder() *cobra.Command { @@ -243,12 +251,10 @@ func saveLDAPConfigurationBuilder() *cobra.Command { Use: "saveLDAPConfiguration", Short: "Edit the LDAP or X.509 Configuration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -262,7 +268,6 @@ func saveLDAPConfigurationBuilder() *cobra.Command { } type verifyLDAPConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -270,12 +275,9 @@ type verifyLDAPConfigurationOpts struct { fs afero.Fs } -func (opts *verifyLDAPConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *verifyLDAPConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *verifyLDAPConfigurationOpts) readData() (*admin.LDAPVerifyConnectivityJobRequestParams, error) { @@ -300,22 +302,30 @@ func (opts *verifyLDAPConfigurationOpts) readData() (*admin.LDAPVerifyConnectivi return out, nil } -func (opts *verifyLDAPConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, LDAPVerifyConnectivityJobRequestParams: data, } + resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func verifyLDAPConfigurationBuilder() *cobra.Command { @@ -326,12 +336,10 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { Use: "verifyLDAPConfiguration", Short: "Verify the LDAP Configuration in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 0a3f61c4fa..88edcbd299 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -23,41 +23,43 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type deleteLegacySnapshotOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string snapshotId string } -func (opts *deleteLegacySnapshotOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteLegacySnapshotOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteLegacySnapshotOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteLegacySnapshotApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } + resp, _, err := opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteLegacySnapshotBuilder() *cobra.Command { @@ -66,12 +68,10 @@ func deleteLegacySnapshotBuilder() *cobra.Command { Use: "deleteLegacySnapshot", Short: "Remove One Legacy Backup Snapshot", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -87,33 +87,37 @@ func deleteLegacySnapshotBuilder() *cobra.Command { } type getLegacyBackupCheckpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string checkpointId string clusterName string } -func (opts *getLegacyBackupCheckpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getLegacyBackupCheckpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getLegacyBackupCheckpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetLegacyBackupCheckpointApiParams{ GroupId: opts.groupId, CheckpointId: opts.checkpointId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getLegacyBackupCheckpointBuilder() *cobra.Command { @@ -122,12 +126,10 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { Use: "getLegacyBackupCheckpoint", Short: "Return One Legacy Backup Checkpoint", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -143,33 +145,37 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { } type getLegacyBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string jobId string } -func (opts *getLegacyBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getLegacyBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getLegacyBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, JobId: opts.jobId, } + resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getLegacyBackupRestoreJobBuilder() *cobra.Command { @@ -178,12 +184,10 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { Use: "getLegacyBackupRestoreJob", Short: "Return One Legacy Backup Restore Job", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -199,33 +203,37 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { } type getLegacySnapshotOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string snapshotId string } -func (opts *getLegacySnapshotOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getLegacySnapshotOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getLegacySnapshotOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetLegacySnapshotApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } + resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getLegacySnapshotBuilder() *cobra.Command { @@ -234,12 +242,10 @@ func getLegacySnapshotBuilder() *cobra.Command { Use: "getLegacySnapshot", Short: "Return One Legacy Backup Snapshot", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -255,31 +261,35 @@ func getLegacySnapshotBuilder() *cobra.Command { } type getLegacySnapshotScheduleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *getLegacySnapshotScheduleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getLegacySnapshotScheduleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getLegacySnapshotScheduleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getLegacySnapshotScheduleBuilder() *cobra.Command { @@ -288,12 +298,10 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { Use: "getLegacySnapshotSchedule", Short: "Return One Snapshot Schedule", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -307,7 +315,6 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { } type listLegacyBackupCheckpointsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -316,15 +323,13 @@ type listLegacyBackupCheckpointsOpts struct { pageNum int } -func (opts *listLegacyBackupCheckpointsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listLegacyBackupCheckpointsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listLegacyBackupCheckpointsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListLegacyBackupCheckpointsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -332,12 +337,19 @@ func (opts *listLegacyBackupCheckpointsOpts) Run(ctx context.Context, w io.Write ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listLegacyBackupCheckpointsBuilder() *cobra.Command { @@ -346,12 +358,10 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { Use: "listLegacyBackupCheckpoints", Short: "Return All Legacy Backup Checkpoints", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -368,7 +378,6 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { } type listLegacyBackupRestoreJobsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -378,15 +387,13 @@ type listLegacyBackupRestoreJobsOpts struct { batchId string } -func (opts *listLegacyBackupRestoreJobsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listLegacyBackupRestoreJobsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listLegacyBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListLegacyBackupRestoreJobsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -395,12 +402,19 @@ func (opts *listLegacyBackupRestoreJobsOpts) Run(ctx context.Context, w io.Write PageNum: &opts.pageNum, BatchId: &opts.batchId, } + resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listLegacyBackupRestoreJobsBuilder() *cobra.Command { @@ -409,12 +423,10 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { Use: "listLegacyBackupRestoreJobs", Short: "Return All Legacy Backup Restore Jobs", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -432,7 +444,6 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { } type listLegacySnapshotsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -442,15 +453,13 @@ type listLegacySnapshotsOpts struct { completed string } -func (opts *listLegacySnapshotsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listLegacySnapshotsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listLegacySnapshotsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listLegacySnapshotsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListLegacySnapshotsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -459,12 +468,19 @@ func (opts *listLegacySnapshotsOpts) Run(ctx context.Context, w io.Writer) error PageNum: &opts.pageNum, Completed: &opts.completed, } + resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listLegacySnapshotsBuilder() *cobra.Command { @@ -473,12 +489,10 @@ func listLegacySnapshotsBuilder() *cobra.Command { Use: "listLegacySnapshots", Short: "Return All Legacy Backup Snapshots", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -496,7 +510,6 @@ func listLegacySnapshotsBuilder() *cobra.Command { } type updateLegacySnapshotRetentionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -506,12 +519,9 @@ type updateLegacySnapshotRetentionOpts struct { fs afero.Fs } -func (opts *updateLegacySnapshotRetentionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateLegacySnapshotRetentionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateLegacySnapshotRetentionOpts) readData() (*admin.BackupSnapshot, error) { @@ -536,11 +546,12 @@ func (opts *updateLegacySnapshotRetentionOpts) readData() (*admin.BackupSnapshot return out, nil } -func (opts *updateLegacySnapshotRetentionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateLegacySnapshotRetentionApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -548,12 +559,19 @@ func (opts *updateLegacySnapshotRetentionOpts) Run(ctx context.Context, w io.Wri BackupSnapshot: data, } + resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateLegacySnapshotRetentionBuilder() *cobra.Command { @@ -564,12 +582,10 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { Use: "updateLegacySnapshotRetention", Short: "Change One Legacy Backup Snapshot Expiration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -587,7 +603,6 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { } type updateLegacySnapshotScheduleOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -596,12 +611,9 @@ type updateLegacySnapshotScheduleOpts struct { fs afero.Fs } -func (opts *updateLegacySnapshotScheduleOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateLegacySnapshotScheduleOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateLegacySnapshotScheduleOpts) readData() (*admin.ApiAtlasSnapshotSchedule, error) { @@ -626,23 +638,31 @@ func (opts *updateLegacySnapshotScheduleOpts) readData() (*admin.ApiAtlasSnapsho return out, nil } -func (opts *updateLegacySnapshotScheduleOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, ApiAtlasSnapshotSchedule: data, } + resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateLegacySnapshotScheduleBuilder() *cobra.Command { @@ -653,12 +673,10 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { Use: "updateLegacySnapshotSchedule", Short: "Update Snapshot Schedule for One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index dbd5c65f08..f3335774fe 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createLegacyBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -40,12 +37,9 @@ type createLegacyBackupRestoreJobOpts struct { fs afero.Fs } -func (opts *createLegacyBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createLegacyBackupRestoreJobOpts) readData() (*admin.BackupRestoreJob, error) { @@ -70,23 +64,31 @@ func (opts *createLegacyBackupRestoreJobOpts) readData() (*admin.BackupRestoreJo return out, nil } -func (opts *createLegacyBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, BackupRestoreJob: data, } + resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createLegacyBackupRestoreJobBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { Use: "createLegacyBackupRestoreJob", Short: "Create One Legacy Backup Restore Job", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index 4e1d8bd991..26cd3d947d 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -23,37 +23,29 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type deferMaintenanceWindowOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *deferMaintenanceWindowOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deferMaintenanceWindowOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deferMaintenanceWindowOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deferMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, } - _, err := opts.client.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(ctx, params).Execute() + return err } func deferMaintenanceWindowBuilder() *cobra.Command { @@ -62,12 +54,10 @@ func deferMaintenanceWindowBuilder() *cobra.Command { Use: "deferMaintenanceWindow", Short: "Defer One Maintenance Window for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -79,29 +69,33 @@ func deferMaintenanceWindowBuilder() *cobra.Command { } type getMaintenanceWindowOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getMaintenanceWindowOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getMaintenanceWindowOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getMaintenanceWindowOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.MaintenanceWindowsApi.GetMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getMaintenanceWindowBuilder() *cobra.Command { @@ -110,12 +104,10 @@ func getMaintenanceWindowBuilder() *cobra.Command { Use: "getMaintenanceWindow", Short: "Return One Maintenance Window for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -127,29 +119,23 @@ func getMaintenanceWindowBuilder() *cobra.Command { } type resetMaintenanceWindowOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *resetMaintenanceWindowOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *resetMaintenanceWindowOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *resetMaintenanceWindowOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *resetMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, } - _, err := opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params).Execute() + return err } func resetMaintenanceWindowBuilder() *cobra.Command { @@ -158,12 +144,10 @@ func resetMaintenanceWindowBuilder() *cobra.Command { Use: "resetMaintenanceWindow", Short: "Reset One Maintenance Window for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -175,29 +159,23 @@ func resetMaintenanceWindowBuilder() *cobra.Command { } type toggleMaintenanceAutoDeferOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *toggleMaintenanceAutoDeferOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *toggleMaintenanceAutoDeferOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *toggleMaintenanceAutoDeferOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *toggleMaintenanceAutoDeferOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, } - _, err := opts.client.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(ctx, params).Execute() + return err } func toggleMaintenanceAutoDeferBuilder() *cobra.Command { @@ -206,12 +184,10 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { Use: "toggleMaintenanceAutoDefer", Short: "Toggle Automatic Deferral of Maintenance for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -223,7 +199,6 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { } type updateMaintenanceWindowOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -231,12 +206,9 @@ type updateMaintenanceWindowOpts struct { fs afero.Fs } -func (opts *updateMaintenanceWindowOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateMaintenanceWindowOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateMaintenanceWindowOpts) readData() (*admin.GroupMaintenanceWindow, error) { @@ -261,22 +233,30 @@ func (opts *updateMaintenanceWindowOpts) readData() (*admin.GroupMaintenanceWind return out, nil } -func (opts *updateMaintenanceWindowOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateMaintenanceWindowApiParams{ GroupId: opts.groupId, GroupMaintenanceWindow: data, } + resp, _, err := opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateMaintenanceWindowBuilder() *cobra.Command { @@ -287,12 +267,10 @@ func updateMaintenanceWindowBuilder() *cobra.Command { Use: "updateMaintenanceWindow", Short: "Update Maintenance Window for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index 3bc81c87a2..ce64a2eaa9 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -23,27 +23,21 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createUserOpts struct { - cli.GlobalOpts client *admin.APIClient filename string fs afero.Fs } -func (opts *createUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createUserOpts) readData() (*admin.CloudAppUser, error) { @@ -68,21 +62,29 @@ func (opts *createUserOpts) readData() (*admin.CloudAppUser, error) { return out, nil } -func (opts *createUserOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createUserOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateUserApiParams{ CloudAppUser: data, } + resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createUserBuilder() *cobra.Command { @@ -93,12 +95,10 @@ func createUserBuilder() *cobra.Command { Use: "createUser", Short: "Create One MongoDB Cloud User", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } @@ -108,29 +108,33 @@ func createUserBuilder() *cobra.Command { } type getUserOpts struct { - cli.GlobalOpts client *admin.APIClient userId string } -func (opts *getUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getUserOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getUserOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetUserApiParams{ UserId: opts.userId, } + resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getUserBuilder() *cobra.Command { @@ -139,12 +143,10 @@ func getUserBuilder() *cobra.Command { Use: "getUser", Short: "Return One MongoDB Cloud User using Its ID", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies this user.`) @@ -154,29 +156,33 @@ func getUserBuilder() *cobra.Command { } type getUserByUsernameOpts struct { - cli.GlobalOpts client *admin.APIClient userName string } -func (opts *getUserByUsernameOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getUserByUsernameOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getUserByUsernameOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getUserByUsernameOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetUserByUsernameApiParams{ UserName: opts.userName, } + resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserByUsernameWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getUserByUsernameBuilder() *cobra.Command { @@ -185,12 +191,10 @@ func getUserByUsernameBuilder() *cobra.Command { Use: "getUserByUsername", Short: "Return One MongoDB Cloud User using Their Username", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.userName, "userName", "", `Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.`) diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index 6bf1d59ad0..83a5b9d2d7 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -18,40 +18,45 @@ package api import ( "context" + "encoding/json" + "fmt" "io" + "time" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getAtlasProcessOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string processId string } -func (opts *getAtlasProcessOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getAtlasProcessOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getAtlasProcessOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getAtlasProcessOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetAtlasProcessApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, } + resp, _, err := opts.client.MonitoringAndLogsApi.GetAtlasProcessWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getAtlasProcessBuilder() *cobra.Command { @@ -60,12 +65,10 @@ func getAtlasProcessBuilder() *cobra.Command { Use: "getAtlasProcess", Short: "Return One MongoDB Process by ID", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -79,33 +82,37 @@ func getAtlasProcessBuilder() *cobra.Command { } type getDatabaseOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string databaseName string processId string } -func (opts *getDatabaseOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getDatabaseOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getDatabaseOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getDatabaseOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetDatabaseApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, ProcessId: opts.processId, } + resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getDatabaseBuilder() *cobra.Command { @@ -114,12 +121,10 @@ func getDatabaseBuilder() *cobra.Command { Use: "getDatabase", Short: "Return One Database for a MongoDB Process", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -135,7 +140,6 @@ func getDatabaseBuilder() *cobra.Command { } type getDatabaseMeasurementsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string databaseName string @@ -147,15 +151,31 @@ type getDatabaseMeasurementsOpts struct { end string } -func (opts *getDatabaseMeasurementsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getDatabaseMeasurementsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getDatabaseMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + params := &admin.GetDatabaseMeasurementsApiParams{ GroupId: opts.groupId, DatabaseName: opts.databaseName, @@ -163,15 +183,22 @@ func (opts *getDatabaseMeasurementsOpts) Run(ctx context.Context, w io.Writer) e Granularity: &opts.granularity, M: &opts.m, Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + Start: start, + End: end, } + resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getDatabaseMeasurementsBuilder() *cobra.Command { @@ -180,12 +207,10 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { Use: "getDatabaseMeasurements", Short: "Return Measurements of One Database for One MongoDB Process", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -207,7 +232,6 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { } type getDiskMeasurementsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string partitionName string @@ -219,15 +243,31 @@ type getDiskMeasurementsOpts struct { end string } -func (opts *getDiskMeasurementsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getDiskMeasurementsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getDiskMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + params := &admin.GetDiskMeasurementsApiParams{ GroupId: opts.groupId, PartitionName: opts.partitionName, @@ -235,15 +275,22 @@ func (opts *getDiskMeasurementsOpts) Run(ctx context.Context, w io.Writer) error Granularity: &opts.granularity, M: &opts.m, Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + Start: start, + End: end, } + resp, _, err := opts.client.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getDiskMeasurementsBuilder() *cobra.Command { @@ -252,12 +299,10 @@ func getDiskMeasurementsBuilder() *cobra.Command { Use: "getDiskMeasurements", Short: "Return Measurements of One Disk for One MongoDB Process", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -279,7 +324,6 @@ func getDiskMeasurementsBuilder() *cobra.Command { } type getHostLogsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string hostName string @@ -288,15 +332,13 @@ type getHostLogsOpts struct { startDate int64 } -func (opts *getHostLogsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getHostLogsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getHostLogsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getHostLogsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetHostLogsApiParams{ GroupId: opts.groupId, HostName: opts.hostName, @@ -304,12 +346,19 @@ func (opts *getHostLogsOpts) Run(ctx context.Context, w io.Writer) error { EndDate: &opts.endDate, StartDate: &opts.startDate, } + resp, _, err := opts.client.MonitoringAndLogsApi.GetHostLogsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getHostLogsBuilder() *cobra.Command { @@ -318,12 +367,10 @@ func getHostLogsBuilder() *cobra.Command { Use: "getHostLogs", Short: "Download Logs for One Cluster Host in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -341,7 +388,6 @@ func getHostLogsBuilder() *cobra.Command { } type getHostMeasurementsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string processId string @@ -352,30 +398,53 @@ type getHostMeasurementsOpts struct { end string } -func (opts *getHostMeasurementsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getHostMeasurementsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getHostMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getHostMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + params := &admin.GetHostMeasurementsApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, Granularity: &opts.granularity, M: &opts.m, Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + Start: start, + End: end, } + resp, _, err := opts.client.MonitoringAndLogsApi.GetHostMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getHostMeasurementsBuilder() *cobra.Command { @@ -384,12 +453,10 @@ func getHostMeasurementsBuilder() *cobra.Command { Use: "getHostMeasurements", Short: "Return Measurements for One MongoDB Process", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -409,7 +476,6 @@ func getHostMeasurementsBuilder() *cobra.Command { } type getIndexMetricsOpts struct { - cli.GlobalOpts client *admin.APIClient processId string indexName string @@ -423,15 +489,31 @@ type getIndexMetricsOpts struct { end string } -func (opts *getIndexMetricsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getIndexMetricsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getIndexMetricsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + params := &admin.GetIndexMetricsApiParams{ ProcessId: opts.processId, IndexName: opts.indexName, @@ -441,15 +523,22 @@ func (opts *getIndexMetricsOpts) Run(ctx context.Context, w io.Writer) error { Granularity: &opts.granularity, Metrics: &opts.metrics, Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + Start: start, + End: end, } + resp, _, err := opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getIndexMetricsBuilder() *cobra.Command { @@ -458,12 +547,10 @@ func getIndexMetricsBuilder() *cobra.Command { Use: "getIndexMetrics", Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -490,7 +577,6 @@ func getIndexMetricsBuilder() *cobra.Command { } type getMeasurementsOpts struct { - cli.GlobalOpts client *admin.APIClient processId string groupId string @@ -501,30 +587,53 @@ type getMeasurementsOpts struct { end string } -func (opts *getMeasurementsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getMeasurementsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + params := &admin.GetMeasurementsApiParams{ ProcessId: opts.processId, GroupId: opts.groupId, Granularity: &opts.granularity, Metrics: &opts.metrics, Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + Start: start, + End: end, } + resp, _, err := opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getMeasurementsBuilder() *cobra.Command { @@ -533,12 +642,10 @@ func getMeasurementsBuilder() *cobra.Command { Use: "getMeasurements", Short: "Return Atlas Search Hardware and Status Metrics", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -559,7 +666,6 @@ func getMeasurementsBuilder() *cobra.Command { } type listAtlasProcessesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -567,27 +673,32 @@ type listAtlasProcessesOpts struct { pageNum int } -func (opts *listAtlasProcessesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listAtlasProcessesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listAtlasProcessesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listAtlasProcessesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListAtlasProcessesApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.MonitoringAndLogsApi.ListAtlasProcessesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listAtlasProcessesBuilder() *cobra.Command { @@ -596,12 +707,10 @@ func listAtlasProcessesBuilder() *cobra.Command { Use: "listAtlasProcesses", Short: "Return All MongoDB Processes in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -616,7 +725,6 @@ func listAtlasProcessesBuilder() *cobra.Command { } type listDatabasesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string processId string @@ -625,15 +733,13 @@ type listDatabasesOpts struct { pageNum int } -func (opts *listDatabasesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listDatabasesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listDatabasesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listDatabasesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListDatabasesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -641,12 +747,19 @@ func (opts *listDatabasesOpts) Run(ctx context.Context, w io.Writer) error { ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.MonitoringAndLogsApi.ListDatabasesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listDatabasesBuilder() *cobra.Command { @@ -655,12 +768,10 @@ func listDatabasesBuilder() *cobra.Command { Use: "listDatabases", Short: "Return Available Databases for One MongoDB Process", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -677,33 +788,37 @@ func listDatabasesBuilder() *cobra.Command { } type listDiskMeasurementsOpts struct { - cli.GlobalOpts client *admin.APIClient partitionName string groupId string processId string } -func (opts *listDiskMeasurementsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listDiskMeasurementsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listDiskMeasurementsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListDiskMeasurementsApiParams{ PartitionName: opts.partitionName, GroupId: opts.groupId, ProcessId: opts.processId, } + resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listDiskMeasurementsBuilder() *cobra.Command { @@ -712,12 +827,10 @@ func listDiskMeasurementsBuilder() *cobra.Command { Use: "listDiskMeasurements", Short: "Return Measurements of One Disk", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) @@ -733,7 +846,6 @@ func listDiskMeasurementsBuilder() *cobra.Command { } type listDiskPartitionsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string processId string @@ -742,15 +854,13 @@ type listDiskPartitionsOpts struct { pageNum int } -func (opts *listDiskPartitionsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listDiskPartitionsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listDiskPartitionsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listDiskPartitionsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListDiskPartitionsApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -758,12 +868,19 @@ func (opts *listDiskPartitionsOpts) Run(ctx context.Context, w io.Writer) error ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskPartitionsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listDiskPartitionsBuilder() *cobra.Command { @@ -772,12 +889,10 @@ func listDiskPartitionsBuilder() *cobra.Command { Use: "listDiskPartitions", Short: "Return Available Disks for One MongoDB Process", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -794,7 +909,6 @@ func listDiskPartitionsBuilder() *cobra.Command { } type listIndexMetricsOpts struct { - cli.GlobalOpts client *admin.APIClient processId string databaseName string @@ -807,15 +921,31 @@ type listIndexMetricsOpts struct { end string } -func (opts *listIndexMetricsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listIndexMetricsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listIndexMetricsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + params := &admin.ListIndexMetricsApiParams{ ProcessId: opts.processId, DatabaseName: opts.databaseName, @@ -824,15 +954,22 @@ func (opts *listIndexMetricsOpts) Run(ctx context.Context, w io.Writer) error { Granularity: &opts.granularity, Metrics: &opts.metrics, Period: &opts.period, - Start: convertTime(&opts.start), - End: convertTime(&opts.end), + Start: start, + End: end, } + resp, _, err := opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listIndexMetricsBuilder() *cobra.Command { @@ -841,12 +978,10 @@ func listIndexMetricsBuilder() *cobra.Command { Use: "listIndexMetrics", Short: "Return All Atlas Search Index Metrics for One Namespace", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -871,31 +1006,35 @@ func listIndexMetricsBuilder() *cobra.Command { } type listMetricTypesOpts struct { - cli.GlobalOpts client *admin.APIClient processId string groupId string } -func (opts *listMetricTypesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listMetricTypesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listMetricTypesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listMetricTypesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListMetricTypesApiParams{ ProcessId: opts.processId, GroupId: opts.groupId, } + resp, _, err := opts.client.MonitoringAndLogsApi.ListMetricTypesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listMetricTypesBuilder() *cobra.Command { @@ -904,12 +1043,10 @@ func listMetricTypesBuilder() *cobra.Command { Use: "listMetricTypes", Short: "Return All Atlas Search Metric Types for One Process", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index 3ae68c19d2..cb0e99e151 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createPeeringConnectionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type createPeeringConnectionOpts struct { fs afero.Fs } -func (opts *createPeeringConnectionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createPeeringConnectionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createPeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringConnectionSettings, error) { @@ -69,22 +63,30 @@ func (opts *createPeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringCo return out, nil } -func (opts *createPeeringConnectionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createPeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, BaseNetworkPeeringConnectionSettings: data, } + resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createPeeringConnectionBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createPeeringConnectionBuilder() *cobra.Command { Use: "createPeeringConnection", Short: "Create One New Network Peering Connection", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,7 +114,6 @@ func createPeeringConnectionBuilder() *cobra.Command { } type createPeeringContainerOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -122,12 +121,9 @@ type createPeeringContainerOpts struct { fs afero.Fs } -func (opts *createPeeringContainerOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createPeeringContainerOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createPeeringContainerOpts) readData() (*admin.CloudProviderContainer, error) { @@ -152,22 +148,30 @@ func (opts *createPeeringContainerOpts) readData() (*admin.CloudProviderContaine return out, nil } -func (opts *createPeeringContainerOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createPeeringContainerOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreatePeeringContainerApiParams{ GroupId: opts.groupId, CloudProviderContainer: data, } + resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createPeeringContainerBuilder() *cobra.Command { @@ -178,12 +182,10 @@ func createPeeringContainerBuilder() *cobra.Command { Use: "createPeeringContainer", Short: "Create One New Network Peering Container", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -197,31 +199,35 @@ func createPeeringContainerBuilder() *cobra.Command { } type deletePeeringConnectionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string peerId string } -func (opts *deletePeeringConnectionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deletePeeringConnectionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deletePeeringConnectionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deletePeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeletePeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, } + resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deletePeeringConnectionBuilder() *cobra.Command { @@ -230,12 +236,10 @@ func deletePeeringConnectionBuilder() *cobra.Command { Use: "deletePeeringConnection", Short: "Remove One Existing Network Peering Connection", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -249,31 +253,35 @@ func deletePeeringConnectionBuilder() *cobra.Command { } type deletePeeringContainerOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string containerId string } -func (opts *deletePeeringContainerOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deletePeeringContainerOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deletePeeringContainerOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deletePeeringContainerOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeletePeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, } + resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deletePeeringContainerBuilder() *cobra.Command { @@ -282,12 +290,10 @@ func deletePeeringContainerBuilder() *cobra.Command { Use: "deletePeeringContainer", Short: "Remove One Network Peering Container", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -301,7 +307,6 @@ func deletePeeringContainerBuilder() *cobra.Command { } type disablePeeringOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -309,12 +314,9 @@ type disablePeeringOpts struct { fs afero.Fs } -func (opts *disablePeeringOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *disablePeeringOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *disablePeeringOpts) readData() (*admin.PrivateIPMode, error) { @@ -339,22 +341,30 @@ func (opts *disablePeeringOpts) readData() (*admin.PrivateIPMode, error) { return out, nil } -func (opts *disablePeeringOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *disablePeeringOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.DisablePeeringApiParams{ GroupId: opts.groupId, PrivateIPMode: data, } + resp, _, err := opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func disablePeeringBuilder() *cobra.Command { @@ -365,12 +375,10 @@ func disablePeeringBuilder() *cobra.Command { Use: "disablePeering", Short: "Disable Connect via Peering Only Mode for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -384,31 +392,35 @@ func disablePeeringBuilder() *cobra.Command { } type getPeeringConnectionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string peerId string } -func (opts *getPeeringConnectionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getPeeringConnectionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getPeeringConnectionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getPeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetPeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, } + resp, _, err := opts.client.NetworkPeeringApi.GetPeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getPeeringConnectionBuilder() *cobra.Command { @@ -417,12 +429,10 @@ func getPeeringConnectionBuilder() *cobra.Command { Use: "getPeeringConnection", Short: "Return One Network Peering Connection in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -436,31 +446,35 @@ func getPeeringConnectionBuilder() *cobra.Command { } type getPeeringContainerOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string containerId string } -func (opts *getPeeringContainerOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getPeeringContainerOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getPeeringContainerOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getPeeringContainerOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetPeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, } + resp, _, err := opts.client.NetworkPeeringApi.GetPeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getPeeringContainerBuilder() *cobra.Command { @@ -469,12 +483,10 @@ func getPeeringContainerBuilder() *cobra.Command { Use: "getPeeringContainer", Short: "Return One Network Peering Container", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -488,7 +500,6 @@ func getPeeringContainerBuilder() *cobra.Command { } type listPeeringConnectionsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -497,15 +508,13 @@ type listPeeringConnectionsOpts struct { providerName string } -func (opts *listPeeringConnectionsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPeeringConnectionsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPeeringConnectionsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPeeringConnectionsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListPeeringConnectionsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -513,12 +522,19 @@ func (opts *listPeeringConnectionsOpts) Run(ctx context.Context, w io.Writer) er PageNum: &opts.pageNum, ProviderName: &opts.providerName, } + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringConnectionsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPeeringConnectionsBuilder() *cobra.Command { @@ -527,12 +543,10 @@ func listPeeringConnectionsBuilder() *cobra.Command { Use: "listPeeringConnections", Short: "Return All Network Peering Connections in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -548,7 +562,6 @@ func listPeeringConnectionsBuilder() *cobra.Command { } type listPeeringContainerByCloudProviderOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string providerName string @@ -557,15 +570,13 @@ type listPeeringContainerByCloudProviderOpts struct { pageNum int } -func (opts *listPeeringContainerByCloudProviderOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPeeringContainerByCloudProviderOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPeeringContainerByCloudProviderOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, ProviderName: &opts.providerName, @@ -573,12 +584,19 @@ func (opts *listPeeringContainerByCloudProviderOpts) Run(ctx context.Context, w ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPeeringContainerByCloudProviderBuilder() *cobra.Command { @@ -587,12 +605,10 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { Use: "listPeeringContainerByCloudProvider", Short: "Return All Network Peering Containers in One Project for One Cloud Provider", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -609,7 +625,6 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { } type listPeeringContainersOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -617,27 +632,32 @@ type listPeeringContainersOpts struct { pageNum int } -func (opts *listPeeringContainersOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPeeringContainersOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPeeringContainersOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPeeringContainersOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListPeeringContainersApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainersWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPeeringContainersBuilder() *cobra.Command { @@ -646,12 +666,10 @@ func listPeeringContainersBuilder() *cobra.Command { Use: "listPeeringContainers", Short: "Return All Network Peering Containers in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -666,7 +684,6 @@ func listPeeringContainersBuilder() *cobra.Command { } type updatePeeringConnectionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string peerId string @@ -675,12 +692,9 @@ type updatePeeringConnectionOpts struct { fs afero.Fs } -func (opts *updatePeeringConnectionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updatePeeringConnectionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updatePeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringConnectionSettings, error) { @@ -705,23 +719,31 @@ func (opts *updatePeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringCo return out, nil } -func (opts *updatePeeringConnectionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updatePeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdatePeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, BaseNetworkPeeringConnectionSettings: data, } + resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updatePeeringConnectionBuilder() *cobra.Command { @@ -732,12 +754,10 @@ func updatePeeringConnectionBuilder() *cobra.Command { Use: "updatePeeringConnection", Short: "Update One New Network Peering Connection", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -753,7 +773,6 @@ func updatePeeringConnectionBuilder() *cobra.Command { } type updatePeeringContainerOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string containerId string @@ -762,12 +781,9 @@ type updatePeeringContainerOpts struct { fs afero.Fs } -func (opts *updatePeeringContainerOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updatePeeringContainerOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updatePeeringContainerOpts) readData() (*admin.CloudProviderContainer, error) { @@ -792,23 +808,31 @@ func (opts *updatePeeringContainerOpts) readData() (*admin.CloudProviderContaine return out, nil } -func (opts *updatePeeringContainerOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updatePeeringContainerOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdatePeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, CloudProviderContainer: data, } + resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updatePeeringContainerBuilder() *cobra.Command { @@ -819,12 +843,10 @@ func updatePeeringContainerBuilder() *cobra.Command { Use: "updatePeeringContainer", Short: "Update One Network Peering Container", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -840,29 +862,33 @@ func updatePeeringContainerBuilder() *cobra.Command { } type verifyConnectViaPeeringOnlyModeForOneProjectOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.NetworkPeeringApi.VerifyConnectViaPeeringOnlyModeForOneProjectWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { @@ -871,12 +897,10 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { Use: "verifyConnectViaPeeringOnlyModeForOneProject", Short: "Verify Connect via Peering Only Mode for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index d19ccf600b..daf8a2e827 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createOnlineArchiveOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -40,12 +37,9 @@ type createOnlineArchiveOpts struct { fs afero.Fs } -func (opts *createOnlineArchiveOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createOnlineArchiveOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createOnlineArchiveOpts) readData() (*admin.BackupOnlineArchiveCreate, error) { @@ -70,23 +64,31 @@ func (opts *createOnlineArchiveOpts) readData() (*admin.BackupOnlineArchiveCreat return out, nil } -func (opts *createOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateOnlineArchiveApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, BackupOnlineArchiveCreate: data, } + resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createOnlineArchiveBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createOnlineArchiveBuilder() *cobra.Command { Use: "createOnlineArchive", Short: "Create One Online Archive", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,33 +118,37 @@ func createOnlineArchiveBuilder() *cobra.Command { } type deleteOnlineArchiveOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string archiveId string clusterName string } -func (opts *deleteOnlineArchiveOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteOnlineArchiveOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteOnlineArchiveApiParams{ GroupId: opts.groupId, ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteOnlineArchiveBuilder() *cobra.Command { @@ -153,12 +157,10 @@ func deleteOnlineArchiveBuilder() *cobra.Command { Use: "deleteOnlineArchive", Short: "Remove One Online Archive", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -174,7 +176,6 @@ func deleteOnlineArchiveBuilder() *cobra.Command { } type downloadOnlineArchiveQueryLogsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -183,15 +184,13 @@ type downloadOnlineArchiveQueryLogsOpts struct { archiveOnly bool } -func (opts *downloadOnlineArchiveQueryLogsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *downloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -199,12 +198,19 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) Run(ctx context.Context, w io.Wr EndDate: &opts.endDate, ArchiveOnly: &opts.archiveOnly, } + resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { @@ -213,12 +219,10 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { Use: "downloadOnlineArchiveQueryLogs", Short: "Download Online Archive Query Logs", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -235,33 +239,37 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { } type getOnlineArchiveOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string archiveId string clusterName string } -func (opts *getOnlineArchiveOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getOnlineArchiveOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetOnlineArchiveApiParams{ GroupId: opts.groupId, ArchiveId: opts.archiveId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getOnlineArchiveBuilder() *cobra.Command { @@ -270,12 +278,10 @@ func getOnlineArchiveBuilder() *cobra.Command { Use: "getOnlineArchive", Short: "Return One Online Archive", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -291,7 +297,6 @@ func getOnlineArchiveBuilder() *cobra.Command { } type listOnlineArchivesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -300,15 +305,13 @@ type listOnlineArchivesOpts struct { pageNum int } -func (opts *listOnlineArchivesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listOnlineArchivesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listOnlineArchivesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listOnlineArchivesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListOnlineArchivesApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, @@ -316,12 +319,19 @@ func (opts *listOnlineArchivesOpts) Run(ctx context.Context, w io.Writer) error ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listOnlineArchivesBuilder() *cobra.Command { @@ -330,12 +340,10 @@ func listOnlineArchivesBuilder() *cobra.Command { Use: "listOnlineArchives", Short: "Return All Online Archives for One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -352,7 +360,6 @@ func listOnlineArchivesBuilder() *cobra.Command { } type updateOnlineArchiveOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string archiveId string @@ -362,12 +369,9 @@ type updateOnlineArchiveOpts struct { fs afero.Fs } -func (opts *updateOnlineArchiveOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateOnlineArchiveOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateOnlineArchiveOpts) readData() (*admin.BackupOnlineArchive, error) { @@ -392,11 +396,12 @@ func (opts *updateOnlineArchiveOpts) readData() (*admin.BackupOnlineArchive, err return out, nil } -func (opts *updateOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateOnlineArchiveApiParams{ GroupId: opts.groupId, ArchiveId: opts.archiveId, @@ -404,12 +409,19 @@ func (opts *updateOnlineArchiveOpts) Run(ctx context.Context, w io.Writer) error BackupOnlineArchive: data, } + resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateOnlineArchiveBuilder() *cobra.Command { @@ -420,12 +432,10 @@ func updateOnlineArchiveBuilder() *cobra.Command { Use: "updateOnlineArchive", Short: "Update One Online Archive", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 52795122d4..c1a2ab66c6 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -23,27 +23,21 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createOrganizationOpts struct { - cli.GlobalOpts client *admin.APIClient filename string fs afero.Fs } -func (opts *createOrganizationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createOrganizationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createOrganizationOpts) readData() (*admin.CreateOrganizationRequest, error) { @@ -68,21 +62,29 @@ func (opts *createOrganizationOpts) readData() (*admin.CreateOrganizationRequest return out, nil } -func (opts *createOrganizationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createOrganizationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateOrganizationApiParams{ CreateOrganizationRequest: data, } + resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createOrganizationBuilder() *cobra.Command { @@ -93,12 +95,10 @@ func createOrganizationBuilder() *cobra.Command { Use: "createOrganization", Short: "Create One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } @@ -108,7 +108,6 @@ func createOrganizationBuilder() *cobra.Command { } type createOrganizationInvitationOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string @@ -116,12 +115,9 @@ type createOrganizationInvitationOpts struct { fs afero.Fs } -func (opts *createOrganizationInvitationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createOrganizationInvitationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createOrganizationInvitationOpts) readData() (*admin.OrganizationInvitationRequest, error) { @@ -146,22 +142,30 @@ func (opts *createOrganizationInvitationOpts) readData() (*admin.OrganizationInv return out, nil } -func (opts *createOrganizationInvitationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, OrganizationInvitationRequest: data, } + resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createOrganizationInvitationBuilder() *cobra.Command { @@ -172,12 +176,10 @@ func createOrganizationInvitationBuilder() *cobra.Command { Use: "createOrganizationInvitation", Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -189,29 +191,33 @@ func createOrganizationInvitationBuilder() *cobra.Command { } type deleteOrganizationOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string } -func (opts *deleteOrganizationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteOrganizationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteOrganizationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteOrganizationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, } + resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteOrganizationBuilder() *cobra.Command { @@ -220,12 +226,10 @@ func deleteOrganizationBuilder() *cobra.Command { Use: "deleteOrganization", Short: "Remove One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -235,31 +239,35 @@ func deleteOrganizationBuilder() *cobra.Command { } type deleteOrganizationInvitationOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string invitationId string } -func (opts *deleteOrganizationInvitationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteOrganizationInvitationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteOrganizationInvitationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteOrganizationInvitationApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, } + resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteOrganizationInvitationBuilder() *cobra.Command { @@ -268,12 +276,10 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { Use: "deleteOrganizationInvitation", Short: "Cancel One Organization Invitation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -285,29 +291,33 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { } type getOrganizationOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string } -func (opts *getOrganizationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getOrganizationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getOrganizationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getOrganizationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, } + resp, _, err := opts.client.OrganizationsApi.GetOrganizationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getOrganizationBuilder() *cobra.Command { @@ -316,12 +326,10 @@ func getOrganizationBuilder() *cobra.Command { Use: "getOrganization", Short: "Return One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -331,31 +339,35 @@ func getOrganizationBuilder() *cobra.Command { } type getOrganizationInvitationOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string invitationId string } -func (opts *getOrganizationInvitationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getOrganizationInvitationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getOrganizationInvitationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetOrganizationInvitationApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, } + resp, _, err := opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getOrganizationInvitationBuilder() *cobra.Command { @@ -364,12 +376,10 @@ func getOrganizationInvitationBuilder() *cobra.Command { Use: "getOrganizationInvitation", Short: "Return One Organization Invitation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -381,29 +391,33 @@ func getOrganizationInvitationBuilder() *cobra.Command { } type getOrganizationSettingsOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string } -func (opts *getOrganizationSettingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getOrganizationSettingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getOrganizationSettingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getOrganizationSettingsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, } + resp, _, err := opts.client.OrganizationsApi.GetOrganizationSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getOrganizationSettingsBuilder() *cobra.Command { @@ -412,12 +426,10 @@ func getOrganizationSettingsBuilder() *cobra.Command { Use: "getOrganizationSettings", Short: "Return Settings for One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -427,31 +439,35 @@ func getOrganizationSettingsBuilder() *cobra.Command { } type listOrganizationInvitationsOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string username string } -func (opts *listOrganizationInvitationsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listOrganizationInvitationsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listOrganizationInvitationsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListOrganizationInvitationsApiParams{ OrgId: opts.orgId, Username: &opts.username, } + resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listOrganizationInvitationsBuilder() *cobra.Command { @@ -460,12 +476,10 @@ func listOrganizationInvitationsBuilder() *cobra.Command { Use: "listOrganizationInvitations", Short: "Return All Organization Invitations", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -476,7 +490,6 @@ func listOrganizationInvitationsBuilder() *cobra.Command { } type listOrganizationProjectsOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string includeCount bool @@ -485,15 +498,13 @@ type listOrganizationProjectsOpts struct { name string } -func (opts *listOrganizationProjectsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listOrganizationProjectsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listOrganizationProjectsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationProjectsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListOrganizationProjectsApiParams{ OrgId: opts.orgId, IncludeCount: &opts.includeCount, @@ -501,12 +512,19 @@ func (opts *listOrganizationProjectsOpts) Run(ctx context.Context, w io.Writer) PageNum: &opts.pageNum, Name: &opts.name, } + resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listOrganizationProjectsBuilder() *cobra.Command { @@ -515,12 +533,10 @@ func listOrganizationProjectsBuilder() *cobra.Command { Use: "listOrganizationProjects", Short: "Return One or More Projects in One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -534,7 +550,6 @@ func listOrganizationProjectsBuilder() *cobra.Command { } type listOrganizationUsersOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string includeCount bool @@ -542,27 +557,32 @@ type listOrganizationUsersOpts struct { pageNum int } -func (opts *listOrganizationUsersOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listOrganizationUsersOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listOrganizationUsersOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationUsersOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListOrganizationUsersApiParams{ OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listOrganizationUsersBuilder() *cobra.Command { @@ -571,12 +591,10 @@ func listOrganizationUsersBuilder() *cobra.Command { Use: "listOrganizationUsers", Short: "Return All MongoDB Cloud Users in One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -589,7 +607,6 @@ func listOrganizationUsersBuilder() *cobra.Command { } type listOrganizationsOpts struct { - cli.GlobalOpts client *admin.APIClient includeCount bool itemsPerPage int @@ -597,27 +614,32 @@ type listOrganizationsOpts struct { name string } -func (opts *listOrganizationsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listOrganizationsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listOrganizationsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListOrganizationsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, Name: &opts.name, } + resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listOrganizationsBuilder() *cobra.Command { @@ -626,12 +648,10 @@ func listOrganizationsBuilder() *cobra.Command { Use: "listOrganizations", Short: "Return All Organizations", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -643,31 +663,35 @@ func listOrganizationsBuilder() *cobra.Command { } type removeOrganizationUserOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string userId string } -func (opts *removeOrganizationUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *removeOrganizationUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *removeOrganizationUserOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *removeOrganizationUserOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.RemoveOrganizationUserApiParams{ OrgId: opts.orgId, UserId: opts.userId, } + resp, _, err := opts.client.OrganizationsApi.RemoveOrganizationUserWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func removeOrganizationUserBuilder() *cobra.Command { @@ -676,12 +700,10 @@ func removeOrganizationUserBuilder() *cobra.Command { Use: "removeOrganizationUser", Short: "Remove One MongoDB Cloud User from One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -693,7 +715,6 @@ func removeOrganizationUserBuilder() *cobra.Command { } type renameOrganizationOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string @@ -701,12 +722,9 @@ type renameOrganizationOpts struct { fs afero.Fs } -func (opts *renameOrganizationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *renameOrganizationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *renameOrganizationOpts) readData() (*admin.AtlasOrganization, error) { @@ -731,22 +749,30 @@ func (opts *renameOrganizationOpts) readData() (*admin.AtlasOrganization, error) return out, nil } -func (opts *renameOrganizationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *renameOrganizationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, AtlasOrganization: data, } + resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func renameOrganizationBuilder() *cobra.Command { @@ -757,12 +783,10 @@ func renameOrganizationBuilder() *cobra.Command { Use: "renameOrganization", Short: "Rename One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -774,7 +798,6 @@ func renameOrganizationBuilder() *cobra.Command { } type updateOrganizationInvitationOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string @@ -782,12 +805,9 @@ type updateOrganizationInvitationOpts struct { fs afero.Fs } -func (opts *updateOrganizationInvitationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateOrganizationInvitationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateOrganizationInvitationOpts) readData() (*admin.OrganizationInvitationRequest, error) { @@ -812,22 +832,30 @@ func (opts *updateOrganizationInvitationOpts) readData() (*admin.OrganizationInv return out, nil } -func (opts *updateOrganizationInvitationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, OrganizationInvitationRequest: data, } + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateOrganizationInvitationBuilder() *cobra.Command { @@ -838,12 +866,10 @@ func updateOrganizationInvitationBuilder() *cobra.Command { Use: "updateOrganizationInvitation", Short: "Update One Organization Invitation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -855,7 +881,6 @@ func updateOrganizationInvitationBuilder() *cobra.Command { } type updateOrganizationInvitationByIdOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string invitationId string @@ -864,12 +889,9 @@ type updateOrganizationInvitationByIdOpts struct { fs afero.Fs } -func (opts *updateOrganizationInvitationByIdOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateOrganizationInvitationByIdOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateOrganizationInvitationByIdOpts) readData() (*admin.OrganizationInvitationUpdateRequest, error) { @@ -894,23 +916,31 @@ func (opts *updateOrganizationInvitationByIdOpts) readData() (*admin.Organizatio return out, nil } -func (opts *updateOrganizationInvitationByIdOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateOrganizationInvitationByIdApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, OrganizationInvitationUpdateRequest: data, } + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateOrganizationInvitationByIdBuilder() *cobra.Command { @@ -921,12 +951,10 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { Use: "updateOrganizationInvitationById", Short: "Update One Organization Invitation by Invitation ID", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -940,7 +968,6 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { } type updateOrganizationRolesOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string userId string @@ -949,12 +976,9 @@ type updateOrganizationRolesOpts struct { fs afero.Fs } -func (opts *updateOrganizationRolesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateOrganizationRolesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateOrganizationRolesOpts) readData() (*admin.UpdateOrgRolesForUser, error) { @@ -979,23 +1003,31 @@ func (opts *updateOrganizationRolesOpts) readData() (*admin.UpdateOrgRolesForUse return out, nil } -func (opts *updateOrganizationRolesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateOrganizationRolesOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateOrganizationRolesApiParams{ OrgId: opts.orgId, UserId: opts.userId, UpdateOrgRolesForUser: data, } + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationRolesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateOrganizationRolesBuilder() *cobra.Command { @@ -1006,12 +1038,10 @@ func updateOrganizationRolesBuilder() *cobra.Command { Use: "updateOrganizationRoles", Short: "Update Organization Roles for One MongoDB Cloud User", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -1025,7 +1055,6 @@ func updateOrganizationRolesBuilder() *cobra.Command { } type updateOrganizationSettingsOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string @@ -1033,12 +1062,9 @@ type updateOrganizationSettingsOpts struct { fs afero.Fs } -func (opts *updateOrganizationSettingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateOrganizationSettingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateOrganizationSettingsOpts) readData() (*admin.OrganizationSettings, error) { @@ -1063,22 +1089,30 @@ func (opts *updateOrganizationSettingsOpts) readData() (*admin.OrganizationSetti return out, nil } -func (opts *updateOrganizationSettingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, OrganizationSettings: data, } + resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateOrganizationSettingsBuilder() *cobra.Command { @@ -1089,12 +1123,10 @@ func updateOrganizationSettingsBuilder() *cobra.Command { Use: "updateOrganizationSettings", Short: "Update Settings for One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index ad9f605b7e..ed8aa793b1 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -18,38 +18,32 @@ package api import ( "context" + "encoding/json" + "fmt" "io" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type disableSlowOperationThresholdingOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *disableSlowOperationThresholdingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *disableSlowOperationThresholdingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *disableSlowOperationThresholdingOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *disableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } - _, err := opts.client.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(ctx, params).Execute() + return err } func disableSlowOperationThresholdingBuilder() *cobra.Command { @@ -58,12 +52,10 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { Use: "disableSlowOperationThresholding", Short: "Disable Managed Slow Operation Threshold", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -75,29 +67,23 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { } type enableSlowOperationThresholdingOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *enableSlowOperationThresholdingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *enableSlowOperationThresholdingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *enableSlowOperationThresholdingOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *enableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } - _, err := opts.client.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(ctx, params).Execute() + return err } func enableSlowOperationThresholdingBuilder() *cobra.Command { @@ -106,12 +92,10 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { Use: "enableSlowOperationThresholding", Short: "Enable Managed Slow Operation Threshold", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -123,7 +107,6 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { } type listSlowQueriesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string processId string @@ -133,15 +116,13 @@ type listSlowQueriesOpts struct { since int64 } -func (opts *listSlowQueriesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listSlowQueriesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listSlowQueriesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listSlowQueriesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListSlowQueriesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -150,12 +131,19 @@ func (opts *listSlowQueriesOpts) Run(ctx context.Context, w io.Writer) error { NLogs: &opts.nLogs, Since: &opts.since, } + resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueriesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listSlowQueriesBuilder() *cobra.Command { @@ -164,12 +152,10 @@ func listSlowQueriesBuilder() *cobra.Command { Use: "listSlowQueries", Short: "Return Slow Queries", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -193,7 +179,6 @@ func listSlowQueriesBuilder() *cobra.Command { } type listSlowQueryNamespacesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string processId string @@ -201,27 +186,32 @@ type listSlowQueryNamespacesOpts struct { since int64 } -func (opts *listSlowQueryNamespacesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listSlowQueryNamespacesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listSlowQueryNamespacesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListSlowQueryNamespacesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, Duration: &opts.duration, Since: &opts.since, } + resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listSlowQueryNamespacesBuilder() *cobra.Command { @@ -230,12 +220,10 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { Use: "listSlowQueryNamespaces", Short: "Return All Namespaces for One Host", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -257,7 +245,6 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { } type listSuggestedIndexesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string processId string @@ -271,15 +258,13 @@ type listSuggestedIndexesOpts struct { since int64 } -func (opts *listSuggestedIndexesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listSuggestedIndexesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listSuggestedIndexesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listSuggestedIndexesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListSuggestedIndexesApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, @@ -292,12 +277,19 @@ func (opts *listSuggestedIndexesOpts) Run(ctx context.Context, w io.Writer) erro NIndexes: &opts.nIndexes, Since: &opts.since, } + resp, _, err := opts.client.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listSuggestedIndexesBuilder() *cobra.Command { @@ -306,12 +298,10 @@ func listSuggestedIndexesBuilder() *cobra.Command { Use: "listSuggestedIndexes", Short: "Return Suggested Indexes", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 5ba75d8458..0d7d8690ee 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string cloudProvider string @@ -41,12 +38,9 @@ type createPrivateEndpointOpts struct { fs afero.Fs } -func (opts *createPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createPrivateEndpointOpts) readData() (*admin.CreateEndpointRequest, error) { @@ -71,11 +65,12 @@ func (opts *createPrivateEndpointOpts) readData() (*admin.CreateEndpointRequest, return out, nil } -func (opts *createPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreatePrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, @@ -83,12 +78,19 @@ func (opts *createPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) err CreateEndpointRequest: data, } + resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createPrivateEndpointBuilder() *cobra.Command { @@ -99,12 +101,10 @@ func createPrivateEndpointBuilder() *cobra.Command { Use: "createPrivateEndpoint", Short: "Create One Private Endpoint for One Provider", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -122,7 +122,6 @@ func createPrivateEndpointBuilder() *cobra.Command { } type createPrivateEndpointServiceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -130,12 +129,9 @@ type createPrivateEndpointServiceOpts struct { fs afero.Fs } -func (opts *createPrivateEndpointServiceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createPrivateEndpointServiceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createPrivateEndpointServiceOpts) readData() (*admin.CloudProviderEndpointServiceRequest, error) { @@ -160,22 +156,30 @@ func (opts *createPrivateEndpointServiceOpts) readData() (*admin.CloudProviderEn return out, nil } -func (opts *createPrivateEndpointServiceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, CloudProviderEndpointServiceRequest: data, } + resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createPrivateEndpointServiceBuilder() *cobra.Command { @@ -186,12 +190,10 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { Use: "createPrivateEndpointService", Short: "Create One Private Endpoint Service for One Provider", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -205,7 +207,6 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { } type deletePrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string cloudProvider string @@ -213,27 +214,32 @@ type deletePrivateEndpointOpts struct { endpointServiceId string } -func (opts *deletePrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deletePrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deletePrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deletePrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeletePrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointId: opts.endpointId, EndpointServiceId: opts.endpointServiceId, } + resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deletePrivateEndpointBuilder() *cobra.Command { @@ -242,12 +248,10 @@ func deletePrivateEndpointBuilder() *cobra.Command { Use: "deletePrivateEndpoint", Short: "Remove One Private Endpoint for One Provider", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -265,33 +269,37 @@ func deletePrivateEndpointBuilder() *cobra.Command { } type deletePrivateEndpointServiceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string cloudProvider string endpointServiceId string } -func (opts *deletePrivateEndpointServiceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deletePrivateEndpointServiceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deletePrivateEndpointServiceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeletePrivateEndpointServiceApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } + resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deletePrivateEndpointServiceBuilder() *cobra.Command { @@ -300,12 +308,10 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { Use: "deletePrivateEndpointService", Short: "Remove One Private Endpoint Service for One Provider", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -321,7 +327,6 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { } type getPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string cloudProvider string @@ -329,27 +334,32 @@ type getPrivateEndpointOpts struct { endpointServiceId string } -func (opts *getPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetPrivateEndpointApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointId: opts.endpointId, EndpointServiceId: opts.endpointServiceId, } + resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getPrivateEndpointBuilder() *cobra.Command { @@ -358,12 +368,10 @@ func getPrivateEndpointBuilder() *cobra.Command { Use: "getPrivateEndpoint", Short: "Return One Private Endpoint for One Provider", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -381,33 +389,37 @@ func getPrivateEndpointBuilder() *cobra.Command { } type getPrivateEndpointServiceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string cloudProvider string endpointServiceId string } -func (opts *getPrivateEndpointServiceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getPrivateEndpointServiceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getPrivateEndpointServiceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetPrivateEndpointServiceApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, EndpointServiceId: opts.endpointServiceId, } + resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getPrivateEndpointServiceBuilder() *cobra.Command { @@ -416,12 +428,10 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { Use: "getPrivateEndpointService", Short: "Return One Private Endpoint Service for One Provider", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -437,29 +447,33 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { } type getRegionalizedPrivateEndpointSettingOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getRegionalizedPrivateEndpointSettingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { @@ -468,12 +482,10 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { Use: "getRegionalizedPrivateEndpointSetting", Short: "Return Regionalized Private Endpoint Status", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -485,31 +497,35 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { } type listPrivateEndpointServicesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string cloudProvider string } -func (opts *listPrivateEndpointServicesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listPrivateEndpointServicesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listPrivateEndpointServicesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListPrivateEndpointServicesApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, } + resp, _, err := opts.client.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listPrivateEndpointServicesBuilder() *cobra.Command { @@ -518,12 +534,10 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { Use: "listPrivateEndpointServices", Short: "Return All Private Endpoint Services for One Provider", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -537,7 +551,6 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { } type toggleRegionalizedPrivateEndpointSettingOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -545,12 +558,9 @@ type toggleRegionalizedPrivateEndpointSettingOpts struct { fs afero.Fs } -func (opts *toggleRegionalizedPrivateEndpointSettingOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData() (*admin.ProjectSettingItem, error) { @@ -575,22 +585,30 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData() (*admin.Pro return out, nil } -func (opts *toggleRegionalizedPrivateEndpointSettingOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.ToggleRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, ProjectSettingItem: data, } + resp, _, err := opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { @@ -601,12 +619,10 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { Use: "toggleRegionalizedPrivateEndpointSetting", Short: "Toggle Regionalized Private Endpoint Status", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index c82cc5f03f..c78b331358 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type addProjectApiKeyOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string apiUserId string @@ -40,12 +37,9 @@ type addProjectApiKeyOpts struct { fs afero.Fs } -func (opts *addProjectApiKeyOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *addProjectApiKeyOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *addProjectApiKeyOpts) readData() (*[]admin.UserAccessRoleAssignment, error) { @@ -70,23 +64,31 @@ func (opts *addProjectApiKeyOpts) readData() (*[]admin.UserAccessRoleAssignment, return out, nil } -func (opts *addProjectApiKeyOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *addProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.AddProjectApiKeyApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, UserAccessRoleAssignment: data, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func addProjectApiKeyBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func addProjectApiKeyBuilder() *cobra.Command { Use: "addProjectApiKey", Short: "Assign One Organization API Key to One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,7 +118,6 @@ func addProjectApiKeyBuilder() *cobra.Command { } type createApiKeyOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string @@ -126,12 +125,9 @@ type createApiKeyOpts struct { fs afero.Fs } -func (opts *createApiKeyOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createApiKeyOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createApiKeyOpts) readData() (*admin.CreateAtlasOrganizationApiKey, error) { @@ -156,22 +152,30 @@ func (opts *createApiKeyOpts) readData() (*admin.CreateAtlasOrganizationApiKey, return out, nil } -func (opts *createApiKeyOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createApiKeyOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, CreateAtlasOrganizationApiKey: data, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createApiKeyBuilder() *cobra.Command { @@ -182,12 +186,10 @@ func createApiKeyBuilder() *cobra.Command { Use: "createApiKey", Short: "Create One Organization API Key", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -199,7 +201,6 @@ func createApiKeyBuilder() *cobra.Command { } type createApiKeyAccessListOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string apiUserId string @@ -211,12 +212,9 @@ type createApiKeyAccessListOpts struct { fs afero.Fs } -func (opts *createApiKeyAccessListOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createApiKeyAccessListOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createApiKeyAccessListOpts) readData() (*[]admin.UserAccessList, error) { @@ -241,11 +239,12 @@ func (opts *createApiKeyAccessListOpts) readData() (*[]admin.UserAccessList, err return out, nil } -func (opts *createApiKeyAccessListOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateApiKeyAccessListApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, @@ -256,12 +255,19 @@ func (opts *createApiKeyAccessListOpts) Run(ctx context.Context, w io.Writer) er UserAccessList: data, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createApiKeyAccessListBuilder() *cobra.Command { @@ -272,12 +278,10 @@ func createApiKeyAccessListBuilder() *cobra.Command { Use: "createApiKeyAccessList", Short: "Create Access List Entries for One Organization API Key", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -294,7 +298,6 @@ func createApiKeyAccessListBuilder() *cobra.Command { } type createProjectApiKeyOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -302,12 +305,9 @@ type createProjectApiKeyOpts struct { fs afero.Fs } -func (opts *createProjectApiKeyOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createProjectApiKeyOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createProjectApiKeyOpts) readData() (*admin.CreateAtlasProjectApiKey, error) { @@ -332,22 +332,30 @@ func (opts *createProjectApiKeyOpts) readData() (*admin.CreateAtlasProjectApiKey return out, nil } -func (opts *createProjectApiKeyOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, CreateAtlasProjectApiKey: data, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createProjectApiKeyBuilder() *cobra.Command { @@ -358,12 +366,10 @@ func createProjectApiKeyBuilder() *cobra.Command { Use: "createProjectApiKey", Short: "Create and Assign One Organization API Key to One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -377,31 +383,35 @@ func createProjectApiKeyBuilder() *cobra.Command { } type deleteApiKeyOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string apiUserId string } -func (opts *deleteApiKeyOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteApiKeyOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteApiKeyOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteApiKeyOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteApiKeyBuilder() *cobra.Command { @@ -410,12 +420,10 @@ func deleteApiKeyBuilder() *cobra.Command { Use: "deleteApiKey", Short: "Remove One Organization API Key", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -427,33 +435,37 @@ func deleteApiKeyBuilder() *cobra.Command { } type deleteApiKeyAccessListEntryOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string apiUserId string ipAddress string } -func (opts *deleteApiKeyAccessListEntryOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteApiKeyAccessListEntryOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteApiKeyAccessListEntryOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteApiKeyAccessListEntryApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, IpAddress: opts.ipAddress, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyAccessListEntryWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteApiKeyAccessListEntryBuilder() *cobra.Command { @@ -462,12 +474,10 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { Use: "deleteApiKeyAccessListEntry", Short: "Remove One Access List Entry for One Organization API Key", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -481,31 +491,35 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { } type getApiKeyOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string apiUserId string } -func (opts *getApiKeyOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getApiKeyOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getApiKeyOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getApiKeyOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getApiKeyBuilder() *cobra.Command { @@ -514,12 +528,10 @@ func getApiKeyBuilder() *cobra.Command { Use: "getApiKey", Short: "Return One Organization API Key", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -531,33 +543,37 @@ func getApiKeyBuilder() *cobra.Command { } type getApiKeyAccessListOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string ipAddress string apiUserId string } -func (opts *getApiKeyAccessListOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getApiKeyAccessListOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getApiKeyAccessListOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetApiKeyAccessListApiParams{ OrgId: opts.orgId, IpAddress: opts.ipAddress, ApiUserId: opts.apiUserId, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyAccessListWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getApiKeyAccessListBuilder() *cobra.Command { @@ -566,12 +582,10 @@ func getApiKeyAccessListBuilder() *cobra.Command { Use: "getApiKeyAccessList", Short: "Return One Access List Entry for One Organization API Key", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -585,7 +599,6 @@ func getApiKeyAccessListBuilder() *cobra.Command { } type listApiKeyAccessListsEntriesOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string apiUserId string @@ -594,15 +607,13 @@ type listApiKeyAccessListsEntriesOpts struct { pageNum int } -func (opts *listApiKeyAccessListsEntriesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listApiKeyAccessListsEntriesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListApiKeyAccessListsEntriesApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, @@ -610,12 +621,19 @@ func (opts *listApiKeyAccessListsEntriesOpts) Run(ctx context.Context, w io.Writ ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listApiKeyAccessListsEntriesBuilder() *cobra.Command { @@ -624,12 +642,10 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { Use: "listApiKeyAccessListsEntries", Short: "Return All Access List Entries for One Organization API Key", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -644,7 +660,6 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { } type listApiKeysOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string includeCount bool @@ -652,27 +667,32 @@ type listApiKeysOpts struct { pageNum int } -func (opts *listApiKeysOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listApiKeysOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listApiKeysOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listApiKeysOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListApiKeysApiParams{ OrgId: opts.orgId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeysWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listApiKeysBuilder() *cobra.Command { @@ -681,12 +701,10 @@ func listApiKeysBuilder() *cobra.Command { Use: "listApiKeys", Short: "Return All Organization API Keys", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -699,7 +717,6 @@ func listApiKeysBuilder() *cobra.Command { } type listProjectApiKeysOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -707,27 +724,32 @@ type listProjectApiKeysOpts struct { pageNum int } -func (opts *listProjectApiKeysOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listProjectApiKeysOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listProjectApiKeysOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listProjectApiKeysOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListProjectApiKeysApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listProjectApiKeysBuilder() *cobra.Command { @@ -736,12 +758,10 @@ func listProjectApiKeysBuilder() *cobra.Command { Use: "listProjectApiKeys", Short: "Return All Organization API Keys Assigned to One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -756,31 +776,35 @@ func listProjectApiKeysBuilder() *cobra.Command { } type removeProjectApiKeyOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string apiUserId string } -func (opts *removeProjectApiKeyOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *removeProjectApiKeyOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *removeProjectApiKeyOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *removeProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.RemoveProjectApiKeyApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func removeProjectApiKeyBuilder() *cobra.Command { @@ -789,12 +813,10 @@ func removeProjectApiKeyBuilder() *cobra.Command { Use: "removeProjectApiKey", Short: "Unassign One Organization API Key from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -808,7 +830,6 @@ func removeProjectApiKeyBuilder() *cobra.Command { } type updateApiKeyOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string apiUserId string @@ -817,12 +838,9 @@ type updateApiKeyOpts struct { fs afero.Fs } -func (opts *updateApiKeyOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateApiKeyOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateApiKeyOpts) readData() (*admin.UpdateAtlasOrganizationApiKey, error) { @@ -847,23 +865,31 @@ func (opts *updateApiKeyOpts) readData() (*admin.UpdateAtlasOrganizationApiKey, return out, nil } -func (opts *updateApiKeyOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateApiKeyOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, UpdateAtlasOrganizationApiKey: data, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateApiKeyBuilder() *cobra.Command { @@ -874,12 +900,10 @@ func updateApiKeyBuilder() *cobra.Command { Use: "updateApiKey", Short: "Update One Organization API Key", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -893,7 +917,6 @@ func updateApiKeyBuilder() *cobra.Command { } type updateApiKeyRolesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string apiUserId string @@ -905,12 +928,9 @@ type updateApiKeyRolesOpts struct { fs afero.Fs } -func (opts *updateApiKeyRolesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateApiKeyRolesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateApiKeyRolesOpts) readData() (*admin.UpdateAtlasProjectApiKey, error) { @@ -935,11 +955,12 @@ func (opts *updateApiKeyRolesOpts) readData() (*admin.UpdateAtlasProjectApiKey, return out, nil } -func (opts *updateApiKeyRolesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateApiKeyRolesOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateApiKeyRolesApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, @@ -950,12 +971,19 @@ func (opts *updateApiKeyRolesOpts) Run(ctx context.Context, w io.Writer) error { UpdateAtlasProjectApiKey: data, } + resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateApiKeyRolesBuilder() *cobra.Command { @@ -966,12 +994,10 @@ func updateApiKeyRolesBuilder() *cobra.Command { Use: "updateApiKeyRoles", Short: "Update Roles of One Organization API Key to One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 6edb4ba59e..280ef7a77d 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createProjectIpAccessListOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -42,12 +39,9 @@ type createProjectIpAccessListOpts struct { fs afero.Fs } -func (opts *createProjectIpAccessListOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createProjectIpAccessListOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createProjectIpAccessListOpts) readData() (*[]admin.NetworkPermissionEntry, error) { @@ -72,11 +66,12 @@ func (opts *createProjectIpAccessListOpts) readData() (*[]admin.NetworkPermissio return out, nil } -func (opts *createProjectIpAccessListOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateProjectIpAccessListApiParams{ GroupId: opts.groupId, @@ -86,12 +81,19 @@ func (opts *createProjectIpAccessListOpts) Run(ctx context.Context, w io.Writer) NetworkPermissionEntry: data, } + resp, _, err := opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createProjectIpAccessListBuilder() *cobra.Command { @@ -102,12 +104,10 @@ func createProjectIpAccessListBuilder() *cobra.Command { Use: "createProjectIpAccessList", Short: "Add Entries to Project IP Access List", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -124,31 +124,35 @@ func createProjectIpAccessListBuilder() *cobra.Command { } type deleteProjectIpAccessListOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string entryValue string } -func (opts *deleteProjectIpAccessListOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteProjectIpAccessListOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteProjectIpAccessListOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteProjectIpAccessListApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } + resp, _, err := opts.client.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteProjectIpAccessListBuilder() *cobra.Command { @@ -157,12 +161,10 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { Use: "deleteProjectIpAccessList", Short: "Remove One Entry from One Project IP Access List", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -180,31 +182,35 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { } type getProjectIpAccessListStatusOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string entryValue string } -func (opts *getProjectIpAccessListStatusOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getProjectIpAccessListStatusOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getProjectIpAccessListStatusOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetProjectIpAccessListStatusApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } + resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getProjectIpAccessListStatusBuilder() *cobra.Command { @@ -213,12 +219,10 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { Use: "getProjectIpAccessListStatus", Short: "Return Status of One Project IP Access List Entry", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -232,31 +236,35 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { } type getProjectIpListOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string entryValue string } -func (opts *getProjectIpListOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getProjectIpListOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getProjectIpListOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getProjectIpListOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetProjectIpListApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } + resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpListWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getProjectIpListBuilder() *cobra.Command { @@ -265,12 +273,10 @@ func getProjectIpListBuilder() *cobra.Command { Use: "getProjectIpList", Short: "Return One Project IP Access List Entry", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -284,7 +290,6 @@ func getProjectIpListBuilder() *cobra.Command { } type listProjectIpAccessListsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -292,27 +297,32 @@ type listProjectIpAccessListsOpts struct { pageNum int } -func (opts *listProjectIpAccessListsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listProjectIpAccessListsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listProjectIpAccessListsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListProjectIpAccessListsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listProjectIpAccessListsBuilder() *cobra.Command { @@ -321,12 +331,10 @@ func listProjectIpAccessListsBuilder() *cobra.Command { Use: "listProjectIpAccessLists", Short: "Return Project IP Access List", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 7735f674c4..627b308f68 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createProjectOpts struct { - cli.GlobalOpts client *admin.APIClient projectOwnerId string @@ -39,12 +36,9 @@ type createProjectOpts struct { fs afero.Fs } -func (opts *createProjectOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createProjectOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createProjectOpts) readData() (*admin.Group, error) { @@ -69,23 +63,31 @@ func (opts *createProjectOpts) readData() (*admin.Group, error) { return out, nil } -func (opts *createProjectOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createProjectOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateProjectApiParams{ ProjectOwnerId: &opts.projectOwnerId, Group: data, } + resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createProjectBuilder() *cobra.Command { @@ -96,12 +98,10 @@ func createProjectBuilder() *cobra.Command { Use: "createProject", Short: "Create One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } @@ -112,7 +112,6 @@ func createProjectBuilder() *cobra.Command { } type createProjectInvitationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -120,12 +119,9 @@ type createProjectInvitationOpts struct { fs afero.Fs } -func (opts *createProjectInvitationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createProjectInvitationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createProjectInvitationOpts) readData() (*admin.GroupInvitationRequest, error) { @@ -150,22 +146,30 @@ func (opts *createProjectInvitationOpts) readData() (*admin.GroupInvitationReque return out, nil } -func (opts *createProjectInvitationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateProjectInvitationApiParams{ GroupId: opts.groupId, GroupInvitationRequest: data, } + resp, _, err := opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createProjectInvitationBuilder() *cobra.Command { @@ -176,12 +180,10 @@ func createProjectInvitationBuilder() *cobra.Command { Use: "createProjectInvitation", Short: "Invite One MongoDB Cloud User to Join One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -195,29 +197,33 @@ func createProjectInvitationBuilder() *cobra.Command { } type deleteProjectOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *deleteProjectOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteProjectOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteProjectOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteProjectOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.ProjectsApi.DeleteProjectWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteProjectBuilder() *cobra.Command { @@ -226,12 +232,10 @@ func deleteProjectBuilder() *cobra.Command { Use: "deleteProject", Short: "Remove One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -243,31 +247,35 @@ func deleteProjectBuilder() *cobra.Command { } type deleteProjectInvitationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string invitationId string } -func (opts *deleteProjectInvitationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteProjectInvitationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteProjectInvitationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteProjectInvitationApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, } + resp, _, err := opts.client.ProjectsApi.DeleteProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteProjectInvitationBuilder() *cobra.Command { @@ -276,12 +284,10 @@ func deleteProjectInvitationBuilder() *cobra.Command { Use: "deleteProjectInvitation", Short: "Cancel One Project Invitation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -295,31 +301,35 @@ func deleteProjectInvitationBuilder() *cobra.Command { } type deleteProjectLimitOpts struct { - cli.GlobalOpts client *admin.APIClient limitName string groupId string } -func (opts *deleteProjectLimitOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteProjectLimitOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteProjectLimitOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteProjectLimitOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, } + resp, _, err := opts.client.ProjectsApi.DeleteProjectLimitWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteProjectLimitBuilder() *cobra.Command { @@ -328,12 +338,10 @@ func deleteProjectLimitBuilder() *cobra.Command { Use: "deleteProjectLimit", Short: "Remove One Project Limit", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -363,29 +371,33 @@ func deleteProjectLimitBuilder() *cobra.Command { } type getProjectOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getProjectOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getProjectOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getProjectOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getProjectOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetProjectApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.ProjectsApi.GetProjectWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getProjectBuilder() *cobra.Command { @@ -394,12 +406,10 @@ func getProjectBuilder() *cobra.Command { Use: "getProject", Short: "Return One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -411,29 +421,33 @@ func getProjectBuilder() *cobra.Command { } type getProjectByNameOpts struct { - cli.GlobalOpts client *admin.APIClient groupName string } -func (opts *getProjectByNameOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getProjectByNameOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getProjectByNameOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getProjectByNameOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetProjectByNameApiParams{ GroupName: opts.groupName, } + resp, _, err := opts.client.ProjectsApi.GetProjectByNameWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getProjectByNameBuilder() *cobra.Command { @@ -442,12 +456,10 @@ func getProjectByNameBuilder() *cobra.Command { Use: "getProjectByName", Short: "Return One Project using Its Name", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupName, "groupName", "", `Human-readable label that identifies this project.`) @@ -457,31 +469,35 @@ func getProjectByNameBuilder() *cobra.Command { } type getProjectInvitationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string invitationId string } -func (opts *getProjectInvitationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getProjectInvitationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getProjectInvitationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetProjectInvitationApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, } + resp, _, err := opts.client.ProjectsApi.GetProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getProjectInvitationBuilder() *cobra.Command { @@ -490,12 +506,10 @@ func getProjectInvitationBuilder() *cobra.Command { Use: "getProjectInvitation", Short: "Return One Project Invitation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -509,31 +523,35 @@ func getProjectInvitationBuilder() *cobra.Command { } type getProjectLimitOpts struct { - cli.GlobalOpts client *admin.APIClient limitName string groupId string } -func (opts *getProjectLimitOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getProjectLimitOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getProjectLimitOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getProjectLimitOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, } + resp, _, err := opts.client.ProjectsApi.GetProjectLimitWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getProjectLimitBuilder() *cobra.Command { @@ -542,12 +560,10 @@ func getProjectLimitBuilder() *cobra.Command { Use: "getProjectLimit", Short: "Return One Limit for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -577,29 +593,33 @@ func getProjectLimitBuilder() *cobra.Command { } type getProjectSettingsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getProjectSettingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getProjectSettingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getProjectSettingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getProjectSettingsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.ProjectsApi.GetProjectSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getProjectSettingsBuilder() *cobra.Command { @@ -608,12 +628,10 @@ func getProjectSettingsBuilder() *cobra.Command { Use: "getProjectSettings", Short: "Return One Project Settings", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -625,31 +643,35 @@ func getProjectSettingsBuilder() *cobra.Command { } type listProjectInvitationsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string username string } -func (opts *listProjectInvitationsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listProjectInvitationsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listProjectInvitationsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listProjectInvitationsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListProjectInvitationsApiParams{ GroupId: opts.groupId, Username: &opts.username, } + resp, _, err := opts.client.ProjectsApi.ListProjectInvitationsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listProjectInvitationsBuilder() *cobra.Command { @@ -658,12 +680,10 @@ func listProjectInvitationsBuilder() *cobra.Command { Use: "listProjectInvitations", Short: "Return All Project Invitations", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -676,29 +696,33 @@ func listProjectInvitationsBuilder() *cobra.Command { } type listProjectLimitsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *listProjectLimitsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listProjectLimitsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listProjectLimitsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listProjectLimitsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.ProjectsApi.ListProjectLimitsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listProjectLimitsBuilder() *cobra.Command { @@ -707,12 +731,10 @@ func listProjectLimitsBuilder() *cobra.Command { Use: "listProjectLimits", Short: "Return All Limits for One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -724,7 +746,6 @@ func listProjectLimitsBuilder() *cobra.Command { } type listProjectUsersOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -734,15 +755,13 @@ type listProjectUsersOpts struct { includeOrgUsers bool } -func (opts *listProjectUsersOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listProjectUsersOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listProjectUsersOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listProjectUsersOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListProjectUsersApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, @@ -751,12 +770,19 @@ func (opts *listProjectUsersOpts) Run(ctx context.Context, w io.Writer) error { FlattenTeams: &opts.flattenTeams, IncludeOrgUsers: &opts.includeOrgUsers, } + resp, _, err := opts.client.ProjectsApi.ListProjectUsersWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listProjectUsersBuilder() *cobra.Command { @@ -765,12 +791,10 @@ func listProjectUsersBuilder() *cobra.Command { Use: "listProjectUsers", Short: "Return All Users in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -787,33 +811,37 @@ func listProjectUsersBuilder() *cobra.Command { } type listProjectsOpts struct { - cli.GlobalOpts client *admin.APIClient includeCount bool itemsPerPage int pageNum int } -func (opts *listProjectsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listProjectsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listProjectsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listProjectsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListProjectsApiParams{ IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.ProjectsApi.ListProjectsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listProjectsBuilder() *cobra.Command { @@ -822,12 +850,10 @@ func listProjectsBuilder() *cobra.Command { Use: "listProjects", Short: "Return All Projects", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -838,31 +864,25 @@ func listProjectsBuilder() *cobra.Command { } type removeProjectUserOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string userId string } -func (opts *removeProjectUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *removeProjectUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *removeProjectUserOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *removeProjectUserOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.RemoveProjectUserApiParams{ GroupId: opts.groupId, UserId: opts.userId, } - _, err := opts.client.ProjectsApi.RemoveProjectUserWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.ProjectsApi.RemoveProjectUserWithParams(ctx, params).Execute() + return err } func removeProjectUserBuilder() *cobra.Command { @@ -871,12 +891,10 @@ func removeProjectUserBuilder() *cobra.Command { Use: "removeProjectUser", Short: "Remove One User from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -890,7 +908,6 @@ func removeProjectUserBuilder() *cobra.Command { } type setProjectLimitOpts struct { - cli.GlobalOpts client *admin.APIClient limitName string groupId string @@ -899,12 +916,9 @@ type setProjectLimitOpts struct { fs afero.Fs } -func (opts *setProjectLimitOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *setProjectLimitOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *setProjectLimitOpts) readData() (*admin.DataFederationLimit, error) { @@ -929,23 +943,31 @@ func (opts *setProjectLimitOpts) readData() (*admin.DataFederationLimit, error) return out, nil } -func (opts *setProjectLimitOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *setProjectLimitOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.SetProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, DataFederationLimit: data, } + resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func setProjectLimitBuilder() *cobra.Command { @@ -956,12 +978,10 @@ func setProjectLimitBuilder() *cobra.Command { Use: "setProjectLimit", Short: "Set One Project Limit", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -993,7 +1013,6 @@ func setProjectLimitBuilder() *cobra.Command { } type updateProjectOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -1001,12 +1020,9 @@ type updateProjectOpts struct { fs afero.Fs } -func (opts *updateProjectOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateProjectOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateProjectOpts) readData() (*admin.GroupName, error) { @@ -1031,22 +1047,30 @@ func (opts *updateProjectOpts) readData() (*admin.GroupName, error) { return out, nil } -func (opts *updateProjectOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateProjectOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, GroupName: data, } + resp, _, err := opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateProjectBuilder() *cobra.Command { @@ -1057,12 +1081,10 @@ func updateProjectBuilder() *cobra.Command { Use: "updateProject", Short: "Update One Project Name", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1076,7 +1098,6 @@ func updateProjectBuilder() *cobra.Command { } type updateProjectInvitationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -1084,12 +1105,9 @@ type updateProjectInvitationOpts struct { fs afero.Fs } -func (opts *updateProjectInvitationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateProjectInvitationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateProjectInvitationOpts) readData() (*admin.GroupInvitationRequest, error) { @@ -1114,22 +1132,30 @@ func (opts *updateProjectInvitationOpts) readData() (*admin.GroupInvitationReque return out, nil } -func (opts *updateProjectInvitationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateProjectInvitationApiParams{ GroupId: opts.groupId, GroupInvitationRequest: data, } + resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateProjectInvitationBuilder() *cobra.Command { @@ -1140,12 +1166,10 @@ func updateProjectInvitationBuilder() *cobra.Command { Use: "updateProjectInvitation", Short: "Update One Project Invitation", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1159,7 +1183,6 @@ func updateProjectInvitationBuilder() *cobra.Command { } type updateProjectInvitationByIdOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string invitationId string @@ -1168,12 +1191,9 @@ type updateProjectInvitationByIdOpts struct { fs afero.Fs } -func (opts *updateProjectInvitationByIdOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateProjectInvitationByIdOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateProjectInvitationByIdOpts) readData() (*admin.GroupInvitationUpdateRequest, error) { @@ -1198,23 +1218,31 @@ func (opts *updateProjectInvitationByIdOpts) readData() (*admin.GroupInvitationU return out, nil } -func (opts *updateProjectInvitationByIdOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateProjectInvitationByIdApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, GroupInvitationUpdateRequest: data, } + resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateProjectInvitationByIdBuilder() *cobra.Command { @@ -1225,12 +1253,10 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { Use: "updateProjectInvitationById", Short: "Update One Project Invitation by Invitation ID", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1246,7 +1272,6 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { } type updateProjectRolesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string userId string @@ -1255,12 +1280,9 @@ type updateProjectRolesOpts struct { fs afero.Fs } -func (opts *updateProjectRolesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateProjectRolesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateProjectRolesOpts) readData() (*admin.UpdateGroupRolesForUser, error) { @@ -1285,23 +1307,31 @@ func (opts *updateProjectRolesOpts) readData() (*admin.UpdateGroupRolesForUser, return out, nil } -func (opts *updateProjectRolesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateProjectRolesOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateProjectRolesApiParams{ GroupId: opts.groupId, UserId: opts.userId, UpdateGroupRolesForUser: data, } + resp, _, err := opts.client.ProjectsApi.UpdateProjectRolesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateProjectRolesBuilder() *cobra.Command { @@ -1312,12 +1342,10 @@ func updateProjectRolesBuilder() *cobra.Command { Use: "updateProjectRoles", Short: "Update Project Roles for One MongoDB Cloud User", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -1333,7 +1361,6 @@ func updateProjectRolesBuilder() *cobra.Command { } type updateProjectSettingsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -1341,12 +1368,9 @@ type updateProjectSettingsOpts struct { fs afero.Fs } -func (opts *updateProjectSettingsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateProjectSettingsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateProjectSettingsOpts) readData() (*admin.GroupSettings, error) { @@ -1371,22 +1395,30 @@ func (opts *updateProjectSettingsOpts) readData() (*admin.GroupSettings, error) return out, nil } -func (opts *updateProjectSettingsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateProjectSettingsOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateProjectSettingsApiParams{ GroupId: opts.groupId, GroupSettings: data, } + resp, _, err := opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateProjectSettingsBuilder() *cobra.Command { @@ -1397,12 +1429,10 @@ func updateProjectSettingsBuilder() *cobra.Command { Use: "updateProjectSettings", Short: "Update One Project Settings", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index c8e6df2a15..e2e9c2066d 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createPushBasedLogConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type createPushBasedLogConfigurationOpts struct { fs afero.Fs } -func (opts *createPushBasedLogConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createPushBasedLogConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createPushBasedLogConfigurationOpts) readData() (*admin.PushBasedLogExportProject, error) { @@ -69,22 +63,20 @@ func (opts *createPushBasedLogConfigurationOpts) readData() (*admin.PushBasedLog return out, nil } -func (opts *createPushBasedLogConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreatePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, PushBasedLogExportProject: data, } - _, err := opts.client.PushBasedLogExportApi.CreatePushBasedLogConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.PushBasedLogExportApi.CreatePushBasedLogConfigurationWithParams(ctx, params).Execute() + return err } func createPushBasedLogConfigurationBuilder() *cobra.Command { @@ -95,12 +87,10 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { Use: "createPushBasedLogConfiguration", Short: "Enable the push-based log export feature for a project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,29 +104,23 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { } type deletePushBasedLogConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *deletePushBasedLogConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deletePushBasedLogConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deletePushBasedLogConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *deletePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.DeletePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, } - _, err := opts.client.PushBasedLogExportApi.DeletePushBasedLogConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.PushBasedLogExportApi.DeletePushBasedLogConfigurationWithParams(ctx, params).Execute() + return err } func deletePushBasedLogConfigurationBuilder() *cobra.Command { @@ -145,12 +129,10 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { Use: "deletePushBasedLogConfiguration", Short: "Disable the push-based log export feature for a project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -162,29 +144,33 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { } type getPushBasedLogConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *getPushBasedLogConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getPushBasedLogConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getPushBasedLogConfigurationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetPushBasedLogConfigurationApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.PushBasedLogExportApi.GetPushBasedLogConfigurationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getPushBasedLogConfigurationBuilder() *cobra.Command { @@ -193,12 +179,10 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { Use: "getPushBasedLogConfiguration", Short: "Get the push-based log export configuration for a project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -210,7 +194,6 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { } type updatePushBasedLogConfigurationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -218,12 +201,9 @@ type updatePushBasedLogConfigurationOpts struct { fs afero.Fs } -func (opts *updatePushBasedLogConfigurationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updatePushBasedLogConfigurationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updatePushBasedLogConfigurationOpts) readData() (*admin.PushBasedLogExportProject, error) { @@ -248,22 +228,20 @@ func (opts *updatePushBasedLogConfigurationOpts) readData() (*admin.PushBasedLog return out, nil } -func (opts *updatePushBasedLogConfigurationOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *updatePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdatePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, PushBasedLogExportProject: data, } - _, err := opts.client.PushBasedLogExportApi.UpdatePushBasedLogConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.PushBasedLogExportApi.UpdatePushBasedLogConfigurationWithParams(ctx, params).Execute() + return err } func updatePushBasedLogConfigurationBuilder() *cobra.Command { @@ -274,12 +252,10 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { Use: "updatePushBasedLogConfiguration", Short: "Update the push-based log export feature for a project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 80aa06330b..3a4132f206 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -23,14 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createRollingIndexOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string @@ -39,12 +37,9 @@ type createRollingIndexOpts struct { fs afero.Fs } -func (opts *createRollingIndexOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createRollingIndexOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createRollingIndexOpts) readData() (*admin.DatabaseRollingIndexRequest, error) { @@ -69,23 +64,21 @@ func (opts *createRollingIndexOpts) readData() (*admin.DatabaseRollingIndexReque return out, nil } -func (opts *createRollingIndexOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *createRollingIndexOpts) run(ctx context.Context, _ io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateRollingIndexApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, DatabaseRollingIndexRequest: data, } - _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() + return err } func createRollingIndexBuilder() *cobra.Command { @@ -96,12 +89,10 @@ func createRollingIndexBuilder() *cobra.Command { Use: "createRollingIndex", Short: "Create One Rolling Index", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index e45b8e9aee..42d44bf0d6 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -18,35 +18,39 @@ package api import ( "context" + "encoding/json" + "fmt" "io" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type getSystemStatusOpts struct { - cli.GlobalOpts client *admin.APIClient } -func (opts *getSystemStatusOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getSystemStatusOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getSystemStatusOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getSystemStatusOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetSystemStatusApiParams{} + resp, _, err := opts.client.RootApi.GetSystemStatusWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getSystemStatusBuilder() *cobra.Command { @@ -55,12 +59,10 @@ func getSystemStatusBuilder() *cobra.Command { Use: "getSystemStatus", Short: "Return the status of this MongoDB application", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index c4c2100481..ab42737bde 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createServerlessInstanceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type createServerlessInstanceOpts struct { fs afero.Fs } -func (opts *createServerlessInstanceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createServerlessInstanceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createServerlessInstanceOpts) readData() (*admin.ServerlessInstanceDescriptionCreate, error) { @@ -69,22 +63,30 @@ func (opts *createServerlessInstanceOpts) readData() (*admin.ServerlessInstanceD return out, nil } -func (opts *createServerlessInstanceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, ServerlessInstanceDescriptionCreate: data, } + resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createServerlessInstanceBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func createServerlessInstanceBuilder() *cobra.Command { Use: "createServerlessInstance", Short: "Create One Serverless Instance in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,31 +114,35 @@ func createServerlessInstanceBuilder() *cobra.Command { } type deleteServerlessInstanceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string name string } -func (opts *deleteServerlessInstanceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteServerlessInstanceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteServerlessInstanceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, } + resp, _, err := opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteServerlessInstanceBuilder() *cobra.Command { @@ -147,12 +151,10 @@ func deleteServerlessInstanceBuilder() *cobra.Command { Use: "deleteServerlessInstance", Short: "Remove One Serverless Instance from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -166,31 +168,35 @@ func deleteServerlessInstanceBuilder() *cobra.Command { } type getServerlessInstanceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string name string } -func (opts *getServerlessInstanceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getServerlessInstanceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getServerlessInstanceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, } + resp, _, err := opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getServerlessInstanceBuilder() *cobra.Command { @@ -199,12 +205,10 @@ func getServerlessInstanceBuilder() *cobra.Command { Use: "getServerlessInstance", Short: "Return One Serverless Instance from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -218,7 +222,6 @@ func getServerlessInstanceBuilder() *cobra.Command { } type listServerlessInstancesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -226,27 +229,32 @@ type listServerlessInstancesOpts struct { pageNum int } -func (opts *listServerlessInstancesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listServerlessInstancesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listServerlessInstancesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listServerlessInstancesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListServerlessInstancesApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listServerlessInstancesBuilder() *cobra.Command { @@ -255,12 +263,10 @@ func listServerlessInstancesBuilder() *cobra.Command { Use: "listServerlessInstances", Short: "Return All Serverless Instances from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -275,7 +281,6 @@ func listServerlessInstancesBuilder() *cobra.Command { } type updateServerlessInstanceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string name string @@ -284,12 +289,9 @@ type updateServerlessInstanceOpts struct { fs afero.Fs } -func (opts *updateServerlessInstanceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateServerlessInstanceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateServerlessInstanceOpts) readData() (*admin.ServerlessInstanceDescriptionUpdate, error) { @@ -314,23 +316,31 @@ func (opts *updateServerlessInstanceOpts) readData() (*admin.ServerlessInstanceD return out, nil } -func (opts *updateServerlessInstanceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, ServerlessInstanceDescriptionUpdate: data, } + resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateServerlessInstanceBuilder() *cobra.Command { @@ -341,12 +351,10 @@ func updateServerlessInstanceBuilder() *cobra.Command { Use: "updateServerlessInstance", Short: "Update One Serverless Instance in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index 1feeadec8c..c565279cf8 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createServerlessPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string instanceName string @@ -40,12 +37,9 @@ type createServerlessPrivateEndpointOpts struct { fs afero.Fs } -func (opts *createServerlessPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createServerlessPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantCreateRequest, error) { @@ -70,23 +64,31 @@ func (opts *createServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTe return out, nil } -func (opts *createServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, ServerlessTenantCreateRequest: data, } + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createServerlessPrivateEndpointBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { Use: "createServerlessPrivateEndpoint", Short: "Create One Private Endpoint for One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,33 +118,37 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { } type deleteServerlessPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string instanceName string endpointId string } -func (opts *deleteServerlessPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteServerlessPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, EndpointId: opts.endpointId, } + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteServerlessPrivateEndpointBuilder() *cobra.Command { @@ -153,12 +157,10 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { Use: "deleteServerlessPrivateEndpoint", Short: "Remove One Private Endpoint for One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -174,33 +176,37 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { } type getServerlessPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string instanceName string endpointId string } -func (opts *getServerlessPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getServerlessPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, EndpointId: opts.endpointId, } + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getServerlessPrivateEndpointBuilder() *cobra.Command { @@ -209,12 +215,10 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { Use: "getServerlessPrivateEndpoint", Short: "Return One Private Endpoint for One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -230,31 +234,35 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { } type listServerlessPrivateEndpointsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string instanceName string } -func (opts *listServerlessPrivateEndpointsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listServerlessPrivateEndpointsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listServerlessPrivateEndpointsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListServerlessPrivateEndpointsApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, } + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listServerlessPrivateEndpointsBuilder() *cobra.Command { @@ -263,12 +271,10 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { Use: "listServerlessPrivateEndpoints", Short: "Return All Private Endpoints for One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -282,7 +288,6 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { } type updateServerlessPrivateEndpointOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string instanceName string @@ -292,12 +297,9 @@ type updateServerlessPrivateEndpointOpts struct { fs afero.Fs } -func (opts *updateServerlessPrivateEndpointOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateServerlessPrivateEndpointOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantEndpointUpdate, error) { @@ -322,11 +324,12 @@ func (opts *updateServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTe return out, nil } -func (opts *updateServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, @@ -334,12 +337,19 @@ func (opts *updateServerlessPrivateEndpointOpts) Run(ctx context.Context, w io.W ServerlessTenantEndpointUpdate: data, } + resp, _, err := opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateServerlessPrivateEndpointBuilder() *cobra.Command { @@ -350,12 +360,10 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { Use: "updateServerlessPrivateEndpoint", Short: "Update One Private Endpoint for One Serverless Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index 49a30ba9ab..88bcdc94e3 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createSharedClusterBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient clusterName string groupId string @@ -40,12 +37,9 @@ type createSharedClusterBackupRestoreJobOpts struct { fs afero.Fs } -func (opts *createSharedClusterBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createSharedClusterBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createSharedClusterBackupRestoreJobOpts) readData() (*admin.TenantRestore, error) { @@ -70,23 +64,31 @@ func (opts *createSharedClusterBackupRestoreJobOpts) readData() (*admin.TenantRe return out, nil } -func (opts *createSharedClusterBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, TenantRestore: data, } + resp, _, err := opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { Use: "createSharedClusterBackupRestoreJob", Short: "Create One Restore Job from One M2 or M5 Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -118,33 +118,37 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { } type getSharedClusterBackupRestoreJobOpts struct { - cli.GlobalOpts client *admin.APIClient clusterName string groupId string restoreId string } -func (opts *getSharedClusterBackupRestoreJobOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getSharedClusterBackupRestoreJobOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getSharedClusterBackupRestoreJobOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, RestoreId: opts.restoreId, } + resp, _, err := opts.client.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { @@ -153,12 +157,10 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { Use: "getSharedClusterBackupRestoreJob", Short: "Return One Restore Job for One M2 or M5 Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -174,31 +176,35 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { } type listSharedClusterBackupRestoreJobsOpts struct { - cli.GlobalOpts client *admin.APIClient clusterName string groupId string } -func (opts *listSharedClusterBackupRestoreJobsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listSharedClusterBackupRestoreJobsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listSharedClusterBackupRestoreJobsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListSharedClusterBackupRestoreJobsApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, } + resp, _, err := opts.client.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { @@ -207,12 +213,10 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { Use: "listSharedClusterBackupRestoreJobs", Short: "Return All Restore Jobs for One M2 or M5 Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index 7ad0a01493..f19b6df847 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type downloadSharedClusterBackupOpts struct { - cli.GlobalOpts client *admin.APIClient clusterName string groupId string @@ -40,12 +37,9 @@ type downloadSharedClusterBackupOpts struct { fs afero.Fs } -func (opts *downloadSharedClusterBackupOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *downloadSharedClusterBackupOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *downloadSharedClusterBackupOpts) readData() (*admin.TenantRestore, error) { @@ -70,23 +64,31 @@ func (opts *downloadSharedClusterBackupOpts) readData() (*admin.TenantRestore, e return out, nil } -func (opts *downloadSharedClusterBackupOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.DownloadSharedClusterBackupApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, TenantRestore: data, } + resp, _, err := opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func downloadSharedClusterBackupBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { Use: "downloadSharedClusterBackup", Short: "Download One M2 or M5 Cluster Snapshot", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -118,33 +118,37 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { } type getSharedClusterBackupOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string snapshotId string } -func (opts *getSharedClusterBackupOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getSharedClusterBackupOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getSharedClusterBackupOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getSharedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetSharedClusterBackupApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, SnapshotId: opts.snapshotId, } + resp, _, err := opts.client.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getSharedClusterBackupBuilder() *cobra.Command { @@ -153,12 +157,10 @@ func getSharedClusterBackupBuilder() *cobra.Command { Use: "getSharedClusterBackup", Short: "Return One Snapshot for One M2 or M5 Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -174,31 +176,35 @@ func getSharedClusterBackupBuilder() *cobra.Command { } type listSharedClusterBackupsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string clusterName string } -func (opts *listSharedClusterBackupsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listSharedClusterBackupsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listSharedClusterBackupsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListSharedClusterBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } + resp, _, err := opts.client.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listSharedClusterBackupsBuilder() *cobra.Command { @@ -207,12 +213,10 @@ func listSharedClusterBackupsBuilder() *cobra.Command { Use: "listSharedClusterBackups", Short: "Return All Snapshots for One M2 or M5 Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index 7a72fbe19d..506da32fe6 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createStreamConnectionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string @@ -40,12 +37,9 @@ type createStreamConnectionOpts struct { fs afero.Fs } -func (opts *createStreamConnectionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createStreamConnectionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createStreamConnectionOpts) readData() (*admin.StreamsConnection, error) { @@ -70,23 +64,31 @@ func (opts *createStreamConnectionOpts) readData() (*admin.StreamsConnection, er return out, nil } -func (opts *createStreamConnectionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateStreamConnectionApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, StreamsConnection: data, } + resp, _, err := opts.client.StreamsApi.CreateStreamConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createStreamConnectionBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createStreamConnectionBuilder() *cobra.Command { Use: "createStreamConnection", Short: "Create One Connection", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,7 +118,6 @@ func createStreamConnectionBuilder() *cobra.Command { } type createStreamInstanceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -126,12 +125,9 @@ type createStreamInstanceOpts struct { fs afero.Fs } -func (opts *createStreamInstanceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createStreamInstanceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createStreamInstanceOpts) readData() (*admin.StreamsTenant, error) { @@ -156,22 +152,30 @@ func (opts *createStreamInstanceOpts) readData() (*admin.StreamsTenant, error) { return out, nil } -func (opts *createStreamInstanceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateStreamInstanceApiParams{ GroupId: opts.groupId, StreamsTenant: data, } + resp, _, err := opts.client.StreamsApi.CreateStreamInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createStreamInstanceBuilder() *cobra.Command { @@ -182,12 +186,10 @@ func createStreamInstanceBuilder() *cobra.Command { Use: "createStreamInstance", Short: "Create One Stream Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -201,33 +203,37 @@ func createStreamInstanceBuilder() *cobra.Command { } type deleteStreamConnectionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string connectionName string } -func (opts *deleteStreamConnectionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteStreamConnectionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteStreamConnectionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteStreamConnectionApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, ConnectionName: opts.connectionName, } + resp, _, err := opts.client.StreamsApi.DeleteStreamConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteStreamConnectionBuilder() *cobra.Command { @@ -236,12 +242,10 @@ func deleteStreamConnectionBuilder() *cobra.Command { Use: "deleteStreamConnection", Short: "Delete One Stream Connection", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -257,31 +261,35 @@ func deleteStreamConnectionBuilder() *cobra.Command { } type deleteStreamInstanceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string } -func (opts *deleteStreamInstanceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteStreamInstanceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteStreamInstanceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteStreamInstanceApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } + resp, _, err := opts.client.StreamsApi.DeleteStreamInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteStreamInstanceBuilder() *cobra.Command { @@ -290,12 +298,10 @@ func deleteStreamInstanceBuilder() *cobra.Command { Use: "deleteStreamInstance", Short: "Delete One Stream Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -309,33 +315,37 @@ func deleteStreamInstanceBuilder() *cobra.Command { } type getStreamConnectionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string connectionName string } -func (opts *getStreamConnectionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getStreamConnectionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getStreamConnectionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetStreamConnectionApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, ConnectionName: opts.connectionName, } + resp, _, err := opts.client.StreamsApi.GetStreamConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getStreamConnectionBuilder() *cobra.Command { @@ -344,12 +354,10 @@ func getStreamConnectionBuilder() *cobra.Command { Use: "getStreamConnection", Short: "Return One Stream Connection", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -365,33 +373,37 @@ func getStreamConnectionBuilder() *cobra.Command { } type getStreamInstanceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string includeConnections bool } -func (opts *getStreamInstanceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getStreamInstanceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getStreamInstanceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetStreamInstanceApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, IncludeConnections: &opts.includeConnections, } + resp, _, err := opts.client.StreamsApi.GetStreamInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getStreamInstanceBuilder() *cobra.Command { @@ -400,12 +412,10 @@ func getStreamInstanceBuilder() *cobra.Command { Use: "getStreamInstance", Short: "Return One Stream Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -420,7 +430,6 @@ func getStreamInstanceBuilder() *cobra.Command { } type listStreamConnectionsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string @@ -428,27 +437,32 @@ type listStreamConnectionsOpts struct { pageNum int } -func (opts *listStreamConnectionsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listStreamConnectionsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listStreamConnectionsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listStreamConnectionsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListStreamConnectionsApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.StreamsApi.ListStreamConnectionsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listStreamConnectionsBuilder() *cobra.Command { @@ -457,12 +471,10 @@ func listStreamConnectionsBuilder() *cobra.Command { Use: "listStreamConnections", Short: "Return All Connections Of The Stream Instances", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -478,33 +490,37 @@ func listStreamConnectionsBuilder() *cobra.Command { } type listStreamInstancesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string itemsPerPage int pageNum int } -func (opts *listStreamInstancesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listStreamInstancesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listStreamInstancesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listStreamInstancesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListStreamInstancesApiParams{ GroupId: opts.groupId, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.StreamsApi.ListStreamInstancesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listStreamInstancesBuilder() *cobra.Command { @@ -513,12 +529,10 @@ func listStreamInstancesBuilder() *cobra.Command { Use: "listStreamInstances", Short: "Return All Project Stream Instances", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -532,7 +546,6 @@ func listStreamInstancesBuilder() *cobra.Command { } type updateStreamConnectionOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string @@ -542,12 +555,9 @@ type updateStreamConnectionOpts struct { fs afero.Fs } -func (opts *updateStreamConnectionOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateStreamConnectionOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateStreamConnectionOpts) readData() (*admin.StreamsConnection, error) { @@ -572,11 +582,12 @@ func (opts *updateStreamConnectionOpts) readData() (*admin.StreamsConnection, er return out, nil } -func (opts *updateStreamConnectionOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateStreamConnectionApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, @@ -584,12 +595,19 @@ func (opts *updateStreamConnectionOpts) Run(ctx context.Context, w io.Writer) er StreamsConnection: data, } + resp, _, err := opts.client.StreamsApi.UpdateStreamConnectionWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateStreamConnectionBuilder() *cobra.Command { @@ -600,12 +618,10 @@ func updateStreamConnectionBuilder() *cobra.Command { Use: "updateStreamConnection", Short: "Update One Stream Connection", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -623,7 +639,6 @@ func updateStreamConnectionBuilder() *cobra.Command { } type updateStreamInstanceOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string tenantName string @@ -632,12 +647,9 @@ type updateStreamInstanceOpts struct { fs afero.Fs } -func (opts *updateStreamInstanceOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateStreamInstanceOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateStreamInstanceOpts) readData() (*admin.StreamsDataProcessRegion, error) { @@ -662,23 +674,31 @@ func (opts *updateStreamInstanceOpts) readData() (*admin.StreamsDataProcessRegio return out, nil } -func (opts *updateStreamInstanceOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateStreamInstanceApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, StreamsDataProcessRegion: data, } + resp, _, err := opts.client.StreamsApi.UpdateStreamInstanceWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateStreamInstanceBuilder() *cobra.Command { @@ -689,12 +709,10 @@ func updateStreamInstanceBuilder() *cobra.Command { Use: "updateStreamInstance", Short: "Update One Stream Instance", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index c7a73705c2..d6ba51b8a0 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type addAllTeamsToProjectOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string @@ -39,12 +36,9 @@ type addAllTeamsToProjectOpts struct { fs afero.Fs } -func (opts *addAllTeamsToProjectOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *addAllTeamsToProjectOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *addAllTeamsToProjectOpts) readData() (*[]admin.TeamRole, error) { @@ -69,22 +63,30 @@ func (opts *addAllTeamsToProjectOpts) readData() (*[]admin.TeamRole, error) { return out, nil } -func (opts *addAllTeamsToProjectOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.AddAllTeamsToProjectApiParams{ GroupId: opts.groupId, TeamRole: data, } + resp, _, err := opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func addAllTeamsToProjectBuilder() *cobra.Command { @@ -95,12 +97,10 @@ func addAllTeamsToProjectBuilder() *cobra.Command { Use: "addAllTeamsToProject", Short: "Add One or More Teams to One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -114,7 +114,6 @@ func addAllTeamsToProjectBuilder() *cobra.Command { } type addTeamUserOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string teamId string @@ -123,12 +122,9 @@ type addTeamUserOpts struct { fs afero.Fs } -func (opts *addTeamUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *addTeamUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *addTeamUserOpts) readData() (*[]admin.AddUserToTeam, error) { @@ -153,23 +149,31 @@ func (opts *addTeamUserOpts) readData() (*[]admin.AddUserToTeam, error) { return out, nil } -func (opts *addTeamUserOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *addTeamUserOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.AddTeamUserApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, AddUserToTeam: data, } + resp, _, err := opts.client.TeamsApi.AddTeamUserWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func addTeamUserBuilder() *cobra.Command { @@ -180,12 +184,10 @@ func addTeamUserBuilder() *cobra.Command { Use: "addTeamUser", Short: "Assign MongoDB Cloud Users from One Organization to One Team", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -199,7 +201,6 @@ func addTeamUserBuilder() *cobra.Command { } type createTeamOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string @@ -207,12 +208,9 @@ type createTeamOpts struct { fs afero.Fs } -func (opts *createTeamOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createTeamOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createTeamOpts) readData() (*admin.Team, error) { @@ -237,22 +235,30 @@ func (opts *createTeamOpts) readData() (*admin.Team, error) { return out, nil } -func (opts *createTeamOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createTeamOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateTeamApiParams{ OrgId: opts.orgId, Team: data, } + resp, _, err := opts.client.TeamsApi.CreateTeamWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createTeamBuilder() *cobra.Command { @@ -263,12 +269,10 @@ func createTeamBuilder() *cobra.Command { Use: "createTeam", Short: "Create One Team in One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -280,31 +284,35 @@ func createTeamBuilder() *cobra.Command { } type deleteTeamOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string teamId string } -func (opts *deleteTeamOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteTeamOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteTeamOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteTeamOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteTeamApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, } + resp, _, err := opts.client.TeamsApi.DeleteTeamWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteTeamBuilder() *cobra.Command { @@ -313,12 +321,10 @@ func deleteTeamBuilder() *cobra.Command { Use: "deleteTeam", Short: "Remove One Team from One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -330,31 +336,35 @@ func deleteTeamBuilder() *cobra.Command { } type getTeamByIdOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string teamId string } -func (opts *getTeamByIdOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getTeamByIdOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getTeamByIdOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getTeamByIdOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetTeamByIdApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, } + resp, _, err := opts.client.TeamsApi.GetTeamByIdWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getTeamByIdBuilder() *cobra.Command { @@ -363,12 +373,10 @@ func getTeamByIdBuilder() *cobra.Command { Use: "getTeamById", Short: "Return One Team using its ID", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -380,31 +388,35 @@ func getTeamByIdBuilder() *cobra.Command { } type getTeamByNameOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string teamName string } -func (opts *getTeamByNameOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getTeamByNameOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getTeamByNameOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getTeamByNameOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetTeamByNameApiParams{ OrgId: opts.orgId, TeamName: opts.teamName, } + resp, _, err := opts.client.TeamsApi.GetTeamByNameWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getTeamByNameBuilder() *cobra.Command { @@ -413,12 +425,10 @@ func getTeamByNameBuilder() *cobra.Command { Use: "getTeamByName", Short: "Return One Team using its Name", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -430,7 +440,6 @@ func getTeamByNameBuilder() *cobra.Command { } type listOrganizationTeamsOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string itemsPerPage int @@ -438,27 +447,32 @@ type listOrganizationTeamsOpts struct { pageNum int } -func (opts *listOrganizationTeamsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listOrganizationTeamsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listOrganizationTeamsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationTeamsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListOrganizationTeamsApiParams{ OrgId: opts.orgId, ItemsPerPage: &opts.itemsPerPage, IncludeCount: &opts.includeCount, PageNum: &opts.pageNum, } + resp, _, err := opts.client.TeamsApi.ListOrganizationTeamsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listOrganizationTeamsBuilder() *cobra.Command { @@ -467,12 +481,10 @@ func listOrganizationTeamsBuilder() *cobra.Command { Use: "listOrganizationTeams", Short: "Return All Teams in One Organization", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -485,7 +497,6 @@ func listOrganizationTeamsBuilder() *cobra.Command { } type listProjectTeamsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -493,27 +504,32 @@ type listProjectTeamsOpts struct { pageNum int } -func (opts *listProjectTeamsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listProjectTeamsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listProjectTeamsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listProjectTeamsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListProjectTeamsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.TeamsApi.ListProjectTeamsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listProjectTeamsBuilder() *cobra.Command { @@ -522,12 +538,10 @@ func listProjectTeamsBuilder() *cobra.Command { Use: "listProjectTeams", Short: "Return All Teams in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -542,7 +556,6 @@ func listProjectTeamsBuilder() *cobra.Command { } type listTeamUsersOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string teamId string @@ -550,27 +563,32 @@ type listTeamUsersOpts struct { pageNum int } -func (opts *listTeamUsersOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listTeamUsersOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listTeamUsersOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listTeamUsersOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListTeamUsersApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.TeamsApi.ListTeamUsersWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listTeamUsersBuilder() *cobra.Command { @@ -579,12 +597,10 @@ func listTeamUsersBuilder() *cobra.Command { Use: "listTeamUsers", Short: "Return All MongoDB Cloud Users Assigned to One Team", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -598,31 +614,25 @@ func listTeamUsersBuilder() *cobra.Command { } type removeProjectTeamOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string teamId string } -func (opts *removeProjectTeamOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *removeProjectTeamOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *removeProjectTeamOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *removeProjectTeamOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, } - _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params).Execute() + return err } func removeProjectTeamBuilder() *cobra.Command { @@ -631,12 +641,10 @@ func removeProjectTeamBuilder() *cobra.Command { Use: "removeProjectTeam", Short: "Remove One Team from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -650,33 +658,27 @@ func removeProjectTeamBuilder() *cobra.Command { } type removeTeamUserOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string teamId string userId string } -func (opts *removeTeamUserOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *removeTeamUserOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *removeTeamUserOpts) Run(ctx context.Context, _ io.Writer) error { +func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Writer) error { + params := &admin.RemoveTeamUserApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, UserId: opts.userId, } - _, err := opts.client.TeamsApi.RemoveTeamUserWithParams(ctx, params).Execute() - if err != nil { - return err - } - return nil + _, err := opts.client.TeamsApi.RemoveTeamUserWithParams(ctx, params).Execute() + return err } func removeTeamUserBuilder() *cobra.Command { @@ -685,12 +687,10 @@ func removeTeamUserBuilder() *cobra.Command { Use: "removeTeamUser", Short: "Remove One MongoDB Cloud User from One Team", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -704,7 +704,6 @@ func removeTeamUserBuilder() *cobra.Command { } type renameTeamOpts struct { - cli.GlobalOpts client *admin.APIClient orgId string teamId string @@ -713,12 +712,9 @@ type renameTeamOpts struct { fs afero.Fs } -func (opts *renameTeamOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *renameTeamOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *renameTeamOpts) readData() (*admin.Team, error) { @@ -743,23 +739,31 @@ func (opts *renameTeamOpts) readData() (*admin.Team, error) { return out, nil } -func (opts *renameTeamOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *renameTeamOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.RenameTeamApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, Team: data, } + resp, _, err := opts.client.TeamsApi.RenameTeamWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func renameTeamBuilder() *cobra.Command { @@ -770,12 +774,10 @@ func renameTeamBuilder() *cobra.Command { Use: "renameTeam", Short: "Rename One Team", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) @@ -789,7 +791,6 @@ func renameTeamBuilder() *cobra.Command { } type updateTeamRolesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string teamId string @@ -798,12 +799,9 @@ type updateTeamRolesOpts struct { fs afero.Fs } -func (opts *updateTeamRolesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateTeamRolesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateTeamRolesOpts) readData() (*admin.TeamRole, error) { @@ -828,23 +826,31 @@ func (opts *updateTeamRolesOpts) readData() (*admin.TeamRole, error) { return out, nil } -func (opts *updateTeamRolesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateTeamRolesOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateTeamRolesApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, TeamRole: data, } + resp, _, err := opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateTeamRolesBuilder() *cobra.Command { @@ -855,12 +861,10 @@ func updateTeamRolesBuilder() *cobra.Command { Use: "updateTeamRoles", Short: "Update Team Roles in One Project", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index b7144f218b..655b7dcb23 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createThirdPartyIntegrationOpts struct { - cli.GlobalOpts client *admin.APIClient integrationType string groupId string @@ -43,12 +40,9 @@ type createThirdPartyIntegrationOpts struct { fs afero.Fs } -func (opts *createThirdPartyIntegrationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createThirdPartyIntegrationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegration, error) { @@ -73,11 +67,12 @@ func (opts *createThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegr return out, nil } -func (opts *createThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, @@ -88,12 +83,19 @@ func (opts *createThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Write ThridPartyIntegration: data, } + resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createThirdPartyIntegrationBuilder() *cobra.Command { @@ -104,12 +106,10 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { Use: "createThirdPartyIntegration", Short: "Configure One Third-Party Service Integration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -128,31 +128,35 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { } type deleteThirdPartyIntegrationOpts struct { - cli.GlobalOpts client *admin.APIClient integrationType string groupId string } -func (opts *deleteThirdPartyIntegrationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *deleteThirdPartyIntegrationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *deleteThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.DeleteThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, } + resp, _, err := opts.client.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func deleteThirdPartyIntegrationBuilder() *cobra.Command { @@ -161,12 +165,10 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { Use: "deleteThirdPartyIntegration", Short: "Remove One Third-Party Service Integration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -180,31 +182,35 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { } type getThirdPartyIntegrationOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string integrationType string } -func (opts *getThirdPartyIntegrationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *getThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.GetThirdPartyIntegrationApiParams{ GroupId: opts.groupId, IntegrationType: opts.integrationType, } + resp, _, err := opts.client.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func getThirdPartyIntegrationBuilder() *cobra.Command { @@ -213,12 +219,10 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { Use: "getThirdPartyIntegration", Short: "Return One Third-Party Service Integration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -232,7 +236,6 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { } type listThirdPartyIntegrationsOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string includeCount bool @@ -240,27 +243,32 @@ type listThirdPartyIntegrationsOpts struct { pageNum int } -func (opts *listThirdPartyIntegrationsOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listThirdPartyIntegrationsOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listThirdPartyIntegrationsOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListThirdPartyIntegrationsApiParams{ GroupId: opts.groupId, IncludeCount: &opts.includeCount, ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listThirdPartyIntegrationsBuilder() *cobra.Command { @@ -269,12 +277,10 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { Use: "listThirdPartyIntegrations", Short: "Return All Active Third-Party Service Integrations", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -289,7 +295,6 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { } type updateThirdPartyIntegrationOpts struct { - cli.GlobalOpts client *admin.APIClient integrationType string groupId string @@ -301,12 +306,9 @@ type updateThirdPartyIntegrationOpts struct { fs afero.Fs } -func (opts *updateThirdPartyIntegrationOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *updateThirdPartyIntegrationOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *updateThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegration, error) { @@ -331,11 +333,12 @@ func (opts *updateThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegr return out, nil } -func (opts *updateThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.UpdateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, @@ -346,12 +349,19 @@ func (opts *updateThirdPartyIntegrationOpts) Run(ctx context.Context, w io.Write ThridPartyIntegration: data, } + resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func updateThirdPartyIntegrationBuilder() *cobra.Command { @@ -362,12 +372,10 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { Use: "updateThirdPartyIntegration", Short: "Update One Third-Party Service Integration", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index f103ee4b85..959d215068 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -23,15 +23,12 @@ import ( "io" "os" - "github.com/mongodb/mongodb-atlas-cli/internal/cli" - "github.com/mongodb/mongodb-atlas-cli/internal/jsonwriter" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) type createDatabaseUserCertificateOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string username string @@ -40,12 +37,9 @@ type createDatabaseUserCertificateOpts struct { fs afero.Fs } -func (opts *createDatabaseUserCertificateOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *createDatabaseUserCertificateOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } func (opts *createDatabaseUserCertificateOpts) readData() (*admin.UserCert, error) { @@ -70,23 +64,31 @@ func (opts *createDatabaseUserCertificateOpts) readData() (*admin.UserCert, erro return out, nil } -func (opts *createDatabaseUserCertificateOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, w io.Writer) error { data, errData := opts.readData() if errData != nil { return errData } + params := &admin.CreateDatabaseUserCertificateApiParams{ GroupId: opts.groupId, Username: opts.username, UserCert: data, } + resp, _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func createDatabaseUserCertificateBuilder() *cobra.Command { @@ -97,12 +99,10 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { Use: "createDatabaseUserCertificate", Short: "Create One X.509 Certificate for One MongoDB User", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -118,29 +118,33 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { } type disableCustomerManagedX509Opts struct { - cli.GlobalOpts client *admin.APIClient groupId string } -func (opts *disableCustomerManagedX509Opts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *disableCustomerManagedX509Opts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *disableCustomerManagedX509Opts) Run(ctx context.Context, w io.Writer) error { +func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, w io.Writer) error { + params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, } + resp, _, err := opts.client.X509AuthenticationApi.DisableCustomerManagedX509WithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func disableCustomerManagedX509Builder() *cobra.Command { @@ -149,12 +153,10 @@ func disableCustomerManagedX509Builder() *cobra.Command { Use: "disableCustomerManagedX509", Short: "Disable Customer-Managed X.509", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. @@ -166,7 +168,6 @@ func disableCustomerManagedX509Builder() *cobra.Command { } type listDatabaseUserCertificatesOpts struct { - cli.GlobalOpts client *admin.APIClient groupId string username string @@ -175,15 +176,13 @@ type listDatabaseUserCertificatesOpts struct { pageNum int } -func (opts *listDatabaseUserCertificatesOpts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *listDatabaseUserCertificatesOpts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } -func (opts *listDatabaseUserCertificatesOpts) Run(ctx context.Context, w io.Writer) error { +func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, w io.Writer) error { + params := &admin.ListDatabaseUserCertificatesApiParams{ GroupId: opts.groupId, Username: opts.username, @@ -191,12 +190,19 @@ func (opts *listDatabaseUserCertificatesOpts) Run(ctx context.Context, w io.Writ ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, } + resp, _, err := opts.client.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(ctx, params).Execute() if err != nil { return err } - return jsonwriter.Print(w, resp) + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err } func listDatabaseUserCertificatesBuilder() *cobra.Command { @@ -205,12 +211,10 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { Use: "listDatabaseUserCertificates", Short: "Return All X.509 Certificates Assigned to One MongoDB User", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. diff --git a/tools/openapi-generator/config/go-templates/api.mustache b/tools/openapi-generator/config/go-templates/api.mustache index cc3c103854..42c6c969a4 100644 --- a/tools/openapi-generator/config/go-templates/api.mustache +++ b/tools/openapi-generator/config/go-templates/api.mustache @@ -107,18 +107,6 @@ func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { return tr.base.RoundTrip(req) } -func convertTime(s *string) *time.Time { - if s == nil { - return nil - } - - r, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil - } - return &r -} - func Builder() *cobra.Command { const use = "api" cmd := &cobra.Command{ diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index f177440f56..a63ab2e976 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -6,18 +6,17 @@ import ( "os" "io" "time" + "encoding/json" + "fmt" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" - "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/cli" - "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/jsonwriter" ) {{#operations}} {{#operation}} type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { - cli.GlobalOpts client *admin.APIClient {{#allParams}} {{^isBodyParam}}{{paramName}} {{{dataType}}}{{/isBodyParam}} @@ -28,12 +27,9 @@ type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { {{/bodyParam}} } -func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) initClient() func() error { - return func() error { - var err error - opts.client, err = newClientWithAuth() - return err - } +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) preRun() (err error) { + opts.client, err = newClientWithAuth() + return err } {{#bodyParam}} @@ -60,26 +56,45 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) readD } {{/bodyParam}} -func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) Run(ctx context.Context, {{^returnType}}_{{/returnType}}{{#returnType}}w{{/returnType}} io.Writer) error { +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(ctx context.Context, {{^returnType}}_{{/returnType}}{{#returnType}}w{{/returnType}} io.Writer) error { {{#bodyParam}} data, errData := opts.readData() if errData != nil { return errData } {{/bodyParam}} + {{#allParams}}{{#isDateTime}} + var {{paramName}} *time.Time + var err{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}} error + if opts.{{paramName}} != "" { + *{{paramName}}, err{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}} = time.Parse(time.RFC3339, opts.{{paramName}}) + if err{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}} != nil { + return err{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}} + } + } + {{/isDateTime}}{{/allParams}} params := &admin.{{operationId}}ApiParams{ {{#allParams}} - {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: {{#isDateTime}}convertTime({{/isDateTime}}{{^isPathParam}}&{{/isPathParam}}opts.{{paramName}}{{#isDateTime}}){{/isDateTime}},{{/isBodyParam}} + {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: {{^isPathParam}}{{^isDateTime}}&{{/isDateTime}}{{/isPathParam}}{{^isDateTime}}opts.{{/isDateTime}}{{paramName}},{{/isBodyParam}} {{/allParams}}{{#bodyParam}} {{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: data, {{/bodyParam}} } + {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params).Execute() + {{#returnType}} if err != nil { return err } - return {{^returnType}}nil{{/returnType}}{{#returnType}}jsonwriter.Print(w, resp){{/returnType}} + prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + if errJson != nil { + return errJson + } + + _, err = fmt.Fprintln(w, string(prettyJSON)) + {{/returnType}} + return err } func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.Command { @@ -92,12 +107,10 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C Use: "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}", Short: "{{ summary }}", PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.PreRunE( - opts.initClient(), - ) + return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.Run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } {{#allParams}} From a3a8d36f567c33ca4c3ae30bfa344595dde0ee8b Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 29 Sep 2023 20:31:54 +0100 Subject: [PATCH 30/44] fetch groupId and orgId from config --- internal/api/api_access_tracking_cmd.go | 15 +- internal/api/api_alert_configurations_cmd.go | 50 +++-- internal/api/api_alerts_cmd.go | 29 +-- internal/api/api_atlas_search_cmd.go | 36 ++-- internal/api/api_auditing_cmd.go | 15 +- internal/api/api_aws_clusters_dns_cmd.go | 15 +- internal/api/api_cloud_backups_cmd.go | 204 ++++++++++-------- .../api/api_cloud_migration_service_cmd.go | 51 +++-- internal/api/api_cloud_provider_access_cmd.go | 36 ++-- .../api/api_cluster_outage_simulation_cmd.go | 22 +- internal/api/api_clusters_cmd.go | 99 +++++---- internal/api/api_custom_database_roles_cmd.go | 36 ++-- internal/api/api_data_federation_cmd.go | 99 +++++---- internal/api/api_data_lake_pipelines_cmd.go | 92 ++++---- internal/api/api_database_users_cmd.go | 36 ++-- ..._rest_using_customer_key_management_cmd.go | 15 +- internal/api/api_events_cmd.go | 25 ++- .../api/api_federated_authentication_cmd.go | 31 ++- internal/api/api_global_clusters_cmd.go | 36 ++-- internal/api/api_invoices_cmd.go | 31 ++- internal/api/api_ldap_configuration_cmd.go | 36 ++-- internal/api/api_legacy_backup_cmd.go | 71 +++--- .../api/api_legacy_backup_restore_jobs_cmd.go | 8 +- internal/api/api_maintenance_windows__cmd.go | 36 ++-- internal/api/api_monitoring_and_logs_cmd.go | 99 +++++---- internal/api/api_network_peering_cmd.go | 92 ++++---- internal/api/api_online_archive_cmd.go | 43 ++-- internal/api/api_organizations_cmd.go | 76 +++++-- internal/api/api_performance_advisor_cmd.go | 36 ++-- .../api/api_private_endpoint_services_cmd.go | 64 +++--- internal/api/api_programmatic_api_keys_cmd.go | 81 ++++--- .../api/api_project_ip_access_list_cmd.go | 36 ++-- internal/api/api_projects_cmd.go | 127 ++++++----- internal/api/api_push_based_log_export_cmd.go | 29 +-- internal/api/api_rolling_index_cmd.go | 8 +- internal/api/api_serverless_instances_cmd.go | 36 ++-- .../api_serverless_private_endpoints_cmd.go | 36 ++-- .../api/api_shared_tier_restore_jobs_cmd.go | 22 +- internal/api/api_shared_tier_snapshots_cmd.go | 22 +- internal/api/api_streams_cmd.go | 71 +++--- internal/api/api_teams_cmd.go | 74 +++++-- .../api/api_third_party_integrations_cmd.go | 36 ++-- internal/api/api_x509_authentication_cmd.go | 22 +- .../config/atlas-api-changes.yaml | 8 + .../config/atlas-api-transformed.yaml | 13 +- .../config/go-templates/cmd.mustache | 14 +- tools/openapi-generator/merge.js | 3 + 47 files changed, 1321 insertions(+), 851 deletions(-) diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index 7c7f38d692..b4c00853cc 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -22,6 +22,7 @@ import ( "fmt" "io" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -43,6 +44,9 @@ func (opts *listAccessLogsByClusterNameOpts) preRun() (err error) { } func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListAccessLogsByClusterNameApiParams{ GroupId: opts.groupId, @@ -80,9 +84,7 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.authResult, "authResult", false, `Flag that indicates whether the response returns the successful authentication attempts only.`) cmd.Flags().Int64Var(&opts.end, "end", 0, `Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.`) @@ -112,6 +114,9 @@ func (opts *listAccessLogsByHostnameOpts) preRun() (err error) { } func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListAccessLogsByHostnameApiParams{ GroupId: opts.groupId, @@ -149,9 +154,7 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.hostname, "hostname", "", `Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.`) cmd.Flags().BoolVar(&opts.authResult, "authResult", false, `Flag that indicates whether the response returns the successful authentication attempts only.`) cmd.Flags().Int64Var(&opts.end, "end", 0, `Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.`) diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index 0722f74b6d..f3c43973dc 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createAlertConfigurationOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -103,9 +107,7 @@ func createAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -125,6 +127,9 @@ func (opts *deleteAlertConfigurationOpts) preRun() (err error) { } func (opts *deleteAlertConfigurationOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -147,9 +152,7 @@ func deleteAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") @@ -169,6 +172,9 @@ func (opts *getAlertConfigurationOpts) preRun() (err error) { } func (opts *getAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -201,9 +207,7 @@ func getAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") @@ -268,6 +272,9 @@ func (opts *listAlertConfigurationsOpts) preRun() (err error) { } func (opts *listAlertConfigurationsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListAlertConfigurationsApiParams{ GroupId: opts.groupId, @@ -302,9 +309,7 @@ func listAlertConfigurationsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -328,6 +333,9 @@ func (opts *listAlertConfigurationsByAlertIdOpts) preRun() (err error) { } func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListAlertConfigurationsByAlertIdApiParams{ GroupId: opts.groupId, @@ -363,9 +371,7 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -417,6 +423,9 @@ func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ToggleAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -453,9 +462,7 @@ func toggleAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -506,6 +513,9 @@ func (opts *updateAlertConfigurationOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -542,9 +552,7 @@ func updateAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index 077d521936..166adbf4f0 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *acknowledgeAlertOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.AcknowledgeAlertApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func acknowledgeAlertBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -129,6 +131,9 @@ func (opts *getAlertOpts) preRun() (err error) { } func (opts *getAlertOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetAlertApiParams{ GroupId: opts.groupId, @@ -161,9 +166,7 @@ func getAlertBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") @@ -186,6 +189,9 @@ func (opts *listAlertsOpts) preRun() (err error) { } func (opts *listAlertsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListAlertsApiParams{ GroupId: opts.groupId, @@ -221,9 +227,7 @@ func listAlertsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -248,6 +252,9 @@ func (opts *listAlertsByAlertConfigurationIdOpts) preRun() (err error) { } func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListAlertsByAlertConfigurationIdApiParams{ GroupId: opts.groupId, @@ -283,9 +290,7 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index 67a57e6da1..256b9f9a65 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func createAtlasSearchIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection on which to create an Atlas Search index.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -130,6 +132,9 @@ func (opts *deleteAtlasSearchIndexOpts) preRun() (err error) { } func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -163,9 +168,7 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the database and collection with one or more Application Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) @@ -188,6 +191,9 @@ func (opts *getAtlasSearchIndexOpts) preRun() (err error) { } func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -221,9 +227,7 @@ func getAtlasSearchIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.`) @@ -247,6 +251,9 @@ func (opts *listAtlasSearchIndexesOpts) preRun() (err error) { } func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListAtlasSearchIndexesApiParams{ GroupId: opts.groupId, @@ -281,9 +288,7 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Name of the collection that contains one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) @@ -337,6 +342,9 @@ func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -374,9 +382,7 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection whose Atlas Search index to update.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 5fbd6c08c9..c04687f18c 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -39,6 +40,9 @@ func (opts *getAuditingConfigurationOpts) preRun() (err error) { } func (opts *getAuditingConfigurationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, @@ -70,9 +74,7 @@ func getAuditingConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -118,6 +120,9 @@ func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateAuditingConfigurationApiParams{ GroupId: opts.groupId, @@ -153,9 +158,7 @@ func updateAuditingConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index fc158020db..e192e8683f 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -39,6 +40,9 @@ func (opts *getAWSCustomDNSOpts) preRun() (err error) { } func (opts *getAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, @@ -70,9 +74,7 @@ func getAWSCustomDNSBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -118,6 +120,9 @@ func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ToggleAWSCustomDNSApiParams{ GroupId: opts.groupId, @@ -153,9 +158,7 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index a361d705f1..7908bcc072 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -41,6 +42,9 @@ func (opts *cancelBackupRestoreJobOpts) preRun() (err error) { } func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CancelBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -74,9 +78,7 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to remove.`) @@ -127,6 +129,9 @@ func (opts *createBackupExportJobOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateBackupExportJobApiParams{ GroupId: opts.groupId, @@ -163,9 +168,7 @@ func createBackupExportJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -216,6 +219,9 @@ func (opts *createBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -252,9 +258,7 @@ func createBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -304,6 +308,9 @@ func (opts *createExportBucketOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, @@ -339,9 +346,7 @@ func createExportBucketBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -390,6 +395,9 @@ func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, w io. if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -426,9 +434,7 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance whose snapshot you want to restore.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -450,6 +456,9 @@ func (opts *deleteAllBackupSchedulesOpts) preRun() (err error) { } func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteAllBackupSchedulesApiParams{ GroupId: opts.groupId, @@ -482,9 +491,7 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -504,6 +511,9 @@ func (opts *deleteExportBucketOpts) preRun() (err error) { } func (opts *deleteExportBucketOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteExportBucketApiParams{ GroupId: opts.groupId, @@ -536,9 +546,7 @@ func deleteExportBucketBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("groupId") @@ -559,6 +567,9 @@ func (opts *deleteReplicaSetBackupOpts) preRun() (err error) { } func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteReplicaSetBackupApiParams{ GroupId: opts.groupId, @@ -592,9 +603,7 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -617,6 +626,9 @@ func (opts *deleteShardedClusterBackupOpts) preRun() (err error) { } func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteShardedClusterBackupApiParams{ GroupId: opts.groupId, @@ -650,9 +662,7 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -675,6 +685,9 @@ func (opts *getBackupExportJobOpts) preRun() (err error) { } func (opts *getBackupExportJobOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetBackupExportJobApiParams{ GroupId: opts.groupId, @@ -708,9 +721,7 @@ func getBackupExportJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.exportId, "exportId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) @@ -733,6 +744,9 @@ func (opts *getBackupRestoreJobOpts) preRun() (err error) { } func (opts *getBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -766,9 +780,7 @@ func getBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) @@ -790,6 +802,9 @@ func (opts *getBackupScheduleOpts) preRun() (err error) { } func (opts *getBackupScheduleOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetBackupScheduleApiParams{ GroupId: opts.groupId, @@ -822,9 +837,7 @@ func getBackupScheduleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -843,6 +856,9 @@ func (opts *getDataProtectionSettingsOpts) preRun() (err error) { } func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, @@ -874,9 +890,7 @@ func getDataProtectionSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -894,6 +908,9 @@ func (opts *getExportBucketOpts) preRun() (err error) { } func (opts *getExportBucketOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetExportBucketApiParams{ GroupId: opts.groupId, @@ -926,9 +943,7 @@ func getExportBucketBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("groupId") @@ -949,6 +964,9 @@ func (opts *getReplicaSetBackupOpts) preRun() (err error) { } func (opts *getReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetReplicaSetBackupApiParams{ GroupId: opts.groupId, @@ -982,9 +1000,7 @@ func getReplicaSetBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -1007,6 +1023,9 @@ func (opts *getServerlessBackupOpts) preRun() (err error) { } func (opts *getServerlessBackupOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetServerlessBackupApiParams{ GroupId: opts.groupId, @@ -1040,9 +1059,7 @@ func getServerlessBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -1065,6 +1082,9 @@ func (opts *getServerlessBackupRestoreJobOpts) preRun() (err error) { } func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -1098,9 +1118,7 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) @@ -1123,6 +1141,9 @@ func (opts *getShardedClusterBackupOpts) preRun() (err error) { } func (opts *getShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetShardedClusterBackupApiParams{ GroupId: opts.groupId, @@ -1156,9 +1177,7 @@ func getShardedClusterBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -1183,6 +1202,9 @@ func (opts *listBackupExportJobsOpts) preRun() (err error) { } func (opts *listBackupExportJobsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListBackupExportJobsApiParams{ GroupId: opts.groupId, @@ -1218,9 +1240,7 @@ func listBackupExportJobsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1246,6 +1266,9 @@ func (opts *listBackupRestoreJobsOpts) preRun() (err error) { } func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -1281,9 +1304,7 @@ func listBackupRestoreJobsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1308,6 +1329,9 @@ func (opts *listExportBucketsOpts) preRun() (err error) { } func (opts *listExportBucketsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListExportBucketsApiParams{ GroupId: opts.groupId, @@ -1342,9 +1366,7 @@ func listExportBucketsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -1368,6 +1390,9 @@ func (opts *listReplicaSetBackupsOpts) preRun() (err error) { } func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListReplicaSetBackupsApiParams{ GroupId: opts.groupId, @@ -1403,9 +1428,7 @@ func listReplicaSetBackupsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1431,6 +1454,9 @@ func (opts *listServerlessBackupRestoreJobsOpts) preRun() (err error) { } func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListServerlessBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -1466,9 +1492,7 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1494,6 +1518,9 @@ func (opts *listServerlessBackupsOpts) preRun() (err error) { } func (opts *listServerlessBackupsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListServerlessBackupsApiParams{ GroupId: opts.groupId, @@ -1529,9 +1556,7 @@ func listServerlessBackupsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1554,6 +1579,9 @@ func (opts *listShardedClusterBackupsOpts) preRun() (err error) { } func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListShardedClusterBackupsApiParams{ GroupId: opts.groupId, @@ -1586,9 +1614,7 @@ func listShardedClusterBackupsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -1637,6 +1663,9 @@ func (opts *takeSnapshotOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.TakeSnapshotApiParams{ GroupId: opts.groupId, @@ -1673,9 +1702,7 @@ func takeSnapshotBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1726,6 +1753,9 @@ func (opts *updateBackupScheduleOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateBackupScheduleApiParams{ GroupId: opts.groupId, @@ -1762,9 +1792,7 @@ func updateBackupScheduleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1814,6 +1842,9 @@ func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, @@ -1849,9 +1880,7 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1901,6 +1930,9 @@ func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateSnapshotRetentionApiParams{ GroupId: opts.groupId, @@ -1938,9 +1970,7 @@ func updateSnapshotRetentionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 8c17997aaa..2763a1629c 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createLinkTokenOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, @@ -103,7 +107,7 @@ func createLinkTokenBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -151,6 +155,9 @@ func (opts *createPushMigrationOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, @@ -186,9 +193,7 @@ func createPushMigrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -208,6 +213,9 @@ func (opts *cutoverMigrationOpts) preRun() (err error) { } func (opts *cutoverMigrationOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CutoverMigrationApiParams{ GroupId: opts.groupId, @@ -230,9 +238,7 @@ func cutoverMigrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) _ = cmd.MarkFlagRequired("groupId") @@ -251,6 +257,9 @@ func (opts *deleteLinkTokenOpts) preRun() (err error) { } func (opts *deleteLinkTokenOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, @@ -282,7 +291,7 @@ func deleteLinkTokenBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -300,6 +309,9 @@ func (opts *getPushMigrationOpts) preRun() (err error) { } func (opts *getPushMigrationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetPushMigrationApiParams{ GroupId: opts.groupId, @@ -332,9 +344,7 @@ func getPushMigrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) _ = cmd.MarkFlagRequired("groupId") @@ -354,6 +364,9 @@ func (opts *getValidationStatusOpts) preRun() (err error) { } func (opts *getValidationStatusOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetValidationStatusApiParams{ GroupId: opts.groupId, @@ -386,9 +399,7 @@ func getValidationStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) _ = cmd.MarkFlagRequired("groupId") @@ -407,6 +418,9 @@ func (opts *listSourceProjectsOpts) preRun() (err error) { } func (opts *listSourceProjectsOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, @@ -438,7 +452,7 @@ func listSourceProjectsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -484,6 +498,9 @@ func (opts *validateMigrationOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, @@ -519,9 +536,7 @@ func validateMigrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index ef36105c42..f56b765652 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, w io. if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.AuthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -157,6 +159,9 @@ func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Wri if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -192,9 +197,7 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -215,6 +218,9 @@ func (opts *deauthorizeCloudProviderAccessRoleOpts) preRun() (err error) { } func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeauthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -238,9 +244,7 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider of the role to deauthorize.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) @@ -262,6 +266,9 @@ func (opts *getCloudProviderAccessRoleOpts) preRun() (err error) { } func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -294,9 +301,7 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) _ = cmd.MarkFlagRequired("groupId") @@ -315,6 +320,9 @@ func (opts *listCloudProviderAccessRolesOpts) preRun() (err error) { } func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, @@ -346,9 +354,7 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index eeff2369fd..41bb82f092 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -40,6 +41,9 @@ func (opts *endOutageSimulationOpts) preRun() (err error) { } func (opts *endOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.EndOutageSimulationApiParams{ GroupId: opts.groupId, @@ -72,9 +76,7 @@ func endOutageSimulationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) _ = cmd.MarkFlagRequired("groupId") @@ -94,6 +96,9 @@ func (opts *getOutageSimulationOpts) preRun() (err error) { } func (opts *getOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetOutageSimulationApiParams{ GroupId: opts.groupId, @@ -126,9 +131,7 @@ func getOutageSimulationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) _ = cmd.MarkFlagRequired("groupId") @@ -177,6 +180,9 @@ func (opts *startOutageSimulationOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.StartOutageSimulationApiParams{ GroupId: opts.groupId, @@ -213,9 +219,7 @@ func startOutageSimulationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to undergo an outage simulation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 6b2cd021d4..1470c0c197 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createClusterOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, @@ -103,9 +107,7 @@ func createClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -126,6 +128,9 @@ func (opts *deleteClusterOpts) preRun() (err error) { } func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteClusterApiParams{ GroupId: opts.groupId, @@ -149,9 +154,7 @@ func deleteClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) @@ -172,6 +175,9 @@ func (opts *getClusterOpts) preRun() (err error) { } func (opts *getClusterOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetClusterApiParams{ GroupId: opts.groupId, @@ -204,9 +210,7 @@ func getClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -226,6 +230,9 @@ func (opts *getClusterAdvancedConfigurationOpts) preRun() (err error) { } func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, @@ -258,9 +265,7 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -280,6 +285,9 @@ func (opts *getClusterStatusOpts) preRun() (err error) { } func (opts *getClusterStatusOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetClusterStatusApiParams{ GroupId: opts.groupId, @@ -312,9 +320,7 @@ func getClusterStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -334,6 +340,9 @@ func (opts *getSampleDatasetLoadStatusOpts) preRun() (err error) { } func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetSampleDatasetLoadStatusApiParams{ GroupId: opts.groupId, @@ -366,9 +375,7 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) _ = cmd.MarkFlagRequired("groupId") @@ -392,6 +399,9 @@ func (opts *listCloudProviderRegionsOpts) preRun() (err error) { } func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListCloudProviderRegionsApiParams{ GroupId: opts.groupId, @@ -428,9 +438,7 @@ func listCloudProviderRegionsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -456,6 +464,9 @@ func (opts *listClustersOpts) preRun() (err error) { } func (opts *listClustersOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListClustersApiParams{ GroupId: opts.groupId, @@ -491,9 +502,7 @@ func listClustersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -568,6 +577,9 @@ func (opts *loadSampleDatasetOpts) preRun() (err error) { } func (opts *loadSampleDatasetOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, @@ -600,9 +612,7 @@ func loadSampleDatasetBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) _ = cmd.MarkFlagRequired("groupId") @@ -622,6 +632,9 @@ func (opts *testFailoverOpts) preRun() (err error) { } func (opts *testFailoverOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.TestFailoverApiParams{ GroupId: opts.groupId, @@ -644,9 +657,7 @@ func testFailoverBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -695,6 +706,9 @@ func (opts *updateClusterOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateClusterApiParams{ GroupId: opts.groupId, @@ -731,9 +745,7 @@ func updateClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -784,6 +796,9 @@ func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, w i if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, @@ -820,9 +835,7 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -872,6 +885,9 @@ func (opts *upgradeSharedClusterOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, @@ -907,9 +923,7 @@ func upgradeSharedClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -957,6 +971,9 @@ func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, w io. if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, @@ -992,9 +1009,7 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index c0a3531a68..aeb810cf85 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -103,9 +107,7 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -125,6 +127,9 @@ func (opts *deleteCustomDatabaseRoleOpts) preRun() (err error) { } func (opts *deleteCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -147,9 +152,7 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) _ = cmd.MarkFlagRequired("groupId") @@ -169,6 +172,9 @@ func (opts *getCustomDatabaseRoleOpts) preRun() (err error) { } func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -201,9 +207,7 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) _ = cmd.MarkFlagRequired("groupId") @@ -222,6 +226,9 @@ func (opts *listCustomDatabaseRolesOpts) preRun() (err error) { } func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, @@ -253,9 +260,7 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -302,6 +307,9 @@ func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -338,9 +346,7 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index 761846d161..7f60af4795 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, w if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -103,9 +107,7 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -154,6 +156,9 @@ func (opts *createFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -191,9 +196,7 @@ func createFederatedDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -244,6 +247,9 @@ func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, w io if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateOneDataFederationQueryLimitApiParams{ GroupId: opts.groupId, @@ -281,9 +287,7 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. @@ -315,6 +319,9 @@ func (opts *deleteDataFederationPrivateEndpointOpts) preRun() (err error) { } func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -347,9 +354,7 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) _ = cmd.MarkFlagRequired("groupId") @@ -369,6 +374,9 @@ func (opts *deleteFederatedDatabaseOpts) preRun() (err error) { } func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -401,9 +409,7 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) _ = cmd.MarkFlagRequired("groupId") @@ -424,6 +430,9 @@ func (opts *deleteOneDataFederationInstanceQueryLimitOpts) preRun() (err error) } func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ GroupId: opts.groupId, @@ -457,9 +466,7 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. @@ -491,6 +498,9 @@ func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { } func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ GroupId: opts.groupId, @@ -525,9 +535,7 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to download query logs.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) @@ -549,6 +557,9 @@ func (opts *getDataFederationPrivateEndpointOpts) preRun() (err error) { } func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -581,9 +592,7 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) _ = cmd.MarkFlagRequired("groupId") @@ -603,6 +612,9 @@ func (opts *getFederatedDatabaseOpts) preRun() (err error) { } func (opts *getFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -635,9 +647,7 @@ func getFederatedDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) _ = cmd.MarkFlagRequired("groupId") @@ -659,6 +669,9 @@ func (opts *listDataFederationPrivateEndpointsOpts) preRun() (err error) { } func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListDataFederationPrivateEndpointsApiParams{ GroupId: opts.groupId, @@ -693,9 +706,7 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -716,6 +727,9 @@ func (opts *listFederatedDatabasesOpts) preRun() (err error) { } func (opts *listFederatedDatabasesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, @@ -748,9 +762,7 @@ func listFederatedDatabasesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) _ = cmd.MarkFlagRequired("groupId") @@ -770,6 +782,9 @@ func (opts *returnFederatedDatabaseQueryLimitOpts) preRun() (err error) { } func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ GroupId: opts.groupId, @@ -803,9 +818,7 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. @@ -835,6 +848,9 @@ func (opts *returnFederatedDatabaseQueryLimitsOpts) preRun() (err error) { } func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ GroupId: opts.groupId, @@ -867,9 +883,7 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) _ = cmd.MarkFlagRequired("groupId") @@ -919,6 +933,9 @@ func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -956,9 +973,7 @@ func updateFederatedDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to update.`) cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 8da3edb181..d9938545db 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -24,6 +24,7 @@ import ( "os" "time" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createPipelineOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, @@ -104,9 +108,7 @@ func createPipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -126,6 +128,9 @@ func (opts *deletePipelineOpts) preRun() (err error) { } func (opts *deletePipelineOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeletePipelineApiParams{ GroupId: opts.groupId, @@ -158,9 +163,7 @@ func deletePipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -181,6 +184,9 @@ func (opts *deletePipelineRunDatasetOpts) preRun() (err error) { } func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeletePipelineRunDatasetApiParams{ GroupId: opts.groupId, @@ -214,9 +220,7 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) @@ -238,6 +242,9 @@ func (opts *getPipelineOpts) preRun() (err error) { } func (opts *getPipelineOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetPipelineApiParams{ GroupId: opts.groupId, @@ -270,9 +277,7 @@ func getPipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -293,6 +298,9 @@ func (opts *getPipelineRunOpts) preRun() (err error) { } func (opts *getPipelineRunOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetPipelineRunApiParams{ GroupId: opts.groupId, @@ -326,9 +334,7 @@ func getPipelineRunBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) @@ -354,6 +360,9 @@ func (opts *listPipelineRunsOpts) preRun() (err error) { } func (opts *listPipelineRunsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var createdBefore *time.Time var errCreatedBefore error @@ -399,9 +408,7 @@ func listPipelineRunsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -425,6 +432,9 @@ func (opts *listPipelineSchedulesOpts) preRun() (err error) { } func (opts *listPipelineSchedulesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListPipelineSchedulesApiParams{ GroupId: opts.groupId, @@ -457,9 +467,7 @@ func listPipelineSchedulesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -483,6 +491,9 @@ func (opts *listPipelineSnapshotsOpts) preRun() (err error) { } func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var completedAfter *time.Time var errCompletedAfter error @@ -528,9 +539,7 @@ func listPipelineSnapshotsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -553,6 +562,9 @@ func (opts *listPipelinesOpts) preRun() (err error) { } func (opts *listPipelinesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, @@ -584,9 +596,7 @@ func listPipelinesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -604,6 +614,9 @@ func (opts *pausePipelineOpts) preRun() (err error) { } func (opts *pausePipelineOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.PausePipelineApiParams{ GroupId: opts.groupId, @@ -636,9 +649,7 @@ func pausePipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -658,6 +669,9 @@ func (opts *resumePipelineOpts) preRun() (err error) { } func (opts *resumePipelineOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ResumePipelineApiParams{ GroupId: opts.groupId, @@ -690,9 +704,7 @@ func resumePipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -741,6 +753,9 @@ func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.TriggerSnapshotIngestionApiParams{ GroupId: opts.groupId, @@ -777,9 +792,7 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -830,6 +843,9 @@ func (opts *updatePipelineOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdatePipelineApiParams{ GroupId: opts.groupId, @@ -866,9 +882,7 @@ func updatePipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index f4a62cb6d2..0a5515138a 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createDatabaseUserOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, @@ -103,9 +107,7 @@ func createDatabaseUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -126,6 +128,9 @@ func (opts *deleteDatabaseUserOpts) preRun() (err error) { } func (opts *deleteDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteDatabaseUserApiParams{ GroupId: opts.groupId, @@ -159,9 +164,7 @@ func deleteDatabaseUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: @@ -196,6 +199,9 @@ func (opts *getDatabaseUserOpts) preRun() (err error) { } func (opts *getDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetDatabaseUserApiParams{ GroupId: opts.groupId, @@ -229,9 +235,7 @@ func getDatabaseUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: @@ -267,6 +271,9 @@ func (opts *listDatabaseUsersOpts) preRun() (err error) { } func (opts *listDatabaseUsersOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListDatabaseUsersApiParams{ GroupId: opts.groupId, @@ -301,9 +308,7 @@ func listDatabaseUsersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -354,6 +359,9 @@ func (opts *updateDatabaseUserOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateDatabaseUserApiParams{ GroupId: opts.groupId, @@ -391,9 +399,7 @@ func updateDatabaseUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index d570824bdc..f3032c8aa0 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -39,6 +40,9 @@ func (opts *getEncryptionAtRestOpts) preRun() (err error) { } func (opts *getEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, @@ -70,9 +74,7 @@ func getEncryptionAtRestBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -118,6 +120,9 @@ func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, @@ -153,9 +158,7 @@ func updateEncryptionAtRestBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 01984fe34f..9f21e6fba2 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -23,6 +23,7 @@ import ( "io" "time" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -40,6 +41,9 @@ func (opts *getOrganizationEventOpts) preRun() (err error) { } func (opts *getOrganizationEventOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetOrganizationEventApiParams{ OrgId: opts.orgId, @@ -73,7 +77,7 @@ func getOrganizationEventBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) @@ -95,6 +99,9 @@ func (opts *getProjectEventOpts) preRun() (err error) { } func (opts *getProjectEventOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetProjectEventApiParams{ GroupId: opts.groupId, @@ -128,9 +135,7 @@ func getProjectEventBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) @@ -157,6 +162,9 @@ func (opts *listOrganizationEventsOpts) preRun() (err error) { } func (opts *listOrganizationEventsOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } var maxDate *time.Time var errMaxDate error @@ -213,7 +221,7 @@ func listOrganizationEventsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -248,6 +256,9 @@ func (opts *listProjectEventsOpts) preRun() (err error) { } func (opts *listProjectEventsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var maxDate *time.Time var errMaxDate error @@ -306,9 +317,7 @@ func listProjectEventsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index e358f7f967..7f72f37be4 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createRoleMappingOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.CreateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -106,7 +110,7 @@ func createRoleMappingBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -166,6 +170,9 @@ func (opts *deleteRoleMappingOpts) preRun() (err error) { } func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -191,7 +198,7 @@ func deleteRoleMappingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove.`) - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") @@ -262,6 +269,9 @@ func (opts *getFederationSettingsOpts) preRun() (err error) { } func (opts *getFederationSettingsOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, @@ -293,7 +303,7 @@ func getFederationSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -416,6 +426,9 @@ func (opts *getRoleMappingOpts) preRun() (err error) { } func (opts *getRoleMappingOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -451,7 +464,7 @@ func getRoleMappingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to return.`) - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") @@ -567,6 +580,9 @@ func (opts *listRoleMappingsOpts) preRun() (err error) { } func (opts *listRoleMappingsOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -600,7 +616,7 @@ func listRoleMappingsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") @@ -875,6 +891,9 @@ func (opts *updateRoleMappingOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.UpdateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -914,7 +933,7 @@ func updateRoleMappingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.id, "id", "", `Unique 24-hexadecimal digit string that identifies the role mapping that you want to update.`) - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 089cc5e8c9..d16b6fe85d 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createCustomZoneMappingOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateCustomZoneMappingApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func createCustomZoneMappingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -158,6 +160,9 @@ func (opts *createManagedNamespaceOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateManagedNamespaceApiParams{ GroupId: opts.groupId, @@ -194,9 +199,7 @@ func createManagedNamespaceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -218,6 +221,9 @@ func (opts *deleteAllCustomZoneMappingsOpts) preRun() (err error) { } func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteAllCustomZoneMappingsApiParams{ GroupId: opts.groupId, @@ -250,9 +256,7 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -274,6 +278,9 @@ func (opts *deleteManagedNamespaceOpts) preRun() (err error) { } func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, @@ -309,9 +316,7 @@ func deleteManagedNamespaceBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label that identifies the database that contains the collection.`) cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) @@ -332,6 +337,9 @@ func (opts *getManagedNamespaceOpts) preRun() (err error) { } func (opts *getManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetManagedNamespaceApiParams{ GroupId: opts.groupId, @@ -364,9 +372,7 @@ func getManagedNamespaceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index fa2c63b0c0..6b5f5a20fc 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, w io.Wr if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.CreateCostExplorerQueryProcessApiParams{ OrgId: opts.orgId, @@ -103,7 +107,7 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -123,6 +127,9 @@ func (opts *createCostExplorerQueryProcess1Opts) preRun() (err error) { } func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.CreateCostExplorerQueryProcess1ApiParams{ OrgId: opts.orgId, @@ -155,7 +162,7 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.token, "token", "", `Unique 64 digit string that identifies the Cost Explorer query.`) _ = cmd.MarkFlagRequired("orgId") @@ -175,6 +182,9 @@ func (opts *downloadInvoiceCSVOpts) preRun() (err error) { } func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.DownloadInvoiceCSVApiParams{ OrgId: opts.orgId, @@ -207,7 +217,7 @@ func downloadInvoiceCSVBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) _ = cmd.MarkFlagRequired("orgId") @@ -227,6 +237,9 @@ func (opts *getInvoiceOpts) preRun() (err error) { } func (opts *getInvoiceOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetInvoiceApiParams{ OrgId: opts.orgId, @@ -259,7 +272,7 @@ func getInvoiceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) _ = cmd.MarkFlagRequired("orgId") @@ -281,6 +294,9 @@ func (opts *listInvoicesOpts) preRun() (err error) { } func (opts *listInvoicesOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListInvoicesApiParams{ OrgId: opts.orgId, @@ -315,7 +331,7 @@ func listInvoicesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -335,6 +351,9 @@ func (opts *listPendingInvoicesOpts) preRun() (err error) { } func (opts *listPendingInvoicesOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, @@ -366,7 +385,7 @@ func listPendingInvoicesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("orgId") return cmd diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index b2f5b5508b..8d1a5d8422 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -39,6 +40,9 @@ func (opts *deleteLDAPConfigurationOpts) preRun() (err error) { } func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -70,9 +74,7 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -89,6 +91,9 @@ func (opts *getLDAPConfigurationOpts) preRun() (err error) { } func (opts *getLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -120,9 +125,7 @@ func getLDAPConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -140,6 +143,9 @@ func (opts *getLDAPConfigurationStatusOpts) preRun() (err error) { } func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetLDAPConfigurationStatusApiParams{ GroupId: opts.groupId, @@ -172,9 +178,7 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) _ = cmd.MarkFlagRequired("groupId") @@ -222,6 +226,9 @@ func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -257,9 +264,7 @@ func saveLDAPConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -307,6 +312,9 @@ func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -342,9 +350,7 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 88edcbd299..86c5581e47 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -41,6 +42,9 @@ func (opts *deleteLegacySnapshotOpts) preRun() (err error) { } func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteLegacySnapshotApiParams{ GroupId: opts.groupId, @@ -74,9 +78,7 @@ func deleteLegacySnapshotBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -99,6 +101,9 @@ func (opts *getLegacyBackupCheckpointOpts) preRun() (err error) { } func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetLegacyBackupCheckpointApiParams{ GroupId: opts.groupId, @@ -132,9 +137,7 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the checkpoint.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) @@ -157,6 +160,9 @@ func (opts *getLegacyBackupRestoreJobOpts) preRun() (err error) { } func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -190,9 +196,7 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVar(&opts.jobId, "jobId", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) @@ -215,6 +219,9 @@ func (opts *getLegacySnapshotOpts) preRun() (err error) { } func (opts *getLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetLegacySnapshotApiParams{ GroupId: opts.groupId, @@ -248,9 +255,7 @@ func getLegacySnapshotBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -272,6 +277,9 @@ func (opts *getLegacySnapshotScheduleOpts) preRun() (err error) { } func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, @@ -304,9 +312,7 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) _ = cmd.MarkFlagRequired("groupId") @@ -329,6 +335,9 @@ func (opts *listLegacyBackupCheckpointsOpts) preRun() (err error) { } func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListLegacyBackupCheckpointsApiParams{ GroupId: opts.groupId, @@ -364,9 +373,7 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -393,6 +400,9 @@ func (opts *listLegacyBackupRestoreJobsOpts) preRun() (err error) { } func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListLegacyBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -429,9 +439,7 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -459,6 +467,9 @@ func (opts *listLegacySnapshotsOpts) preRun() (err error) { } func (opts *listLegacySnapshotsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListLegacySnapshotsApiParams{ GroupId: opts.groupId, @@ -495,9 +506,7 @@ func listLegacySnapshotsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -551,6 +560,9 @@ func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, w io.Wri if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateLegacySnapshotRetentionApiParams{ GroupId: opts.groupId, @@ -588,9 +600,7 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -643,6 +653,9 @@ func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, @@ -679,9 +692,7 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index f3335774fe..12659c64cd 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index 26cd3d947d..fdad7548a9 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -39,6 +40,9 @@ func (opts *deferMaintenanceWindowOpts) preRun() (err error) { } func (opts *deferMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -60,9 +64,7 @@ func deferMaintenanceWindowBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -79,6 +81,9 @@ func (opts *getMaintenanceWindowOpts) preRun() (err error) { } func (opts *getMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -110,9 +115,7 @@ func getMaintenanceWindowBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -129,6 +132,9 @@ func (opts *resetMaintenanceWindowOpts) preRun() (err error) { } func (opts *resetMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -150,9 +156,7 @@ func resetMaintenanceWindowBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -169,6 +173,9 @@ func (opts *toggleMaintenanceAutoDeferOpts) preRun() (err error) { } func (opts *toggleMaintenanceAutoDeferOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, @@ -190,9 +197,7 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -238,6 +243,9 @@ func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -273,9 +281,7 @@ func updateMaintenanceWindowBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index 83a5b9d2d7..f8f66338ec 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -23,6 +23,7 @@ import ( "io" "time" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -39,6 +40,9 @@ func (opts *getAtlasProcessOpts) preRun() (err error) { } func (opts *getAtlasProcessOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetAtlasProcessApiParams{ GroupId: opts.groupId, @@ -71,9 +75,7 @@ func getAtlasProcessBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("groupId") @@ -94,6 +96,9 @@ func (opts *getDatabaseOpts) preRun() (err error) { } func (opts *getDatabaseOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetDatabaseApiParams{ GroupId: opts.groupId, @@ -127,9 +132,7 @@ func getDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -157,6 +160,9 @@ func (opts *getDatabaseMeasurementsOpts) preRun() (err error) { } func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var start *time.Time var errStart error @@ -213,9 +219,7 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) @@ -249,6 +253,9 @@ func (opts *getDiskMeasurementsOpts) preRun() (err error) { } func (opts *getDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var start *time.Time var errStart error @@ -305,9 +312,7 @@ func getDiskMeasurementsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) @@ -338,6 +343,9 @@ func (opts *getHostLogsOpts) preRun() (err error) { } func (opts *getHostLogsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetHostLogsApiParams{ GroupId: opts.groupId, @@ -373,9 +381,7 @@ func getHostLogsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.hostName, "hostName", "", `Human-readable label that identifies the host that stores the log files that you want to download.`) cmd.Flags().StringVar(&opts.logName, "logName", "", `Human-readable label that identifies the log file that you want to return. To return audit logs, enable *Database Auditing* for the specified project.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) @@ -404,6 +410,9 @@ func (opts *getHostMeasurementsOpts) preRun() (err error) { } func (opts *getHostMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var start *time.Time var errStart error @@ -459,9 +468,7 @@ func getHostMeasurementsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) cmd.Flags().StringSliceVar(&opts.m, "m", nil, `One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.`) @@ -495,6 +502,9 @@ func (opts *getIndexMetricsOpts) preRun() (err error) { } func (opts *getIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var start *time.Time var errStart error @@ -557,9 +567,7 @@ func getIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.indexName, "indexName", "", `Human-readable label that identifies the index.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database.`) cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the measurements that MongoDB Atlas reports for the associated data series.`) cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) @@ -593,6 +601,9 @@ func (opts *getMeasurementsOpts) preRun() (err error) { } func (opts *getMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var start *time.Time var errStart error @@ -649,9 +660,7 @@ func getMeasurementsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.`) cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) @@ -679,6 +688,9 @@ func (opts *listAtlasProcessesOpts) preRun() (err error) { } func (opts *listAtlasProcessesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListAtlasProcessesApiParams{ GroupId: opts.groupId, @@ -713,9 +725,7 @@ func listAtlasProcessesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -739,6 +749,9 @@ func (opts *listDatabasesOpts) preRun() (err error) { } func (opts *listDatabasesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListDatabasesApiParams{ GroupId: opts.groupId, @@ -774,9 +787,7 @@ func listDatabasesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -800,6 +811,9 @@ func (opts *listDiskMeasurementsOpts) preRun() (err error) { } func (opts *listDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListDiskMeasurementsApiParams{ PartitionName: opts.partitionName, @@ -834,9 +848,7 @@ func listDiskMeasurementsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("partitionName") @@ -860,6 +872,9 @@ func (opts *listDiskPartitionsOpts) preRun() (err error) { } func (opts *listDiskPartitionsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListDiskPartitionsApiParams{ GroupId: opts.groupId, @@ -895,9 +910,7 @@ func listDiskPartitionsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -927,6 +940,9 @@ func (opts *listIndexMetricsOpts) preRun() (err error) { } func (opts *listIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } var start *time.Time var errStart error @@ -987,9 +1003,7 @@ func listIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database.`) cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the measurements that MongoDB Atlas reports for the associated data series.`) cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) @@ -1017,6 +1031,9 @@ func (opts *listMetricTypesOpts) preRun() (err error) { } func (opts *listMetricTypesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListMetricTypesApiParams{ ProcessId: opts.processId, @@ -1050,9 +1067,7 @@ func listMetricTypesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index cb0e99e151..5c3cad6a09 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createPeeringConnectionOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, @@ -103,9 +107,7 @@ func createPeeringConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -153,6 +155,9 @@ func (opts *createPeeringContainerOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreatePeeringContainerApiParams{ GroupId: opts.groupId, @@ -188,9 +193,7 @@ func createPeeringContainerBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -210,6 +213,9 @@ func (opts *deletePeeringConnectionOpts) preRun() (err error) { } func (opts *deletePeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeletePeeringConnectionApiParams{ GroupId: opts.groupId, @@ -242,9 +248,7 @@ func deletePeeringConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.`) _ = cmd.MarkFlagRequired("groupId") @@ -264,6 +268,9 @@ func (opts *deletePeeringContainerOpts) preRun() (err error) { } func (opts *deletePeeringContainerOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeletePeeringContainerApiParams{ GroupId: opts.groupId, @@ -296,9 +303,7 @@ func deletePeeringContainerBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("groupId") @@ -346,6 +351,9 @@ func (opts *disablePeeringOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DisablePeeringApiParams{ GroupId: opts.groupId, @@ -381,9 +389,7 @@ func disablePeeringBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -403,6 +409,9 @@ func (opts *getPeeringConnectionOpts) preRun() (err error) { } func (opts *getPeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetPeeringConnectionApiParams{ GroupId: opts.groupId, @@ -435,9 +444,7 @@ func getPeeringConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.`) _ = cmd.MarkFlagRequired("groupId") @@ -457,6 +464,9 @@ func (opts *getPeeringContainerOpts) preRun() (err error) { } func (opts *getPeeringContainerOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetPeeringContainerApiParams{ GroupId: opts.groupId, @@ -489,9 +499,7 @@ func getPeeringContainerBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("groupId") @@ -514,6 +522,9 @@ func (opts *listPeeringConnectionsOpts) preRun() (err error) { } func (opts *listPeeringConnectionsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListPeeringConnectionsApiParams{ GroupId: opts.groupId, @@ -549,9 +560,7 @@ func listPeeringConnectionsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -576,6 +585,9 @@ func (opts *listPeeringContainerByCloudProviderOpts) preRun() (err error) { } func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, @@ -611,9 +623,7 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider that serves the desired network peering containers.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -638,6 +648,9 @@ func (opts *listPeeringContainersOpts) preRun() (err error) { } func (opts *listPeeringContainersOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListPeeringContainersApiParams{ GroupId: opts.groupId, @@ -672,9 +685,7 @@ func listPeeringContainersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -724,6 +735,9 @@ func (opts *updatePeeringConnectionOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdatePeeringConnectionApiParams{ GroupId: opts.groupId, @@ -760,9 +774,7 @@ func updatePeeringConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -813,6 +825,9 @@ func (opts *updatePeeringContainerOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdatePeeringContainerApiParams{ GroupId: opts.groupId, @@ -849,9 +864,7 @@ func updatePeeringContainerBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -872,6 +885,9 @@ func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) preRun() (err erro } func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, @@ -903,9 +919,7 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index daf8a2e827..a4a1c13790 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func createOnlineArchiveBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -130,6 +132,9 @@ func (opts *deleteOnlineArchiveOpts) preRun() (err error) { } func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -163,9 +168,7 @@ func deleteOnlineArchiveBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to delete.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.`) @@ -190,6 +193,9 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { } func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ GroupId: opts.groupId, @@ -225,9 +231,7 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) @@ -251,6 +255,9 @@ func (opts *getOnlineArchiveOpts) preRun() (err error) { } func (opts *getOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -284,9 +291,7 @@ func getOnlineArchiveBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to return.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) @@ -311,6 +316,9 @@ func (opts *listOnlineArchivesOpts) preRun() (err error) { } func (opts *listOnlineArchivesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListOnlineArchivesApiParams{ GroupId: opts.groupId, @@ -346,9 +354,7 @@ func listOnlineArchivesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -401,6 +407,9 @@ func (opts *updateOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -438,9 +447,7 @@ func updateOnlineArchiveBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to update.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index c1a2ab66c6..1b17bbeb16 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -147,6 +148,9 @@ func (opts *createOrganizationInvitationOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -182,7 +186,7 @@ func createOrganizationInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -201,6 +205,9 @@ func (opts *deleteOrganizationOpts) preRun() (err error) { } func (opts *deleteOrganizationOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, @@ -232,7 +239,7 @@ func deleteOrganizationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -250,6 +257,9 @@ func (opts *deleteOrganizationInvitationOpts) preRun() (err error) { } func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.DeleteOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -282,7 +292,7 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("orgId") @@ -301,6 +311,9 @@ func (opts *getOrganizationOpts) preRun() (err error) { } func (opts *getOrganizationOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, @@ -332,7 +345,7 @@ func getOrganizationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -350,6 +363,9 @@ func (opts *getOrganizationInvitationOpts) preRun() (err error) { } func (opts *getOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -382,7 +398,7 @@ func getOrganizationInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("orgId") @@ -401,6 +417,9 @@ func (opts *getOrganizationSettingsOpts) preRun() (err error) { } func (opts *getOrganizationSettingsOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, @@ -432,7 +451,7 @@ func getOrganizationSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("orgId") return cmd @@ -450,6 +469,9 @@ func (opts *listOrganizationInvitationsOpts) preRun() (err error) { } func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListOrganizationInvitationsApiParams{ OrgId: opts.orgId, @@ -482,7 +504,7 @@ func listOrganizationInvitationsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.`) _ = cmd.MarkFlagRequired("orgId") @@ -504,6 +526,9 @@ func (opts *listOrganizationProjectsOpts) preRun() (err error) { } func (opts *listOrganizationProjectsOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListOrganizationProjectsApiParams{ OrgId: opts.orgId, @@ -539,7 +564,7 @@ func listOrganizationProjectsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -563,6 +588,9 @@ func (opts *listOrganizationUsersOpts) preRun() (err error) { } func (opts *listOrganizationUsersOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListOrganizationUsersApiParams{ OrgId: opts.orgId, @@ -597,7 +625,7 @@ func listOrganizationUsersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -674,6 +702,9 @@ func (opts *removeOrganizationUserOpts) preRun() (err error) { } func (opts *removeOrganizationUserOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.RemoveOrganizationUserApiParams{ OrgId: opts.orgId, @@ -706,7 +737,7 @@ func removeOrganizationUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to be deleted.`) _ = cmd.MarkFlagRequired("orgId") @@ -754,6 +785,9 @@ func (opts *renameOrganizationOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, @@ -789,7 +823,7 @@ func renameOrganizationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -837,6 +871,9 @@ func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -872,7 +909,7 @@ func updateOrganizationInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -921,6 +958,9 @@ func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, w io. if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.UpdateOrganizationInvitationByIdApiParams{ OrgId: opts.orgId, @@ -957,7 +997,7 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1008,6 +1048,9 @@ func (opts *updateOrganizationRolesOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.UpdateOrganizationRolesApiParams{ OrgId: opts.orgId, @@ -1044,7 +1087,7 @@ func updateOrganizationRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1094,6 +1137,9 @@ func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, w io.Writer if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, @@ -1129,7 +1175,7 @@ func updateOrganizationSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index ed8aa793b1..79ce2ae27d 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -22,6 +22,7 @@ import ( "fmt" "io" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -37,6 +38,9 @@ func (opts *disableSlowOperationThresholdingOpts) preRun() (err error) { } func (opts *disableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, @@ -58,9 +62,7 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -77,6 +79,9 @@ func (opts *enableSlowOperationThresholdingOpts) preRun() (err error) { } func (opts *enableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, @@ -98,9 +103,7 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -122,6 +125,9 @@ func (opts *listSlowQueriesOpts) preRun() (err error) { } func (opts *listSlowQueriesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListSlowQueriesApiParams{ GroupId: opts.groupId, @@ -158,9 +164,7 @@ func listSlowQueriesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds slow queries among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. @@ -192,6 +196,9 @@ func (opts *listSlowQueryNamespacesOpts) preRun() (err error) { } func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListSlowQueryNamespacesApiParams{ GroupId: opts.groupId, @@ -226,9 +233,7 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. @@ -264,6 +269,9 @@ func (opts *listSuggestedIndexesOpts) preRun() (err error) { } func (opts *listSuggestedIndexesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListSuggestedIndexesApiParams{ GroupId: opts.groupId, @@ -304,9 +312,7 @@ func listSuggestedIndexesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 0d7d8690ee..92170ae02f 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -70,6 +71,9 @@ func (opts *createPrivateEndpointOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreatePrivateEndpointApiParams{ GroupId: opts.groupId, @@ -107,9 +111,7 @@ func createPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.`) @@ -161,6 +163,9 @@ func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -196,9 +201,7 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -220,6 +223,9 @@ func (opts *deletePrivateEndpointOpts) preRun() (err error) { } func (opts *deletePrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeletePrivateEndpointApiParams{ GroupId: opts.groupId, @@ -254,9 +260,7 @@ func deletePrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.`) @@ -281,6 +285,9 @@ func (opts *deletePrivateEndpointServiceOpts) preRun() (err error) { } func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeletePrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -314,9 +321,7 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.`) @@ -340,6 +345,9 @@ func (opts *getPrivateEndpointOpts) preRun() (err error) { } func (opts *getPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -374,9 +382,7 @@ func getPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.`) @@ -401,6 +407,9 @@ func (opts *getPrivateEndpointServiceOpts) preRun() (err error) { } func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetPrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -434,9 +443,7 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.`) @@ -457,6 +464,9 @@ func (opts *getRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { } func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, @@ -488,9 +498,7 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -508,6 +516,9 @@ func (opts *listPrivateEndpointServicesOpts) preRun() (err error) { } func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListPrivateEndpointServicesApiParams{ GroupId: opts.groupId, @@ -540,9 +551,7 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) _ = cmd.MarkFlagRequired("groupId") @@ -590,6 +599,9 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Contex if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ToggleRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, @@ -625,9 +637,7 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index c78b331358..a9033aaceb 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *addProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.AddProjectApiKeyApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func addProjectApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -157,6 +159,9 @@ func (opts *createApiKeyOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, @@ -192,7 +197,7 @@ func createApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -244,6 +249,9 @@ func (opts *createApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.CreateApiKeyAccessListApiParams{ OrgId: opts.orgId, @@ -284,7 +292,7 @@ func createApiKeyAccessListBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -337,6 +345,9 @@ func (opts *createProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, @@ -372,9 +383,7 @@ func createProjectApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -394,6 +403,9 @@ func (opts *deleteApiKeyOpts) preRun() (err error) { } func (opts *deleteApiKeyOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.DeleteApiKeyApiParams{ OrgId: opts.orgId, @@ -426,7 +438,7 @@ func deleteApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key.`) _ = cmd.MarkFlagRequired("orgId") @@ -447,6 +459,9 @@ func (opts *deleteApiKeyAccessListEntryOpts) preRun() (err error) { } func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.DeleteApiKeyAccessListEntryApiParams{ OrgId: opts.orgId, @@ -480,7 +495,7 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) @@ -502,6 +517,9 @@ func (opts *getApiKeyOpts) preRun() (err error) { } func (opts *getApiKeyOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetApiKeyApiParams{ OrgId: opts.orgId, @@ -534,7 +552,7 @@ func getApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.`) _ = cmd.MarkFlagRequired("orgId") @@ -555,6 +573,9 @@ func (opts *getApiKeyAccessListOpts) preRun() (err error) { } func (opts *getApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetApiKeyAccessListApiParams{ OrgId: opts.orgId, @@ -588,7 +609,7 @@ func getApiKeyAccessListBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.`) @@ -613,6 +634,9 @@ func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { } func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListApiKeyAccessListsEntriesApiParams{ OrgId: opts.orgId, @@ -648,7 +672,7 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -673,6 +697,9 @@ func (opts *listApiKeysOpts) preRun() (err error) { } func (opts *listApiKeysOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListApiKeysApiParams{ OrgId: opts.orgId, @@ -707,7 +734,7 @@ func listApiKeysBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -730,6 +757,9 @@ func (opts *listProjectApiKeysOpts) preRun() (err error) { } func (opts *listProjectApiKeysOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListProjectApiKeysApiParams{ GroupId: opts.groupId, @@ -764,9 +794,7 @@ func listProjectApiKeysBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -787,6 +815,9 @@ func (opts *removeProjectApiKeyOpts) preRun() (err error) { } func (opts *removeProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.RemoveProjectApiKeyApiParams{ GroupId: opts.groupId, @@ -819,9 +850,7 @@ func removeProjectApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) _ = cmd.MarkFlagRequired("groupId") @@ -870,6 +899,9 @@ func (opts *updateApiKeyOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.UpdateApiKeyApiParams{ OrgId: opts.orgId, @@ -906,7 +938,7 @@ func updateApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key you want to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -960,6 +992,9 @@ func (opts *updateApiKeyRolesOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateApiKeyRolesApiParams{ GroupId: opts.groupId, @@ -1000,9 +1035,7 @@ func updateApiKeyRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 280ef7a77d..07d4a89d78 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -71,6 +72,9 @@ func (opts *createProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateProjectIpAccessListApiParams{ GroupId: opts.groupId, @@ -110,9 +114,7 @@ func createProjectIpAccessListBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -135,6 +137,9 @@ func (opts *deleteProjectIpAccessListOpts) preRun() (err error) { } func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteProjectIpAccessListApiParams{ GroupId: opts.groupId, @@ -167,9 +172,7 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: - how your application established the connection, @@ -193,6 +196,9 @@ func (opts *getProjectIpAccessListStatusOpts) preRun() (err error) { } func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetProjectIpAccessListStatusApiParams{ GroupId: opts.groupId, @@ -225,9 +231,7 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Network address or cloud provider security construct that identifies which project access list entry to be verified.`) _ = cmd.MarkFlagRequired("groupId") @@ -247,6 +251,9 @@ func (opts *getProjectIpListOpts) preRun() (err error) { } func (opts *getProjectIpListOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetProjectIpListApiParams{ GroupId: opts.groupId, @@ -279,9 +286,7 @@ func getProjectIpListBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).`) _ = cmd.MarkFlagRequired("groupId") @@ -303,6 +308,9 @@ func (opts *listProjectIpAccessListsOpts) preRun() (err error) { } func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListProjectIpAccessListsApiParams{ GroupId: opts.groupId, @@ -337,9 +345,7 @@ func listProjectIpAccessListsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 627b308f68..6bdd6d5b61 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -151,6 +152,9 @@ func (opts *createProjectInvitationOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateProjectInvitationApiParams{ GroupId: opts.groupId, @@ -186,9 +190,7 @@ func createProjectInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -207,6 +209,9 @@ func (opts *deleteProjectOpts) preRun() (err error) { } func (opts *deleteProjectOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, @@ -238,9 +243,7 @@ func deleteProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -258,6 +261,9 @@ func (opts *deleteProjectInvitationOpts) preRun() (err error) { } func (opts *deleteProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteProjectInvitationApiParams{ GroupId: opts.groupId, @@ -290,9 +296,7 @@ func deleteProjectInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("groupId") @@ -312,6 +316,9 @@ func (opts *deleteProjectLimitOpts) preRun() (err error) { } func (opts *deleteProjectLimitOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteProjectLimitApiParams{ LimitName: opts.limitName, @@ -361,9 +368,7 @@ func deleteProjectLimitBuilder() *cobra.Command { | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -381,6 +386,9 @@ func (opts *getProjectOpts) preRun() (err error) { } func (opts *getProjectOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetProjectApiParams{ GroupId: opts.groupId, @@ -412,9 +420,7 @@ func getProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -480,6 +486,9 @@ func (opts *getProjectInvitationOpts) preRun() (err error) { } func (opts *getProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetProjectInvitationApiParams{ GroupId: opts.groupId, @@ -512,9 +521,7 @@ func getProjectInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("groupId") @@ -534,6 +541,9 @@ func (opts *getProjectLimitOpts) preRun() (err error) { } func (opts *getProjectLimitOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetProjectLimitApiParams{ LimitName: opts.limitName, @@ -583,9 +593,7 @@ func getProjectLimitBuilder() *cobra.Command { | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -603,6 +611,9 @@ func (opts *getProjectSettingsOpts) preRun() (err error) { } func (opts *getProjectSettingsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, @@ -634,9 +645,7 @@ func getProjectSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -654,6 +663,9 @@ func (opts *listProjectInvitationsOpts) preRun() (err error) { } func (opts *listProjectInvitationsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListProjectInvitationsApiParams{ GroupId: opts.groupId, @@ -686,9 +698,7 @@ func listProjectInvitationsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this project.`) _ = cmd.MarkFlagRequired("groupId") @@ -706,6 +716,9 @@ func (opts *listProjectLimitsOpts) preRun() (err error) { } func (opts *listProjectLimitsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, @@ -737,9 +750,7 @@ func listProjectLimitsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -761,6 +772,9 @@ func (opts *listProjectUsersOpts) preRun() (err error) { } func (opts *listProjectUsersOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListProjectUsersApiParams{ GroupId: opts.groupId, @@ -797,9 +811,7 @@ func listProjectUsersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -875,6 +887,9 @@ func (opts *removeProjectUserOpts) preRun() (err error) { } func (opts *removeProjectUserOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.RemoveProjectUserApiParams{ GroupId: opts.groupId, @@ -897,9 +912,7 @@ func removeProjectUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.`) _ = cmd.MarkFlagRequired("groupId") @@ -948,6 +961,9 @@ func (opts *setProjectLimitOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.SetProjectLimitApiParams{ LimitName: opts.limitName, @@ -1001,9 +1017,7 @@ func setProjectLimitBuilder() *cobra.Command { | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1052,6 +1066,9 @@ func (opts *updateProjectOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, @@ -1087,9 +1104,7 @@ func updateProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1137,6 +1152,9 @@ func (opts *updateProjectInvitationOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateProjectInvitationApiParams{ GroupId: opts.groupId, @@ -1172,9 +1190,7 @@ func updateProjectInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1223,6 +1239,9 @@ func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateProjectInvitationByIdApiParams{ GroupId: opts.groupId, @@ -1259,9 +1278,7 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1312,6 +1329,9 @@ func (opts *updateProjectRolesOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateProjectRolesApiParams{ GroupId: opts.groupId, @@ -1348,9 +1368,7 @@ func updateProjectRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1400,6 +1418,9 @@ func (opts *updateProjectSettingsOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateProjectSettingsApiParams{ GroupId: opts.groupId, @@ -1435,9 +1456,7 @@ func updateProjectSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index e2e9c2066d..3f88e74281 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, _ io.W if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreatePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -93,9 +97,7 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -114,6 +116,9 @@ func (opts *deletePushBasedLogConfigurationOpts) preRun() (err error) { } func (opts *deletePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeletePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -135,9 +140,7 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -154,6 +157,9 @@ func (opts *getPushBasedLogConfigurationOpts) preRun() (err error) { } func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetPushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -185,9 +191,7 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -233,6 +237,9 @@ func (opts *updatePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.W if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdatePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -258,9 +265,7 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 3a4132f206..9433079a06 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createRollingIndexOpts) run(ctx context.Context, _ io.Writer) error if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateRollingIndexApiParams{ GroupId: opts.groupId, @@ -95,9 +99,7 @@ func createRollingIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index ab42737bde..1de1058aa7 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *createServerlessInstanceOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -103,9 +107,7 @@ func createServerlessInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -125,6 +127,9 @@ func (opts *deleteServerlessInstanceOpts) preRun() (err error) { } func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -157,9 +162,7 @@ func deleteServerlessInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("groupId") @@ -179,6 +182,9 @@ func (opts *getServerlessInstanceOpts) preRun() (err error) { } func (opts *getServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -211,9 +217,7 @@ func getServerlessInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("groupId") @@ -235,6 +239,9 @@ func (opts *listServerlessInstancesOpts) preRun() (err error) { } func (opts *listServerlessInstancesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListServerlessInstancesApiParams{ GroupId: opts.groupId, @@ -269,9 +276,7 @@ func listServerlessInstancesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -321,6 +326,9 @@ func (opts *updateServerlessInstanceOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -357,9 +365,7 @@ func updateServerlessInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index c565279cf8..04457a997a 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, w io.W if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -130,6 +132,9 @@ func (opts *deleteServerlessPrivateEndpointOpts) preRun() (err error) { } func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -163,9 +168,7 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.`) @@ -188,6 +191,9 @@ func (opts *getServerlessPrivateEndpointOpts) preRun() (err error) { } func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -221,9 +227,7 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint.`) @@ -245,6 +249,9 @@ func (opts *listServerlessPrivateEndpointsOpts) preRun() (err error) { } func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListServerlessPrivateEndpointsApiParams{ GroupId: opts.groupId, @@ -277,9 +284,7 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) _ = cmd.MarkFlagRequired("groupId") @@ -329,6 +334,9 @@ func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, w io.W if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -366,9 +374,7 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.`) diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index 88bcdc94e3..f9e2198230 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, @@ -106,9 +110,7 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -130,6 +132,9 @@ func (opts *getSharedClusterBackupRestoreJobOpts) preRun() (err error) { } func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, @@ -164,9 +169,7 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) _ = cmd.MarkFlagRequired("clusterName") @@ -187,6 +190,9 @@ func (opts *listSharedClusterBackupRestoreJobsOpts) preRun() (err error) { } func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListSharedClusterBackupRestoreJobsApiParams{ ClusterName: opts.clusterName, @@ -220,9 +226,7 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index f19b6df847..acd40500b8 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DownloadSharedClusterBackupApiParams{ ClusterName: opts.clusterName, @@ -106,9 +110,7 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -130,6 +132,9 @@ func (opts *getSharedClusterBackupOpts) preRun() (err error) { } func (opts *getSharedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetSharedClusterBackupApiParams{ GroupId: opts.groupId, @@ -163,9 +168,7 @@ func getSharedClusterBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -187,6 +190,9 @@ func (opts *listSharedClusterBackupsOpts) preRun() (err error) { } func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListSharedClusterBackupsApiParams{ GroupId: opts.groupId, @@ -219,9 +225,7 @@ func listSharedClusterBackupsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index 506da32fe6..c24739724a 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createStreamConnectionOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateStreamConnectionApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func createStreamConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -157,6 +159,9 @@ func (opts *createStreamInstanceOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateStreamInstanceApiParams{ GroupId: opts.groupId, @@ -192,9 +197,7 @@ func createStreamInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -215,6 +218,9 @@ func (opts *deleteStreamConnectionOpts) preRun() (err error) { } func (opts *deleteStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteStreamConnectionApiParams{ GroupId: opts.groupId, @@ -248,9 +254,7 @@ func deleteStreamConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) @@ -272,6 +276,9 @@ func (opts *deleteStreamInstanceOpts) preRun() (err error) { } func (opts *deleteStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteStreamInstanceApiParams{ GroupId: opts.groupId, @@ -304,9 +311,7 @@ func deleteStreamInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to delete.`) _ = cmd.MarkFlagRequired("groupId") @@ -327,6 +332,9 @@ func (opts *getStreamConnectionOpts) preRun() (err error) { } func (opts *getStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetStreamConnectionApiParams{ GroupId: opts.groupId, @@ -360,9 +368,7 @@ func getStreamConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection to return.`) @@ -385,6 +391,9 @@ func (opts *getStreamInstanceOpts) preRun() (err error) { } func (opts *getStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetStreamInstanceApiParams{ GroupId: opts.groupId, @@ -418,9 +427,7 @@ func getStreamInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().BoolVar(&opts.includeConnections, "includeConnections", false, `Flag to indicate whether connections information should be included in the stream instance.`) @@ -443,6 +450,9 @@ func (opts *listStreamConnectionsOpts) preRun() (err error) { } func (opts *listStreamConnectionsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListStreamConnectionsApiParams{ GroupId: opts.groupId, @@ -477,9 +487,7 @@ func listStreamConnectionsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -502,6 +510,9 @@ func (opts *listStreamInstancesOpts) preRun() (err error) { } func (opts *listStreamInstancesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListStreamInstancesApiParams{ GroupId: opts.groupId, @@ -535,9 +546,7 @@ func listStreamInstancesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -587,6 +596,9 @@ func (opts *updateStreamConnectionOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateStreamConnectionApiParams{ GroupId: opts.groupId, @@ -624,9 +636,7 @@ func updateStreamConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) @@ -679,6 +689,9 @@ func (opts *updateStreamInstanceOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateStreamInstanceApiParams{ GroupId: opts.groupId, @@ -715,9 +728,7 @@ func updateStreamInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index d6ba51b8a0..4897e99f0e 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -68,6 +69,9 @@ func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.AddAllTeamsToProjectApiParams{ GroupId: opts.groupId, @@ -103,9 +107,7 @@ func addAllTeamsToProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -154,6 +156,9 @@ func (opts *addTeamUserOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.AddTeamUserApiParams{ OrgId: opts.orgId, @@ -190,7 +195,7 @@ func addTeamUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -240,6 +245,9 @@ func (opts *createTeamOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.CreateTeamApiParams{ OrgId: opts.orgId, @@ -275,7 +283,7 @@ func createTeamBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -295,6 +303,9 @@ func (opts *deleteTeamOpts) preRun() (err error) { } func (opts *deleteTeamOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.DeleteTeamApiParams{ OrgId: opts.orgId, @@ -327,7 +338,7 @@ func deleteTeamBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to delete.`) _ = cmd.MarkFlagRequired("orgId") @@ -347,6 +358,9 @@ func (opts *getTeamByIdOpts) preRun() (err error) { } func (opts *getTeamByIdOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetTeamByIdApiParams{ OrgId: opts.orgId, @@ -379,7 +393,7 @@ func getTeamByIdBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose information you want to return.`) _ = cmd.MarkFlagRequired("orgId") @@ -399,6 +413,9 @@ func (opts *getTeamByNameOpts) preRun() (err error) { } func (opts *getTeamByNameOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.GetTeamByNameApiParams{ OrgId: opts.orgId, @@ -431,7 +448,7 @@ func getTeamByNameBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamName, "teamName", "", `Name of the team whose information you want to return.`) _ = cmd.MarkFlagRequired("orgId") @@ -453,6 +470,9 @@ func (opts *listOrganizationTeamsOpts) preRun() (err error) { } func (opts *listOrganizationTeamsOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListOrganizationTeamsApiParams{ OrgId: opts.orgId, @@ -487,7 +507,7 @@ func listOrganizationTeamsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -510,6 +530,9 @@ func (opts *listProjectTeamsOpts) preRun() (err error) { } func (opts *listProjectTeamsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListProjectTeamsApiParams{ GroupId: opts.groupId, @@ -544,9 +567,7 @@ func listProjectTeamsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -569,6 +590,9 @@ func (opts *listTeamUsersOpts) preRun() (err error) { } func (opts *listTeamUsersOpts) run(ctx context.Context, w io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.ListTeamUsersApiParams{ OrgId: opts.orgId, @@ -603,7 +627,7 @@ func listTeamUsersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose application users you want to return.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -625,6 +649,9 @@ func (opts *removeProjectTeamOpts) preRun() (err error) { } func (opts *removeProjectTeamOpts) run(ctx context.Context, _ io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, @@ -647,9 +674,7 @@ func removeProjectTeamBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.`) _ = cmd.MarkFlagRequired("groupId") @@ -670,6 +695,9 @@ func (opts *removeTeamUserOpts) preRun() (err error) { } func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Writer) error { + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.RemoveTeamUserApiParams{ OrgId: opts.orgId, @@ -693,7 +721,7 @@ func removeTeamUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.`) @@ -744,6 +772,9 @@ func (opts *renameTeamOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.orgId == "" { + opts.orgId = config.OrgID() + } params := &admin.RenameTeamApiParams{ OrgId: opts.orgId, @@ -780,7 +811,7 @@ func renameTeamBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.`) + cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to rename.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -831,6 +862,9 @@ func (opts *updateTeamRolesOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateTeamRolesApiParams{ GroupId: opts.groupId, @@ -867,9 +901,7 @@ func updateTeamRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 655b7dcb23..17fab37e01 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -72,6 +73,9 @@ func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, @@ -113,9 +117,7 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -139,6 +141,9 @@ func (opts *deleteThirdPartyIntegrationOpts) preRun() (err error) { } func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DeleteThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, @@ -172,9 +177,7 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") @@ -193,6 +196,9 @@ func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { } func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.GetThirdPartyIntegrationApiParams{ GroupId: opts.groupId, @@ -225,9 +231,7 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) _ = cmd.MarkFlagRequired("groupId") @@ -249,6 +253,9 @@ func (opts *listThirdPartyIntegrationsOpts) preRun() (err error) { } func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListThirdPartyIntegrationsApiParams{ GroupId: opts.groupId, @@ -283,9 +290,7 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -338,6 +343,9 @@ func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.UpdateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, @@ -379,9 +387,7 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index 959d215068..a6c1eed7ef 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -23,6 +23,7 @@ import ( "io" "os" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -69,6 +70,9 @@ func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, w io.Wri if errData != nil { return errData } + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.CreateDatabaseUserCertificateApiParams{ GroupId: opts.groupId, @@ -105,9 +109,7 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account for whom to create a certificate.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -128,6 +130,9 @@ func (opts *disableCustomerManagedX509Opts) preRun() (err error) { } func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, @@ -159,9 +164,7 @@ func disableCustomerManagedX509Builder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -182,6 +185,9 @@ func (opts *listDatabaseUserCertificatesOpts) preRun() (err error) { } func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, w io.Writer) error { + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } params := &admin.ListDatabaseUserCertificatesApiParams{ GroupId: opts.groupId, @@ -217,9 +223,7 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. - -**NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.`) + cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account whose certificates you want to return.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) diff --git a/tools/openapi-generator/config/atlas-api-changes.yaml b/tools/openapi-generator/config/atlas-api-changes.yaml index ba06789383..6d923b3e40 100644 --- a/tools/openapi-generator/config/atlas-api-changes.yaml +++ b/tools/openapi-generator/config/atlas-api-changes.yaml @@ -2,3 +2,11 @@ paths: "/api/atlas/v2/groups/{groupId}/clusters": post: summary: TEST DESCRIPTION +components: + parameters: + groupId: + description: Unique 24-hexadecimal digit string that identifies your project. + x-group-id: true + orgId: + description: Unique 24-hexadecimal digit string that identifies the organization + x-org-id: true diff --git a/tools/openapi-generator/config/atlas-api-transformed.yaml b/tools/openapi-generator/config/atlas-api-transformed.yaml index b44538fffd..408584910c 100644 --- a/tools/openapi-generator/config/atlas-api-transformed.yaml +++ b/tools/openapi-generator/config/atlas-api-transformed.yaml @@ -14845,13 +14845,7 @@ components: type: string example: PT1M groupId: - description: >- - Unique 24-hexadecimal digit string that identifies your project. Use the - [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all - projects to which the authenticated user has access. - - - **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups. + description: Unique 24-hexadecimal digit string that identifies your project. in: path name: groupId required: true @@ -14861,6 +14855,7 @@ components: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ + x-group-id: true identityProviderId: description: Unique 20-hexadecimal digit string that identifies the identity provider. in: path @@ -14914,9 +14909,6 @@ components: pattern: ^([a-f0-9]{24})$ orgId: description: Unique 24-hexadecimal digit string that identifies the organization - that contains your projects. Use the - [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to - retrieve all organizations to which the authenticated user has access. in: path name: orgId required: true @@ -14926,6 +14918,7 @@ components: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ + x-org-id: true pageNum: description: Number of the page that displays the current set of the total objects that the response returns. diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index a63ab2e976..8d02ac0293 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -12,6 +12,7 @@ import ( "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/config" ) {{#operations}} @@ -72,7 +73,17 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(c return err{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}} } } - {{/isDateTime}}{{/allParams}} + {{/isDateTime}} + {{#vendorExtensions.x-group-id}} + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + {{/vendorExtensions.x-group-id}} + {{#vendorExtensions.x-org-id}} + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + {{/vendorExtensions.x-org-id}}{{/allParams}} params := &admin.{{operationId}}ApiParams{ {{#allParams}} {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: {{^isPathParam}}{{^isDateTime}}&{{/isDateTime}}{{/isPathParam}}{{^isDateTime}}opts.{{/isDateTime}}{{paramName}},{{/isBodyParam}} @@ -142,4 +153,3 @@ func {{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}Builder() *cobra.Comm ) return cmd } - diff --git a/tools/openapi-generator/merge.js b/tools/openapi-generator/merge.js index f3092bde74..eede7f0bed 100644 --- a/tools/openapi-generator/merge.js +++ b/tools/openapi-generator/merge.js @@ -21,6 +21,9 @@ function visit(o, fn) { let toVisit = [{path: null, value: o}]; while (toVisit.length > 0) { const {path, value} = toVisit.pop() + if (value == null) { + continue; + } if (typeof value !== 'object') { fn(path, value); continue; From 916765a16fb7140aaf839126373a5dbd831e6882 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 29 Sep 2023 20:35:37 +0100 Subject: [PATCH 31/44] rename groupId to projectId --- internal/api/api_access_tracking_cmd.go | 4 +- internal/api/api_alert_configurations_cmd.go | 14 ++--- internal/api/api_alerts_cmd.go | 8 +-- internal/api/api_atlas_search_cmd.go | 10 ++-- internal/api/api_auditing_cmd.go | 4 +- internal/api/api_aws_clusters_dns_cmd.go | 4 +- internal/api/api_cloud_backups_cmd.go | 58 +++++++++---------- .../api/api_cloud_migration_service_cmd.go | 10 ++-- internal/api/api_cloud_provider_access_cmd.go | 10 ++-- .../api/api_cluster_outage_simulation_cmd.go | 6 +- internal/api/api_clusters_cmd.go | 28 ++++----- internal/api/api_custom_database_roles_cmd.go | 10 ++-- internal/api/api_data_federation_cmd.go | 28 ++++----- internal/api/api_data_lake_pipelines_cmd.go | 26 ++++----- internal/api/api_database_users_cmd.go | 10 ++-- ..._rest_using_customer_key_management_cmd.go | 4 +- internal/api/api_events_cmd.go | 4 +- internal/api/api_global_clusters_cmd.go | 10 ++-- internal/api/api_ldap_configuration_cmd.go | 10 ++-- internal/api/api_legacy_backup_cmd.go | 20 +++---- .../api/api_legacy_backup_restore_jobs_cmd.go | 2 +- internal/api/api_maintenance_windows__cmd.go | 10 ++-- internal/api/api_monitoring_and_logs_cmd.go | 28 ++++----- internal/api/api_network_peering_cmd.go | 26 ++++----- internal/api/api_online_archive_cmd.go | 12 ++-- internal/api/api_performance_advisor_cmd.go | 10 ++-- .../api/api_private_endpoint_services_cmd.go | 18 +++--- internal/api/api_programmatic_api_keys_cmd.go | 10 ++-- .../api/api_project_ip_access_list_cmd.go | 10 ++-- internal/api/api_projects_cmd.go | 36 ++++++------ internal/api/api_push_based_log_export_cmd.go | 8 +-- internal/api/api_rolling_index_cmd.go | 2 +- internal/api/api_serverless_instances_cmd.go | 10 ++-- .../api_serverless_private_endpoints_cmd.go | 10 ++-- .../api/api_shared_tier_restore_jobs_cmd.go | 6 +- internal/api/api_shared_tier_snapshots_cmd.go | 6 +- internal/api/api_streams_cmd.go | 20 +++---- internal/api/api_teams_cmd.go | 8 +-- .../api/api_third_party_integrations_cmd.go | 10 ++-- internal/api/api_x509_authentication_cmd.go | 6 +- .../config/atlas-api-changes.yaml | 1 + .../config/atlas-api-transformed.yaml | 1 + .../config/go-templates/cmd.mustache | 2 +- 43 files changed, 266 insertions(+), 264 deletions(-) diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index b4c00853cc..686e017c41 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -84,7 +84,7 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.authResult, "authResult", false, `Flag that indicates whether the response returns the successful authentication attempts only.`) cmd.Flags().Int64Var(&opts.end, "end", 0, `Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.`) @@ -154,7 +154,7 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.hostname, "hostname", "", `Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download.`) cmd.Flags().BoolVar(&opts.authResult, "authResult", false, `Flag that indicates whether the response returns the successful authentication attempts only.`) cmd.Flags().Int64Var(&opts.end, "end", 0, `Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds.`) diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index f3c43973dc..a16138cdd9 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -107,7 +107,7 @@ func createAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -152,7 +152,7 @@ func deleteAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") @@ -207,7 +207,7 @@ func getAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") @@ -309,7 +309,7 @@ func listAlertConfigurationsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -371,7 +371,7 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -462,7 +462,7 @@ func toggleAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -552,7 +552,7 @@ func updateAlertConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index 166adbf4f0..66a89a3544 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -109,7 +109,7 @@ func acknowledgeAlertBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -166,7 +166,7 @@ func getAlertBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("groupId") @@ -227,7 +227,7 @@ func listAlertsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -290,7 +290,7 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index 256b9f9a65..c07404651d 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -109,7 +109,7 @@ func createAtlasSearchIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection on which to create an Atlas Search index.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -168,7 +168,7 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the database and collection with one or more Application Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) @@ -227,7 +227,7 @@ func getAtlasSearchIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.`) @@ -288,7 +288,7 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Name of the collection that contains one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) @@ -382,7 +382,7 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection whose Atlas Search index to update.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index c04687f18c..788fe4d019 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -74,7 +74,7 @@ func getAuditingConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -158,7 +158,7 @@ func updateAuditingConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index e192e8683f..784dc66ffc 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -74,7 +74,7 @@ func getAWSCustomDNSBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -158,7 +158,7 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 7908bcc072..9bf0bd8354 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -78,7 +78,7 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to remove.`) @@ -168,7 +168,7 @@ func createBackupExportJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -258,7 +258,7 @@ func createBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -346,7 +346,7 @@ func createExportBucketBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -434,7 +434,7 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance whose snapshot you want to restore.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -491,7 +491,7 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -546,7 +546,7 @@ func deleteExportBucketBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("groupId") @@ -603,7 +603,7 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -662,7 +662,7 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -721,7 +721,7 @@ func getBackupExportJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.exportId, "exportId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) @@ -780,7 +780,7 @@ func getBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) @@ -837,7 +837,7 @@ func getBackupScheduleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -890,7 +890,7 @@ func getDataProtectionSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -943,7 +943,7 @@ func getExportBucketBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("groupId") @@ -1000,7 +1000,7 @@ func getReplicaSetBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -1059,7 +1059,7 @@ func getServerlessBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -1118,7 +1118,7 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) @@ -1177,7 +1177,7 @@ func getShardedClusterBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -1240,7 +1240,7 @@ func listBackupExportJobsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1304,7 +1304,7 @@ func listBackupRestoreJobsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1366,7 +1366,7 @@ func listExportBucketsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -1428,7 +1428,7 @@ func listReplicaSetBackupsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1492,7 +1492,7 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1556,7 +1556,7 @@ func listServerlessBackupsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1614,7 +1614,7 @@ func listShardedClusterBackupsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -1702,7 +1702,7 @@ func takeSnapshotBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1792,7 +1792,7 @@ func updateBackupScheduleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1880,7 +1880,7 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1970,7 +1970,7 @@ func updateSnapshotRetentionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 2763a1629c..354ac394c7 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -193,7 +193,7 @@ func createPushMigrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -238,7 +238,7 @@ func cutoverMigrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) _ = cmd.MarkFlagRequired("groupId") @@ -344,7 +344,7 @@ func getPushMigrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) _ = cmd.MarkFlagRequired("groupId") @@ -399,7 +399,7 @@ func getValidationStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) _ = cmd.MarkFlagRequired("groupId") @@ -536,7 +536,7 @@ func validateMigrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index f56b765652..d302c9f79b 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -109,7 +109,7 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -197,7 +197,7 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -244,7 +244,7 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider of the role to deauthorize.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) @@ -301,7 +301,7 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) _ = cmd.MarkFlagRequired("groupId") @@ -354,7 +354,7 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index 41bb82f092..be7aa33acd 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -76,7 +76,7 @@ func endOutageSimulationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) _ = cmd.MarkFlagRequired("groupId") @@ -131,7 +131,7 @@ func getOutageSimulationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) _ = cmd.MarkFlagRequired("groupId") @@ -219,7 +219,7 @@ func startOutageSimulationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to undergo an outage simulation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 1470c0c197..f0646a2a48 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -107,7 +107,7 @@ func createClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -154,7 +154,7 @@ func deleteClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) @@ -210,7 +210,7 @@ func getClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -265,7 +265,7 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -320,7 +320,7 @@ func getClusterStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -375,7 +375,7 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) _ = cmd.MarkFlagRequired("groupId") @@ -438,7 +438,7 @@ func listCloudProviderRegionsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -502,7 +502,7 @@ func listClustersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -612,7 +612,7 @@ func loadSampleDatasetBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) _ = cmd.MarkFlagRequired("groupId") @@ -657,7 +657,7 @@ func testFailoverBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -745,7 +745,7 @@ func updateClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -835,7 +835,7 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -923,7 +923,7 @@ func upgradeSharedClusterBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1009,7 +1009,7 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index aeb810cf85..eb7c869bfc 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -107,7 +107,7 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -152,7 +152,7 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) _ = cmd.MarkFlagRequired("groupId") @@ -207,7 +207,7 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) _ = cmd.MarkFlagRequired("groupId") @@ -260,7 +260,7 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -346,7 +346,7 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index 7f60af4795..53df00639f 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -107,7 +107,7 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -196,7 +196,7 @@ func createFederatedDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -287,7 +287,7 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. @@ -354,7 +354,7 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) _ = cmd.MarkFlagRequired("groupId") @@ -409,7 +409,7 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) _ = cmd.MarkFlagRequired("groupId") @@ -466,7 +466,7 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. @@ -535,7 +535,7 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to download query logs.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) @@ -592,7 +592,7 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) _ = cmd.MarkFlagRequired("groupId") @@ -647,7 +647,7 @@ func getFederatedDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) _ = cmd.MarkFlagRequired("groupId") @@ -706,7 +706,7 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -762,7 +762,7 @@ func listFederatedDatabasesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) _ = cmd.MarkFlagRequired("groupId") @@ -818,7 +818,7 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to which the query limit applies.`) cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this data federation instance limit. @@ -883,7 +883,7 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) _ = cmd.MarkFlagRequired("groupId") @@ -973,7 +973,7 @@ func updateFederatedDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to update.`) cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index d9938545db..153fc76677 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -108,7 +108,7 @@ func createPipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -163,7 +163,7 @@ func deletePipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -220,7 +220,7 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) @@ -277,7 +277,7 @@ func getPipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -334,7 +334,7 @@ func getPipelineRunBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) @@ -408,7 +408,7 @@ func listPipelineRunsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -467,7 +467,7 @@ func listPipelineSchedulesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -539,7 +539,7 @@ func listPipelineSnapshotsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -596,7 +596,7 @@ func listPipelinesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -649,7 +649,7 @@ func pausePipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -704,7 +704,7 @@ func resumePipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("groupId") @@ -792,7 +792,7 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -882,7 +882,7 @@ func updatePipelineBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index 0a5515138a..01dc562e69 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -107,7 +107,7 @@ func createDatabaseUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -164,7 +164,7 @@ func deleteDatabaseUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: @@ -235,7 +235,7 @@ func getDatabaseUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: @@ -308,7 +308,7 @@ func listDatabaseUsersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -399,7 +399,7 @@ func updateDatabaseUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index f3032c8aa0..da1fa19f78 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -74,7 +74,7 @@ func getEncryptionAtRestBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -158,7 +158,7 @@ func updateEncryptionAtRestBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 9f21e6fba2..91961e4e51 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -135,7 +135,7 @@ func getProjectEventBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) @@ -317,7 +317,7 @@ func listProjectEventsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index d16b6fe85d..033dbe6920 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -109,7 +109,7 @@ func createCustomZoneMappingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -199,7 +199,7 @@ func createManagedNamespaceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -256,7 +256,7 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") @@ -316,7 +316,7 @@ func deleteManagedNamespaceBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label that identifies the database that contains the collection.`) cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) @@ -372,7 +372,7 @@ func getManagedNamespaceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 8d1a5d8422..97deb5f86a 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -74,7 +74,7 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -125,7 +125,7 @@ func getLDAPConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -178,7 +178,7 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) _ = cmd.MarkFlagRequired("groupId") @@ -264,7 +264,7 @@ func saveLDAPConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -350,7 +350,7 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 86c5581e47..0cadbbf9c2 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -78,7 +78,7 @@ func deleteLegacySnapshotBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -137,7 +137,7 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the checkpoint.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) @@ -196,7 +196,7 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVar(&opts.jobId, "jobId", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) @@ -255,7 +255,7 @@ func getLegacySnapshotBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -312,7 +312,7 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) _ = cmd.MarkFlagRequired("groupId") @@ -373,7 +373,7 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -439,7 +439,7 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -506,7 +506,7 @@ func listLegacySnapshotsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -600,7 +600,7 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -692,7 +692,7 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index 12659c64cd..93cac71a40 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -109,7 +109,7 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index fdad7548a9..04c1224ec3 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -64,7 +64,7 @@ func deferMaintenanceWindowBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -115,7 +115,7 @@ func getMaintenanceWindowBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -156,7 +156,7 @@ func resetMaintenanceWindowBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -197,7 +197,7 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -281,7 +281,7 @@ func updateMaintenanceWindowBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index f8f66338ec..a6e06c42c8 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -75,7 +75,7 @@ func getAtlasProcessBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("groupId") @@ -132,7 +132,7 @@ func getDatabaseBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -219,7 +219,7 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) @@ -312,7 +312,7 @@ func getDiskMeasurementsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) @@ -381,7 +381,7 @@ func getHostLogsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.hostName, "hostName", "", `Human-readable label that identifies the host that stores the log files that you want to download.`) cmd.Flags().StringVar(&opts.logName, "logName", "", `Human-readable label that identifies the log file that you want to return. To return audit logs, enable *Database Auditing* for the specified project.`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) @@ -468,7 +468,7 @@ func getHostMeasurementsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) cmd.Flags().StringSliceVar(&opts.m, "m", nil, `One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.`) @@ -567,7 +567,7 @@ func getIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.indexName, "indexName", "", `Human-readable label that identifies the index.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database.`) cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the measurements that MongoDB Atlas reports for the associated data series.`) cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) @@ -660,7 +660,7 @@ func getMeasurementsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series.`) cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) @@ -725,7 +725,7 @@ func listAtlasProcessesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -787,7 +787,7 @@ func listDatabasesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -848,7 +848,7 @@ func listDiskMeasurementsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("partitionName") @@ -910,7 +910,7 @@ func listDiskPartitionsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -1003,7 +1003,7 @@ func listIndexMetricsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database.`) cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.granularity, "granularity", "", `Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.`) cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the measurements that MongoDB Atlas reports for the associated data series.`) cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) @@ -1067,7 +1067,7 @@ func listMetricTypesBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index 5c3cad6a09..e67e21417d 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -107,7 +107,7 @@ func createPeeringConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -193,7 +193,7 @@ func createPeeringContainerBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -248,7 +248,7 @@ func deletePeeringConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.`) _ = cmd.MarkFlagRequired("groupId") @@ -303,7 +303,7 @@ func deletePeeringContainerBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("groupId") @@ -389,7 +389,7 @@ func disablePeeringBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -444,7 +444,7 @@ func getPeeringConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.`) _ = cmd.MarkFlagRequired("groupId") @@ -499,7 +499,7 @@ func getPeeringContainerBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("groupId") @@ -560,7 +560,7 @@ func listPeeringConnectionsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -623,7 +623,7 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider that serves the desired network peering containers.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -685,7 +685,7 @@ func listPeeringContainersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -774,7 +774,7 @@ func updatePeeringConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -864,7 +864,7 @@ func updatePeeringContainerBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -919,7 +919,7 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index a4a1c13790..3f9a0be9f3 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -109,7 +109,7 @@ func createOnlineArchiveBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -168,7 +168,7 @@ func deleteOnlineArchiveBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to delete.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.`) @@ -231,7 +231,7 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) @@ -291,7 +291,7 @@ func getOnlineArchiveBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to return.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) @@ -354,7 +354,7 @@ func listOnlineArchivesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -447,7 +447,7 @@ func updateOnlineArchiveBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to update.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index 79ce2ae27d..252761ec62 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -62,7 +62,7 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -103,7 +103,7 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -164,7 +164,7 @@ func listSlowQueriesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds slow queries among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. @@ -233,7 +233,7 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().Int64Var(&opts.duration, "duration", 0, `Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. @@ -312,7 +312,7 @@ func listSuggestedIndexesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 92170ae02f..764413d489 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -111,7 +111,7 @@ func createPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint.`) @@ -201,7 +201,7 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -260,7 +260,7 @@ func deletePrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.`) @@ -321,7 +321,7 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.`) @@ -382,7 +382,7 @@ func getPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.`) @@ -443,7 +443,7 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.`) @@ -498,7 +498,7 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -551,7 +551,7 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) _ = cmd.MarkFlagRequired("groupId") @@ -637,7 +637,7 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index a9033aaceb..0206742d2c 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -109,7 +109,7 @@ func addProjectApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -383,7 +383,7 @@ func createProjectApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -794,7 +794,7 @@ func listProjectApiKeysBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -850,7 +850,7 @@ func removeProjectApiKeyBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) _ = cmd.MarkFlagRequired("groupId") @@ -1035,7 +1035,7 @@ func updateApiKeyRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 07d4a89d78..66dca5d40f 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -114,7 +114,7 @@ func createProjectIpAccessListBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -172,7 +172,7 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: - how your application established the connection, @@ -231,7 +231,7 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Network address or cloud provider security construct that identifies which project access list entry to be verified.`) _ = cmd.MarkFlagRequired("groupId") @@ -286,7 +286,7 @@ func getProjectIpListBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).`) _ = cmd.MarkFlagRequired("groupId") @@ -345,7 +345,7 @@ func listProjectIpAccessListsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 6bdd6d5b61..d3dcec1612 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -190,7 +190,7 @@ func createProjectInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -243,7 +243,7 @@ func deleteProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -296,7 +296,7 @@ func deleteProjectInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("groupId") @@ -368,7 +368,7 @@ func deleteProjectLimitBuilder() *cobra.Command { | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -420,7 +420,7 @@ func getProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -521,7 +521,7 @@ func getProjectInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("groupId") @@ -593,7 +593,7 @@ func getProjectLimitBuilder() *cobra.Command { | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("limitName") _ = cmd.MarkFlagRequired("groupId") @@ -645,7 +645,7 @@ func getProjectSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -698,7 +698,7 @@ func listProjectInvitationsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this project.`) _ = cmd.MarkFlagRequired("groupId") @@ -750,7 +750,7 @@ func listProjectLimitsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -811,7 +811,7 @@ func listProjectUsersBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -912,7 +912,7 @@ func removeProjectUserBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.`) _ = cmd.MarkFlagRequired("groupId") @@ -1017,7 +1017,7 @@ func setProjectLimitBuilder() *cobra.Command { | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| `) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1104,7 +1104,7 @@ func updateProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1190,7 +1190,7 @@ func updateProjectInvitationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1278,7 +1278,7 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1368,7 +1368,7 @@ func updateProjectRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to modify.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1456,7 +1456,7 @@ func updateProjectSettingsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index 3f88e74281..9b8f52acaf 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -97,7 +97,7 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -140,7 +140,7 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -191,7 +191,7 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -265,7 +265,7 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 9433079a06..e261ff51ea 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -99,7 +99,7 @@ func createRollingIndexBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster on which MongoDB Cloud creates an index.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index 1de1058aa7..74cb01ef73 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -107,7 +107,7 @@ func createServerlessInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -162,7 +162,7 @@ func deleteServerlessInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("groupId") @@ -217,7 +217,7 @@ func getServerlessInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("groupId") @@ -276,7 +276,7 @@ func listServerlessInstancesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -365,7 +365,7 @@ func updateServerlessInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index 04457a997a..0d2b6e6918 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -109,7 +109,7 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance for which the tenant endpoint will be created.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -168,7 +168,7 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.`) @@ -227,7 +227,7 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint.`) @@ -284,7 +284,7 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) _ = cmd.MarkFlagRequired("groupId") @@ -374,7 +374,7 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated.`) diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index f9e2198230..01880e83c2 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -110,7 +110,7 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -169,7 +169,7 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) _ = cmd.MarkFlagRequired("clusterName") @@ -226,7 +226,7 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index acd40500b8..51a114a095 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -110,7 +110,7 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -168,7 +168,7 @@ func getSharedClusterBackupBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) @@ -225,7 +225,7 @@ func listSharedClusterBackupsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("groupId") diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index c24739724a..859aa8fb3b 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -109,7 +109,7 @@ func createStreamConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -197,7 +197,7 @@ func createStreamInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -254,7 +254,7 @@ func deleteStreamConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) @@ -311,7 +311,7 @@ func deleteStreamInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to delete.`) _ = cmd.MarkFlagRequired("groupId") @@ -368,7 +368,7 @@ func getStreamConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection to return.`) @@ -427,7 +427,7 @@ func getStreamInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().BoolVar(&opts.includeConnections, "includeConnections", false, `Flag to indicate whether connections information should be included in the stream instance.`) @@ -487,7 +487,7 @@ func listStreamConnectionsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -546,7 +546,7 @@ func listStreamInstancesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -636,7 +636,7 @@ func updateStreamConnectionBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) @@ -728,7 +728,7 @@ func updateStreamInstanceBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to update.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index 4897e99f0e..4804c14749 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -107,7 +107,7 @@ func addAllTeamsToProjectBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -567,7 +567,7 @@ func listProjectTeamsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -674,7 +674,7 @@ func removeProjectTeamBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.`) _ = cmd.MarkFlagRequired("groupId") @@ -901,7 +901,7 @@ func updateTeamRolesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team for which you want to update roles.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 17fab37e01..706918aa97 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -117,7 +117,7 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) @@ -177,7 +177,7 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("integrationType") _ = cmd.MarkFlagRequired("groupId") @@ -231,7 +231,7 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) _ = cmd.MarkFlagRequired("groupId") @@ -290,7 +290,7 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) @@ -387,7 +387,7 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index a6c1eed7ef..9770cf6c19 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -109,7 +109,7 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account for whom to create a certificate.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -164,7 +164,7 @@ func disableCustomerManagedX509Builder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("groupId") return cmd @@ -223,7 +223,7 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { return opts.run(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.groupId, "groupId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.username, "username", "", `Human-readable label that represents the MongoDB database user account whose certificates you want to return.`) cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) diff --git a/tools/openapi-generator/config/atlas-api-changes.yaml b/tools/openapi-generator/config/atlas-api-changes.yaml index 6d923b3e40..bdf5da47f9 100644 --- a/tools/openapi-generator/config/atlas-api-changes.yaml +++ b/tools/openapi-generator/config/atlas-api-changes.yaml @@ -7,6 +7,7 @@ components: groupId: description: Unique 24-hexadecimal digit string that identifies your project. x-group-id: true + x-flag-name: projectId orgId: description: Unique 24-hexadecimal digit string that identifies the organization x-org-id: true diff --git a/tools/openapi-generator/config/atlas-api-transformed.yaml b/tools/openapi-generator/config/atlas-api-transformed.yaml index 408584910c..89c66b779f 100644 --- a/tools/openapi-generator/config/atlas-api-transformed.yaml +++ b/tools/openapi-generator/config/atlas-api-transformed.yaml @@ -14855,6 +14855,7 @@ components: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ + x-flag-name: projectId x-group-id: true identityProviderId: description: Unique 20-hexadecimal digit string that identifies the identity provider. diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 8d02ac0293..46fc08ddd7 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -125,7 +125,7 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C }, } {{#allParams}} - {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{paramName}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, `{{unescapedDescription}}`){{/isBodyParam}} + {{^isBodyParam}}cmd.Flags().{{#isArray}}{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Slice{{/isArray}}{{^isArray}}{{#lambda.titlecase}}{{dataType}}{{/lambda.titlecase}}{{/isArray}}Var(&opts.{{paramName}}, "{{#vendorExtensions.x-flag-name}}{{.}}{{/vendorExtensions.x-flag-name}}{{^vendorExtensions.x-flag-name}}{{paramName}}{{/vendorExtensions.x-flag-name}}", {{#isDateTime}}""{{/isDateTime}}{{#isString}}"{{/isString}}{{^defaultValue}}{{#isArray}}nil{{/isArray}}{{#isNumeric}}0{{/isNumeric}}{{#isInteger}}0{{/isInteger}}{{#isShort}}0{{/isShort}}{{#isLong}}0{{/isLong}}{{#isUnboundedInteger}}0{{/isUnboundedInteger}}{{#isNumber}}0{{/isNumber}}{{#isFloat}}0{{/isFloat}}{{#isDouble}}0{{/isDouble}}{{#isDecimal}}0{{/isDecimal}}{{#isBoolean}}false{{/isBoolean}}{{/defaultValue}}{{defaultValue}}{{#isString}}"{{/isString}}, `{{unescapedDescription}}`){{/isBodyParam}} {{/allParams}} {{#bodyParam}} cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") From 9db143dcaa00cfa4ce1f352c79b4ef6270553778 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Fri, 29 Sep 2023 22:12:23 +0100 Subject: [PATCH 32/44] sdk import --- tools/openapi-generator/config/atlas-api-changes.yaml | 1 + tools/openapi-generator/config/atlas-api-transformed.yaml | 1 + tools/openapi-generator/config/go-templates/cmd.mustache | 2 +- tools/openapi-generator/merge.js | 7 ++++++- tools/openapi-generator/package.json | 4 ++-- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/openapi-generator/config/atlas-api-changes.yaml b/tools/openapi-generator/config/atlas-api-changes.yaml index bdf5da47f9..d4f1c5783a 100644 --- a/tools/openapi-generator/config/atlas-api-changes.yaml +++ b/tools/openapi-generator/config/atlas-api-changes.yaml @@ -1,3 +1,4 @@ +x-sdk-import: ${SDKIMPORT}/admin paths: "/api/atlas/v2/groups/{groupId}/clusters": post: diff --git a/tools/openapi-generator/config/atlas-api-transformed.yaml b/tools/openapi-generator/config/atlas-api-transformed.yaml index 89c66b779f..ecd88472f5 100644 --- a/tools/openapi-generator/config/atlas-api-transformed.yaml +++ b/tools/openapi-generator/config/atlas-api-transformed.yaml @@ -28869,3 +28869,4 @@ components: DigestAuth: scheme: digest type: http +x-sdk-import: go.mongodb.org/atlas-sdk/v20230201008/admin diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 46fc08ddd7..8f14d03ddc 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -11,7 +11,7 @@ import ( "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "{{vendorExtensions.x-sdk-import}}" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/config" ) diff --git a/tools/openapi-generator/merge.js b/tools/openapi-generator/merge.js index eede7f0bed..7d6a98b5b3 100644 --- a/tools/openapi-generator/merge.js +++ b/tools/openapi-generator/merge.js @@ -11,7 +11,12 @@ try { } try { - atlasApiChanges = yaml.parse(fs.readFileSync('config/atlas-api-changes.yaml', 'utf8')); + let f = fs.readFileSync('config/atlas-api-changes.yaml', 'utf8'); + Object.entries(process.env).forEach(entry => { + const [key, value] = entry; + f = f.replaceAll("${" + key + "}", value); + }); + atlasApiChanges = yaml.parse(f); } catch (err) { console.error(err); process.exit(1); diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index d2aad9516c..585f6d2d54 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -4,8 +4,8 @@ "description": "OpenAPI Generator for MongoDB Atlas CLI", "scripts": { "generate:clear": "rm -rf ../../internal/api", - "generate:download": "SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}') curl -L -o config/atlas-api.yaml https://github.com/mongodb/atlas-sdk-go/raw/$SDKVERSION/openapi/atlas-api-transformed.yaml", - "generate:transform": "node merge.js", + "generate:download": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); curl -L -o config/atlas-api.yaml \"https://raw.githubusercontent.com/mongodb/atlas-sdk-go/$SDKVERSION/openapi/atlas-api-transformed.yaml\"", + "generate:transform": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $1}'); node merge.js", "generate:init": "mkdir -p ../../internal/api && cp ./config/.openapi-generator-ignore ../../internal/api/.openapi-generator-ignore", "generate:run": "GO_POST_PROCESS_FILE='goimports -w' openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api", "generate": "npm run generate:clear && npm run generate:init && npm run generate:download && npm run generate:transform && npm run generate:run" From 891c48a367ed5fa257854085908e73d86a332608 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Mon, 2 Oct 2023 10:24:30 +0100 Subject: [PATCH 33/44] fix groupId/orgId validation --- internal/api/api_access_tracking_cmd.go | 42 +- internal/api/api_alert_configurations_cmd.go | 155 +++-- internal/api/api_alerts_cmd.go | 84 ++- internal/api/api_atlas_search_cmd.go | 106 +++- internal/api/api_auditing_cmd.go | 44 +- internal/api/api_aws_clusters_dns_cmd.go | 44 +- internal/api/api_cloud_backups_cmd.go | 598 +++++++++++++----- .../api/api_cloud_migration_service_cmd.go | 168 +++-- internal/api/api_cloud_provider_access_cmd.go | 106 +++- .../api/api_cluster_outage_simulation_cmd.go | 64 +- internal/api/api_clusters_cmd.go | 299 ++++++--- internal/api/api_custom_database_roles_cmd.go | 106 +++- internal/api/api_data_federation_cmd.go | 290 ++++++--- internal/api/api_data_lake_pipelines_cmd.go | 268 ++++++-- internal/api/api_database_users_cmd.go | 106 +++- ..._rest_using_customer_key_management_cmd.go | 44 +- internal/api/api_events_cmd.go | 82 ++- .../api/api_federated_authentication_cmd.go | 189 ++++-- internal/api/api_global_clusters_cmd.go | 106 +++- internal/api/api_invoices_cmd.go | 124 +++- internal/api/api_ldap_configuration_cmd.go | 106 +++- internal/api/api_legacy_backup_cmd.go | 206 ++++-- .../api/api_legacy_backup_restore_jobs_cmd.go | 24 +- internal/api/api_maintenance_windows__cmd.go | 104 ++- internal/api/api_mongo_db_cloud_users_cmd.go | 21 +- internal/api/api_monitoring_and_logs_cmd.go | 282 +++++++-- internal/api/api_network_peering_cmd.go | 272 ++++++-- internal/api/api_online_archive_cmd.go | 126 +++- internal/api/api_organizations_cmd.go | 328 +++++++--- internal/api/api_performance_advisor_cmd.go | 102 ++- .../api/api_private_endpoint_services_cmd.go | 188 ++++-- internal/api/api_programmatic_api_keys_cmd.go | 294 ++++++--- .../api/api_project_ip_access_list_cmd.go | 104 ++- internal/api/api_projects_cmd.go | 397 +++++++++--- internal/api/api_push_based_log_export_cmd.go | 86 ++- internal/api/api_rolling_index_cmd.go | 24 +- internal/api/api_root_cmd.go | 7 +- internal/api/api_serverless_instances_cmd.go | 106 +++- .../api_serverless_private_endpoints_cmd.go | 106 +++- .../api/api_shared_tier_restore_jobs_cmd.go | 64 +- internal/api/api_shared_tier_snapshots_cmd.go | 64 +- internal/api/api_streams_cmd.go | 210 ++++-- internal/api/api_teams_cmd.go | 272 ++++++-- .../api/api_third_party_integrations_cmd.go | 106 +++- internal/api/api_x509_authentication_cmd.go | 64 +- .../config/go-templates/cmd.mustache | 55 +- 46 files changed, 5019 insertions(+), 1724 deletions(-) diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index 686e017c41..0589ccec41 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" @@ -39,14 +41,25 @@ type listAccessLogsByClusterNameOpts struct { } func (opts *listAccessLogsByClusterNameOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListAccessLogsByClusterNameApiParams{ GroupId: opts.groupId, @@ -92,7 +105,6 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -109,14 +121,25 @@ type listAccessLogsByHostnameOpts struct { } func (opts *listAccessLogsByHostnameOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListAccessLogsByHostnameApiParams{ GroupId: opts.groupId, @@ -162,7 +185,6 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostname") return cmd } diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index a16138cdd9..b690754968 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createAlertConfigurationOpts struct { } func (opts *createAlertConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, error) { @@ -69,9 +85,6 @@ func (opts *createAlertConfigurationOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -111,7 +124,6 @@ func createAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -122,14 +134,25 @@ type deleteAlertConfigurationOpts struct { } func (opts *deleteAlertConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteAlertConfigurationOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteAlertConfigurationOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -155,7 +178,6 @@ func deleteAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } @@ -167,14 +189,25 @@ type getAlertConfigurationOpts struct { } func (opts *getAlertConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -210,7 +243,6 @@ func getAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } @@ -220,8 +252,11 @@ type listAlertConfigurationMatchersFieldNamesOpts struct { } func (opts *listAlertConfigurationMatchersFieldNamesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *listAlertConfigurationMatchersFieldNamesOpts) run(ctx context.Context, w io.Writer) error { @@ -267,14 +302,25 @@ type listAlertConfigurationsOpts struct { } func (opts *listAlertConfigurationsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listAlertConfigurationsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listAlertConfigurationsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListAlertConfigurationsApiParams{ GroupId: opts.groupId, @@ -314,7 +360,6 @@ func listAlertConfigurationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -328,14 +373,25 @@ type listAlertConfigurationsByAlertIdOpts struct { } func (opts *listAlertConfigurationsByAlertIdOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListAlertConfigurationsByAlertIdApiParams{ GroupId: opts.groupId, @@ -377,7 +433,6 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } @@ -392,8 +447,22 @@ type toggleAlertConfigurationOpts struct { } func (opts *toggleAlertConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *toggleAlertConfigurationOpts) readData() (*admin.AlertsToggle, error) { @@ -423,9 +492,6 @@ func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.ToggleAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -467,7 +533,6 @@ func toggleAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } @@ -482,8 +547,22 @@ type updateAlertConfigurationOpts struct { } func (opts *updateAlertConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, error) { @@ -513,9 +592,6 @@ func (opts *updateAlertConfigurationOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -557,7 +633,6 @@ func updateAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index 66a89a3544..ff8e590794 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type acknowledgeAlertOpts struct { } func (opts *acknowledgeAlertOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *acknowledgeAlertOpts) readData() (*admin.AlertViewForNdsGroup, error) { @@ -70,9 +86,6 @@ func (opts *acknowledgeAlertOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.AcknowledgeAlertApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func acknowledgeAlertBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } @@ -126,14 +138,25 @@ type getAlertOpts struct { } func (opts *getAlertOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getAlertOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getAlertOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetAlertApiParams{ GroupId: opts.groupId, @@ -169,7 +192,6 @@ func getAlertBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertId") return cmd } @@ -184,14 +206,25 @@ type listAlertsOpts struct { } func (opts *listAlertsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listAlertsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listAlertsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListAlertsApiParams{ GroupId: opts.groupId, @@ -233,7 +266,6 @@ func listAlertsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.status, "status", "", `Status of the alerts to return. Omit to return all alerts in all statuses.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -247,14 +279,25 @@ type listAlertsByAlertConfigurationIdOpts struct { } func (opts *listAlertsByAlertConfigurationIdOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListAlertsByAlertConfigurationIdApiParams{ GroupId: opts.groupId, @@ -296,7 +339,6 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("alertConfigId") return cmd } diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index c07404651d..ba1976a8d5 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createAtlasSearchIndexOpts struct { } func (opts *createAtlasSearchIndexOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, error) { @@ -70,9 +86,6 @@ func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func createAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -127,14 +139,25 @@ type deleteAtlasSearchIndexOpts struct { } func (opts *deleteAtlasSearchIndexOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -172,7 +195,6 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the database and collection with one or more Application Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd @@ -186,14 +208,25 @@ type getAtlasSearchIndexOpts struct { } func (opts *getAtlasSearchIndexOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -231,7 +264,6 @@ func getAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Name of the cluster that contains the collection with one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.indexId, "indexId", "", `Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd @@ -246,14 +278,25 @@ type listAtlasSearchIndexesOpts struct { } func (opts *listAtlasSearchIndexesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListAtlasSearchIndexesApiParams{ GroupId: opts.groupId, @@ -293,7 +336,6 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Name of the collection that contains one or more Atlas Search indexes.`) cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("databaseName") @@ -311,8 +353,22 @@ type updateAtlasSearchIndexOpts struct { } func (opts *updateAtlasSearchIndexOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, error) { @@ -342,9 +398,6 @@ func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -388,7 +441,6 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") return cmd diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 788fe4d019..292b0b9eac 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -35,14 +37,25 @@ type getAuditingConfigurationOpts struct { } func (opts *getAuditingConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getAuditingConfigurationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getAuditingConfigurationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, @@ -76,7 +89,6 @@ func getAuditingConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -89,8 +101,22 @@ type updateAuditingConfigurationOpts struct { } func (opts *updateAuditingConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateAuditingConfigurationOpts) readData() (*admin.AuditLog, error) { @@ -120,9 +146,6 @@ func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateAuditingConfigurationApiParams{ GroupId: opts.groupId, @@ -162,7 +185,6 @@ func updateAuditingConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index 784dc66ffc..778bedf1a1 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -35,14 +37,25 @@ type getAWSCustomDNSOpts struct { } func (opts *getAWSCustomDNSOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, @@ -76,7 +89,6 @@ func getAWSCustomDNSBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -89,8 +101,22 @@ type toggleAWSCustomDNSOpts struct { } func (opts *toggleAWSCustomDNSOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *toggleAWSCustomDNSOpts) readData() (*admin.AWSCustomDNSEnabled, error) { @@ -120,9 +146,6 @@ func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.ToggleAWSCustomDNSApiParams{ GroupId: opts.groupId, @@ -162,7 +185,6 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 9bf0bd8354..34d7225146 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -37,14 +39,25 @@ type cancelBackupRestoreJobOpts struct { } func (opts *cancelBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { params := &admin.CancelBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -82,7 +95,6 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to remove.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd @@ -98,8 +110,22 @@ type createBackupExportJobOpts struct { } func (opts *createBackupExportJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createBackupExportJobOpts) readData() (*admin.DiskBackupExportJobRequest, error) { @@ -129,9 +155,6 @@ func (opts *createBackupExportJobOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateBackupExportJobApiParams{ GroupId: opts.groupId, @@ -173,7 +196,6 @@ func createBackupExportJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -188,8 +210,22 @@ type createBackupRestoreJobOpts struct { } func (opts *createBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createBackupRestoreJobOpts) readData() (*admin.DiskBackupSnapshotRestoreJob, error) { @@ -219,9 +255,6 @@ func (opts *createBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -263,7 +296,6 @@ func createBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -277,8 +309,22 @@ type createExportBucketOpts struct { } func (opts *createExportBucketOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createExportBucketOpts) readData() (*admin.DiskBackupSnapshotAWSExportBucket, error) { @@ -308,9 +354,6 @@ func (opts *createExportBucketOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateExportBucketApiParams{ GroupId: opts.groupId, @@ -350,7 +393,6 @@ func createExportBucketBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -364,8 +406,22 @@ type createServerlessBackupRestoreJobOpts struct { } func (opts *createServerlessBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createServerlessBackupRestoreJobOpts) readData() (*admin.ServerlessBackupRestoreJob, error) { @@ -395,9 +451,6 @@ func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, w io. if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -439,7 +492,6 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -451,14 +503,25 @@ type deleteAllBackupSchedulesOpts struct { } func (opts *deleteAllBackupSchedulesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteAllBackupSchedulesApiParams{ GroupId: opts.groupId, @@ -494,7 +557,6 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -506,14 +568,25 @@ type deleteExportBucketOpts struct { } func (opts *deleteExportBucketOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteExportBucketOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteExportBucketOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteExportBucketApiParams{ GroupId: opts.groupId, @@ -549,7 +622,6 @@ func deleteExportBucketBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") return cmd } @@ -562,14 +634,25 @@ type deleteReplicaSetBackupOpts struct { } func (opts *deleteReplicaSetBackupOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteReplicaSetBackupApiParams{ GroupId: opts.groupId, @@ -607,7 +690,6 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -621,14 +703,25 @@ type deleteShardedClusterBackupOpts struct { } func (opts *deleteShardedClusterBackupOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteShardedClusterBackupApiParams{ GroupId: opts.groupId, @@ -666,7 +759,6 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -680,14 +772,25 @@ type getBackupExportJobOpts struct { } func (opts *getBackupExportJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getBackupExportJobOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getBackupExportJobOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetBackupExportJobApiParams{ GroupId: opts.groupId, @@ -725,7 +828,6 @@ func getBackupExportJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.exportId, "exportId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("exportId") return cmd @@ -739,14 +841,25 @@ type getBackupRestoreJobOpts struct { } func (opts *getBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -784,7 +897,6 @@ func getBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the restore jobs you want to return.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd @@ -797,14 +909,25 @@ type getBackupScheduleOpts struct { } func (opts *getBackupScheduleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getBackupScheduleOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getBackupScheduleOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetBackupScheduleApiParams{ GroupId: opts.groupId, @@ -840,7 +963,6 @@ func getBackupScheduleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -851,14 +973,25 @@ type getDataProtectionSettingsOpts struct { } func (opts *getDataProtectionSettingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, @@ -892,7 +1025,6 @@ func getDataProtectionSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -903,14 +1035,25 @@ type getExportBucketOpts struct { } func (opts *getExportBucketOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getExportBucketOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getExportBucketOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetExportBucketApiParams{ GroupId: opts.groupId, @@ -946,7 +1089,6 @@ func getExportBucketBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("exportBucketId") return cmd } @@ -959,14 +1101,25 @@ type getReplicaSetBackupOpts struct { } func (opts *getReplicaSetBackupOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetReplicaSetBackupApiParams{ GroupId: opts.groupId, @@ -1004,7 +1157,6 @@ func getReplicaSetBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -1018,14 +1170,25 @@ type getServerlessBackupOpts struct { } func (opts *getServerlessBackupOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getServerlessBackupOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getServerlessBackupOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetServerlessBackupApiParams{ GroupId: opts.groupId, @@ -1063,7 +1226,6 @@ func getServerlessBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -1077,14 +1239,25 @@ type getServerlessBackupRestoreJobOpts struct { } func (opts *getServerlessBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -1122,7 +1295,6 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the serverless instance.`) cmd.Flags().StringVar(&opts.restoreJobId, "restoreJobId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") return cmd @@ -1136,14 +1308,25 @@ type getShardedClusterBackupOpts struct { } func (opts *getShardedClusterBackupOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetShardedClusterBackupApiParams{ GroupId: opts.groupId, @@ -1181,7 +1364,6 @@ func getShardedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -1197,14 +1379,25 @@ type listBackupExportJobsOpts struct { } func (opts *listBackupExportJobsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listBackupExportJobsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listBackupExportJobsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListBackupExportJobsApiParams{ GroupId: opts.groupId, @@ -1246,7 +1439,6 @@ func listBackupExportJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -1261,14 +1453,25 @@ type listBackupRestoreJobsOpts struct { } func (opts *listBackupRestoreJobsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -1310,7 +1513,6 @@ func listBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -1324,14 +1526,25 @@ type listExportBucketsOpts struct { } func (opts *listExportBucketsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listExportBucketsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listExportBucketsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListExportBucketsApiParams{ GroupId: opts.groupId, @@ -1371,7 +1584,6 @@ func listExportBucketsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -1385,14 +1597,25 @@ type listReplicaSetBackupsOpts struct { } func (opts *listReplicaSetBackupsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListReplicaSetBackupsApiParams{ GroupId: opts.groupId, @@ -1434,7 +1657,6 @@ func listReplicaSetBackupsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -1449,14 +1671,25 @@ type listServerlessBackupRestoreJobsOpts struct { } func (opts *listServerlessBackupRestoreJobsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListServerlessBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -1498,7 +1731,6 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -1513,14 +1745,25 @@ type listServerlessBackupsOpts struct { } func (opts *listServerlessBackupsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listServerlessBackupsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listServerlessBackupsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListServerlessBackupsApiParams{ GroupId: opts.groupId, @@ -1562,7 +1805,6 @@ func listServerlessBackupsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -1574,14 +1816,25 @@ type listShardedClusterBackupsOpts struct { } func (opts *listShardedClusterBackupsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListShardedClusterBackupsApiParams{ GroupId: opts.groupId, @@ -1617,7 +1870,6 @@ func listShardedClusterBackupsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -1632,8 +1884,22 @@ type takeSnapshotOpts struct { } func (opts *takeSnapshotOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *takeSnapshotOpts) readData() (*admin.DiskBackupOnDemandSnapshotRequest, error) { @@ -1663,9 +1929,6 @@ func (opts *takeSnapshotOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.TakeSnapshotApiParams{ GroupId: opts.groupId, @@ -1707,7 +1970,6 @@ func takeSnapshotBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -1722,8 +1984,22 @@ type updateBackupScheduleOpts struct { } func (opts *updateBackupScheduleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateBackupScheduleOpts) readData() (*admin.DiskBackupSnapshotSchedule, error) { @@ -1753,9 +2029,6 @@ func (opts *updateBackupScheduleOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateBackupScheduleApiParams{ GroupId: opts.groupId, @@ -1797,7 +2070,6 @@ func updateBackupScheduleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -1811,8 +2083,22 @@ type updateDataProtectionSettingsOpts struct { } func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateDataProtectionSettingsOpts) readData() (*admin.DataProtectionSettings, error) { @@ -1842,9 +2128,6 @@ func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, @@ -1884,7 +2167,6 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -1899,8 +2181,22 @@ type updateSnapshotRetentionOpts struct { } func (opts *updateSnapshotRetentionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateSnapshotRetentionOpts) readData() (*admin.BackupSnapshotRetention, error) { @@ -1930,9 +2226,6 @@ func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateSnapshotRetentionApiParams{ GroupId: opts.groupId, @@ -1976,7 +2269,6 @@ func updateSnapshotRetentionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 354ac394c7..686aea21cb 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createLinkTokenOpts struct { } func (opts *createLinkTokenOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *createLinkTokenOpts) readData() (*admin.TargetOrgRequest, error) { @@ -69,9 +85,6 @@ func (opts *createLinkTokenOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.CreateLinkTokenApiParams{ OrgId: opts.orgId, @@ -111,7 +124,6 @@ func createLinkTokenBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -124,8 +136,22 @@ type createPushMigrationOpts struct { } func (opts *createPushMigrationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createPushMigrationOpts) readData() (*admin.LiveMigrationRequest, error) { @@ -155,9 +181,6 @@ func (opts *createPushMigrationOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreatePushMigrationApiParams{ GroupId: opts.groupId, @@ -197,7 +220,6 @@ func createPushMigrationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -208,14 +230,25 @@ type cutoverMigrationOpts struct { } func (opts *cutoverMigrationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *cutoverMigrationOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *cutoverMigrationOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.CutoverMigrationApiParams{ GroupId: opts.groupId, @@ -241,7 +274,6 @@ func cutoverMigrationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } @@ -252,14 +284,25 @@ type deleteLinkTokenOpts struct { } func (opts *deleteLinkTokenOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteLinkTokenOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *deleteLinkTokenOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, @@ -293,7 +336,6 @@ func deleteLinkTokenBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -304,14 +346,25 @@ type getPushMigrationOpts struct { } func (opts *getPushMigrationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getPushMigrationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getPushMigrationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetPushMigrationApiParams{ GroupId: opts.groupId, @@ -347,7 +400,6 @@ func getPushMigrationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("liveMigrationId") return cmd } @@ -359,14 +411,25 @@ type getValidationStatusOpts struct { } func (opts *getValidationStatusOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getValidationStatusOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getValidationStatusOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetValidationStatusApiParams{ GroupId: opts.groupId, @@ -402,7 +465,6 @@ func getValidationStatusBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("validationId") return cmd } @@ -413,14 +475,25 @@ type listSourceProjectsOpts struct { } func (opts *listSourceProjectsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listSourceProjectsOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listSourceProjectsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, @@ -454,7 +527,6 @@ func listSourceProjectsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -467,8 +539,22 @@ type validateMigrationOpts struct { } func (opts *validateMigrationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *validateMigrationOpts) readData() (*admin.LiveMigrationRequest, error) { @@ -498,9 +584,6 @@ func (opts *validateMigrationOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.ValidateMigrationApiParams{ GroupId: opts.groupId, @@ -540,7 +623,6 @@ func validateMigrationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index d302c9f79b..64e9f20a0b 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type authorizeCloudProviderAccessRoleOpts struct { } func (opts *authorizeCloudProviderAccessRoleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *authorizeCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderAccessRole, error) { @@ -70,9 +86,6 @@ func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, w io. if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.AuthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") return cmd } @@ -128,8 +140,22 @@ type createCloudProviderAccessRoleOpts struct { } func (opts *createCloudProviderAccessRoleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderAccessRole, error) { @@ -159,9 +185,6 @@ func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Wri if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -201,7 +224,6 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -213,14 +235,25 @@ type deauthorizeCloudProviderAccessRoleOpts struct { } func (opts *deauthorizeCloudProviderAccessRoleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.DeauthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -248,7 +281,6 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", "", `Human-readable label that identifies the cloud provider of the role to deauthorize.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("roleId") return cmd @@ -261,14 +293,25 @@ type getCloudProviderAccessRoleOpts struct { } func (opts *getCloudProviderAccessRoleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -304,7 +347,6 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleId") return cmd } @@ -315,14 +357,25 @@ type listCloudProviderAccessRolesOpts struct { } func (opts *listCloudProviderAccessRolesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, @@ -356,7 +409,6 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index be7aa33acd..d2f1ceec1a 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -36,14 +38,25 @@ type endOutageSimulationOpts struct { } func (opts *endOutageSimulationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *endOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *endOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.EndOutageSimulationApiParams{ GroupId: opts.groupId, @@ -79,7 +92,6 @@ func endOutageSimulationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -91,14 +103,25 @@ type getOutageSimulationOpts struct { } func (opts *getOutageSimulationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetOutageSimulationApiParams{ GroupId: opts.groupId, @@ -134,7 +157,6 @@ func getOutageSimulationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -149,8 +171,22 @@ type startOutageSimulationOpts struct { } func (opts *startOutageSimulationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *startOutageSimulationOpts) readData() (*admin.ClusterOutageSimulation, error) { @@ -180,9 +216,6 @@ func (opts *startOutageSimulationOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.StartOutageSimulationApiParams{ GroupId: opts.groupId, @@ -224,7 +257,6 @@ func startOutageSimulationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index f0646a2a48..6920c49f35 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createClusterOpts struct { } func (opts *createClusterOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createClusterOpts) readData() (*admin.AdvancedClusterDescription, error) { @@ -69,9 +85,6 @@ func (opts *createClusterOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateClusterApiParams{ GroupId: opts.groupId, @@ -111,7 +124,6 @@ func createClusterBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -123,14 +135,25 @@ type deleteClusterOpts struct { } func (opts *deleteClusterOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteClusterApiParams{ GroupId: opts.groupId, @@ -158,7 +181,6 @@ func deleteClusterBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().BoolVar(&opts.retainBackups, "retainBackups", false, `Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -170,14 +192,25 @@ type getClusterOpts struct { } func (opts *getClusterOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getClusterOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getClusterOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetClusterApiParams{ GroupId: opts.groupId, @@ -213,7 +246,6 @@ func getClusterBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -225,14 +257,25 @@ type getClusterAdvancedConfigurationOpts struct { } func (opts *getClusterAdvancedConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, @@ -268,7 +311,6 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -280,14 +322,25 @@ type getClusterStatusOpts struct { } func (opts *getClusterStatusOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getClusterStatusOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getClusterStatusOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetClusterStatusApiParams{ GroupId: opts.groupId, @@ -323,7 +376,6 @@ func getClusterStatusBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -335,14 +387,25 @@ type getSampleDatasetLoadStatusOpts struct { } func (opts *getSampleDatasetLoadStatusOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetSampleDatasetLoadStatusApiParams{ GroupId: opts.groupId, @@ -378,7 +441,6 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("sampleDatasetId") return cmd } @@ -394,14 +456,25 @@ type listCloudProviderRegionsOpts struct { } func (opts *listCloudProviderRegionsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListCloudProviderRegionsApiParams{ GroupId: opts.groupId, @@ -445,7 +518,6 @@ func listCloudProviderRegionsBuilder() *cobra.Command { cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, `Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.`) cmd.Flags().StringVar(&opts.tier, "tier", "", `Cluster tier for which to retrieve the regions.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -459,14 +531,25 @@ type listClustersOpts struct { } func (opts *listClustersOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listClustersOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listClustersOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListClustersApiParams{ GroupId: opts.groupId, @@ -508,7 +591,6 @@ func listClustersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().BoolVar(&opts.includeDeletedWithRetainedBackups, "includeDeletedWithRetainedBackups", false, `Flag that indicates whether to return Clusters with retain backups.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -520,8 +602,11 @@ type listClustersForAllProjectsOpts struct { } func (opts *listClustersForAllProjectsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *listClustersForAllProjectsOpts) run(ctx context.Context, w io.Writer) error { @@ -572,14 +657,25 @@ type loadSampleDatasetOpts struct { } func (opts *loadSampleDatasetOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *loadSampleDatasetOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *loadSampleDatasetOpts) run(ctx context.Context, w io.Writer) error { params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, @@ -615,7 +711,6 @@ func loadSampleDatasetBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } @@ -627,14 +722,25 @@ type testFailoverOpts struct { } func (opts *testFailoverOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *testFailoverOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *testFailoverOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.TestFailoverApiParams{ GroupId: opts.groupId, @@ -660,7 +766,6 @@ func testFailoverBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -675,8 +780,22 @@ type updateClusterOpts struct { } func (opts *updateClusterOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateClusterOpts) readData() (*admin.AdvancedClusterDescription, error) { @@ -706,9 +825,6 @@ func (opts *updateClusterOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateClusterApiParams{ GroupId: opts.groupId, @@ -750,7 +866,6 @@ func updateClusterBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -765,8 +880,22 @@ type updateClusterAdvancedConfigurationOpts struct { } func (opts *updateClusterAdvancedConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateClusterAdvancedConfigurationOpts) readData() (*admin.ClusterDescriptionProcessArgs, error) { @@ -796,9 +925,6 @@ func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, w i if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, @@ -840,7 +966,6 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -854,8 +979,22 @@ type upgradeSharedClusterOpts struct { } func (opts *upgradeSharedClusterOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *upgradeSharedClusterOpts) readData() (*admin.LegacyAtlasCluster, error) { @@ -885,9 +1024,6 @@ func (opts *upgradeSharedClusterOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, @@ -927,7 +1063,6 @@ func upgradeSharedClusterBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -940,8 +1075,22 @@ type upgradeSharedClusterToServerlessOpts struct { } func (opts *upgradeSharedClusterToServerlessOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *upgradeSharedClusterToServerlessOpts) readData() (*admin.ServerlessInstanceDescription, error) { @@ -971,9 +1120,6 @@ func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, w io. if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpgradeSharedClusterToServerlessApiParams{ GroupId: opts.groupId, @@ -1013,7 +1159,6 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index eb7c869bfc..3d38910968 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createCustomDatabaseRoleOpts struct { } func (opts *createCustomDatabaseRoleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createCustomDatabaseRoleOpts) readData() (*admin.UserCustomDBRole, error) { @@ -69,9 +85,6 @@ func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -111,7 +124,6 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -122,14 +134,25 @@ type deleteCustomDatabaseRoleOpts struct { } func (opts *deleteCustomDatabaseRoleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -155,7 +178,6 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd } @@ -167,14 +189,25 @@ type getCustomDatabaseRoleOpts struct { } func (opts *getCustomDatabaseRoleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -210,7 +243,6 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd } @@ -221,14 +253,25 @@ type listCustomDatabaseRolesOpts struct { } func (opts *listCustomDatabaseRolesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, @@ -262,7 +305,6 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -276,8 +318,22 @@ type updateCustomDatabaseRoleOpts struct { } func (opts *updateCustomDatabaseRoleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateCustomDatabaseRoleOpts) readData() (*admin.UpdateCustomDBRole, error) { @@ -307,9 +363,6 @@ func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -351,7 +404,6 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("roleName") return cmd } diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index 53df00639f..7b55485b99 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createDataFederationPrivateEndpointOpts struct { } func (opts *createDataFederationPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createDataFederationPrivateEndpointOpts) readData() (*admin.PrivateNetworkEndpointIdEntry, error) { @@ -69,9 +85,6 @@ func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, w if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -111,7 +124,6 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -125,8 +137,22 @@ type createFederatedDatabaseOpts struct { } func (opts *createFederatedDatabaseOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, error) { @@ -156,9 +182,6 @@ func (opts *createFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -201,7 +224,6 @@ func createFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -216,8 +238,22 @@ type createOneDataFederationQueryLimitOpts struct { } func (opts *createOneDataFederationQueryLimitOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createOneDataFederationQueryLimitOpts) readData() (*admin.DataFederationTenantQueryLimit, error) { @@ -247,9 +283,6 @@ func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, w io if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateOneDataFederationQueryLimitApiParams{ GroupId: opts.groupId, @@ -301,7 +334,6 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd @@ -314,14 +346,25 @@ type deleteDataFederationPrivateEndpointOpts struct { } func (opts *deleteDataFederationPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -357,7 +400,6 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") return cmd } @@ -369,14 +411,25 @@ type deleteFederatedDatabaseOpts struct { } func (opts *deleteFederatedDatabaseOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -412,7 +465,6 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } @@ -425,14 +477,25 @@ type deleteOneDataFederationInstanceQueryLimitOpts struct { } func (opts *deleteOneDataFederationInstanceQueryLimitOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ GroupId: opts.groupId, @@ -478,7 +541,6 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd @@ -493,14 +555,25 @@ type downloadFederatedDatabaseQueryLogsOpts struct { } func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ GroupId: opts.groupId, @@ -540,7 +613,6 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } @@ -552,14 +624,25 @@ type getDataFederationPrivateEndpointOpts struct { } func (opts *getDataFederationPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -595,7 +678,6 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("endpointId") return cmd } @@ -607,14 +689,25 @@ type getFederatedDatabaseOpts struct { } func (opts *getFederatedDatabaseOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -650,7 +743,6 @@ func getFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } @@ -664,14 +756,25 @@ type listDataFederationPrivateEndpointsOpts struct { } func (opts *listDataFederationPrivateEndpointsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListDataFederationPrivateEndpointsApiParams{ GroupId: opts.groupId, @@ -711,7 +814,6 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -722,14 +824,25 @@ type listFederatedDatabasesOpts struct { } func (opts *listFederatedDatabasesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listFederatedDatabasesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listFederatedDatabasesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, @@ -765,7 +878,6 @@ func listFederatedDatabasesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -777,14 +889,25 @@ type returnFederatedDatabaseQueryLimitOpts struct { } func (opts *returnFederatedDatabaseQueryLimitOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ GroupId: opts.groupId, @@ -830,7 +953,6 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | `) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") return cmd @@ -843,14 +965,25 @@ type returnFederatedDatabaseQueryLimitsOpts struct { } func (opts *returnFederatedDatabaseQueryLimitsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ GroupId: opts.groupId, @@ -886,7 +1019,6 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } @@ -902,8 +1034,22 @@ type updateFederatedDatabaseOpts struct { } func (opts *updateFederatedDatabaseOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, error) { @@ -933,9 +1079,6 @@ func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -979,7 +1122,6 @@ func updateFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("skipRoleValidation") return cmd diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 153fc76677..f84a5d7b5a 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createPipelineOpts struct { } func (opts *createPipelineOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createPipelineOpts) readData() (*admin.DataLakeIngestionPipeline, error) { @@ -70,9 +86,6 @@ func (opts *createPipelineOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreatePipelineApiParams{ GroupId: opts.groupId, @@ -112,7 +125,6 @@ func createPipelineBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -123,14 +135,25 @@ type deletePipelineOpts struct { } func (opts *deletePipelineOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deletePipelineOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deletePipelineOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeletePipelineApiParams{ GroupId: opts.groupId, @@ -166,7 +189,6 @@ func deletePipelineBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } @@ -179,14 +201,25 @@ type deletePipelineRunDatasetOpts struct { } func (opts *deletePipelineRunDatasetOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeletePipelineRunDatasetApiParams{ GroupId: opts.groupId, @@ -224,7 +257,6 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd @@ -237,14 +269,25 @@ type getPipelineOpts struct { } func (opts *getPipelineOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getPipelineOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getPipelineOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetPipelineApiParams{ GroupId: opts.groupId, @@ -280,7 +323,6 @@ func getPipelineBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } @@ -293,14 +335,25 @@ type getPipelineRunOpts struct { } func (opts *getPipelineRunOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getPipelineRunOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getPipelineRunOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetPipelineRunApiParams{ GroupId: opts.groupId, @@ -338,7 +391,6 @@ func getPipelineRunBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) cmd.Flags().StringVar(&opts.pipelineRunId, "pipelineRunId", "", `Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") return cmd @@ -355,14 +407,25 @@ type listPipelineRunsOpts struct { } func (opts *listPipelineRunsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPipelineRunsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listPipelineRunsOpts) run(ctx context.Context, w io.Writer) error { var createdBefore *time.Time var errCreatedBefore error @@ -415,7 +478,6 @@ func listPipelineRunsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", `If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } @@ -427,14 +489,25 @@ type listPipelineSchedulesOpts struct { } func (opts *listPipelineSchedulesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPipelineSchedulesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listPipelineSchedulesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListPipelineSchedulesApiParams{ GroupId: opts.groupId, @@ -470,7 +543,6 @@ func listPipelineSchedulesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } @@ -486,14 +558,25 @@ type listPipelineSnapshotsOpts struct { } func (opts *listPipelineSnapshotsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, w io.Writer) error { var completedAfter *time.Time var errCompletedAfter error @@ -546,7 +629,6 @@ func listPipelineSnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", `Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } @@ -557,14 +639,25 @@ type listPipelinesOpts struct { } func (opts *listPipelinesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPipelinesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listPipelinesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, @@ -598,7 +691,6 @@ func listPipelinesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -609,14 +701,25 @@ type pausePipelineOpts struct { } func (opts *pausePipelineOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *pausePipelineOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *pausePipelineOpts) run(ctx context.Context, w io.Writer) error { params := &admin.PausePipelineApiParams{ GroupId: opts.groupId, @@ -652,7 +755,6 @@ func pausePipelineBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } @@ -664,14 +766,25 @@ type resumePipelineOpts struct { } func (opts *resumePipelineOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *resumePipelineOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *resumePipelineOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ResumePipelineApiParams{ GroupId: opts.groupId, @@ -707,7 +820,6 @@ func resumePipelineBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } @@ -722,8 +834,22 @@ type triggerSnapshotIngestionOpts struct { } func (opts *triggerSnapshotIngestionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *triggerSnapshotIngestionOpts) readData() (*admin.TriggerIngestionPipelineRequest, error) { @@ -753,9 +879,6 @@ func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.TriggerSnapshotIngestionApiParams{ GroupId: opts.groupId, @@ -797,7 +920,6 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } @@ -812,8 +934,22 @@ type updatePipelineOpts struct { } func (opts *updatePipelineOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updatePipelineOpts) readData() (*admin.DataLakeIngestionPipeline, error) { @@ -843,9 +979,6 @@ func (opts *updatePipelineOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdatePipelineApiParams{ GroupId: opts.groupId, @@ -887,7 +1020,6 @@ func updatePipelineBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("pipelineName") return cmd } diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index 01dc562e69..f232b082bb 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createDatabaseUserOpts struct { } func (opts *createDatabaseUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) { @@ -69,9 +85,6 @@ func (opts *createDatabaseUserOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateDatabaseUserApiParams{ GroupId: opts.groupId, @@ -111,7 +124,6 @@ func createDatabaseUserBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -123,14 +135,25 @@ type deleteDatabaseUserOpts struct { } func (opts *deleteDatabaseUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteDatabaseUserApiParams{ GroupId: opts.groupId, @@ -180,7 +203,6 @@ func deleteDatabaseUserBuilder() *cobra.Command { | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") return cmd @@ -194,14 +216,25 @@ type getDatabaseUserOpts struct { } func (opts *getDatabaseUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetDatabaseUserApiParams{ GroupId: opts.groupId, @@ -251,7 +284,6 @@ func getDatabaseUserBuilder() *cobra.Command { | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | `) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") return cmd @@ -266,14 +298,25 @@ type listDatabaseUsersOpts struct { } func (opts *listDatabaseUsersOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listDatabaseUsersOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listDatabaseUsersOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListDatabaseUsersApiParams{ GroupId: opts.groupId, @@ -313,7 +356,6 @@ func listDatabaseUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -328,8 +370,22 @@ type updateDatabaseUserOpts struct { } func (opts *updateDatabaseUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) { @@ -359,9 +415,6 @@ func (opts *updateDatabaseUserOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateDatabaseUserApiParams{ GroupId: opts.groupId, @@ -417,7 +470,6 @@ func updateDatabaseUserBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") return cmd diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index da1fa19f78..c46db35fc5 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -35,14 +37,25 @@ type getEncryptionAtRestOpts struct { } func (opts *getEncryptionAtRestOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, @@ -76,7 +89,6 @@ func getEncryptionAtRestBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -89,8 +101,22 @@ type updateEncryptionAtRestOpts struct { } func (opts *updateEncryptionAtRestOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateEncryptionAtRestOpts) readData() (*admin.EncryptionAtRest, error) { @@ -120,9 +146,6 @@ func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateEncryptionAtRestApiParams{ GroupId: opts.groupId, @@ -162,7 +185,6 @@ func updateEncryptionAtRestBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 91961e4e51..842b9f37f3 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "time" @@ -36,14 +38,25 @@ type getOrganizationEventOpts struct { } func (opts *getOrganizationEventOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getOrganizationEventOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getOrganizationEventOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetOrganizationEventApiParams{ OrgId: opts.orgId, @@ -81,7 +94,6 @@ func getOrganizationEventBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("eventId") return cmd } @@ -94,14 +106,25 @@ type getProjectEventOpts struct { } func (opts *getProjectEventOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getProjectEventOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getProjectEventOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectEventApiParams{ GroupId: opts.groupId, @@ -139,7 +162,6 @@ func getProjectEventBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.eventId, "eventId", "", `Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access.`) cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("eventId") return cmd } @@ -157,14 +179,25 @@ type listOrganizationEventsOpts struct { } func (opts *listOrganizationEventsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listOrganizationEventsOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listOrganizationEventsOpts) run(ctx context.Context, w io.Writer) error { var maxDate *time.Time var errMaxDate error @@ -232,7 +265,6 @@ func listOrganizationEventsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -251,14 +283,25 @@ type listProjectEventsOpts struct { } func (opts *listProjectEventsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listProjectEventsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listProjectEventsOpts) run(ctx context.Context, w io.Writer) error { var maxDate *time.Time var errMaxDate error @@ -332,7 +375,6 @@ func listProjectEventsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index 7f72f37be4..50b9c23df0 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createRoleMappingOpts struct { } func (opts *createRoleMappingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *createRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, error) { @@ -70,9 +86,6 @@ func (opts *createRoleMappingOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.CreateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -115,7 +128,6 @@ func createRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("federationSettingsId") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -125,8 +137,11 @@ type deleteFederationAppOpts struct { } func (opts *deleteFederationAppOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *deleteFederationAppOpts) run(ctx context.Context, _ io.Writer) error { @@ -165,14 +180,25 @@ type deleteRoleMappingOpts struct { } func (opts *deleteRoleMappingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -202,7 +228,6 @@ func deleteRoleMappingBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -213,8 +238,11 @@ type getConnectedOrgConfigOpts struct { } func (opts *getConnectedOrgConfigOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *getConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) error { @@ -264,14 +292,25 @@ type getFederationSettingsOpts struct { } func (opts *getFederationSettingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getFederationSettingsOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getFederationSettingsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, @@ -305,7 +344,6 @@ func getFederationSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -316,8 +354,11 @@ type getIdentityProviderOpts struct { } func (opts *getIdentityProviderOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *getIdentityProviderOpts) run(ctx context.Context, w io.Writer) error { @@ -368,8 +409,11 @@ type getIdentityProviderMetadataOpts struct { } func (opts *getIdentityProviderMetadataOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *getIdentityProviderMetadataOpts) run(ctx context.Context, w io.Writer) error { @@ -421,14 +465,25 @@ type getRoleMappingOpts struct { } func (opts *getRoleMappingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getRoleMappingOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getRoleMappingOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -468,7 +523,6 @@ func getRoleMappingBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -478,8 +532,11 @@ type listConnectedOrgConfigsOpts struct { } func (opts *listConnectedOrgConfigsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *listConnectedOrgConfigsOpts) run(ctx context.Context, w io.Writer) error { @@ -526,8 +583,11 @@ type listIdentityProvidersOpts struct { } func (opts *listIdentityProvidersOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *listIdentityProvidersOpts) run(ctx context.Context, w io.Writer) error { @@ -575,14 +635,25 @@ type listRoleMappingsOpts struct { } func (opts *listRoleMappingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listRoleMappingsOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listRoleMappingsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -619,7 +690,6 @@ func listRoleMappingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("federationSettingsId") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -630,8 +700,11 @@ type removeConnectedOrgConfigOpts struct { } func (opts *removeConnectedOrgConfigOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *removeConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) error { @@ -685,8 +758,11 @@ type updateConnectedOrgConfigOpts struct { } func (opts *updateConnectedOrgConfigOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *updateConnectedOrgConfigOpts) readData() (*admin.ConnectedOrgConfig, error) { @@ -772,8 +848,11 @@ type updateIdentityProviderOpts struct { } func (opts *updateIdentityProviderOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *updateIdentityProviderOpts) readData() (*admin.SamlIdentityProviderUpdate, error) { @@ -860,8 +939,22 @@ type updateRoleMappingOpts struct { } func (opts *updateRoleMappingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *updateRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, error) { @@ -891,9 +984,6 @@ func (opts *updateRoleMappingOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.UpdateRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -939,7 +1029,6 @@ func updateRoleMappingBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") - _ = cmd.MarkFlagRequired("orgId") return cmd } diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 033dbe6920..21c190016c 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createCustomZoneMappingOpts struct { } func (opts *createCustomZoneMappingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createCustomZoneMappingOpts) readData() (*admin.GeoSharding, error) { @@ -70,9 +86,6 @@ func (opts *createCustomZoneMappingOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateCustomZoneMappingApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func createCustomZoneMappingBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -129,8 +141,22 @@ type createManagedNamespaceOpts struct { } func (opts *createManagedNamespaceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createManagedNamespaceOpts) readData() (*admin.ManagedNamespace, error) { @@ -160,9 +186,6 @@ func (opts *createManagedNamespaceOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateManagedNamespaceApiParams{ GroupId: opts.groupId, @@ -204,7 +227,6 @@ func createManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -216,14 +238,25 @@ type deleteAllCustomZoneMappingsOpts struct { } func (opts *deleteAllCustomZoneMappingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteAllCustomZoneMappingsApiParams{ GroupId: opts.groupId, @@ -259,7 +292,6 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -273,14 +305,25 @@ type deleteManagedNamespaceOpts struct { } func (opts *deleteManagedNamespaceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, @@ -321,7 +364,6 @@ func deleteManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) _ = cmd.MarkFlagRequired("clusterName") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -332,14 +374,25 @@ type getManagedNamespaceOpts struct { } func (opts *getManagedNamespaceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetManagedNamespaceApiParams{ GroupId: opts.groupId, @@ -375,7 +428,6 @@ func getManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index 6b5f5a20fc..9825698b4a 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createCostExplorerQueryProcessOpts struct { } func (opts *createCostExplorerQueryProcessOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *createCostExplorerQueryProcessOpts) readData() (*admin.CostExplorerFilterRequestBody, error) { @@ -69,9 +85,6 @@ func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, w io.Wr if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.CreateCostExplorerQueryProcessApiParams{ OrgId: opts.orgId, @@ -111,7 +124,6 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -122,14 +134,25 @@ type createCostExplorerQueryProcess1Opts struct { } func (opts *createCostExplorerQueryProcess1Opts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, w io.Writer) error { params := &admin.CreateCostExplorerQueryProcess1ApiParams{ OrgId: opts.orgId, @@ -165,7 +188,6 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.token, "token", "", `Unique 64 digit string that identifies the Cost Explorer query.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("token") return cmd } @@ -177,14 +199,25 @@ type downloadInvoiceCSVOpts struct { } func (opts *downloadInvoiceCSVOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DownloadInvoiceCSVApiParams{ OrgId: opts.orgId, @@ -220,7 +253,6 @@ func downloadInvoiceCSVBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") return cmd } @@ -232,14 +264,25 @@ type getInvoiceOpts struct { } func (opts *getInvoiceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getInvoiceOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getInvoiceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetInvoiceApiParams{ OrgId: opts.orgId, @@ -275,7 +318,6 @@ func getInvoiceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invoiceId") return cmd } @@ -289,14 +331,25 @@ type listInvoicesOpts struct { } func (opts *listInvoicesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listInvoicesOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listInvoicesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListInvoicesApiParams{ OrgId: opts.orgId, @@ -336,7 +389,6 @@ func listInvoicesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -346,14 +398,25 @@ type listPendingInvoicesOpts struct { } func (opts *listPendingInvoicesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPendingInvoicesOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listPendingInvoicesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, @@ -387,7 +450,6 @@ func listPendingInvoicesBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) - _ = cmd.MarkFlagRequired("orgId") return cmd } diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 97deb5f86a..8329317f5b 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -35,14 +37,25 @@ type deleteLDAPConfigurationOpts struct { } func (opts *deleteLDAPConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -76,7 +89,6 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -86,14 +98,25 @@ type getLDAPConfigurationOpts struct { } func (opts *getLDAPConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -127,7 +150,6 @@ func getLDAPConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -138,14 +160,25 @@ type getLDAPConfigurationStatusOpts struct { } func (opts *getLDAPConfigurationStatusOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetLDAPConfigurationStatusApiParams{ GroupId: opts.groupId, @@ -181,7 +214,6 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("requestId") return cmd } @@ -195,8 +227,22 @@ type saveLDAPConfigurationOpts struct { } func (opts *saveLDAPConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *saveLDAPConfigurationOpts) readData() (*admin.UserSecurity, error) { @@ -226,9 +272,6 @@ func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.SaveLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -268,7 +311,6 @@ func saveLDAPConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -281,8 +323,22 @@ type verifyLDAPConfigurationOpts struct { } func (opts *verifyLDAPConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *verifyLDAPConfigurationOpts) readData() (*admin.LDAPVerifyConnectivityJobRequestParams, error) { @@ -312,9 +368,6 @@ func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.VerifyLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -354,7 +407,6 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 0cadbbf9c2..66b1402335 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -37,14 +39,25 @@ type deleteLegacySnapshotOpts struct { } func (opts *deleteLegacySnapshotOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteLegacySnapshotApiParams{ GroupId: opts.groupId, @@ -82,7 +95,6 @@ func deleteLegacySnapshotBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -96,14 +108,25 @@ type getLegacyBackupCheckpointOpts struct { } func (opts *getLegacyBackupCheckpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetLegacyBackupCheckpointApiParams{ GroupId: opts.groupId, @@ -141,7 +164,6 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.checkpointId, "checkpointId", "", `Unique 24-hexadecimal digit string that identifies the checkpoint.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the checkpoints that you want to return.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("checkpointId") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -155,14 +177,25 @@ type getLegacyBackupRestoreJobOpts struct { } func (opts *getLegacyBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -200,7 +233,6 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) cmd.Flags().StringVar(&opts.jobId, "jobId", "", `Unique 24-hexadecimal digit string that identifies the restore job.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("jobId") return cmd @@ -214,14 +246,25 @@ type getLegacySnapshotOpts struct { } func (opts *getLegacySnapshotOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetLegacySnapshotApiParams{ GroupId: opts.groupId, @@ -259,7 +302,6 @@ func getLegacySnapshotBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -272,14 +314,25 @@ type getLegacySnapshotScheduleOpts struct { } func (opts *getLegacySnapshotScheduleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, @@ -315,7 +368,6 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -330,14 +382,25 @@ type listLegacyBackupCheckpointsOpts struct { } func (opts *listLegacyBackupCheckpointsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListLegacyBackupCheckpointsApiParams{ GroupId: opts.groupId, @@ -379,7 +442,6 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -395,14 +457,25 @@ type listLegacyBackupRestoreJobsOpts struct { } func (opts *listLegacyBackupRestoreJobsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListLegacyBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -446,7 +519,6 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -462,14 +534,25 @@ type listLegacySnapshotsOpts struct { } func (opts *listLegacySnapshotsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listLegacySnapshotsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listLegacySnapshotsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListLegacySnapshotsApiParams{ GroupId: opts.groupId, @@ -513,7 +596,6 @@ func listLegacySnapshotsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.completed, "completed", ""true"", `Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -529,8 +611,22 @@ type updateLegacySnapshotRetentionOpts struct { } func (opts *updateLegacySnapshotRetentionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateLegacySnapshotRetentionOpts) readData() (*admin.BackupSnapshot, error) { @@ -560,9 +656,6 @@ func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, w io.Wri if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateLegacySnapshotRetentionApiParams{ GroupId: opts.groupId, @@ -606,7 +699,6 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -622,8 +714,22 @@ type updateLegacySnapshotScheduleOpts struct { } func (opts *updateLegacySnapshotScheduleOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateLegacySnapshotScheduleOpts) readData() (*admin.ApiAtlasSnapshotSchedule, error) { @@ -653,9 +759,6 @@ func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, @@ -697,7 +800,6 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index 93cac71a40..e264ac54fe 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createLegacyBackupRestoreJobOpts struct { } func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createLegacyBackupRestoreJobOpts) readData() (*admin.BackupRestoreJob, error) { @@ -70,9 +86,6 @@ func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index 04c1224ec3..7598aa52f8 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -35,14 +37,25 @@ type deferMaintenanceWindowOpts struct { } func (opts *deferMaintenanceWindowOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deferMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deferMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -66,7 +79,6 @@ func deferMaintenanceWindowBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -76,14 +88,25 @@ type getMaintenanceWindowOpts struct { } func (opts *getMaintenanceWindowOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -117,7 +140,6 @@ func getMaintenanceWindowBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -127,14 +149,25 @@ type resetMaintenanceWindowOpts struct { } func (opts *resetMaintenanceWindowOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *resetMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *resetMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -158,7 +191,6 @@ func resetMaintenanceWindowBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -168,14 +200,25 @@ type toggleMaintenanceAutoDeferOpts struct { } func (opts *toggleMaintenanceAutoDeferOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *toggleMaintenanceAutoDeferOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *toggleMaintenanceAutoDeferOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, @@ -199,7 +242,6 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -212,8 +254,22 @@ type updateMaintenanceWindowOpts struct { } func (opts *updateMaintenanceWindowOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateMaintenanceWindowOpts) readData() (*admin.GroupMaintenanceWindow, error) { @@ -243,9 +299,6 @@ func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -285,7 +338,6 @@ func updateMaintenanceWindowBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index ce64a2eaa9..53078e6ab0 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -36,8 +36,11 @@ type createUserOpts struct { } func (opts *createUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *createUserOpts) readData() (*admin.CloudAppUser, error) { @@ -113,8 +116,11 @@ type getUserOpts struct { } func (opts *getUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *getUserOpts) run(ctx context.Context, w io.Writer) error { @@ -161,8 +167,11 @@ type getUserByUsernameOpts struct { } func (opts *getUserByUsernameOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *getUserByUsernameOpts) run(ctx context.Context, w io.Writer) error { diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index a6e06c42c8..61fb62bb18 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "time" @@ -35,14 +37,25 @@ type getAtlasProcessOpts struct { } func (opts *getAtlasProcessOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getAtlasProcessOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getAtlasProcessOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetAtlasProcessApiParams{ GroupId: opts.groupId, @@ -78,7 +91,6 @@ func getAtlasProcessBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } @@ -91,14 +103,25 @@ type getDatabaseOpts struct { } func (opts *getDatabaseOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getDatabaseOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getDatabaseOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetDatabaseApiParams{ GroupId: opts.groupId, @@ -136,7 +159,6 @@ func getDatabaseBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database that the specified MongoDB process serves.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") return cmd @@ -155,14 +177,25 @@ type getDatabaseMeasurementsOpts struct { } func (opts *getDatabaseMeasurementsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, w io.Writer) error { var start *time.Time var errStart error @@ -228,7 +261,6 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") @@ -248,14 +280,25 @@ type getDiskMeasurementsOpts struct { } func (opts *getDiskMeasurementsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { var start *time.Time var errStart error @@ -321,7 +364,6 @@ func getDiskMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") @@ -338,14 +380,25 @@ type getHostLogsOpts struct { } func (opts *getHostLogsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getHostLogsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getHostLogsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetHostLogsApiParams{ GroupId: opts.groupId, @@ -387,7 +440,6 @@ func getHostLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("hostName") _ = cmd.MarkFlagRequired("logName") return cmd @@ -405,14 +457,25 @@ type getHostMeasurementsOpts struct { } func (opts *getHostMeasurementsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getHostMeasurementsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getHostMeasurementsOpts) run(ctx context.Context, w io.Writer) error { var start *time.Time var errStart error @@ -476,7 +539,6 @@ func getHostMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") return cmd @@ -497,14 +559,25 @@ type getIndexMetricsOpts struct { } func (opts *getIndexMetricsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { var start *time.Time var errStart error @@ -578,7 +651,6 @@ func getIndexMetricsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("indexName") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("collectionName") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") return cmd @@ -596,14 +668,25 @@ type getMeasurementsOpts struct { } func (opts *getMeasurementsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getMeasurementsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getMeasurementsOpts) run(ctx context.Context, w io.Writer) error { var start *time.Time var errStart error @@ -668,7 +751,6 @@ func getMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) _ = cmd.MarkFlagRequired("processId") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") return cmd @@ -683,14 +765,25 @@ type listAtlasProcessesOpts struct { } func (opts *listAtlasProcessesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listAtlasProcessesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listAtlasProcessesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListAtlasProcessesApiParams{ GroupId: opts.groupId, @@ -730,7 +823,6 @@ func listAtlasProcessesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -744,14 +836,25 @@ type listDatabasesOpts struct { } func (opts *listDatabasesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listDatabasesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listDatabasesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListDatabasesApiParams{ GroupId: opts.groupId, @@ -793,7 +896,6 @@ func listDatabasesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } @@ -806,14 +908,25 @@ type listDiskMeasurementsOpts struct { } func (opts *listDiskMeasurementsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListDiskMeasurementsApiParams{ PartitionName: opts.partitionName, @@ -852,7 +965,6 @@ func listDiskMeasurementsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("partitionName") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } @@ -867,14 +979,25 @@ type listDiskPartitionsOpts struct { } func (opts *listDiskPartitionsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listDiskPartitionsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listDiskPartitionsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListDiskPartitionsApiParams{ GroupId: opts.groupId, @@ -916,7 +1039,6 @@ func listDiskPartitionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } @@ -935,14 +1057,25 @@ type listIndexMetricsOpts struct { } func (opts *listIndexMetricsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { var start *time.Time var errStart error @@ -1013,7 +1146,6 @@ func listIndexMetricsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("collectionName") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") return cmd @@ -1026,14 +1158,25 @@ type listMetricTypesOpts struct { } func (opts *listMetricTypesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listMetricTypesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listMetricTypesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListMetricTypesApiParams{ ProcessId: opts.processId, @@ -1070,7 +1213,6 @@ func listMetricTypesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("processId") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index e67e21417d..628cc3d495 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createPeeringConnectionOpts struct { } func (opts *createPeeringConnectionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createPeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringConnectionSettings, error) { @@ -69,9 +85,6 @@ func (opts *createPeeringConnectionOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreatePeeringConnectionApiParams{ GroupId: opts.groupId, @@ -111,7 +124,6 @@ func createPeeringConnectionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -124,8 +136,22 @@ type createPeeringContainerOpts struct { } func (opts *createPeeringContainerOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createPeeringContainerOpts) readData() (*admin.CloudProviderContainer, error) { @@ -155,9 +181,6 @@ func (opts *createPeeringContainerOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreatePeeringContainerApiParams{ GroupId: opts.groupId, @@ -197,7 +220,6 @@ func createPeeringContainerBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -208,14 +230,25 @@ type deletePeeringConnectionOpts struct { } func (opts *deletePeeringConnectionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deletePeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deletePeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeletePeeringConnectionApiParams{ GroupId: opts.groupId, @@ -251,7 +284,6 @@ func deletePeeringConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd } @@ -263,14 +295,25 @@ type deletePeeringContainerOpts struct { } func (opts *deletePeeringContainerOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deletePeeringContainerOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deletePeeringContainerOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeletePeeringContainerApiParams{ GroupId: opts.groupId, @@ -306,7 +349,6 @@ func deletePeeringContainerBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd } @@ -320,8 +362,22 @@ type disablePeeringOpts struct { } func (opts *disablePeeringOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *disablePeeringOpts) readData() (*admin.PrivateIPMode, error) { @@ -351,9 +407,6 @@ func (opts *disablePeeringOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.DisablePeeringApiParams{ GroupId: opts.groupId, @@ -393,7 +446,6 @@ func disablePeeringBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -404,14 +456,25 @@ type getPeeringConnectionOpts struct { } func (opts *getPeeringConnectionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getPeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getPeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetPeeringConnectionApiParams{ GroupId: opts.groupId, @@ -447,7 +510,6 @@ func getPeeringConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd } @@ -459,14 +521,25 @@ type getPeeringContainerOpts struct { } func (opts *getPeeringContainerOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getPeeringContainerOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getPeeringContainerOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetPeeringContainerApiParams{ GroupId: opts.groupId, @@ -502,7 +575,6 @@ func getPeeringContainerBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd } @@ -517,14 +589,25 @@ type listPeeringConnectionsOpts struct { } func (opts *listPeeringConnectionsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPeeringConnectionsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listPeeringConnectionsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListPeeringConnectionsApiParams{ GroupId: opts.groupId, @@ -566,7 +649,6 @@ func listPeeringConnectionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider to use for this VPC peering connection.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -580,14 +662,25 @@ type listPeeringContainerByCloudProviderOpts struct { } func (opts *listPeeringContainerByCloudProviderOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, @@ -629,7 +722,6 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("providerName") return cmd } @@ -643,14 +735,25 @@ type listPeeringContainersOpts struct { } func (opts *listPeeringContainersOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPeeringContainersOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listPeeringContainersOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListPeeringContainersApiParams{ GroupId: opts.groupId, @@ -690,7 +793,6 @@ func listPeeringContainersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -704,8 +806,22 @@ type updatePeeringConnectionOpts struct { } func (opts *updatePeeringConnectionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updatePeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringConnectionSettings, error) { @@ -735,9 +851,6 @@ func (opts *updatePeeringConnectionOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdatePeeringConnectionApiParams{ GroupId: opts.groupId, @@ -779,7 +892,6 @@ func updatePeeringConnectionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("peerId") return cmd } @@ -794,8 +906,22 @@ type updatePeeringContainerOpts struct { } func (opts *updatePeeringContainerOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updatePeeringContainerOpts) readData() (*admin.CloudProviderContainer, error) { @@ -825,9 +951,6 @@ func (opts *updatePeeringContainerOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdatePeeringContainerApiParams{ GroupId: opts.groupId, @@ -869,7 +992,6 @@ func updatePeeringContainerBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("containerId") return cmd } @@ -880,14 +1002,25 @@ type verifyConnectViaPeeringOnlyModeForOneProjectOpts struct { } func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Context, w io.Writer) error { params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, @@ -921,7 +1054,6 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index 3f9a0be9f3..b7db544cee 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createOnlineArchiveOpts struct { } func (opts *createOnlineArchiveOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createOnlineArchiveOpts) readData() (*admin.BackupOnlineArchiveCreate, error) { @@ -70,9 +86,6 @@ func (opts *createOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func createOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -127,14 +139,25 @@ type deleteOnlineArchiveOpts struct { } func (opts *deleteOnlineArchiveOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -172,7 +195,6 @@ func deleteOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to delete.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -188,14 +210,25 @@ type downloadOnlineArchiveQueryLogsOpts struct { } func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ GroupId: opts.groupId, @@ -237,7 +270,6 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time).`) cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, `Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -250,14 +282,25 @@ type getOnlineArchiveOpts struct { } func (opts *getOnlineArchiveOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -295,7 +338,6 @@ func getOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.archiveId, "archiveId", "", `Unique 24-hexadecimal digit string that identifies the online archive to return.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd @@ -311,14 +353,25 @@ type listOnlineArchivesOpts struct { } func (opts *listOnlineArchivesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listOnlineArchivesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listOnlineArchivesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListOnlineArchivesApiParams{ GroupId: opts.groupId, @@ -360,7 +413,6 @@ func listOnlineArchivesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } @@ -376,8 +428,22 @@ type updateOnlineArchiveOpts struct { } func (opts *updateOnlineArchiveOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateOnlineArchiveOpts) readData() (*admin.BackupOnlineArchive, error) { @@ -407,9 +473,6 @@ func (opts *updateOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -453,7 +516,6 @@ func updateOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") return cmd diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 1b17bbeb16..d7c2429c13 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -37,8 +39,11 @@ type createOrganizationOpts struct { } func (opts *createOrganizationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *createOrganizationOpts) readData() (*admin.CreateOrganizationRequest, error) { @@ -117,8 +122,22 @@ type createOrganizationInvitationOpts struct { } func (opts *createOrganizationInvitationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *createOrganizationInvitationOpts) readData() (*admin.OrganizationInvitationRequest, error) { @@ -148,9 +167,6 @@ func (opts *createOrganizationInvitationOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.CreateOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -190,7 +206,6 @@ func createOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -200,14 +215,25 @@ type deleteOrganizationOpts struct { } func (opts *deleteOrganizationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteOrganizationOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *deleteOrganizationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, @@ -241,7 +267,6 @@ func deleteOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -252,14 +277,25 @@ type deleteOrganizationInvitationOpts struct { } func (opts *deleteOrganizationInvitationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -295,7 +331,6 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } @@ -306,14 +341,25 @@ type getOrganizationOpts struct { } func (opts *getOrganizationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getOrganizationOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getOrganizationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, @@ -347,7 +393,6 @@ func getOrganizationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -358,14 +403,25 @@ type getOrganizationInvitationOpts struct { } func (opts *getOrganizationInvitationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -401,7 +457,6 @@ func getOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } @@ -412,14 +467,25 @@ type getOrganizationSettingsOpts struct { } func (opts *getOrganizationSettingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getOrganizationSettingsOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getOrganizationSettingsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, @@ -453,7 +519,6 @@ func getOrganizationSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -464,14 +529,25 @@ type listOrganizationInvitationsOpts struct { } func (opts *listOrganizationInvitationsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationInvitationsApiParams{ OrgId: opts.orgId, @@ -507,7 +583,6 @@ func listOrganizationInvitationsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -521,14 +596,25 @@ type listOrganizationProjectsOpts struct { } func (opts *listOrganizationProjectsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listOrganizationProjectsOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listOrganizationProjectsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationProjectsApiParams{ OrgId: opts.orgId, @@ -570,7 +656,6 @@ func listOrganizationProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -583,14 +668,25 @@ type listOrganizationUsersOpts struct { } func (opts *listOrganizationUsersOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listOrganizationUsersOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listOrganizationUsersOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationUsersApiParams{ OrgId: opts.orgId, @@ -630,7 +726,6 @@ func listOrganizationUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -643,8 +738,11 @@ type listOrganizationsOpts struct { } func (opts *listOrganizationsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *listOrganizationsOpts) run(ctx context.Context, w io.Writer) error { @@ -697,14 +795,25 @@ type removeOrganizationUserOpts struct { } func (opts *removeOrganizationUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *removeOrganizationUserOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *removeOrganizationUserOpts) run(ctx context.Context, w io.Writer) error { params := &admin.RemoveOrganizationUserApiParams{ OrgId: opts.orgId, @@ -740,7 +849,6 @@ func removeOrganizationUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to be deleted.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("userId") return cmd } @@ -754,8 +862,22 @@ type renameOrganizationOpts struct { } func (opts *renameOrganizationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *renameOrganizationOpts) readData() (*admin.AtlasOrganization, error) { @@ -785,9 +907,6 @@ func (opts *renameOrganizationOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.RenameOrganizationApiParams{ OrgId: opts.orgId, @@ -827,7 +946,6 @@ func renameOrganizationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -840,8 +958,22 @@ type updateOrganizationInvitationOpts struct { } func (opts *updateOrganizationInvitationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *updateOrganizationInvitationOpts) readData() (*admin.OrganizationInvitationRequest, error) { @@ -871,9 +1003,6 @@ func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.UpdateOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -913,7 +1042,6 @@ func updateOrganizationInvitationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -927,8 +1055,22 @@ type updateOrganizationInvitationByIdOpts struct { } func (opts *updateOrganizationInvitationByIdOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *updateOrganizationInvitationByIdOpts) readData() (*admin.OrganizationInvitationUpdateRequest, error) { @@ -958,9 +1100,6 @@ func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, w io. if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.UpdateOrganizationInvitationByIdApiParams{ OrgId: opts.orgId, @@ -1002,7 +1141,6 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("invitationId") return cmd } @@ -1017,8 +1155,22 @@ type updateOrganizationRolesOpts struct { } func (opts *updateOrganizationRolesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *updateOrganizationRolesOpts) readData() (*admin.UpdateOrgRolesForUser, error) { @@ -1048,9 +1200,6 @@ func (opts *updateOrganizationRolesOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.UpdateOrganizationRolesApiParams{ OrgId: opts.orgId, @@ -1092,7 +1241,6 @@ func updateOrganizationRolesBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("userId") return cmd } @@ -1106,8 +1254,22 @@ type updateOrganizationSettingsOpts struct { } func (opts *updateOrganizationSettingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *updateOrganizationSettingsOpts) readData() (*admin.OrganizationSettings, error) { @@ -1137,9 +1299,6 @@ func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, w io.Writer if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.UpdateOrganizationSettingsApiParams{ OrgId: opts.orgId, @@ -1179,7 +1338,6 @@ func updateOrganizationSettingsBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") return cmd } diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index 252761ec62..d53a592146 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" @@ -33,14 +35,25 @@ type disableSlowOperationThresholdingOpts struct { } func (opts *disableSlowOperationThresholdingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *disableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *disableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, @@ -64,7 +77,6 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -74,14 +86,25 @@ type enableSlowOperationThresholdingOpts struct { } func (opts *enableSlowOperationThresholdingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *enableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *enableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, @@ -105,7 +128,6 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -120,14 +142,25 @@ type listSlowQueriesOpts struct { } func (opts *listSlowQueriesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listSlowQueriesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listSlowQueriesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListSlowQueriesApiParams{ GroupId: opts.groupId, @@ -177,7 +210,6 @@ func listSlowQueriesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } @@ -191,14 +223,25 @@ type listSlowQueryNamespacesOpts struct { } func (opts *listSlowQueryNamespacesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListSlowQueryNamespacesApiParams{ GroupId: opts.groupId, @@ -244,7 +287,6 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } @@ -264,14 +306,25 @@ type listSuggestedIndexesOpts struct { } func (opts *listSuggestedIndexesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listSuggestedIndexesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listSuggestedIndexesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListSuggestedIndexesApiParams{ GroupId: opts.groupId, @@ -329,7 +382,6 @@ func listSuggestedIndexesBuilder() *cobra.Command { - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("processId") return cmd } diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 764413d489..f6c68aa2ac 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -40,8 +42,22 @@ type createPrivateEndpointOpts struct { } func (opts *createPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createPrivateEndpointOpts) readData() (*admin.CreateEndpointRequest, error) { @@ -71,9 +87,6 @@ func (opts *createPrivateEndpointOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreatePrivateEndpointApiParams{ GroupId: opts.groupId, @@ -117,7 +130,6 @@ func createPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd @@ -132,8 +144,22 @@ type createPrivateEndpointServiceOpts struct { } func (opts *createPrivateEndpointServiceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createPrivateEndpointServiceOpts) readData() (*admin.CloudProviderEndpointServiceRequest, error) { @@ -163,9 +189,6 @@ func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writ if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreatePrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -205,7 +228,6 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -218,14 +240,25 @@ type deletePrivateEndpointOpts struct { } func (opts *deletePrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deletePrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deletePrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeletePrivateEndpointApiParams{ GroupId: opts.groupId, @@ -265,7 +298,6 @@ func deletePrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") _ = cmd.MarkFlagRequired("endpointServiceId") @@ -280,14 +312,25 @@ type deletePrivateEndpointServiceOpts struct { } func (opts *deletePrivateEndpointServiceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeletePrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -325,7 +368,6 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd @@ -340,14 +382,25 @@ type getPrivateEndpointOpts struct { } func (opts *getPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -387,7 +440,6 @@ func getPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") _ = cmd.MarkFlagRequired("endpointServiceId") @@ -402,14 +454,25 @@ type getPrivateEndpointServiceOpts struct { } func (opts *getPrivateEndpointServiceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetPrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -447,7 +510,6 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) cmd.Flags().StringVar(&opts.endpointServiceId, "endpointServiceId", "", `Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") return cmd @@ -459,14 +521,25 @@ type getRegionalizedPrivateEndpointSettingOpts struct { } func (opts *getRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, @@ -500,7 +573,6 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -511,14 +583,25 @@ type listPrivateEndpointServicesOpts struct { } func (opts *listPrivateEndpointServicesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListPrivateEndpointServicesApiParams{ GroupId: opts.groupId, @@ -554,7 +637,6 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("cloudProvider") return cmd } @@ -568,8 +650,22 @@ type toggleRegionalizedPrivateEndpointSettingOpts struct { } func (opts *toggleRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData() (*admin.ProjectSettingItem, error) { @@ -599,9 +695,6 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Contex if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.ToggleRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, @@ -641,7 +734,6 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index 0206742d2c..548c6c240d 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type addProjectApiKeyOpts struct { } func (opts *addProjectApiKeyOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *addProjectApiKeyOpts) readData() (*[]admin.UserAccessRoleAssignment, error) { @@ -70,9 +86,6 @@ func (opts *addProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.AddProjectApiKeyApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func addProjectApiKeyBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } @@ -128,8 +140,22 @@ type createApiKeyOpts struct { } func (opts *createApiKeyOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *createApiKeyOpts) readData() (*admin.CreateAtlasOrganizationApiKey, error) { @@ -159,9 +185,6 @@ func (opts *createApiKeyOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.CreateApiKeyApiParams{ OrgId: opts.orgId, @@ -201,7 +224,6 @@ func createApiKeyBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -218,8 +240,22 @@ type createApiKeyAccessListOpts struct { } func (opts *createApiKeyAccessListOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *createApiKeyAccessListOpts) readData() (*[]admin.UserAccessList, error) { @@ -249,9 +285,6 @@ func (opts *createApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.CreateApiKeyAccessListApiParams{ OrgId: opts.orgId, @@ -300,7 +333,6 @@ func createApiKeyAccessListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } @@ -314,8 +346,22 @@ type createProjectApiKeyOpts struct { } func (opts *createProjectApiKeyOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createProjectApiKeyOpts) readData() (*admin.CreateAtlasProjectApiKey, error) { @@ -345,9 +391,6 @@ func (opts *createProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateProjectApiKeyApiParams{ GroupId: opts.groupId, @@ -387,7 +430,6 @@ func createProjectApiKeyBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -398,14 +440,25 @@ type deleteApiKeyOpts struct { } func (opts *deleteApiKeyOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteApiKeyOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *deleteApiKeyOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteApiKeyApiParams{ OrgId: opts.orgId, @@ -441,7 +494,6 @@ func deleteApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } @@ -454,14 +506,25 @@ type deleteApiKeyAccessListEntryOpts struct { } func (opts *deleteApiKeyAccessListEntryOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteApiKeyAccessListEntryApiParams{ OrgId: opts.orgId, @@ -499,7 +562,6 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries.`) cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") _ = cmd.MarkFlagRequired("ipAddress") return cmd @@ -512,14 +574,25 @@ type getApiKeyOpts struct { } func (opts *getApiKeyOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getApiKeyOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getApiKeyOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetApiKeyApiParams{ OrgId: opts.orgId, @@ -555,7 +628,6 @@ func getApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } @@ -568,14 +640,25 @@ type getApiKeyAccessListOpts struct { } func (opts *getApiKeyAccessListOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetApiKeyAccessListApiParams{ OrgId: opts.orgId, @@ -613,7 +696,6 @@ func getApiKeyAccessListBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.ipAddress, "ipAddress", "", `One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("ipAddress") _ = cmd.MarkFlagRequired("apiUserId") return cmd @@ -629,14 +711,25 @@ type listApiKeyAccessListsEntriesOpts struct { } func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListApiKeyAccessListsEntriesApiParams{ OrgId: opts.orgId, @@ -678,7 +771,6 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } @@ -692,14 +784,25 @@ type listApiKeysOpts struct { } func (opts *listApiKeysOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listApiKeysOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listApiKeysOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListApiKeysApiParams{ OrgId: opts.orgId, @@ -739,7 +842,6 @@ func listApiKeysBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -752,14 +854,25 @@ type listProjectApiKeysOpts struct { } func (opts *listProjectApiKeysOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listProjectApiKeysOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listProjectApiKeysOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectApiKeysApiParams{ GroupId: opts.groupId, @@ -799,7 +912,6 @@ func listProjectApiKeysBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -810,14 +922,25 @@ type removeProjectApiKeyOpts struct { } func (opts *removeProjectApiKeyOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *removeProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *removeProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { params := &admin.RemoveProjectApiKeyApiParams{ GroupId: opts.groupId, @@ -853,7 +976,6 @@ func removeProjectApiKeyBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } @@ -868,8 +990,22 @@ type updateApiKeyOpts struct { } func (opts *updateApiKeyOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *updateApiKeyOpts) readData() (*admin.UpdateAtlasOrganizationApiKey, error) { @@ -899,9 +1035,6 @@ func (opts *updateApiKeyOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.UpdateApiKeyApiParams{ OrgId: opts.orgId, @@ -943,7 +1076,6 @@ func updateApiKeyBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } @@ -961,8 +1093,22 @@ type updateApiKeyRolesOpts struct { } func (opts *updateApiKeyRolesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateApiKeyRolesOpts) readData() (*admin.UpdateAtlasProjectApiKey, error) { @@ -992,9 +1138,6 @@ func (opts *updateApiKeyRolesOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateApiKeyRolesApiParams{ GroupId: opts.groupId, @@ -1043,7 +1186,6 @@ func updateApiKeyRolesBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("apiUserId") return cmd } diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 66dca5d40f..7b71b7ea61 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -41,8 +43,22 @@ type createProjectIpAccessListOpts struct { } func (opts *createProjectIpAccessListOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createProjectIpAccessListOpts) readData() (*[]admin.NetworkPermissionEntry, error) { @@ -72,9 +88,6 @@ func (opts *createProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateProjectIpAccessListApiParams{ GroupId: opts.groupId, @@ -121,7 +134,6 @@ func createProjectIpAccessListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -132,14 +144,25 @@ type deleteProjectIpAccessListOpts struct { } func (opts *deleteProjectIpAccessListOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteProjectIpAccessListApiParams{ GroupId: opts.groupId, @@ -179,7 +202,6 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { - how MongoDB Cloud or the driver using the address behaves, and - which protocol (like TCP or UDP) the connection uses.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd } @@ -191,14 +213,25 @@ type getProjectIpAccessListStatusOpts struct { } func (opts *getProjectIpAccessListStatusOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectIpAccessListStatusApiParams{ GroupId: opts.groupId, @@ -234,7 +267,6 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Network address or cloud provider security construct that identifies which project access list entry to be verified.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd } @@ -246,14 +278,25 @@ type getProjectIpListOpts struct { } func (opts *getProjectIpListOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getProjectIpListOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getProjectIpListOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectIpListApiParams{ GroupId: opts.groupId, @@ -289,7 +332,6 @@ func getProjectIpListBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("entryValue") return cmd } @@ -303,14 +345,25 @@ type listProjectIpAccessListsOpts struct { } func (opts *listProjectIpAccessListsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectIpAccessListsApiParams{ GroupId: opts.groupId, @@ -350,7 +403,6 @@ func listProjectIpAccessListsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index d3dcec1612..78690384c3 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,11 @@ type createProjectOpts struct { } func (opts *createProjectOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *createProjectOpts) readData() (*admin.Group, error) { @@ -121,8 +126,22 @@ type createProjectInvitationOpts struct { } func (opts *createProjectInvitationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createProjectInvitationOpts) readData() (*admin.GroupInvitationRequest, error) { @@ -152,9 +171,6 @@ func (opts *createProjectInvitationOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateProjectInvitationApiParams{ GroupId: opts.groupId, @@ -194,7 +210,6 @@ func createProjectInvitationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -204,14 +219,25 @@ type deleteProjectOpts struct { } func (opts *deleteProjectOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteProjectOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteProjectOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, @@ -245,7 +271,6 @@ func deleteProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -256,14 +281,25 @@ type deleteProjectInvitationOpts struct { } func (opts *deleteProjectInvitationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteProjectInvitationApiParams{ GroupId: opts.groupId, @@ -299,7 +335,6 @@ func deleteProjectInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd } @@ -311,14 +346,25 @@ type deleteProjectLimitOpts struct { } func (opts *deleteProjectLimitOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteProjectLimitOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteProjectLimitOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteProjectLimitApiParams{ LimitName: opts.limitName, @@ -371,7 +417,6 @@ func deleteProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("limitName") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -381,14 +426,25 @@ type getProjectOpts struct { } func (opts *getProjectOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getProjectOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getProjectOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectApiParams{ GroupId: opts.groupId, @@ -422,7 +478,6 @@ func getProjectBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -432,8 +487,11 @@ type getProjectByNameOpts struct { } func (opts *getProjectByNameOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *getProjectByNameOpts) run(ctx context.Context, w io.Writer) error { @@ -481,14 +539,25 @@ type getProjectInvitationOpts struct { } func (opts *getProjectInvitationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectInvitationApiParams{ GroupId: opts.groupId, @@ -524,7 +593,6 @@ func getProjectInvitationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd } @@ -536,14 +604,25 @@ type getProjectLimitOpts struct { } func (opts *getProjectLimitOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getProjectLimitOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getProjectLimitOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectLimitApiParams{ LimitName: opts.limitName, @@ -596,7 +675,6 @@ func getProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("limitName") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -606,14 +684,25 @@ type getProjectSettingsOpts struct { } func (opts *getProjectSettingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getProjectSettingsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getProjectSettingsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, @@ -647,7 +736,6 @@ func getProjectSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -658,14 +746,25 @@ type listProjectInvitationsOpts struct { } func (opts *listProjectInvitationsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listProjectInvitationsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listProjectInvitationsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectInvitationsApiParams{ GroupId: opts.groupId, @@ -701,7 +800,6 @@ func listProjectInvitationsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -711,14 +809,25 @@ type listProjectLimitsOpts struct { } func (opts *listProjectLimitsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listProjectLimitsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listProjectLimitsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, @@ -752,7 +861,6 @@ func listProjectLimitsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -767,14 +875,25 @@ type listProjectUsersOpts struct { } func (opts *listProjectUsersOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listProjectUsersOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listProjectUsersOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectUsersApiParams{ GroupId: opts.groupId, @@ -818,7 +937,6 @@ func listProjectUsersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.flattenTeams, "flattenTeams", false, `Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `"flattenTeams" : false`, this resource returns only users with a role in the project. If `"flattenTeams" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.`) cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, `Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `"includeOrgUsers": false`, this resource returns only users with a role in the project. If `"includeOrgUsers": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -830,8 +948,11 @@ type listProjectsOpts struct { } func (opts *listProjectsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *listProjectsOpts) run(ctx context.Context, w io.Writer) error { @@ -882,14 +1003,25 @@ type removeProjectUserOpts struct { } func (opts *removeProjectUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *removeProjectUserOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *removeProjectUserOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.RemoveProjectUserApiParams{ GroupId: opts.groupId, @@ -915,7 +1047,6 @@ func removeProjectUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("userId") return cmd } @@ -930,8 +1061,22 @@ type setProjectLimitOpts struct { } func (opts *setProjectLimitOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *setProjectLimitOpts) readData() (*admin.DataFederationLimit, error) { @@ -961,9 +1106,6 @@ func (opts *setProjectLimitOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.SetProjectLimitApiParams{ LimitName: opts.limitName, @@ -1022,7 +1164,6 @@ func setProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("limitName") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -1035,8 +1176,22 @@ type updateProjectOpts struct { } func (opts *updateProjectOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateProjectOpts) readData() (*admin.GroupName, error) { @@ -1066,9 +1221,6 @@ func (opts *updateProjectOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, @@ -1108,7 +1260,6 @@ func updateProjectBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -1121,8 +1272,22 @@ type updateProjectInvitationOpts struct { } func (opts *updateProjectInvitationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateProjectInvitationOpts) readData() (*admin.GroupInvitationRequest, error) { @@ -1152,9 +1317,6 @@ func (opts *updateProjectInvitationOpts) run(ctx context.Context, w io.Writer) e if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateProjectInvitationApiParams{ GroupId: opts.groupId, @@ -1194,7 +1356,6 @@ func updateProjectInvitationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -1208,8 +1369,22 @@ type updateProjectInvitationByIdOpts struct { } func (opts *updateProjectInvitationByIdOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateProjectInvitationByIdOpts) readData() (*admin.GroupInvitationUpdateRequest, error) { @@ -1239,9 +1414,6 @@ func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateProjectInvitationByIdApiParams{ GroupId: opts.groupId, @@ -1283,7 +1455,6 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("invitationId") return cmd } @@ -1298,8 +1469,22 @@ type updateProjectRolesOpts struct { } func (opts *updateProjectRolesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateProjectRolesOpts) readData() (*admin.UpdateGroupRolesForUser, error) { @@ -1329,9 +1514,6 @@ func (opts *updateProjectRolesOpts) run(ctx context.Context, w io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateProjectRolesApiParams{ GroupId: opts.groupId, @@ -1373,7 +1555,6 @@ func updateProjectRolesBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("userId") return cmd } @@ -1387,8 +1568,22 @@ type updateProjectSettingsOpts struct { } func (opts *updateProjectSettingsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateProjectSettingsOpts) readData() (*admin.GroupSettings, error) { @@ -1418,9 +1613,6 @@ func (opts *updateProjectSettingsOpts) run(ctx context.Context, w io.Writer) err if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateProjectSettingsApiParams{ GroupId: opts.groupId, @@ -1460,7 +1652,6 @@ func updateProjectSettingsBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index 9b8f52acaf..2f0264eea8 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createPushBasedLogConfigurationOpts struct { } func (opts *createPushBasedLogConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createPushBasedLogConfigurationOpts) readData() (*admin.PushBasedLogExportProject, error) { @@ -69,9 +85,6 @@ func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, _ io.W if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreatePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -101,7 +114,6 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -111,14 +123,25 @@ type deletePushBasedLogConfigurationOpts struct { } func (opts *deletePushBasedLogConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deletePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deletePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.DeletePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -142,7 +165,6 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -152,14 +174,25 @@ type getPushBasedLogConfigurationOpts struct { } func (opts *getPushBasedLogConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetPushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -193,7 +226,6 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -206,8 +238,22 @@ type updatePushBasedLogConfigurationOpts struct { } func (opts *updatePushBasedLogConfigurationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updatePushBasedLogConfigurationOpts) readData() (*admin.PushBasedLogExportProject, error) { @@ -237,9 +283,6 @@ func (opts *updatePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.W if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdatePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -269,7 +312,6 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index e261ff51ea..8711dfafa9 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createRollingIndexOpts struct { } func (opts *createRollingIndexOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createRollingIndexOpts) readData() (*admin.DatabaseRollingIndexRequest, error) { @@ -70,9 +86,6 @@ func (opts *createRollingIndexOpts) run(ctx context.Context, _ io.Writer) error if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateRollingIndexApiParams{ GroupId: opts.groupId, @@ -104,7 +117,6 @@ func createRollingIndexBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index 42d44bf0d6..967cf25f32 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -31,8 +31,11 @@ type getSystemStatusOpts struct { } func (opts *getSystemStatusOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + return nil } func (opts *getSystemStatusOpts) run(ctx context.Context, w io.Writer) error { diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index 74cb01ef73..8538d448c7 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type createServerlessInstanceOpts struct { } func (opts *createServerlessInstanceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createServerlessInstanceOpts) readData() (*admin.ServerlessInstanceDescriptionCreate, error) { @@ -69,9 +85,6 @@ func (opts *createServerlessInstanceOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -111,7 +124,6 @@ func createServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -122,14 +134,25 @@ type deleteServerlessInstanceOpts struct { } func (opts *deleteServerlessInstanceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -165,7 +188,6 @@ func deleteServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } @@ -177,14 +199,25 @@ type getServerlessInstanceOpts struct { } func (opts *getServerlessInstanceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -220,7 +253,6 @@ func getServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } @@ -234,14 +266,25 @@ type listServerlessInstancesOpts struct { } func (opts *listServerlessInstancesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listServerlessInstancesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listServerlessInstancesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListServerlessInstancesApiParams{ GroupId: opts.groupId, @@ -281,7 +324,6 @@ func listServerlessInstancesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -295,8 +337,22 @@ type updateServerlessInstanceOpts struct { } func (opts *updateServerlessInstanceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateServerlessInstanceOpts) readData() (*admin.ServerlessInstanceDescriptionUpdate, error) { @@ -326,9 +382,6 @@ func (opts *updateServerlessInstanceOpts) run(ctx context.Context, w io.Writer) if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -370,7 +423,6 @@ func updateServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("name") return cmd } diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index 0d2b6e6918..3b8a7d0abd 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createServerlessPrivateEndpointOpts struct { } func (opts *createServerlessPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantCreateRequest, error) { @@ -70,9 +86,6 @@ func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, w io.W if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") return cmd } @@ -127,14 +139,25 @@ type deleteServerlessPrivateEndpointOpts struct { } func (opts *deleteServerlessPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -172,7 +195,6 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") return cmd @@ -186,14 +208,25 @@ type getServerlessPrivateEndpointOpts struct { } func (opts *getServerlessPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -231,7 +264,6 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 24-hexadecimal digit string that identifies the tenant endpoint.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") return cmd @@ -244,14 +276,25 @@ type listServerlessPrivateEndpointsOpts struct { } func (opts *listServerlessPrivateEndpointsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListServerlessPrivateEndpointsApiParams{ GroupId: opts.groupId, @@ -287,7 +330,6 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") return cmd } @@ -303,8 +345,22 @@ type updateServerlessPrivateEndpointOpts struct { } func (opts *updateServerlessPrivateEndpointOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantEndpointUpdate, error) { @@ -334,9 +390,6 @@ func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, w io.W if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -380,7 +433,6 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") return cmd diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index 01880e83c2..bbddbea63a 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createSharedClusterBackupRestoreJobOpts struct { } func (opts *createSharedClusterBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createSharedClusterBackupRestoreJobOpts) readData() (*admin.TenantRestore, error) { @@ -70,9 +86,6 @@ func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, @@ -115,7 +128,6 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -127,14 +139,25 @@ type getSharedClusterBackupRestoreJobOpts struct { } func (opts *getSharedClusterBackupRestoreJobOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, @@ -173,7 +196,6 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.restoreId, "restoreId", "", `Unique 24-hexadecimal digit string that identifies the restore job to return.`) _ = cmd.MarkFlagRequired("clusterName") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("restoreId") return cmd } @@ -185,14 +207,25 @@ type listSharedClusterBackupRestoreJobsOpts struct { } func (opts *listSharedClusterBackupRestoreJobsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListSharedClusterBackupRestoreJobsApiParams{ ClusterName: opts.clusterName, @@ -229,7 +262,6 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("clusterName") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index 51a114a095..657e3431c5 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type downloadSharedClusterBackupOpts struct { } func (opts *downloadSharedClusterBackupOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *downloadSharedClusterBackupOpts) readData() (*admin.TenantRestore, error) { @@ -70,9 +86,6 @@ func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.DownloadSharedClusterBackupApiParams{ ClusterName: opts.clusterName, @@ -115,7 +128,6 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -127,14 +139,25 @@ type getSharedClusterBackupOpts struct { } func (opts *getSharedClusterBackupOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getSharedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getSharedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetSharedClusterBackupApiParams{ GroupId: opts.groupId, @@ -172,7 +195,6 @@ func getSharedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.snapshotId, "snapshotId", "", `Unique 24-hexadecimal digit string that identifies the desired snapshot.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") return cmd @@ -185,14 +207,25 @@ type listSharedClusterBackupsOpts struct { } func (opts *listSharedClusterBackupsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListSharedClusterBackupsApiParams{ GroupId: opts.groupId, @@ -228,7 +261,6 @@ func listSharedClusterBackupsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("clusterName") return cmd } diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index 859aa8fb3b..1f83e3c422 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createStreamConnectionOpts struct { } func (opts *createStreamConnectionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createStreamConnectionOpts) readData() (*admin.StreamsConnection, error) { @@ -70,9 +86,6 @@ func (opts *createStreamConnectionOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateStreamConnectionApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func createStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } @@ -128,8 +140,22 @@ type createStreamInstanceOpts struct { } func (opts *createStreamInstanceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createStreamInstanceOpts) readData() (*admin.StreamsTenant, error) { @@ -159,9 +185,6 @@ func (opts *createStreamInstanceOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateStreamInstanceApiParams{ GroupId: opts.groupId, @@ -201,7 +224,6 @@ func createStreamInstanceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -213,14 +235,25 @@ type deleteStreamConnectionOpts struct { } func (opts *deleteStreamConnectionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteStreamConnectionApiParams{ GroupId: opts.groupId, @@ -258,7 +291,6 @@ func deleteStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("connectionName") return cmd @@ -271,14 +303,25 @@ type deleteStreamInstanceOpts struct { } func (opts *deleteStreamInstanceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteStreamInstanceApiParams{ GroupId: opts.groupId, @@ -314,7 +357,6 @@ func deleteStreamInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to delete.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } @@ -327,14 +369,25 @@ type getStreamConnectionOpts struct { } func (opts *getStreamConnectionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetStreamConnectionApiParams{ GroupId: opts.groupId, @@ -372,7 +425,6 @@ func getStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().StringVar(&opts.connectionName, "connectionName", "", `Human-readable label that identifies the stream connection to return.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("connectionName") return cmd @@ -386,14 +438,25 @@ type getStreamInstanceOpts struct { } func (opts *getStreamInstanceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetStreamInstanceApiParams{ GroupId: opts.groupId, @@ -431,7 +494,6 @@ func getStreamInstanceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to return.`) cmd.Flags().BoolVar(&opts.includeConnections, "includeConnections", false, `Flag to indicate whether connections information should be included in the stream instance.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } @@ -445,14 +507,25 @@ type listStreamConnectionsOpts struct { } func (opts *listStreamConnectionsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listStreamConnectionsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listStreamConnectionsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListStreamConnectionsApiParams{ GroupId: opts.groupId, @@ -492,7 +565,6 @@ func listStreamConnectionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } @@ -505,14 +577,25 @@ type listStreamInstancesOpts struct { } func (opts *listStreamInstancesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listStreamInstancesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listStreamInstancesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListStreamInstancesApiParams{ GroupId: opts.groupId, @@ -550,7 +633,6 @@ func listStreamInstancesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -565,8 +647,22 @@ type updateStreamConnectionOpts struct { } func (opts *updateStreamConnectionOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateStreamConnectionOpts) readData() (*admin.StreamsConnection, error) { @@ -596,9 +692,6 @@ func (opts *updateStreamConnectionOpts) run(ctx context.Context, w io.Writer) er if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateStreamConnectionApiParams{ GroupId: opts.groupId, @@ -642,7 +735,6 @@ func updateStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("connectionName") return cmd @@ -658,8 +750,22 @@ type updateStreamInstanceOpts struct { } func (opts *updateStreamInstanceOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateStreamInstanceOpts) readData() (*admin.StreamsDataProcessRegion, error) { @@ -689,9 +795,6 @@ func (opts *updateStreamInstanceOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateStreamInstanceApiParams{ GroupId: opts.groupId, @@ -733,7 +836,6 @@ func updateStreamInstanceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("tenantName") return cmd } diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index 4804c14749..137057a91a 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -38,8 +40,22 @@ type addAllTeamsToProjectOpts struct { } func (opts *addAllTeamsToProjectOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *addAllTeamsToProjectOpts) readData() (*[]admin.TeamRole, error) { @@ -69,9 +85,6 @@ func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, w io.Writer) erro if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.AddAllTeamsToProjectApiParams{ GroupId: opts.groupId, @@ -111,7 +124,6 @@ func addAllTeamsToProjectBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -125,8 +137,22 @@ type addTeamUserOpts struct { } func (opts *addTeamUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *addTeamUserOpts) readData() (*[]admin.AddUserToTeam, error) { @@ -156,9 +182,6 @@ func (opts *addTeamUserOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.AddTeamUserApiParams{ OrgId: opts.orgId, @@ -200,7 +223,6 @@ func addTeamUserBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } @@ -214,8 +236,22 @@ type createTeamOpts struct { } func (opts *createTeamOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *createTeamOpts) readData() (*admin.Team, error) { @@ -245,9 +281,6 @@ func (opts *createTeamOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.CreateTeamApiParams{ OrgId: opts.orgId, @@ -287,7 +320,6 @@ func createTeamBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -298,14 +330,25 @@ type deleteTeamOpts struct { } func (opts *deleteTeamOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteTeamOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *deleteTeamOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteTeamApiParams{ OrgId: opts.orgId, @@ -341,7 +384,6 @@ func deleteTeamBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to delete.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } @@ -353,14 +395,25 @@ type getTeamByIdOpts struct { } func (opts *getTeamByIdOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getTeamByIdOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getTeamByIdOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetTeamByIdApiParams{ OrgId: opts.orgId, @@ -396,7 +449,6 @@ func getTeamByIdBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose information you want to return.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } @@ -408,14 +460,25 @@ type getTeamByNameOpts struct { } func (opts *getTeamByNameOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getTeamByNameOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *getTeamByNameOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetTeamByNameApiParams{ OrgId: opts.orgId, @@ -451,7 +514,6 @@ func getTeamByNameBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamName, "teamName", "", `Name of the team whose information you want to return.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamName") return cmd } @@ -465,14 +527,25 @@ type listOrganizationTeamsOpts struct { } func (opts *listOrganizationTeamsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listOrganizationTeamsOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listOrganizationTeamsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListOrganizationTeamsApiParams{ OrgId: opts.orgId, @@ -512,7 +585,6 @@ func listOrganizationTeamsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("orgId") return cmd } @@ -525,14 +597,25 @@ type listProjectTeamsOpts struct { } func (opts *listProjectTeamsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listProjectTeamsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listProjectTeamsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListProjectTeamsApiParams{ GroupId: opts.groupId, @@ -572,7 +655,6 @@ func listProjectTeamsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -585,14 +667,25 @@ type listTeamUsersOpts struct { } func (opts *listTeamUsersOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listTeamUsersOpts) run(ctx context.Context, w io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *listTeamUsersOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListTeamUsersApiParams{ OrgId: opts.orgId, @@ -632,7 +725,6 @@ func listTeamUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } @@ -644,14 +736,25 @@ type removeProjectTeamOpts struct { } func (opts *removeProjectTeamOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *removeProjectTeamOpts) run(ctx context.Context, _ io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *removeProjectTeamOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, @@ -677,7 +780,6 @@ func removeProjectTeamBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") return cmd } @@ -690,14 +792,25 @@ type removeTeamUserOpts struct { } func (opts *removeTeamUserOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Writer) error { if opts.orgId == "" { opts.orgId = config.OrgID() } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil +} + +func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Writer) error { params := &admin.RemoveTeamUserApiParams{ OrgId: opts.orgId, @@ -725,7 +838,6 @@ func removeTeamUserBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user.`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team.`) - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") _ = cmd.MarkFlagRequired("userId") return cmd @@ -741,8 +853,22 @@ type renameTeamOpts struct { } func (opts *renameTeamOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.orgId == "" { + opts.orgId = config.OrgID() + } + if opts.orgId == "" { + return errors.New(`required flag(s) "orgId" not set`) + } + b, errDecode := hex.DecodeString(opts.orgId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) + } + + return nil } func (opts *renameTeamOpts) readData() (*admin.Team, error) { @@ -772,9 +898,6 @@ func (opts *renameTeamOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.orgId == "" { - opts.orgId = config.OrgID() - } params := &admin.RenameTeamApiParams{ OrgId: opts.orgId, @@ -816,7 +939,6 @@ func renameTeamBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("orgId") _ = cmd.MarkFlagRequired("teamId") return cmd } @@ -831,8 +953,22 @@ type updateTeamRolesOpts struct { } func (opts *updateTeamRolesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateTeamRolesOpts) readData() (*admin.TeamRole, error) { @@ -862,9 +998,6 @@ func (opts *updateTeamRolesOpts) run(ctx context.Context, w io.Writer) error { if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateTeamRolesApiParams{ GroupId: opts.groupId, @@ -906,7 +1039,6 @@ func updateTeamRolesBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("teamId") return cmd } diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 706918aa97..7812697e30 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -42,8 +44,22 @@ type createThirdPartyIntegrationOpts struct { } func (opts *createThirdPartyIntegrationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegration, error) { @@ -73,9 +89,6 @@ func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, @@ -125,7 +138,6 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("integrationType") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -136,14 +148,25 @@ type deleteThirdPartyIntegrationOpts struct { } func (opts *deleteThirdPartyIntegrationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.DeleteThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, @@ -180,7 +203,6 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("integrationType") - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -191,14 +213,25 @@ type getThirdPartyIntegrationOpts struct { } func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { params := &admin.GetThirdPartyIntegrationApiParams{ GroupId: opts.groupId, @@ -234,7 +267,6 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("integrationType") return cmd } @@ -248,14 +280,25 @@ type listThirdPartyIntegrationsOpts struct { } func (opts *listThirdPartyIntegrationsOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListThirdPartyIntegrationsApiParams{ GroupId: opts.groupId, @@ -295,7 +338,6 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -312,8 +354,22 @@ type updateThirdPartyIntegrationOpts struct { } func (opts *updateThirdPartyIntegrationOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *updateThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegration, error) { @@ -343,9 +399,6 @@ func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, w io.Write if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.UpdateThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, @@ -395,7 +448,6 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("integrationType") - _ = cmd.MarkFlagRequired("groupId") return cmd } diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index 9770cf6c19..f0cc9bc538 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -18,7 +18,9 @@ package api import ( "context" + "encoding/hex" "encoding/json" + "errors" "fmt" "io" "os" @@ -39,8 +41,22 @@ type createDatabaseUserCertificateOpts struct { } func (opts *createDatabaseUserCertificateOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil } func (opts *createDatabaseUserCertificateOpts) readData() (*admin.UserCert, error) { @@ -70,9 +86,6 @@ func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, w io.Wri if errData != nil { return errData } - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } params := &admin.CreateDatabaseUserCertificateApiParams{ GroupId: opts.groupId, @@ -114,7 +127,6 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") return cmd } @@ -125,14 +137,25 @@ type disableCustomerManagedX509Opts struct { } func (opts *disableCustomerManagedX509Opts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, w io.Writer) error { params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, @@ -166,7 +189,6 @@ func disableCustomerManagedX509Builder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - _ = cmd.MarkFlagRequired("groupId") return cmd } @@ -180,14 +202,25 @@ type listDatabaseUserCertificatesOpts struct { } func (opts *listDatabaseUserCertificatesOpts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err -} + if opts.client, err = newClientWithAuth(); err != nil { + return err + } -func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, w io.Writer) error { if opts.groupId == "" { opts.groupId = config.ProjectID() } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, w io.Writer) error { params := &admin.ListDatabaseUserCertificatesApiParams{ GroupId: opts.groupId, @@ -229,7 +262,6 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) - _ = cmd.MarkFlagRequired("groupId") _ = cmd.MarkFlagRequired("username") return cmd } diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 8f14d03ddc..5c11c96785 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -3,11 +3,13 @@ package {{packageName}} import ( "context" - "os" - "io" - "time" + "errors" + "encoding/hex" "encoding/json" "fmt" + "io" + "os" + "time" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -29,8 +31,35 @@ type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { } func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) preRun() (err error) { - opts.client, err = newClientWithAuth() - return err + if opts.client, err = newClientWithAuth(); err != nil { + return err + } + + {{#allParams}}{{#vendorExtensions.x-group-id}} + if opts.{{paramName}} == "" { + opts.{{paramName}} = config.ProjectID() + } + if opts.{{paramName}} == "" { + return errors.New(`required flag(s) "{{#vendorExtensions.x-flag-name}}{{.}}{{/vendorExtensions.x-flag-name}}{{^vendorExtensions.x-flag-name}}{{paramName}}{{/vendorExtensions.x-flag-name}}" not set`) + } + b, errDecode := hex.DecodeString(opts.{{paramName}}) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.{{paramName}}) + } + {{/vendorExtensions.x-group-id}}{{#vendorExtensions.x-org-id}} + if opts.{{paramName}} == "" { + opts.{{paramName}} = config.OrgID() + } + if opts.{{paramName}} == "" { + return errors.New(`required flag(s) "{{#vendorExtensions.x-flag-name}}{{.}}{{/vendorExtensions.x-flag-name}}{{^vendorExtensions.x-flag-name}}{{paramName}}{{/vendorExtensions.x-flag-name}}" not set`) + } + b, errDecode := hex.DecodeString(opts.{{paramName}}) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.{{paramName}}) + } + {{/vendorExtensions.x-org-id}}{{/allParams}} + + return nil } {{#bodyParam}} @@ -73,17 +102,7 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(c return err{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}} } } - {{/isDateTime}} - {{#vendorExtensions.x-group-id}} - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } - {{/vendorExtensions.x-group-id}} - {{#vendorExtensions.x-org-id}} - if opts.orgId == "" { - opts.orgId = config.OrgID() - } - {{/vendorExtensions.x-org-id}}{{/allParams}} + {{/isDateTime}}{{/allParams}} params := &admin.{{operationId}}ApiParams{ {{#allParams}} {{^isBodyParam}}{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}: {{^isPathParam}}{{^isDateTime}}&{{/isDateTime}}{{/isPathParam}}{{^isDateTime}}opts.{{/isDateTime}}{{paramName}},{{/isBodyParam}} @@ -130,8 +149,8 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C {{#bodyParam}} cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") {{/bodyParam}} -{{#allParams}}{{^isBodyParam}}{{#required}} - _ = cmd.MarkFlagRequired("{{paramName}}"){{/required}}{{/isBodyParam}}{{/allParams}} +{{#allParams}}{{^isBodyParam}}{{^vendorExtensions.x-org-id}}{{^vendorExtensions.x-group-id}}{{#required}} + _ = cmd.MarkFlagRequired("{{#vendorExtensions.x-flag-name}}{{.}}{{/vendorExtensions.x-flag-name}}{{^vendorExtensions.x-flag-name}}{{paramName}}{{/vendorExtensions.x-flag-name}}"){{/required}}{{/vendorExtensions.x-group-id}}{{/vendorExtensions.x-org-id}}{{/isBodyParam}}{{/allParams}} return cmd } {{/operation}} From 32dfcdbbcacbac2cd84e2608f1010a30b73b16bb Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Mon, 2 Oct 2023 10:51:16 +0100 Subject: [PATCH 34/44] add format --- internal/api/api_access_tracking_cmd.go | 52 +- internal/api/api_alert_configurations_cmd.go | 202 ++++- internal/api/api_alerts_cmd.go | 109 ++- internal/api/api_atlas_search_cmd.go | 140 +++- internal/api/api_auditing_cmd.go | 59 +- internal/api/api_aws_clusters_dns_cmd.go | 59 +- internal/api/api_cloud_backups_cmd.go | 776 ++++++++++++++---- .../api/api_cloud_migration_service_cmd.go | 202 ++++- internal/api/api_cloud_provider_access_cmd.go | 121 ++- .../api/api_cluster_outage_simulation_cmd.go | 84 +- internal/api/api_clusters_cmd.go | 370 +++++++-- internal/api/api_custom_database_roles_cmd.go | 121 ++- internal/api/api_data_federation_cmd.go | 377 +++++++-- internal/api/api_data_lake_pipelines_cmd.go | 346 ++++++-- internal/api/api_database_users_cmd.go | 140 +++- ..._rest_using_customer_key_management_cmd.go | 59 +- internal/api/api_events_cmd.go | 102 ++- .../api/api_federated_authentication_cmd.go | 364 ++++++-- internal/api/api_global_clusters_cmd.go | 140 +++- internal/api/api_invoices_cmd.go | 159 +++- internal/api/api_ldap_configuration_cmd.go | 140 +++- internal/api/api_legacy_backup_cmd.go | 265 ++++-- .../api/api_legacy_backup_restore_jobs_cmd.go | 34 +- internal/api/api_maintenance_windows__cmd.go | 77 +- internal/api/api_mongo_db_cloud_users_cmd.go | 84 +- internal/api/api_monitoring_and_logs_cmd.go | 352 ++++++-- internal/api/api_network_peering_cmd.go | 358 ++++++-- internal/api/api_online_archive_cmd.go | 165 +++- internal/api/api_organizations_cmd.go | 470 +++++++++-- internal/api/api_performance_advisor_cmd.go | 89 +- .../api/api_private_endpoint_services_cmd.go | 246 ++++-- internal/api/api_programmatic_api_keys_cmd.go | 389 +++++++-- .../api/api_project_ip_access_list_cmd.go | 134 ++- internal/api/api_projects_cmd.go | 557 ++++++++++--- internal/api/api_push_based_log_export_cmd.go | 58 +- internal/api/api_rolling_index_cmd.go | 13 +- internal/api/api_root_cmd.go | 27 +- internal/api/api_serverless_instances_cmd.go | 140 +++- .../api_serverless_private_endpoints_cmd.go | 140 +++- .../api/api_shared_tier_restore_jobs_cmd.go | 84 +- internal/api/api_shared_tier_snapshots_cmd.go | 84 +- internal/api/api_streams_cmd.go | 277 +++++-- internal/api/api_teams_cmd.go | 320 ++++++-- .../api/api_third_party_integrations_cmd.go | 140 +++- internal/api/api_x509_authentication_cmd.go | 84 +- .../config/go-templates/cmd.mustache | 39 +- 46 files changed, 7071 insertions(+), 1677 deletions(-) diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index 0589ccec41..82dac59098 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -23,6 +23,8 @@ import ( "errors" "fmt" "io" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/cobra" @@ -38,6 +40,8 @@ type listAccessLogsByClusterNameOpts struct { ipAddress string nLogs int start int64 + format string + tmpl *template.Template } func (opts *listAccessLogsByClusterNameOpts) preRun() (err error) { @@ -56,10 +60,14 @@ func (opts *listAccessLogsByClusterNameOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAccessLogsByClusterNameApiParams{ GroupId: opts.groupId, @@ -81,7 +89,17 @@ func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -94,7 +112,7 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -106,6 +124,7 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -118,6 +137,8 @@ type listAccessLogsByHostnameOpts struct { ipAddress string nLogs int start int64 + format string + tmpl *template.Template } func (opts *listAccessLogsByHostnameOpts) preRun() (err error) { @@ -136,10 +157,14 @@ func (opts *listAccessLogsByHostnameOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAccessLogsByHostnameApiParams{ GroupId: opts.groupId, @@ -161,7 +186,17 @@ func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -174,7 +209,7 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -186,6 +221,7 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.start, "start", 0, `Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds.`) _ = cmd.MarkFlagRequired("hostname") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index b690754968..2b21ec0905 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createAlertConfigurationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createAlertConfigurationOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createAlertConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, error) { +func (opts *createAlertConfigurationOpts) readData(r io.Reader) (*admin.GroupAlertsConfig, error) { var out *admin.GroupAlertsConfig var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, return out, nil } -func (opts *createAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createAlertConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createAlertConfigurationOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -149,10 +167,10 @@ func (opts *deleteAlertConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *deleteAlertConfigurationOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *deleteAlertConfigurationOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DeleteAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -172,7 +190,7 @@ func deleteAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -186,6 +204,8 @@ type getAlertConfigurationOpts struct { client *admin.APIClient groupId string alertConfigId string + format string + tmpl *template.Template } func (opts *getAlertConfigurationOpts) preRun() (err error) { @@ -204,10 +224,14 @@ func (opts *getAlertConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getAlertConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetAlertConfigurationApiParams{ GroupId: opts.groupId, @@ -224,7 +248,17 @@ func (opts *getAlertConfigurationOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -237,18 +271,21 @@ func getAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertConfigId, "alertConfigId", "", `Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("alertConfigId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listAlertConfigurationMatchersFieldNamesOpts struct { client *admin.APIClient + format string + tmpl *template.Template } func (opts *listAlertConfigurationMatchersFieldNamesOpts) preRun() (err error) { @@ -256,10 +293,14 @@ func (opts *listAlertConfigurationMatchersFieldNamesOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAlertConfigurationMatchersFieldNamesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAlertConfigurationMatchersFieldNamesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{} @@ -273,7 +314,17 @@ func (opts *listAlertConfigurationMatchersFieldNamesOpts) run(ctx context.Contex return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -286,10 +337,11 @@ func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -299,6 +351,8 @@ type listAlertConfigurationsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listAlertConfigurationsOpts) preRun() (err error) { @@ -317,10 +371,14 @@ func (opts *listAlertConfigurationsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAlertConfigurationsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAlertConfigurationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAlertConfigurationsApiParams{ GroupId: opts.groupId, @@ -339,7 +397,17 @@ func (opts *listAlertConfigurationsOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -352,7 +420,7 @@ func listAlertConfigurationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -360,6 +428,7 @@ func listAlertConfigurationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -370,6 +439,8 @@ type listAlertConfigurationsByAlertIdOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listAlertConfigurationsByAlertIdOpts) preRun() (err error) { @@ -388,10 +459,14 @@ func (opts *listAlertConfigurationsByAlertIdOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAlertConfigurationsByAlertIdApiParams{ GroupId: opts.groupId, @@ -411,7 +486,17 @@ func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, w io. return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -424,7 +509,7 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -434,6 +519,7 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("alertId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -444,6 +530,8 @@ type toggleAlertConfigurationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *toggleAlertConfigurationOpts) preRun() (err error) { @@ -462,16 +550,20 @@ func (opts *toggleAlertConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *toggleAlertConfigurationOpts) readData() (*admin.AlertsToggle, error) { +func (opts *toggleAlertConfigurationOpts) readData(r io.Reader) (*admin.AlertsToggle, error) { var out *admin.AlertsToggle var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -487,8 +579,8 @@ func (opts *toggleAlertConfigurationOpts) readData() (*admin.AlertsToggle, error return out, nil } -func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -510,7 +602,17 @@ func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -525,7 +627,7 @@ func toggleAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -534,6 +636,7 @@ func toggleAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("alertConfigId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -544,6 +647,8 @@ type updateAlertConfigurationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateAlertConfigurationOpts) preRun() (err error) { @@ -562,16 +667,20 @@ func (opts *updateAlertConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, error) { +func (opts *updateAlertConfigurationOpts) readData(r io.Reader) (*admin.GroupAlertsConfig, error) { var out *admin.GroupAlertsConfig var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -587,8 +696,8 @@ func (opts *updateAlertConfigurationOpts) readData() (*admin.GroupAlertsConfig, return out, nil } -func (opts *updateAlertConfigurationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateAlertConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -610,7 +719,17 @@ func (opts *updateAlertConfigurationOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -625,7 +744,7 @@ func updateAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -634,6 +753,7 @@ func updateAlertConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("alertConfigId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index ff8e590794..20ec002cb3 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type acknowledgeAlertOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *acknowledgeAlertOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *acknowledgeAlertOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *acknowledgeAlertOpts) readData() (*admin.AlertViewForNdsGroup, error) { +func (opts *acknowledgeAlertOpts) readData(r io.Reader) (*admin.AlertViewForNdsGroup, error) { var out *admin.AlertViewForNdsGroup var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *acknowledgeAlertOpts) readData() (*admin.AlertViewForNdsGroup, error return out, nil } -func (opts *acknowledgeAlertOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *acknowledgeAlertOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *acknowledgeAlertOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func acknowledgeAlertBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func acknowledgeAlertBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("alertId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -135,6 +153,8 @@ type getAlertOpts struct { client *admin.APIClient groupId string alertId string + format string + tmpl *template.Template } func (opts *getAlertOpts) preRun() (err error) { @@ -153,10 +173,14 @@ func (opts *getAlertOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getAlertOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getAlertOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetAlertApiParams{ GroupId: opts.groupId, @@ -173,7 +197,17 @@ func (opts *getAlertOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -186,13 +220,14 @@ func getAlertBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.alertId, "alertId", "", `Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access.`) _ = cmd.MarkFlagRequired("alertId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -203,6 +238,8 @@ type listAlertsOpts struct { itemsPerPage int pageNum int status string + format string + tmpl *template.Template } func (opts *listAlertsOpts) preRun() (err error) { @@ -221,10 +258,14 @@ func (opts *listAlertsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAlertsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAlertsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAlertsApiParams{ GroupId: opts.groupId, @@ -244,7 +285,17 @@ func (opts *listAlertsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -257,7 +308,7 @@ func listAlertsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -266,6 +317,7 @@ func listAlertsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.status, "status", "", `Status of the alerts to return. Omit to return all alerts in all statuses.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -276,6 +328,8 @@ type listAlertsByAlertConfigurationIdOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listAlertsByAlertConfigurationIdOpts) preRun() (err error) { @@ -294,10 +348,14 @@ func (opts *listAlertsByAlertConfigurationIdOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAlertsByAlertConfigurationIdApiParams{ GroupId: opts.groupId, @@ -317,7 +375,17 @@ func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, w io. return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -330,7 +398,7 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -340,6 +408,7 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("alertConfigId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index ba1976a8d5..f245848b59 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createAtlasSearchIndexOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createAtlasSearchIndexOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createAtlasSearchIndexOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, error) { +func (opts *createAtlasSearchIndexOpts) readData(r io.Reader) (*admin.ClusterSearchIndex, error) { var out *admin.ClusterSearchIndex var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, e return out, nil } -func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createAtlasSearchIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func createAtlasSearchIndexBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -136,6 +154,8 @@ type deleteAtlasSearchIndexOpts struct { groupId string clusterName string indexId string + format string + tmpl *template.Template } func (opts *deleteAtlasSearchIndexOpts) preRun() (err error) { @@ -154,10 +174,14 @@ func (opts *deleteAtlasSearchIndexOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -175,7 +199,17 @@ func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -188,7 +222,7 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -197,6 +231,7 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -205,6 +240,8 @@ type getAtlasSearchIndexOpts struct { groupId string clusterName string indexId string + format string + tmpl *template.Template } func (opts *getAtlasSearchIndexOpts) preRun() (err error) { @@ -223,10 +260,14 @@ func (opts *getAtlasSearchIndexOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -244,7 +285,17 @@ func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -257,7 +308,7 @@ func getAtlasSearchIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -266,6 +317,7 @@ func getAtlasSearchIndexBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -275,6 +327,8 @@ type listAtlasSearchIndexesOpts struct { clusterName string collectionName string databaseName string + format string + tmpl *template.Template } func (opts *listAtlasSearchIndexesOpts) preRun() (err error) { @@ -293,10 +347,14 @@ func (opts *listAtlasSearchIndexesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAtlasSearchIndexesApiParams{ GroupId: opts.groupId, @@ -315,7 +373,17 @@ func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -328,7 +396,7 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -339,6 +407,7 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("databaseName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -350,6 +419,8 @@ type updateAtlasSearchIndexOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateAtlasSearchIndexOpts) preRun() (err error) { @@ -368,16 +439,20 @@ func (opts *updateAtlasSearchIndexOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, error) { +func (opts *updateAtlasSearchIndexOpts) readData(r io.Reader) (*admin.ClusterSearchIndex, error) { var out *admin.ClusterSearchIndex var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -393,8 +468,8 @@ func (opts *updateAtlasSearchIndexOpts) readData() (*admin.ClusterSearchIndex, e return out, nil } -func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -417,7 +492,17 @@ func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -432,7 +517,7 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -443,6 +528,7 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("indexId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 292b0b9eac..85cacb62e2 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -34,6 +35,8 @@ import ( type getAuditingConfigurationOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getAuditingConfigurationOpts) preRun() (err error) { @@ -52,10 +55,14 @@ func (opts *getAuditingConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getAuditingConfigurationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getAuditingConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, @@ -71,7 +78,17 @@ func (opts *getAuditingConfigurationOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -84,11 +101,12 @@ func getAuditingConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -98,6 +116,8 @@ type updateAuditingConfigurationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateAuditingConfigurationOpts) preRun() (err error) { @@ -116,16 +136,20 @@ func (opts *updateAuditingConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateAuditingConfigurationOpts) readData() (*admin.AuditLog, error) { +func (opts *updateAuditingConfigurationOpts) readData(r io.Reader) (*admin.AuditLog, error) { var out *admin.AuditLog var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -141,8 +165,8 @@ func (opts *updateAuditingConfigurationOpts) readData() (*admin.AuditLog, error) return out, nil } -func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -163,7 +187,17 @@ func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -178,13 +212,14 @@ func updateAuditingConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index 778bedf1a1..829fd03720 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -34,6 +35,8 @@ import ( type getAWSCustomDNSOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getAWSCustomDNSOpts) preRun() (err error) { @@ -52,10 +55,14 @@ func (opts *getAWSCustomDNSOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getAWSCustomDNSOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, @@ -71,7 +78,17 @@ func (opts *getAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -84,11 +101,12 @@ func getAWSCustomDNSBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -98,6 +116,8 @@ type toggleAWSCustomDNSOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *toggleAWSCustomDNSOpts) preRun() (err error) { @@ -116,16 +136,20 @@ func (opts *toggleAWSCustomDNSOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *toggleAWSCustomDNSOpts) readData() (*admin.AWSCustomDNSEnabled, error) { +func (opts *toggleAWSCustomDNSOpts) readData(r io.Reader) (*admin.AWSCustomDNSEnabled, error) { var out *admin.AWSCustomDNSEnabled var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -141,8 +165,8 @@ func (opts *toggleAWSCustomDNSOpts) readData() (*admin.AWSCustomDNSEnabled, erro return out, nil } -func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -163,7 +187,17 @@ func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -178,13 +212,14 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 34d7225146..6aa26fab88 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -36,6 +37,8 @@ type cancelBackupRestoreJobOpts struct { groupId string clusterName string restoreJobId string + format string + tmpl *template.Template } func (opts *cancelBackupRestoreJobOpts) preRun() (err error) { @@ -54,10 +57,14 @@ func (opts *cancelBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { +func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.CancelBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -75,7 +82,17 @@ func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -88,7 +105,7 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -97,6 +114,7 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -107,6 +125,8 @@ type createBackupExportJobOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createBackupExportJobOpts) preRun() (err error) { @@ -125,16 +145,20 @@ func (opts *createBackupExportJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createBackupExportJobOpts) readData() (*admin.DiskBackupExportJobRequest, error) { +func (opts *createBackupExportJobOpts) readData(r io.Reader) (*admin.DiskBackupExportJobRequest, error) { var out *admin.DiskBackupExportJobRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -150,8 +174,8 @@ func (opts *createBackupExportJobOpts) readData() (*admin.DiskBackupExportJobReq return out, nil } -func (opts *createBackupExportJobOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createBackupExportJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -173,7 +197,17 @@ func (opts *createBackupExportJobOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -188,7 +222,7 @@ func createBackupExportJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -197,6 +231,7 @@ func createBackupExportJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -207,6 +242,8 @@ type createBackupRestoreJobOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createBackupRestoreJobOpts) preRun() (err error) { @@ -225,16 +262,20 @@ func (opts *createBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createBackupRestoreJobOpts) readData() (*admin.DiskBackupSnapshotRestoreJob, error) { +func (opts *createBackupRestoreJobOpts) readData(r io.Reader) (*admin.DiskBackupSnapshotRestoreJob, error) { var out *admin.DiskBackupSnapshotRestoreJob var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -250,8 +291,8 @@ func (opts *createBackupRestoreJobOpts) readData() (*admin.DiskBackupSnapshotRes return out, nil } -func (opts *createBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -273,7 +314,17 @@ func (opts *createBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -288,7 +339,7 @@ func createBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -297,6 +348,7 @@ func createBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -306,6 +358,8 @@ type createExportBucketOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createExportBucketOpts) preRun() (err error) { @@ -324,16 +378,20 @@ func (opts *createExportBucketOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createExportBucketOpts) readData() (*admin.DiskBackupSnapshotAWSExportBucket, error) { +func (opts *createExportBucketOpts) readData(r io.Reader) (*admin.DiskBackupSnapshotAWSExportBucket, error) { var out *admin.DiskBackupSnapshotAWSExportBucket var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -349,8 +407,8 @@ func (opts *createExportBucketOpts) readData() (*admin.DiskBackupSnapshotAWSExpo return out, nil } -func (opts *createExportBucketOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createExportBucketOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -371,7 +429,17 @@ func (opts *createExportBucketOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -386,13 +454,14 @@ func createExportBucketBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -403,6 +472,8 @@ type createServerlessBackupRestoreJobOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createServerlessBackupRestoreJobOpts) preRun() (err error) { @@ -421,16 +492,20 @@ func (opts *createServerlessBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createServerlessBackupRestoreJobOpts) readData() (*admin.ServerlessBackupRestoreJob, error) { +func (opts *createServerlessBackupRestoreJobOpts) readData(r io.Reader) (*admin.ServerlessBackupRestoreJob, error) { var out *admin.ServerlessBackupRestoreJob var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -446,8 +521,8 @@ func (opts *createServerlessBackupRestoreJobOpts) readData() (*admin.ServerlessB return out, nil } -func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -469,7 +544,17 @@ func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, w io. return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -484,7 +569,7 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -493,6 +578,7 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -500,6 +586,8 @@ type deleteAllBackupSchedulesOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *deleteAllBackupSchedulesOpts) preRun() (err error) { @@ -518,10 +606,14 @@ func (opts *deleteAllBackupSchedulesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteAllBackupSchedulesApiParams{ GroupId: opts.groupId, @@ -538,7 +630,17 @@ func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -551,13 +653,14 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -565,6 +668,8 @@ type deleteExportBucketOpts struct { client *admin.APIClient groupId string exportBucketId string + format string + tmpl *template.Template } func (opts *deleteExportBucketOpts) preRun() (err error) { @@ -583,10 +688,14 @@ func (opts *deleteExportBucketOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteExportBucketOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteExportBucketOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteExportBucketApiParams{ GroupId: opts.groupId, @@ -603,7 +712,17 @@ func (opts *deleteExportBucketOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -616,13 +735,14 @@ func deleteExportBucketBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("exportBucketId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -631,6 +751,8 @@ type deleteReplicaSetBackupOpts struct { groupId string clusterName string snapshotId string + format string + tmpl *template.Template } func (opts *deleteReplicaSetBackupOpts) preRun() (err error) { @@ -649,10 +771,14 @@ func (opts *deleteReplicaSetBackupOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteReplicaSetBackupApiParams{ GroupId: opts.groupId, @@ -670,7 +796,17 @@ func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -683,7 +819,7 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -692,6 +828,7 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -700,6 +837,8 @@ type deleteShardedClusterBackupOpts struct { groupId string clusterName string snapshotId string + format string + tmpl *template.Template } func (opts *deleteShardedClusterBackupOpts) preRun() (err error) { @@ -718,10 +857,14 @@ func (opts *deleteShardedClusterBackupOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteShardedClusterBackupApiParams{ GroupId: opts.groupId, @@ -739,7 +882,17 @@ func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, w io.Writer return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -752,7 +905,7 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -761,6 +914,7 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -769,6 +923,8 @@ type getBackupExportJobOpts struct { groupId string clusterName string exportId string + format string + tmpl *template.Template } func (opts *getBackupExportJobOpts) preRun() (err error) { @@ -787,10 +943,14 @@ func (opts *getBackupExportJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getBackupExportJobOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getBackupExportJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetBackupExportJobApiParams{ GroupId: opts.groupId, @@ -808,7 +968,17 @@ func (opts *getBackupExportJobOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -821,7 +991,7 @@ func getBackupExportJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -830,6 +1000,7 @@ func getBackupExportJobBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("exportId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -838,6 +1009,8 @@ type getBackupRestoreJobOpts struct { groupId string clusterName string restoreJobId string + format string + tmpl *template.Template } func (opts *getBackupRestoreJobOpts) preRun() (err error) { @@ -856,10 +1029,14 @@ func (opts *getBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -877,7 +1054,17 @@ func (opts *getBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -890,7 +1077,7 @@ func getBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -899,6 +1086,7 @@ func getBackupRestoreJobBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -906,6 +1094,8 @@ type getBackupScheduleOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *getBackupScheduleOpts) preRun() (err error) { @@ -924,10 +1114,14 @@ func (opts *getBackupScheduleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getBackupScheduleOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getBackupScheduleOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetBackupScheduleApiParams{ GroupId: opts.groupId, @@ -944,7 +1138,17 @@ func (opts *getBackupScheduleOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -957,19 +1161,22 @@ func getBackupScheduleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getDataProtectionSettingsOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getDataProtectionSettingsOpts) preRun() (err error) { @@ -988,10 +1195,14 @@ func (opts *getDataProtectionSettingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, @@ -1007,7 +1218,17 @@ func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1020,11 +1241,12 @@ func getDataProtectionSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1032,6 +1254,8 @@ type getExportBucketOpts struct { client *admin.APIClient groupId string exportBucketId string + format string + tmpl *template.Template } func (opts *getExportBucketOpts) preRun() (err error) { @@ -1050,10 +1274,14 @@ func (opts *getExportBucketOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getExportBucketOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getExportBucketOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetExportBucketApiParams{ GroupId: opts.groupId, @@ -1070,7 +1298,17 @@ func (opts *getExportBucketOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1083,13 +1321,14 @@ func getExportBucketBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.exportBucketId, "exportBucketId", "", `Unique string that identifies the AWS S3 bucket to which you export your snapshots.`) _ = cmd.MarkFlagRequired("exportBucketId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1098,6 +1337,8 @@ type getReplicaSetBackupOpts struct { groupId string clusterName string snapshotId string + format string + tmpl *template.Template } func (opts *getReplicaSetBackupOpts) preRun() (err error) { @@ -1116,10 +1357,14 @@ func (opts *getReplicaSetBackupOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getReplicaSetBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetReplicaSetBackupApiParams{ GroupId: opts.groupId, @@ -1137,7 +1382,17 @@ func (opts *getReplicaSetBackupOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1150,7 +1405,7 @@ func getReplicaSetBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1159,6 +1414,7 @@ func getReplicaSetBackupBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1167,6 +1423,8 @@ type getServerlessBackupOpts struct { groupId string clusterName string snapshotId string + format string + tmpl *template.Template } func (opts *getServerlessBackupOpts) preRun() (err error) { @@ -1185,10 +1443,14 @@ func (opts *getServerlessBackupOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getServerlessBackupOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getServerlessBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetServerlessBackupApiParams{ GroupId: opts.groupId, @@ -1206,7 +1468,17 @@ func (opts *getServerlessBackupOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1219,7 +1491,7 @@ func getServerlessBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1228,6 +1500,7 @@ func getServerlessBackupBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1236,6 +1509,8 @@ type getServerlessBackupRestoreJobOpts struct { groupId string clusterName string restoreJobId string + format string + tmpl *template.Template } func (opts *getServerlessBackupRestoreJobOpts) preRun() (err error) { @@ -1254,10 +1529,14 @@ func (opts *getServerlessBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -1275,7 +1554,17 @@ func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, w io.Wri return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1288,7 +1577,7 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1297,6 +1586,7 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreJobId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1305,6 +1595,8 @@ type getShardedClusterBackupOpts struct { groupId string clusterName string snapshotId string + format string + tmpl *template.Template } func (opts *getShardedClusterBackupOpts) preRun() (err error) { @@ -1323,10 +1615,14 @@ func (opts *getShardedClusterBackupOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getShardedClusterBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetShardedClusterBackupApiParams{ GroupId: opts.groupId, @@ -1344,7 +1640,17 @@ func (opts *getShardedClusterBackupOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1357,7 +1663,7 @@ func getShardedClusterBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1366,6 +1672,7 @@ func getShardedClusterBackupBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1376,6 +1683,8 @@ type listBackupExportJobsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listBackupExportJobsOpts) preRun() (err error) { @@ -1394,10 +1703,14 @@ func (opts *listBackupExportJobsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listBackupExportJobsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listBackupExportJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListBackupExportJobsApiParams{ GroupId: opts.groupId, @@ -1417,7 +1730,17 @@ func (opts *listBackupExportJobsOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1430,7 +1753,7 @@ func listBackupExportJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1440,6 +1763,7 @@ func listBackupExportJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1450,6 +1774,8 @@ type listBackupRestoreJobsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listBackupRestoreJobsOpts) preRun() (err error) { @@ -1468,10 +1794,14 @@ func (opts *listBackupRestoreJobsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -1491,7 +1821,17 @@ func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1504,7 +1844,7 @@ func listBackupRestoreJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1514,6 +1854,7 @@ func listBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1523,6 +1864,8 @@ type listExportBucketsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listExportBucketsOpts) preRun() (err error) { @@ -1541,10 +1884,14 @@ func (opts *listExportBucketsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listExportBucketsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listExportBucketsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListExportBucketsApiParams{ GroupId: opts.groupId, @@ -1563,7 +1910,17 @@ func (opts *listExportBucketsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1576,7 +1933,7 @@ func listExportBucketsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1584,6 +1941,7 @@ func listExportBucketsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1594,6 +1952,8 @@ type listReplicaSetBackupsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listReplicaSetBackupsOpts) preRun() (err error) { @@ -1612,10 +1972,14 @@ func (opts *listReplicaSetBackupsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListReplicaSetBackupsApiParams{ GroupId: opts.groupId, @@ -1635,7 +1999,17 @@ func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1648,7 +2022,7 @@ func listReplicaSetBackupsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1658,6 +2032,7 @@ func listReplicaSetBackupsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1668,6 +2043,8 @@ type listServerlessBackupRestoreJobsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listServerlessBackupRestoreJobsOpts) preRun() (err error) { @@ -1686,10 +2063,14 @@ func (opts *listServerlessBackupRestoreJobsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListServerlessBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -1709,7 +2090,17 @@ func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, w io.W return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1722,7 +2113,7 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1732,6 +2123,7 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1742,6 +2134,8 @@ type listServerlessBackupsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listServerlessBackupsOpts) preRun() (err error) { @@ -1760,10 +2154,14 @@ func (opts *listServerlessBackupsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listServerlessBackupsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listServerlessBackupsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListServerlessBackupsApiParams{ GroupId: opts.groupId, @@ -1783,7 +2181,17 @@ func (opts *listServerlessBackupsOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1796,7 +2204,7 @@ func listServerlessBackupsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1806,6 +2214,7 @@ func listServerlessBackupsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1813,6 +2222,8 @@ type listShardedClusterBackupsOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *listShardedClusterBackupsOpts) preRun() (err error) { @@ -1831,10 +2242,14 @@ func (opts *listShardedClusterBackupsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListShardedClusterBackupsApiParams{ GroupId: opts.groupId, @@ -1851,7 +2266,17 @@ func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1864,13 +2289,14 @@ func listShardedClusterBackupsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1881,6 +2307,8 @@ type takeSnapshotOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *takeSnapshotOpts) preRun() (err error) { @@ -1899,16 +2327,20 @@ func (opts *takeSnapshotOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *takeSnapshotOpts) readData() (*admin.DiskBackupOnDemandSnapshotRequest, error) { +func (opts *takeSnapshotOpts) readData(r io.Reader) (*admin.DiskBackupOnDemandSnapshotRequest, error) { var out *admin.DiskBackupOnDemandSnapshotRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1924,8 +2356,8 @@ func (opts *takeSnapshotOpts) readData() (*admin.DiskBackupOnDemandSnapshotReque return out, nil } -func (opts *takeSnapshotOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *takeSnapshotOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1947,7 +2379,17 @@ func (opts *takeSnapshotOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1962,7 +2404,7 @@ func takeSnapshotBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1971,6 +2413,7 @@ func takeSnapshotBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1981,6 +2424,8 @@ type updateBackupScheduleOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateBackupScheduleOpts) preRun() (err error) { @@ -1999,16 +2444,20 @@ func (opts *updateBackupScheduleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateBackupScheduleOpts) readData() (*admin.DiskBackupSnapshotSchedule, error) { +func (opts *updateBackupScheduleOpts) readData(r io.Reader) (*admin.DiskBackupSnapshotSchedule, error) { var out *admin.DiskBackupSnapshotSchedule var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -2024,8 +2473,8 @@ func (opts *updateBackupScheduleOpts) readData() (*admin.DiskBackupSnapshotSched return out, nil } -func (opts *updateBackupScheduleOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateBackupScheduleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -2047,7 +2496,17 @@ func (opts *updateBackupScheduleOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -2062,7 +2521,7 @@ func updateBackupScheduleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2071,6 +2530,7 @@ func updateBackupScheduleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -2080,6 +2540,8 @@ type updateDataProtectionSettingsOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { @@ -2098,16 +2560,20 @@ func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateDataProtectionSettingsOpts) readData() (*admin.DataProtectionSettings, error) { +func (opts *updateDataProtectionSettingsOpts) readData(r io.Reader) (*admin.DataProtectionSettings, error) { var out *admin.DataProtectionSettings var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -2123,8 +2589,8 @@ func (opts *updateDataProtectionSettingsOpts) readData() (*admin.DataProtectionS return out, nil } -func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -2145,7 +2611,17 @@ func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -2160,13 +2636,14 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -2178,6 +2655,8 @@ type updateSnapshotRetentionOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateSnapshotRetentionOpts) preRun() (err error) { @@ -2196,16 +2675,20 @@ func (opts *updateSnapshotRetentionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateSnapshotRetentionOpts) readData() (*admin.BackupSnapshotRetention, error) { +func (opts *updateSnapshotRetentionOpts) readData(r io.Reader) (*admin.BackupSnapshotRetention, error) { var out *admin.BackupSnapshotRetention var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -2221,8 +2704,8 @@ func (opts *updateSnapshotRetentionOpts) readData() (*admin.BackupSnapshotRetent return out, nil } -func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -2245,7 +2728,17 @@ func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -2260,7 +2753,7 @@ func updateSnapshotRetentionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2271,6 +2764,7 @@ func updateSnapshotRetentionBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 686aea21cb..5eb21b49ef 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createLinkTokenOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createLinkTokenOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createLinkTokenOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createLinkTokenOpts) readData() (*admin.TargetOrgRequest, error) { +func (opts *createLinkTokenOpts) readData(r io.Reader) (*admin.TargetOrgRequest, error) { var out *admin.TargetOrgRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createLinkTokenOpts) readData() (*admin.TargetOrgRequest, error) { return out, nil } -func (opts *createLinkTokenOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createLinkTokenOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createLinkTokenOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createLinkTokenBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -133,6 +151,8 @@ type createPushMigrationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createPushMigrationOpts) preRun() (err error) { @@ -151,16 +171,20 @@ func (opts *createPushMigrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createPushMigrationOpts) readData() (*admin.LiveMigrationRequest, error) { +func (opts *createPushMigrationOpts) readData(r io.Reader) (*admin.LiveMigrationRequest, error) { var out *admin.LiveMigrationRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -176,8 +200,8 @@ func (opts *createPushMigrationOpts) readData() (*admin.LiveMigrationRequest, er return out, nil } -func (opts *createPushMigrationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createPushMigrationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -198,7 +222,17 @@ func (opts *createPushMigrationOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -213,13 +247,14 @@ func createPushMigrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -245,10 +280,10 @@ func (opts *cutoverMigrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *cutoverMigrationOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *cutoverMigrationOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.CutoverMigrationApiParams{ GroupId: opts.groupId, @@ -268,7 +303,7 @@ func cutoverMigrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -281,6 +316,8 @@ func cutoverMigrationBuilder() *cobra.Command { type deleteLinkTokenOpts struct { client *admin.APIClient orgId string + format string + tmpl *template.Template } func (opts *deleteLinkTokenOpts) preRun() (err error) { @@ -299,10 +336,14 @@ func (opts *deleteLinkTokenOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteLinkTokenOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteLinkTokenOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, @@ -318,7 +359,17 @@ func (opts *deleteLinkTokenOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -331,11 +382,12 @@ func deleteLinkTokenBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -343,6 +395,8 @@ type getPushMigrationOpts struct { client *admin.APIClient groupId string liveMigrationId string + format string + tmpl *template.Template } func (opts *getPushMigrationOpts) preRun() (err error) { @@ -361,10 +415,14 @@ func (opts *getPushMigrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getPushMigrationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getPushMigrationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetPushMigrationApiParams{ GroupId: opts.groupId, @@ -381,7 +439,17 @@ func (opts *getPushMigrationOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -394,13 +462,14 @@ func getPushMigrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.liveMigrationId, "liveMigrationId", "", `Unique 24-hexadecimal digit string that identifies the migration.`) _ = cmd.MarkFlagRequired("liveMigrationId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -408,6 +477,8 @@ type getValidationStatusOpts struct { client *admin.APIClient groupId string validationId string + format string + tmpl *template.Template } func (opts *getValidationStatusOpts) preRun() (err error) { @@ -426,10 +497,14 @@ func (opts *getValidationStatusOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getValidationStatusOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getValidationStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetValidationStatusApiParams{ GroupId: opts.groupId, @@ -446,7 +521,17 @@ func (opts *getValidationStatusOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -459,19 +544,22 @@ func getValidationStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.validationId, "validationId", "", `Unique 24-hexadecimal digit string that identifies the validation job.`) _ = cmd.MarkFlagRequired("validationId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listSourceProjectsOpts struct { client *admin.APIClient orgId string + format string + tmpl *template.Template } func (opts *listSourceProjectsOpts) preRun() (err error) { @@ -490,10 +578,14 @@ func (opts *listSourceProjectsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listSourceProjectsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listSourceProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, @@ -509,7 +601,17 @@ func (opts *listSourceProjectsOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -522,11 +624,12 @@ func listSourceProjectsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -536,6 +639,8 @@ type validateMigrationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *validateMigrationOpts) preRun() (err error) { @@ -554,16 +659,20 @@ func (opts *validateMigrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *validateMigrationOpts) readData() (*admin.LiveMigrationRequest, error) { +func (opts *validateMigrationOpts) readData(r io.Reader) (*admin.LiveMigrationRequest, error) { var out *admin.LiveMigrationRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -579,8 +688,8 @@ func (opts *validateMigrationOpts) readData() (*admin.LiveMigrationRequest, erro return out, nil } -func (opts *validateMigrationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *validateMigrationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -601,7 +710,17 @@ func (opts *validateMigrationOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -616,13 +735,14 @@ func validateMigrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index 64e9f20a0b..bffabf4fe0 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type authorizeCloudProviderAccessRoleOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *authorizeCloudProviderAccessRoleOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *authorizeCloudProviderAccessRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *authorizeCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderAccessRole, error) { +func (opts *authorizeCloudProviderAccessRoleOpts) readData(r io.Reader) (*admin.CloudProviderAccessRole, error) { var out *admin.CloudProviderAccessRole var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *authorizeCloudProviderAccessRoleOpts) readData() (*admin.CloudProvid return out, nil } -func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, w io. return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("roleId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -137,6 +155,8 @@ type createCloudProviderAccessRoleOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createCloudProviderAccessRoleOpts) preRun() (err error) { @@ -155,16 +175,20 @@ func (opts *createCloudProviderAccessRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderAccessRole, error) { +func (opts *createCloudProviderAccessRoleOpts) readData(r io.Reader) (*admin.CloudProviderAccessRole, error) { var out *admin.CloudProviderAccessRole var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -180,8 +204,8 @@ func (opts *createCloudProviderAccessRoleOpts) readData() (*admin.CloudProviderA return out, nil } -func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -202,7 +226,17 @@ func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Wri return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -217,13 +251,14 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -250,10 +285,10 @@ func (opts *deauthorizeCloudProviderAccessRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DeauthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -274,7 +309,7 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -290,6 +325,8 @@ type getCloudProviderAccessRoleOpts struct { client *admin.APIClient groupId string roleId string + format string + tmpl *template.Template } func (opts *getCloudProviderAccessRoleOpts) preRun() (err error) { @@ -308,10 +345,14 @@ func (opts *getCloudProviderAccessRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -328,7 +369,17 @@ func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, w io.Writer return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -341,19 +392,22 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleId, "roleId", "", `Unique 24-hexadecimal digit string that identifies the role.`) _ = cmd.MarkFlagRequired("roleId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listCloudProviderAccessRolesOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *listCloudProviderAccessRolesOpts) preRun() (err error) { @@ -372,10 +426,14 @@ func (opts *listCloudProviderAccessRolesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, @@ -391,7 +449,17 @@ func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -404,11 +472,12 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index d2f1ceec1a..aec06958ef 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -35,6 +36,8 @@ type endOutageSimulationOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *endOutageSimulationOpts) preRun() (err error) { @@ -53,10 +56,14 @@ func (opts *endOutageSimulationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *endOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *endOutageSimulationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.EndOutageSimulationApiParams{ GroupId: opts.groupId, @@ -73,7 +80,17 @@ func (opts *endOutageSimulationOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -86,13 +103,14 @@ func endOutageSimulationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -100,6 +118,8 @@ type getOutageSimulationOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *getOutageSimulationOpts) preRun() (err error) { @@ -118,10 +138,14 @@ func (opts *getOutageSimulationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getOutageSimulationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetOutageSimulationApiParams{ GroupId: opts.groupId, @@ -138,7 +162,17 @@ func (opts *getOutageSimulationOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -151,13 +185,14 @@ func getOutageSimulationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster that is undergoing outage simulation.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -168,6 +203,8 @@ type startOutageSimulationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *startOutageSimulationOpts) preRun() (err error) { @@ -186,16 +223,20 @@ func (opts *startOutageSimulationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *startOutageSimulationOpts) readData() (*admin.ClusterOutageSimulation, error) { +func (opts *startOutageSimulationOpts) readData(r io.Reader) (*admin.ClusterOutageSimulation, error) { var out *admin.ClusterOutageSimulation var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -211,8 +252,8 @@ func (opts *startOutageSimulationOpts) readData() (*admin.ClusterOutageSimulatio return out, nil } -func (opts *startOutageSimulationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *startOutageSimulationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -234,7 +275,17 @@ func (opts *startOutageSimulationOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -249,7 +300,7 @@ func startOutageSimulationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -258,6 +309,7 @@ func startOutageSimulationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 6920c49f35..8213b38663 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createClusterOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createClusterOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createClusterOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createClusterOpts) readData() (*admin.AdvancedClusterDescription, error) { +func (opts *createClusterOpts) readData(r io.Reader) (*admin.AdvancedClusterDescription, error) { var out *admin.AdvancedClusterDescription var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createClusterOpts) readData() (*admin.AdvancedClusterDescription, er return out, nil } -func (opts *createClusterOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createClusterOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createClusterOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -150,10 +168,10 @@ func (opts *deleteClusterOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DeleteClusterApiParams{ GroupId: opts.groupId, @@ -174,7 +192,7 @@ func deleteClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -189,6 +207,8 @@ type getClusterOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *getClusterOpts) preRun() (err error) { @@ -207,10 +227,14 @@ func (opts *getClusterOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getClusterOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getClusterOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetClusterApiParams{ GroupId: opts.groupId, @@ -227,7 +251,17 @@ func (opts *getClusterOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -240,13 +274,14 @@ func getClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -254,6 +289,8 @@ type getClusterAdvancedConfigurationOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *getClusterAdvancedConfigurationOpts) preRun() (err error) { @@ -272,10 +309,14 @@ func (opts *getClusterAdvancedConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, @@ -292,7 +333,17 @@ func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, w io.W return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -305,13 +356,14 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -319,6 +371,8 @@ type getClusterStatusOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *getClusterStatusOpts) preRun() (err error) { @@ -337,10 +391,14 @@ func (opts *getClusterStatusOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getClusterStatusOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getClusterStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetClusterStatusApiParams{ GroupId: opts.groupId, @@ -357,7 +415,17 @@ func (opts *getClusterStatusOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -370,13 +438,14 @@ func getClusterStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -384,6 +453,8 @@ type getSampleDatasetLoadStatusOpts struct { client *admin.APIClient groupId string sampleDatasetId string + format string + tmpl *template.Template } func (opts *getSampleDatasetLoadStatusOpts) preRun() (err error) { @@ -402,10 +473,14 @@ func (opts *getSampleDatasetLoadStatusOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetSampleDatasetLoadStatusApiParams{ GroupId: opts.groupId, @@ -422,7 +497,17 @@ func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, w io.Writer return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -435,13 +520,14 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.sampleDatasetId, "sampleDatasetId", "", `Unique 24-hexadecimal digit string that identifies the loaded sample dataset.`) _ = cmd.MarkFlagRequired("sampleDatasetId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -453,6 +539,8 @@ type listCloudProviderRegionsOpts struct { pageNum int providers []string tier string + format string + tmpl *template.Template } func (opts *listCloudProviderRegionsOpts) preRun() (err error) { @@ -471,10 +559,14 @@ func (opts *listCloudProviderRegionsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListCloudProviderRegionsApiParams{ GroupId: opts.groupId, @@ -495,7 +587,17 @@ func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -508,7 +610,7 @@ func listCloudProviderRegionsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -518,6 +620,7 @@ func listCloudProviderRegionsBuilder() *cobra.Command { cmd.Flags().StringSliceVar(&opts.providers, "providers", nil, `Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters.`) cmd.Flags().StringVar(&opts.tier, "tier", "", `Cluster tier for which to retrieve the regions.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -528,6 +631,8 @@ type listClustersOpts struct { itemsPerPage int pageNum int includeDeletedWithRetainedBackups bool + format string + tmpl *template.Template } func (opts *listClustersOpts) preRun() (err error) { @@ -546,10 +651,14 @@ func (opts *listClustersOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listClustersOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listClustersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListClustersApiParams{ GroupId: opts.groupId, @@ -569,7 +678,17 @@ func (opts *listClustersOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -582,7 +701,7 @@ func listClustersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -591,6 +710,7 @@ func listClustersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().BoolVar(&opts.includeDeletedWithRetainedBackups, "includeDeletedWithRetainedBackups", false, `Flag that indicates whether to return Clusters with retain backups.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -599,6 +719,8 @@ type listClustersForAllProjectsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listClustersForAllProjectsOpts) preRun() (err error) { @@ -606,10 +728,14 @@ func (opts *listClustersForAllProjectsOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listClustersForAllProjectsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listClustersForAllProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListClustersForAllProjectsApiParams{ IncludeCount: &opts.includeCount, @@ -627,7 +753,17 @@ func (opts *listClustersForAllProjectsOpts) run(ctx context.Context, w io.Writer return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -640,13 +776,14 @@ func listClustersForAllProjectsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -654,6 +791,8 @@ type loadSampleDatasetOpts struct { client *admin.APIClient groupId string name string + format string + tmpl *template.Template } func (opts *loadSampleDatasetOpts) preRun() (err error) { @@ -672,10 +811,14 @@ func (opts *loadSampleDatasetOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *loadSampleDatasetOpts) run(ctx context.Context, w io.Writer) error { +func (opts *loadSampleDatasetOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, @@ -692,7 +835,17 @@ func (opts *loadSampleDatasetOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -705,13 +858,14 @@ func loadSampleDatasetBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the cluster into which you load the sample dataset.`) _ = cmd.MarkFlagRequired("name") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -737,10 +891,10 @@ func (opts *testFailoverOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *testFailoverOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *testFailoverOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.TestFailoverApiParams{ GroupId: opts.groupId, @@ -760,7 +914,7 @@ func testFailoverBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -777,6 +931,8 @@ type updateClusterOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateClusterOpts) preRun() (err error) { @@ -795,16 +951,20 @@ func (opts *updateClusterOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateClusterOpts) readData() (*admin.AdvancedClusterDescription, error) { +func (opts *updateClusterOpts) readData(r io.Reader) (*admin.AdvancedClusterDescription, error) { var out *admin.AdvancedClusterDescription var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -820,8 +980,8 @@ func (opts *updateClusterOpts) readData() (*admin.AdvancedClusterDescription, er return out, nil } -func (opts *updateClusterOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateClusterOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -843,7 +1003,17 @@ func (opts *updateClusterOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -858,7 +1028,7 @@ func updateClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -867,6 +1037,7 @@ func updateClusterBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -877,6 +1048,8 @@ type updateClusterAdvancedConfigurationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateClusterAdvancedConfigurationOpts) preRun() (err error) { @@ -895,16 +1068,20 @@ func (opts *updateClusterAdvancedConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateClusterAdvancedConfigurationOpts) readData() (*admin.ClusterDescriptionProcessArgs, error) { +func (opts *updateClusterAdvancedConfigurationOpts) readData(r io.Reader) (*admin.ClusterDescriptionProcessArgs, error) { var out *admin.ClusterDescriptionProcessArgs var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -920,8 +1097,8 @@ func (opts *updateClusterAdvancedConfigurationOpts) readData() (*admin.ClusterDe return out, nil } -func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -943,7 +1120,17 @@ func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, w i return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -958,7 +1145,7 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -967,6 +1154,7 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -976,6 +1164,8 @@ type upgradeSharedClusterOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *upgradeSharedClusterOpts) preRun() (err error) { @@ -994,16 +1184,20 @@ func (opts *upgradeSharedClusterOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *upgradeSharedClusterOpts) readData() (*admin.LegacyAtlasCluster, error) { +func (opts *upgradeSharedClusterOpts) readData(r io.Reader) (*admin.LegacyAtlasCluster, error) { var out *admin.LegacyAtlasCluster var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1019,8 +1213,8 @@ func (opts *upgradeSharedClusterOpts) readData() (*admin.LegacyAtlasCluster, err return out, nil } -func (opts *upgradeSharedClusterOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *upgradeSharedClusterOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1041,7 +1235,17 @@ func (opts *upgradeSharedClusterOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1056,13 +1260,14 @@ func upgradeSharedClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1072,6 +1277,8 @@ type upgradeSharedClusterToServerlessOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *upgradeSharedClusterToServerlessOpts) preRun() (err error) { @@ -1090,16 +1297,20 @@ func (opts *upgradeSharedClusterToServerlessOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *upgradeSharedClusterToServerlessOpts) readData() (*admin.ServerlessInstanceDescription, error) { +func (opts *upgradeSharedClusterToServerlessOpts) readData(r io.Reader) (*admin.ServerlessInstanceDescription, error) { var out *admin.ServerlessInstanceDescription var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1115,8 +1326,8 @@ func (opts *upgradeSharedClusterToServerlessOpts) readData() (*admin.ServerlessI return out, nil } -func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1137,7 +1348,17 @@ func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, w io. return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1152,13 +1373,14 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 3d38910968..8db099dac2 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createCustomDatabaseRoleOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createCustomDatabaseRoleOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createCustomDatabaseRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createCustomDatabaseRoleOpts) readData() (*admin.UserCustomDBRole, error) { +func (opts *createCustomDatabaseRoleOpts) readData(r io.Reader) (*admin.UserCustomDBRole, error) { var out *admin.UserCustomDBRole var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createCustomDatabaseRoleOpts) readData() (*admin.UserCustomDBRole, e return out, nil } -func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -149,10 +167,10 @@ func (opts *deleteCustomDatabaseRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *deleteCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *deleteCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DeleteCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -172,7 +190,7 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -186,6 +204,8 @@ type getCustomDatabaseRoleOpts struct { client *admin.APIClient groupId string roleName string + format string + tmpl *template.Template } func (opts *getCustomDatabaseRoleOpts) preRun() (err error) { @@ -204,10 +224,14 @@ func (opts *getCustomDatabaseRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetCustomDatabaseRoleApiParams{ GroupId: opts.groupId, @@ -224,7 +248,17 @@ func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -237,19 +271,22 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.roleName, "roleName", "", `Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project.`) _ = cmd.MarkFlagRequired("roleName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listCustomDatabaseRolesOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *listCustomDatabaseRolesOpts) preRun() (err error) { @@ -268,10 +305,14 @@ func (opts *listCustomDatabaseRolesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, @@ -287,7 +328,17 @@ func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -300,11 +351,12 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -315,6 +367,8 @@ type updateCustomDatabaseRoleOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateCustomDatabaseRoleOpts) preRun() (err error) { @@ -333,16 +387,20 @@ func (opts *updateCustomDatabaseRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateCustomDatabaseRoleOpts) readData() (*admin.UpdateCustomDBRole, error) { +func (opts *updateCustomDatabaseRoleOpts) readData(r io.Reader) (*admin.UpdateCustomDBRole, error) { var out *admin.UpdateCustomDBRole var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -358,8 +416,8 @@ func (opts *updateCustomDatabaseRoleOpts) readData() (*admin.UpdateCustomDBRole, return out, nil } -func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -381,7 +439,17 @@ func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -396,7 +464,7 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -405,6 +473,7 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("roleName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index 7b55485b99..e5095906b1 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createDataFederationPrivateEndpointOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createDataFederationPrivateEndpointOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createDataFederationPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createDataFederationPrivateEndpointOpts) readData() (*admin.PrivateNetworkEndpointIdEntry, error) { +func (opts *createDataFederationPrivateEndpointOpts) readData(r io.Reader) (*admin.PrivateNetworkEndpointIdEntry, error) { var out *admin.PrivateNetworkEndpointIdEntry var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createDataFederationPrivateEndpointOpts) readData() (*admin.PrivateN return out, nil } -func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, w return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -134,6 +152,8 @@ type createFederatedDatabaseOpts struct { skipRoleValidation bool filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createFederatedDatabaseOpts) preRun() (err error) { @@ -152,16 +172,20 @@ func (opts *createFederatedDatabaseOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, error) { +func (opts *createFederatedDatabaseOpts) readData(r io.Reader) (*admin.DataLakeTenant, error) { var out *admin.DataLakeTenant var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -177,8 +201,8 @@ func (opts *createFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, erro return out, nil } -func (opts *createFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createFederatedDatabaseOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -201,7 +225,17 @@ func (opts *createFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -216,7 +250,7 @@ func createFederatedDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -224,6 +258,7 @@ func createFederatedDatabaseBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.skipRoleValidation, "skipRoleValidation", false, `Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -235,6 +270,8 @@ type createOneDataFederationQueryLimitOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createOneDataFederationQueryLimitOpts) preRun() (err error) { @@ -253,16 +290,20 @@ func (opts *createOneDataFederationQueryLimitOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createOneDataFederationQueryLimitOpts) readData() (*admin.DataFederationTenantQueryLimit, error) { +func (opts *createOneDataFederationQueryLimitOpts) readData(r io.Reader) (*admin.DataFederationTenantQueryLimit, error) { var out *admin.DataFederationTenantQueryLimit var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -278,8 +319,8 @@ func (opts *createOneDataFederationQueryLimitOpts) readData() (*admin.DataFedera return out, nil } -func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -302,7 +343,17 @@ func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, w io return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -317,7 +368,7 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -336,6 +387,7 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -343,6 +395,8 @@ type deleteDataFederationPrivateEndpointOpts struct { client *admin.APIClient groupId string endpointId string + format string + tmpl *template.Template } func (opts *deleteDataFederationPrivateEndpointOpts) preRun() (err error) { @@ -361,10 +415,14 @@ func (opts *deleteDataFederationPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -381,7 +439,17 @@ func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, w return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -394,13 +462,14 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) _ = cmd.MarkFlagRequired("endpointId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -408,6 +477,8 @@ type deleteFederatedDatabaseOpts struct { client *admin.APIClient groupId string tenantName string + format string + tmpl *template.Template } func (opts *deleteFederatedDatabaseOpts) preRun() (err error) { @@ -426,10 +497,14 @@ func (opts *deleteFederatedDatabaseOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -446,7 +521,17 @@ func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -459,13 +544,14 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance to remove.`) _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -474,6 +560,8 @@ type deleteOneDataFederationInstanceQueryLimitOpts struct { groupId string tenantName string limitName string + format string + tmpl *template.Template } func (opts *deleteOneDataFederationInstanceQueryLimitOpts) preRun() (err error) { @@ -492,10 +580,14 @@ func (opts *deleteOneDataFederationInstanceQueryLimitOpts) preRun() (err error) return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ GroupId: opts.groupId, @@ -513,7 +605,17 @@ func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Conte return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -526,7 +628,7 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -543,6 +645,7 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -552,6 +655,8 @@ type downloadFederatedDatabaseQueryLogsOpts struct { tenantName string endDate int64 startDate int64 + format string + tmpl *template.Template } func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { @@ -570,10 +675,14 @@ func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ GroupId: opts.groupId, @@ -592,7 +701,17 @@ func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, w i return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -605,7 +724,7 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -614,6 +733,7 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -621,6 +741,8 @@ type getDataFederationPrivateEndpointOpts struct { client *admin.APIClient groupId string endpointId string + format string + tmpl *template.Template } func (opts *getDataFederationPrivateEndpointOpts) preRun() (err error) { @@ -639,10 +761,14 @@ func (opts *getDataFederationPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -659,7 +785,17 @@ func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, w io. return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -672,13 +808,14 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.endpointId, "endpointId", "", `Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature.`) _ = cmd.MarkFlagRequired("endpointId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -686,6 +823,8 @@ type getFederatedDatabaseOpts struct { client *admin.APIClient groupId string tenantName string + format string + tmpl *template.Template } func (opts *getFederatedDatabaseOpts) preRun() (err error) { @@ -704,10 +843,14 @@ func (opts *getFederatedDatabaseOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getFederatedDatabaseOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetFederatedDatabaseApiParams{ GroupId: opts.groupId, @@ -724,7 +867,17 @@ func (opts *getFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -737,13 +890,14 @@ func getFederatedDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the Federated Database to return.`) _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -753,6 +907,8 @@ type listDataFederationPrivateEndpointsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listDataFederationPrivateEndpointsOpts) preRun() (err error) { @@ -771,10 +927,14 @@ func (opts *listDataFederationPrivateEndpointsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListDataFederationPrivateEndpointsApiParams{ GroupId: opts.groupId, @@ -793,7 +953,17 @@ func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, w i return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -806,7 +976,7 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -814,6 +984,7 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -821,6 +992,8 @@ type listFederatedDatabasesOpts struct { client *admin.APIClient groupId string type_ string + format string + tmpl *template.Template } func (opts *listFederatedDatabasesOpts) preRun() (err error) { @@ -839,10 +1012,14 @@ func (opts *listFederatedDatabasesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listFederatedDatabasesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listFederatedDatabasesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, @@ -859,7 +1036,17 @@ func (opts *listFederatedDatabasesOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -872,12 +1059,13 @@ func listFederatedDatabasesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.type_, "type_", ""USER"", `Type of Federated Database Instances to return.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -886,6 +1074,8 @@ type returnFederatedDatabaseQueryLimitOpts struct { groupId string tenantName string limitName string + format string + tmpl *template.Template } func (opts *returnFederatedDatabaseQueryLimitOpts) preRun() (err error) { @@ -904,10 +1094,14 @@ func (opts *returnFederatedDatabaseQueryLimitOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, w io.Writer) error { +func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ GroupId: opts.groupId, @@ -925,7 +1119,17 @@ func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, w io return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -938,7 +1142,7 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -955,6 +1159,7 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("limitName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -962,6 +1167,8 @@ type returnFederatedDatabaseQueryLimitsOpts struct { client *admin.APIClient groupId string tenantName string + format string + tmpl *template.Template } func (opts *returnFederatedDatabaseQueryLimitsOpts) preRun() (err error) { @@ -980,10 +1187,14 @@ func (opts *returnFederatedDatabaseQueryLimitsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ GroupId: opts.groupId, @@ -1000,7 +1211,17 @@ func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, w i return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1013,13 +1234,14 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the federated database instance for which you want to retrieve query limits.`) _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1031,6 +1253,8 @@ type updateFederatedDatabaseOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateFederatedDatabaseOpts) preRun() (err error) { @@ -1049,16 +1273,20 @@ func (opts *updateFederatedDatabaseOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, error) { +func (opts *updateFederatedDatabaseOpts) readData(r io.Reader) (*admin.DataLakeTenant, error) { var out *admin.DataLakeTenant var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1074,8 +1302,8 @@ func (opts *updateFederatedDatabaseOpts) readData() (*admin.DataLakeTenant, erro return out, nil } -func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1098,7 +1326,17 @@ func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1113,7 +1351,7 @@ func updateFederatedDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1124,6 +1362,7 @@ func updateFederatedDatabaseBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("skipRoleValidation") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index f84a5d7b5a..90bf6b3e0a 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "time" "github.com/mongodb/mongodb-atlas-cli/internal/config" @@ -38,6 +39,8 @@ type createPipelineOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createPipelineOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createPipelineOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createPipelineOpts) readData() (*admin.DataLakeIngestionPipeline, error) { +func (opts *createPipelineOpts) readData(r io.Reader) (*admin.DataLakeIngestionPipeline, error) { var out *admin.DataLakeIngestionPipeline var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createPipelineOpts) readData() (*admin.DataLakeIngestionPipeline, er return out, nil } -func (opts *createPipelineOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createPipelineOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -103,7 +110,17 @@ func (opts *createPipelineOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -118,13 +135,14 @@ func createPipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -132,6 +150,8 @@ type deletePipelineOpts struct { client *admin.APIClient groupId string pipelineName string + format string + tmpl *template.Template } func (opts *deletePipelineOpts) preRun() (err error) { @@ -150,10 +170,14 @@ func (opts *deletePipelineOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deletePipelineOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deletePipelineOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeletePipelineApiParams{ GroupId: opts.groupId, @@ -170,7 +194,17 @@ func (opts *deletePipelineOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -183,13 +217,14 @@ func deletePipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -198,6 +233,8 @@ type deletePipelineRunDatasetOpts struct { groupId string pipelineName string pipelineRunId string + format string + tmpl *template.Template } func (opts *deletePipelineRunDatasetOpts) preRun() (err error) { @@ -216,10 +253,14 @@ func (opts *deletePipelineRunDatasetOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeletePipelineRunDatasetApiParams{ GroupId: opts.groupId, @@ -237,7 +278,17 @@ func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -250,7 +301,7 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -259,6 +310,7 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -266,6 +318,8 @@ type getPipelineOpts struct { client *admin.APIClient groupId string pipelineName string + format string + tmpl *template.Template } func (opts *getPipelineOpts) preRun() (err error) { @@ -284,10 +338,14 @@ func (opts *getPipelineOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getPipelineOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getPipelineOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetPipelineApiParams{ GroupId: opts.groupId, @@ -304,7 +362,17 @@ func (opts *getPipelineOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -317,13 +385,14 @@ func getPipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -332,6 +401,8 @@ type getPipelineRunOpts struct { groupId string pipelineName string pipelineRunId string + format string + tmpl *template.Template } func (opts *getPipelineRunOpts) preRun() (err error) { @@ -350,10 +421,14 @@ func (opts *getPipelineRunOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getPipelineRunOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getPipelineRunOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetPipelineRunApiParams{ GroupId: opts.groupId, @@ -371,7 +446,17 @@ func (opts *getPipelineRunOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -384,7 +469,7 @@ func getPipelineRunBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -393,6 +478,7 @@ func getPipelineRunBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("pipelineName") _ = cmd.MarkFlagRequired("pipelineRunId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -404,6 +490,8 @@ type listPipelineRunsOpts struct { itemsPerPage int pageNum int createdBefore string + format string + tmpl *template.Template } func (opts *listPipelineRunsOpts) preRun() (err error) { @@ -422,10 +510,14 @@ func (opts *listPipelineRunsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPipelineRunsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPipelineRunsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var createdBefore *time.Time var errCreatedBefore error @@ -455,7 +547,17 @@ func (opts *listPipelineRunsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -468,7 +570,7 @@ func listPipelineRunsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -479,6 +581,7 @@ func listPipelineRunsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.createdBefore, "createdBefore", "", `If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date.`) _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -486,6 +589,8 @@ type listPipelineSchedulesOpts struct { client *admin.APIClient groupId string pipelineName string + format string + tmpl *template.Template } func (opts *listPipelineSchedulesOpts) preRun() (err error) { @@ -504,10 +609,14 @@ func (opts *listPipelineSchedulesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPipelineSchedulesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPipelineSchedulesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListPipelineSchedulesApiParams{ GroupId: opts.groupId, @@ -524,7 +633,17 @@ func (opts *listPipelineSchedulesOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -537,13 +656,14 @@ func listPipelineSchedulesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -555,6 +675,8 @@ type listPipelineSnapshotsOpts struct { itemsPerPage int pageNum int completedAfter string + format string + tmpl *template.Template } func (opts *listPipelineSnapshotsOpts) preRun() (err error) { @@ -573,10 +695,14 @@ func (opts *listPipelineSnapshotsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var completedAfter *time.Time var errCompletedAfter error @@ -606,7 +732,17 @@ func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -619,7 +755,7 @@ func listPipelineSnapshotsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -630,12 +766,15 @@ func listPipelineSnapshotsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.completedAfter, "completedAfter", "", `Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC.`) _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listPipelinesOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *listPipelinesOpts) preRun() (err error) { @@ -654,10 +793,14 @@ func (opts *listPipelinesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPipelinesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPipelinesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, @@ -673,7 +816,17 @@ func (opts *listPipelinesOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -686,11 +839,12 @@ func listPipelinesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -698,6 +852,8 @@ type pausePipelineOpts struct { client *admin.APIClient groupId string pipelineName string + format string + tmpl *template.Template } func (opts *pausePipelineOpts) preRun() (err error) { @@ -716,10 +872,14 @@ func (opts *pausePipelineOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *pausePipelineOpts) run(ctx context.Context, w io.Writer) error { +func (opts *pausePipelineOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.PausePipelineApiParams{ GroupId: opts.groupId, @@ -736,7 +896,17 @@ func (opts *pausePipelineOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -749,13 +919,14 @@ func pausePipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -763,6 +934,8 @@ type resumePipelineOpts struct { client *admin.APIClient groupId string pipelineName string + format string + tmpl *template.Template } func (opts *resumePipelineOpts) preRun() (err error) { @@ -781,10 +954,14 @@ func (opts *resumePipelineOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *resumePipelineOpts) run(ctx context.Context, w io.Writer) error { +func (opts *resumePipelineOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ResumePipelineApiParams{ GroupId: opts.groupId, @@ -801,7 +978,17 @@ func (opts *resumePipelineOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -814,13 +1001,14 @@ func resumePipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.pipelineName, "pipelineName", "", `Human-readable label that identifies the Data Lake Pipeline.`) _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -831,6 +1019,8 @@ type triggerSnapshotIngestionOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *triggerSnapshotIngestionOpts) preRun() (err error) { @@ -849,16 +1039,20 @@ func (opts *triggerSnapshotIngestionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *triggerSnapshotIngestionOpts) readData() (*admin.TriggerIngestionPipelineRequest, error) { +func (opts *triggerSnapshotIngestionOpts) readData(r io.Reader) (*admin.TriggerIngestionPipelineRequest, error) { var out *admin.TriggerIngestionPipelineRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -874,8 +1068,8 @@ func (opts *triggerSnapshotIngestionOpts) readData() (*admin.TriggerIngestionPip return out, nil } -func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -897,7 +1091,17 @@ func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -912,7 +1116,7 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -921,6 +1125,7 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -931,6 +1136,8 @@ type updatePipelineOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updatePipelineOpts) preRun() (err error) { @@ -949,16 +1156,20 @@ func (opts *updatePipelineOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updatePipelineOpts) readData() (*admin.DataLakeIngestionPipeline, error) { +func (opts *updatePipelineOpts) readData(r io.Reader) (*admin.DataLakeIngestionPipeline, error) { var out *admin.DataLakeIngestionPipeline var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -974,8 +1185,8 @@ func (opts *updatePipelineOpts) readData() (*admin.DataLakeIngestionPipeline, er return out, nil } -func (opts *updatePipelineOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updatePipelineOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -997,7 +1208,17 @@ func (opts *updatePipelineOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1012,7 +1233,7 @@ func updatePipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1021,6 +1242,7 @@ func updatePipelineBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("pipelineName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index f232b082bb..d34fd3c8e1 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createDatabaseUserOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createDatabaseUserOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createDatabaseUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) { +func (opts *createDatabaseUserOpts) readData(r io.Reader) (*admin.CloudDatabaseUser, error) { var out *admin.CloudDatabaseUser var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) return out, nil } -func (opts *createDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createDatabaseUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createDatabaseUserOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createDatabaseUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -132,6 +150,8 @@ type deleteDatabaseUserOpts struct { groupId string databaseName string username string + format string + tmpl *template.Template } func (opts *deleteDatabaseUserOpts) preRun() (err error) { @@ -150,10 +170,14 @@ func (opts *deleteDatabaseUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteDatabaseUserOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteDatabaseUserApiParams{ GroupId: opts.groupId, @@ -171,7 +195,17 @@ func (opts *deleteDatabaseUserOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -184,7 +218,7 @@ func deleteDatabaseUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -205,6 +239,7 @@ func deleteDatabaseUserBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -213,6 +248,8 @@ type getDatabaseUserOpts struct { groupId string databaseName string username string + format string + tmpl *template.Template } func (opts *getDatabaseUserOpts) preRun() (err error) { @@ -231,10 +268,14 @@ func (opts *getDatabaseUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getDatabaseUserOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetDatabaseUserApiParams{ GroupId: opts.groupId, @@ -252,7 +293,17 @@ func (opts *getDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -265,7 +316,7 @@ func getDatabaseUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -286,6 +337,7 @@ func getDatabaseUserBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -295,6 +347,8 @@ type listDatabaseUsersOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listDatabaseUsersOpts) preRun() (err error) { @@ -313,10 +367,14 @@ func (opts *listDatabaseUsersOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listDatabaseUsersOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listDatabaseUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListDatabaseUsersApiParams{ GroupId: opts.groupId, @@ -335,7 +393,17 @@ func (opts *listDatabaseUsersOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -348,7 +416,7 @@ func listDatabaseUsersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -356,6 +424,7 @@ func listDatabaseUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -367,6 +436,8 @@ type updateDatabaseUserOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateDatabaseUserOpts) preRun() (err error) { @@ -385,16 +456,20 @@ func (opts *updateDatabaseUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) { +func (opts *updateDatabaseUserOpts) readData(r io.Reader) (*admin.CloudDatabaseUser, error) { var out *admin.CloudDatabaseUser var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -410,8 +485,8 @@ func (opts *updateDatabaseUserOpts) readData() (*admin.CloudDatabaseUser, error) return out, nil } -func (opts *updateDatabaseUserOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateDatabaseUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -434,7 +509,17 @@ func (opts *updateDatabaseUserOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -449,7 +534,7 @@ func updateDatabaseUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -472,6 +557,7 @@ func updateDatabaseUserBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("username") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index c46db35fc5..25f57ce5c7 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -34,6 +35,8 @@ import ( type getEncryptionAtRestOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getEncryptionAtRestOpts) preRun() (err error) { @@ -52,10 +55,14 @@ func (opts *getEncryptionAtRestOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getEncryptionAtRestOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, @@ -71,7 +78,17 @@ func (opts *getEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -84,11 +101,12 @@ func getEncryptionAtRestBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -98,6 +116,8 @@ type updateEncryptionAtRestOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateEncryptionAtRestOpts) preRun() (err error) { @@ -116,16 +136,20 @@ func (opts *updateEncryptionAtRestOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateEncryptionAtRestOpts) readData() (*admin.EncryptionAtRest, error) { +func (opts *updateEncryptionAtRestOpts) readData(r io.Reader) (*admin.EncryptionAtRest, error) { var out *admin.EncryptionAtRest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -141,8 +165,8 @@ func (opts *updateEncryptionAtRestOpts) readData() (*admin.EncryptionAtRest, err return out, nil } -func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -163,7 +187,17 @@ func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -178,13 +212,14 @@ func updateEncryptionAtRestBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 842b9f37f3..c6ae375b37 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -23,6 +23,8 @@ import ( "errors" "fmt" "io" + "strings" + "text/template" "time" "github.com/mongodb/mongodb-atlas-cli/internal/config" @@ -35,6 +37,8 @@ type getOrganizationEventOpts struct { orgId string eventId string includeRaw bool + format string + tmpl *template.Template } func (opts *getOrganizationEventOpts) preRun() (err error) { @@ -53,10 +57,14 @@ func (opts *getOrganizationEventOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getOrganizationEventOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getOrganizationEventOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetOrganizationEventApiParams{ OrgId: opts.orgId, @@ -74,7 +82,17 @@ func (opts *getOrganizationEventOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -87,7 +105,7 @@ func getOrganizationEventBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -95,6 +113,7 @@ func getOrganizationEventBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) _ = cmd.MarkFlagRequired("eventId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -103,6 +122,8 @@ type getProjectEventOpts struct { groupId string eventId string includeRaw bool + format string + tmpl *template.Template } func (opts *getProjectEventOpts) preRun() (err error) { @@ -121,10 +142,14 @@ func (opts *getProjectEventOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getProjectEventOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getProjectEventOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetProjectEventApiParams{ GroupId: opts.groupId, @@ -142,7 +167,17 @@ func (opts *getProjectEventOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -155,7 +190,7 @@ func getProjectEventBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -163,6 +198,7 @@ func getProjectEventBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeRaw, "includeRaw", false, `Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event.`) _ = cmd.MarkFlagRequired("eventId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -176,6 +212,8 @@ type listOrganizationEventsOpts struct { includeRaw bool maxDate string minDate string + format string + tmpl *template.Template } func (opts *listOrganizationEventsOpts) preRun() (err error) { @@ -194,10 +232,14 @@ func (opts *listOrganizationEventsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listOrganizationEventsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationEventsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var maxDate *time.Time var errMaxDate error @@ -238,7 +280,17 @@ func (opts *listOrganizationEventsOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -251,7 +303,7 @@ func listOrganizationEventsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -265,6 +317,7 @@ func listOrganizationEventsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -280,6 +333,8 @@ type listProjectEventsOpts struct { includeRaw bool maxDate string minDate string + format string + tmpl *template.Template } func (opts *listProjectEventsOpts) preRun() (err error) { @@ -298,10 +353,14 @@ func (opts *listProjectEventsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listProjectEventsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listProjectEventsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var maxDate *time.Time var errMaxDate error @@ -344,7 +403,17 @@ func (opts *listProjectEventsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -357,7 +426,7 @@ func listProjectEventsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -375,6 +444,7 @@ func listProjectEventsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.maxDate, "maxDate", "", `Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) cmd.Flags().StringVar(&opts.minDate, "minDate", "", `Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index 50b9c23df0..dfc0dbf2ce 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createRoleMappingOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createRoleMappingOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createRoleMappingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, error) { +func (opts *createRoleMappingOpts) readData(r io.Reader) (*admin.AuthFederationRoleMapping, error) { var out *admin.AuthFederationRoleMapping var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, return out, nil } -func (opts *createRoleMappingOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createRoleMappingOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createRoleMappingOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createRoleMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -128,6 +145,7 @@ func createRoleMappingBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("federationSettingsId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -141,10 +159,10 @@ func (opts *deleteFederationAppOpts) preRun() (err error) { return err } - return nil + return err } -func (opts *deleteFederationAppOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *deleteFederationAppOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DeleteFederationAppApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -163,7 +181,7 @@ func deleteFederationAppBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -195,10 +213,10 @@ func (opts *deleteRoleMappingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + return err } -func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -219,7 +237,7 @@ func deleteRoleMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -235,6 +253,8 @@ type getConnectedOrgConfigOpts struct { client *admin.APIClient federationSettingsId string orgId string + format string + tmpl *template.Template } func (opts *getConnectedOrgConfigOpts) preRun() (err error) { @@ -242,10 +262,14 @@ func (opts *getConnectedOrgConfigOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getConnectedOrgConfigOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -262,7 +286,17 @@ func (opts *getConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -275,7 +309,7 @@ func getConnectedOrgConfigBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -283,12 +317,15 @@ func getConnectedOrgConfigBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getFederationSettingsOpts struct { client *admin.APIClient orgId string + format string + tmpl *template.Template } func (opts *getFederationSettingsOpts) preRun() (err error) { @@ -307,10 +344,14 @@ func (opts *getFederationSettingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getFederationSettingsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getFederationSettingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, @@ -326,7 +367,17 @@ func (opts *getFederationSettingsOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -339,11 +390,12 @@ func getFederationSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -351,6 +403,8 @@ type getIdentityProviderOpts struct { client *admin.APIClient federationSettingsId string identityProviderId string + format string + tmpl *template.Template } func (opts *getIdentityProviderOpts) preRun() (err error) { @@ -358,10 +412,14 @@ func (opts *getIdentityProviderOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getIdentityProviderOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getIdentityProviderOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -378,7 +436,17 @@ func (opts *getIdentityProviderOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -391,7 +459,7 @@ func getIdentityProviderBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -399,6 +467,7 @@ func getIdentityProviderBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -406,6 +475,8 @@ type getIdentityProviderMetadataOpts struct { client *admin.APIClient federationSettingsId string identityProviderId string + format string + tmpl *template.Template } func (opts *getIdentityProviderMetadataOpts) preRun() (err error) { @@ -413,10 +484,14 @@ func (opts *getIdentityProviderMetadataOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getIdentityProviderMetadataOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getIdentityProviderMetadataOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetIdentityProviderMetadataApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -433,7 +508,17 @@ func (opts *getIdentityProviderMetadataOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -446,7 +531,7 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -454,6 +539,7 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -462,6 +548,8 @@ type getRoleMappingOpts struct { federationSettingsId string id string orgId string + format string + tmpl *template.Template } func (opts *getRoleMappingOpts) preRun() (err error) { @@ -480,10 +568,14 @@ func (opts *getRoleMappingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getRoleMappingOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getRoleMappingOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -501,7 +593,17 @@ func (opts *getRoleMappingOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -514,7 +616,7 @@ func getRoleMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -523,12 +625,15 @@ func getRoleMappingBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listConnectedOrgConfigsOpts struct { client *admin.APIClient federationSettingsId string + format string + tmpl *template.Template } func (opts *listConnectedOrgConfigsOpts) preRun() (err error) { @@ -536,10 +641,14 @@ func (opts *listConnectedOrgConfigsOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listConnectedOrgConfigsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listConnectedOrgConfigsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListConnectedOrgConfigsApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -555,7 +664,17 @@ func (opts *listConnectedOrgConfigsOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -568,18 +687,21 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) _ = cmd.MarkFlagRequired("federationSettingsId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listIdentityProvidersOpts struct { client *admin.APIClient federationSettingsId string + format string + tmpl *template.Template } func (opts *listIdentityProvidersOpts) preRun() (err error) { @@ -587,10 +709,14 @@ func (opts *listIdentityProvidersOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listIdentityProvidersOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listIdentityProvidersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListIdentityProvidersApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -606,7 +732,17 @@ func (opts *listIdentityProvidersOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -619,12 +755,13 @@ func listIdentityProvidersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) _ = cmd.MarkFlagRequired("federationSettingsId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -632,6 +769,8 @@ type listRoleMappingsOpts struct { client *admin.APIClient federationSettingsId string orgId string + format string + tmpl *template.Template } func (opts *listRoleMappingsOpts) preRun() (err error) { @@ -650,10 +789,14 @@ func (opts *listRoleMappingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listRoleMappingsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listRoleMappingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -670,7 +813,17 @@ func (opts *listRoleMappingsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -683,13 +836,14 @@ func listRoleMappingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) _ = cmd.MarkFlagRequired("federationSettingsId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -697,6 +851,8 @@ type removeConnectedOrgConfigOpts struct { client *admin.APIClient federationSettingsId string orgId string + format string + tmpl *template.Template } func (opts *removeConnectedOrgConfigOpts) preRun() (err error) { @@ -704,10 +860,14 @@ func (opts *removeConnectedOrgConfigOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *removeConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) error { +func (opts *removeConnectedOrgConfigOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.RemoveConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -724,7 +884,17 @@ func (opts *removeConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -737,7 +907,7 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -745,6 +915,7 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -755,6 +926,8 @@ type updateConnectedOrgConfigOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateConnectedOrgConfigOpts) preRun() (err error) { @@ -762,16 +935,20 @@ func (opts *updateConnectedOrgConfigOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateConnectedOrgConfigOpts) readData() (*admin.ConnectedOrgConfig, error) { +func (opts *updateConnectedOrgConfigOpts) readData(r io.Reader) (*admin.ConnectedOrgConfig, error) { var out *admin.ConnectedOrgConfig var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -787,8 +964,8 @@ func (opts *updateConnectedOrgConfigOpts) readData() (*admin.ConnectedOrgConfig, return out, nil } -func (opts *updateConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateConnectedOrgConfigOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -810,7 +987,17 @@ func (opts *updateConnectedOrgConfigOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -825,7 +1012,7 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -835,6 +1022,7 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("orgId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -845,6 +1033,8 @@ type updateIdentityProviderOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateIdentityProviderOpts) preRun() (err error) { @@ -852,16 +1042,20 @@ func (opts *updateIdentityProviderOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateIdentityProviderOpts) readData() (*admin.SamlIdentityProviderUpdate, error) { +func (opts *updateIdentityProviderOpts) readData(r io.Reader) (*admin.SamlIdentityProviderUpdate, error) { var out *admin.SamlIdentityProviderUpdate var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -877,8 +1071,8 @@ func (opts *updateIdentityProviderOpts) readData() (*admin.SamlIdentityProviderU return out, nil } -func (opts *updateIdentityProviderOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateIdentityProviderOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -900,7 +1094,17 @@ func (opts *updateIdentityProviderOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -915,7 +1119,7 @@ func updateIdentityProviderBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -925,6 +1129,7 @@ func updateIdentityProviderBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -936,6 +1141,8 @@ type updateRoleMappingOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateRoleMappingOpts) preRun() (err error) { @@ -954,16 +1161,20 @@ func (opts *updateRoleMappingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, error) { +func (opts *updateRoleMappingOpts) readData(r io.Reader) (*admin.AuthFederationRoleMapping, error) { var out *admin.AuthFederationRoleMapping var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -979,8 +1190,8 @@ func (opts *updateRoleMappingOpts) readData() (*admin.AuthFederationRoleMapping, return out, nil } -func (opts *updateRoleMappingOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateRoleMappingOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1003,7 +1214,17 @@ func (opts *updateRoleMappingOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1018,7 +1239,7 @@ func updateRoleMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -1029,6 +1250,7 @@ func updateRoleMappingBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("id") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 21c190016c..ea81cbb8eb 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createCustomZoneMappingOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createCustomZoneMappingOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createCustomZoneMappingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createCustomZoneMappingOpts) readData() (*admin.GeoSharding, error) { +func (opts *createCustomZoneMappingOpts) readData(r io.Reader) (*admin.GeoSharding, error) { var out *admin.GeoSharding var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createCustomZoneMappingOpts) readData() (*admin.GeoSharding, error) return out, nil } -func (opts *createCustomZoneMappingOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createCustomZoneMappingOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createCustomZoneMappingOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createCustomZoneMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func createCustomZoneMappingBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -138,6 +156,8 @@ type createManagedNamespaceOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createManagedNamespaceOpts) preRun() (err error) { @@ -156,16 +176,20 @@ func (opts *createManagedNamespaceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createManagedNamespaceOpts) readData() (*admin.ManagedNamespace, error) { +func (opts *createManagedNamespaceOpts) readData(r io.Reader) (*admin.ManagedNamespace, error) { var out *admin.ManagedNamespace var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -181,8 +205,8 @@ func (opts *createManagedNamespaceOpts) readData() (*admin.ManagedNamespace, err return out, nil } -func (opts *createManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createManagedNamespaceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -204,7 +228,17 @@ func (opts *createManagedNamespaceOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -219,7 +253,7 @@ func createManagedNamespaceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -228,6 +262,7 @@ func createManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -235,6 +270,8 @@ type deleteAllCustomZoneMappingsOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *deleteAllCustomZoneMappingsOpts) preRun() (err error) { @@ -253,10 +290,14 @@ func (opts *deleteAllCustomZoneMappingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteAllCustomZoneMappingsApiParams{ GroupId: opts.groupId, @@ -273,7 +314,17 @@ func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -286,13 +337,14 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -302,6 +354,8 @@ type deleteManagedNamespaceOpts struct { groupId string db string collection string + format string + tmpl *template.Template } func (opts *deleteManagedNamespaceOpts) preRun() (err error) { @@ -320,10 +374,14 @@ func (opts *deleteManagedNamespaceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, @@ -342,7 +400,17 @@ func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -355,7 +423,7 @@ func deleteManagedNamespaceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) @@ -364,6 +432,7 @@ func deleteManagedNamespaceBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -371,6 +440,8 @@ type getManagedNamespaceOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *getManagedNamespaceOpts) preRun() (err error) { @@ -389,10 +460,14 @@ func (opts *getManagedNamespaceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getManagedNamespaceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetManagedNamespaceApiParams{ GroupId: opts.groupId, @@ -409,7 +484,17 @@ func (opts *getManagedNamespaceOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -422,13 +507,14 @@ func getManagedNamespaceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index 9825698b4a..3b51cae801 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createCostExplorerQueryProcessOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createCostExplorerQueryProcessOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createCostExplorerQueryProcessOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createCostExplorerQueryProcessOpts) readData() (*admin.CostExplorerFilterRequestBody, error) { +func (opts *createCostExplorerQueryProcessOpts) readData(r io.Reader) (*admin.CostExplorerFilterRequestBody, error) { var out *admin.CostExplorerFilterRequestBody var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createCostExplorerQueryProcessOpts) readData() (*admin.CostExplorerF return out, nil } -func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, w io.Wr return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -131,6 +149,8 @@ type createCostExplorerQueryProcess1Opts struct { client *admin.APIClient orgId string token string + format string + tmpl *template.Template } func (opts *createCostExplorerQueryProcess1Opts) preRun() (err error) { @@ -149,10 +169,14 @@ func (opts *createCostExplorerQueryProcess1Opts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, w io.Writer) error { +func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.CreateCostExplorerQueryProcess1ApiParams{ OrgId: opts.orgId, @@ -169,7 +193,17 @@ func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, w io.W return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -182,13 +216,14 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.token, "token", "", `Unique 64 digit string that identifies the Cost Explorer query.`) _ = cmd.MarkFlagRequired("token") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -196,6 +231,8 @@ type downloadInvoiceCSVOpts struct { client *admin.APIClient orgId string invoiceId string + format string + tmpl *template.Template } func (opts *downloadInvoiceCSVOpts) preRun() (err error) { @@ -214,10 +251,14 @@ func (opts *downloadInvoiceCSVOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, w io.Writer) error { +func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DownloadInvoiceCSVApiParams{ OrgId: opts.orgId, @@ -234,7 +275,17 @@ func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -247,13 +298,14 @@ func downloadInvoiceCSVBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) _ = cmd.MarkFlagRequired("invoiceId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -261,6 +313,8 @@ type getInvoiceOpts struct { client *admin.APIClient orgId string invoiceId string + format string + tmpl *template.Template } func (opts *getInvoiceOpts) preRun() (err error) { @@ -279,10 +333,14 @@ func (opts *getInvoiceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getInvoiceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getInvoiceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetInvoiceApiParams{ OrgId: opts.orgId, @@ -299,7 +357,17 @@ func (opts *getInvoiceOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -312,13 +380,14 @@ func getInvoiceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invoiceId, "invoiceId", "", `Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.`) _ = cmd.MarkFlagRequired("invoiceId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -328,6 +397,8 @@ type listInvoicesOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listInvoicesOpts) preRun() (err error) { @@ -346,10 +417,14 @@ func (opts *listInvoicesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listInvoicesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listInvoicesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListInvoicesApiParams{ OrgId: opts.orgId, @@ -368,7 +443,17 @@ func (opts *listInvoicesOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -381,7 +466,7 @@ func listInvoicesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -389,12 +474,15 @@ func listInvoicesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listPendingInvoicesOpts struct { client *admin.APIClient orgId string + format string + tmpl *template.Template } func (opts *listPendingInvoicesOpts) preRun() (err error) { @@ -413,10 +501,14 @@ func (opts *listPendingInvoicesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPendingInvoicesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPendingInvoicesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, @@ -432,7 +524,17 @@ func (opts *listPendingInvoicesOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -445,11 +547,12 @@ func listPendingInvoicesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 8329317f5b..680120dc73 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -34,6 +35,8 @@ import ( type deleteLDAPConfigurationOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *deleteLDAPConfigurationOpts) preRun() (err error) { @@ -52,10 +55,14 @@ func (opts *deleteLDAPConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -71,7 +78,17 @@ func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -84,17 +101,20 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getLDAPConfigurationOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getLDAPConfigurationOpts) preRun() (err error) { @@ -113,10 +133,14 @@ func (opts *getLDAPConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getLDAPConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, @@ -132,7 +156,17 @@ func (opts *getLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -145,11 +179,12 @@ func getLDAPConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -157,6 +192,8 @@ type getLDAPConfigurationStatusOpts struct { client *admin.APIClient groupId string requestId string + format string + tmpl *template.Template } func (opts *getLDAPConfigurationStatusOpts) preRun() (err error) { @@ -175,10 +212,14 @@ func (opts *getLDAPConfigurationStatusOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetLDAPConfigurationStatusApiParams{ GroupId: opts.groupId, @@ -195,7 +236,17 @@ func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, w io.Writer return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -208,13 +259,14 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.requestId, "requestId", "", `Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration.`) _ = cmd.MarkFlagRequired("requestId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -224,6 +276,8 @@ type saveLDAPConfigurationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *saveLDAPConfigurationOpts) preRun() (err error) { @@ -242,16 +296,20 @@ func (opts *saveLDAPConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *saveLDAPConfigurationOpts) readData() (*admin.UserSecurity, error) { +func (opts *saveLDAPConfigurationOpts) readData(r io.Reader) (*admin.UserSecurity, error) { var out *admin.UserSecurity var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -267,8 +325,8 @@ func (opts *saveLDAPConfigurationOpts) readData() (*admin.UserSecurity, error) { return out, nil } -func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -289,7 +347,17 @@ func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -304,13 +372,14 @@ func saveLDAPConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -320,6 +389,8 @@ type verifyLDAPConfigurationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *verifyLDAPConfigurationOpts) preRun() (err error) { @@ -338,16 +409,20 @@ func (opts *verifyLDAPConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *verifyLDAPConfigurationOpts) readData() (*admin.LDAPVerifyConnectivityJobRequestParams, error) { +func (opts *verifyLDAPConfigurationOpts) readData(r io.Reader) (*admin.LDAPVerifyConnectivityJobRequestParams, error) { var out *admin.LDAPVerifyConnectivityJobRequestParams var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -363,8 +438,8 @@ func (opts *verifyLDAPConfigurationOpts) readData() (*admin.LDAPVerifyConnectivi return out, nil } -func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -385,7 +460,17 @@ func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -400,13 +485,14 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 66b1402335..deebd2c5d2 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -36,6 +37,8 @@ type deleteLegacySnapshotOpts struct { groupId string clusterName string snapshotId string + format string + tmpl *template.Template } func (opts *deleteLegacySnapshotOpts) preRun() (err error) { @@ -54,10 +57,14 @@ func (opts *deleteLegacySnapshotOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteLegacySnapshotApiParams{ GroupId: opts.groupId, @@ -75,7 +82,17 @@ func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -88,7 +105,7 @@ func deleteLegacySnapshotBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -97,6 +114,7 @@ func deleteLegacySnapshotBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -105,6 +123,8 @@ type getLegacyBackupCheckpointOpts struct { groupId string checkpointId string clusterName string + format string + tmpl *template.Template } func (opts *getLegacyBackupCheckpointOpts) preRun() (err error) { @@ -123,10 +143,14 @@ func (opts *getLegacyBackupCheckpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetLegacyBackupCheckpointApiParams{ GroupId: opts.groupId, @@ -144,7 +168,17 @@ func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -157,7 +191,7 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -166,6 +200,7 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("checkpointId") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -174,6 +209,8 @@ type getLegacyBackupRestoreJobOpts struct { groupId string clusterName string jobId string + format string + tmpl *template.Template } func (opts *getLegacyBackupRestoreJobOpts) preRun() (err error) { @@ -192,10 +229,14 @@ func (opts *getLegacyBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -213,7 +254,17 @@ func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -226,7 +277,7 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -235,6 +286,7 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("jobId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -243,6 +295,8 @@ type getLegacySnapshotOpts struct { groupId string clusterName string snapshotId string + format string + tmpl *template.Template } func (opts *getLegacySnapshotOpts) preRun() (err error) { @@ -261,10 +315,14 @@ func (opts *getLegacySnapshotOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getLegacySnapshotOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetLegacySnapshotApiParams{ GroupId: opts.groupId, @@ -282,7 +340,17 @@ func (opts *getLegacySnapshotOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -295,7 +363,7 @@ func getLegacySnapshotBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -304,6 +372,7 @@ func getLegacySnapshotBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -311,6 +380,8 @@ type getLegacySnapshotScheduleOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *getLegacySnapshotScheduleOpts) preRun() (err error) { @@ -329,10 +400,14 @@ func (opts *getLegacySnapshotScheduleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, @@ -349,7 +424,17 @@ func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -362,13 +447,14 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -379,6 +465,8 @@ type listLegacyBackupCheckpointsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listLegacyBackupCheckpointsOpts) preRun() (err error) { @@ -397,10 +485,14 @@ func (opts *listLegacyBackupCheckpointsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListLegacyBackupCheckpointsApiParams{ GroupId: opts.groupId, @@ -420,7 +512,17 @@ func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -433,7 +535,7 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -443,6 +545,7 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -454,6 +557,8 @@ type listLegacyBackupRestoreJobsOpts struct { itemsPerPage int pageNum int batchId string + format string + tmpl *template.Template } func (opts *listLegacyBackupRestoreJobsOpts) preRun() (err error) { @@ -472,10 +577,14 @@ func (opts *listLegacyBackupRestoreJobsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListLegacyBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -496,7 +605,17 @@ func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -509,7 +628,7 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -520,6 +639,7 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.batchId, "batchId", "", `Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -531,6 +651,8 @@ type listLegacySnapshotsOpts struct { itemsPerPage int pageNum int completed string + format string + tmpl *template.Template } func (opts *listLegacySnapshotsOpts) preRun() (err error) { @@ -549,10 +671,14 @@ func (opts *listLegacySnapshotsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listLegacySnapshotsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listLegacySnapshotsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListLegacySnapshotsApiParams{ GroupId: opts.groupId, @@ -573,7 +699,17 @@ func (opts *listLegacySnapshotsOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -586,7 +722,7 @@ func listLegacySnapshotsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -597,6 +733,7 @@ func listLegacySnapshotsBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.completed, "completed", ""true"", `Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -608,6 +745,8 @@ type updateLegacySnapshotRetentionOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateLegacySnapshotRetentionOpts) preRun() (err error) { @@ -626,16 +765,20 @@ func (opts *updateLegacySnapshotRetentionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateLegacySnapshotRetentionOpts) readData() (*admin.BackupSnapshot, error) { +func (opts *updateLegacySnapshotRetentionOpts) readData(r io.Reader) (*admin.BackupSnapshot, error) { var out *admin.BackupSnapshot var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -651,8 +794,8 @@ func (opts *updateLegacySnapshotRetentionOpts) readData() (*admin.BackupSnapshot return out, nil } -func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -675,7 +818,17 @@ func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, w io.Wri return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -690,7 +843,7 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -701,6 +854,7 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -711,6 +865,8 @@ type updateLegacySnapshotScheduleOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateLegacySnapshotScheduleOpts) preRun() (err error) { @@ -729,16 +885,20 @@ func (opts *updateLegacySnapshotScheduleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateLegacySnapshotScheduleOpts) readData() (*admin.ApiAtlasSnapshotSchedule, error) { +func (opts *updateLegacySnapshotScheduleOpts) readData(r io.Reader) (*admin.ApiAtlasSnapshotSchedule, error) { var out *admin.ApiAtlasSnapshotSchedule var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -754,8 +914,8 @@ func (opts *updateLegacySnapshotScheduleOpts) readData() (*admin.ApiAtlasSnapsho return out, nil } -func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -777,7 +937,17 @@ func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -792,7 +962,7 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -801,6 +971,7 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index e264ac54fe..1afea5621e 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createLegacyBackupRestoreJobOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createLegacyBackupRestoreJobOpts) readData() (*admin.BackupRestoreJob, error) { +func (opts *createLegacyBackupRestoreJobOpts) readData(r io.Reader) (*admin.BackupRestoreJob, error) { var out *admin.BackupRestoreJob var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createLegacyBackupRestoreJobOpts) readData() (*admin.BackupRestoreJo return out, nil } -func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index 7598aa52f8..ca46dd9f52 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -52,10 +53,10 @@ func (opts *deferMaintenanceWindowOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *deferMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *deferMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -74,7 +75,7 @@ func deferMaintenanceWindowBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -85,6 +86,8 @@ func deferMaintenanceWindowBuilder() *cobra.Command { type getMaintenanceWindowOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getMaintenanceWindowOpts) preRun() (err error) { @@ -103,10 +106,14 @@ func (opts *getMaintenanceWindowOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -122,7 +129,17 @@ func (opts *getMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -135,11 +152,12 @@ func getMaintenanceWindowBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -164,10 +182,10 @@ func (opts *resetMaintenanceWindowOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *resetMaintenanceWindowOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *resetMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, @@ -186,7 +204,7 @@ func resetMaintenanceWindowBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -215,10 +233,10 @@ func (opts *toggleMaintenanceAutoDeferOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *toggleMaintenanceAutoDeferOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *toggleMaintenanceAutoDeferOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, @@ -237,7 +255,7 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -251,6 +269,8 @@ type updateMaintenanceWindowOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateMaintenanceWindowOpts) preRun() (err error) { @@ -269,16 +289,20 @@ func (opts *updateMaintenanceWindowOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateMaintenanceWindowOpts) readData() (*admin.GroupMaintenanceWindow, error) { +func (opts *updateMaintenanceWindowOpts) readData(r io.Reader) (*admin.GroupMaintenanceWindow, error) { var out *admin.GroupMaintenanceWindow var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -294,8 +318,8 @@ func (opts *updateMaintenanceWindowOpts) readData() (*admin.GroupMaintenanceWind return out, nil } -func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -316,7 +340,17 @@ func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -331,13 +365,14 @@ func updateMaintenanceWindowBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index 53078e6ab0..b527d3ae84 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -21,7 +21,8 @@ import ( "encoding/json" "fmt" "io" - "os" + "strings" + "text/template" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -33,6 +34,8 @@ type createUserOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createUserOpts) preRun() (err error) { @@ -40,16 +43,20 @@ func (opts *createUserOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createUserOpts) readData() (*admin.CloudAppUser, error) { +func (opts *createUserOpts) readData(r io.Reader) (*admin.CloudAppUser, error) { var out *admin.CloudAppUser var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -65,8 +72,8 @@ func (opts *createUserOpts) readData() (*admin.CloudAppUser, error) { return out, nil } -func (opts *createUserOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -86,7 +93,17 @@ func (opts *createUserOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -101,18 +118,21 @@ func createUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getUserOpts struct { client *admin.APIClient userId string + format string + tmpl *template.Template } func (opts *getUserOpts) preRun() (err error) { @@ -120,10 +140,14 @@ func (opts *getUserOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getUserOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getUserOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetUserApiParams{ UserId: opts.userId, @@ -139,7 +163,17 @@ func (opts *getUserOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -152,18 +186,21 @@ func getUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies this user.`) _ = cmd.MarkFlagRequired("userId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getUserByUsernameOpts struct { client *admin.APIClient userName string + format string + tmpl *template.Template } func (opts *getUserByUsernameOpts) preRun() (err error) { @@ -171,10 +208,14 @@ func (opts *getUserByUsernameOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getUserByUsernameOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getUserByUsernameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetUserByUsernameApiParams{ UserName: opts.userName, @@ -190,7 +231,17 @@ func (opts *getUserByUsernameOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -203,12 +254,13 @@ func getUserByUsernameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.userName, "userName", "", `Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.`) _ = cmd.MarkFlagRequired("userName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index 61fb62bb18..a54552c8cc 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -23,6 +23,8 @@ import ( "errors" "fmt" "io" + "strings" + "text/template" "time" "github.com/mongodb/mongodb-atlas-cli/internal/config" @@ -34,6 +36,8 @@ type getAtlasProcessOpts struct { client *admin.APIClient groupId string processId string + format string + tmpl *template.Template } func (opts *getAtlasProcessOpts) preRun() (err error) { @@ -52,10 +56,14 @@ func (opts *getAtlasProcessOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getAtlasProcessOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getAtlasProcessOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetAtlasProcessApiParams{ GroupId: opts.groupId, @@ -72,7 +80,17 @@ func (opts *getAtlasProcessOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -85,13 +103,14 @@ func getAtlasProcessBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests.`) _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -100,6 +119,8 @@ type getDatabaseOpts struct { groupId string databaseName string processId string + format string + tmpl *template.Template } func (opts *getDatabaseOpts) preRun() (err error) { @@ -118,10 +139,14 @@ func (opts *getDatabaseOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getDatabaseOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getDatabaseOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetDatabaseApiParams{ GroupId: opts.groupId, @@ -139,7 +164,17 @@ func (opts *getDatabaseOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -152,7 +187,7 @@ func getDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -161,6 +196,7 @@ func getDatabaseBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -174,6 +210,8 @@ type getDatabaseMeasurementsOpts struct { period string start string end string + format string + tmpl *template.Template } func (opts *getDatabaseMeasurementsOpts) preRun() (err error) { @@ -192,10 +230,14 @@ func (opts *getDatabaseMeasurementsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var start *time.Time var errStart error @@ -236,7 +278,17 @@ func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -249,7 +301,7 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -264,6 +316,7 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("databaseName") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -277,6 +330,8 @@ type getDiskMeasurementsOpts struct { period string start string end string + format string + tmpl *template.Template } func (opts *getDiskMeasurementsOpts) preRun() (err error) { @@ -295,10 +350,14 @@ func (opts *getDiskMeasurementsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getDiskMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var start *time.Time var errStart error @@ -339,7 +398,17 @@ func (opts *getDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -352,7 +421,7 @@ func getDiskMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -367,6 +436,7 @@ func getDiskMeasurementsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -377,6 +447,8 @@ type getHostLogsOpts struct { logName string endDate int64 startDate int64 + format string + tmpl *template.Template } func (opts *getHostLogsOpts) preRun() (err error) { @@ -395,10 +467,14 @@ func (opts *getHostLogsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getHostLogsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getHostLogsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetHostLogsApiParams{ GroupId: opts.groupId, @@ -418,7 +494,17 @@ func (opts *getHostLogsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -431,7 +517,7 @@ func getHostLogsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -442,6 +528,7 @@ func getHostLogsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("hostName") _ = cmd.MarkFlagRequired("logName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -454,6 +541,8 @@ type getHostMeasurementsOpts struct { period string start string end string + format string + tmpl *template.Template } func (opts *getHostMeasurementsOpts) preRun() (err error) { @@ -472,10 +561,14 @@ func (opts *getHostMeasurementsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getHostMeasurementsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getHostMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var start *time.Time var errStart error @@ -515,7 +608,17 @@ func (opts *getHostMeasurementsOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -528,7 +631,7 @@ func getHostMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -541,6 +644,7 @@ func getHostMeasurementsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -556,6 +660,8 @@ type getIndexMetricsOpts struct { period string start string end string + format string + tmpl *template.Template } func (opts *getIndexMetricsOpts) preRun() (err error) { @@ -574,10 +680,14 @@ func (opts *getIndexMetricsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getIndexMetricsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var start *time.Time var errStart error @@ -620,7 +730,17 @@ func (opts *getIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -633,7 +753,7 @@ func getIndexMetricsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -653,6 +773,7 @@ func getIndexMetricsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -665,6 +786,8 @@ type getMeasurementsOpts struct { period string start string end string + format string + tmpl *template.Template } func (opts *getMeasurementsOpts) preRun() (err error) { @@ -683,10 +806,14 @@ func (opts *getMeasurementsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getMeasurementsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var start *time.Time var errStart error @@ -726,7 +853,17 @@ func (opts *getMeasurementsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -739,7 +876,7 @@ func getMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -753,6 +890,7 @@ func getMeasurementsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("processId") _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -762,6 +900,8 @@ type listAtlasProcessesOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listAtlasProcessesOpts) preRun() (err error) { @@ -780,10 +920,14 @@ func (opts *listAtlasProcessesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listAtlasProcessesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listAtlasProcessesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListAtlasProcessesApiParams{ GroupId: opts.groupId, @@ -802,7 +946,17 @@ func (opts *listAtlasProcessesOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -815,7 +969,7 @@ func listAtlasProcessesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -823,6 +977,7 @@ func listAtlasProcessesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -833,6 +988,8 @@ type listDatabasesOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listDatabasesOpts) preRun() (err error) { @@ -851,10 +1008,14 @@ func (opts *listDatabasesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listDatabasesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listDatabasesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListDatabasesApiParams{ GroupId: opts.groupId, @@ -874,7 +1035,17 @@ func (opts *listDatabasesOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -887,7 +1058,7 @@ func listDatabasesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -897,6 +1068,7 @@ func listDatabasesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -905,6 +1077,8 @@ type listDiskMeasurementsOpts struct { partitionName string groupId string processId string + format string + tmpl *template.Template } func (opts *listDiskMeasurementsOpts) preRun() (err error) { @@ -923,10 +1097,14 @@ func (opts *listDiskMeasurementsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listDiskMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListDiskMeasurementsApiParams{ PartitionName: opts.partitionName, @@ -944,7 +1122,17 @@ func (opts *listDiskMeasurementsOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -957,7 +1145,7 @@ func listDiskMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) @@ -966,6 +1154,7 @@ func listDiskMeasurementsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("partitionName") _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -976,6 +1165,8 @@ type listDiskPartitionsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listDiskPartitionsOpts) preRun() (err error) { @@ -994,10 +1185,14 @@ func (opts *listDiskPartitionsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listDiskPartitionsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listDiskPartitionsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListDiskPartitionsApiParams{ GroupId: opts.groupId, @@ -1017,7 +1212,17 @@ func (opts *listDiskPartitionsOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1030,7 +1235,7 @@ func listDiskPartitionsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1040,6 +1245,7 @@ func listDiskPartitionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1054,6 +1260,8 @@ type listIndexMetricsOpts struct { period string start string end string + format string + tmpl *template.Template } func (opts *listIndexMetricsOpts) preRun() (err error) { @@ -1072,10 +1280,14 @@ func (opts *listIndexMetricsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listIndexMetricsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { var start *time.Time var errStart error @@ -1117,7 +1329,17 @@ func (opts *listIndexMetricsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1130,7 +1352,7 @@ func listIndexMetricsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -1148,6 +1370,7 @@ func listIndexMetricsBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("collectionName") _ = cmd.MarkFlagRequired("granularity") _ = cmd.MarkFlagRequired("metrics") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1155,6 +1378,8 @@ type listMetricTypesOpts struct { client *admin.APIClient processId string groupId string + format string + tmpl *template.Template } func (opts *listMetricTypesOpts) preRun() (err error) { @@ -1173,10 +1398,14 @@ func (opts *listMetricTypesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listMetricTypesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listMetricTypesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListMetricTypesApiParams{ ProcessId: opts.processId, @@ -1193,7 +1422,17 @@ func (opts *listMetricTypesOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1206,13 +1445,14 @@ func listMetricTypesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index 628cc3d495..38950c3866 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createPeeringConnectionOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createPeeringConnectionOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createPeeringConnectionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createPeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringConnectionSettings, error) { +func (opts *createPeeringConnectionOpts) readData(r io.Reader) (*admin.BaseNetworkPeeringConnectionSettings, error) { var out *admin.BaseNetworkPeeringConnectionSettings var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createPeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringCo return out, nil } -func (opts *createPeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createPeeringConnectionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createPeeringConnectionOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createPeeringConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -133,6 +151,8 @@ type createPeeringContainerOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createPeeringContainerOpts) preRun() (err error) { @@ -151,16 +171,20 @@ func (opts *createPeeringContainerOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createPeeringContainerOpts) readData() (*admin.CloudProviderContainer, error) { +func (opts *createPeeringContainerOpts) readData(r io.Reader) (*admin.CloudProviderContainer, error) { var out *admin.CloudProviderContainer var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -176,8 +200,8 @@ func (opts *createPeeringContainerOpts) readData() (*admin.CloudProviderContaine return out, nil } -func (opts *createPeeringContainerOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createPeeringContainerOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -198,7 +222,17 @@ func (opts *createPeeringContainerOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -213,13 +247,14 @@ func createPeeringContainerBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -227,6 +262,8 @@ type deletePeeringConnectionOpts struct { client *admin.APIClient groupId string peerId string + format string + tmpl *template.Template } func (opts *deletePeeringConnectionOpts) preRun() (err error) { @@ -245,10 +282,14 @@ func (opts *deletePeeringConnectionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deletePeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deletePeeringConnectionOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeletePeeringConnectionApiParams{ GroupId: opts.groupId, @@ -265,7 +306,17 @@ func (opts *deletePeeringConnectionOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -278,13 +329,14 @@ func deletePeeringConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete.`) _ = cmd.MarkFlagRequired("peerId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -292,6 +344,8 @@ type deletePeeringContainerOpts struct { client *admin.APIClient groupId string containerId string + format string + tmpl *template.Template } func (opts *deletePeeringContainerOpts) preRun() (err error) { @@ -310,10 +364,14 @@ func (opts *deletePeeringContainerOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deletePeeringContainerOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deletePeeringContainerOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeletePeeringContainerApiParams{ GroupId: opts.groupId, @@ -330,7 +388,17 @@ func (opts *deletePeeringContainerOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -343,13 +411,14 @@ func deletePeeringContainerBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("containerId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -359,6 +428,8 @@ type disablePeeringOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *disablePeeringOpts) preRun() (err error) { @@ -377,16 +448,20 @@ func (opts *disablePeeringOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *disablePeeringOpts) readData() (*admin.PrivateIPMode, error) { +func (opts *disablePeeringOpts) readData(r io.Reader) (*admin.PrivateIPMode, error) { var out *admin.PrivateIPMode var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -402,8 +477,8 @@ func (opts *disablePeeringOpts) readData() (*admin.PrivateIPMode, error) { return out, nil } -func (opts *disablePeeringOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *disablePeeringOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -424,7 +499,17 @@ func (opts *disablePeeringOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -439,13 +524,14 @@ func disablePeeringBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -453,6 +539,8 @@ type getPeeringConnectionOpts struct { client *admin.APIClient groupId string peerId string + format string + tmpl *template.Template } func (opts *getPeeringConnectionOpts) preRun() (err error) { @@ -471,10 +559,14 @@ func (opts *getPeeringConnectionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getPeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getPeeringConnectionOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetPeeringConnectionApiParams{ GroupId: opts.groupId, @@ -491,7 +583,17 @@ func (opts *getPeeringConnectionOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -504,13 +606,14 @@ func getPeeringConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.peerId, "peerId", "", `Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve.`) _ = cmd.MarkFlagRequired("peerId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -518,6 +621,8 @@ type getPeeringContainerOpts struct { client *admin.APIClient groupId string containerId string + format string + tmpl *template.Template } func (opts *getPeeringContainerOpts) preRun() (err error) { @@ -536,10 +641,14 @@ func (opts *getPeeringContainerOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getPeeringContainerOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getPeeringContainerOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetPeeringContainerApiParams{ GroupId: opts.groupId, @@ -556,7 +665,17 @@ func (opts *getPeeringContainerOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -569,13 +688,14 @@ func getPeeringContainerBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.containerId, "containerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove.`) _ = cmd.MarkFlagRequired("containerId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -586,6 +706,8 @@ type listPeeringConnectionsOpts struct { itemsPerPage int pageNum int providerName string + format string + tmpl *template.Template } func (opts *listPeeringConnectionsOpts) preRun() (err error) { @@ -604,10 +726,14 @@ func (opts *listPeeringConnectionsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPeeringConnectionsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPeeringConnectionsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListPeeringConnectionsApiParams{ GroupId: opts.groupId, @@ -627,7 +753,17 @@ func (opts *listPeeringConnectionsOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -640,7 +776,7 @@ func listPeeringConnectionsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -649,6 +785,7 @@ func listPeeringConnectionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.providerName, "providerName", ""AWS"", `Cloud service provider to use for this VPC peering connection.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -659,6 +796,8 @@ type listPeeringContainerByCloudProviderOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listPeeringContainerByCloudProviderOpts) preRun() (err error) { @@ -677,10 +816,14 @@ func (opts *listPeeringContainerByCloudProviderOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, @@ -700,7 +843,17 @@ func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, w return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -713,7 +866,7 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -723,6 +876,7 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("providerName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -732,6 +886,8 @@ type listPeeringContainersOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listPeeringContainersOpts) preRun() (err error) { @@ -750,10 +906,14 @@ func (opts *listPeeringContainersOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPeeringContainersOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPeeringContainersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListPeeringContainersApiParams{ GroupId: opts.groupId, @@ -772,7 +932,17 @@ func (opts *listPeeringContainersOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -785,7 +955,7 @@ func listPeeringContainersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -793,6 +963,7 @@ func listPeeringContainersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -803,6 +974,8 @@ type updatePeeringConnectionOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updatePeeringConnectionOpts) preRun() (err error) { @@ -821,16 +994,20 @@ func (opts *updatePeeringConnectionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updatePeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringConnectionSettings, error) { +func (opts *updatePeeringConnectionOpts) readData(r io.Reader) (*admin.BaseNetworkPeeringConnectionSettings, error) { var out *admin.BaseNetworkPeeringConnectionSettings var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -846,8 +1023,8 @@ func (opts *updatePeeringConnectionOpts) readData() (*admin.BaseNetworkPeeringCo return out, nil } -func (opts *updatePeeringConnectionOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updatePeeringConnectionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -869,7 +1046,17 @@ func (opts *updatePeeringConnectionOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -884,7 +1071,7 @@ func updatePeeringConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -893,6 +1080,7 @@ func updatePeeringConnectionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("peerId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -903,6 +1091,8 @@ type updatePeeringContainerOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updatePeeringContainerOpts) preRun() (err error) { @@ -921,16 +1111,20 @@ func (opts *updatePeeringContainerOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updatePeeringContainerOpts) readData() (*admin.CloudProviderContainer, error) { +func (opts *updatePeeringContainerOpts) readData(r io.Reader) (*admin.CloudProviderContainer, error) { var out *admin.CloudProviderContainer var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -946,8 +1140,8 @@ func (opts *updatePeeringContainerOpts) readData() (*admin.CloudProviderContaine return out, nil } -func (opts *updatePeeringContainerOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updatePeeringContainerOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -969,7 +1163,17 @@ func (opts *updatePeeringContainerOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -984,7 +1188,7 @@ func updatePeeringContainerBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -993,12 +1197,15 @@ func updatePeeringContainerBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("containerId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type verifyConnectViaPeeringOnlyModeForOneProjectOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) preRun() (err error) { @@ -1017,10 +1224,14 @@ func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) preRun() (err erro return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Context, w io.Writer) error { +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, @@ -1036,7 +1247,17 @@ func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Co return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1049,11 +1270,12 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index b7db544cee..c630184b36 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createOnlineArchiveOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createOnlineArchiveOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createOnlineArchiveOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createOnlineArchiveOpts) readData() (*admin.BackupOnlineArchiveCreate, error) { +func (opts *createOnlineArchiveOpts) readData(r io.Reader) (*admin.BackupOnlineArchiveCreate, error) { var out *admin.BackupOnlineArchiveCreate var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createOnlineArchiveOpts) readData() (*admin.BackupOnlineArchiveCreat return out, nil } -func (opts *createOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createOnlineArchiveOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createOnlineArchiveBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func createOnlineArchiveBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -136,6 +154,8 @@ type deleteOnlineArchiveOpts struct { groupId string archiveId string clusterName string + format string + tmpl *template.Template } func (opts *deleteOnlineArchiveOpts) preRun() (err error) { @@ -154,10 +174,14 @@ func (opts *deleteOnlineArchiveOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -175,7 +199,17 @@ func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -188,7 +222,7 @@ func deleteOnlineArchiveBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -197,6 +231,7 @@ func deleteOnlineArchiveBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -207,6 +242,8 @@ type downloadOnlineArchiveQueryLogsOpts struct { startDate int64 endDate int64 archiveOnly bool + format string + tmpl *template.Template } func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { @@ -225,10 +262,14 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ GroupId: opts.groupId, @@ -248,7 +289,17 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, w io.Wr return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -261,7 +312,7 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -271,6 +322,7 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.archiveOnly, "archiveOnly", false, `Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -279,6 +331,8 @@ type getOnlineArchiveOpts struct { groupId string archiveId string clusterName string + format string + tmpl *template.Template } func (opts *getOnlineArchiveOpts) preRun() (err error) { @@ -297,10 +351,14 @@ func (opts *getOnlineArchiveOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getOnlineArchiveOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -318,7 +376,17 @@ func (opts *getOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -331,7 +399,7 @@ func getOnlineArchiveBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -340,6 +408,7 @@ func getOnlineArchiveBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -350,6 +419,8 @@ type listOnlineArchivesOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listOnlineArchivesOpts) preRun() (err error) { @@ -368,10 +439,14 @@ func (opts *listOnlineArchivesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listOnlineArchivesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listOnlineArchivesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListOnlineArchivesApiParams{ GroupId: opts.groupId, @@ -391,7 +466,17 @@ func (opts *listOnlineArchivesOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -404,7 +489,7 @@ func listOnlineArchivesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -414,6 +499,7 @@ func listOnlineArchivesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -425,6 +511,8 @@ type updateOnlineArchiveOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateOnlineArchiveOpts) preRun() (err error) { @@ -443,16 +531,20 @@ func (opts *updateOnlineArchiveOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateOnlineArchiveOpts) readData() (*admin.BackupOnlineArchive, error) { +func (opts *updateOnlineArchiveOpts) readData(r io.Reader) (*admin.BackupOnlineArchive, error) { var out *admin.BackupOnlineArchive var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -468,8 +560,8 @@ func (opts *updateOnlineArchiveOpts) readData() (*admin.BackupOnlineArchive, err return out, nil } -func (opts *updateOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateOnlineArchiveOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -492,7 +584,17 @@ func (opts *updateOnlineArchiveOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -507,7 +609,7 @@ func updateOnlineArchiveBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -518,6 +620,7 @@ func updateOnlineArchiveBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("archiveId") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index d7c2429c13..f6a2240b22 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -36,6 +37,8 @@ type createOrganizationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createOrganizationOpts) preRun() (err error) { @@ -43,16 +46,20 @@ func (opts *createOrganizationOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createOrganizationOpts) readData() (*admin.CreateOrganizationRequest, error) { +func (opts *createOrganizationOpts) readData(r io.Reader) (*admin.CreateOrganizationRequest, error) { var out *admin.CreateOrganizationRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -68,8 +75,8 @@ func (opts *createOrganizationOpts) readData() (*admin.CreateOrganizationRequest return out, nil } -func (opts *createOrganizationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createOrganizationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -89,7 +96,17 @@ func (opts *createOrganizationOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -104,12 +121,13 @@ func createOrganizationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -119,6 +137,8 @@ type createOrganizationInvitationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createOrganizationInvitationOpts) preRun() (err error) { @@ -137,16 +157,20 @@ func (opts *createOrganizationInvitationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createOrganizationInvitationOpts) readData() (*admin.OrganizationInvitationRequest, error) { +func (opts *createOrganizationInvitationOpts) readData(r io.Reader) (*admin.OrganizationInvitationRequest, error) { var out *admin.OrganizationInvitationRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -162,8 +186,8 @@ func (opts *createOrganizationInvitationOpts) readData() (*admin.OrganizationInv return out, nil } -func (opts *createOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createOrganizationInvitationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -184,7 +208,17 @@ func (opts *createOrganizationInvitationOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -199,19 +233,22 @@ func createOrganizationInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type deleteOrganizationOpts struct { client *admin.APIClient orgId string + format string + tmpl *template.Template } func (opts *deleteOrganizationOpts) preRun() (err error) { @@ -230,10 +267,14 @@ func (opts *deleteOrganizationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteOrganizationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteOrganizationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, @@ -249,7 +290,17 @@ func (opts *deleteOrganizationOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -262,11 +313,12 @@ func deleteOrganizationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -274,6 +326,8 @@ type deleteOrganizationInvitationOpts struct { client *admin.APIClient orgId string invitationId string + format string + tmpl *template.Template } func (opts *deleteOrganizationInvitationOpts) preRun() (err error) { @@ -292,10 +346,14 @@ func (opts *deleteOrganizationInvitationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -312,7 +370,17 @@ func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -325,19 +393,22 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("invitationId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getOrganizationOpts struct { client *admin.APIClient orgId string + format string + tmpl *template.Template } func (opts *getOrganizationOpts) preRun() (err error) { @@ -356,10 +427,14 @@ func (opts *getOrganizationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getOrganizationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getOrganizationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, @@ -375,7 +450,17 @@ func (opts *getOrganizationOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -388,11 +473,12 @@ func getOrganizationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -400,6 +486,8 @@ type getOrganizationInvitationOpts struct { client *admin.APIClient orgId string invitationId string + format string + tmpl *template.Template } func (opts *getOrganizationInvitationOpts) preRun() (err error) { @@ -418,10 +506,14 @@ func (opts *getOrganizationInvitationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getOrganizationInvitationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetOrganizationInvitationApiParams{ OrgId: opts.orgId, @@ -438,7 +530,17 @@ func (opts *getOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -451,19 +553,22 @@ func getOrganizationInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("invitationId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getOrganizationSettingsOpts struct { client *admin.APIClient orgId string + format string + tmpl *template.Template } func (opts *getOrganizationSettingsOpts) preRun() (err error) { @@ -482,10 +587,14 @@ func (opts *getOrganizationSettingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getOrganizationSettingsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getOrganizationSettingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, @@ -501,7 +610,17 @@ func (opts *getOrganizationSettingsOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -514,11 +633,12 @@ func getOrganizationSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -526,6 +646,8 @@ type listOrganizationInvitationsOpts struct { client *admin.APIClient orgId string username string + format string + tmpl *template.Template } func (opts *listOrganizationInvitationsOpts) preRun() (err error) { @@ -544,10 +666,14 @@ func (opts *listOrganizationInvitationsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListOrganizationInvitationsApiParams{ OrgId: opts.orgId, @@ -564,7 +690,17 @@ func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -577,12 +713,13 @@ func listOrganizationInvitationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -593,6 +730,8 @@ type listOrganizationProjectsOpts struct { itemsPerPage int pageNum int name string + format string + tmpl *template.Template } func (opts *listOrganizationProjectsOpts) preRun() (err error) { @@ -611,10 +750,14 @@ func (opts *listOrganizationProjectsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listOrganizationProjectsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListOrganizationProjectsApiParams{ OrgId: opts.orgId, @@ -634,7 +777,17 @@ func (opts *listOrganizationProjectsOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -647,7 +800,7 @@ func listOrganizationProjectsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -656,6 +809,7 @@ func listOrganizationProjectsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -665,6 +819,8 @@ type listOrganizationUsersOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listOrganizationUsersOpts) preRun() (err error) { @@ -683,10 +839,14 @@ func (opts *listOrganizationUsersOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listOrganizationUsersOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListOrganizationUsersApiParams{ OrgId: opts.orgId, @@ -705,7 +865,17 @@ func (opts *listOrganizationUsersOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -718,7 +888,7 @@ func listOrganizationUsersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -726,6 +896,7 @@ func listOrganizationUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -735,6 +906,8 @@ type listOrganizationsOpts struct { itemsPerPage int pageNum int name string + format string + tmpl *template.Template } func (opts *listOrganizationsOpts) preRun() (err error) { @@ -742,10 +915,14 @@ func (opts *listOrganizationsOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listOrganizationsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListOrganizationsApiParams{ IncludeCount: &opts.includeCount, @@ -764,7 +941,17 @@ func (opts *listOrganizationsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -777,7 +964,7 @@ func listOrganizationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -785,6 +972,7 @@ func listOrganizationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -792,6 +980,8 @@ type removeOrganizationUserOpts struct { client *admin.APIClient orgId string userId string + format string + tmpl *template.Template } func (opts *removeOrganizationUserOpts) preRun() (err error) { @@ -810,10 +1000,14 @@ func (opts *removeOrganizationUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *removeOrganizationUserOpts) run(ctx context.Context, w io.Writer) error { +func (opts *removeOrganizationUserOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.RemoveOrganizationUserApiParams{ OrgId: opts.orgId, @@ -830,7 +1024,17 @@ func (opts *removeOrganizationUserOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -843,13 +1047,14 @@ func removeOrganizationUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies the user to be deleted.`) _ = cmd.MarkFlagRequired("userId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -859,6 +1064,8 @@ type renameOrganizationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *renameOrganizationOpts) preRun() (err error) { @@ -877,16 +1084,20 @@ func (opts *renameOrganizationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *renameOrganizationOpts) readData() (*admin.AtlasOrganization, error) { +func (opts *renameOrganizationOpts) readData(r io.Reader) (*admin.AtlasOrganization, error) { var out *admin.AtlasOrganization var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -902,8 +1113,8 @@ func (opts *renameOrganizationOpts) readData() (*admin.AtlasOrganization, error) return out, nil } -func (opts *renameOrganizationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *renameOrganizationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -924,7 +1135,17 @@ func (opts *renameOrganizationOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -939,13 +1160,14 @@ func renameOrganizationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -955,6 +1177,8 @@ type updateOrganizationInvitationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateOrganizationInvitationOpts) preRun() (err error) { @@ -973,16 +1197,20 @@ func (opts *updateOrganizationInvitationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateOrganizationInvitationOpts) readData() (*admin.OrganizationInvitationRequest, error) { +func (opts *updateOrganizationInvitationOpts) readData(r io.Reader) (*admin.OrganizationInvitationRequest, error) { var out *admin.OrganizationInvitationRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -998,8 +1226,8 @@ func (opts *updateOrganizationInvitationOpts) readData() (*admin.OrganizationInv return out, nil } -func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1020,7 +1248,17 @@ func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1035,13 +1273,14 @@ func updateOrganizationInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1052,6 +1291,8 @@ type updateOrganizationInvitationByIdOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateOrganizationInvitationByIdOpts) preRun() (err error) { @@ -1070,16 +1311,20 @@ func (opts *updateOrganizationInvitationByIdOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateOrganizationInvitationByIdOpts) readData() (*admin.OrganizationInvitationUpdateRequest, error) { +func (opts *updateOrganizationInvitationByIdOpts) readData(r io.Reader) (*admin.OrganizationInvitationUpdateRequest, error) { var out *admin.OrganizationInvitationUpdateRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1095,8 +1340,8 @@ func (opts *updateOrganizationInvitationByIdOpts) readData() (*admin.Organizatio return out, nil } -func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1118,7 +1363,17 @@ func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, w io. return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1133,7 +1388,7 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1142,6 +1397,7 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("invitationId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1152,6 +1408,8 @@ type updateOrganizationRolesOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateOrganizationRolesOpts) preRun() (err error) { @@ -1170,16 +1428,20 @@ func (opts *updateOrganizationRolesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateOrganizationRolesOpts) readData() (*admin.UpdateOrgRolesForUser, error) { +func (opts *updateOrganizationRolesOpts) readData(r io.Reader) (*admin.UpdateOrgRolesForUser, error) { var out *admin.UpdateOrgRolesForUser var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1195,8 +1457,8 @@ func (opts *updateOrganizationRolesOpts) readData() (*admin.UpdateOrgRolesForUse return out, nil } -func (opts *updateOrganizationRolesOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateOrganizationRolesOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1218,7 +1480,17 @@ func (opts *updateOrganizationRolesOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1233,7 +1505,7 @@ func updateOrganizationRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1242,6 +1514,7 @@ func updateOrganizationRolesBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("userId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1251,6 +1524,8 @@ type updateOrganizationSettingsOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateOrganizationSettingsOpts) preRun() (err error) { @@ -1269,16 +1544,20 @@ func (opts *updateOrganizationSettingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateOrganizationSettingsOpts) readData() (*admin.OrganizationSettings, error) { +func (opts *updateOrganizationSettingsOpts) readData(r io.Reader) (*admin.OrganizationSettings, error) { var out *admin.OrganizationSettings var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1294,8 +1573,8 @@ func (opts *updateOrganizationSettingsOpts) readData() (*admin.OrganizationSetti return out, nil } -func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1316,7 +1595,17 @@ func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, w io.Writer return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1331,13 +1620,14 @@ func updateOrganizationSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index d53a592146..859ed737ab 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -23,6 +23,8 @@ import ( "errors" "fmt" "io" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/cobra" @@ -50,10 +52,10 @@ func (opts *disableSlowOperationThresholdingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *disableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *disableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, @@ -72,7 +74,7 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -101,10 +103,10 @@ func (opts *enableSlowOperationThresholdingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *enableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *enableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, @@ -123,7 +125,7 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -139,6 +141,8 @@ type listSlowQueriesOpts struct { namespaces []string nLogs int64 since int64 + format string + tmpl *template.Template } func (opts *listSlowQueriesOpts) preRun() (err error) { @@ -157,10 +161,14 @@ func (opts *listSlowQueriesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listSlowQueriesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listSlowQueriesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListSlowQueriesApiParams{ GroupId: opts.groupId, @@ -181,7 +189,17 @@ func (opts *listSlowQueriesOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -194,7 +212,7 @@ func listSlowQueriesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -211,6 +229,7 @@ func listSlowQueriesBuilder() *cobra.Command { - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -220,6 +239,8 @@ type listSlowQueryNamespacesOpts struct { processId string duration int64 since int64 + format string + tmpl *template.Template } func (opts *listSlowQueryNamespacesOpts) preRun() (err error) { @@ -238,10 +259,14 @@ func (opts *listSlowQueryNamespacesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListSlowQueryNamespacesApiParams{ GroupId: opts.groupId, @@ -260,7 +285,17 @@ func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -273,7 +308,7 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -288,6 +323,7 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -303,6 +339,8 @@ type listSuggestedIndexesOpts struct { nExamples int64 nIndexes int64 since int64 + format string + tmpl *template.Template } func (opts *listSuggestedIndexesOpts) preRun() (err error) { @@ -321,10 +359,14 @@ func (opts *listSuggestedIndexesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listSuggestedIndexesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listSuggestedIndexesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListSuggestedIndexesApiParams{ GroupId: opts.groupId, @@ -349,7 +391,17 @@ func (opts *listSuggestedIndexesOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -362,7 +414,7 @@ func listSuggestedIndexesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -383,6 +435,7 @@ func listSuggestedIndexesBuilder() *cobra.Command { - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index f6c68aa2ac..577caee161 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -39,6 +40,8 @@ type createPrivateEndpointOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createPrivateEndpointOpts) preRun() (err error) { @@ -57,16 +60,20 @@ func (opts *createPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createPrivateEndpointOpts) readData() (*admin.CreateEndpointRequest, error) { +func (opts *createPrivateEndpointOpts) readData(r io.Reader) (*admin.CreateEndpointRequest, error) { var out *admin.CreateEndpointRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -82,8 +89,8 @@ func (opts *createPrivateEndpointOpts) readData() (*admin.CreateEndpointRequest, return out, nil } -func (opts *createPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -106,7 +113,17 @@ func (opts *createPrivateEndpointOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -121,7 +138,7 @@ func createPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -132,6 +149,7 @@ func createPrivateEndpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -141,6 +159,8 @@ type createPrivateEndpointServiceOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createPrivateEndpointServiceOpts) preRun() (err error) { @@ -159,16 +179,20 @@ func (opts *createPrivateEndpointServiceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createPrivateEndpointServiceOpts) readData() (*admin.CloudProviderEndpointServiceRequest, error) { +func (opts *createPrivateEndpointServiceOpts) readData(r io.Reader) (*admin.CloudProviderEndpointServiceRequest, error) { var out *admin.CloudProviderEndpointServiceRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -184,8 +208,8 @@ func (opts *createPrivateEndpointServiceOpts) readData() (*admin.CloudProviderEn return out, nil } -func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -206,7 +230,17 @@ func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -221,13 +255,14 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -237,6 +272,8 @@ type deletePrivateEndpointOpts struct { cloudProvider string endpointId string endpointServiceId string + format string + tmpl *template.Template } func (opts *deletePrivateEndpointOpts) preRun() (err error) { @@ -255,10 +292,14 @@ func (opts *deletePrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deletePrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deletePrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeletePrivateEndpointApiParams{ GroupId: opts.groupId, @@ -277,7 +318,17 @@ func (opts *deletePrivateEndpointOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -290,7 +341,7 @@ func deletePrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -301,6 +352,7 @@ func deletePrivateEndpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") _ = cmd.MarkFlagRequired("endpointServiceId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -309,6 +361,8 @@ type deletePrivateEndpointServiceOpts struct { groupId string cloudProvider string endpointServiceId string + format string + tmpl *template.Template } func (opts *deletePrivateEndpointServiceOpts) preRun() (err error) { @@ -327,10 +381,14 @@ func (opts *deletePrivateEndpointServiceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeletePrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -348,7 +406,17 @@ func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -361,7 +429,7 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -370,6 +438,7 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -379,6 +448,8 @@ type getPrivateEndpointOpts struct { cloudProvider string endpointId string endpointServiceId string + format string + tmpl *template.Template } func (opts *getPrivateEndpointOpts) preRun() (err error) { @@ -397,10 +468,14 @@ func (opts *getPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -419,7 +494,17 @@ func (opts *getPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -432,7 +517,7 @@ func getPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -443,6 +528,7 @@ func getPrivateEndpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointId") _ = cmd.MarkFlagRequired("endpointServiceId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -451,6 +537,8 @@ type getPrivateEndpointServiceOpts struct { groupId string cloudProvider string endpointServiceId string + format string + tmpl *template.Template } func (opts *getPrivateEndpointServiceOpts) preRun() (err error) { @@ -469,10 +557,14 @@ func (opts *getPrivateEndpointServiceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetPrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -490,7 +582,17 @@ func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -503,7 +605,7 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -512,12 +614,15 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("cloudProvider") _ = cmd.MarkFlagRequired("endpointServiceId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getRegionalizedPrivateEndpointSettingOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { @@ -536,10 +641,14 @@ func (opts *getRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, @@ -555,7 +664,17 @@ func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -568,11 +687,12 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -580,6 +700,8 @@ type listPrivateEndpointServicesOpts struct { client *admin.APIClient groupId string cloudProvider string + format string + tmpl *template.Template } func (opts *listPrivateEndpointServicesOpts) preRun() (err error) { @@ -598,10 +720,14 @@ func (opts *listPrivateEndpointServicesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListPrivateEndpointServicesApiParams{ GroupId: opts.groupId, @@ -618,7 +744,17 @@ func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -631,13 +767,14 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.cloudProvider, "cloudProvider", ""AWS"", `Cloud service provider that manages this private endpoint service.`) _ = cmd.MarkFlagRequired("cloudProvider") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -647,6 +784,8 @@ type toggleRegionalizedPrivateEndpointSettingOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *toggleRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { @@ -665,16 +804,20 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData() (*admin.ProjectSettingItem, error) { +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData(r io.Reader) (*admin.ProjectSettingItem, error) { var out *admin.ProjectSettingItem var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -690,8 +833,8 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData() (*admin.Pro return out, nil } -func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -712,7 +855,17 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Contex return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -727,13 +880,14 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index 548c6c240d..c868c56918 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type addProjectApiKeyOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *addProjectApiKeyOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *addProjectApiKeyOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *addProjectApiKeyOpts) readData() (*[]admin.UserAccessRoleAssignment, error) { +func (opts *addProjectApiKeyOpts) readData(r io.Reader) (*[]admin.UserAccessRoleAssignment, error) { var out *[]admin.UserAccessRoleAssignment var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *addProjectApiKeyOpts) readData() (*[]admin.UserAccessRoleAssignment, return out, nil } -func (opts *addProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *addProjectApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *addProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func addProjectApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func addProjectApiKeyBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -137,6 +155,8 @@ type createApiKeyOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createApiKeyOpts) preRun() (err error) { @@ -155,16 +175,20 @@ func (opts *createApiKeyOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createApiKeyOpts) readData() (*admin.CreateAtlasOrganizationApiKey, error) { +func (opts *createApiKeyOpts) readData(r io.Reader) (*admin.CreateAtlasOrganizationApiKey, error) { var out *admin.CreateAtlasOrganizationApiKey var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -180,8 +204,8 @@ func (opts *createApiKeyOpts) readData() (*admin.CreateAtlasOrganizationApiKey, return out, nil } -func (opts *createApiKeyOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -202,7 +226,17 @@ func (opts *createApiKeyOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -217,13 +251,14 @@ func createApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -237,6 +272,8 @@ type createApiKeyAccessListOpts struct { pageNum int filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createApiKeyAccessListOpts) preRun() (err error) { @@ -255,16 +292,20 @@ func (opts *createApiKeyAccessListOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createApiKeyAccessListOpts) readData() (*[]admin.UserAccessList, error) { +func (opts *createApiKeyAccessListOpts) readData(r io.Reader) (*[]admin.UserAccessList, error) { var out *[]admin.UserAccessList var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -280,8 +321,8 @@ func (opts *createApiKeyAccessListOpts) readData() (*[]admin.UserAccessList, err return out, nil } -func (opts *createApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createApiKeyAccessListOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -307,7 +348,17 @@ func (opts *createApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -322,7 +373,7 @@ func createApiKeyAccessListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -334,6 +385,7 @@ func createApiKeyAccessListBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -343,6 +395,8 @@ type createProjectApiKeyOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createProjectApiKeyOpts) preRun() (err error) { @@ -361,16 +415,20 @@ func (opts *createProjectApiKeyOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createProjectApiKeyOpts) readData() (*admin.CreateAtlasProjectApiKey, error) { +func (opts *createProjectApiKeyOpts) readData(r io.Reader) (*admin.CreateAtlasProjectApiKey, error) { var out *admin.CreateAtlasProjectApiKey var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -386,8 +444,8 @@ func (opts *createProjectApiKeyOpts) readData() (*admin.CreateAtlasProjectApiKey return out, nil } -func (opts *createProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createProjectApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -408,7 +466,17 @@ func (opts *createProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -423,13 +491,14 @@ func createProjectApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -437,6 +506,8 @@ type deleteApiKeyOpts struct { client *admin.APIClient orgId string apiUserId string + format string + tmpl *template.Template } func (opts *deleteApiKeyOpts) preRun() (err error) { @@ -455,10 +526,14 @@ func (opts *deleteApiKeyOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteApiKeyOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteApiKeyOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteApiKeyApiParams{ OrgId: opts.orgId, @@ -475,7 +550,17 @@ func (opts *deleteApiKeyOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -488,13 +573,14 @@ func deleteApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key.`) _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -503,6 +589,8 @@ type deleteApiKeyAccessListEntryOpts struct { orgId string apiUserId string ipAddress string + format string + tmpl *template.Template } func (opts *deleteApiKeyAccessListEntryOpts) preRun() (err error) { @@ -521,10 +609,14 @@ func (opts *deleteApiKeyAccessListEntryOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteApiKeyAccessListEntryApiParams{ OrgId: opts.orgId, @@ -542,7 +634,17 @@ func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -555,7 +657,7 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -564,6 +666,7 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("apiUserId") _ = cmd.MarkFlagRequired("ipAddress") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -571,6 +674,8 @@ type getApiKeyOpts struct { client *admin.APIClient orgId string apiUserId string + format string + tmpl *template.Template } func (opts *getApiKeyOpts) preRun() (err error) { @@ -589,10 +694,14 @@ func (opts *getApiKeyOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getApiKeyOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getApiKeyOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetApiKeyApiParams{ OrgId: opts.orgId, @@ -609,7 +718,17 @@ func (opts *getApiKeyOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -622,13 +741,14 @@ func getApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to update.`) _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -637,6 +757,8 @@ type getApiKeyAccessListOpts struct { orgId string ipAddress string apiUserId string + format string + tmpl *template.Template } func (opts *getApiKeyAccessListOpts) preRun() (err error) { @@ -655,10 +777,14 @@ func (opts *getApiKeyAccessListOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getApiKeyAccessListOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetApiKeyAccessListApiParams{ OrgId: opts.orgId, @@ -676,7 +802,17 @@ func (opts *getApiKeyAccessListOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -689,7 +825,7 @@ func getApiKeyAccessListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -698,6 +834,7 @@ func getApiKeyAccessListBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("ipAddress") _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -708,6 +845,8 @@ type listApiKeyAccessListsEntriesOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { @@ -726,10 +865,14 @@ func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListApiKeyAccessListsEntriesApiParams{ OrgId: opts.orgId, @@ -749,7 +892,17 @@ func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -762,7 +915,7 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -772,6 +925,7 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -781,6 +935,8 @@ type listApiKeysOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listApiKeysOpts) preRun() (err error) { @@ -799,10 +955,14 @@ func (opts *listApiKeysOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listApiKeysOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listApiKeysOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListApiKeysApiParams{ OrgId: opts.orgId, @@ -821,7 +981,17 @@ func (opts *listApiKeysOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -834,7 +1004,7 @@ func listApiKeysBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -842,6 +1012,7 @@ func listApiKeysBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -851,6 +1022,8 @@ type listProjectApiKeysOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listProjectApiKeysOpts) preRun() (err error) { @@ -869,10 +1042,14 @@ func (opts *listProjectApiKeysOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listProjectApiKeysOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listProjectApiKeysOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListProjectApiKeysApiParams{ GroupId: opts.groupId, @@ -891,7 +1068,17 @@ func (opts *listProjectApiKeysOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -904,7 +1091,7 @@ func listProjectApiKeysBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -912,6 +1099,7 @@ func listProjectApiKeysBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -919,6 +1107,8 @@ type removeProjectApiKeyOpts struct { client *admin.APIClient groupId string apiUserId string + format string + tmpl *template.Template } func (opts *removeProjectApiKeyOpts) preRun() (err error) { @@ -937,10 +1127,14 @@ func (opts *removeProjectApiKeyOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *removeProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error { +func (opts *removeProjectApiKeyOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.RemoveProjectApiKeyApiParams{ GroupId: opts.groupId, @@ -957,7 +1151,17 @@ func (opts *removeProjectApiKeyOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -970,13 +1174,14 @@ func removeProjectApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.apiUserId, "apiUserId", "", `Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project.`) _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -987,6 +1192,8 @@ type updateApiKeyOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateApiKeyOpts) preRun() (err error) { @@ -1005,16 +1212,20 @@ func (opts *updateApiKeyOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateApiKeyOpts) readData() (*admin.UpdateAtlasOrganizationApiKey, error) { +func (opts *updateApiKeyOpts) readData(r io.Reader) (*admin.UpdateAtlasOrganizationApiKey, error) { var out *admin.UpdateAtlasOrganizationApiKey var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1030,8 +1241,8 @@ func (opts *updateApiKeyOpts) readData() (*admin.UpdateAtlasOrganizationApiKey, return out, nil } -func (opts *updateApiKeyOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1053,7 +1264,17 @@ func (opts *updateApiKeyOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1068,7 +1289,7 @@ func updateApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1077,6 +1298,7 @@ func updateApiKeyBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1090,6 +1312,8 @@ type updateApiKeyRolesOpts struct { includeCount bool filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateApiKeyRolesOpts) preRun() (err error) { @@ -1108,16 +1332,20 @@ func (opts *updateApiKeyRolesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateApiKeyRolesOpts) readData() (*admin.UpdateAtlasProjectApiKey, error) { +func (opts *updateApiKeyRolesOpts) readData(r io.Reader) (*admin.UpdateAtlasProjectApiKey, error) { var out *admin.UpdateAtlasProjectApiKey var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1133,8 +1361,8 @@ func (opts *updateApiKeyRolesOpts) readData() (*admin.UpdateAtlasProjectApiKey, return out, nil } -func (opts *updateApiKeyRolesOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateApiKeyRolesOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1160,7 +1388,17 @@ func (opts *updateApiKeyRolesOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1175,7 +1413,7 @@ func updateApiKeyRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1187,6 +1425,7 @@ func updateApiKeyRolesBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("apiUserId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 7b71b7ea61..808685abbf 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -40,6 +41,8 @@ type createProjectIpAccessListOpts struct { pageNum int filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createProjectIpAccessListOpts) preRun() (err error) { @@ -58,16 +61,20 @@ func (opts *createProjectIpAccessListOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createProjectIpAccessListOpts) readData() (*[]admin.NetworkPermissionEntry, error) { +func (opts *createProjectIpAccessListOpts) readData(r io.Reader) (*[]admin.NetworkPermissionEntry, error) { var out *[]admin.NetworkPermissionEntry var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -83,8 +90,8 @@ func (opts *createProjectIpAccessListOpts) readData() (*[]admin.NetworkPermissio return out, nil } -func (opts *createProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createProjectIpAccessListOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -109,7 +116,17 @@ func (opts *createProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -124,7 +141,7 @@ func createProjectIpAccessListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -134,6 +151,7 @@ func createProjectIpAccessListBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -141,6 +159,8 @@ type deleteProjectIpAccessListOpts struct { client *admin.APIClient groupId string entryValue string + format string + tmpl *template.Template } func (opts *deleteProjectIpAccessListOpts) preRun() (err error) { @@ -159,10 +179,14 @@ func (opts *deleteProjectIpAccessListOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteProjectIpAccessListApiParams{ GroupId: opts.groupId, @@ -179,7 +203,17 @@ func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -192,7 +226,7 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -203,6 +237,7 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { - which protocol (like TCP or UDP) the connection uses.`) _ = cmd.MarkFlagRequired("entryValue") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -210,6 +245,8 @@ type getProjectIpAccessListStatusOpts struct { client *admin.APIClient groupId string entryValue string + format string + tmpl *template.Template } func (opts *getProjectIpAccessListStatusOpts) preRun() (err error) { @@ -228,10 +265,14 @@ func (opts *getProjectIpAccessListStatusOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetProjectIpAccessListStatusApiParams{ GroupId: opts.groupId, @@ -248,7 +289,17 @@ func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -261,13 +312,14 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Network address or cloud provider security construct that identifies which project access list entry to be verified.`) _ = cmd.MarkFlagRequired("entryValue") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -275,6 +327,8 @@ type getProjectIpListOpts struct { client *admin.APIClient groupId string entryValue string + format string + tmpl *template.Template } func (opts *getProjectIpListOpts) preRun() (err error) { @@ -293,10 +347,14 @@ func (opts *getProjectIpListOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getProjectIpListOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getProjectIpListOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetProjectIpListApiParams{ GroupId: opts.groupId, @@ -313,7 +371,17 @@ func (opts *getProjectIpListOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -326,13 +394,14 @@ func getProjectIpListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.entryValue, "entryValue", "", `Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`).`) _ = cmd.MarkFlagRequired("entryValue") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -342,6 +411,8 @@ type listProjectIpAccessListsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listProjectIpAccessListsOpts) preRun() (err error) { @@ -360,10 +431,14 @@ func (opts *listProjectIpAccessListsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListProjectIpAccessListsApiParams{ GroupId: opts.groupId, @@ -382,7 +457,17 @@ func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -395,7 +480,7 @@ func listProjectIpAccessListsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -403,6 +488,7 @@ func listProjectIpAccessListsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 78690384c3..b05d4873f8 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createProjectOpts struct { projectOwnerId string filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createProjectOpts) preRun() (err error) { @@ -44,16 +47,20 @@ func (opts *createProjectOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createProjectOpts) readData() (*admin.Group, error) { +func (opts *createProjectOpts) readData(r io.Reader) (*admin.Group, error) { var out *admin.Group var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -69,8 +76,8 @@ func (opts *createProjectOpts) readData() (*admin.Group, error) { return out, nil } -func (opts *createProjectOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createProjectOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -92,7 +99,17 @@ func (opts *createProjectOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -107,13 +124,14 @@ func createProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.projectOwnerId, "projectOwnerId", "", `Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -123,6 +141,8 @@ type createProjectInvitationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createProjectInvitationOpts) preRun() (err error) { @@ -141,16 +161,20 @@ func (opts *createProjectInvitationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createProjectInvitationOpts) readData() (*admin.GroupInvitationRequest, error) { +func (opts *createProjectInvitationOpts) readData(r io.Reader) (*admin.GroupInvitationRequest, error) { var out *admin.GroupInvitationRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -166,8 +190,8 @@ func (opts *createProjectInvitationOpts) readData() (*admin.GroupInvitationReque return out, nil } -func (opts *createProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createProjectInvitationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -188,7 +212,17 @@ func (opts *createProjectInvitationOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -203,19 +237,22 @@ func createProjectInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type deleteProjectOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *deleteProjectOpts) preRun() (err error) { @@ -234,10 +271,14 @@ func (opts *deleteProjectOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteProjectOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteProjectOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, @@ -253,7 +294,17 @@ func (opts *deleteProjectOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -266,11 +317,12 @@ func deleteProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -278,6 +330,8 @@ type deleteProjectInvitationOpts struct { client *admin.APIClient groupId string invitationId string + format string + tmpl *template.Template } func (opts *deleteProjectInvitationOpts) preRun() (err error) { @@ -296,10 +350,14 @@ func (opts *deleteProjectInvitationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteProjectInvitationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteProjectInvitationApiParams{ GroupId: opts.groupId, @@ -316,7 +374,17 @@ func (opts *deleteProjectInvitationOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -329,13 +397,14 @@ func deleteProjectInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("invitationId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -343,6 +412,8 @@ type deleteProjectLimitOpts struct { client *admin.APIClient limitName string groupId string + format string + tmpl *template.Template } func (opts *deleteProjectLimitOpts) preRun() (err error) { @@ -361,10 +432,14 @@ func (opts *deleteProjectLimitOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteProjectLimitOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteProjectLimitOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteProjectLimitApiParams{ LimitName: opts.limitName, @@ -381,7 +456,17 @@ func (opts *deleteProjectLimitOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -394,7 +479,7 @@ func deleteProjectLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -417,12 +502,15 @@ func deleteProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("limitName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getProjectOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getProjectOpts) preRun() (err error) { @@ -441,10 +529,14 @@ func (opts *getProjectOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getProjectOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getProjectOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetProjectApiParams{ GroupId: opts.groupId, @@ -460,7 +552,17 @@ func (opts *getProjectOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -473,17 +575,20 @@ func getProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getProjectByNameOpts struct { client *admin.APIClient groupName string + format string + tmpl *template.Template } func (opts *getProjectByNameOpts) preRun() (err error) { @@ -491,10 +596,14 @@ func (opts *getProjectByNameOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getProjectByNameOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getProjectByNameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetProjectByNameApiParams{ GroupName: opts.groupName, @@ -510,7 +619,17 @@ func (opts *getProjectByNameOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -523,12 +642,13 @@ func getProjectByNameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupName, "groupName", "", `Human-readable label that identifies this project.`) _ = cmd.MarkFlagRequired("groupName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -536,6 +656,8 @@ type getProjectInvitationOpts struct { client *admin.APIClient groupId string invitationId string + format string + tmpl *template.Template } func (opts *getProjectInvitationOpts) preRun() (err error) { @@ -554,10 +676,14 @@ func (opts *getProjectInvitationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getProjectInvitationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetProjectInvitationApiParams{ GroupId: opts.groupId, @@ -574,7 +700,17 @@ func (opts *getProjectInvitationOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -587,13 +723,14 @@ func getProjectInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.invitationId, "invitationId", "", `Unique 24-hexadecimal digit string that identifies the invitation.`) _ = cmd.MarkFlagRequired("invitationId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -601,6 +738,8 @@ type getProjectLimitOpts struct { client *admin.APIClient limitName string groupId string + format string + tmpl *template.Template } func (opts *getProjectLimitOpts) preRun() (err error) { @@ -619,10 +758,14 @@ func (opts *getProjectLimitOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getProjectLimitOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getProjectLimitOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetProjectLimitApiParams{ LimitName: opts.limitName, @@ -639,7 +782,17 @@ func (opts *getProjectLimitOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -652,7 +805,7 @@ func getProjectLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -675,12 +828,15 @@ func getProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("limitName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type getProjectSettingsOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getProjectSettingsOpts) preRun() (err error) { @@ -699,10 +855,14 @@ func (opts *getProjectSettingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getProjectSettingsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getProjectSettingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, @@ -718,7 +878,17 @@ func (opts *getProjectSettingsOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -731,11 +901,12 @@ func getProjectSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -743,6 +914,8 @@ type listProjectInvitationsOpts struct { client *admin.APIClient groupId string username string + format string + tmpl *template.Template } func (opts *listProjectInvitationsOpts) preRun() (err error) { @@ -761,10 +934,14 @@ func (opts *listProjectInvitationsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listProjectInvitationsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listProjectInvitationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListProjectInvitationsApiParams{ GroupId: opts.groupId, @@ -781,7 +958,17 @@ func (opts *listProjectInvitationsOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -794,18 +981,21 @@ func listProjectInvitationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.username, "username", "", `Email address of the user account invited to this project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type listProjectLimitsOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *listProjectLimitsOpts) preRun() (err error) { @@ -824,10 +1014,14 @@ func (opts *listProjectLimitsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listProjectLimitsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listProjectLimitsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, @@ -843,7 +1037,17 @@ func (opts *listProjectLimitsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -856,11 +1060,12 @@ func listProjectLimitsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -872,6 +1077,8 @@ type listProjectUsersOpts struct { pageNum int flattenTeams bool includeOrgUsers bool + format string + tmpl *template.Template } func (opts *listProjectUsersOpts) preRun() (err error) { @@ -890,10 +1097,14 @@ func (opts *listProjectUsersOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listProjectUsersOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listProjectUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListProjectUsersApiParams{ GroupId: opts.groupId, @@ -914,7 +1125,17 @@ func (opts *listProjectUsersOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -927,7 +1148,7 @@ func listProjectUsersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -937,6 +1158,7 @@ func listProjectUsersBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.flattenTeams, "flattenTeams", false, `Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `"flattenTeams" : false`, this resource returns only users with a role in the project. If `"flattenTeams" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project.`) cmd.Flags().BoolVar(&opts.includeOrgUsers, "includeOrgUsers", false, `Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `"includeOrgUsers": false`, this resource returns only users with a role in the project. If `"includeOrgUsers": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -945,6 +1167,8 @@ type listProjectsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listProjectsOpts) preRun() (err error) { @@ -952,10 +1176,14 @@ func (opts *listProjectsOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listProjectsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListProjectsApiParams{ IncludeCount: &opts.includeCount, @@ -973,7 +1201,17 @@ func (opts *listProjectsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -986,13 +1224,14 @@ func listProjectsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1018,10 +1257,10 @@ func (opts *removeProjectUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *removeProjectUserOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *removeProjectUserOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.RemoveProjectUserApiParams{ GroupId: opts.groupId, @@ -1041,7 +1280,7 @@ func removeProjectUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1058,6 +1297,8 @@ type setProjectLimitOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *setProjectLimitOpts) preRun() (err error) { @@ -1076,16 +1317,20 @@ func (opts *setProjectLimitOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *setProjectLimitOpts) readData() (*admin.DataFederationLimit, error) { +func (opts *setProjectLimitOpts) readData(r io.Reader) (*admin.DataFederationLimit, error) { var out *admin.DataFederationLimit var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1101,8 +1346,8 @@ func (opts *setProjectLimitOpts) readData() (*admin.DataFederationLimit, error) return out, nil } -func (opts *setProjectLimitOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *setProjectLimitOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1124,7 +1369,17 @@ func (opts *setProjectLimitOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1139,7 +1394,7 @@ func setProjectLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -1164,6 +1419,7 @@ func setProjectLimitBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("limitName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1173,6 +1429,8 @@ type updateProjectOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateProjectOpts) preRun() (err error) { @@ -1191,16 +1449,20 @@ func (opts *updateProjectOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateProjectOpts) readData() (*admin.GroupName, error) { +func (opts *updateProjectOpts) readData(r io.Reader) (*admin.GroupName, error) { var out *admin.GroupName var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1216,8 +1478,8 @@ func (opts *updateProjectOpts) readData() (*admin.GroupName, error) { return out, nil } -func (opts *updateProjectOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateProjectOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1238,7 +1500,17 @@ func (opts *updateProjectOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1253,13 +1525,14 @@ func updateProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1269,6 +1542,8 @@ type updateProjectInvitationOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateProjectInvitationOpts) preRun() (err error) { @@ -1287,16 +1562,20 @@ func (opts *updateProjectInvitationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateProjectInvitationOpts) readData() (*admin.GroupInvitationRequest, error) { +func (opts *updateProjectInvitationOpts) readData(r io.Reader) (*admin.GroupInvitationRequest, error) { var out *admin.GroupInvitationRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1312,8 +1591,8 @@ func (opts *updateProjectInvitationOpts) readData() (*admin.GroupInvitationReque return out, nil } -func (opts *updateProjectInvitationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateProjectInvitationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1334,7 +1613,17 @@ func (opts *updateProjectInvitationOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1349,13 +1638,14 @@ func updateProjectInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1366,6 +1656,8 @@ type updateProjectInvitationByIdOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateProjectInvitationByIdOpts) preRun() (err error) { @@ -1384,16 +1676,20 @@ func (opts *updateProjectInvitationByIdOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateProjectInvitationByIdOpts) readData() (*admin.GroupInvitationUpdateRequest, error) { +func (opts *updateProjectInvitationByIdOpts) readData(r io.Reader) (*admin.GroupInvitationUpdateRequest, error) { var out *admin.GroupInvitationUpdateRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1409,8 +1705,8 @@ func (opts *updateProjectInvitationByIdOpts) readData() (*admin.GroupInvitationU return out, nil } -func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1432,7 +1728,17 @@ func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1447,7 +1753,7 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1456,6 +1762,7 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("invitationId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1466,6 +1773,8 @@ type updateProjectRolesOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateProjectRolesOpts) preRun() (err error) { @@ -1484,16 +1793,20 @@ func (opts *updateProjectRolesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateProjectRolesOpts) readData() (*admin.UpdateGroupRolesForUser, error) { +func (opts *updateProjectRolesOpts) readData(r io.Reader) (*admin.UpdateGroupRolesForUser, error) { var out *admin.UpdateGroupRolesForUser var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1509,8 +1822,8 @@ func (opts *updateProjectRolesOpts) readData() (*admin.UpdateGroupRolesForUser, return out, nil } -func (opts *updateProjectRolesOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateProjectRolesOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1532,7 +1845,17 @@ func (opts *updateProjectRolesOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1547,7 +1870,7 @@ func updateProjectRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1556,6 +1879,7 @@ func updateProjectRolesBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("userId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -1565,6 +1889,8 @@ type updateProjectSettingsOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateProjectSettingsOpts) preRun() (err error) { @@ -1583,16 +1909,20 @@ func (opts *updateProjectSettingsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateProjectSettingsOpts) readData() (*admin.GroupSettings, error) { +func (opts *updateProjectSettingsOpts) readData(r io.Reader) (*admin.GroupSettings, error) { var out *admin.GroupSettings var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -1608,8 +1938,8 @@ func (opts *updateProjectSettingsOpts) readData() (*admin.GroupSettings, error) return out, nil } -func (opts *updateProjectSettingsOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateProjectSettingsOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1630,7 +1960,17 @@ func (opts *updateProjectSettingsOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1645,13 +1985,14 @@ func updateProjectSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index 2f0264eea8..dc6e45900d 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -55,16 +56,16 @@ func (opts *createPushBasedLogConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *createPushBasedLogConfigurationOpts) readData() (*admin.PushBasedLogExportProject, error) { +func (opts *createPushBasedLogConfigurationOpts) readData(r io.Reader) (*admin.PushBasedLogExportProject, error) { var out *admin.PushBasedLogExportProject var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +81,8 @@ func (opts *createPushBasedLogConfigurationOpts) readData() (*admin.PushBasedLog return out, nil } -func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { - data, errData := opts.readData() +func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, r io.Reader, _ io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -107,7 +108,7 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -138,10 +139,10 @@ func (opts *deletePushBasedLogConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *deletePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *deletePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.DeletePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -160,7 +161,7 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -171,6 +172,8 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { type getPushBasedLogConfigurationOpts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *getPushBasedLogConfigurationOpts) preRun() (err error) { @@ -189,10 +192,14 @@ func (opts *getPushBasedLogConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetPushBasedLogConfigurationApiParams{ GroupId: opts.groupId, @@ -208,7 +215,17 @@ func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -221,11 +238,12 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -253,16 +271,16 @@ func (opts *updatePushBasedLogConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *updatePushBasedLogConfigurationOpts) readData() (*admin.PushBasedLogExportProject, error) { +func (opts *updatePushBasedLogConfigurationOpts) readData(r io.Reader) (*admin.PushBasedLogExportProject, error) { var out *admin.PushBasedLogExportProject var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -278,8 +296,8 @@ func (opts *updatePushBasedLogConfigurationOpts) readData() (*admin.PushBasedLog return out, nil } -func (opts *updatePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Writer) error { - data, errData := opts.readData() +func (opts *updatePushBasedLogConfigurationOpts) run(ctx context.Context, r io.Reader, _ io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -305,7 +323,7 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 8711dfafa9..5d0ee4e5db 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -23,7 +23,6 @@ import ( "errors" "fmt" "io" - "os" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -56,16 +55,16 @@ func (opts *createRollingIndexOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *createRollingIndexOpts) readData() (*admin.DatabaseRollingIndexRequest, error) { +func (opts *createRollingIndexOpts) readData(r io.Reader) (*admin.DatabaseRollingIndexRequest, error) { var out *admin.DatabaseRollingIndexRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +80,8 @@ func (opts *createRollingIndexOpts) readData() (*admin.DatabaseRollingIndexReque return out, nil } -func (opts *createRollingIndexOpts) run(ctx context.Context, _ io.Writer) error { - data, errData := opts.readData() +func (opts *createRollingIndexOpts) run(ctx context.Context, r io.Reader, _ io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -109,7 +108,7 @@ func createRollingIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index 967cf25f32..a0d76e3f0d 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -21,6 +21,8 @@ import ( "encoding/json" "fmt" "io" + "strings" + "text/template" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -28,6 +30,8 @@ import ( type getSystemStatusOpts struct { client *admin.APIClient + format string + tmpl *template.Template } func (opts *getSystemStatusOpts) preRun() (err error) { @@ -35,10 +39,14 @@ func (opts *getSystemStatusOpts) preRun() (err error) { return err } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getSystemStatusOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getSystemStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetSystemStatusApiParams{} @@ -52,7 +60,17 @@ func (opts *getSystemStatusOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -65,10 +83,11 @@ func getSystemStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index 8538d448c7..9e67aa3312 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type createServerlessInstanceOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createServerlessInstanceOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *createServerlessInstanceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createServerlessInstanceOpts) readData() (*admin.ServerlessInstanceDescriptionCreate, error) { +func (opts *createServerlessInstanceOpts) readData(r io.Reader) (*admin.ServerlessInstanceDescriptionCreate, error) { var out *admin.ServerlessInstanceDescriptionCreate var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *createServerlessInstanceOpts) readData() (*admin.ServerlessInstanceD return out, nil } -func (opts *createServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createServerlessInstanceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *createServerlessInstanceOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func createServerlessInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -131,6 +149,8 @@ type deleteServerlessInstanceOpts struct { client *admin.APIClient groupId string name string + format string + tmpl *template.Template } func (opts *deleteServerlessInstanceOpts) preRun() (err error) { @@ -149,10 +169,14 @@ func (opts *deleteServerlessInstanceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -169,7 +193,17 @@ func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -182,13 +216,14 @@ func deleteServerlessInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("name") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -196,6 +231,8 @@ type getServerlessInstanceOpts struct { client *admin.APIClient groupId string name string + format string + tmpl *template.Template } func (opts *getServerlessInstanceOpts) preRun() (err error) { @@ -214,10 +251,14 @@ func (opts *getServerlessInstanceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getServerlessInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, @@ -234,7 +275,17 @@ func (opts *getServerlessInstanceOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -247,13 +298,14 @@ func getServerlessInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.name, "name", "", `Human-readable label that identifies the serverless instance.`) _ = cmd.MarkFlagRequired("name") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -263,6 +315,8 @@ type listServerlessInstancesOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listServerlessInstancesOpts) preRun() (err error) { @@ -281,10 +335,14 @@ func (opts *listServerlessInstancesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listServerlessInstancesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listServerlessInstancesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListServerlessInstancesApiParams{ GroupId: opts.groupId, @@ -303,7 +361,17 @@ func (opts *listServerlessInstancesOpts) run(ctx context.Context, w io.Writer) e return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -316,7 +384,7 @@ func listServerlessInstancesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -324,6 +392,7 @@ func listServerlessInstancesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -334,6 +403,8 @@ type updateServerlessInstanceOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateServerlessInstanceOpts) preRun() (err error) { @@ -352,16 +423,20 @@ func (opts *updateServerlessInstanceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateServerlessInstanceOpts) readData() (*admin.ServerlessInstanceDescriptionUpdate, error) { +func (opts *updateServerlessInstanceOpts) readData(r io.Reader) (*admin.ServerlessInstanceDescriptionUpdate, error) { var out *admin.ServerlessInstanceDescriptionUpdate var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -377,8 +452,8 @@ func (opts *updateServerlessInstanceOpts) readData() (*admin.ServerlessInstanceD return out, nil } -func (opts *updateServerlessInstanceOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateServerlessInstanceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -400,7 +475,17 @@ func (opts *updateServerlessInstanceOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -415,7 +500,7 @@ func updateServerlessInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -424,6 +509,7 @@ func updateServerlessInstanceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("name") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index 3b8a7d0abd..f108ba61ff 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createServerlessPrivateEndpointOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createServerlessPrivateEndpointOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createServerlessPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantCreateRequest, error) { +func (opts *createServerlessPrivateEndpointOpts) readData(r io.Reader) (*admin.ServerlessTenantCreateRequest, error) { var out *admin.ServerlessTenantCreateRequest var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTe return out, nil } -func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, w io.W return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("instanceName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -136,6 +154,8 @@ type deleteServerlessPrivateEndpointOpts struct { groupId string instanceName string endpointId string + format string + tmpl *template.Template } func (opts *deleteServerlessPrivateEndpointOpts) preRun() (err error) { @@ -154,10 +174,14 @@ func (opts *deleteServerlessPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -175,7 +199,17 @@ func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, w io.W return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -188,7 +222,7 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -197,6 +231,7 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -205,6 +240,8 @@ type getServerlessPrivateEndpointOpts struct { groupId string instanceName string endpointId string + format string + tmpl *template.Template } func (opts *getServerlessPrivateEndpointOpts) preRun() (err error) { @@ -223,10 +260,14 @@ func (opts *getServerlessPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -244,7 +285,17 @@ func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -257,7 +308,7 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -266,6 +317,7 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -273,6 +325,8 @@ type listServerlessPrivateEndpointsOpts struct { client *admin.APIClient groupId string instanceName string + format string + tmpl *template.Template } func (opts *listServerlessPrivateEndpointsOpts) preRun() (err error) { @@ -291,10 +345,14 @@ func (opts *listServerlessPrivateEndpointsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListServerlessPrivateEndpointsApiParams{ GroupId: opts.groupId, @@ -311,7 +369,17 @@ func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, w io.Wr return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -324,13 +392,14 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.instanceName, "instanceName", "", `Human-readable label that identifies the serverless instance associated with the tenant endpoint.`) _ = cmd.MarkFlagRequired("instanceName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -342,6 +411,8 @@ type updateServerlessPrivateEndpointOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateServerlessPrivateEndpointOpts) preRun() (err error) { @@ -360,16 +431,20 @@ func (opts *updateServerlessPrivateEndpointOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTenantEndpointUpdate, error) { +func (opts *updateServerlessPrivateEndpointOpts) readData(r io.Reader) (*admin.ServerlessTenantEndpointUpdate, error) { var out *admin.ServerlessTenantEndpointUpdate var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -385,8 +460,8 @@ func (opts *updateServerlessPrivateEndpointOpts) readData() (*admin.ServerlessTe return out, nil } -func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -409,7 +484,17 @@ func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, w io.W return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -424,7 +509,7 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -435,6 +520,7 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("instanceName") _ = cmd.MarkFlagRequired("endpointId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index bbddbea63a..046eabd3c0 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createSharedClusterBackupRestoreJobOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createSharedClusterBackupRestoreJobOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createSharedClusterBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createSharedClusterBackupRestoreJobOpts) readData() (*admin.TenantRestore, error) { +func (opts *createSharedClusterBackupRestoreJobOpts) readData(r io.Reader) (*admin.TenantRestore, error) { var out *admin.TenantRestore var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createSharedClusterBackupRestoreJobOpts) readData() (*admin.TenantRe return out, nil } -func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -128,6 +145,7 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -136,6 +154,8 @@ type getSharedClusterBackupRestoreJobOpts struct { clusterName string groupId string restoreId string + format string + tmpl *template.Template } func (opts *getSharedClusterBackupRestoreJobOpts) preRun() (err error) { @@ -154,10 +174,14 @@ func (opts *getSharedClusterBackupRestoreJobOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, @@ -175,7 +199,17 @@ func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, w io. return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -188,7 +222,7 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -197,6 +231,7 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("restoreId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -204,6 +239,8 @@ type listSharedClusterBackupRestoreJobsOpts struct { client *admin.APIClient clusterName string groupId string + format string + tmpl *template.Template } func (opts *listSharedClusterBackupRestoreJobsOpts) preRun() (err error) { @@ -222,10 +259,14 @@ func (opts *listSharedClusterBackupRestoreJobsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListSharedClusterBackupRestoreJobsApiParams{ ClusterName: opts.clusterName, @@ -242,7 +283,17 @@ func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, w i return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -255,13 +306,14 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index 657e3431c5..c2311ecc14 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type downloadSharedClusterBackupOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *downloadSharedClusterBackupOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *downloadSharedClusterBackupOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *downloadSharedClusterBackupOpts) readData() (*admin.TenantRestore, error) { +func (opts *downloadSharedClusterBackupOpts) readData(r io.Reader) (*admin.TenantRestore, error) { var out *admin.TenantRestore var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *downloadSharedClusterBackupOpts) readData() (*admin.TenantRestore, e return out, nil } -func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -128,6 +145,7 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -136,6 +154,8 @@ type getSharedClusterBackupOpts struct { groupId string clusterName string snapshotId string + format string + tmpl *template.Template } func (opts *getSharedClusterBackupOpts) preRun() (err error) { @@ -154,10 +174,14 @@ func (opts *getSharedClusterBackupOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getSharedClusterBackupOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getSharedClusterBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetSharedClusterBackupApiParams{ GroupId: opts.groupId, @@ -175,7 +199,17 @@ func (opts *getSharedClusterBackupOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -188,7 +222,7 @@ func getSharedClusterBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -197,6 +231,7 @@ func getSharedClusterBackupBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("clusterName") _ = cmd.MarkFlagRequired("snapshotId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -204,6 +239,8 @@ type listSharedClusterBackupsOpts struct { client *admin.APIClient groupId string clusterName string + format string + tmpl *template.Template } func (opts *listSharedClusterBackupsOpts) preRun() (err error) { @@ -222,10 +259,14 @@ func (opts *listSharedClusterBackupsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListSharedClusterBackupsApiParams{ GroupId: opts.groupId, @@ -242,7 +283,17 @@ func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -255,13 +306,14 @@ func listSharedClusterBackupsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index 1f83e3c422..15306a12b5 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createStreamConnectionOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createStreamConnectionOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createStreamConnectionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createStreamConnectionOpts) readData() (*admin.StreamsConnection, error) { +func (opts *createStreamConnectionOpts) readData(r io.Reader) (*admin.StreamsConnection, error) { var out *admin.StreamsConnection var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createStreamConnectionOpts) readData() (*admin.StreamsConnection, er return out, nil } -func (opts *createStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createStreamConnectionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createStreamConnectionOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createStreamConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,6 +145,7 @@ func createStreamConnectionBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -137,6 +155,8 @@ type createStreamInstanceOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createStreamInstanceOpts) preRun() (err error) { @@ -155,16 +175,20 @@ func (opts *createStreamInstanceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createStreamInstanceOpts) readData() (*admin.StreamsTenant, error) { +func (opts *createStreamInstanceOpts) readData(r io.Reader) (*admin.StreamsTenant, error) { var out *admin.StreamsTenant var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -180,8 +204,8 @@ func (opts *createStreamInstanceOpts) readData() (*admin.StreamsTenant, error) { return out, nil } -func (opts *createStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createStreamInstanceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -202,7 +226,17 @@ func (opts *createStreamInstanceOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -217,13 +251,14 @@ func createStreamInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -232,6 +267,8 @@ type deleteStreamConnectionOpts struct { groupId string tenantName string connectionName string + format string + tmpl *template.Template } func (opts *deleteStreamConnectionOpts) preRun() (err error) { @@ -250,10 +287,14 @@ func (opts *deleteStreamConnectionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteStreamConnectionOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteStreamConnectionApiParams{ GroupId: opts.groupId, @@ -271,7 +312,17 @@ func (opts *deleteStreamConnectionOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -284,7 +335,7 @@ func deleteStreamConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -293,6 +344,7 @@ func deleteStreamConnectionBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("connectionName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -300,6 +352,8 @@ type deleteStreamInstanceOpts struct { client *admin.APIClient groupId string tenantName string + format string + tmpl *template.Template } func (opts *deleteStreamInstanceOpts) preRun() (err error) { @@ -318,10 +372,14 @@ func (opts *deleteStreamInstanceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteStreamInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteStreamInstanceApiParams{ GroupId: opts.groupId, @@ -338,7 +396,17 @@ func (opts *deleteStreamInstanceOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -351,13 +419,14 @@ func deleteStreamInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance to delete.`) _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -366,6 +435,8 @@ type getStreamConnectionOpts struct { groupId string tenantName string connectionName string + format string + tmpl *template.Template } func (opts *getStreamConnectionOpts) preRun() (err error) { @@ -384,10 +455,14 @@ func (opts *getStreamConnectionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getStreamConnectionOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetStreamConnectionApiParams{ GroupId: opts.groupId, @@ -405,7 +480,17 @@ func (opts *getStreamConnectionOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -418,7 +503,7 @@ func getStreamConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -427,6 +512,7 @@ func getStreamConnectionBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("connectionName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -435,6 +521,8 @@ type getStreamInstanceOpts struct { groupId string tenantName string includeConnections bool + format string + tmpl *template.Template } func (opts *getStreamInstanceOpts) preRun() (err error) { @@ -453,10 +541,14 @@ func (opts *getStreamInstanceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getStreamInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetStreamInstanceApiParams{ GroupId: opts.groupId, @@ -474,7 +566,17 @@ func (opts *getStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -487,7 +589,7 @@ func getStreamInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -495,6 +597,7 @@ func getStreamInstanceBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeConnections, "includeConnections", false, `Flag to indicate whether connections information should be included in the stream instance.`) _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -504,6 +607,8 @@ type listStreamConnectionsOpts struct { tenantName string itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listStreamConnectionsOpts) preRun() (err error) { @@ -522,10 +627,14 @@ func (opts *listStreamConnectionsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listStreamConnectionsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listStreamConnectionsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListStreamConnectionsApiParams{ GroupId: opts.groupId, @@ -544,7 +653,17 @@ func (opts *listStreamConnectionsOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -557,7 +676,7 @@ func listStreamConnectionsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -566,6 +685,7 @@ func listStreamConnectionsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -574,6 +694,8 @@ type listStreamInstancesOpts struct { groupId string itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listStreamInstancesOpts) preRun() (err error) { @@ -592,10 +714,14 @@ func (opts *listStreamInstancesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listStreamInstancesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listStreamInstancesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListStreamInstancesApiParams{ GroupId: opts.groupId, @@ -613,7 +739,17 @@ func (opts *listStreamInstancesOpts) run(ctx context.Context, w io.Writer) error return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -626,13 +762,14 @@ func listStreamInstancesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -644,6 +781,8 @@ type updateStreamConnectionOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateStreamConnectionOpts) preRun() (err error) { @@ -662,16 +801,20 @@ func (opts *updateStreamConnectionOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateStreamConnectionOpts) readData() (*admin.StreamsConnection, error) { +func (opts *updateStreamConnectionOpts) readData(r io.Reader) (*admin.StreamsConnection, error) { var out *admin.StreamsConnection var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -687,8 +830,8 @@ func (opts *updateStreamConnectionOpts) readData() (*admin.StreamsConnection, er return out, nil } -func (opts *updateStreamConnectionOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateStreamConnectionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -711,7 +854,17 @@ func (opts *updateStreamConnectionOpts) run(ctx context.Context, w io.Writer) er return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -726,7 +879,7 @@ func updateStreamConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -737,6 +890,7 @@ func updateStreamConnectionBuilder() *cobra.Command { _ = cmd.MarkFlagRequired("tenantName") _ = cmd.MarkFlagRequired("connectionName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -747,6 +901,8 @@ type updateStreamInstanceOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateStreamInstanceOpts) preRun() (err error) { @@ -765,16 +921,20 @@ func (opts *updateStreamInstanceOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateStreamInstanceOpts) readData() (*admin.StreamsDataProcessRegion, error) { +func (opts *updateStreamInstanceOpts) readData(r io.Reader) (*admin.StreamsDataProcessRegion, error) { var out *admin.StreamsDataProcessRegion var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -790,8 +950,8 @@ func (opts *updateStreamInstanceOpts) readData() (*admin.StreamsDataProcessRegio return out, nil } -func (opts *updateStreamInstanceOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateStreamInstanceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -813,7 +973,17 @@ func (opts *updateStreamInstanceOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -828,7 +998,7 @@ func updateStreamInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -837,6 +1007,7 @@ func updateStreamInstanceBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index 137057a91a..8af70d1175 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -37,6 +38,8 @@ type addAllTeamsToProjectOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *addAllTeamsToProjectOpts) preRun() (err error) { @@ -55,16 +58,20 @@ func (opts *addAllTeamsToProjectOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *addAllTeamsToProjectOpts) readData() (*[]admin.TeamRole, error) { +func (opts *addAllTeamsToProjectOpts) readData(r io.Reader) (*[]admin.TeamRole, error) { var out *[]admin.TeamRole var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -80,8 +87,8 @@ func (opts *addAllTeamsToProjectOpts) readData() (*[]admin.TeamRole, error) { return out, nil } -func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -102,7 +109,17 @@ func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, w io.Writer) erro return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -117,13 +134,14 @@ func addAllTeamsToProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -134,6 +152,8 @@ type addTeamUserOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *addTeamUserOpts) preRun() (err error) { @@ -152,16 +172,20 @@ func (opts *addTeamUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *addTeamUserOpts) readData() (*[]admin.AddUserToTeam, error) { +func (opts *addTeamUserOpts) readData(r io.Reader) (*[]admin.AddUserToTeam, error) { var out *[]admin.AddUserToTeam var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -177,8 +201,8 @@ func (opts *addTeamUserOpts) readData() (*[]admin.AddUserToTeam, error) { return out, nil } -func (opts *addTeamUserOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *addTeamUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -200,7 +224,17 @@ func (opts *addTeamUserOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -215,7 +249,7 @@ func addTeamUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -224,6 +258,7 @@ func addTeamUserBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("teamId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -233,6 +268,8 @@ type createTeamOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createTeamOpts) preRun() (err error) { @@ -251,16 +288,20 @@ func (opts *createTeamOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createTeamOpts) readData() (*admin.Team, error) { +func (opts *createTeamOpts) readData(r io.Reader) (*admin.Team, error) { var out *admin.Team var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -276,8 +317,8 @@ func (opts *createTeamOpts) readData() (*admin.Team, error) { return out, nil } -func (opts *createTeamOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createTeamOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -298,7 +339,17 @@ func (opts *createTeamOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -313,13 +364,14 @@ func createTeamBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -327,6 +379,8 @@ type deleteTeamOpts struct { client *admin.APIClient orgId string teamId string + format string + tmpl *template.Template } func (opts *deleteTeamOpts) preRun() (err error) { @@ -345,10 +399,14 @@ func (opts *deleteTeamOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteTeamOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteTeamOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteTeamApiParams{ OrgId: opts.orgId, @@ -365,7 +423,17 @@ func (opts *deleteTeamOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -378,13 +446,14 @@ func deleteTeamBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team that you want to delete.`) _ = cmd.MarkFlagRequired("teamId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -392,6 +461,8 @@ type getTeamByIdOpts struct { client *admin.APIClient orgId string teamId string + format string + tmpl *template.Template } func (opts *getTeamByIdOpts) preRun() (err error) { @@ -410,10 +481,14 @@ func (opts *getTeamByIdOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getTeamByIdOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getTeamByIdOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetTeamByIdApiParams{ OrgId: opts.orgId, @@ -430,7 +505,17 @@ func (opts *getTeamByIdOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -443,13 +528,14 @@ func getTeamByIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamId, "teamId", "", `Unique 24-hexadecimal digit string that identifies the team whose information you want to return.`) _ = cmd.MarkFlagRequired("teamId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -457,6 +543,8 @@ type getTeamByNameOpts struct { client *admin.APIClient orgId string teamName string + format string + tmpl *template.Template } func (opts *getTeamByNameOpts) preRun() (err error) { @@ -475,10 +563,14 @@ func (opts *getTeamByNameOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getTeamByNameOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getTeamByNameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetTeamByNameApiParams{ OrgId: opts.orgId, @@ -495,7 +587,17 @@ func (opts *getTeamByNameOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -508,13 +610,14 @@ func getTeamByNameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) cmd.Flags().StringVar(&opts.teamName, "teamName", "", `Name of the team whose information you want to return.`) _ = cmd.MarkFlagRequired("teamName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -524,6 +627,8 @@ type listOrganizationTeamsOpts struct { itemsPerPage int includeCount bool pageNum int + format string + tmpl *template.Template } func (opts *listOrganizationTeamsOpts) preRun() (err error) { @@ -542,10 +647,14 @@ func (opts *listOrganizationTeamsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listOrganizationTeamsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listOrganizationTeamsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListOrganizationTeamsApiParams{ OrgId: opts.orgId, @@ -564,7 +673,17 @@ func (opts *listOrganizationTeamsOpts) run(ctx context.Context, w io.Writer) err return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -577,7 +696,7 @@ func listOrganizationTeamsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -585,6 +704,7 @@ func listOrganizationTeamsBuilder() *cobra.Command { cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -594,6 +714,8 @@ type listProjectTeamsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listProjectTeamsOpts) preRun() (err error) { @@ -612,10 +734,14 @@ func (opts *listProjectTeamsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listProjectTeamsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listProjectTeamsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListProjectTeamsApiParams{ GroupId: opts.groupId, @@ -634,7 +760,17 @@ func (opts *listProjectTeamsOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -647,7 +783,7 @@ func listProjectTeamsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -655,6 +791,7 @@ func listProjectTeamsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -664,6 +801,8 @@ type listTeamUsersOpts struct { teamId string itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listTeamUsersOpts) preRun() (err error) { @@ -682,10 +821,14 @@ func (opts *listTeamUsersOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listTeamUsersOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listTeamUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListTeamUsersApiParams{ OrgId: opts.orgId, @@ -704,7 +847,17 @@ func (opts *listTeamUsersOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -717,7 +870,7 @@ func listTeamUsersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -726,6 +879,7 @@ func listTeamUsersBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("teamId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -751,10 +905,10 @@ func (opts *removeProjectTeamOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + return err } -func (opts *removeProjectTeamOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *removeProjectTeamOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, @@ -774,7 +928,7 @@ func removeProjectTeamBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -807,10 +961,10 @@ func (opts *removeTeamUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + return err } -func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Writer) error { +func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { params := &admin.RemoveTeamUserApiParams{ OrgId: opts.orgId, @@ -831,7 +985,7 @@ func removeTeamUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -850,6 +1004,8 @@ type renameTeamOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *renameTeamOpts) preRun() (err error) { @@ -868,16 +1024,20 @@ func (opts *renameTeamOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *renameTeamOpts) readData() (*admin.Team, error) { +func (opts *renameTeamOpts) readData(r io.Reader) (*admin.Team, error) { var out *admin.Team var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -893,8 +1053,8 @@ func (opts *renameTeamOpts) readData() (*admin.Team, error) { return out, nil } -func (opts *renameTeamOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *renameTeamOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -916,7 +1076,17 @@ func (opts *renameTeamOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -931,7 +1101,7 @@ func renameTeamBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -940,6 +1110,7 @@ func renameTeamBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("teamId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -950,6 +1121,8 @@ type updateTeamRolesOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateTeamRolesOpts) preRun() (err error) { @@ -968,16 +1141,20 @@ func (opts *updateTeamRolesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateTeamRolesOpts) readData() (*admin.TeamRole, error) { +func (opts *updateTeamRolesOpts) readData(r io.Reader) (*admin.TeamRole, error) { var out *admin.TeamRole var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -993,8 +1170,8 @@ func (opts *updateTeamRolesOpts) readData() (*admin.TeamRole, error) { return out, nil } -func (opts *updateTeamRolesOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateTeamRolesOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -1016,7 +1193,17 @@ func (opts *updateTeamRolesOpts) run(ctx context.Context, w io.Writer) error { return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -1031,7 +1218,7 @@ func updateTeamRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1040,6 +1227,7 @@ func updateTeamRolesBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("teamId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 7812697e30..158dde0be9 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -41,6 +42,8 @@ type createThirdPartyIntegrationOpts struct { pageNum int filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createThirdPartyIntegrationOpts) preRun() (err error) { @@ -59,16 +62,20 @@ func (opts *createThirdPartyIntegrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegration, error) { +func (opts *createThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.ThridPartyIntegration, error) { var out *admin.ThridPartyIntegration var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -84,8 +91,8 @@ func (opts *createThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegr return out, nil } -func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -111,7 +118,17 @@ func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -126,7 +143,7 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -138,6 +155,7 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("integrationType") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -145,6 +163,8 @@ type deleteThirdPartyIntegrationOpts struct { client *admin.APIClient integrationType string groupId string + format string + tmpl *template.Template } func (opts *deleteThirdPartyIntegrationOpts) preRun() (err error) { @@ -163,10 +183,14 @@ func (opts *deleteThirdPartyIntegrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DeleteThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, @@ -183,7 +207,17 @@ func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -196,13 +230,14 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) _ = cmd.MarkFlagRequired("integrationType") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -210,6 +245,8 @@ type getThirdPartyIntegrationOpts struct { client *admin.APIClient groupId string integrationType string + format string + tmpl *template.Template } func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { @@ -228,10 +265,14 @@ func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { +func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.GetThirdPartyIntegrationApiParams{ GroupId: opts.groupId, @@ -248,7 +289,17 @@ func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -261,13 +312,14 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) _ = cmd.MarkFlagRequired("integrationType") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -277,6 +329,8 @@ type listThirdPartyIntegrationsOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listThirdPartyIntegrationsOpts) preRun() (err error) { @@ -295,10 +349,14 @@ func (opts *listThirdPartyIntegrationsOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListThirdPartyIntegrationsApiParams{ GroupId: opts.groupId, @@ -317,7 +375,17 @@ func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, w io.Writer return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -330,7 +398,7 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -338,6 +406,7 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -351,6 +420,8 @@ type updateThirdPartyIntegrationOpts struct { pageNum int filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *updateThirdPartyIntegrationOpts) preRun() (err error) { @@ -369,16 +440,20 @@ func (opts *updateThirdPartyIntegrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *updateThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegration, error) { +func (opts *updateThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.ThridPartyIntegration, error) { var out *admin.ThridPartyIntegration var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -394,8 +469,8 @@ func (opts *updateThirdPartyIntegrationOpts) readData() (*admin.ThridPartyIntegr return out, nil } -func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -421,7 +496,17 @@ func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, w io.Write return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -436,7 +521,7 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -448,6 +533,7 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("integrationType") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index f0cc9bc538..3ca68e5b8d 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -23,7 +23,8 @@ import ( "errors" "fmt" "io" - "os" + "strings" + "text/template" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" @@ -38,6 +39,8 @@ type createDatabaseUserCertificateOpts struct { filename string fs afero.Fs + format string + tmpl *template.Template } func (opts *createDatabaseUserCertificateOpts) preRun() (err error) { @@ -56,16 +59,20 @@ func (opts *createDatabaseUserCertificateOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *createDatabaseUserCertificateOpts) readData() (*admin.UserCert, error) { +func (opts *createDatabaseUserCertificateOpts) readData(r io.Reader) (*admin.UserCert, error) { var out *admin.UserCert var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -81,8 +88,8 @@ func (opts *createDatabaseUserCertificateOpts) readData() (*admin.UserCert, erro return out, nil } -func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, w io.Writer) error { - data, errData := opts.readData() +func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { + data, errData := opts.readData(r) if errData != nil { return errData } @@ -104,7 +111,17 @@ func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, w io.Wri return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -119,7 +136,7 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -128,12 +145,15 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") _ = cmd.MarkFlagRequired("username") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } type disableCustomerManagedX509Opts struct { client *admin.APIClient groupId string + format string + tmpl *template.Template } func (opts *disableCustomerManagedX509Opts) preRun() (err error) { @@ -152,10 +172,14 @@ func (opts *disableCustomerManagedX509Opts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, w io.Writer) error { +func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, @@ -171,7 +195,17 @@ func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, w io.Writer return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -184,11 +218,12 @@ func disableCustomerManagedX509Builder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } @@ -199,6 +234,8 @@ type listDatabaseUserCertificatesOpts struct { includeCount bool itemsPerPage int pageNum int + format string + tmpl *template.Template } func (opts *listDatabaseUserCertificatesOpts) preRun() (err error) { @@ -217,10 +254,14 @@ func (opts *listDatabaseUserCertificatesOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return nil + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + + return err } -func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, w io.Writer) error { +func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { params := &admin.ListDatabaseUserCertificatesApiParams{ GroupId: opts.groupId, @@ -240,7 +281,17 @@ func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, w io.Writ return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) return err } @@ -253,7 +304,7 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -263,6 +314,7 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) _ = cmd.MarkFlagRequired("username") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") return cmd } diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 5c11c96785..b27321a221 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -7,8 +7,10 @@ import ( "encoding/hex" "encoding/json" "fmt" + "strings" "io" "os" + "text/template" "time" "github.com/spf13/afero" @@ -28,6 +30,10 @@ type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { filename string fs afero.Fs {{/bodyParam}} + {{#returnType}} + format string + tmpl *template.Template + {{/returnType}} } func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) preRun() (err error) { @@ -59,17 +65,23 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) preRu } {{/vendorExtensions.x-org-id}}{{/allParams}} - return nil + {{#returnType}} + if opts.format != "" { + opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + } + {{/returnType}} + + return err } {{#bodyParam}} -func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) readData() (*{{#isArray}}[]{{/isArray}}admin.{{baseType}}, error) { +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) readData(r io.Reader) (*{{#isArray}}[]{{/isArray}}admin.{{baseType}}, error) { var out *{{#isArray}}[]{{/isArray}}admin.{{baseType}} var buf []byte var err error if opts.filename == "" { - buf, err = io.ReadAll(os.Stdin) + buf, err = io.ReadAll(r) } else { if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { return nil, fmt.Errorf("file not found: %s", opts.filename) @@ -86,9 +98,9 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) readD } {{/bodyParam}} -func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(ctx context.Context, {{^returnType}}_{{/returnType}}{{#returnType}}w{{/returnType}} io.Writer) error { +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(ctx context.Context, {{^bodyParam}}_{{/bodyParam}}{{#bodyParam}}r{{/bodyParam}} io.Reader, {{^returnType}}_{{/returnType}}{{#returnType}}w{{/returnType}} io.Writer) error { {{#bodyParam}} - data, errData := opts.readData() + data, errData := opts.readData(r) if errData != nil { return errData } @@ -122,7 +134,17 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(c return errJson } - _, err = fmt.Fprintln(w, string(prettyJSON)) + if opts.format == "" { + _, err = fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + err = opts.tmpl.Execute(w, parsedJSON) {{/returnType}} return err } @@ -140,7 +162,7 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) }, } {{#allParams}} @@ -151,6 +173,9 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C {{/bodyParam}} {{#allParams}}{{^isBodyParam}}{{^vendorExtensions.x-org-id}}{{^vendorExtensions.x-group-id}}{{#required}} _ = cmd.MarkFlagRequired("{{#vendorExtensions.x-flag-name}}{{.}}{{/vendorExtensions.x-flag-name}}{{^vendorExtensions.x-flag-name}}{{paramName}}{{/vendorExtensions.x-flag-name}}"){{/required}}{{/vendorExtensions.x-group-id}}{{/vendorExtensions.x-org-id}}{{/isBodyParam}}{{/allParams}} + {{#returnType}} + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + {{/returnType}} return cmd } {{/operation}} From b3e23bd06291f2e58d60993422bd0cd278b6db90 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Mon, 2 Oct 2023 11:36:33 +0100 Subject: [PATCH 35/44] fix import and client --- internal/api/.openapi-generator-ignore | 1 + internal/api/.openapi-generator/FILES | 1 + internal/api/api.go | 102 -------------- internal/api/api_access_tracking_cmd.go | 4 +- internal/api/api_alert_configurations_cmd.go | 16 +-- internal/api/api_alerts_cmd.go | 8 +- internal/api/api_atlas_search_cmd.go | 10 +- internal/api/api_auditing_cmd.go | 4 +- internal/api/api_aws_clusters_dns_cmd.go | 4 +- internal/api/api_cloud_backups_cmd.go | 58 ++++---- .../api/api_cloud_migration_service_cmd.go | 16 +-- internal/api/api_cloud_provider_access_cmd.go | 10 +- .../api/api_cluster_outage_simulation_cmd.go | 6 +- internal/api/api_clusters_cmd.go | 30 ++-- internal/api/api_custom_database_roles_cmd.go | 10 +- internal/api/api_data_federation_cmd.go | 28 ++-- internal/api/api_data_lake_pipelines_cmd.go | 26 ++-- internal/api/api_database_users_cmd.go | 10 +- ..._rest_using_customer_key_management_cmd.go | 4 +- internal/api/api_events_cmd.go | 8 +- .../api/api_federated_authentication_cmd.go | 30 ++-- internal/api/api_global_clusters_cmd.go | 10 +- internal/api/api_invoices_cmd.go | 12 +- internal/api/api_ldap_configuration_cmd.go | 10 +- internal/api/api_legacy_backup_cmd.go | 20 +-- .../api/api_legacy_backup_restore_jobs_cmd.go | 2 +- internal/api/api_maintenance_windows__cmd.go | 10 +- internal/api/api_mongo_db_cloud_users_cmd.go | 7 +- internal/api/api_monitoring_and_logs_cmd.go | 28 ++-- internal/api/api_network_peering_cmd.go | 26 ++-- internal/api/api_online_archive_cmd.go | 12 +- internal/api/api_organizations_cmd.go | 34 ++--- internal/api/api_performance_advisor_cmd.go | 10 +- .../api/api_private_endpoint_services_cmd.go | 18 +-- internal/api/api_programmatic_api_keys_cmd.go | 28 ++-- .../api/api_project_ip_access_list_cmd.go | 10 +- internal/api/api_projects_cmd.go | 42 +++--- internal/api/api_push_based_log_export_cmd.go | 8 +- internal/api/api_rolling_index_cmd.go | 2 +- internal/api/api_root_cmd.go | 3 +- internal/api/api_serverless_instances_cmd.go | 10 +- .../api_serverless_private_endpoints_cmd.go | 10 +- .../api/api_shared_tier_restore_jobs_cmd.go | 6 +- internal/api/api_shared_tier_snapshots_cmd.go | 6 +- internal/api/api_streams_cmd.go | 20 +-- internal/api/api_teams_cmd.go | 26 ++-- .../api/api_third_party_integrations_cmd.go | 10 +- internal/api/api_x509_authentication_cmd.go | 6 +- internal/api/client.go | 128 ++++++++++++++++++ .../config/.openapi-generator-ignore | 1 + tools/openapi-generator/config/config.yaml | 3 + .../config/go-templates/api.mustache | 102 -------------- .../config/go-templates/client.mustache | 113 ++++++++++++++++ .../config/go-templates/cmd.mustache | 2 +- 54 files changed, 583 insertions(+), 538 deletions(-) create mode 100644 internal/api/client.go create mode 100644 tools/openapi-generator/config/go-templates/client.mustache diff --git a/internal/api/.openapi-generator-ignore b/internal/api/.openapi-generator-ignore index 856ce9c953..83365f7a8a 100644 --- a/internal/api/.openapi-generator-ignore +++ b/internal/api/.openapi-generator-ignore @@ -2,3 +2,4 @@ *.* !*_cmd.go !api.go +!client.go diff --git a/internal/api/.openapi-generator/FILES b/internal/api/.openapi-generator/FILES index a0f5a6f478..fca7b95d03 100644 --- a/internal/api/.openapi-generator/FILES +++ b/internal/api/.openapi-generator/FILES @@ -44,3 +44,4 @@ api_streams_cmd.go api_teams_cmd.go api_third_party_integrations_cmd.go api_x509_authentication_cmd.go +client.go diff --git a/internal/api/api.go b/internal/api/api.go index 03a4827516..b50c894644 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -17,111 +17,9 @@ package api import ( - "time" - "net" - "net/http" - "github.com/spf13/cobra" - "github.com/mongodb-forks/digest" - "go.mongodb.org/atlas-sdk/v20230201008/admin" - "go.mongodb.org/atlas/auth" - "github.com/mongodb/mongodb-atlas-cli/internal/config" - "github.com/mongodb/mongodb-atlas-cli/internal/log" -) - -const ( - cloudGovServiceURL = "https://cloud.mongodbgov.com/" - timeout = 5 * time.Second - keepAlive = 30 * time.Second - maxIdleConns = 5 - maxIdleConnsPerHost = 4 - idleConnTimeout = 30 * time.Second - expectContinueTimeout = 1 * time.Second ) -func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { - httpTransport := &http.Transport{ - DialContext: (&net.Dialer{ - Timeout: timeout, - KeepAlive: keepAlive, - }).DialContext, - MaxIdleConns: maxIdleConns, - MaxIdleConnsPerHost: maxIdleConnsPerHost, - Proxy: http.ProxyFromEnvironment, - IdleConnTimeout: idleConnTimeout, - ExpectContinueTimeout: expectContinueTimeout, - } - - if username == "" && password == "" && accessToken == nil { - return &http.Client{Transport: httpTransport}, nil - } - if username != "" && password != "" { - t := &digest.Transport{ - Username: username, - Password: password, - } - t.Transport = httpTransport - return t.Client() - } - tr := &Transport{ - token: accessToken, - base: httpTransport, - } - - return &http.Client{Transport: tr}, nil -} - -func newClientWithAuth() (*admin.APIClient, error) { - profile := config.Default() - - var authToken *auth.Token - - username := profile.PublicAPIKey() - password := profile.PrivateAPIKey() - - if username == "" && password == "" { - var err error - authToken, err = profile.Token() - if err != nil { - return nil, err - } - } - - baseURL := profile.OpsManagerURL() - if baseURL == "" && profile.Service() == config.CloudGovService { - baseURL = cloudGovServiceURL - } - - client, err := httpClient(username, password, authToken) - if err != nil { - return nil, err - } - - opts := []admin.ClientModifier{ - admin.UseHTTPClient(client), - admin.UseUserAgent(config.UserAgent), - admin.UseDebug(log.IsDebugLevel())} - - if baseURL != "" { - opts = append(opts, admin.UseBaseURL(baseURL)) - } - c, err := admin.NewClient(opts...) - if err != nil { - return nil, err - } - return c, nil -} - -type Transport struct { - token *auth.Token - base http.RoundTripper -} - -func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { - tr.token.SetAuthHeader(req) - return tr.base.RoundTrip(req) -} - func Builder() *cobra.Command { const use = "api" cmd := &cobra.Command{ diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index 82dac59098..a21da13b68 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -45,7 +45,7 @@ type listAccessLogsByClusterNameOpts struct { } func (opts *listAccessLogsByClusterNameOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -142,7 +142,7 @@ type listAccessLogsByHostnameOpts struct { } func (opts *listAccessLogsByHostnameOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index 2b21ec0905..2aadf5d795 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -43,7 +43,7 @@ type createAlertConfigurationOpts struct { } func (opts *createAlertConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -152,7 +152,7 @@ type deleteAlertConfigurationOpts struct { } func (opts *deleteAlertConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -209,7 +209,7 @@ type getAlertConfigurationOpts struct { } func (opts *getAlertConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -289,7 +289,7 @@ type listAlertConfigurationMatchersFieldNamesOpts struct { } func (opts *listAlertConfigurationMatchersFieldNamesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -356,7 +356,7 @@ type listAlertConfigurationsOpts struct { } func (opts *listAlertConfigurationsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -444,7 +444,7 @@ type listAlertConfigurationsByAlertIdOpts struct { } func (opts *listAlertConfigurationsByAlertIdOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -535,7 +535,7 @@ type toggleAlertConfigurationOpts struct { } func (opts *toggleAlertConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -652,7 +652,7 @@ type updateAlertConfigurationOpts struct { } func (opts *updateAlertConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index 20ec002cb3..69397a9384 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -44,7 +44,7 @@ type acknowledgeAlertOpts struct { } func (opts *acknowledgeAlertOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -158,7 +158,7 @@ type getAlertOpts struct { } func (opts *getAlertOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -243,7 +243,7 @@ type listAlertsOpts struct { } func (opts *listAlertsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -333,7 +333,7 @@ type listAlertsByAlertConfigurationIdOpts struct { } func (opts *listAlertsByAlertConfigurationIdOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index f245848b59..9c00a22e1f 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -44,7 +44,7 @@ type createAtlasSearchIndexOpts struct { } func (opts *createAtlasSearchIndexOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -159,7 +159,7 @@ type deleteAtlasSearchIndexOpts struct { } func (opts *deleteAtlasSearchIndexOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -245,7 +245,7 @@ type getAtlasSearchIndexOpts struct { } func (opts *getAtlasSearchIndexOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -332,7 +332,7 @@ type listAtlasSearchIndexesOpts struct { } func (opts *listAtlasSearchIndexesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -424,7 +424,7 @@ type updateAtlasSearchIndexOpts struct { } func (opts *updateAtlasSearchIndexOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 85cacb62e2..ab676f453d 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -40,7 +40,7 @@ type getAuditingConfigurationOpts struct { } func (opts *getAuditingConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -121,7 +121,7 @@ type updateAuditingConfigurationOpts struct { } func (opts *updateAuditingConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index 829fd03720..18242834c2 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -40,7 +40,7 @@ type getAWSCustomDNSOpts struct { } func (opts *getAWSCustomDNSOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -121,7 +121,7 @@ type toggleAWSCustomDNSOpts struct { } func (opts *toggleAWSCustomDNSOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 6aa26fab88..6d2cd2ef91 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -42,7 +42,7 @@ type cancelBackupRestoreJobOpts struct { } func (opts *cancelBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -130,7 +130,7 @@ type createBackupExportJobOpts struct { } func (opts *createBackupExportJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -247,7 +247,7 @@ type createBackupRestoreJobOpts struct { } func (opts *createBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -363,7 +363,7 @@ type createExportBucketOpts struct { } func (opts *createExportBucketOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -477,7 +477,7 @@ type createServerlessBackupRestoreJobOpts struct { } func (opts *createServerlessBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -591,7 +591,7 @@ type deleteAllBackupSchedulesOpts struct { } func (opts *deleteAllBackupSchedulesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -673,7 +673,7 @@ type deleteExportBucketOpts struct { } func (opts *deleteExportBucketOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -756,7 +756,7 @@ type deleteReplicaSetBackupOpts struct { } func (opts *deleteReplicaSetBackupOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -842,7 +842,7 @@ type deleteShardedClusterBackupOpts struct { } func (opts *deleteShardedClusterBackupOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -928,7 +928,7 @@ type getBackupExportJobOpts struct { } func (opts *getBackupExportJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1014,7 +1014,7 @@ type getBackupRestoreJobOpts struct { } func (opts *getBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1099,7 +1099,7 @@ type getBackupScheduleOpts struct { } func (opts *getBackupScheduleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1180,7 +1180,7 @@ type getDataProtectionSettingsOpts struct { } func (opts *getDataProtectionSettingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1259,7 +1259,7 @@ type getExportBucketOpts struct { } func (opts *getExportBucketOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1342,7 +1342,7 @@ type getReplicaSetBackupOpts struct { } func (opts *getReplicaSetBackupOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1428,7 +1428,7 @@ type getServerlessBackupOpts struct { } func (opts *getServerlessBackupOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1514,7 +1514,7 @@ type getServerlessBackupRestoreJobOpts struct { } func (opts *getServerlessBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1600,7 +1600,7 @@ type getShardedClusterBackupOpts struct { } func (opts *getShardedClusterBackupOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1688,7 +1688,7 @@ type listBackupExportJobsOpts struct { } func (opts *listBackupExportJobsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1779,7 +1779,7 @@ type listBackupRestoreJobsOpts struct { } func (opts *listBackupRestoreJobsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1869,7 +1869,7 @@ type listExportBucketsOpts struct { } func (opts *listExportBucketsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1957,7 +1957,7 @@ type listReplicaSetBackupsOpts struct { } func (opts *listReplicaSetBackupsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -2048,7 +2048,7 @@ type listServerlessBackupRestoreJobsOpts struct { } func (opts *listServerlessBackupRestoreJobsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -2139,7 +2139,7 @@ type listServerlessBackupsOpts struct { } func (opts *listServerlessBackupsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -2227,7 +2227,7 @@ type listShardedClusterBackupsOpts struct { } func (opts *listShardedClusterBackupsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -2312,7 +2312,7 @@ type takeSnapshotOpts struct { } func (opts *takeSnapshotOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -2429,7 +2429,7 @@ type updateBackupScheduleOpts struct { } func (opts *updateBackupScheduleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -2545,7 +2545,7 @@ type updateDataProtectionSettingsOpts struct { } func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -2660,7 +2660,7 @@ type updateSnapshotRetentionOpts struct { } func (opts *updateSnapshotRetentionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 5eb21b49ef..82fe0b18c8 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -43,7 +43,7 @@ type createLinkTokenOpts struct { } func (opts *createLinkTokenOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -156,7 +156,7 @@ type createPushMigrationOpts struct { } func (opts *createPushMigrationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -265,7 +265,7 @@ type cutoverMigrationOpts struct { } func (opts *cutoverMigrationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -321,7 +321,7 @@ type deleteLinkTokenOpts struct { } func (opts *deleteLinkTokenOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -400,7 +400,7 @@ type getPushMigrationOpts struct { } func (opts *getPushMigrationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -482,7 +482,7 @@ type getValidationStatusOpts struct { } func (opts *getValidationStatusOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -563,7 +563,7 @@ type listSourceProjectsOpts struct { } func (opts *listSourceProjectsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -644,7 +644,7 @@ type validateMigrationOpts struct { } func (opts *validateMigrationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index bffabf4fe0..ce2a06475a 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -44,7 +44,7 @@ type authorizeCloudProviderAccessRoleOpts struct { } func (opts *authorizeCloudProviderAccessRoleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -160,7 +160,7 @@ type createCloudProviderAccessRoleOpts struct { } func (opts *createCloudProviderAccessRoleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -270,7 +270,7 @@ type deauthorizeCloudProviderAccessRoleOpts struct { } func (opts *deauthorizeCloudProviderAccessRoleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -330,7 +330,7 @@ type getCloudProviderAccessRoleOpts struct { } func (opts *getCloudProviderAccessRoleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -411,7 +411,7 @@ type listCloudProviderAccessRolesOpts struct { } func (opts *listCloudProviderAccessRolesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index aec06958ef..7a8fd40a25 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -41,7 +41,7 @@ type endOutageSimulationOpts struct { } func (opts *endOutageSimulationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -123,7 +123,7 @@ type getOutageSimulationOpts struct { } func (opts *getOutageSimulationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -208,7 +208,7 @@ type startOutageSimulationOpts struct { } func (opts *startOutageSimulationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 8213b38663..07b3a07f4c 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -43,7 +43,7 @@ type createClusterOpts struct { } func (opts *createClusterOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -153,7 +153,7 @@ type deleteClusterOpts struct { } func (opts *deleteClusterOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -212,7 +212,7 @@ type getClusterOpts struct { } func (opts *getClusterOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -294,7 +294,7 @@ type getClusterAdvancedConfigurationOpts struct { } func (opts *getClusterAdvancedConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -376,7 +376,7 @@ type getClusterStatusOpts struct { } func (opts *getClusterStatusOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -458,7 +458,7 @@ type getSampleDatasetLoadStatusOpts struct { } func (opts *getSampleDatasetLoadStatusOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -544,7 +544,7 @@ type listCloudProviderRegionsOpts struct { } func (opts *listCloudProviderRegionsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -636,7 +636,7 @@ type listClustersOpts struct { } func (opts *listClustersOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -724,7 +724,7 @@ type listClustersForAllProjectsOpts struct { } func (opts *listClustersForAllProjectsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -796,7 +796,7 @@ type loadSampleDatasetOpts struct { } func (opts *loadSampleDatasetOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -876,7 +876,7 @@ type testFailoverOpts struct { } func (opts *testFailoverOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -936,7 +936,7 @@ type updateClusterOpts struct { } func (opts *updateClusterOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1053,7 +1053,7 @@ type updateClusterAdvancedConfigurationOpts struct { } func (opts *updateClusterAdvancedConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1169,7 +1169,7 @@ type upgradeSharedClusterOpts struct { } func (opts *upgradeSharedClusterOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1282,7 +1282,7 @@ type upgradeSharedClusterToServerlessOpts struct { } func (opts *upgradeSharedClusterToServerlessOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 8db099dac2..87177c858a 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -43,7 +43,7 @@ type createCustomDatabaseRoleOpts struct { } func (opts *createCustomDatabaseRoleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -152,7 +152,7 @@ type deleteCustomDatabaseRoleOpts struct { } func (opts *deleteCustomDatabaseRoleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -209,7 +209,7 @@ type getCustomDatabaseRoleOpts struct { } func (opts *getCustomDatabaseRoleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -290,7 +290,7 @@ type listCustomDatabaseRolesOpts struct { } func (opts *listCustomDatabaseRolesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -372,7 +372,7 @@ type updateCustomDatabaseRoleOpts struct { } func (opts *updateCustomDatabaseRoleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index e5095906b1..c0609a0b79 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -43,7 +43,7 @@ type createDataFederationPrivateEndpointOpts struct { } func (opts *createDataFederationPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -157,7 +157,7 @@ type createFederatedDatabaseOpts struct { } func (opts *createFederatedDatabaseOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -275,7 +275,7 @@ type createOneDataFederationQueryLimitOpts struct { } func (opts *createOneDataFederationQueryLimitOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -400,7 +400,7 @@ type deleteDataFederationPrivateEndpointOpts struct { } func (opts *deleteDataFederationPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -482,7 +482,7 @@ type deleteFederatedDatabaseOpts struct { } func (opts *deleteFederatedDatabaseOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -565,7 +565,7 @@ type deleteOneDataFederationInstanceQueryLimitOpts struct { } func (opts *deleteOneDataFederationInstanceQueryLimitOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -660,7 +660,7 @@ type downloadFederatedDatabaseQueryLogsOpts struct { } func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -746,7 +746,7 @@ type getDataFederationPrivateEndpointOpts struct { } func (opts *getDataFederationPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -828,7 +828,7 @@ type getFederatedDatabaseOpts struct { } func (opts *getFederatedDatabaseOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -912,7 +912,7 @@ type listDataFederationPrivateEndpointsOpts struct { } func (opts *listDataFederationPrivateEndpointsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -997,7 +997,7 @@ type listFederatedDatabasesOpts struct { } func (opts *listFederatedDatabasesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1079,7 +1079,7 @@ type returnFederatedDatabaseQueryLimitOpts struct { } func (opts *returnFederatedDatabaseQueryLimitOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1172,7 +1172,7 @@ type returnFederatedDatabaseQueryLimitsOpts struct { } func (opts *returnFederatedDatabaseQueryLimitsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1258,7 +1258,7 @@ type updateFederatedDatabaseOpts struct { } func (opts *updateFederatedDatabaseOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 90bf6b3e0a..b7246d4d82 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -44,7 +44,7 @@ type createPipelineOpts struct { } func (opts *createPipelineOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -155,7 +155,7 @@ type deletePipelineOpts struct { } func (opts *deletePipelineOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -238,7 +238,7 @@ type deletePipelineRunDatasetOpts struct { } func (opts *deletePipelineRunDatasetOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -323,7 +323,7 @@ type getPipelineOpts struct { } func (opts *getPipelineOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -406,7 +406,7 @@ type getPipelineRunOpts struct { } func (opts *getPipelineRunOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -495,7 +495,7 @@ type listPipelineRunsOpts struct { } func (opts *listPipelineRunsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -594,7 +594,7 @@ type listPipelineSchedulesOpts struct { } func (opts *listPipelineSchedulesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -680,7 +680,7 @@ type listPipelineSnapshotsOpts struct { } func (opts *listPipelineSnapshotsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -778,7 +778,7 @@ type listPipelinesOpts struct { } func (opts *listPipelinesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -857,7 +857,7 @@ type pausePipelineOpts struct { } func (opts *pausePipelineOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -939,7 +939,7 @@ type resumePipelineOpts struct { } func (opts *resumePipelineOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1024,7 +1024,7 @@ type triggerSnapshotIngestionOpts struct { } func (opts *triggerSnapshotIngestionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1141,7 +1141,7 @@ type updatePipelineOpts struct { } func (opts *updatePipelineOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index d34fd3c8e1..b7d26c80c9 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -43,7 +43,7 @@ type createDatabaseUserOpts struct { } func (opts *createDatabaseUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -155,7 +155,7 @@ type deleteDatabaseUserOpts struct { } func (opts *deleteDatabaseUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -253,7 +253,7 @@ type getDatabaseUserOpts struct { } func (opts *getDatabaseUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -352,7 +352,7 @@ type listDatabaseUsersOpts struct { } func (opts *listDatabaseUsersOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -441,7 +441,7 @@ type updateDatabaseUserOpts struct { } func (opts *updateDatabaseUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index 25f57ce5c7..70cf96b190 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -40,7 +40,7 @@ type getEncryptionAtRestOpts struct { } func (opts *getEncryptionAtRestOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -121,7 +121,7 @@ type updateEncryptionAtRestOpts struct { } func (opts *updateEncryptionAtRestOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index c6ae375b37..638086a2c8 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -42,7 +42,7 @@ type getOrganizationEventOpts struct { } func (opts *getOrganizationEventOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -127,7 +127,7 @@ type getProjectEventOpts struct { } func (opts *getProjectEventOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -217,7 +217,7 @@ type listOrganizationEventsOpts struct { } func (opts *listOrganizationEventsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -338,7 +338,7 @@ type listProjectEventsOpts struct { } func (opts *listProjectEventsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index dfc0dbf2ce..aa5358702b 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -44,7 +44,7 @@ type createRoleMappingOpts struct { } func (opts *createRoleMappingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -155,7 +155,7 @@ type deleteFederationAppOpts struct { } func (opts *deleteFederationAppOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -198,7 +198,7 @@ type deleteRoleMappingOpts struct { } func (opts *deleteRoleMappingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -258,7 +258,7 @@ type getConnectedOrgConfigOpts struct { } func (opts *getConnectedOrgConfigOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -329,7 +329,7 @@ type getFederationSettingsOpts struct { } func (opts *getFederationSettingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -408,7 +408,7 @@ type getIdentityProviderOpts struct { } func (opts *getIdentityProviderOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -480,7 +480,7 @@ type getIdentityProviderMetadataOpts struct { } func (opts *getIdentityProviderMetadataOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -553,7 +553,7 @@ type getRoleMappingOpts struct { } func (opts *getRoleMappingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -637,7 +637,7 @@ type listConnectedOrgConfigsOpts struct { } func (opts *listConnectedOrgConfigsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -705,7 +705,7 @@ type listIdentityProvidersOpts struct { } func (opts *listIdentityProvidersOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -774,7 +774,7 @@ type listRoleMappingsOpts struct { } func (opts *listRoleMappingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -856,7 +856,7 @@ type removeConnectedOrgConfigOpts struct { } func (opts *removeConnectedOrgConfigOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -931,7 +931,7 @@ type updateConnectedOrgConfigOpts struct { } func (opts *updateConnectedOrgConfigOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1038,7 +1038,7 @@ type updateIdentityProviderOpts struct { } func (opts *updateIdentityProviderOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1146,7 +1146,7 @@ type updateRoleMappingOpts struct { } func (opts *updateRoleMappingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index ea81cbb8eb..99e5e58ac3 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -44,7 +44,7 @@ type createCustomZoneMappingOpts struct { } func (opts *createCustomZoneMappingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -161,7 +161,7 @@ type createManagedNamespaceOpts struct { } func (opts *createManagedNamespaceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -275,7 +275,7 @@ type deleteAllCustomZoneMappingsOpts struct { } func (opts *deleteAllCustomZoneMappingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -359,7 +359,7 @@ type deleteManagedNamespaceOpts struct { } func (opts *deleteManagedNamespaceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -445,7 +445,7 @@ type getManagedNamespaceOpts struct { } func (opts *getManagedNamespaceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index 3b51cae801..8d39109e8c 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -43,7 +43,7 @@ type createCostExplorerQueryProcessOpts struct { } func (opts *createCostExplorerQueryProcessOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -154,7 +154,7 @@ type createCostExplorerQueryProcess1Opts struct { } func (opts *createCostExplorerQueryProcess1Opts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -236,7 +236,7 @@ type downloadInvoiceCSVOpts struct { } func (opts *downloadInvoiceCSVOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -318,7 +318,7 @@ type getInvoiceOpts struct { } func (opts *getInvoiceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -402,7 +402,7 @@ type listInvoicesOpts struct { } func (opts *listInvoicesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -486,7 +486,7 @@ type listPendingInvoicesOpts struct { } func (opts *listPendingInvoicesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 680120dc73..e804a1b581 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -40,7 +40,7 @@ type deleteLDAPConfigurationOpts struct { } func (opts *deleteLDAPConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -118,7 +118,7 @@ type getLDAPConfigurationOpts struct { } func (opts *getLDAPConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -197,7 +197,7 @@ type getLDAPConfigurationStatusOpts struct { } func (opts *getLDAPConfigurationStatusOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -281,7 +281,7 @@ type saveLDAPConfigurationOpts struct { } func (opts *saveLDAPConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -394,7 +394,7 @@ type verifyLDAPConfigurationOpts struct { } func (opts *verifyLDAPConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index deebd2c5d2..6650fea9a3 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -42,7 +42,7 @@ type deleteLegacySnapshotOpts struct { } func (opts *deleteLegacySnapshotOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -128,7 +128,7 @@ type getLegacyBackupCheckpointOpts struct { } func (opts *getLegacyBackupCheckpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -214,7 +214,7 @@ type getLegacyBackupRestoreJobOpts struct { } func (opts *getLegacyBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -300,7 +300,7 @@ type getLegacySnapshotOpts struct { } func (opts *getLegacySnapshotOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -385,7 +385,7 @@ type getLegacySnapshotScheduleOpts struct { } func (opts *getLegacySnapshotScheduleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -470,7 +470,7 @@ type listLegacyBackupCheckpointsOpts struct { } func (opts *listLegacyBackupCheckpointsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -562,7 +562,7 @@ type listLegacyBackupRestoreJobsOpts struct { } func (opts *listLegacyBackupRestoreJobsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -656,7 +656,7 @@ type listLegacySnapshotsOpts struct { } func (opts *listLegacySnapshotsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -750,7 +750,7 @@ type updateLegacySnapshotRetentionOpts struct { } func (opts *updateLegacySnapshotRetentionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -870,7 +870,7 @@ type updateLegacySnapshotScheduleOpts struct { } func (opts *updateLegacySnapshotScheduleOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index 1afea5621e..201d734b12 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -44,7 +44,7 @@ type createLegacyBackupRestoreJobOpts struct { } func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index ca46dd9f52..c0db0ec31e 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -38,7 +38,7 @@ type deferMaintenanceWindowOpts struct { } func (opts *deferMaintenanceWindowOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -91,7 +91,7 @@ type getMaintenanceWindowOpts struct { } func (opts *getMaintenanceWindowOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -167,7 +167,7 @@ type resetMaintenanceWindowOpts struct { } func (opts *resetMaintenanceWindowOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -218,7 +218,7 @@ type toggleMaintenanceAutoDeferOpts struct { } func (opts *toggleMaintenanceAutoDeferOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -274,7 +274,7 @@ type updateMaintenanceWindowOpts struct { } func (opts *updateMaintenanceWindowOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index b527d3ae84..e3894c563a 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -24,6 +24,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" @@ -39,7 +40,7 @@ type createUserOpts struct { } func (opts *createUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -136,7 +137,7 @@ type getUserOpts struct { } func (opts *getUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -204,7 +205,7 @@ type getUserByUsernameOpts struct { } func (opts *getUserByUsernameOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index a54552c8cc..cda0de4103 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -41,7 +41,7 @@ type getAtlasProcessOpts struct { } func (opts *getAtlasProcessOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -124,7 +124,7 @@ type getDatabaseOpts struct { } func (opts *getDatabaseOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -215,7 +215,7 @@ type getDatabaseMeasurementsOpts struct { } func (opts *getDatabaseMeasurementsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -335,7 +335,7 @@ type getDiskMeasurementsOpts struct { } func (opts *getDiskMeasurementsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -452,7 +452,7 @@ type getHostLogsOpts struct { } func (opts *getHostLogsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -546,7 +546,7 @@ type getHostMeasurementsOpts struct { } func (opts *getHostMeasurementsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -665,7 +665,7 @@ type getIndexMetricsOpts struct { } func (opts *getIndexMetricsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -791,7 +791,7 @@ type getMeasurementsOpts struct { } func (opts *getMeasurementsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -905,7 +905,7 @@ type listAtlasProcessesOpts struct { } func (opts *listAtlasProcessesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -993,7 +993,7 @@ type listDatabasesOpts struct { } func (opts *listDatabasesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1082,7 +1082,7 @@ type listDiskMeasurementsOpts struct { } func (opts *listDiskMeasurementsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1170,7 +1170,7 @@ type listDiskPartitionsOpts struct { } func (opts *listDiskPartitionsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1265,7 +1265,7 @@ type listIndexMetricsOpts struct { } func (opts *listIndexMetricsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1383,7 +1383,7 @@ type listMetricTypesOpts struct { } func (opts *listMetricTypesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index 38950c3866..c5ac12b53d 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -43,7 +43,7 @@ type createPeeringConnectionOpts struct { } func (opts *createPeeringConnectionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -156,7 +156,7 @@ type createPeeringContainerOpts struct { } func (opts *createPeeringContainerOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -267,7 +267,7 @@ type deletePeeringConnectionOpts struct { } func (opts *deletePeeringConnectionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -349,7 +349,7 @@ type deletePeeringContainerOpts struct { } func (opts *deletePeeringContainerOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -433,7 +433,7 @@ type disablePeeringOpts struct { } func (opts *disablePeeringOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -544,7 +544,7 @@ type getPeeringConnectionOpts struct { } func (opts *getPeeringConnectionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -626,7 +626,7 @@ type getPeeringContainerOpts struct { } func (opts *getPeeringContainerOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -711,7 +711,7 @@ type listPeeringConnectionsOpts struct { } func (opts *listPeeringConnectionsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -801,7 +801,7 @@ type listPeeringContainerByCloudProviderOpts struct { } func (opts *listPeeringContainerByCloudProviderOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -891,7 +891,7 @@ type listPeeringContainersOpts struct { } func (opts *listPeeringContainersOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -979,7 +979,7 @@ type updatePeeringConnectionOpts struct { } func (opts *updatePeeringConnectionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1096,7 +1096,7 @@ type updatePeeringContainerOpts struct { } func (opts *updatePeeringContainerOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1209,7 +1209,7 @@ type verifyConnectViaPeeringOnlyModeForOneProjectOpts struct { } func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index c630184b36..28280a2a50 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -44,7 +44,7 @@ type createOnlineArchiveOpts struct { } func (opts *createOnlineArchiveOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -159,7 +159,7 @@ type deleteOnlineArchiveOpts struct { } func (opts *deleteOnlineArchiveOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -247,7 +247,7 @@ type downloadOnlineArchiveQueryLogsOpts struct { } func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -336,7 +336,7 @@ type getOnlineArchiveOpts struct { } func (opts *getOnlineArchiveOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -424,7 +424,7 @@ type listOnlineArchivesOpts struct { } func (opts *listOnlineArchivesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -516,7 +516,7 @@ type updateOnlineArchiveOpts struct { } func (opts *updateOnlineArchiveOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index f6a2240b22..26662083ef 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -42,7 +42,7 @@ type createOrganizationOpts struct { } func (opts *createOrganizationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -142,7 +142,7 @@ type createOrganizationInvitationOpts struct { } func (opts *createOrganizationInvitationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -252,7 +252,7 @@ type deleteOrganizationOpts struct { } func (opts *deleteOrganizationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -331,7 +331,7 @@ type deleteOrganizationInvitationOpts struct { } func (opts *deleteOrganizationInvitationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -412,7 +412,7 @@ type getOrganizationOpts struct { } func (opts *getOrganizationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -491,7 +491,7 @@ type getOrganizationInvitationOpts struct { } func (opts *getOrganizationInvitationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -572,7 +572,7 @@ type getOrganizationSettingsOpts struct { } func (opts *getOrganizationSettingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -651,7 +651,7 @@ type listOrganizationInvitationsOpts struct { } func (opts *listOrganizationInvitationsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -735,7 +735,7 @@ type listOrganizationProjectsOpts struct { } func (opts *listOrganizationProjectsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -824,7 +824,7 @@ type listOrganizationUsersOpts struct { } func (opts *listOrganizationUsersOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -911,7 +911,7 @@ type listOrganizationsOpts struct { } func (opts *listOrganizationsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -985,7 +985,7 @@ type removeOrganizationUserOpts struct { } func (opts *removeOrganizationUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1069,7 +1069,7 @@ type renameOrganizationOpts struct { } func (opts *renameOrganizationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1182,7 +1182,7 @@ type updateOrganizationInvitationOpts struct { } func (opts *updateOrganizationInvitationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1296,7 +1296,7 @@ type updateOrganizationInvitationByIdOpts struct { } func (opts *updateOrganizationInvitationByIdOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1413,7 +1413,7 @@ type updateOrganizationRolesOpts struct { } func (opts *updateOrganizationRolesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1529,7 +1529,7 @@ type updateOrganizationSettingsOpts struct { } func (opts *updateOrganizationSettingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index 859ed737ab..dacca6cb4b 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -37,7 +37,7 @@ type disableSlowOperationThresholdingOpts struct { } func (opts *disableSlowOperationThresholdingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -88,7 +88,7 @@ type enableSlowOperationThresholdingOpts struct { } func (opts *enableSlowOperationThresholdingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -146,7 +146,7 @@ type listSlowQueriesOpts struct { } func (opts *listSlowQueriesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -244,7 +244,7 @@ type listSlowQueryNamespacesOpts struct { } func (opts *listSlowQueryNamespacesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -344,7 +344,7 @@ type listSuggestedIndexesOpts struct { } func (opts *listSuggestedIndexesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 577caee161..66129c185e 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -45,7 +45,7 @@ type createPrivateEndpointOpts struct { } func (opts *createPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -164,7 +164,7 @@ type createPrivateEndpointServiceOpts struct { } func (opts *createPrivateEndpointServiceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -277,7 +277,7 @@ type deletePrivateEndpointOpts struct { } func (opts *deletePrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -366,7 +366,7 @@ type deletePrivateEndpointServiceOpts struct { } func (opts *deletePrivateEndpointServiceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -453,7 +453,7 @@ type getPrivateEndpointOpts struct { } func (opts *getPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -542,7 +542,7 @@ type getPrivateEndpointServiceOpts struct { } func (opts *getPrivateEndpointServiceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -626,7 +626,7 @@ type getRegionalizedPrivateEndpointSettingOpts struct { } func (opts *getRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -705,7 +705,7 @@ type listPrivateEndpointServicesOpts struct { } func (opts *listPrivateEndpointServicesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -789,7 +789,7 @@ type toggleRegionalizedPrivateEndpointSettingOpts struct { } func (opts *toggleRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index c868c56918..d0c92bda08 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -44,7 +44,7 @@ type addProjectApiKeyOpts struct { } func (opts *addProjectApiKeyOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -160,7 +160,7 @@ type createApiKeyOpts struct { } func (opts *createApiKeyOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -277,7 +277,7 @@ type createApiKeyAccessListOpts struct { } func (opts *createApiKeyAccessListOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -400,7 +400,7 @@ type createProjectApiKeyOpts struct { } func (opts *createProjectApiKeyOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -511,7 +511,7 @@ type deleteApiKeyOpts struct { } func (opts *deleteApiKeyOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -594,7 +594,7 @@ type deleteApiKeyAccessListEntryOpts struct { } func (opts *deleteApiKeyAccessListEntryOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -679,7 +679,7 @@ type getApiKeyOpts struct { } func (opts *getApiKeyOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -762,7 +762,7 @@ type getApiKeyAccessListOpts struct { } func (opts *getApiKeyAccessListOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -850,7 +850,7 @@ type listApiKeyAccessListsEntriesOpts struct { } func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -940,7 +940,7 @@ type listApiKeysOpts struct { } func (opts *listApiKeysOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1027,7 +1027,7 @@ type listProjectApiKeysOpts struct { } func (opts *listProjectApiKeysOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1112,7 +1112,7 @@ type removeProjectApiKeyOpts struct { } func (opts *removeProjectApiKeyOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1197,7 +1197,7 @@ type updateApiKeyOpts struct { } func (opts *updateApiKeyOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1317,7 +1317,7 @@ type updateApiKeyRolesOpts struct { } func (opts *updateApiKeyRolesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 808685abbf..076e95727a 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -46,7 +46,7 @@ type createProjectIpAccessListOpts struct { } func (opts *createProjectIpAccessListOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -164,7 +164,7 @@ type deleteProjectIpAccessListOpts struct { } func (opts *deleteProjectIpAccessListOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -250,7 +250,7 @@ type getProjectIpAccessListStatusOpts struct { } func (opts *getProjectIpAccessListStatusOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -332,7 +332,7 @@ type getProjectIpListOpts struct { } func (opts *getProjectIpListOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -416,7 +416,7 @@ type listProjectIpAccessListsOpts struct { } func (opts *listProjectIpAccessListsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index b05d4873f8..1145220378 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -43,7 +43,7 @@ type createProjectOpts struct { } func (opts *createProjectOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -146,7 +146,7 @@ type createProjectInvitationOpts struct { } func (opts *createProjectInvitationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -256,7 +256,7 @@ type deleteProjectOpts struct { } func (opts *deleteProjectOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -335,7 +335,7 @@ type deleteProjectInvitationOpts struct { } func (opts *deleteProjectInvitationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -417,7 +417,7 @@ type deleteProjectLimitOpts struct { } func (opts *deleteProjectLimitOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -514,7 +514,7 @@ type getProjectOpts struct { } func (opts *getProjectOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -592,7 +592,7 @@ type getProjectByNameOpts struct { } func (opts *getProjectByNameOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -661,7 +661,7 @@ type getProjectInvitationOpts struct { } func (opts *getProjectInvitationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -743,7 +743,7 @@ type getProjectLimitOpts struct { } func (opts *getProjectLimitOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -840,7 +840,7 @@ type getProjectSettingsOpts struct { } func (opts *getProjectSettingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -919,7 +919,7 @@ type listProjectInvitationsOpts struct { } func (opts *listProjectInvitationsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -999,7 +999,7 @@ type listProjectLimitsOpts struct { } func (opts *listProjectLimitsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1082,7 +1082,7 @@ type listProjectUsersOpts struct { } func (opts *listProjectUsersOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1172,7 +1172,7 @@ type listProjectsOpts struct { } func (opts *listProjectsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1242,7 +1242,7 @@ type removeProjectUserOpts struct { } func (opts *removeProjectUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1302,7 +1302,7 @@ type setProjectLimitOpts struct { } func (opts *setProjectLimitOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1434,7 +1434,7 @@ type updateProjectOpts struct { } func (opts *updateProjectOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1547,7 +1547,7 @@ type updateProjectInvitationOpts struct { } func (opts *updateProjectInvitationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1661,7 +1661,7 @@ type updateProjectInvitationByIdOpts struct { } func (opts *updateProjectInvitationByIdOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1778,7 +1778,7 @@ type updateProjectRolesOpts struct { } func (opts *updateProjectRolesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1894,7 +1894,7 @@ type updateProjectSettingsOpts struct { } func (opts *updateProjectSettingsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index dc6e45900d..b71cae367c 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -41,7 +41,7 @@ type createPushBasedLogConfigurationOpts struct { } func (opts *createPushBasedLogConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -124,7 +124,7 @@ type deletePushBasedLogConfigurationOpts struct { } func (opts *deletePushBasedLogConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -177,7 +177,7 @@ type getPushBasedLogConfigurationOpts struct { } func (opts *getPushBasedLogConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -256,7 +256,7 @@ type updatePushBasedLogConfigurationOpts struct { } func (opts *updatePushBasedLogConfigurationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 5d0ee4e5db..34abe47e9b 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -40,7 +40,7 @@ type createRollingIndexOpts struct { } func (opts *createRollingIndexOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index a0d76e3f0d..f4cf07156e 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -24,6 +24,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20230201008/admin" ) @@ -35,7 +36,7 @@ type getSystemStatusOpts struct { } func (opts *getSystemStatusOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index 9e67aa3312..1ba5abca26 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -43,7 +43,7 @@ type createServerlessInstanceOpts struct { } func (opts *createServerlessInstanceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -154,7 +154,7 @@ type deleteServerlessInstanceOpts struct { } func (opts *deleteServerlessInstanceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -236,7 +236,7 @@ type getServerlessInstanceOpts struct { } func (opts *getServerlessInstanceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -320,7 +320,7 @@ type listServerlessInstancesOpts struct { } func (opts *listServerlessInstancesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -408,7 +408,7 @@ type updateServerlessInstanceOpts struct { } func (opts *updateServerlessInstanceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index f108ba61ff..81b5b5273c 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -44,7 +44,7 @@ type createServerlessPrivateEndpointOpts struct { } func (opts *createServerlessPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -159,7 +159,7 @@ type deleteServerlessPrivateEndpointOpts struct { } func (opts *deleteServerlessPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -245,7 +245,7 @@ type getServerlessPrivateEndpointOpts struct { } func (opts *getServerlessPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -330,7 +330,7 @@ type listServerlessPrivateEndpointsOpts struct { } func (opts *listServerlessPrivateEndpointsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -416,7 +416,7 @@ type updateServerlessPrivateEndpointOpts struct { } func (opts *updateServerlessPrivateEndpointOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index 046eabd3c0..4b269113f4 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -44,7 +44,7 @@ type createSharedClusterBackupRestoreJobOpts struct { } func (opts *createSharedClusterBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -159,7 +159,7 @@ type getSharedClusterBackupRestoreJobOpts struct { } func (opts *getSharedClusterBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -244,7 +244,7 @@ type listSharedClusterBackupRestoreJobsOpts struct { } func (opts *listSharedClusterBackupRestoreJobsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index c2311ecc14..f389089467 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -44,7 +44,7 @@ type downloadSharedClusterBackupOpts struct { } func (opts *downloadSharedClusterBackupOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -159,7 +159,7 @@ type getSharedClusterBackupOpts struct { } func (opts *getSharedClusterBackupOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -244,7 +244,7 @@ type listSharedClusterBackupsOpts struct { } func (opts *listSharedClusterBackupsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index 15306a12b5..ac061312da 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -44,7 +44,7 @@ type createStreamConnectionOpts struct { } func (opts *createStreamConnectionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -160,7 +160,7 @@ type createStreamInstanceOpts struct { } func (opts *createStreamInstanceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -272,7 +272,7 @@ type deleteStreamConnectionOpts struct { } func (opts *deleteStreamConnectionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -357,7 +357,7 @@ type deleteStreamInstanceOpts struct { } func (opts *deleteStreamInstanceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -440,7 +440,7 @@ type getStreamConnectionOpts struct { } func (opts *getStreamConnectionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -526,7 +526,7 @@ type getStreamInstanceOpts struct { } func (opts *getStreamInstanceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -612,7 +612,7 @@ type listStreamConnectionsOpts struct { } func (opts *listStreamConnectionsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -699,7 +699,7 @@ type listStreamInstancesOpts struct { } func (opts *listStreamInstancesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -786,7 +786,7 @@ type updateStreamConnectionOpts struct { } func (opts *updateStreamConnectionOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -906,7 +906,7 @@ type updateStreamInstanceOpts struct { } func (opts *updateStreamInstanceOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index 8af70d1175..79917d63da 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -43,7 +43,7 @@ type addAllTeamsToProjectOpts struct { } func (opts *addAllTeamsToProjectOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -157,7 +157,7 @@ type addTeamUserOpts struct { } func (opts *addTeamUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -273,7 +273,7 @@ type createTeamOpts struct { } func (opts *createTeamOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -384,7 +384,7 @@ type deleteTeamOpts struct { } func (opts *deleteTeamOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -466,7 +466,7 @@ type getTeamByIdOpts struct { } func (opts *getTeamByIdOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -548,7 +548,7 @@ type getTeamByNameOpts struct { } func (opts *getTeamByNameOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -632,7 +632,7 @@ type listOrganizationTeamsOpts struct { } func (opts *listOrganizationTeamsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -719,7 +719,7 @@ type listProjectTeamsOpts struct { } func (opts *listProjectTeamsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -806,7 +806,7 @@ type listTeamUsersOpts struct { } func (opts *listTeamUsersOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -890,7 +890,7 @@ type removeProjectTeamOpts struct { } func (opts *removeProjectTeamOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -946,7 +946,7 @@ type removeTeamUserOpts struct { } func (opts *removeTeamUserOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1009,7 +1009,7 @@ type renameTeamOpts struct { } func (opts *renameTeamOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -1126,7 +1126,7 @@ type updateTeamRolesOpts struct { } func (opts *updateTeamRolesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 158dde0be9..33b5a4de24 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -47,7 +47,7 @@ type createThirdPartyIntegrationOpts struct { } func (opts *createThirdPartyIntegrationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -168,7 +168,7 @@ type deleteThirdPartyIntegrationOpts struct { } func (opts *deleteThirdPartyIntegrationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -250,7 +250,7 @@ type getThirdPartyIntegrationOpts struct { } func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -334,7 +334,7 @@ type listThirdPartyIntegrationsOpts struct { } func (opts *listThirdPartyIntegrationsOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -425,7 +425,7 @@ type updateThirdPartyIntegrationOpts struct { } func (opts *updateThirdPartyIntegrationOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index 3ca68e5b8d..ed3b2b3620 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -44,7 +44,7 @@ type createDatabaseUserCertificateOpts struct { } func (opts *createDatabaseUserCertificateOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -157,7 +157,7 @@ type disableCustomerManagedX509Opts struct { } func (opts *disableCustomerManagedX509Opts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } @@ -239,7 +239,7 @@ type listDatabaseUserCertificatesOpts struct { } func (opts *listDatabaseUserCertificatesOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } diff --git a/internal/api/client.go b/internal/api/client.go new file mode 100644 index 0000000000..740606760d --- /dev/null +++ b/internal/api/client.go @@ -0,0 +1,128 @@ +// Copyright 2023 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "time" + "net" + "net/http" + + "github.com/mongodb-forks/digest" + "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas/auth" + "github.com/mongodb/mongodb-atlas-cli/internal/log" +) + +const ( + cloudGovServiceURL = "https://cloud.mongodbgov.com/" + cloudGovService = "cloudgov" + timeout = 5 * time.Second + keepAlive = 30 * time.Second + maxIdleConns = 5 + maxIdleConnsPerHost = 4 + idleConnTimeout = 30 * time.Second + expectContinueTimeout = 1 * time.Second +) + +type profileReader interface { + PublicAPIKey() string + PrivateAPIKey() string + Token() (*auth.Token, error) + OpsManagerURL() string + Service() string +} + +func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { + httpTransport := &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: timeout, + KeepAlive: keepAlive, + }).DialContext, + MaxIdleConns: maxIdleConns, + MaxIdleConnsPerHost: maxIdleConnsPerHost, + Proxy: http.ProxyFromEnvironment, + IdleConnTimeout: idleConnTimeout, + ExpectContinueTimeout: expectContinueTimeout, + } + + if username == "" && password == "" && accessToken == nil { + return &http.Client{Transport: httpTransport}, nil + } + if username != "" && password != "" { + t := &digest.Transport{ + Username: username, + Password: password, + } + t.Transport = httpTransport + return t.Client() + } + tr := &transport{ + token: accessToken, + base: httpTransport, + } + + return &http.Client{Transport: tr}, nil +} + +func newClientWithAuth(userAgent string, profile profileReader) (*admin.APIClient, error) { + var authToken *auth.Token + + username := profile.PublicAPIKey() + password := profile.PrivateAPIKey() + + if username == "" && password == "" { + var err error + authToken, err = profile.Token() + if err != nil { + return nil, err + } + } + + baseURL := profile.OpsManagerURL() + if baseURL == "" && profile.Service() == cloudGovService { + baseURL = cloudGovServiceURL + } + + client, err := httpClient(username, password, authToken) + if err != nil { + return nil, err + } + + opts := []admin.ClientModifier{ + admin.UseHTTPClient(client), + admin.UseUserAgent(userAgent), + admin.UseDebug(log.IsDebugLevel())} + + if baseURL != "" { + opts = append(opts, admin.UseBaseURL(baseURL)) + } + c, err := admin.NewClient(opts...) + if err != nil { + return nil, err + } + return c, nil +} + +type transport struct { + token *auth.Token + base http.RoundTripper +} + +func (tr *transport) RoundTrip(req *http.Request) (*http.Response, error) { + tr.token.SetAuthHeader(req) + return tr.base.RoundTrip(req) +} diff --git a/tools/openapi-generator/config/.openapi-generator-ignore b/tools/openapi-generator/config/.openapi-generator-ignore index 856ce9c953..83365f7a8a 100644 --- a/tools/openapi-generator/config/.openapi-generator-ignore +++ b/tools/openapi-generator/config/.openapi-generator-ignore @@ -2,3 +2,4 @@ *.* !*_cmd.go !api.go +!client.go diff --git a/tools/openapi-generator/config/config.yaml b/tools/openapi-generator/config/config.yaml index 2947180f5a..93c982245c 100644 --- a/tools/openapi-generator/config/config.yaml +++ b/tools/openapi-generator/config/config.yaml @@ -13,3 +13,6 @@ files: api.mustache: destinationFilename: api.go templateType: SupportingFiles + client.mustache: + destinationFilename: client.go + templateType: SupportingFiles diff --git a/tools/openapi-generator/config/go-templates/api.mustache b/tools/openapi-generator/config/go-templates/api.mustache index 42c6c969a4..b14da4a9a6 100644 --- a/tools/openapi-generator/config/go-templates/api.mustache +++ b/tools/openapi-generator/config/go-templates/api.mustache @@ -2,111 +2,9 @@ package {{packageName}} import ( - "time" - "net" - "net/http" - "github.com/spf13/cobra" - "github.com/mongodb-forks/digest" - "go.mongodb.org/atlas-sdk/v20230201008/admin" - "go.mongodb.org/atlas/auth" - "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/config" - "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/log" -) - -const ( - cloudGovServiceURL = "https://cloud.mongodbgov.com/" - timeout = 5 * time.Second - keepAlive = 30 * time.Second - maxIdleConns = 5 - maxIdleConnsPerHost = 4 - idleConnTimeout = 30 * time.Second - expectContinueTimeout = 1 * time.Second ) -func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { - httpTransport := &http.Transport{ - DialContext: (&net.Dialer{ - Timeout: timeout, - KeepAlive: keepAlive, - }).DialContext, - MaxIdleConns: maxIdleConns, - MaxIdleConnsPerHost: maxIdleConnsPerHost, - Proxy: http.ProxyFromEnvironment, - IdleConnTimeout: idleConnTimeout, - ExpectContinueTimeout: expectContinueTimeout, - } - - if username == "" && password == "" && accessToken == nil { - return &http.Client{Transport: httpTransport}, nil - } - if username != "" && password != "" { - t := &digest.Transport{ - Username: username, - Password: password, - } - t.Transport = httpTransport - return t.Client() - } - tr := &Transport{ - token: accessToken, - base: httpTransport, - } - - return &http.Client{Transport: tr}, nil -} - -func newClientWithAuth() (*admin.APIClient, error) { - profile := config.Default() - - var authToken *auth.Token - - username := profile.PublicAPIKey() - password := profile.PrivateAPIKey() - - if username == "" && password == "" { - var err error - authToken, err = profile.Token() - if err != nil { - return nil, err - } - } - - baseURL := profile.OpsManagerURL() - if baseURL == "" && profile.Service() == config.CloudGovService { - baseURL = cloudGovServiceURL - } - - client, err := httpClient(username, password, authToken) - if err != nil { - return nil, err - } - - opts := []admin.ClientModifier{ - admin.UseHTTPClient(client), - admin.UseUserAgent(config.UserAgent), - admin.UseDebug(log.IsDebugLevel())} - - if baseURL != "" { - opts = append(opts, admin.UseBaseURL(baseURL)) - } - c, err := admin.NewClient(opts...) - if err != nil { - return nil, err - } - return c, nil -} - -type Transport struct { - token *auth.Token - base http.RoundTripper -} - -func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error) { - tr.token.SetAuthHeader(req) - return tr.base.RoundTrip(req) -} - func Builder() *cobra.Command { const use = "api" cmd := &cobra.Command{ diff --git a/tools/openapi-generator/config/go-templates/client.mustache b/tools/openapi-generator/config/go-templates/client.mustache new file mode 100644 index 0000000000..ccc2ff71ef --- /dev/null +++ b/tools/openapi-generator/config/go-templates/client.mustache @@ -0,0 +1,113 @@ +{{>partial_header}} +package {{packageName}} + +import ( + "time" + "net" + "net/http" + + "github.com/mongodb-forks/digest" + "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-sdk-import}}{{/apis.0}}{{/apiInfo}}" + "go.mongodb.org/atlas/auth" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/log" +) + +const ( + cloudGovServiceURL = "https://cloud.mongodbgov.com/" + cloudGovService = "cloudgov" + timeout = 5 * time.Second + keepAlive = 30 * time.Second + maxIdleConns = 5 + maxIdleConnsPerHost = 4 + idleConnTimeout = 30 * time.Second + expectContinueTimeout = 1 * time.Second +) + +type profileReader interface { + PublicAPIKey() string + PrivateAPIKey() string + Token() (*auth.Token, error) + OpsManagerURL() string + Service() string +} + +func httpClient(username, password string, accessToken *auth.Token) (*http.Client, error) { + httpTransport := &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: timeout, + KeepAlive: keepAlive, + }).DialContext, + MaxIdleConns: maxIdleConns, + MaxIdleConnsPerHost: maxIdleConnsPerHost, + Proxy: http.ProxyFromEnvironment, + IdleConnTimeout: idleConnTimeout, + ExpectContinueTimeout: expectContinueTimeout, + } + + if username == "" && password == "" && accessToken == nil { + return &http.Client{Transport: httpTransport}, nil + } + if username != "" && password != "" { + t := &digest.Transport{ + Username: username, + Password: password, + } + t.Transport = httpTransport + return t.Client() + } + tr := &transport{ + token: accessToken, + base: httpTransport, + } + + return &http.Client{Transport: tr}, nil +} + +func newClientWithAuth(userAgent string, profile profileReader) (*admin.APIClient, error) { + var authToken *auth.Token + + username := profile.PublicAPIKey() + password := profile.PrivateAPIKey() + + if username == "" && password == "" { + var err error + authToken, err = profile.Token() + if err != nil { + return nil, err + } + } + + baseURL := profile.OpsManagerURL() + if baseURL == "" && profile.Service() == cloudGovService { + baseURL = cloudGovServiceURL + } + + client, err := httpClient(username, password, authToken) + if err != nil { + return nil, err + } + + opts := []admin.ClientModifier{ + admin.UseHTTPClient(client), + admin.UseUserAgent(userAgent), + admin.UseDebug(log.IsDebugLevel())} + + if baseURL != "" { + opts = append(opts, admin.UseBaseURL(baseURL)) + } + c, err := admin.NewClient(opts...) + if err != nil { + return nil, err + } + return c, nil +} + +type transport struct { + token *auth.Token + base http.RoundTripper +} + +func (tr *transport) RoundTrip(req *http.Request) (*http.Response, error) { + tr.token.SetAuthHeader(req) + return tr.base.RoundTrip(req) +} diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index b27321a221..81aed184a8 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -37,7 +37,7 @@ type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { } func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) preRun() (err error) { - if opts.client, err = newClientWithAuth(); err != nil { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err } From a9d619ef17edbc47d089ba2d1c98a612a47806bf Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Tue, 3 Oct 2023 13:04:50 +0100 Subject: [PATCH 36/44] fix sdkImport --- tools/openapi-generator/config/atlas-api-changes.yaml | 1 - tools/openapi-generator/config/atlas-api-transformed.yaml | 1 - .../openapi-generator/config/go-templates/client.mustache | 2 +- tools/openapi-generator/config/go-templates/cmd.mustache | 2 +- tools/openapi-generator/package.json | 8 ++++---- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/openapi-generator/config/atlas-api-changes.yaml b/tools/openapi-generator/config/atlas-api-changes.yaml index d4f1c5783a..bdf5da47f9 100644 --- a/tools/openapi-generator/config/atlas-api-changes.yaml +++ b/tools/openapi-generator/config/atlas-api-changes.yaml @@ -1,4 +1,3 @@ -x-sdk-import: ${SDKIMPORT}/admin paths: "/api/atlas/v2/groups/{groupId}/clusters": post: diff --git a/tools/openapi-generator/config/atlas-api-transformed.yaml b/tools/openapi-generator/config/atlas-api-transformed.yaml index ecd88472f5..89c66b779f 100644 --- a/tools/openapi-generator/config/atlas-api-transformed.yaml +++ b/tools/openapi-generator/config/atlas-api-transformed.yaml @@ -28869,4 +28869,3 @@ components: DigestAuth: scheme: digest type: http -x-sdk-import: go.mongodb.org/atlas-sdk/v20230201008/admin diff --git a/tools/openapi-generator/config/go-templates/client.mustache b/tools/openapi-generator/config/go-templates/client.mustache index ccc2ff71ef..33756840ed 100644 --- a/tools/openapi-generator/config/go-templates/client.mustache +++ b/tools/openapi-generator/config/go-templates/client.mustache @@ -7,7 +7,7 @@ import ( "net/http" "github.com/mongodb-forks/digest" - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-sdk-import}}{{/apis.0}}{{/apiInfo}}" + "{{sdkImport}}/admin" "go.mongodb.org/atlas/auth" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/log" ) diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 81aed184a8..bcfb9a3c37 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -15,7 +15,7 @@ import ( "github.com/spf13/afero" "github.com/spf13/cobra" - "{{vendorExtensions.x-sdk-import}}" + "{{sdkImport}}/admin" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/config" ) diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index 585f6d2d54..05c6544380 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -2,13 +2,13 @@ "name": "openapi-generator", "version": "1.0.0", "description": "OpenAPI Generator for MongoDB Atlas CLI", + "private": true, "scripts": { - "generate:clear": "rm -rf ../../internal/api", + "generate:clear": "rm -rf ../../internal/api && mkdir -p ../../internal/api && cp config/.openapi-generator-ignore ../../internal/api", "generate:download": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); curl -L -o config/atlas-api.yaml \"https://raw.githubusercontent.com/mongodb/atlas-sdk-go/$SDKVERSION/openapi/atlas-api-transformed.yaml\"", "generate:transform": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $1}'); node merge.js", - "generate:init": "mkdir -p ../../internal/api && cp ./config/.openapi-generator-ignore ../../internal/api/.openapi-generator-ignore", - "generate:run": "GO_POST_PROCESS_FILE='goimports -w' openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api", - "generate": "npm run generate:clear && npm run generate:init && npm run generate:download && npm run generate:transform && npm run generate:run" + "generate:run": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $1}'); export GO_POST_PROCESS_FILE='goimports -w'; openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api --additional-properties=\"sdkImport=$SDKIMPORT,sdkVersion=$SDKVERSION\"", + "generate": "npm run generate:clear && npm run generate:download && npm run generate:transform && npm run generate:run" }, "repository": { "type": "git", From 08fd12a4a5b01140d84952603221342c435edbb0 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Wed, 4 Oct 2023 18:04:42 +0100 Subject: [PATCH 37/44] add watcher --- internal/api/api_access_tracking_cmd.go | 66 +- internal/api/api_alert_configurations_cmd.go | 248 +++-- internal/api/api_alerts_cmd.go | 132 ++- internal/api/api_atlas_search_cmd.go | 165 +-- internal/api/api_auditing_cmd.go | 66 +- internal/api/api_aws_clusters_dns_cmd.go | 66 +- internal/api/api_cloud_backups_cmd.go | 957 +++++++++++------- .../api/api_cloud_migration_service_cmd.go | 248 +++-- internal/api/api_cloud_provider_access_cmd.go | 149 ++- .../api/api_cluster_outage_simulation_cmd.go | 99 +- internal/api/api_clusters_cmd.go | 511 ++++++---- internal/api/api_custom_database_roles_cmd.go | 149 ++- internal/api/api_data_federation_cmd.go | 463 +++++---- internal/api/api_data_lake_pipelines_cmd.go | 429 ++++---- internal/api/api_database_users_cmd.go | 165 +-- ..._rest_using_customer_key_management_cmd.go | 66 +- internal/api/api_events_cmd.go | 132 ++- .../api/api_federated_authentication_cmd.go | 463 +++++---- internal/api/api_global_clusters_cmd.go | 165 +-- internal/api/api_invoices_cmd.go | 198 ++-- internal/api/api_ldap_configuration_cmd.go | 165 +-- internal/api/api_legacy_backup_cmd.go | 330 +++--- .../api/api_legacy_backup_restore_jobs_cmd.go | 33 +- internal/api/api_maintenance_windows__cmd.go | 117 ++- internal/api/api_mongo_db_cloud_users_cmd.go | 99 +- internal/api/api_monitoring_and_logs_cmd.go | 463 +++++---- internal/api/api_network_peering_cmd.go | 429 ++++---- internal/api/api_online_archive_cmd.go | 199 ++-- internal/api/api_organizations_cmd.go | 561 ++++++---- internal/api/api_performance_advisor_cmd.go | 133 ++- .../api/api_private_endpoint_services_cmd.go | 297 +++--- internal/api/api_programmatic_api_keys_cmd.go | 462 +++++---- .../api/api_project_ip_access_list_cmd.go | 165 +-- internal/api/api_projects_cmd.go | 677 ++++++++----- internal/api/api_push_based_log_export_cmd.go | 84 +- internal/api/api_rolling_index_cmd.go | 17 +- internal/api/api_root_cmd.go | 33 +- internal/api/api_serverless_instances_cmd.go | 165 +-- .../api_serverless_private_endpoints_cmd.go | 165 +-- .../api/api_shared_tier_restore_jobs_cmd.go | 99 +- internal/api/api_shared_tier_snapshots_cmd.go | 99 +- internal/api/api_streams_cmd.go | 330 +++--- internal/api/api_teams_cmd.go | 397 +++++--- .../api/api_third_party_integrations_cmd.go | 165 +-- internal/api/api_x509_authentication_cmd.go | 99 +- .../config/atlas-api-changes.yaml | 10 + .../config/atlas-api-transformed.yaml | 12 + .../config/go-templates/cmd.mustache | 99 +- 48 files changed, 6677 insertions(+), 4164 deletions(-) diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index a21da13b68..1fac1be096 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -42,6 +42,7 @@ type listAccessLogsByClusterNameOpts struct { start int64 format string tmpl *template.Template + resp *admin.MongoDBAccessLogsList } func (opts *listAccessLogsByClusterNameOpts) preRun() (err error) { @@ -61,13 +62,15 @@ func (opts *listAccessLogsByClusterNameOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAccessLogsByClusterNameApiParams{ GroupId: opts.groupId, @@ -79,28 +82,29 @@ func (opts *listAccessLogsByClusterNameOpts) run(ctx context.Context, _ io.Reade Start: &opts.start, } - resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AccessTrackingApi.ListAccessLogsByClusterNameWithParams(ctx, params).Execute() + return err +} + +func (opts *listAccessLogsByClusterNameOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAccessLogsByClusterNameBuilder() *cobra.Command { @@ -112,7 +116,10 @@ func listAccessLogsByClusterNameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -139,6 +146,7 @@ type listAccessLogsByHostnameOpts struct { start int64 format string tmpl *template.Template + resp *admin.MongoDBAccessLogsList } func (opts *listAccessLogsByHostnameOpts) preRun() (err error) { @@ -158,13 +166,15 @@ func (opts *listAccessLogsByHostnameOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAccessLogsByHostnameApiParams{ GroupId: opts.groupId, @@ -176,28 +186,29 @@ func (opts *listAccessLogsByHostnameOpts) run(ctx context.Context, _ io.Reader, Start: &opts.start, } - resp, _, err := opts.client.AccessTrackingApi.ListAccessLogsByHostnameWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AccessTrackingApi.ListAccessLogsByHostnameWithParams(ctx, params).Execute() + return err +} + +func (opts *listAccessLogsByHostnameOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAccessLogsByHostnameBuilder() *cobra.Command { @@ -209,7 +220,10 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index 2aadf5d795..f581245aec 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -40,6 +40,7 @@ type createAlertConfigurationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GroupAlertsConfig } func (opts *createAlertConfigurationOpts) preRun() (err error) { @@ -59,10 +60,12 @@ func (opts *createAlertConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createAlertConfigurationOpts) readData(r io.Reader) (*admin.GroupAlertsConfig, error) { @@ -87,7 +90,7 @@ func (opts *createAlertConfigurationOpts) readData(r io.Reader) (*admin.GroupAle return out, nil } -func (opts *createAlertConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createAlertConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +102,29 @@ func (opts *createAlertConfigurationOpts) run(ctx context.Context, r io.Reader, GroupAlertsConfig: data, } - resp, _, err := opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertConfigurationsApi.CreateAlertConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *createAlertConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createAlertConfigurationBuilder() *cobra.Command { @@ -134,7 +138,10 @@ func createAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -167,20 +174,26 @@ func (opts *deleteAlertConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *deleteAlertConfigurationOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *deleteAlertConfigurationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - _, err := opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params).Execute() + var err error + _, err = opts.client.AlertConfigurationsApi.DeleteAlertConfigurationWithParams(ctx, params).Execute() return err } +func (opts *deleteAlertConfigurationOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func deleteAlertConfigurationBuilder() *cobra.Command { opts := deleteAlertConfigurationOpts{} cmd := &cobra.Command{ @@ -190,7 +203,10 @@ func deleteAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -206,6 +222,7 @@ type getAlertConfigurationOpts struct { alertConfigId string format string tmpl *template.Template + resp *admin.GroupAlertsConfig } func (opts *getAlertConfigurationOpts) preRun() (err error) { @@ -225,41 +242,44 @@ func (opts *getAlertConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getAlertConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getAlertConfigurationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetAlertConfigurationApiParams{ GroupId: opts.groupId, AlertConfigId: opts.alertConfigId, } - resp, _, err := opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertConfigurationsApi.GetAlertConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *getAlertConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getAlertConfigurationBuilder() *cobra.Command { @@ -271,7 +291,10 @@ func getAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -286,6 +309,7 @@ type listAlertConfigurationMatchersFieldNamesOpts struct { client *admin.APIClient format string tmpl *template.Template + resp []string } func (opts *listAlertConfigurationMatchersFieldNamesOpts) preRun() (err error) { @@ -294,38 +318,41 @@ func (opts *listAlertConfigurationMatchersFieldNamesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAlertConfigurationMatchersFieldNamesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAlertConfigurationMatchersFieldNamesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAlertConfigurationMatchersFieldNamesApiParams{} - resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertConfigurationsApi.ListAlertConfigurationMatchersFieldNamesWithParams(ctx, params).Execute() + return err +} + +func (opts *listAlertConfigurationMatchersFieldNamesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { @@ -337,7 +364,10 @@ func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } @@ -353,6 +383,7 @@ type listAlertConfigurationsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedAlertConfig } func (opts *listAlertConfigurationsOpts) preRun() (err error) { @@ -372,13 +403,15 @@ func (opts *listAlertConfigurationsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAlertConfigurationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAlertConfigurationsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAlertConfigurationsApiParams{ GroupId: opts.groupId, @@ -387,28 +420,29 @@ func (opts *listAlertConfigurationsOpts) run(ctx context.Context, _ io.Reader, w PageNum: &opts.pageNum, } - resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertConfigurationsApi.ListAlertConfigurationsWithParams(ctx, params).Execute() + return err +} + +func (opts *listAlertConfigurationsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAlertConfigurationsBuilder() *cobra.Command { @@ -420,7 +454,10 @@ func listAlertConfigurationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -441,6 +478,7 @@ type listAlertConfigurationsByAlertIdOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedAlertConfig } func (opts *listAlertConfigurationsByAlertIdOpts) preRun() (err error) { @@ -460,13 +498,15 @@ func (opts *listAlertConfigurationsByAlertIdOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAlertConfigurationsByAlertIdApiParams{ GroupId: opts.groupId, @@ -476,28 +516,29 @@ func (opts *listAlertConfigurationsByAlertIdOpts) run(ctx context.Context, _ io. PageNum: &opts.pageNum, } - resp, _, err := opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertConfigurationsApi.ListAlertConfigurationsByAlertIdWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listAlertConfigurationsByAlertIdOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { @@ -509,7 +550,10 @@ func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -532,6 +576,7 @@ type toggleAlertConfigurationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GroupAlertsConfig } func (opts *toggleAlertConfigurationOpts) preRun() (err error) { @@ -551,10 +596,12 @@ func (opts *toggleAlertConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *toggleAlertConfigurationOpts) readData(r io.Reader) (*admin.AlertsToggle, error) { @@ -579,7 +626,7 @@ func (opts *toggleAlertConfigurationOpts) readData(r io.Reader) (*admin.AlertsTo return out, nil } -func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -592,28 +639,29 @@ func (opts *toggleAlertConfigurationOpts) run(ctx context.Context, r io.Reader, AlertsToggle: data, } - resp, _, err := opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertConfigurationsApi.ToggleAlertConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *toggleAlertConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func toggleAlertConfigurationBuilder() *cobra.Command { @@ -627,7 +675,10 @@ func toggleAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -649,6 +700,7 @@ type updateAlertConfigurationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GroupAlertsConfig } func (opts *updateAlertConfigurationOpts) preRun() (err error) { @@ -668,10 +720,12 @@ func (opts *updateAlertConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateAlertConfigurationOpts) readData(r io.Reader) (*admin.GroupAlertsConfig, error) { @@ -696,7 +750,7 @@ func (opts *updateAlertConfigurationOpts) readData(r io.Reader) (*admin.GroupAle return out, nil } -func (opts *updateAlertConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateAlertConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -709,28 +763,29 @@ func (opts *updateAlertConfigurationOpts) run(ctx context.Context, r io.Reader, GroupAlertsConfig: data, } - resp, _, err := opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertConfigurationsApi.UpdateAlertConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *updateAlertConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateAlertConfigurationBuilder() *cobra.Command { @@ -744,7 +799,10 @@ func updateAlertConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index 69397a9384..c3387f7a8c 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -41,6 +41,7 @@ type acknowledgeAlertOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.AlertViewForNdsGroup } func (opts *acknowledgeAlertOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *acknowledgeAlertOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *acknowledgeAlertOpts) readData(r io.Reader) (*admin.AlertViewForNdsGroup, error) { @@ -88,7 +91,7 @@ func (opts *acknowledgeAlertOpts) readData(r io.Reader) (*admin.AlertViewForNdsG return out, nil } -func (opts *acknowledgeAlertOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *acknowledgeAlertOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *acknowledgeAlertOpts) run(ctx context.Context, r io.Reader, w io.Wri AlertViewForNdsGroup: data, } - resp, _, err := opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertsApi.AcknowledgeAlertWithParams(ctx, params).Execute() + return err +} + +func (opts *acknowledgeAlertOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func acknowledgeAlertBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func acknowledgeAlertBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -155,6 +162,7 @@ type getAlertOpts struct { alertId string format string tmpl *template.Template + resp *admin.AlertViewForNdsGroup } func (opts *getAlertOpts) preRun() (err error) { @@ -174,41 +182,44 @@ func (opts *getAlertOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getAlertOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getAlertOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetAlertApiParams{ GroupId: opts.groupId, AlertId: opts.alertId, } - resp, _, err := opts.client.AlertsApi.GetAlertWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertsApi.GetAlertWithParams(ctx, params).Execute() + return err +} + +func (opts *getAlertOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getAlertBuilder() *cobra.Command { @@ -220,7 +231,10 @@ func getAlertBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -240,6 +254,7 @@ type listAlertsOpts struct { status string format string tmpl *template.Template + resp *admin.PaginatedAlert } func (opts *listAlertsOpts) preRun() (err error) { @@ -259,13 +274,15 @@ func (opts *listAlertsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAlertsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAlertsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAlertsApiParams{ GroupId: opts.groupId, @@ -275,28 +292,29 @@ func (opts *listAlertsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) e Status: &opts.status, } - resp, _, err := opts.client.AlertsApi.ListAlertsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertsApi.ListAlertsWithParams(ctx, params).Execute() + return err +} + +func (opts *listAlertsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAlertsBuilder() *cobra.Command { @@ -308,7 +326,10 @@ func listAlertsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -330,6 +351,7 @@ type listAlertsByAlertConfigurationIdOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedAlert } func (opts *listAlertsByAlertConfigurationIdOpts) preRun() (err error) { @@ -349,13 +371,15 @@ func (opts *listAlertsByAlertConfigurationIdOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAlertsByAlertConfigurationIdApiParams{ GroupId: opts.groupId, @@ -365,28 +389,29 @@ func (opts *listAlertsByAlertConfigurationIdOpts) run(ctx context.Context, _ io. PageNum: &opts.pageNum, } - resp, _, err := opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AlertsApi.ListAlertsByAlertConfigurationIdWithParams(ctx, params).Execute() + return err +} + +func (opts *listAlertsByAlertConfigurationIdOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { @@ -398,7 +423,10 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index 9c00a22e1f..f24d0cf827 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -41,6 +41,7 @@ type createAtlasSearchIndexOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ClusterSearchIndex } func (opts *createAtlasSearchIndexOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createAtlasSearchIndexOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createAtlasSearchIndexOpts) readData(r io.Reader) (*admin.ClusterSearchIndex, error) { @@ -88,7 +91,7 @@ func (opts *createAtlasSearchIndexOpts) readData(r io.Reader) (*admin.ClusterSea return out, nil } -func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *createAtlasSearchIndexOpts) run(ctx context.Context, r io.Reader, w ClusterSearchIndex: data, } - resp, _, err := opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AtlasSearchApi.CreateAtlasSearchIndexWithParams(ctx, params).Execute() + return err +} + +func (opts *createAtlasSearchIndexOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createAtlasSearchIndexBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func createAtlasSearchIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -156,6 +163,7 @@ type deleteAtlasSearchIndexOpts struct { indexId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteAtlasSearchIndexOpts) preRun() (err error) { @@ -175,13 +183,15 @@ func (opts *deleteAtlasSearchIndexOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -189,28 +199,29 @@ func (opts *deleteAtlasSearchIndexOpts) run(ctx context.Context, _ io.Reader, w IndexId: opts.indexId, } - resp, _, err := opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AtlasSearchApi.DeleteAtlasSearchIndexWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteAtlasSearchIndexOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteAtlasSearchIndexBuilder() *cobra.Command { @@ -222,7 +233,10 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -242,6 +256,7 @@ type getAtlasSearchIndexOpts struct { indexId string format string tmpl *template.Template + resp *admin.ClusterSearchIndex } func (opts *getAtlasSearchIndexOpts) preRun() (err error) { @@ -261,13 +276,15 @@ func (opts *getAtlasSearchIndexOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetAtlasSearchIndexApiParams{ GroupId: opts.groupId, @@ -275,28 +292,29 @@ func (opts *getAtlasSearchIndexOpts) run(ctx context.Context, _ io.Reader, w io. IndexId: opts.indexId, } - resp, _, err := opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AtlasSearchApi.GetAtlasSearchIndexWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getAtlasSearchIndexOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getAtlasSearchIndexBuilder() *cobra.Command { @@ -308,7 +326,10 @@ func getAtlasSearchIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -329,6 +350,7 @@ type listAtlasSearchIndexesOpts struct { databaseName string format string tmpl *template.Template + resp []admin.ClusterSearchIndex } func (opts *listAtlasSearchIndexesOpts) preRun() (err error) { @@ -348,13 +370,15 @@ func (opts *listAtlasSearchIndexesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAtlasSearchIndexesApiParams{ GroupId: opts.groupId, @@ -363,28 +387,29 @@ func (opts *listAtlasSearchIndexesOpts) run(ctx context.Context, _ io.Reader, w DatabaseName: opts.databaseName, } - resp, _, err := opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AtlasSearchApi.ListAtlasSearchIndexesWithParams(ctx, params).Execute() + return err +} + +func (opts *listAtlasSearchIndexesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAtlasSearchIndexesBuilder() *cobra.Command { @@ -396,7 +421,10 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -421,6 +449,7 @@ type updateAtlasSearchIndexOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ClusterSearchIndex } func (opts *updateAtlasSearchIndexOpts) preRun() (err error) { @@ -440,10 +469,12 @@ func (opts *updateAtlasSearchIndexOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateAtlasSearchIndexOpts) readData(r io.Reader) (*admin.ClusterSearchIndex, error) { @@ -468,7 +499,7 @@ func (opts *updateAtlasSearchIndexOpts) readData(r io.Reader) (*admin.ClusterSea return out, nil } -func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -482,28 +513,29 @@ func (opts *updateAtlasSearchIndexOpts) run(ctx context.Context, r io.Reader, w ClusterSearchIndex: data, } - resp, _, err := opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AtlasSearchApi.UpdateAtlasSearchIndexWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateAtlasSearchIndexOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateAtlasSearchIndexBuilder() *cobra.Command { @@ -517,7 +549,10 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index ab676f453d..222523282a 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -37,6 +37,7 @@ type getAuditingConfigurationOpts struct { groupId string format string tmpl *template.Template + resp *admin.AuditLog } func (opts *getAuditingConfigurationOpts) preRun() (err error) { @@ -56,40 +57,43 @@ func (opts *getAuditingConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getAuditingConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getAuditingConfigurationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetAuditingConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.AuditingApi.GetAuditingConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AuditingApi.GetAuditingConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *getAuditingConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getAuditingConfigurationBuilder() *cobra.Command { @@ -101,7 +105,10 @@ func getAuditingConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -118,6 +125,7 @@ type updateAuditingConfigurationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.AuditLog } func (opts *updateAuditingConfigurationOpts) preRun() (err error) { @@ -137,10 +145,12 @@ func (opts *updateAuditingConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateAuditingConfigurationOpts) readData(r io.Reader) (*admin.AuditLog, error) { @@ -165,7 +175,7 @@ func (opts *updateAuditingConfigurationOpts) readData(r io.Reader) (*admin.Audit return out, nil } -func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -177,28 +187,29 @@ func (opts *updateAuditingConfigurationOpts) run(ctx context.Context, r io.Reade AuditLog: data, } - resp, _, err := opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AuditingApi.UpdateAuditingConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *updateAuditingConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateAuditingConfigurationBuilder() *cobra.Command { @@ -212,7 +223,10 @@ func updateAuditingConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index 18242834c2..1135d686d7 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -37,6 +37,7 @@ type getAWSCustomDNSOpts struct { groupId string format string tmpl *template.Template + resp *admin.AWSCustomDNSEnabled } func (opts *getAWSCustomDNSOpts) preRun() (err error) { @@ -56,40 +57,43 @@ func (opts *getAWSCustomDNSOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getAWSCustomDNSOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getAWSCustomDNSOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetAWSCustomDNSApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.AWSClustersDNSApi.GetAWSCustomDNSWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AWSClustersDNSApi.GetAWSCustomDNSWithParams(ctx, params).Execute() + return err +} + +func (opts *getAWSCustomDNSOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getAWSCustomDNSBuilder() *cobra.Command { @@ -101,7 +105,10 @@ func getAWSCustomDNSBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -118,6 +125,7 @@ type toggleAWSCustomDNSOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.AWSCustomDNSEnabled } func (opts *toggleAWSCustomDNSOpts) preRun() (err error) { @@ -137,10 +145,12 @@ func (opts *toggleAWSCustomDNSOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *toggleAWSCustomDNSOpts) readData(r io.Reader) (*admin.AWSCustomDNSEnabled, error) { @@ -165,7 +175,7 @@ func (opts *toggleAWSCustomDNSOpts) readData(r io.Reader) (*admin.AWSCustomDNSEn return out, nil } -func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -177,28 +187,29 @@ func (opts *toggleAWSCustomDNSOpts) run(ctx context.Context, r io.Reader, w io.W AWSCustomDNSEnabled: data, } - resp, _, err := opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.AWSClustersDNSApi.ToggleAWSCustomDNSWithParams(ctx, params).Execute() + return err +} + +func (opts *toggleAWSCustomDNSOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func toggleAWSCustomDNSBuilder() *cobra.Command { @@ -212,7 +223,10 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 6d2cd2ef91..7a4f1ddc39 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -39,6 +39,7 @@ type cancelBackupRestoreJobOpts struct { restoreJobId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *cancelBackupRestoreJobOpts) preRun() (err error) { @@ -58,13 +59,15 @@ func (opts *cancelBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.CancelBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -72,28 +75,29 @@ func (opts *cancelBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.CancelBackupRestoreJobWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *cancelBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func cancelBackupRestoreJobBuilder() *cobra.Command { @@ -105,7 +109,10 @@ func cancelBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -127,6 +134,7 @@ type createBackupExportJobOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DiskBackupExportJob } func (opts *createBackupExportJobOpts) preRun() (err error) { @@ -146,10 +154,12 @@ func (opts *createBackupExportJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createBackupExportJobOpts) readData(r io.Reader) (*admin.DiskBackupExportJobRequest, error) { @@ -174,7 +184,7 @@ func (opts *createBackupExportJobOpts) readData(r io.Reader) (*admin.DiskBackupE return out, nil } -func (opts *createBackupExportJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createBackupExportJobOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -187,28 +197,29 @@ func (opts *createBackupExportJobOpts) run(ctx context.Context, r io.Reader, w i DiskBackupExportJobRequest: data, } - resp, _, err := opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.CreateBackupExportJobWithParams(ctx, params).Execute() + return err +} + +func (opts *createBackupExportJobOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createBackupExportJobBuilder() *cobra.Command { @@ -222,7 +233,10 @@ func createBackupExportJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -244,6 +258,7 @@ type createBackupRestoreJobOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DiskBackupSnapshotRestoreJob } func (opts *createBackupRestoreJobOpts) preRun() (err error) { @@ -263,10 +278,12 @@ func (opts *createBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createBackupRestoreJobOpts) readData(r io.Reader) (*admin.DiskBackupSnapshotRestoreJob, error) { @@ -291,7 +308,7 @@ func (opts *createBackupRestoreJobOpts) readData(r io.Reader) (*admin.DiskBackup return out, nil } -func (opts *createBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createBackupRestoreJobOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -304,28 +321,29 @@ func (opts *createBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w DiskBackupSnapshotRestoreJob: data, } - resp, _, err := opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.CreateBackupRestoreJobWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createBackupRestoreJobBuilder() *cobra.Command { @@ -339,7 +357,10 @@ func createBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -360,6 +381,7 @@ type createExportBucketOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DiskBackupSnapshotAWSExportBucket } func (opts *createExportBucketOpts) preRun() (err error) { @@ -379,10 +401,12 @@ func (opts *createExportBucketOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createExportBucketOpts) readData(r io.Reader) (*admin.DiskBackupSnapshotAWSExportBucket, error) { @@ -407,7 +431,7 @@ func (opts *createExportBucketOpts) readData(r io.Reader) (*admin.DiskBackupSnap return out, nil } -func (opts *createExportBucketOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createExportBucketOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -419,28 +443,29 @@ func (opts *createExportBucketOpts) run(ctx context.Context, r io.Reader, w io.W DiskBackupSnapshotAWSExportBucket: data, } - resp, _, err := opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.CreateExportBucketWithParams(ctx, params).Execute() + return err +} + +func (opts *createExportBucketOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createExportBucketBuilder() *cobra.Command { @@ -454,7 +479,10 @@ func createExportBucketBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -474,6 +502,7 @@ type createServerlessBackupRestoreJobOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ServerlessBackupRestoreJob } func (opts *createServerlessBackupRestoreJobOpts) preRun() (err error) { @@ -493,10 +522,12 @@ func (opts *createServerlessBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createServerlessBackupRestoreJobOpts) readData(r io.Reader) (*admin.ServerlessBackupRestoreJob, error) { @@ -521,7 +552,7 @@ func (opts *createServerlessBackupRestoreJobOpts) readData(r io.Reader) (*admin. return out, nil } -func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -534,28 +565,29 @@ func (opts *createServerlessBackupRestoreJobOpts) run(ctx context.Context, r io. ServerlessBackupRestoreJob: data, } - resp, _, err := opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.CreateServerlessBackupRestoreJobWithParams(ctx, params).Execute() + return err +} + +func (opts *createServerlessBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createServerlessBackupRestoreJobBuilder() *cobra.Command { @@ -569,7 +601,10 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -588,6 +623,7 @@ type deleteAllBackupSchedulesOpts struct { clusterName string format string tmpl *template.Template + resp *admin.DiskBackupSnapshotSchedule } func (opts *deleteAllBackupSchedulesOpts) preRun() (err error) { @@ -607,41 +643,44 @@ func (opts *deleteAllBackupSchedulesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteAllBackupSchedulesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteAllBackupSchedulesApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.DeleteAllBackupSchedulesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteAllBackupSchedulesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteAllBackupSchedulesBuilder() *cobra.Command { @@ -653,7 +692,10 @@ func deleteAllBackupSchedulesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -670,6 +712,7 @@ type deleteExportBucketOpts struct { exportBucketId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteExportBucketOpts) preRun() (err error) { @@ -689,41 +732,44 @@ func (opts *deleteExportBucketOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteExportBucketOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteExportBucketOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteExportBucketApiParams{ GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } - resp, _, err := opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.DeleteExportBucketWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteExportBucketOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteExportBucketBuilder() *cobra.Command { @@ -735,7 +781,10 @@ func deleteExportBucketBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -753,6 +802,7 @@ type deleteReplicaSetBackupOpts struct { snapshotId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteReplicaSetBackupOpts) preRun() (err error) { @@ -772,13 +822,15 @@ func (opts *deleteReplicaSetBackupOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteReplicaSetBackupApiParams{ GroupId: opts.groupId, @@ -786,28 +838,29 @@ func (opts *deleteReplicaSetBackupOpts) run(ctx context.Context, _ io.Reader, w SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.DeleteReplicaSetBackupWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteReplicaSetBackupOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteReplicaSetBackupBuilder() *cobra.Command { @@ -819,7 +872,10 @@ func deleteReplicaSetBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -839,6 +895,7 @@ type deleteShardedClusterBackupOpts struct { snapshotId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteShardedClusterBackupOpts) preRun() (err error) { @@ -858,13 +915,15 @@ func (opts *deleteShardedClusterBackupOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteShardedClusterBackupApiParams{ GroupId: opts.groupId, @@ -872,28 +931,29 @@ func (opts *deleteShardedClusterBackupOpts) run(ctx context.Context, _ io.Reader SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.DeleteShardedClusterBackupWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteShardedClusterBackupOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteShardedClusterBackupBuilder() *cobra.Command { @@ -905,7 +965,10 @@ func deleteShardedClusterBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -925,6 +988,7 @@ type getBackupExportJobOpts struct { exportId string format string tmpl *template.Template + resp *admin.DiskBackupExportJob } func (opts *getBackupExportJobOpts) preRun() (err error) { @@ -944,13 +1008,15 @@ func (opts *getBackupExportJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getBackupExportJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getBackupExportJobOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetBackupExportJobApiParams{ GroupId: opts.groupId, @@ -958,28 +1024,29 @@ func (opts *getBackupExportJobOpts) run(ctx context.Context, _ io.Reader, w io.W ExportId: opts.exportId, } - resp, _, err := opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetBackupExportJobWithParams(ctx, params).Execute() + return err +} + +func (opts *getBackupExportJobOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getBackupExportJobBuilder() *cobra.Command { @@ -991,7 +1058,10 @@ func getBackupExportJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1011,6 +1081,7 @@ type getBackupRestoreJobOpts struct { restoreJobId string format string tmpl *template.Template + resp *admin.DiskBackupSnapshotRestoreJob } func (opts *getBackupRestoreJobOpts) preRun() (err error) { @@ -1030,13 +1101,15 @@ func (opts *getBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -1044,28 +1117,29 @@ func (opts *getBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io. RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetBackupRestoreJobWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getBackupRestoreJobBuilder() *cobra.Command { @@ -1077,7 +1151,10 @@ func getBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1096,6 +1173,7 @@ type getBackupScheduleOpts struct { clusterName string format string tmpl *template.Template + resp *admin.DiskBackupSnapshotSchedule } func (opts *getBackupScheduleOpts) preRun() (err error) { @@ -1115,41 +1193,44 @@ func (opts *getBackupScheduleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getBackupScheduleOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getBackupScheduleOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetBackupScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetBackupScheduleWithParams(ctx, params).Execute() + return err +} + +func (opts *getBackupScheduleOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getBackupScheduleBuilder() *cobra.Command { @@ -1161,7 +1242,10 @@ func getBackupScheduleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1177,6 +1261,7 @@ type getDataProtectionSettingsOpts struct { groupId string format string tmpl *template.Template + resp *admin.DataProtectionSettings } func (opts *getDataProtectionSettingsOpts) preRun() (err error) { @@ -1196,40 +1281,43 @@ func (opts *getDataProtectionSettingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getDataProtectionSettingsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetDataProtectionSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudBackupsApi.GetDataProtectionSettingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetDataProtectionSettingsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getDataProtectionSettingsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getDataProtectionSettingsBuilder() *cobra.Command { @@ -1241,7 +1329,10 @@ func getDataProtectionSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1256,6 +1347,7 @@ type getExportBucketOpts struct { exportBucketId string format string tmpl *template.Template + resp *admin.DiskBackupSnapshotAWSExportBucket } func (opts *getExportBucketOpts) preRun() (err error) { @@ -1275,41 +1367,44 @@ func (opts *getExportBucketOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getExportBucketOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getExportBucketOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetExportBucketApiParams{ GroupId: opts.groupId, ExportBucketId: opts.exportBucketId, } - resp, _, err := opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetExportBucketWithParams(ctx, params).Execute() + return err +} + +func (opts *getExportBucketOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getExportBucketBuilder() *cobra.Command { @@ -1321,7 +1416,10 @@ func getExportBucketBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1339,6 +1437,7 @@ type getReplicaSetBackupOpts struct { snapshotId string format string tmpl *template.Template + resp *admin.DiskBackupReplicaSet } func (opts *getReplicaSetBackupOpts) preRun() (err error) { @@ -1358,13 +1457,15 @@ func (opts *getReplicaSetBackupOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getReplicaSetBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getReplicaSetBackupOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetReplicaSetBackupApiParams{ GroupId: opts.groupId, @@ -1372,28 +1473,29 @@ func (opts *getReplicaSetBackupOpts) run(ctx context.Context, _ io.Reader, w io. SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetReplicaSetBackupWithParams(ctx, params).Execute() + return err +} + +func (opts *getReplicaSetBackupOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getReplicaSetBackupBuilder() *cobra.Command { @@ -1405,7 +1507,10 @@ func getReplicaSetBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1425,6 +1530,7 @@ type getServerlessBackupOpts struct { snapshotId string format string tmpl *template.Template + resp *admin.ServerlessBackupSnapshot } func (opts *getServerlessBackupOpts) preRun() (err error) { @@ -1444,13 +1550,15 @@ func (opts *getServerlessBackupOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getServerlessBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getServerlessBackupOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetServerlessBackupApiParams{ GroupId: opts.groupId, @@ -1458,28 +1566,29 @@ func (opts *getServerlessBackupOpts) run(ctx context.Context, _ io.Reader, w io. SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetServerlessBackupWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getServerlessBackupOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getServerlessBackupBuilder() *cobra.Command { @@ -1491,7 +1600,10 @@ func getServerlessBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1511,6 +1623,7 @@ type getServerlessBackupRestoreJobOpts struct { restoreJobId string format string tmpl *template.Template + resp *admin.ServerlessBackupRestoreJob } func (opts *getServerlessBackupRestoreJobOpts) preRun() (err error) { @@ -1530,13 +1643,15 @@ func (opts *getServerlessBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetServerlessBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -1544,28 +1659,29 @@ func (opts *getServerlessBackupRestoreJobOpts) run(ctx context.Context, _ io.Rea RestoreJobId: opts.restoreJobId, } - resp, _, err := opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetServerlessBackupRestoreJobWithParams(ctx, params).Execute() + return err +} + +func (opts *getServerlessBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getServerlessBackupRestoreJobBuilder() *cobra.Command { @@ -1577,7 +1693,10 @@ func getServerlessBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1597,6 +1716,7 @@ type getShardedClusterBackupOpts struct { snapshotId string format string tmpl *template.Template + resp *admin.DiskBackupShardedClusterSnapshot } func (opts *getShardedClusterBackupOpts) preRun() (err error) { @@ -1616,13 +1736,15 @@ func (opts *getShardedClusterBackupOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getShardedClusterBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getShardedClusterBackupOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetShardedClusterBackupApiParams{ GroupId: opts.groupId, @@ -1630,28 +1752,29 @@ func (opts *getShardedClusterBackupOpts) run(ctx context.Context, _ io.Reader, w SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.GetShardedClusterBackupWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getShardedClusterBackupOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getShardedClusterBackupBuilder() *cobra.Command { @@ -1663,7 +1786,10 @@ func getShardedClusterBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1685,6 +1811,7 @@ type listBackupExportJobsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiAtlasDiskBackupExportJob } func (opts *listBackupExportJobsOpts) preRun() (err error) { @@ -1704,13 +1831,15 @@ func (opts *listBackupExportJobsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listBackupExportJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listBackupExportJobsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListBackupExportJobsApiParams{ GroupId: opts.groupId, @@ -1720,28 +1849,29 @@ func (opts *listBackupExportJobsOpts) run(ctx context.Context, _ io.Reader, w io PageNum: &opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.ListBackupExportJobsWithParams(ctx, params).Execute() + return err +} + +func (opts *listBackupExportJobsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listBackupExportJobsBuilder() *cobra.Command { @@ -1753,7 +1883,10 @@ func listBackupExportJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1776,6 +1909,7 @@ type listBackupRestoreJobsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedCloudBackupRestoreJob } func (opts *listBackupRestoreJobsOpts) preRun() (err error) { @@ -1795,13 +1929,15 @@ func (opts *listBackupRestoreJobsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -1811,28 +1947,29 @@ func (opts *listBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w i PageNum: &opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.ListBackupRestoreJobsWithParams(ctx, params).Execute() + return err +} + +func (opts *listBackupRestoreJobsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listBackupRestoreJobsBuilder() *cobra.Command { @@ -1844,7 +1981,10 @@ func listBackupRestoreJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1866,6 +2006,7 @@ type listExportBucketsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedBackupSnapshotExportBucket } func (opts *listExportBucketsOpts) preRun() (err error) { @@ -1885,13 +2026,15 @@ func (opts *listExportBucketsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listExportBucketsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listExportBucketsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListExportBucketsApiParams{ GroupId: opts.groupId, @@ -1900,28 +2043,29 @@ func (opts *listExportBucketsOpts) run(ctx context.Context, _ io.Reader, w io.Wr PageNum: &opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.ListExportBucketsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listExportBucketsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listExportBucketsBuilder() *cobra.Command { @@ -1933,7 +2077,10 @@ func listExportBucketsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1954,6 +2101,7 @@ type listReplicaSetBackupsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedCloudBackupReplicaSet } func (opts *listReplicaSetBackupsOpts) preRun() (err error) { @@ -1973,13 +2121,15 @@ func (opts *listReplicaSetBackupsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListReplicaSetBackupsApiParams{ GroupId: opts.groupId, @@ -1989,28 +2139,29 @@ func (opts *listReplicaSetBackupsOpts) run(ctx context.Context, _ io.Reader, w i PageNum: &opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.ListReplicaSetBackupsWithParams(ctx, params).Execute() + return err +} + +func (opts *listReplicaSetBackupsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listReplicaSetBackupsBuilder() *cobra.Command { @@ -2022,7 +2173,10 @@ func listReplicaSetBackupsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2045,6 +2199,7 @@ type listServerlessBackupRestoreJobsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiAtlasServerlessBackupRestoreJob } func (opts *listServerlessBackupRestoreJobsOpts) preRun() (err error) { @@ -2064,13 +2219,15 @@ func (opts *listServerlessBackupRestoreJobsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListServerlessBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -2080,28 +2237,29 @@ func (opts *listServerlessBackupRestoreJobsOpts) run(ctx context.Context, _ io.R PageNum: &opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.ListServerlessBackupRestoreJobsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listServerlessBackupRestoreJobsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listServerlessBackupRestoreJobsBuilder() *cobra.Command { @@ -2113,7 +2271,10 @@ func listServerlessBackupRestoreJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2136,6 +2297,7 @@ type listServerlessBackupsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiAtlasServerlessBackupSnapshot } func (opts *listServerlessBackupsOpts) preRun() (err error) { @@ -2155,13 +2317,15 @@ func (opts *listServerlessBackupsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listServerlessBackupsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listServerlessBackupsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListServerlessBackupsApiParams{ GroupId: opts.groupId, @@ -2171,28 +2335,29 @@ func (opts *listServerlessBackupsOpts) run(ctx context.Context, _ io.Reader, w i PageNum: &opts.pageNum, } - resp, _, err := opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.ListServerlessBackupsWithParams(ctx, params).Execute() + return err +} + +func (opts *listServerlessBackupsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listServerlessBackupsBuilder() *cobra.Command { @@ -2204,7 +2369,10 @@ func listServerlessBackupsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2224,6 +2392,7 @@ type listShardedClusterBackupsOpts struct { clusterName string format string tmpl *template.Template + resp *admin.PaginatedCloudBackupShardedClusterSnapshot } func (opts *listShardedClusterBackupsOpts) preRun() (err error) { @@ -2243,41 +2412,44 @@ func (opts *listShardedClusterBackupsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listShardedClusterBackupsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListShardedClusterBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.ListShardedClusterBackupsWithParams(ctx, params).Execute() + return err +} + +func (opts *listShardedClusterBackupsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listShardedClusterBackupsBuilder() *cobra.Command { @@ -2289,7 +2461,10 @@ func listShardedClusterBackupsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2309,6 +2484,7 @@ type takeSnapshotOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DiskBackupSnapshot } func (opts *takeSnapshotOpts) preRun() (err error) { @@ -2328,10 +2504,12 @@ func (opts *takeSnapshotOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *takeSnapshotOpts) readData(r io.Reader) (*admin.DiskBackupOnDemandSnapshotRequest, error) { @@ -2356,7 +2534,7 @@ func (opts *takeSnapshotOpts) readData(r io.Reader) (*admin.DiskBackupOnDemandSn return out, nil } -func (opts *takeSnapshotOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *takeSnapshotOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -2369,28 +2547,29 @@ func (opts *takeSnapshotOpts) run(ctx context.Context, r io.Reader, w io.Writer) DiskBackupOnDemandSnapshotRequest: data, } - resp, _, err := opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.TakeSnapshotWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *takeSnapshotOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func takeSnapshotBuilder() *cobra.Command { @@ -2404,7 +2583,10 @@ func takeSnapshotBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2426,6 +2608,7 @@ type updateBackupScheduleOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DiskBackupSnapshotSchedule } func (opts *updateBackupScheduleOpts) preRun() (err error) { @@ -2445,10 +2628,12 @@ func (opts *updateBackupScheduleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateBackupScheduleOpts) readData(r io.Reader) (*admin.DiskBackupSnapshotSchedule, error) { @@ -2473,7 +2658,7 @@ func (opts *updateBackupScheduleOpts) readData(r io.Reader) (*admin.DiskBackupSn return out, nil } -func (opts *updateBackupScheduleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateBackupScheduleOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -2486,28 +2671,29 @@ func (opts *updateBackupScheduleOpts) run(ctx context.Context, r io.Reader, w io DiskBackupSnapshotSchedule: data, } - resp, _, err := opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.UpdateBackupScheduleWithParams(ctx, params).Execute() + return err +} + +func (opts *updateBackupScheduleOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateBackupScheduleBuilder() *cobra.Command { @@ -2521,7 +2707,10 @@ func updateBackupScheduleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2542,6 +2731,7 @@ type updateDataProtectionSettingsOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DataProtectionSettings } func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { @@ -2561,10 +2751,12 @@ func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateDataProtectionSettingsOpts) readData(r io.Reader) (*admin.DataProtectionSettings, error) { @@ -2589,7 +2781,7 @@ func (opts *updateDataProtectionSettingsOpts) readData(r io.Reader) (*admin.Data return out, nil } -func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -2601,28 +2793,29 @@ func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, r io.Read DataProtectionSettings: data, } - resp, _, err := opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.UpdateDataProtectionSettingsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateDataProtectionSettingsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateDataProtectionSettingsBuilder() *cobra.Command { @@ -2636,7 +2829,10 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -2657,6 +2853,7 @@ type updateSnapshotRetentionOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DiskBackupReplicaSet } func (opts *updateSnapshotRetentionOpts) preRun() (err error) { @@ -2676,10 +2873,12 @@ func (opts *updateSnapshotRetentionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateSnapshotRetentionOpts) readData(r io.Reader) (*admin.BackupSnapshotRetention, error) { @@ -2704,7 +2903,7 @@ func (opts *updateSnapshotRetentionOpts) readData(r io.Reader) (*admin.BackupSna return out, nil } -func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -2718,28 +2917,29 @@ func (opts *updateSnapshotRetentionOpts) run(ctx context.Context, r io.Reader, w BackupSnapshotRetention: data, } - resp, _, err := opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudBackupsApi.UpdateSnapshotRetentionWithParams(ctx, params).Execute() + return err +} + +func (opts *updateSnapshotRetentionOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateSnapshotRetentionBuilder() *cobra.Command { @@ -2753,7 +2953,10 @@ func updateSnapshotRetentionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 82fe0b18c8..f9bcd20bff 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -40,6 +40,7 @@ type createLinkTokenOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.TargetOrg } func (opts *createLinkTokenOpts) preRun() (err error) { @@ -59,10 +60,12 @@ func (opts *createLinkTokenOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createLinkTokenOpts) readData(r io.Reader) (*admin.TargetOrgRequest, error) { @@ -87,7 +90,7 @@ func (opts *createLinkTokenOpts) readData(r io.Reader) (*admin.TargetOrgRequest, return out, nil } -func (opts *createLinkTokenOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createLinkTokenOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +102,29 @@ func (opts *createLinkTokenOpts) run(ctx context.Context, r io.Reader, w io.Writ TargetOrgRequest: data, } - resp, _, err := opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudMigrationServiceApi.CreateLinkTokenWithParams(ctx, params).Execute() + return err +} + +func (opts *createLinkTokenOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createLinkTokenBuilder() *cobra.Command { @@ -134,7 +138,10 @@ func createLinkTokenBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -153,6 +160,7 @@ type createPushMigrationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.LiveMigrationResponse } func (opts *createPushMigrationOpts) preRun() (err error) { @@ -172,10 +180,12 @@ func (opts *createPushMigrationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createPushMigrationOpts) readData(r io.Reader) (*admin.LiveMigrationRequest, error) { @@ -200,7 +210,7 @@ func (opts *createPushMigrationOpts) readData(r io.Reader) (*admin.LiveMigration return out, nil } -func (opts *createPushMigrationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createPushMigrationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -212,28 +222,29 @@ func (opts *createPushMigrationOpts) run(ctx context.Context, r io.Reader, w io. LiveMigrationRequest: data, } - resp, _, err := opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudMigrationServiceApi.CreatePushMigrationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createPushMigrationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createPushMigrationBuilder() *cobra.Command { @@ -247,7 +258,10 @@ func createPushMigrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -280,20 +294,26 @@ func (opts *cutoverMigrationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *cutoverMigrationOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *cutoverMigrationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.CutoverMigrationApiParams{ GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } - _, err := opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params).Execute() + var err error + _, err = opts.client.CloudMigrationServiceApi.CutoverMigrationWithParams(ctx, params).Execute() return err } +func (opts *cutoverMigrationOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func cutoverMigrationBuilder() *cobra.Command { opts := cutoverMigrationOpts{} cmd := &cobra.Command{ @@ -303,7 +323,10 @@ func cutoverMigrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -318,6 +341,7 @@ type deleteLinkTokenOpts struct { orgId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteLinkTokenOpts) preRun() (err error) { @@ -337,40 +361,43 @@ func (opts *deleteLinkTokenOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteLinkTokenOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteLinkTokenOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteLinkTokenApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.CloudMigrationServiceApi.DeleteLinkTokenWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudMigrationServiceApi.DeleteLinkTokenWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteLinkTokenOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteLinkTokenBuilder() *cobra.Command { @@ -382,7 +409,10 @@ func deleteLinkTokenBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -397,6 +427,7 @@ type getPushMigrationOpts struct { liveMigrationId string format string tmpl *template.Template + resp *admin.LiveMigrationResponse } func (opts *getPushMigrationOpts) preRun() (err error) { @@ -416,41 +447,44 @@ func (opts *getPushMigrationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getPushMigrationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getPushMigrationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetPushMigrationApiParams{ GroupId: opts.groupId, LiveMigrationId: opts.liveMigrationId, } - resp, _, err := opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudMigrationServiceApi.GetPushMigrationWithParams(ctx, params).Execute() + return err +} + +func (opts *getPushMigrationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getPushMigrationBuilder() *cobra.Command { @@ -462,7 +496,10 @@ func getPushMigrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -479,6 +516,7 @@ type getValidationStatusOpts struct { validationId string format string tmpl *template.Template + resp *admin.LiveImportValidation } func (opts *getValidationStatusOpts) preRun() (err error) { @@ -498,41 +536,44 @@ func (opts *getValidationStatusOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getValidationStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getValidationStatusOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetValidationStatusApiParams{ GroupId: opts.groupId, ValidationId: opts.validationId, } - resp, _, err := opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudMigrationServiceApi.GetValidationStatusWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getValidationStatusOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getValidationStatusBuilder() *cobra.Command { @@ -544,7 +585,10 @@ func getValidationStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -560,6 +604,7 @@ type listSourceProjectsOpts struct { orgId string format string tmpl *template.Template + resp []admin.LiveImportAvailableProject } func (opts *listSourceProjectsOpts) preRun() (err error) { @@ -579,40 +624,43 @@ func (opts *listSourceProjectsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listSourceProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listSourceProjectsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListSourceProjectsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.CloudMigrationServiceApi.ListSourceProjectsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudMigrationServiceApi.ListSourceProjectsWithParams(ctx, params).Execute() + return err +} + +func (opts *listSourceProjectsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listSourceProjectsBuilder() *cobra.Command { @@ -624,7 +672,10 @@ func listSourceProjectsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -641,6 +692,7 @@ type validateMigrationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.LiveImportValidation } func (opts *validateMigrationOpts) preRun() (err error) { @@ -660,10 +712,12 @@ func (opts *validateMigrationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *validateMigrationOpts) readData(r io.Reader) (*admin.LiveMigrationRequest, error) { @@ -688,7 +742,7 @@ func (opts *validateMigrationOpts) readData(r io.Reader) (*admin.LiveMigrationRe return out, nil } -func (opts *validateMigrationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *validateMigrationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -700,28 +754,29 @@ func (opts *validateMigrationOpts) run(ctx context.Context, r io.Reader, w io.Wr LiveMigrationRequest: data, } - resp, _, err := opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudMigrationServiceApi.ValidateMigrationWithParams(ctx, params).Execute() + return err +} + +func (opts *validateMigrationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func validateMigrationBuilder() *cobra.Command { @@ -735,7 +790,10 @@ func validateMigrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index ce2a06475a..5963142d26 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -41,6 +41,7 @@ type authorizeCloudProviderAccessRoleOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CloudProviderAccessRole } func (opts *authorizeCloudProviderAccessRoleOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *authorizeCloudProviderAccessRoleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *authorizeCloudProviderAccessRoleOpts) readData(r io.Reader) (*admin.CloudProviderAccessRole, error) { @@ -88,7 +91,7 @@ func (opts *authorizeCloudProviderAccessRoleOpts) readData(r io.Reader) (*admin. return out, nil } -func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *authorizeCloudProviderAccessRoleOpts) run(ctx context.Context, r io. CloudProviderAccessRole: data, } - resp, _, err := opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudProviderAccessApi.AuthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() + return err +} + +func (opts *authorizeCloudProviderAccessRoleOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -157,6 +164,7 @@ type createCloudProviderAccessRoleOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CloudProviderAccessRole } func (opts *createCloudProviderAccessRoleOpts) preRun() (err error) { @@ -176,10 +184,12 @@ func (opts *createCloudProviderAccessRoleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createCloudProviderAccessRoleOpts) readData(r io.Reader) (*admin.CloudProviderAccessRole, error) { @@ -204,7 +214,7 @@ func (opts *createCloudProviderAccessRoleOpts) readData(r io.Reader) (*admin.Clo return out, nil } -func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -216,28 +226,29 @@ func (opts *createCloudProviderAccessRoleOpts) run(ctx context.Context, r io.Rea CloudProviderAccessRole: data, } - resp, _, err := opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudProviderAccessApi.CreateCloudProviderAccessRoleWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createCloudProviderAccessRoleOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createCloudProviderAccessRoleBuilder() *cobra.Command { @@ -251,7 +262,10 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -285,10 +299,10 @@ func (opts *deauthorizeCloudProviderAccessRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeauthorizeCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, @@ -296,10 +310,16 @@ func (opts *deauthorizeCloudProviderAccessRoleOpts) run(ctx context.Context, _ i RoleId: opts.roleId, } - _, err := opts.client.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() + var err error + _, err = opts.client.CloudProviderAccessApi.DeauthorizeCloudProviderAccessRoleWithParams(ctx, params).Execute() return err } +func (opts *deauthorizeCloudProviderAccessRoleOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { opts := deauthorizeCloudProviderAccessRoleOpts{} cmd := &cobra.Command{ @@ -309,7 +329,10 @@ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -327,6 +350,7 @@ type getCloudProviderAccessRoleOpts struct { roleId string format string tmpl *template.Template + resp *admin.CloudProviderAccessRole } func (opts *getCloudProviderAccessRoleOpts) preRun() (err error) { @@ -346,41 +370,44 @@ func (opts *getCloudProviderAccessRoleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getCloudProviderAccessRoleOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetCloudProviderAccessRoleApiParams{ GroupId: opts.groupId, RoleId: opts.roleId, } - resp, _, err := opts.client.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudProviderAccessApi.GetCloudProviderAccessRoleWithParams(ctx, params).Execute() + return err +} + +func (opts *getCloudProviderAccessRoleOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getCloudProviderAccessRoleBuilder() *cobra.Command { @@ -392,7 +419,10 @@ func getCloudProviderAccessRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -408,6 +438,7 @@ type listCloudProviderAccessRolesOpts struct { groupId string format string tmpl *template.Template + resp *admin.CloudProviderAccessRoles } func (opts *listCloudProviderAccessRolesOpts) preRun() (err error) { @@ -427,40 +458,43 @@ func (opts *listCloudProviderAccessRolesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listCloudProviderAccessRolesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListCloudProviderAccessRolesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CloudProviderAccessApi.ListCloudProviderAccessRolesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CloudProviderAccessApi.ListCloudProviderAccessRolesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listCloudProviderAccessRolesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listCloudProviderAccessRolesBuilder() *cobra.Command { @@ -472,7 +506,10 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index 7a8fd40a25..509dec7eec 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -38,6 +38,7 @@ type endOutageSimulationOpts struct { clusterName string format string tmpl *template.Template + resp *admin.ClusterOutageSimulation } func (opts *endOutageSimulationOpts) preRun() (err error) { @@ -57,41 +58,44 @@ func (opts *endOutageSimulationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *endOutageSimulationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *endOutageSimulationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.EndOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClusterOutageSimulationApi.EndOutageSimulationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClusterOutageSimulationApi.EndOutageSimulationWithParams(ctx, params).Execute() + return err +} + +func (opts *endOutageSimulationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func endOutageSimulationBuilder() *cobra.Command { @@ -103,7 +107,10 @@ func endOutageSimulationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -120,6 +127,7 @@ type getOutageSimulationOpts struct { clusterName string format string tmpl *template.Template + resp *admin.ClusterOutageSimulation } func (opts *getOutageSimulationOpts) preRun() (err error) { @@ -139,41 +147,44 @@ func (opts *getOutageSimulationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getOutageSimulationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getOutageSimulationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetOutageSimulationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClusterOutageSimulationApi.GetOutageSimulationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClusterOutageSimulationApi.GetOutageSimulationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getOutageSimulationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getOutageSimulationBuilder() *cobra.Command { @@ -185,7 +196,10 @@ func getOutageSimulationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -205,6 +219,7 @@ type startOutageSimulationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ClusterOutageSimulation } func (opts *startOutageSimulationOpts) preRun() (err error) { @@ -224,10 +239,12 @@ func (opts *startOutageSimulationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *startOutageSimulationOpts) readData(r io.Reader) (*admin.ClusterOutageSimulation, error) { @@ -252,7 +269,7 @@ func (opts *startOutageSimulationOpts) readData(r io.Reader) (*admin.ClusterOuta return out, nil } -func (opts *startOutageSimulationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *startOutageSimulationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -265,28 +282,29 @@ func (opts *startOutageSimulationOpts) run(ctx context.Context, r io.Reader, w i ClusterOutageSimulation: data, } - resp, _, err := opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClusterOutageSimulationApi.StartOutageSimulationWithParams(ctx, params).Execute() + return err +} + +func (opts *startOutageSimulationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func startOutageSimulationBuilder() *cobra.Command { @@ -300,7 +318,10 @@ func startOutageSimulationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 07b3a07f4c..2d7561413d 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -25,7 +25,9 @@ import ( "io" "strings" "text/template" + "time" + "github.com/briandowns/spinner" "github.com/mongodb/mongodb-atlas-cli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -36,10 +38,14 @@ type createClusterOpts struct { client *admin.APIClient groupId string - filename string - fs afero.Fs - format string - tmpl *template.Template + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.AdvancedClusterDescription + watchEnabled bool + watchTimeout string + wt time.Duration } func (opts *createClusterOpts) preRun() (err error) { @@ -59,10 +65,15 @@ func (opts *createClusterOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + if opts.wt, err = time.ParseDuration(opts.watchTimeout); err != nil { + return err } - return err + return nil } func (opts *createClusterOpts) readData(r io.Reader) (*admin.AdvancedClusterDescription, error) { @@ -87,7 +98,7 @@ func (opts *createClusterOpts) readData(r io.Reader) (*admin.AdvancedClusterDesc return out, nil } -func (opts *createClusterOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createClusterOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +110,63 @@ func (opts *createClusterOpts) run(ctx context.Context, r io.Reader, w io.Writer AdvancedClusterDescription: data, } - resp, _, err := opts.client.ClustersApi.CreateClusterWithParams(ctx, params).Execute() - if err != nil { + var err error + opts.resp, _, err = opts.client.ClustersApi.CreateClusterWithParams(ctx, params).Execute() + return err +} + +func (opts *createClusterOpts) watch(ctx context.Context) error { + if !opts.watchEnabled { + return nil + } + + spin := spinner.New(spinner.CharSets[9], 100*time.Millisecond) + spin.Start() + defer spin.Stop() + + watchCtx, cancel := context.WithTimeout(ctx, opts.wt) + defer cancel() + for { + select { + case <-watchCtx.Done(): + return watchCtx.Err() + default: + params := &admin.GetClusterApiParams{ + GroupId: *opts.resp.GroupId, + ClusterName: *opts.resp.Name, + } + resp, _, err := opts.client.ClustersApi.GetClusterWithParams(ctx, params).Execute() + if err != nil { + return err + } + if resp.StateName != nil && *resp.StateName == "IDLE" { + return nil + } + } + } +} + +func (opts *createClusterOpts) postRun(ctx context.Context, w io.Writer) error { + if err := opts.watch(ctx); err != nil { return err } - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createClusterBuilder() *cobra.Command { @@ -134,7 +180,10 @@ func createClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -142,6 +191,8 @@ func createClusterBuilder() *cobra.Command { cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + cmd.Flags().BoolVarP(&opts.watchEnabled, "watch", "w", false, "WATCH DESCRIPTION") + cmd.Flags().StringVar(&opts.watchTimeout, "timeout", "5m", "WATCH TIMEOUT DESCRIPTION") return cmd } @@ -168,10 +219,10 @@ func (opts *deleteClusterOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteClusterApiParams{ GroupId: opts.groupId, @@ -179,10 +230,16 @@ func (opts *deleteClusterOpts) run(ctx context.Context, _ io.Reader, _ io.Writer RetainBackups: &opts.retainBackups, } - _, err := opts.client.ClustersApi.DeleteClusterWithParams(ctx, params).Execute() + var err error + _, err = opts.client.ClustersApi.DeleteClusterWithParams(ctx, params).Execute() return err } +func (opts *deleteClusterOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func deleteClusterBuilder() *cobra.Command { opts := deleteClusterOpts{} cmd := &cobra.Command{ @@ -192,7 +249,10 @@ func deleteClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -209,6 +269,7 @@ type getClusterOpts struct { clusterName string format string tmpl *template.Template + resp *admin.AdvancedClusterDescription } func (opts *getClusterOpts) preRun() (err error) { @@ -228,41 +289,44 @@ func (opts *getClusterOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getClusterOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getClusterOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetClusterApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClustersApi.GetClusterWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.GetClusterWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getClusterOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getClusterBuilder() *cobra.Command { @@ -274,7 +338,10 @@ func getClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -291,6 +358,7 @@ type getClusterAdvancedConfigurationOpts struct { clusterName string format string tmpl *template.Template + resp *admin.ClusterDescriptionProcessArgs } func (opts *getClusterAdvancedConfigurationOpts) preRun() (err error) { @@ -310,41 +378,44 @@ func (opts *getClusterAdvancedConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getClusterAdvancedConfigurationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetClusterAdvancedConfigurationApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.GetClusterAdvancedConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *getClusterAdvancedConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getClusterAdvancedConfigurationBuilder() *cobra.Command { @@ -356,7 +427,10 @@ func getClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -373,6 +447,7 @@ type getClusterStatusOpts struct { clusterName string format string tmpl *template.Template + resp *admin.ClusterStatus } func (opts *getClusterStatusOpts) preRun() (err error) { @@ -392,41 +467,44 @@ func (opts *getClusterStatusOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getClusterStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getClusterStatusOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetClusterStatusApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.GetClusterStatusWithParams(ctx, params).Execute() + return err +} + +func (opts *getClusterStatusOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getClusterStatusBuilder() *cobra.Command { @@ -438,7 +516,10 @@ func getClusterStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -455,6 +536,7 @@ type getSampleDatasetLoadStatusOpts struct { sampleDatasetId string format string tmpl *template.Template + resp *admin.SampleDatasetStatus } func (opts *getSampleDatasetLoadStatusOpts) preRun() (err error) { @@ -474,41 +556,44 @@ func (opts *getSampleDatasetLoadStatusOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getSampleDatasetLoadStatusOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetSampleDatasetLoadStatusApiParams{ GroupId: opts.groupId, SampleDatasetId: opts.sampleDatasetId, } - resp, _, err := opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.GetSampleDatasetLoadStatusWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getSampleDatasetLoadStatusOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getSampleDatasetLoadStatusBuilder() *cobra.Command { @@ -520,7 +605,10 @@ func getSampleDatasetLoadStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -541,6 +629,7 @@ type listCloudProviderRegionsOpts struct { tier string format string tmpl *template.Template + resp *admin.PaginatedApiAtlasProviderRegions } func (opts *listCloudProviderRegionsOpts) preRun() (err error) { @@ -560,13 +649,15 @@ func (opts *listCloudProviderRegionsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListCloudProviderRegionsApiParams{ GroupId: opts.groupId, @@ -577,28 +668,29 @@ func (opts *listCloudProviderRegionsOpts) run(ctx context.Context, _ io.Reader, Tier: &opts.tier, } - resp, _, err := opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.ListCloudProviderRegionsWithParams(ctx, params).Execute() + return err +} + +func (opts *listCloudProviderRegionsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listCloudProviderRegionsBuilder() *cobra.Command { @@ -610,7 +702,10 @@ func listCloudProviderRegionsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -633,6 +728,7 @@ type listClustersOpts struct { includeDeletedWithRetainedBackups bool format string tmpl *template.Template + resp *admin.PaginatedAdvancedClusterDescription } func (opts *listClustersOpts) preRun() (err error) { @@ -652,13 +748,15 @@ func (opts *listClustersOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listClustersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listClustersOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListClustersApiParams{ GroupId: opts.groupId, @@ -668,28 +766,29 @@ func (opts *listClustersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) IncludeDeletedWithRetainedBackups: &opts.includeDeletedWithRetainedBackups, } - resp, _, err := opts.client.ClustersApi.ListClustersWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.ListClustersWithParams(ctx, params).Execute() + return err +} + +func (opts *listClustersOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listClustersBuilder() *cobra.Command { @@ -701,7 +800,10 @@ func listClustersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -721,6 +823,7 @@ type listClustersForAllProjectsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedOrgGroup } func (opts *listClustersForAllProjectsOpts) preRun() (err error) { @@ -729,13 +832,15 @@ func (opts *listClustersForAllProjectsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listClustersForAllProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listClustersForAllProjectsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListClustersForAllProjectsApiParams{ IncludeCount: &opts.includeCount, @@ -743,28 +848,29 @@ func (opts *listClustersForAllProjectsOpts) run(ctx context.Context, _ io.Reader PageNum: &opts.pageNum, } - resp, _, err := opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.ListClustersForAllProjectsWithParams(ctx, params).Execute() + return err +} + +func (opts *listClustersForAllProjectsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listClustersForAllProjectsBuilder() *cobra.Command { @@ -776,7 +882,10 @@ func listClustersForAllProjectsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -793,6 +902,7 @@ type loadSampleDatasetOpts struct { name string format string tmpl *template.Template + resp *admin.SampleDatasetStatus } func (opts *loadSampleDatasetOpts) preRun() (err error) { @@ -812,41 +922,44 @@ func (opts *loadSampleDatasetOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *loadSampleDatasetOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *loadSampleDatasetOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.LoadSampleDatasetApiParams{ GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.LoadSampleDatasetWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *loadSampleDatasetOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func loadSampleDatasetBuilder() *cobra.Command { @@ -858,7 +971,10 @@ func loadSampleDatasetBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -891,20 +1007,26 @@ func (opts *testFailoverOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *testFailoverOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *testFailoverOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.TestFailoverApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - _, err := opts.client.ClustersApi.TestFailoverWithParams(ctx, params).Execute() + var err error + _, err = opts.client.ClustersApi.TestFailoverWithParams(ctx, params).Execute() return err } +func (opts *testFailoverOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func testFailoverBuilder() *cobra.Command { opts := testFailoverOpts{} cmd := &cobra.Command{ @@ -914,7 +1036,10 @@ func testFailoverBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -933,6 +1058,7 @@ type updateClusterOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.AdvancedClusterDescription } func (opts *updateClusterOpts) preRun() (err error) { @@ -952,10 +1078,12 @@ func (opts *updateClusterOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateClusterOpts) readData(r io.Reader) (*admin.AdvancedClusterDescription, error) { @@ -980,7 +1108,7 @@ func (opts *updateClusterOpts) readData(r io.Reader) (*admin.AdvancedClusterDesc return out, nil } -func (opts *updateClusterOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateClusterOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -993,28 +1121,29 @@ func (opts *updateClusterOpts) run(ctx context.Context, r io.Reader, w io.Writer AdvancedClusterDescription: data, } - resp, _, err := opts.client.ClustersApi.UpdateClusterWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.UpdateClusterWithParams(ctx, params).Execute() + return err +} + +func (opts *updateClusterOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateClusterBuilder() *cobra.Command { @@ -1028,7 +1157,10 @@ func updateClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1050,6 +1182,7 @@ type updateClusterAdvancedConfigurationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ClusterDescriptionProcessArgs } func (opts *updateClusterAdvancedConfigurationOpts) preRun() (err error) { @@ -1069,10 +1202,12 @@ func (opts *updateClusterAdvancedConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateClusterAdvancedConfigurationOpts) readData(r io.Reader) (*admin.ClusterDescriptionProcessArgs, error) { @@ -1097,7 +1232,7 @@ func (opts *updateClusterAdvancedConfigurationOpts) readData(r io.Reader) (*admi return out, nil } -func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1110,28 +1245,29 @@ func (opts *updateClusterAdvancedConfigurationOpts) run(ctx context.Context, r i ClusterDescriptionProcessArgs: data, } - resp, _, err := opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.UpdateClusterAdvancedConfigurationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateClusterAdvancedConfigurationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateClusterAdvancedConfigurationBuilder() *cobra.Command { @@ -1145,7 +1281,10 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1166,6 +1305,7 @@ type upgradeSharedClusterOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.LegacyAtlasCluster } func (opts *upgradeSharedClusterOpts) preRun() (err error) { @@ -1185,10 +1325,12 @@ func (opts *upgradeSharedClusterOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *upgradeSharedClusterOpts) readData(r io.Reader) (*admin.LegacyAtlasCluster, error) { @@ -1213,7 +1355,7 @@ func (opts *upgradeSharedClusterOpts) readData(r io.Reader) (*admin.LegacyAtlasC return out, nil } -func (opts *upgradeSharedClusterOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *upgradeSharedClusterOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1225,28 +1367,29 @@ func (opts *upgradeSharedClusterOpts) run(ctx context.Context, r io.Reader, w io LegacyAtlasCluster: data, } - resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.UpgradeSharedClusterWithParams(ctx, params).Execute() + return err +} + +func (opts *upgradeSharedClusterOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func upgradeSharedClusterBuilder() *cobra.Command { @@ -1260,7 +1403,10 @@ func upgradeSharedClusterBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1279,6 +1425,7 @@ type upgradeSharedClusterToServerlessOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ServerlessInstanceDescription } func (opts *upgradeSharedClusterToServerlessOpts) preRun() (err error) { @@ -1298,10 +1445,12 @@ func (opts *upgradeSharedClusterToServerlessOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *upgradeSharedClusterToServerlessOpts) readData(r io.Reader) (*admin.ServerlessInstanceDescription, error) { @@ -1326,7 +1475,7 @@ func (opts *upgradeSharedClusterToServerlessOpts) readData(r io.Reader) (*admin. return out, nil } -func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1338,28 +1487,29 @@ func (opts *upgradeSharedClusterToServerlessOpts) run(ctx context.Context, r io. ServerlessInstanceDescription: data, } - resp, _, err := opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ClustersApi.UpgradeSharedClusterToServerlessWithParams(ctx, params).Execute() + return err +} + +func (opts *upgradeSharedClusterToServerlessOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func upgradeSharedClusterToServerlessBuilder() *cobra.Command { @@ -1373,7 +1523,10 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 87177c858a..5755342eb5 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -40,6 +40,7 @@ type createCustomDatabaseRoleOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.UserCustomDBRole } func (opts *createCustomDatabaseRoleOpts) preRun() (err error) { @@ -59,10 +60,12 @@ func (opts *createCustomDatabaseRoleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createCustomDatabaseRoleOpts) readData(r io.Reader) (*admin.UserCustomDBRole, error) { @@ -87,7 +90,7 @@ func (opts *createCustomDatabaseRoleOpts) readData(r io.Reader) (*admin.UserCust return out, nil } -func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +102,29 @@ func (opts *createCustomDatabaseRoleOpts) run(ctx context.Context, r io.Reader, UserCustomDBRole: data, } - resp, _, err := opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CustomDatabaseRolesApi.CreateCustomDatabaseRoleWithParams(ctx, params).Execute() + return err +} + +func (opts *createCustomDatabaseRoleOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createCustomDatabaseRoleBuilder() *cobra.Command { @@ -134,7 +138,10 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -167,20 +174,26 @@ func (opts *deleteCustomDatabaseRoleOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *deleteCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *deleteCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, } - _, err := opts.client.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(ctx, params).Execute() + var err error + _, err = opts.client.CustomDatabaseRolesApi.DeleteCustomDatabaseRoleWithParams(ctx, params).Execute() return err } +func (opts *deleteCustomDatabaseRoleOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func deleteCustomDatabaseRoleBuilder() *cobra.Command { opts := deleteCustomDatabaseRoleOpts{} cmd := &cobra.Command{ @@ -190,7 +203,10 @@ func deleteCustomDatabaseRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -206,6 +222,7 @@ type getCustomDatabaseRoleOpts struct { roleName string format string tmpl *template.Template + resp *admin.UserCustomDBRole } func (opts *getCustomDatabaseRoleOpts) preRun() (err error) { @@ -225,41 +242,44 @@ func (opts *getCustomDatabaseRoleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getCustomDatabaseRoleOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetCustomDatabaseRoleApiParams{ GroupId: opts.groupId, RoleName: opts.roleName, } - resp, _, err := opts.client.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CustomDatabaseRolesApi.GetCustomDatabaseRoleWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getCustomDatabaseRoleOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getCustomDatabaseRoleBuilder() *cobra.Command { @@ -271,7 +291,10 @@ func getCustomDatabaseRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -287,6 +310,7 @@ type listCustomDatabaseRolesOpts struct { groupId string format string tmpl *template.Template + resp []admin.UserCustomDBRole } func (opts *listCustomDatabaseRolesOpts) preRun() (err error) { @@ -306,40 +330,43 @@ func (opts *listCustomDatabaseRolesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listCustomDatabaseRolesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListCustomDatabaseRolesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.CustomDatabaseRolesApi.ListCustomDatabaseRolesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CustomDatabaseRolesApi.ListCustomDatabaseRolesWithParams(ctx, params).Execute() + return err +} + +func (opts *listCustomDatabaseRolesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listCustomDatabaseRolesBuilder() *cobra.Command { @@ -351,7 +378,10 @@ func listCustomDatabaseRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -369,6 +399,7 @@ type updateCustomDatabaseRoleOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.UserCustomDBRole } func (opts *updateCustomDatabaseRoleOpts) preRun() (err error) { @@ -388,10 +419,12 @@ func (opts *updateCustomDatabaseRoleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateCustomDatabaseRoleOpts) readData(r io.Reader) (*admin.UpdateCustomDBRole, error) { @@ -416,7 +449,7 @@ func (opts *updateCustomDatabaseRoleOpts) readData(r io.Reader) (*admin.UpdateCu return out, nil } -func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -429,28 +462,29 @@ func (opts *updateCustomDatabaseRoleOpts) run(ctx context.Context, r io.Reader, UpdateCustomDBRole: data, } - resp, _, err := opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.CustomDatabaseRolesApi.UpdateCustomDatabaseRoleWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateCustomDatabaseRoleOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateCustomDatabaseRoleBuilder() *cobra.Command { @@ -464,7 +498,10 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index c0609a0b79..69b86bcd95 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -23,6 +23,7 @@ import ( "errors" "fmt" "io" + "os" "strings" "text/template" @@ -40,6 +41,7 @@ type createDataFederationPrivateEndpointOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedPrivateNetworkEndpointIdEntry } func (opts *createDataFederationPrivateEndpointOpts) preRun() (err error) { @@ -59,10 +61,12 @@ func (opts *createDataFederationPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createDataFederationPrivateEndpointOpts) readData(r io.Reader) (*admin.PrivateNetworkEndpointIdEntry, error) { @@ -87,7 +91,7 @@ func (opts *createDataFederationPrivateEndpointOpts) readData(r io.Reader) (*adm return out, nil } -func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +103,29 @@ func (opts *createDataFederationPrivateEndpointOpts) run(ctx context.Context, r PrivateNetworkEndpointIdEntry: data, } - resp, _, err := opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.CreateDataFederationPrivateEndpointWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createDataFederationPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createDataFederationPrivateEndpointBuilder() *cobra.Command { @@ -134,7 +139,10 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -154,6 +162,7 @@ type createFederatedDatabaseOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DataLakeTenant } func (opts *createFederatedDatabaseOpts) preRun() (err error) { @@ -173,10 +182,12 @@ func (opts *createFederatedDatabaseOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createFederatedDatabaseOpts) readData(r io.Reader) (*admin.DataLakeTenant, error) { @@ -201,7 +212,7 @@ func (opts *createFederatedDatabaseOpts) readData(r io.Reader) (*admin.DataLakeT return out, nil } -func (opts *createFederatedDatabaseOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createFederatedDatabaseOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -215,28 +226,29 @@ func (opts *createFederatedDatabaseOpts) run(ctx context.Context, r io.Reader, w DataLakeTenant: data, } - resp, _, err := opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.CreateFederatedDatabaseWithParams(ctx, params).Execute() + return err +} + +func (opts *createFederatedDatabaseOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createFederatedDatabaseBuilder() *cobra.Command { @@ -250,7 +262,10 @@ func createFederatedDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -272,6 +287,7 @@ type createOneDataFederationQueryLimitOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DataFederationTenantQueryLimit } func (opts *createOneDataFederationQueryLimitOpts) preRun() (err error) { @@ -291,10 +307,12 @@ func (opts *createOneDataFederationQueryLimitOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createOneDataFederationQueryLimitOpts) readData(r io.Reader) (*admin.DataFederationTenantQueryLimit, error) { @@ -319,7 +337,7 @@ func (opts *createOneDataFederationQueryLimitOpts) readData(r io.Reader) (*admin return out, nil } -func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -333,28 +351,29 @@ func (opts *createOneDataFederationQueryLimitOpts) run(ctx context.Context, r io DataFederationTenantQueryLimit: data, } - resp, _, err := opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.CreateOneDataFederationQueryLimitWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createOneDataFederationQueryLimitOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createOneDataFederationQueryLimitBuilder() *cobra.Command { @@ -368,7 +387,10 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -397,6 +419,7 @@ type deleteDataFederationPrivateEndpointOpts struct { endpointId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteDataFederationPrivateEndpointOpts) preRun() (err error) { @@ -416,41 +439,44 @@ func (opts *deleteDataFederationPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteDataFederationPrivateEndpointOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, EndpointId: opts.endpointId, } - resp, _, err := opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.DeleteDataFederationPrivateEndpointWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteDataFederationPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { @@ -462,7 +488,10 @@ func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -479,6 +508,7 @@ type deleteFederatedDatabaseOpts struct { tenantName string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteFederatedDatabaseOpts) preRun() (err error) { @@ -498,41 +528,44 @@ func (opts *deleteFederatedDatabaseOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteFederatedDatabaseOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteFederatedDatabaseApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.DeleteFederatedDatabaseWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteFederatedDatabaseOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteFederatedDatabaseBuilder() *cobra.Command { @@ -544,7 +577,10 @@ func deleteFederatedDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -562,6 +598,7 @@ type deleteOneDataFederationInstanceQueryLimitOpts struct { limitName string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteOneDataFederationInstanceQueryLimitOpts) preRun() (err error) { @@ -581,13 +618,15 @@ func (opts *deleteOneDataFederationInstanceQueryLimitOpts) preRun() (err error) } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteOneDataFederationInstanceQueryLimitApiParams{ GroupId: opts.groupId, @@ -595,28 +634,29 @@ func (opts *deleteOneDataFederationInstanceQueryLimitOpts) run(ctx context.Conte LimitName: opts.limitName, } - resp, _, err := opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.DeleteOneDataFederationInstanceQueryLimitWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteOneDataFederationInstanceQueryLimitOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { @@ -628,7 +668,10 @@ func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -657,6 +700,7 @@ type downloadFederatedDatabaseQueryLogsOpts struct { startDate int64 format string tmpl *template.Template + resp *os.File } func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { @@ -676,13 +720,15 @@ func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DownloadFederatedDatabaseQueryLogsApiParams{ GroupId: opts.groupId, @@ -691,28 +737,29 @@ func (opts *downloadFederatedDatabaseQueryLogsOpts) run(ctx context.Context, _ i StartDate: &opts.startDate, } - resp, _, err := opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.DownloadFederatedDatabaseQueryLogsWithParams(ctx, params).Execute() + return err +} + +func (opts *downloadFederatedDatabaseQueryLogsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { @@ -724,7 +771,10 @@ func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -743,6 +793,7 @@ type getDataFederationPrivateEndpointOpts struct { endpointId string format string tmpl *template.Template + resp *admin.PrivateNetworkEndpointIdEntry } func (opts *getDataFederationPrivateEndpointOpts) preRun() (err error) { @@ -762,41 +813,44 @@ func (opts *getDataFederationPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getDataFederationPrivateEndpointOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetDataFederationPrivateEndpointApiParams{ GroupId: opts.groupId, EndpointId: opts.endpointId, } - resp, _, err := opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.GetDataFederationPrivateEndpointWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getDataFederationPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getDataFederationPrivateEndpointBuilder() *cobra.Command { @@ -808,7 +862,10 @@ func getDataFederationPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -825,6 +882,7 @@ type getFederatedDatabaseOpts struct { tenantName string format string tmpl *template.Template + resp *admin.DataLakeTenant } func (opts *getFederatedDatabaseOpts) preRun() (err error) { @@ -844,41 +902,44 @@ func (opts *getFederatedDatabaseOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getFederatedDatabaseOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getFederatedDatabaseOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetFederatedDatabaseApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.GetFederatedDatabaseWithParams(ctx, params).Execute() + return err +} + +func (opts *getFederatedDatabaseOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getFederatedDatabaseBuilder() *cobra.Command { @@ -890,7 +951,10 @@ func getFederatedDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -909,6 +973,7 @@ type listDataFederationPrivateEndpointsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedPrivateNetworkEndpointIdEntry } func (opts *listDataFederationPrivateEndpointsOpts) preRun() (err error) { @@ -928,13 +993,15 @@ func (opts *listDataFederationPrivateEndpointsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListDataFederationPrivateEndpointsApiParams{ GroupId: opts.groupId, @@ -943,28 +1010,29 @@ func (opts *listDataFederationPrivateEndpointsOpts) run(ctx context.Context, _ i PageNum: &opts.pageNum, } - resp, _, err := opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.ListDataFederationPrivateEndpointsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listDataFederationPrivateEndpointsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listDataFederationPrivateEndpointsBuilder() *cobra.Command { @@ -976,7 +1044,10 @@ func listDataFederationPrivateEndpointsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -994,6 +1065,7 @@ type listFederatedDatabasesOpts struct { type_ string format string tmpl *template.Template + resp []admin.DataLakeTenant } func (opts *listFederatedDatabasesOpts) preRun() (err error) { @@ -1013,41 +1085,44 @@ func (opts *listFederatedDatabasesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listFederatedDatabasesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listFederatedDatabasesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListFederatedDatabasesApiParams{ GroupId: opts.groupId, Type_: &opts.type_, } - resp, _, err := opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.ListFederatedDatabasesWithParams(ctx, params).Execute() + return err +} + +func (opts *listFederatedDatabasesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listFederatedDatabasesBuilder() *cobra.Command { @@ -1059,7 +1134,10 @@ func listFederatedDatabasesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1076,6 +1154,7 @@ type returnFederatedDatabaseQueryLimitOpts struct { limitName string format string tmpl *template.Template + resp *admin.DataFederationTenantQueryLimit } func (opts *returnFederatedDatabaseQueryLimitOpts) preRun() (err error) { @@ -1095,13 +1174,15 @@ func (opts *returnFederatedDatabaseQueryLimitOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ReturnFederatedDatabaseQueryLimitApiParams{ GroupId: opts.groupId, @@ -1109,28 +1190,29 @@ func (opts *returnFederatedDatabaseQueryLimitOpts) run(ctx context.Context, _ io LimitName: opts.limitName, } - resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *returnFederatedDatabaseQueryLimitOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { @@ -1142,7 +1224,10 @@ func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1169,6 +1254,7 @@ type returnFederatedDatabaseQueryLimitsOpts struct { tenantName string format string tmpl *template.Template + resp []admin.DataFederationTenantQueryLimit } func (opts *returnFederatedDatabaseQueryLimitsOpts) preRun() (err error) { @@ -1188,41 +1274,44 @@ func (opts *returnFederatedDatabaseQueryLimitsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *returnFederatedDatabaseQueryLimitsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ReturnFederatedDatabaseQueryLimitsApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.ReturnFederatedDatabaseQueryLimitsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *returnFederatedDatabaseQueryLimitsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { @@ -1234,7 +1323,10 @@ func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1255,6 +1347,7 @@ type updateFederatedDatabaseOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DataLakeTenant } func (opts *updateFederatedDatabaseOpts) preRun() (err error) { @@ -1274,10 +1367,12 @@ func (opts *updateFederatedDatabaseOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateFederatedDatabaseOpts) readData(r io.Reader) (*admin.DataLakeTenant, error) { @@ -1302,7 +1397,7 @@ func (opts *updateFederatedDatabaseOpts) readData(r io.Reader) (*admin.DataLakeT return out, nil } -func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1316,28 +1411,29 @@ func (opts *updateFederatedDatabaseOpts) run(ctx context.Context, r io.Reader, w DataLakeTenant: data, } - resp, _, err := opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataFederationApi.UpdateFederatedDatabaseWithParams(ctx, params).Execute() + return err +} + +func (opts *updateFederatedDatabaseOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateFederatedDatabaseBuilder() *cobra.Command { @@ -1351,7 +1447,10 @@ func updateFederatedDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index b7246d4d82..719943970f 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -41,6 +41,7 @@ type createPipelineOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DataLakeIngestionPipeline } func (opts *createPipelineOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createPipelineOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createPipelineOpts) readData(r io.Reader) (*admin.DataLakeIngestionPipeline, error) { @@ -88,7 +91,7 @@ func (opts *createPipelineOpts) readData(r io.Reader) (*admin.DataLakeIngestionP return out, nil } -func (opts *createPipelineOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createPipelineOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -100,28 +103,29 @@ func (opts *createPipelineOpts) run(ctx context.Context, r io.Reader, w io.Write DataLakeIngestionPipeline: data, } - resp, _, err := opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.CreatePipelineWithParams(ctx, params).Execute() + return err +} + +func (opts *createPipelineOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createPipelineBuilder() *cobra.Command { @@ -135,7 +139,10 @@ func createPipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -152,6 +159,7 @@ type deletePipelineOpts struct { pipelineName string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deletePipelineOpts) preRun() (err error) { @@ -171,41 +179,44 @@ func (opts *deletePipelineOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deletePipelineOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deletePipelineOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeletePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.DeletePipelineWithParams(ctx, params).Execute() + return err +} + +func (opts *deletePipelineOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deletePipelineBuilder() *cobra.Command { @@ -217,7 +228,10 @@ func deletePipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -235,6 +249,7 @@ type deletePipelineRunDatasetOpts struct { pipelineRunId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deletePipelineRunDatasetOpts) preRun() (err error) { @@ -254,13 +269,15 @@ func (opts *deletePipelineRunDatasetOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeletePipelineRunDatasetApiParams{ GroupId: opts.groupId, @@ -268,28 +285,29 @@ func (opts *deletePipelineRunDatasetOpts) run(ctx context.Context, _ io.Reader, PipelineRunId: opts.pipelineRunId, } - resp, _, err := opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.DeletePipelineRunDatasetWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deletePipelineRunDatasetOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deletePipelineRunDatasetBuilder() *cobra.Command { @@ -301,7 +319,10 @@ func deletePipelineRunDatasetBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -320,6 +341,7 @@ type getPipelineOpts struct { pipelineName string format string tmpl *template.Template + resp *admin.DataLakeIngestionPipeline } func (opts *getPipelineOpts) preRun() (err error) { @@ -339,41 +361,44 @@ func (opts *getPipelineOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getPipelineOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getPipelineOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetPipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.GetPipelineWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getPipelineOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getPipelineBuilder() *cobra.Command { @@ -385,7 +410,10 @@ func getPipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -403,6 +431,7 @@ type getPipelineRunOpts struct { pipelineRunId string format string tmpl *template.Template + resp *admin.IngestionPipelineRun } func (opts *getPipelineRunOpts) preRun() (err error) { @@ -422,13 +451,15 @@ func (opts *getPipelineRunOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getPipelineRunOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getPipelineRunOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetPipelineRunApiParams{ GroupId: opts.groupId, @@ -436,28 +467,29 @@ func (opts *getPipelineRunOpts) run(ctx context.Context, _ io.Reader, w io.Write PipelineRunId: opts.pipelineRunId, } - resp, _, err := opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.GetPipelineRunWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getPipelineRunOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getPipelineRunBuilder() *cobra.Command { @@ -469,7 +501,10 @@ func getPipelineRunBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -492,6 +527,7 @@ type listPipelineRunsOpts struct { createdBefore string format string tmpl *template.Template + resp *admin.PaginatedPipelineRun } func (opts *listPipelineRunsOpts) preRun() (err error) { @@ -511,13 +547,15 @@ func (opts *listPipelineRunsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPipelineRunsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPipelineRunsOpts) run(ctx context.Context, _ io.Reader) error { var createdBefore *time.Time var errCreatedBefore error @@ -537,28 +575,29 @@ func (opts *listPipelineRunsOpts) run(ctx context.Context, _ io.Reader, w io.Wri CreatedBefore: createdBefore, } - resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.ListPipelineRunsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listPipelineRunsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPipelineRunsBuilder() *cobra.Command { @@ -570,7 +609,10 @@ func listPipelineRunsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -591,6 +633,7 @@ type listPipelineSchedulesOpts struct { pipelineName string format string tmpl *template.Template + resp []admin.DiskBackupApiPolicyItem } func (opts *listPipelineSchedulesOpts) preRun() (err error) { @@ -610,41 +653,44 @@ func (opts *listPipelineSchedulesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPipelineSchedulesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPipelineSchedulesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListPipelineSchedulesApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.ListPipelineSchedulesWithParams(ctx, params).Execute() + return err +} + +func (opts *listPipelineSchedulesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPipelineSchedulesBuilder() *cobra.Command { @@ -656,7 +702,10 @@ func listPipelineSchedulesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -677,6 +726,7 @@ type listPipelineSnapshotsOpts struct { completedAfter string format string tmpl *template.Template + resp *admin.PaginatedBackupSnapshot } func (opts *listPipelineSnapshotsOpts) preRun() (err error) { @@ -696,13 +746,15 @@ func (opts *listPipelineSnapshotsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, _ io.Reader) error { var completedAfter *time.Time var errCompletedAfter error @@ -722,28 +774,29 @@ func (opts *listPipelineSnapshotsOpts) run(ctx context.Context, _ io.Reader, w i CompletedAfter: completedAfter, } - resp, _, err := opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.ListPipelineSnapshotsWithParams(ctx, params).Execute() + return err +} + +func (opts *listPipelineSnapshotsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPipelineSnapshotsBuilder() *cobra.Command { @@ -755,7 +808,10 @@ func listPipelineSnapshotsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -775,6 +831,7 @@ type listPipelinesOpts struct { groupId string format string tmpl *template.Template + resp []admin.DataLakeIngestionPipeline } func (opts *listPipelinesOpts) preRun() (err error) { @@ -794,40 +851,43 @@ func (opts *listPipelinesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPipelinesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPipelinesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListPipelinesApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.DataLakePipelinesApi.ListPipelinesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.ListPipelinesWithParams(ctx, params).Execute() + return err +} + +func (opts *listPipelinesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPipelinesBuilder() *cobra.Command { @@ -839,7 +899,10 @@ func listPipelinesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -854,6 +917,7 @@ type pausePipelineOpts struct { pipelineName string format string tmpl *template.Template + resp *admin.DataLakeIngestionPipeline } func (opts *pausePipelineOpts) preRun() (err error) { @@ -873,41 +937,44 @@ func (opts *pausePipelineOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *pausePipelineOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *pausePipelineOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.PausePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.PausePipelineWithParams(ctx, params).Execute() + return err +} + +func (opts *pausePipelineOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func pausePipelineBuilder() *cobra.Command { @@ -919,7 +986,10 @@ func pausePipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -936,6 +1006,7 @@ type resumePipelineOpts struct { pipelineName string format string tmpl *template.Template + resp *admin.DataLakeIngestionPipeline } func (opts *resumePipelineOpts) preRun() (err error) { @@ -955,41 +1026,44 @@ func (opts *resumePipelineOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *resumePipelineOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *resumePipelineOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ResumePipelineApiParams{ GroupId: opts.groupId, PipelineName: opts.pipelineName, } - resp, _, err := opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.ResumePipelineWithParams(ctx, params).Execute() + return err +} + +func (opts *resumePipelineOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func resumePipelineBuilder() *cobra.Command { @@ -1001,7 +1075,10 @@ func resumePipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1021,6 +1098,7 @@ type triggerSnapshotIngestionOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.IngestionPipelineRun } func (opts *triggerSnapshotIngestionOpts) preRun() (err error) { @@ -1040,10 +1118,12 @@ func (opts *triggerSnapshotIngestionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *triggerSnapshotIngestionOpts) readData(r io.Reader) (*admin.TriggerIngestionPipelineRequest, error) { @@ -1068,7 +1148,7 @@ func (opts *triggerSnapshotIngestionOpts) readData(r io.Reader) (*admin.TriggerI return out, nil } -func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1081,28 +1161,29 @@ func (opts *triggerSnapshotIngestionOpts) run(ctx context.Context, r io.Reader, TriggerIngestionPipelineRequest: data, } - resp, _, err := opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.TriggerSnapshotIngestionWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *triggerSnapshotIngestionOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func triggerSnapshotIngestionBuilder() *cobra.Command { @@ -1116,7 +1197,10 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1138,6 +1222,7 @@ type updatePipelineOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DataLakeIngestionPipeline } func (opts *updatePipelineOpts) preRun() (err error) { @@ -1157,10 +1242,12 @@ func (opts *updatePipelineOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updatePipelineOpts) readData(r io.Reader) (*admin.DataLakeIngestionPipeline, error) { @@ -1185,7 +1272,7 @@ func (opts *updatePipelineOpts) readData(r io.Reader) (*admin.DataLakeIngestionP return out, nil } -func (opts *updatePipelineOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updatePipelineOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1198,28 +1285,29 @@ func (opts *updatePipelineOpts) run(ctx context.Context, r io.Reader, w io.Write DataLakeIngestionPipeline: data, } - resp, _, err := opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DataLakePipelinesApi.UpdatePipelineWithParams(ctx, params).Execute() + return err +} + +func (opts *updatePipelineOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updatePipelineBuilder() *cobra.Command { @@ -1233,7 +1321,10 @@ func updatePipelineBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index b7d26c80c9..634f7ef6ec 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -40,6 +40,7 @@ type createDatabaseUserOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CloudDatabaseUser } func (opts *createDatabaseUserOpts) preRun() (err error) { @@ -59,10 +60,12 @@ func (opts *createDatabaseUserOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createDatabaseUserOpts) readData(r io.Reader) (*admin.CloudDatabaseUser, error) { @@ -87,7 +90,7 @@ func (opts *createDatabaseUserOpts) readData(r io.Reader) (*admin.CloudDatabaseU return out, nil } -func (opts *createDatabaseUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createDatabaseUserOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +102,29 @@ func (opts *createDatabaseUserOpts) run(ctx context.Context, r io.Reader, w io.W CloudDatabaseUser: data, } - resp, _, err := opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DatabaseUsersApi.CreateDatabaseUserWithParams(ctx, params).Execute() + return err +} + +func (opts *createDatabaseUserOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createDatabaseUserBuilder() *cobra.Command { @@ -134,7 +138,10 @@ func createDatabaseUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -152,6 +159,7 @@ type deleteDatabaseUserOpts struct { username string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteDatabaseUserOpts) preRun() (err error) { @@ -171,13 +179,15 @@ func (opts *deleteDatabaseUserOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteDatabaseUserOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteDatabaseUserOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteDatabaseUserApiParams{ GroupId: opts.groupId, @@ -185,28 +195,29 @@ func (opts *deleteDatabaseUserOpts) run(ctx context.Context, _ io.Reader, w io.W Username: opts.username, } - resp, _, err := opts.client.DatabaseUsersApi.DeleteDatabaseUserWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DatabaseUsersApi.DeleteDatabaseUserWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteDatabaseUserOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteDatabaseUserBuilder() *cobra.Command { @@ -218,7 +229,10 @@ func deleteDatabaseUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -250,6 +264,7 @@ type getDatabaseUserOpts struct { username string format string tmpl *template.Template + resp *admin.CloudDatabaseUser } func (opts *getDatabaseUserOpts) preRun() (err error) { @@ -269,13 +284,15 @@ func (opts *getDatabaseUserOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getDatabaseUserOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getDatabaseUserOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetDatabaseUserApiParams{ GroupId: opts.groupId, @@ -283,28 +300,29 @@ func (opts *getDatabaseUserOpts) run(ctx context.Context, _ io.Reader, w io.Writ Username: opts.username, } - resp, _, err := opts.client.DatabaseUsersApi.GetDatabaseUserWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DatabaseUsersApi.GetDatabaseUserWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getDatabaseUserOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getDatabaseUserBuilder() *cobra.Command { @@ -316,7 +334,10 @@ func getDatabaseUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -349,6 +370,7 @@ type listDatabaseUsersOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiAtlasDatabaseUser } func (opts *listDatabaseUsersOpts) preRun() (err error) { @@ -368,13 +390,15 @@ func (opts *listDatabaseUsersOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listDatabaseUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listDatabaseUsersOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListDatabaseUsersApiParams{ GroupId: opts.groupId, @@ -383,28 +407,29 @@ func (opts *listDatabaseUsersOpts) run(ctx context.Context, _ io.Reader, w io.Wr PageNum: &opts.pageNum, } - resp, _, err := opts.client.DatabaseUsersApi.ListDatabaseUsersWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DatabaseUsersApi.ListDatabaseUsersWithParams(ctx, params).Execute() + return err +} + +func (opts *listDatabaseUsersOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listDatabaseUsersBuilder() *cobra.Command { @@ -416,7 +441,10 @@ func listDatabaseUsersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -438,6 +466,7 @@ type updateDatabaseUserOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CloudDatabaseUser } func (opts *updateDatabaseUserOpts) preRun() (err error) { @@ -457,10 +486,12 @@ func (opts *updateDatabaseUserOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateDatabaseUserOpts) readData(r io.Reader) (*admin.CloudDatabaseUser, error) { @@ -485,7 +516,7 @@ func (opts *updateDatabaseUserOpts) readData(r io.Reader) (*admin.CloudDatabaseU return out, nil } -func (opts *updateDatabaseUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateDatabaseUserOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -499,28 +530,29 @@ func (opts *updateDatabaseUserOpts) run(ctx context.Context, r io.Reader, w io.W CloudDatabaseUser: data, } - resp, _, err := opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.DatabaseUsersApi.UpdateDatabaseUserWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateDatabaseUserOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateDatabaseUserBuilder() *cobra.Command { @@ -534,7 +566,10 @@ func updateDatabaseUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index 70cf96b190..9db6ba234d 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -37,6 +37,7 @@ type getEncryptionAtRestOpts struct { groupId string format string tmpl *template.Template + resp *admin.EncryptionAtRest } func (opts *getEncryptionAtRestOpts) preRun() (err error) { @@ -56,40 +57,43 @@ func (opts *getEncryptionAtRestOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getEncryptionAtRestOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getEncryptionAtRestOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetEncryptionAtRestApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRestWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRestWithParams(ctx, params).Execute() + return err +} + +func (opts *getEncryptionAtRestOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getEncryptionAtRestBuilder() *cobra.Command { @@ -101,7 +105,10 @@ func getEncryptionAtRestBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -118,6 +125,7 @@ type updateEncryptionAtRestOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.EncryptionAtRest } func (opts *updateEncryptionAtRestOpts) preRun() (err error) { @@ -137,10 +145,12 @@ func (opts *updateEncryptionAtRestOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateEncryptionAtRestOpts) readData(r io.Reader) (*admin.EncryptionAtRest, error) { @@ -165,7 +175,7 @@ func (opts *updateEncryptionAtRestOpts) readData(r io.Reader) (*admin.Encryption return out, nil } -func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -177,28 +187,29 @@ func (opts *updateEncryptionAtRestOpts) run(ctx context.Context, r io.Reader, w EncryptionAtRest: data, } - resp, _, err := opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.EncryptionAtRestUsingCustomerKeyManagementApi.UpdateEncryptionAtRestWithParams(ctx, params).Execute() + return err +} + +func (opts *updateEncryptionAtRestOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateEncryptionAtRestBuilder() *cobra.Command { @@ -212,7 +223,10 @@ func updateEncryptionAtRestBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 638086a2c8..c06e490fb4 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -39,6 +39,7 @@ type getOrganizationEventOpts struct { includeRaw bool format string tmpl *template.Template + resp *admin.EventViewForOrg } func (opts *getOrganizationEventOpts) preRun() (err error) { @@ -58,13 +59,15 @@ func (opts *getOrganizationEventOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getOrganizationEventOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getOrganizationEventOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetOrganizationEventApiParams{ OrgId: opts.orgId, @@ -72,28 +75,29 @@ func (opts *getOrganizationEventOpts) run(ctx context.Context, _ io.Reader, w io IncludeRaw: &opts.includeRaw, } - resp, _, err := opts.client.EventsApi.GetOrganizationEventWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.EventsApi.GetOrganizationEventWithParams(ctx, params).Execute() + return err +} + +func (opts *getOrganizationEventOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getOrganizationEventBuilder() *cobra.Command { @@ -105,7 +109,10 @@ func getOrganizationEventBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -124,6 +131,7 @@ type getProjectEventOpts struct { includeRaw bool format string tmpl *template.Template + resp *admin.EventViewForNdsGroup } func (opts *getProjectEventOpts) preRun() (err error) { @@ -143,13 +151,15 @@ func (opts *getProjectEventOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getProjectEventOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getProjectEventOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetProjectEventApiParams{ GroupId: opts.groupId, @@ -157,28 +167,29 @@ func (opts *getProjectEventOpts) run(ctx context.Context, _ io.Reader, w io.Writ IncludeRaw: &opts.includeRaw, } - resp, _, err := opts.client.EventsApi.GetProjectEventWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.EventsApi.GetProjectEventWithParams(ctx, params).Execute() + return err +} + +func (opts *getProjectEventOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getProjectEventBuilder() *cobra.Command { @@ -190,7 +201,10 @@ func getProjectEventBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -214,6 +228,7 @@ type listOrganizationEventsOpts struct { minDate string format string tmpl *template.Template + resp *admin.OrgPaginatedEvent } func (opts *listOrganizationEventsOpts) preRun() (err error) { @@ -233,13 +248,15 @@ func (opts *listOrganizationEventsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listOrganizationEventsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listOrganizationEventsOpts) run(ctx context.Context, _ io.Reader) error { var maxDate *time.Time var errMaxDate error @@ -270,28 +287,29 @@ func (opts *listOrganizationEventsOpts) run(ctx context.Context, _ io.Reader, w MinDate: minDate, } - resp, _, err := opts.client.EventsApi.ListOrganizationEventsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.EventsApi.ListOrganizationEventsWithParams(ctx, params).Execute() + return err +} + +func (opts *listOrganizationEventsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listOrganizationEventsBuilder() *cobra.Command { @@ -303,7 +321,10 @@ func listOrganizationEventsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -335,6 +356,7 @@ type listProjectEventsOpts struct { minDate string format string tmpl *template.Template + resp *admin.GroupPaginatedEvent } func (opts *listProjectEventsOpts) preRun() (err error) { @@ -354,13 +376,15 @@ func (opts *listProjectEventsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listProjectEventsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listProjectEventsOpts) run(ctx context.Context, _ io.Reader) error { var maxDate *time.Time var errMaxDate error @@ -393,28 +417,29 @@ func (opts *listProjectEventsOpts) run(ctx context.Context, _ io.Reader, w io.Wr MinDate: minDate, } - resp, _, err := opts.client.EventsApi.ListProjectEventsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.EventsApi.ListProjectEventsWithParams(ctx, params).Execute() + return err +} + +func (opts *listProjectEventsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listProjectEventsBuilder() *cobra.Command { @@ -426,7 +451,10 @@ func listProjectEventsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index aa5358702b..112b10673c 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -41,6 +41,7 @@ type createRoleMappingOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.AuthFederationRoleMapping } func (opts *createRoleMappingOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createRoleMappingOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createRoleMappingOpts) readData(r io.Reader) (*admin.AuthFederationRoleMapping, error) { @@ -88,7 +91,7 @@ func (opts *createRoleMappingOpts) readData(r io.Reader) (*admin.AuthFederationR return out, nil } -func (opts *createRoleMappingOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createRoleMappingOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *createRoleMappingOpts) run(ctx context.Context, r io.Reader, w io.Wr AuthFederationRoleMapping: data, } - resp, _, err := opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.CreateRoleMappingWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createRoleMappingOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createRoleMappingBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func createRoleMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -159,19 +166,25 @@ func (opts *deleteFederationAppOpts) preRun() (err error) { return err } - return err + return nil } -func (opts *deleteFederationAppOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *deleteFederationAppOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteFederationAppApiParams{ FederationSettingsId: opts.federationSettingsId, } - _, err := opts.client.FederatedAuthenticationApi.DeleteFederationAppWithParams(ctx, params).Execute() + var err error + _, err = opts.client.FederatedAuthenticationApi.DeleteFederationAppWithParams(ctx, params).Execute() return err } +func (opts *deleteFederationAppOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func deleteFederationAppBuilder() *cobra.Command { opts := deleteFederationAppOpts{} cmd := &cobra.Command{ @@ -181,7 +194,10 @@ func deleteFederationAppBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -213,10 +229,10 @@ func (opts *deleteRoleMappingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return err + return nil } -func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -224,10 +240,16 @@ func (opts *deleteRoleMappingOpts) run(ctx context.Context, _ io.Reader, _ io.Wr OrgId: opts.orgId, } - _, err := opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params).Execute() + var err error + _, err = opts.client.FederatedAuthenticationApi.DeleteRoleMappingWithParams(ctx, params).Execute() return err } +func (opts *deleteRoleMappingOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func deleteRoleMappingBuilder() *cobra.Command { opts := deleteRoleMappingOpts{} cmd := &cobra.Command{ @@ -237,7 +259,10 @@ func deleteRoleMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -255,6 +280,7 @@ type getConnectedOrgConfigOpts struct { orgId string format string tmpl *template.Template + resp *admin.ConnectedOrgConfig } func (opts *getConnectedOrgConfigOpts) preRun() (err error) { @@ -263,41 +289,44 @@ func (opts *getConnectedOrgConfigOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getConnectedOrgConfigOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getConnectedOrgConfigOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.GetConnectedOrgConfigWithParams(ctx, params).Execute() + return err +} + +func (opts *getConnectedOrgConfigOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getConnectedOrgConfigBuilder() *cobra.Command { @@ -309,7 +338,10 @@ func getConnectedOrgConfigBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -326,6 +358,7 @@ type getFederationSettingsOpts struct { orgId string format string tmpl *template.Template + resp *admin.OrgFederationSettings } func (opts *getFederationSettingsOpts) preRun() (err error) { @@ -345,40 +378,43 @@ func (opts *getFederationSettingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getFederationSettingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getFederationSettingsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetFederationSettingsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetFederationSettingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.GetFederationSettingsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getFederationSettingsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getFederationSettingsBuilder() *cobra.Command { @@ -390,7 +426,10 @@ func getFederationSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -405,6 +444,7 @@ type getIdentityProviderOpts struct { identityProviderId string format string tmpl *template.Template + resp *admin.FederationIdentityProvider } func (opts *getIdentityProviderOpts) preRun() (err error) { @@ -413,41 +453,44 @@ func (opts *getIdentityProviderOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getIdentityProviderOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getIdentityProviderOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetIdentityProviderApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.GetIdentityProviderWithParams(ctx, params).Execute() + return err +} + +func (opts *getIdentityProviderOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getIdentityProviderBuilder() *cobra.Command { @@ -459,7 +502,10 @@ func getIdentityProviderBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -477,6 +523,7 @@ type getIdentityProviderMetadataOpts struct { identityProviderId string format string tmpl *template.Template + resp string } func (opts *getIdentityProviderMetadataOpts) preRun() (err error) { @@ -485,41 +532,44 @@ func (opts *getIdentityProviderMetadataOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getIdentityProviderMetadataOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getIdentityProviderMetadataOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetIdentityProviderMetadataApiParams{ FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.GetIdentityProviderMetadataWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getIdentityProviderMetadataOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getIdentityProviderMetadataBuilder() *cobra.Command { @@ -531,7 +581,10 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -550,6 +603,7 @@ type getRoleMappingOpts struct { orgId string format string tmpl *template.Template + resp *admin.AuthFederationRoleMapping } func (opts *getRoleMappingOpts) preRun() (err error) { @@ -569,13 +623,15 @@ func (opts *getRoleMappingOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getRoleMappingOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getRoleMappingOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetRoleMappingApiParams{ FederationSettingsId: opts.federationSettingsId, @@ -583,28 +639,29 @@ func (opts *getRoleMappingOpts) run(ctx context.Context, _ io.Reader, w io.Write OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.GetRoleMappingWithParams(ctx, params).Execute() + return err +} + +func (opts *getRoleMappingOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getRoleMappingBuilder() *cobra.Command { @@ -616,7 +673,10 @@ func getRoleMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -634,6 +694,7 @@ type listConnectedOrgConfigsOpts struct { federationSettingsId string format string tmpl *template.Template + resp []admin.ConnectedOrgConfig } func (opts *listConnectedOrgConfigsOpts) preRun() (err error) { @@ -642,40 +703,43 @@ func (opts *listConnectedOrgConfigsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listConnectedOrgConfigsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listConnectedOrgConfigsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListConnectedOrgConfigsApiParams{ FederationSettingsId: opts.federationSettingsId, } - resp, _, err := opts.client.FederatedAuthenticationApi.ListConnectedOrgConfigsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.ListConnectedOrgConfigsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listConnectedOrgConfigsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listConnectedOrgConfigsBuilder() *cobra.Command { @@ -687,7 +751,10 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -702,6 +769,7 @@ type listIdentityProvidersOpts struct { federationSettingsId string format string tmpl *template.Template + resp []admin.FederationIdentityProvider } func (opts *listIdentityProvidersOpts) preRun() (err error) { @@ -710,40 +778,43 @@ func (opts *listIdentityProvidersOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listIdentityProvidersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listIdentityProvidersOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListIdentityProvidersApiParams{ FederationSettingsId: opts.federationSettingsId, } - resp, _, err := opts.client.FederatedAuthenticationApi.ListIdentityProvidersWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.ListIdentityProvidersWithParams(ctx, params).Execute() + return err +} + +func (opts *listIdentityProvidersOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listIdentityProvidersBuilder() *cobra.Command { @@ -755,7 +826,10 @@ func listIdentityProvidersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -771,6 +845,7 @@ type listRoleMappingsOpts struct { orgId string format string tmpl *template.Template + resp []admin.AuthFederationRoleMapping } func (opts *listRoleMappingsOpts) preRun() (err error) { @@ -790,41 +865,44 @@ func (opts *listRoleMappingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listRoleMappingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listRoleMappingsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListRoleMappingsApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.ListRoleMappingsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listRoleMappingsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listRoleMappingsBuilder() *cobra.Command { @@ -836,7 +914,10 @@ func listRoleMappingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -853,6 +934,7 @@ type removeConnectedOrgConfigOpts struct { orgId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *removeConnectedOrgConfigOpts) preRun() (err error) { @@ -861,41 +943,44 @@ func (opts *removeConnectedOrgConfigOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *removeConnectedOrgConfigOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *removeConnectedOrgConfigOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.RemoveConnectedOrgConfigApiParams{ FederationSettingsId: opts.federationSettingsId, OrgId: opts.orgId, } - resp, _, err := opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.RemoveConnectedOrgConfigWithParams(ctx, params).Execute() + return err +} + +func (opts *removeConnectedOrgConfigOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func removeConnectedOrgConfigBuilder() *cobra.Command { @@ -907,7 +992,10 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -928,6 +1016,7 @@ type updateConnectedOrgConfigOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ConnectedOrgConfig } func (opts *updateConnectedOrgConfigOpts) preRun() (err error) { @@ -936,10 +1025,12 @@ func (opts *updateConnectedOrgConfigOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateConnectedOrgConfigOpts) readData(r io.Reader) (*admin.ConnectedOrgConfig, error) { @@ -964,7 +1055,7 @@ func (opts *updateConnectedOrgConfigOpts) readData(r io.Reader) (*admin.Connecte return out, nil } -func (opts *updateConnectedOrgConfigOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateConnectedOrgConfigOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -977,28 +1068,29 @@ func (opts *updateConnectedOrgConfigOpts) run(ctx context.Context, r io.Reader, ConnectedOrgConfig: data, } - resp, _, err := opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.UpdateConnectedOrgConfigWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateConnectedOrgConfigOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateConnectedOrgConfigBuilder() *cobra.Command { @@ -1012,7 +1104,10 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -1035,6 +1130,7 @@ type updateIdentityProviderOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.FederationIdentityProvider } func (opts *updateIdentityProviderOpts) preRun() (err error) { @@ -1043,10 +1139,12 @@ func (opts *updateIdentityProviderOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateIdentityProviderOpts) readData(r io.Reader) (*admin.SamlIdentityProviderUpdate, error) { @@ -1071,7 +1169,7 @@ func (opts *updateIdentityProviderOpts) readData(r io.Reader) (*admin.SamlIdenti return out, nil } -func (opts *updateIdentityProviderOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateIdentityProviderOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1084,28 +1182,29 @@ func (opts *updateIdentityProviderOpts) run(ctx context.Context, r io.Reader, w SamlIdentityProviderUpdate: data, } - resp, _, err := opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.UpdateIdentityProviderWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateIdentityProviderOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateIdentityProviderBuilder() *cobra.Command { @@ -1119,7 +1218,10 @@ func updateIdentityProviderBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) @@ -1143,6 +1245,7 @@ type updateRoleMappingOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.AuthFederationRoleMapping } func (opts *updateRoleMappingOpts) preRun() (err error) { @@ -1162,10 +1265,12 @@ func (opts *updateRoleMappingOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateRoleMappingOpts) readData(r io.Reader) (*admin.AuthFederationRoleMapping, error) { @@ -1190,7 +1295,7 @@ func (opts *updateRoleMappingOpts) readData(r io.Reader) (*admin.AuthFederationR return out, nil } -func (opts *updateRoleMappingOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateRoleMappingOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1204,28 +1309,29 @@ func (opts *updateRoleMappingOpts) run(ctx context.Context, r io.Reader, w io.Wr AuthFederationRoleMapping: data, } - resp, _, err := opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.UpdateRoleMappingWithParams(ctx, params).Execute() + return err +} + +func (opts *updateRoleMappingOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateRoleMappingBuilder() *cobra.Command { @@ -1239,7 +1345,10 @@ func updateRoleMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 99e5e58ac3..f27bd87ab8 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -41,6 +41,7 @@ type createCustomZoneMappingOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GeoSharding } func (opts *createCustomZoneMappingOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createCustomZoneMappingOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createCustomZoneMappingOpts) readData(r io.Reader) (*admin.GeoSharding, error) { @@ -88,7 +91,7 @@ func (opts *createCustomZoneMappingOpts) readData(r io.Reader) (*admin.GeoShardi return out, nil } -func (opts *createCustomZoneMappingOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createCustomZoneMappingOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *createCustomZoneMappingOpts) run(ctx context.Context, r io.Reader, w GeoSharding: data, } - resp, _, err := opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.GlobalClustersApi.CreateCustomZoneMappingWithParams(ctx, params).Execute() + return err +} + +func (opts *createCustomZoneMappingOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createCustomZoneMappingBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func createCustomZoneMappingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -158,6 +165,7 @@ type createManagedNamespaceOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GeoSharding } func (opts *createManagedNamespaceOpts) preRun() (err error) { @@ -177,10 +185,12 @@ func (opts *createManagedNamespaceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createManagedNamespaceOpts) readData(r io.Reader) (*admin.ManagedNamespace, error) { @@ -205,7 +215,7 @@ func (opts *createManagedNamespaceOpts) readData(r io.Reader) (*admin.ManagedNam return out, nil } -func (opts *createManagedNamespaceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createManagedNamespaceOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -218,28 +228,29 @@ func (opts *createManagedNamespaceOpts) run(ctx context.Context, r io.Reader, w ManagedNamespace: data, } - resp, _, err := opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.GlobalClustersApi.CreateManagedNamespaceWithParams(ctx, params).Execute() + return err +} + +func (opts *createManagedNamespaceOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createManagedNamespaceBuilder() *cobra.Command { @@ -253,7 +264,10 @@ func createManagedNamespaceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -272,6 +286,7 @@ type deleteAllCustomZoneMappingsOpts struct { clusterName string format string tmpl *template.Template + resp *admin.GeoSharding } func (opts *deleteAllCustomZoneMappingsOpts) preRun() (err error) { @@ -291,41 +306,44 @@ func (opts *deleteAllCustomZoneMappingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteAllCustomZoneMappingsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteAllCustomZoneMappingsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.GlobalClustersApi.DeleteAllCustomZoneMappingsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteAllCustomZoneMappingsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteAllCustomZoneMappingsBuilder() *cobra.Command { @@ -337,7 +355,10 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -356,6 +377,7 @@ type deleteManagedNamespaceOpts struct { collection string format string tmpl *template.Template + resp *admin.GeoSharding } func (opts *deleteManagedNamespaceOpts) preRun() (err error) { @@ -375,13 +397,15 @@ func (opts *deleteManagedNamespaceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteManagedNamespaceApiParams{ ClusterName: opts.clusterName, @@ -390,28 +414,29 @@ func (opts *deleteManagedNamespaceOpts) run(ctx context.Context, _ io.Reader, w Collection: &opts.collection, } - resp, _, err := opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.GlobalClustersApi.DeleteManagedNamespaceWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteManagedNamespaceOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteManagedNamespaceBuilder() *cobra.Command { @@ -423,7 +448,10 @@ func deleteManagedNamespaceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) @@ -442,6 +470,7 @@ type getManagedNamespaceOpts struct { clusterName string format string tmpl *template.Template + resp *admin.GeoSharding } func (opts *getManagedNamespaceOpts) preRun() (err error) { @@ -461,41 +490,44 @@ func (opts *getManagedNamespaceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getManagedNamespaceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getManagedNamespaceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetManagedNamespaceApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.GlobalClustersApi.GetManagedNamespaceWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getManagedNamespaceOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getManagedNamespaceBuilder() *cobra.Command { @@ -507,7 +539,10 @@ func getManagedNamespaceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index 8d39109e8c..5ef95af6e6 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -40,6 +40,7 @@ type createCostExplorerQueryProcessOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CostExplorerFilterResponse } func (opts *createCostExplorerQueryProcessOpts) preRun() (err error) { @@ -59,10 +60,12 @@ func (opts *createCostExplorerQueryProcessOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createCostExplorerQueryProcessOpts) readData(r io.Reader) (*admin.CostExplorerFilterRequestBody, error) { @@ -87,7 +90,7 @@ func (opts *createCostExplorerQueryProcessOpts) readData(r io.Reader) (*admin.Co return out, nil } -func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +102,29 @@ func (opts *createCostExplorerQueryProcessOpts) run(ctx context.Context, r io.Re CostExplorerFilterRequestBody: data, } - resp, _, err := opts.client.InvoicesApi.CreateCostExplorerQueryProcessWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.InvoicesApi.CreateCostExplorerQueryProcessWithParams(ctx, params).Execute() + return err +} + +func (opts *createCostExplorerQueryProcessOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createCostExplorerQueryProcessBuilder() *cobra.Command { @@ -134,7 +138,10 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -151,6 +158,7 @@ type createCostExplorerQueryProcess1Opts struct { token string format string tmpl *template.Template + resp string } func (opts *createCostExplorerQueryProcess1Opts) preRun() (err error) { @@ -170,41 +178,44 @@ func (opts *createCostExplorerQueryProcess1Opts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *createCostExplorerQueryProcess1Opts) run(ctx context.Context, _ io.Reader) error { params := &admin.CreateCostExplorerQueryProcess1ApiParams{ OrgId: opts.orgId, Token: opts.token, } - resp, _, err := opts.client.InvoicesApi.CreateCostExplorerQueryProcess1WithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.InvoicesApi.CreateCostExplorerQueryProcess1WithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createCostExplorerQueryProcess1Opts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createCostExplorerQueryProcess1Builder() *cobra.Command { @@ -216,7 +227,10 @@ func createCostExplorerQueryProcess1Builder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -233,6 +247,7 @@ type downloadInvoiceCSVOpts struct { invoiceId string format string tmpl *template.Template + resp string } func (opts *downloadInvoiceCSVOpts) preRun() (err error) { @@ -252,41 +267,44 @@ func (opts *downloadInvoiceCSVOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *downloadInvoiceCSVOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DownloadInvoiceCSVApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, } - resp, _, err := opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.InvoicesApi.DownloadInvoiceCSVWithParams(ctx, params).Execute() + return err +} + +func (opts *downloadInvoiceCSVOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func downloadInvoiceCSVBuilder() *cobra.Command { @@ -298,7 +316,10 @@ func downloadInvoiceCSVBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -315,6 +336,7 @@ type getInvoiceOpts struct { invoiceId string format string tmpl *template.Template + resp string } func (opts *getInvoiceOpts) preRun() (err error) { @@ -334,41 +356,44 @@ func (opts *getInvoiceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getInvoiceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getInvoiceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetInvoiceApiParams{ OrgId: opts.orgId, InvoiceId: opts.invoiceId, } - resp, _, err := opts.client.InvoicesApi.GetInvoiceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.InvoicesApi.GetInvoiceWithParams(ctx, params).Execute() + return err +} + +func (opts *getInvoiceOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getInvoiceBuilder() *cobra.Command { @@ -380,7 +405,10 @@ func getInvoiceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -399,6 +427,7 @@ type listInvoicesOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiInvoice } func (opts *listInvoicesOpts) preRun() (err error) { @@ -418,13 +447,15 @@ func (opts *listInvoicesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listInvoicesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listInvoicesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListInvoicesApiParams{ OrgId: opts.orgId, @@ -433,28 +464,29 @@ func (opts *listInvoicesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) PageNum: &opts.pageNum, } - resp, _, err := opts.client.InvoicesApi.ListInvoicesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.InvoicesApi.ListInvoicesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listInvoicesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listInvoicesBuilder() *cobra.Command { @@ -466,7 +498,10 @@ func listInvoicesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -483,6 +518,7 @@ type listPendingInvoicesOpts struct { orgId string format string tmpl *template.Template + resp *admin.PaginatedApiInvoice } func (opts *listPendingInvoicesOpts) preRun() (err error) { @@ -502,40 +538,43 @@ func (opts *listPendingInvoicesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPendingInvoicesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPendingInvoicesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListPendingInvoicesApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.InvoicesApi.ListPendingInvoicesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.InvoicesApi.ListPendingInvoicesWithParams(ctx, params).Execute() + return err +} + +func (opts *listPendingInvoicesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPendingInvoicesBuilder() *cobra.Command { @@ -547,7 +586,10 @@ func listPendingInvoicesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index e804a1b581..8d4ef38c6d 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -37,6 +37,7 @@ type deleteLDAPConfigurationOpts struct { groupId string format string tmpl *template.Template + resp *admin.UserSecurity } func (opts *deleteLDAPConfigurationOpts) preRun() (err error) { @@ -56,40 +57,43 @@ func (opts *deleteLDAPConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteLDAPConfigurationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteLDAPConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LDAPConfigurationApi.DeleteLDAPConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteLDAPConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteLDAPConfigurationBuilder() *cobra.Command { @@ -101,7 +105,10 @@ func deleteLDAPConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -115,6 +122,7 @@ type getLDAPConfigurationOpts struct { groupId string format string tmpl *template.Template + resp *admin.UserSecurity } func (opts *getLDAPConfigurationOpts) preRun() (err error) { @@ -134,40 +142,43 @@ func (opts *getLDAPConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getLDAPConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getLDAPConfigurationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetLDAPConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LDAPConfigurationApi.GetLDAPConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *getLDAPConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getLDAPConfigurationBuilder() *cobra.Command { @@ -179,7 +190,10 @@ func getLDAPConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -194,6 +208,7 @@ type getLDAPConfigurationStatusOpts struct { requestId string format string tmpl *template.Template + resp *admin.LDAPVerifyConnectivityJobRequest } func (opts *getLDAPConfigurationStatusOpts) preRun() (err error) { @@ -213,41 +228,44 @@ func (opts *getLDAPConfigurationStatusOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getLDAPConfigurationStatusOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetLDAPConfigurationStatusApiParams{ GroupId: opts.groupId, RequestId: opts.requestId, } - resp, _, err := opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LDAPConfigurationApi.GetLDAPConfigurationStatusWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getLDAPConfigurationStatusOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getLDAPConfigurationStatusBuilder() *cobra.Command { @@ -259,7 +277,10 @@ func getLDAPConfigurationStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -278,6 +299,7 @@ type saveLDAPConfigurationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.UserSecurity } func (opts *saveLDAPConfigurationOpts) preRun() (err error) { @@ -297,10 +319,12 @@ func (opts *saveLDAPConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *saveLDAPConfigurationOpts) readData(r io.Reader) (*admin.UserSecurity, error) { @@ -325,7 +349,7 @@ func (opts *saveLDAPConfigurationOpts) readData(r io.Reader) (*admin.UserSecurit return out, nil } -func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -337,28 +361,29 @@ func (opts *saveLDAPConfigurationOpts) run(ctx context.Context, r io.Reader, w i UserSecurity: data, } - resp, _, err := opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LDAPConfigurationApi.SaveLDAPConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *saveLDAPConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func saveLDAPConfigurationBuilder() *cobra.Command { @@ -372,7 +397,10 @@ func saveLDAPConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -391,6 +419,7 @@ type verifyLDAPConfigurationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.LDAPVerifyConnectivityJobRequest } func (opts *verifyLDAPConfigurationOpts) preRun() (err error) { @@ -410,10 +439,12 @@ func (opts *verifyLDAPConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *verifyLDAPConfigurationOpts) readData(r io.Reader) (*admin.LDAPVerifyConnectivityJobRequestParams, error) { @@ -438,7 +469,7 @@ func (opts *verifyLDAPConfigurationOpts) readData(r io.Reader) (*admin.LDAPVerif return out, nil } -func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -450,28 +481,29 @@ func (opts *verifyLDAPConfigurationOpts) run(ctx context.Context, r io.Reader, w LDAPVerifyConnectivityJobRequestParams: data, } - resp, _, err := opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LDAPConfigurationApi.VerifyLDAPConfigurationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *verifyLDAPConfigurationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func verifyLDAPConfigurationBuilder() *cobra.Command { @@ -485,7 +517,10 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 6650fea9a3..3bf274d59b 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -39,6 +39,7 @@ type deleteLegacySnapshotOpts struct { snapshotId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteLegacySnapshotOpts) preRun() (err error) { @@ -58,13 +59,15 @@ func (opts *deleteLegacySnapshotOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteLegacySnapshotApiParams{ GroupId: opts.groupId, @@ -72,28 +75,29 @@ func (opts *deleteLegacySnapshotOpts) run(ctx context.Context, _ io.Reader, w io SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.DeleteLegacySnapshotWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteLegacySnapshotOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteLegacySnapshotBuilder() *cobra.Command { @@ -105,7 +109,10 @@ func deleteLegacySnapshotBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -125,6 +132,7 @@ type getLegacyBackupCheckpointOpts struct { clusterName string format string tmpl *template.Template + resp *admin.ApiAtlasCheckpoint } func (opts *getLegacyBackupCheckpointOpts) preRun() (err error) { @@ -144,13 +152,15 @@ func (opts *getLegacyBackupCheckpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetLegacyBackupCheckpointApiParams{ GroupId: opts.groupId, @@ -158,28 +168,29 @@ func (opts *getLegacyBackupCheckpointOpts) run(ctx context.Context, _ io.Reader, ClusterName: opts.clusterName, } - resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.GetLegacyBackupCheckpointWithParams(ctx, params).Execute() + return err +} + +func (opts *getLegacyBackupCheckpointOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getLegacyBackupCheckpointBuilder() *cobra.Command { @@ -191,7 +202,10 @@ func getLegacyBackupCheckpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -211,6 +225,7 @@ type getLegacyBackupRestoreJobOpts struct { jobId string format string tmpl *template.Template + resp *admin.BackupRestoreJob } func (opts *getLegacyBackupRestoreJobOpts) preRun() (err error) { @@ -230,13 +245,15 @@ func (opts *getLegacyBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetLegacyBackupRestoreJobApiParams{ GroupId: opts.groupId, @@ -244,28 +261,29 @@ func (opts *getLegacyBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, JobId: opts.jobId, } - resp, _, err := opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.GetLegacyBackupRestoreJobWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getLegacyBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getLegacyBackupRestoreJobBuilder() *cobra.Command { @@ -277,7 +295,10 @@ func getLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -297,6 +318,7 @@ type getLegacySnapshotOpts struct { snapshotId string format string tmpl *template.Template + resp *admin.BackupSnapshot } func (opts *getLegacySnapshotOpts) preRun() (err error) { @@ -316,13 +338,15 @@ func (opts *getLegacySnapshotOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getLegacySnapshotOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getLegacySnapshotOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetLegacySnapshotApiParams{ GroupId: opts.groupId, @@ -330,28 +354,29 @@ func (opts *getLegacySnapshotOpts) run(ctx context.Context, _ io.Reader, w io.Wr SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.GetLegacySnapshotWithParams(ctx, params).Execute() + return err +} + +func (opts *getLegacySnapshotOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getLegacySnapshotBuilder() *cobra.Command { @@ -363,7 +388,10 @@ func getLegacySnapshotBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -382,6 +410,7 @@ type getLegacySnapshotScheduleOpts struct { clusterName string format string tmpl *template.Template + resp *admin.ApiAtlasSnapshotSchedule } func (opts *getLegacySnapshotScheduleOpts) preRun() (err error) { @@ -401,41 +430,44 @@ func (opts *getLegacySnapshotScheduleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getLegacySnapshotScheduleOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetLegacySnapshotScheduleApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.GetLegacySnapshotScheduleWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getLegacySnapshotScheduleOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getLegacySnapshotScheduleBuilder() *cobra.Command { @@ -447,7 +479,10 @@ func getLegacySnapshotScheduleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -467,6 +502,7 @@ type listLegacyBackupCheckpointsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiAtlasCheckpoint } func (opts *listLegacyBackupCheckpointsOpts) preRun() (err error) { @@ -486,13 +522,15 @@ func (opts *listLegacyBackupCheckpointsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListLegacyBackupCheckpointsApiParams{ GroupId: opts.groupId, @@ -502,28 +540,29 @@ func (opts *listLegacyBackupCheckpointsOpts) run(ctx context.Context, _ io.Reade PageNum: &opts.pageNum, } - resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.ListLegacyBackupCheckpointsWithParams(ctx, params).Execute() + return err +} + +func (opts *listLegacyBackupCheckpointsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listLegacyBackupCheckpointsBuilder() *cobra.Command { @@ -535,7 +574,10 @@ func listLegacyBackupCheckpointsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -559,6 +601,7 @@ type listLegacyBackupRestoreJobsOpts struct { batchId string format string tmpl *template.Template + resp *admin.PaginatedRestoreJob } func (opts *listLegacyBackupRestoreJobsOpts) preRun() (err error) { @@ -578,13 +621,15 @@ func (opts *listLegacyBackupRestoreJobsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListLegacyBackupRestoreJobsApiParams{ GroupId: opts.groupId, @@ -595,28 +640,29 @@ func (opts *listLegacyBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reade BatchId: &opts.batchId, } - resp, _, err := opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.ListLegacyBackupRestoreJobsWithParams(ctx, params).Execute() + return err +} + +func (opts *listLegacyBackupRestoreJobsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listLegacyBackupRestoreJobsBuilder() *cobra.Command { @@ -628,7 +674,10 @@ func listLegacyBackupRestoreJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -653,6 +702,7 @@ type listLegacySnapshotsOpts struct { completed string format string tmpl *template.Template + resp *admin.PaginatedSnapshot } func (opts *listLegacySnapshotsOpts) preRun() (err error) { @@ -672,13 +722,15 @@ func (opts *listLegacySnapshotsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listLegacySnapshotsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listLegacySnapshotsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListLegacySnapshotsApiParams{ GroupId: opts.groupId, @@ -689,28 +741,29 @@ func (opts *listLegacySnapshotsOpts) run(ctx context.Context, _ io.Reader, w io. Completed: &opts.completed, } - resp, _, err := opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.ListLegacySnapshotsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listLegacySnapshotsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listLegacySnapshotsBuilder() *cobra.Command { @@ -722,7 +775,10 @@ func listLegacySnapshotsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -747,6 +803,7 @@ type updateLegacySnapshotRetentionOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.BackupSnapshot } func (opts *updateLegacySnapshotRetentionOpts) preRun() (err error) { @@ -766,10 +823,12 @@ func (opts *updateLegacySnapshotRetentionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateLegacySnapshotRetentionOpts) readData(r io.Reader) (*admin.BackupSnapshot, error) { @@ -794,7 +853,7 @@ func (opts *updateLegacySnapshotRetentionOpts) readData(r io.Reader) (*admin.Bac return out, nil } -func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -808,28 +867,29 @@ func (opts *updateLegacySnapshotRetentionOpts) run(ctx context.Context, r io.Rea BackupSnapshot: data, } - resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.UpdateLegacySnapshotRetentionWithParams(ctx, params).Execute() + return err +} + +func (opts *updateLegacySnapshotRetentionOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateLegacySnapshotRetentionBuilder() *cobra.Command { @@ -843,7 +903,10 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -867,6 +930,7 @@ type updateLegacySnapshotScheduleOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ApiAtlasSnapshotSchedule } func (opts *updateLegacySnapshotScheduleOpts) preRun() (err error) { @@ -886,10 +950,12 @@ func (opts *updateLegacySnapshotScheduleOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateLegacySnapshotScheduleOpts) readData(r io.Reader) (*admin.ApiAtlasSnapshotSchedule, error) { @@ -914,7 +980,7 @@ func (opts *updateLegacySnapshotScheduleOpts) readData(r io.Reader) (*admin.ApiA return out, nil } -func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -927,28 +993,29 @@ func (opts *updateLegacySnapshotScheduleOpts) run(ctx context.Context, r io.Read ApiAtlasSnapshotSchedule: data, } - resp, _, err := opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.UpdateLegacySnapshotScheduleWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateLegacySnapshotScheduleOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateLegacySnapshotScheduleBuilder() *cobra.Command { @@ -962,7 +1029,10 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go index 201d734b12..fbb71ad962 100644 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ b/internal/api/api_legacy_backup_restore_jobs_cmd.go @@ -41,6 +41,7 @@ type createLegacyBackupRestoreJobOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedRestoreJob } func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createLegacyBackupRestoreJobOpts) readData(r io.Reader) (*admin.BackupRestoreJob, error) { @@ -88,7 +91,7 @@ func (opts *createLegacyBackupRestoreJobOpts) readData(r io.Reader) (*admin.Back return out, nil } -func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, r io.Read BackupRestoreJob: data, } - resp, _, err := opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() + return err +} + +func (opts *createLegacyBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createLegacyBackupRestoreJobBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index c0db0ec31e..3619e4518f 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -53,19 +53,25 @@ func (opts *deferMaintenanceWindowOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *deferMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *deferMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeferMaintenanceWindowApiParams{ GroupId: opts.groupId, } - _, err := opts.client.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(ctx, params).Execute() + var err error + _, err = opts.client.MaintenanceWindowsApi.DeferMaintenanceWindowWithParams(ctx, params).Execute() return err } +func (opts *deferMaintenanceWindowOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func deferMaintenanceWindowBuilder() *cobra.Command { opts := deferMaintenanceWindowOpts{} cmd := &cobra.Command{ @@ -75,7 +81,10 @@ func deferMaintenanceWindowBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -88,6 +97,7 @@ type getMaintenanceWindowOpts struct { groupId string format string tmpl *template.Template + resp *admin.GroupMaintenanceWindow } func (opts *getMaintenanceWindowOpts) preRun() (err error) { @@ -107,40 +117,43 @@ func (opts *getMaintenanceWindowOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetMaintenanceWindowApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.MaintenanceWindowsApi.GetMaintenanceWindowWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MaintenanceWindowsApi.GetMaintenanceWindowWithParams(ctx, params).Execute() + return err +} + +func (opts *getMaintenanceWindowOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getMaintenanceWindowBuilder() *cobra.Command { @@ -152,7 +165,10 @@ func getMaintenanceWindowBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -182,19 +198,25 @@ func (opts *resetMaintenanceWindowOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *resetMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *resetMaintenanceWindowOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ResetMaintenanceWindowApiParams{ GroupId: opts.groupId, } - _, err := opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params).Execute() + var err error + _, err = opts.client.MaintenanceWindowsApi.ResetMaintenanceWindowWithParams(ctx, params).Execute() return err } +func (opts *resetMaintenanceWindowOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func resetMaintenanceWindowBuilder() *cobra.Command { opts := resetMaintenanceWindowOpts{} cmd := &cobra.Command{ @@ -204,7 +226,10 @@ func resetMaintenanceWindowBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -233,19 +258,25 @@ func (opts *toggleMaintenanceAutoDeferOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *toggleMaintenanceAutoDeferOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *toggleMaintenanceAutoDeferOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ToggleMaintenanceAutoDeferApiParams{ GroupId: opts.groupId, } - _, err := opts.client.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(ctx, params).Execute() + var err error + _, err = opts.client.MaintenanceWindowsApi.ToggleMaintenanceAutoDeferWithParams(ctx, params).Execute() return err } +func (opts *toggleMaintenanceAutoDeferOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func toggleMaintenanceAutoDeferBuilder() *cobra.Command { opts := toggleMaintenanceAutoDeferOpts{} cmd := &cobra.Command{ @@ -255,7 +286,10 @@ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -271,6 +305,7 @@ type updateMaintenanceWindowOpts struct { fs afero.Fs format string tmpl *template.Template + resp map[string]interface{} } func (opts *updateMaintenanceWindowOpts) preRun() (err error) { @@ -290,10 +325,12 @@ func (opts *updateMaintenanceWindowOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateMaintenanceWindowOpts) readData(r io.Reader) (*admin.GroupMaintenanceWindow, error) { @@ -318,7 +355,7 @@ func (opts *updateMaintenanceWindowOpts) readData(r io.Reader) (*admin.GroupMain return out, nil } -func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -330,28 +367,29 @@ func (opts *updateMaintenanceWindowOpts) run(ctx context.Context, r io.Reader, w GroupMaintenanceWindow: data, } - resp, _, err := opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MaintenanceWindowsApi.UpdateMaintenanceWindowWithParams(ctx, params).Execute() + return err +} + +func (opts *updateMaintenanceWindowOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateMaintenanceWindowBuilder() *cobra.Command { @@ -365,7 +403,10 @@ func updateMaintenanceWindowBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index e3894c563a..ebac6a93ca 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -37,6 +37,7 @@ type createUserOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CloudAppUser } func (opts *createUserOpts) preRun() (err error) { @@ -45,10 +46,12 @@ func (opts *createUserOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createUserOpts) readData(r io.Reader) (*admin.CloudAppUser, error) { @@ -73,7 +76,7 @@ func (opts *createUserOpts) readData(r io.Reader) (*admin.CloudAppUser, error) { return out, nil } -func (opts *createUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createUserOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -84,28 +87,29 @@ func (opts *createUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) e CloudAppUser: data, } - resp, _, err := opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MongoDBCloudUsersApi.CreateUserWithParams(ctx, params).Execute() + return err +} + +func (opts *createUserOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createUserBuilder() *cobra.Command { @@ -119,7 +123,10 @@ func createUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } @@ -134,6 +141,7 @@ type getUserOpts struct { userId string format string tmpl *template.Template + resp *admin.CloudAppUser } func (opts *getUserOpts) preRun() (err error) { @@ -142,40 +150,43 @@ func (opts *getUserOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getUserOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getUserOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetUserApiParams{ UserId: opts.userId, } - resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MongoDBCloudUsersApi.GetUserWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getUserOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getUserBuilder() *cobra.Command { @@ -187,7 +198,10 @@ func getUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.userId, "userId", "", `Unique 24-hexadecimal digit string that identifies this user.`) @@ -202,6 +216,7 @@ type getUserByUsernameOpts struct { userName string format string tmpl *template.Template + resp *admin.CloudAppUser } func (opts *getUserByUsernameOpts) preRun() (err error) { @@ -210,40 +225,43 @@ func (opts *getUserByUsernameOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getUserByUsernameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getUserByUsernameOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetUserByUsernameApiParams{ UserName: opts.userName, } - resp, _, err := opts.client.MongoDBCloudUsersApi.GetUserByUsernameWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MongoDBCloudUsersApi.GetUserByUsernameWithParams(ctx, params).Execute() + return err +} + +func (opts *getUserByUsernameOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getUserByUsernameBuilder() *cobra.Command { @@ -255,7 +273,10 @@ func getUserByUsernameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.userName, "userName", "", `Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user.`) diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index cda0de4103..acb569a09e 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -23,6 +23,7 @@ import ( "errors" "fmt" "io" + "os" "strings" "text/template" "time" @@ -38,6 +39,7 @@ type getAtlasProcessOpts struct { processId string format string tmpl *template.Template + resp *admin.ApiHostViewAtlas } func (opts *getAtlasProcessOpts) preRun() (err error) { @@ -57,41 +59,44 @@ func (opts *getAtlasProcessOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getAtlasProcessOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getAtlasProcessOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetAtlasProcessApiParams{ GroupId: opts.groupId, ProcessId: opts.processId, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetAtlasProcessWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.GetAtlasProcessWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getAtlasProcessOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getAtlasProcessBuilder() *cobra.Command { @@ -103,7 +108,10 @@ func getAtlasProcessBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -121,6 +129,7 @@ type getDatabaseOpts struct { processId string format string tmpl *template.Template + resp *admin.MesurementsDatabase } func (opts *getDatabaseOpts) preRun() (err error) { @@ -140,13 +149,15 @@ func (opts *getDatabaseOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getDatabaseOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getDatabaseOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetDatabaseApiParams{ GroupId: opts.groupId, @@ -154,28 +165,29 @@ func (opts *getDatabaseOpts) run(ctx context.Context, _ io.Reader, w io.Writer) ProcessId: opts.processId, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.GetDatabaseWithParams(ctx, params).Execute() + return err +} + +func (opts *getDatabaseOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getDatabaseBuilder() *cobra.Command { @@ -187,7 +199,10 @@ func getDatabaseBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -212,6 +227,7 @@ type getDatabaseMeasurementsOpts struct { end string format string tmpl *template.Template + resp *admin.ApiMeasurementsGeneralViewAtlas } func (opts *getDatabaseMeasurementsOpts) preRun() (err error) { @@ -231,13 +247,15 @@ func (opts *getDatabaseMeasurementsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, _ io.Reader) error { var start *time.Time var errStart error @@ -268,28 +286,29 @@ func (opts *getDatabaseMeasurementsOpts) run(ctx context.Context, _ io.Reader, w End: end, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.GetDatabaseMeasurementsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getDatabaseMeasurementsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getDatabaseMeasurementsBuilder() *cobra.Command { @@ -301,7 +320,10 @@ func getDatabaseMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -332,6 +354,7 @@ type getDiskMeasurementsOpts struct { end string format string tmpl *template.Template + resp *admin.ApiMeasurementsGeneralViewAtlas } func (opts *getDiskMeasurementsOpts) preRun() (err error) { @@ -351,13 +374,15 @@ func (opts *getDiskMeasurementsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getDiskMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getDiskMeasurementsOpts) run(ctx context.Context, _ io.Reader) error { var start *time.Time var errStart error @@ -388,28 +413,29 @@ func (opts *getDiskMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io. End: end, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.GetDiskMeasurementsWithParams(ctx, params).Execute() + return err +} + +func (opts *getDiskMeasurementsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getDiskMeasurementsBuilder() *cobra.Command { @@ -421,7 +447,10 @@ func getDiskMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -449,6 +478,7 @@ type getHostLogsOpts struct { startDate int64 format string tmpl *template.Template + resp *os.File } func (opts *getHostLogsOpts) preRun() (err error) { @@ -468,13 +498,15 @@ func (opts *getHostLogsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getHostLogsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getHostLogsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetHostLogsApiParams{ GroupId: opts.groupId, @@ -484,28 +516,29 @@ func (opts *getHostLogsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) StartDate: &opts.startDate, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetHostLogsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.GetHostLogsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getHostLogsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getHostLogsBuilder() *cobra.Command { @@ -517,7 +550,10 @@ func getHostLogsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -543,6 +579,7 @@ type getHostMeasurementsOpts struct { end string format string tmpl *template.Template + resp *admin.ApiMeasurementsGeneralViewAtlas } func (opts *getHostMeasurementsOpts) preRun() (err error) { @@ -562,13 +599,15 @@ func (opts *getHostMeasurementsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getHostMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getHostMeasurementsOpts) run(ctx context.Context, _ io.Reader) error { var start *time.Time var errStart error @@ -598,28 +637,29 @@ func (opts *getHostMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io. End: end, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetHostMeasurementsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.GetHostMeasurementsWithParams(ctx, params).Execute() + return err +} + +func (opts *getHostMeasurementsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getHostMeasurementsBuilder() *cobra.Command { @@ -631,7 +671,10 @@ func getHostMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -662,6 +705,7 @@ type getIndexMetricsOpts struct { end string format string tmpl *template.Template + resp *admin.MeasurementsIndexes } func (opts *getIndexMetricsOpts) preRun() (err error) { @@ -681,13 +725,15 @@ func (opts *getIndexMetricsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getIndexMetricsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getIndexMetricsOpts) run(ctx context.Context, _ io.Reader) error { var start *time.Time var errStart error @@ -720,28 +766,29 @@ func (opts *getIndexMetricsOpts) run(ctx context.Context, _ io.Reader, w io.Writ End: end, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.GetIndexMetricsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getIndexMetricsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getIndexMetricsBuilder() *cobra.Command { @@ -753,7 +800,10 @@ func getIndexMetricsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -788,6 +838,7 @@ type getMeasurementsOpts struct { end string format string tmpl *template.Template + resp *admin.MeasurementsNonIndex } func (opts *getMeasurementsOpts) preRun() (err error) { @@ -807,13 +858,15 @@ func (opts *getMeasurementsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getMeasurementsOpts) run(ctx context.Context, _ io.Reader) error { var start *time.Time var errStart error @@ -843,28 +896,29 @@ func (opts *getMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writ End: end, } - resp, _, err := opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.GetMeasurementsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getMeasurementsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getMeasurementsBuilder() *cobra.Command { @@ -876,7 +930,10 @@ func getMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -902,6 +959,7 @@ type listAtlasProcessesOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedHostViewAtlas } func (opts *listAtlasProcessesOpts) preRun() (err error) { @@ -921,13 +979,15 @@ func (opts *listAtlasProcessesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listAtlasProcessesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listAtlasProcessesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListAtlasProcessesApiParams{ GroupId: opts.groupId, @@ -936,28 +996,29 @@ func (opts *listAtlasProcessesOpts) run(ctx context.Context, _ io.Reader, w io.W PageNum: &opts.pageNum, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListAtlasProcessesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.ListAtlasProcessesWithParams(ctx, params).Execute() + return err +} + +func (opts *listAtlasProcessesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listAtlasProcessesBuilder() *cobra.Command { @@ -969,7 +1030,10 @@ func listAtlasProcessesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -990,6 +1054,7 @@ type listDatabasesOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedDatabase } func (opts *listDatabasesOpts) preRun() (err error) { @@ -1009,13 +1074,15 @@ func (opts *listDatabasesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listDatabasesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listDatabasesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListDatabasesApiParams{ GroupId: opts.groupId, @@ -1025,28 +1092,29 @@ func (opts *listDatabasesOpts) run(ctx context.Context, _ io.Reader, w io.Writer PageNum: &opts.pageNum, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListDatabasesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.ListDatabasesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listDatabasesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listDatabasesBuilder() *cobra.Command { @@ -1058,7 +1126,10 @@ func listDatabasesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1079,6 +1150,7 @@ type listDiskMeasurementsOpts struct { processId string format string tmpl *template.Template + resp *admin.MeasurementDiskPartition } func (opts *listDiskMeasurementsOpts) preRun() (err error) { @@ -1098,13 +1170,15 @@ func (opts *listDiskMeasurementsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listDiskMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listDiskMeasurementsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListDiskMeasurementsApiParams{ PartitionName: opts.partitionName, @@ -1112,28 +1186,29 @@ func (opts *listDiskMeasurementsOpts) run(ctx context.Context, _ io.Reader, w io ProcessId: opts.processId, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.ListDiskMeasurementsWithParams(ctx, params).Execute() + return err +} + +func (opts *listDiskMeasurementsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listDiskMeasurementsBuilder() *cobra.Command { @@ -1145,7 +1220,10 @@ func listDiskMeasurementsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.partitionName, "partitionName", "", `Human-readable label of the disk or partition to which the measurements apply.`) @@ -1167,6 +1245,7 @@ type listDiskPartitionsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedDiskPartition } func (opts *listDiskPartitionsOpts) preRun() (err error) { @@ -1186,13 +1265,15 @@ func (opts *listDiskPartitionsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listDiskPartitionsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listDiskPartitionsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListDiskPartitionsApiParams{ GroupId: opts.groupId, @@ -1202,28 +1283,29 @@ func (opts *listDiskPartitionsOpts) run(ctx context.Context, _ io.Reader, w io.W PageNum: &opts.pageNum, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListDiskPartitionsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.ListDiskPartitionsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listDiskPartitionsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listDiskPartitionsBuilder() *cobra.Command { @@ -1235,7 +1317,10 @@ func listDiskPartitionsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1262,6 +1347,7 @@ type listIndexMetricsOpts struct { end string format string tmpl *template.Template + resp *admin.MeasurementsIndexes } func (opts *listIndexMetricsOpts) preRun() (err error) { @@ -1281,13 +1367,15 @@ func (opts *listIndexMetricsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listIndexMetricsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listIndexMetricsOpts) run(ctx context.Context, _ io.Reader) error { var start *time.Time var errStart error @@ -1319,28 +1407,29 @@ func (opts *listIndexMetricsOpts) run(ctx context.Context, _ io.Reader, w io.Wri End: end, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.ListIndexMetricsWithParams(ctx, params).Execute() + return err +} + +func (opts *listIndexMetricsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listIndexMetricsBuilder() *cobra.Command { @@ -1352,7 +1441,10 @@ func listIndexMetricsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) @@ -1380,6 +1472,7 @@ type listMetricTypesOpts struct { groupId string format string tmpl *template.Template + resp *admin.CloudSearchMetrics } func (opts *listMetricTypesOpts) preRun() (err error) { @@ -1399,41 +1492,44 @@ func (opts *listMetricTypesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listMetricTypesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listMetricTypesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListMetricTypesApiParams{ ProcessId: opts.processId, GroupId: opts.groupId, } - resp, _, err := opts.client.MonitoringAndLogsApi.ListMetricTypesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.MonitoringAndLogsApi.ListMetricTypesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listMetricTypesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listMetricTypesBuilder() *cobra.Command { @@ -1445,7 +1541,10 @@ func listMetricTypesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index c5ac12b53d..09dc0ead61 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -40,6 +40,7 @@ type createPeeringConnectionOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.BaseNetworkPeeringConnectionSettings } func (opts *createPeeringConnectionOpts) preRun() (err error) { @@ -59,10 +60,12 @@ func (opts *createPeeringConnectionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createPeeringConnectionOpts) readData(r io.Reader) (*admin.BaseNetworkPeeringConnectionSettings, error) { @@ -87,7 +90,7 @@ func (opts *createPeeringConnectionOpts) readData(r io.Reader) (*admin.BaseNetwo return out, nil } -func (opts *createPeeringConnectionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createPeeringConnectionOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +102,29 @@ func (opts *createPeeringConnectionOpts) run(ctx context.Context, r io.Reader, w BaseNetworkPeeringConnectionSettings: data, } - resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.CreatePeeringConnectionWithParams(ctx, params).Execute() + return err +} + +func (opts *createPeeringConnectionOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createPeeringConnectionBuilder() *cobra.Command { @@ -134,7 +138,10 @@ func createPeeringConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -153,6 +160,7 @@ type createPeeringContainerOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CloudProviderContainer } func (opts *createPeeringContainerOpts) preRun() (err error) { @@ -172,10 +180,12 @@ func (opts *createPeeringContainerOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createPeeringContainerOpts) readData(r io.Reader) (*admin.CloudProviderContainer, error) { @@ -200,7 +210,7 @@ func (opts *createPeeringContainerOpts) readData(r io.Reader) (*admin.CloudProvi return out, nil } -func (opts *createPeeringContainerOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createPeeringContainerOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -212,28 +222,29 @@ func (opts *createPeeringContainerOpts) run(ctx context.Context, r io.Reader, w CloudProviderContainer: data, } - resp, _, err := opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.CreatePeeringContainerWithParams(ctx, params).Execute() + return err +} + +func (opts *createPeeringContainerOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createPeeringContainerBuilder() *cobra.Command { @@ -247,7 +258,10 @@ func createPeeringContainerBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -264,6 +278,7 @@ type deletePeeringConnectionOpts struct { peerId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deletePeeringConnectionOpts) preRun() (err error) { @@ -283,41 +298,44 @@ func (opts *deletePeeringConnectionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deletePeeringConnectionOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deletePeeringConnectionOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeletePeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, } - resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringConnectionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.DeletePeeringConnectionWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deletePeeringConnectionOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deletePeeringConnectionBuilder() *cobra.Command { @@ -329,7 +347,10 @@ func deletePeeringConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -346,6 +367,7 @@ type deletePeeringContainerOpts struct { containerId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deletePeeringContainerOpts) preRun() (err error) { @@ -365,41 +387,44 @@ func (opts *deletePeeringContainerOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deletePeeringContainerOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deletePeeringContainerOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeletePeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, } - resp, _, err := opts.client.NetworkPeeringApi.DeletePeeringContainerWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.DeletePeeringContainerWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deletePeeringContainerOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deletePeeringContainerBuilder() *cobra.Command { @@ -411,7 +436,10 @@ func deletePeeringContainerBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -430,6 +458,7 @@ type disablePeeringOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PrivateIPMode } func (opts *disablePeeringOpts) preRun() (err error) { @@ -449,10 +478,12 @@ func (opts *disablePeeringOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *disablePeeringOpts) readData(r io.Reader) (*admin.PrivateIPMode, error) { @@ -477,7 +508,7 @@ func (opts *disablePeeringOpts) readData(r io.Reader) (*admin.PrivateIPMode, err return out, nil } -func (opts *disablePeeringOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *disablePeeringOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -489,28 +520,29 @@ func (opts *disablePeeringOpts) run(ctx context.Context, r io.Reader, w io.Write PrivateIPMode: data, } - resp, _, err := opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.DisablePeeringWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *disablePeeringOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func disablePeeringBuilder() *cobra.Command { @@ -524,7 +556,10 @@ func disablePeeringBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -541,6 +576,7 @@ type getPeeringConnectionOpts struct { peerId string format string tmpl *template.Template + resp *admin.BaseNetworkPeeringConnectionSettings } func (opts *getPeeringConnectionOpts) preRun() (err error) { @@ -560,41 +596,44 @@ func (opts *getPeeringConnectionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getPeeringConnectionOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getPeeringConnectionOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetPeeringConnectionApiParams{ GroupId: opts.groupId, PeerId: opts.peerId, } - resp, _, err := opts.client.NetworkPeeringApi.GetPeeringConnectionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.GetPeeringConnectionWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getPeeringConnectionOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getPeeringConnectionBuilder() *cobra.Command { @@ -606,7 +645,10 @@ func getPeeringConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -623,6 +665,7 @@ type getPeeringContainerOpts struct { containerId string format string tmpl *template.Template + resp *admin.CloudProviderContainer } func (opts *getPeeringContainerOpts) preRun() (err error) { @@ -642,41 +685,44 @@ func (opts *getPeeringContainerOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getPeeringContainerOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getPeeringContainerOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetPeeringContainerApiParams{ GroupId: opts.groupId, ContainerId: opts.containerId, } - resp, _, err := opts.client.NetworkPeeringApi.GetPeeringContainerWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.GetPeeringContainerWithParams(ctx, params).Execute() + return err +} + +func (opts *getPeeringContainerOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getPeeringContainerBuilder() *cobra.Command { @@ -688,7 +734,10 @@ func getPeeringContainerBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -708,6 +757,7 @@ type listPeeringConnectionsOpts struct { providerName string format string tmpl *template.Template + resp *admin.PaginatedContainerPeer } func (opts *listPeeringConnectionsOpts) preRun() (err error) { @@ -727,13 +777,15 @@ func (opts *listPeeringConnectionsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPeeringConnectionsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPeeringConnectionsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListPeeringConnectionsApiParams{ GroupId: opts.groupId, @@ -743,28 +795,29 @@ func (opts *listPeeringConnectionsOpts) run(ctx context.Context, _ io.Reader, w ProviderName: &opts.providerName, } - resp, _, err := opts.client.NetworkPeeringApi.ListPeeringConnectionsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.ListPeeringConnectionsWithParams(ctx, params).Execute() + return err +} + +func (opts *listPeeringConnectionsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPeeringConnectionsBuilder() *cobra.Command { @@ -776,7 +829,10 @@ func listPeeringConnectionsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -798,6 +854,7 @@ type listPeeringContainerByCloudProviderOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedCloudProviderContainer } func (opts *listPeeringContainerByCloudProviderOpts) preRun() (err error) { @@ -817,13 +874,15 @@ func (opts *listPeeringContainerByCloudProviderOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListPeeringContainerByCloudProviderApiParams{ GroupId: opts.groupId, @@ -833,28 +892,29 @@ func (opts *listPeeringContainerByCloudProviderOpts) run(ctx context.Context, _ PageNum: &opts.pageNum, } - resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.ListPeeringContainerByCloudProviderWithParams(ctx, params).Execute() + return err +} + +func (opts *listPeeringContainerByCloudProviderOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPeeringContainerByCloudProviderBuilder() *cobra.Command { @@ -866,7 +926,10 @@ func listPeeringContainerByCloudProviderBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -888,6 +951,7 @@ type listPeeringContainersOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedCloudProviderContainer } func (opts *listPeeringContainersOpts) preRun() (err error) { @@ -907,13 +971,15 @@ func (opts *listPeeringContainersOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPeeringContainersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPeeringContainersOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListPeeringContainersApiParams{ GroupId: opts.groupId, @@ -922,28 +988,29 @@ func (opts *listPeeringContainersOpts) run(ctx context.Context, _ io.Reader, w i PageNum: &opts.pageNum, } - resp, _, err := opts.client.NetworkPeeringApi.ListPeeringContainersWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.ListPeeringContainersWithParams(ctx, params).Execute() + return err +} + +func (opts *listPeeringContainersOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPeeringContainersBuilder() *cobra.Command { @@ -955,7 +1022,10 @@ func listPeeringContainersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -976,6 +1046,7 @@ type updatePeeringConnectionOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.BaseNetworkPeeringConnectionSettings } func (opts *updatePeeringConnectionOpts) preRun() (err error) { @@ -995,10 +1066,12 @@ func (opts *updatePeeringConnectionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updatePeeringConnectionOpts) readData(r io.Reader) (*admin.BaseNetworkPeeringConnectionSettings, error) { @@ -1023,7 +1096,7 @@ func (opts *updatePeeringConnectionOpts) readData(r io.Reader) (*admin.BaseNetwo return out, nil } -func (opts *updatePeeringConnectionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updatePeeringConnectionOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1036,28 +1109,29 @@ func (opts *updatePeeringConnectionOpts) run(ctx context.Context, r io.Reader, w BaseNetworkPeeringConnectionSettings: data, } - resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.UpdatePeeringConnectionWithParams(ctx, params).Execute() + return err +} + +func (opts *updatePeeringConnectionOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updatePeeringConnectionBuilder() *cobra.Command { @@ -1071,7 +1145,10 @@ func updatePeeringConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1093,6 +1170,7 @@ type updatePeeringContainerOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CloudProviderContainer } func (opts *updatePeeringContainerOpts) preRun() (err error) { @@ -1112,10 +1190,12 @@ func (opts *updatePeeringContainerOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updatePeeringContainerOpts) readData(r io.Reader) (*admin.CloudProviderContainer, error) { @@ -1140,7 +1220,7 @@ func (opts *updatePeeringContainerOpts) readData(r io.Reader) (*admin.CloudProvi return out, nil } -func (opts *updatePeeringContainerOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updatePeeringContainerOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1153,28 +1233,29 @@ func (opts *updatePeeringContainerOpts) run(ctx context.Context, r io.Reader, w CloudProviderContainer: data, } - resp, _, err := opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.UpdatePeeringContainerWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updatePeeringContainerOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updatePeeringContainerBuilder() *cobra.Command { @@ -1188,7 +1269,10 @@ func updatePeeringContainerBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1206,6 +1290,7 @@ type verifyConnectViaPeeringOnlyModeForOneProjectOpts struct { groupId string format string tmpl *template.Template + resp *admin.PrivateIPMode } func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) preRun() (err error) { @@ -1225,40 +1310,43 @@ func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) preRun() (err erro } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.VerifyConnectViaPeeringOnlyModeForOneProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.NetworkPeeringApi.VerifyConnectViaPeeringOnlyModeForOneProjectWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.NetworkPeeringApi.VerifyConnectViaPeeringOnlyModeForOneProjectWithParams(ctx, params).Execute() + return err +} + +func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { @@ -1270,7 +1358,10 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index 28280a2a50..fb2dfb45b3 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -23,6 +23,7 @@ import ( "errors" "fmt" "io" + "os" "strings" "text/template" @@ -41,6 +42,7 @@ type createOnlineArchiveOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.BackupOnlineArchive } func (opts *createOnlineArchiveOpts) preRun() (err error) { @@ -60,10 +62,12 @@ func (opts *createOnlineArchiveOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createOnlineArchiveOpts) readData(r io.Reader) (*admin.BackupOnlineArchiveCreate, error) { @@ -88,7 +92,7 @@ func (opts *createOnlineArchiveOpts) readData(r io.Reader) (*admin.BackupOnlineA return out, nil } -func (opts *createOnlineArchiveOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createOnlineArchiveOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +105,29 @@ func (opts *createOnlineArchiveOpts) run(ctx context.Context, r io.Reader, w io. BackupOnlineArchiveCreate: data, } - resp, _, err := opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OnlineArchiveApi.CreateOnlineArchiveWithParams(ctx, params).Execute() + return err +} + +func (opts *createOnlineArchiveOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createOnlineArchiveBuilder() *cobra.Command { @@ -136,7 +141,10 @@ func createOnlineArchiveBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -156,6 +164,7 @@ type deleteOnlineArchiveOpts struct { clusterName string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteOnlineArchiveOpts) preRun() (err error) { @@ -175,13 +184,15 @@ func (opts *deleteOnlineArchiveOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -189,28 +200,29 @@ func (opts *deleteOnlineArchiveOpts) run(ctx context.Context, _ io.Reader, w io. ClusterName: opts.clusterName, } - resp, _, err := opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OnlineArchiveApi.DeleteOnlineArchiveWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteOnlineArchiveOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteOnlineArchiveBuilder() *cobra.Command { @@ -222,7 +234,10 @@ func deleteOnlineArchiveBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -244,6 +259,7 @@ type downloadOnlineArchiveQueryLogsOpts struct { archiveOnly bool format string tmpl *template.Template + resp *os.File } func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { @@ -263,13 +279,15 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DownloadOnlineArchiveQueryLogsApiParams{ GroupId: opts.groupId, @@ -279,28 +297,29 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) run(ctx context.Context, _ io.Re ArchiveOnly: &opts.archiveOnly, } - resp, _, err := opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OnlineArchiveApi.DownloadOnlineArchiveQueryLogsWithParams(ctx, params).Execute() + return err +} + +func (opts *downloadOnlineArchiveQueryLogsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { @@ -312,7 +331,10 @@ func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -333,6 +355,7 @@ type getOnlineArchiveOpts struct { clusterName string format string tmpl *template.Template + resp *admin.BackupOnlineArchive } func (opts *getOnlineArchiveOpts) preRun() (err error) { @@ -352,13 +375,15 @@ func (opts *getOnlineArchiveOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getOnlineArchiveOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getOnlineArchiveOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetOnlineArchiveApiParams{ GroupId: opts.groupId, @@ -366,28 +391,29 @@ func (opts *getOnlineArchiveOpts) run(ctx context.Context, _ io.Reader, w io.Wri ClusterName: opts.clusterName, } - resp, _, err := opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OnlineArchiveApi.GetOnlineArchiveWithParams(ctx, params).Execute() + return err +} + +func (opts *getOnlineArchiveOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getOnlineArchiveBuilder() *cobra.Command { @@ -399,7 +425,10 @@ func getOnlineArchiveBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -421,6 +450,7 @@ type listOnlineArchivesOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedOnlineArchive } func (opts *listOnlineArchivesOpts) preRun() (err error) { @@ -440,13 +470,15 @@ func (opts *listOnlineArchivesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listOnlineArchivesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listOnlineArchivesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListOnlineArchivesApiParams{ GroupId: opts.groupId, @@ -456,28 +488,29 @@ func (opts *listOnlineArchivesOpts) run(ctx context.Context, _ io.Reader, w io.W PageNum: &opts.pageNum, } - resp, _, err := opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OnlineArchiveApi.ListOnlineArchivesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listOnlineArchivesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listOnlineArchivesBuilder() *cobra.Command { @@ -489,7 +522,10 @@ func listOnlineArchivesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -513,6 +549,7 @@ type updateOnlineArchiveOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.BackupOnlineArchive } func (opts *updateOnlineArchiveOpts) preRun() (err error) { @@ -532,10 +569,12 @@ func (opts *updateOnlineArchiveOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateOnlineArchiveOpts) readData(r io.Reader) (*admin.BackupOnlineArchive, error) { @@ -560,7 +599,7 @@ func (opts *updateOnlineArchiveOpts) readData(r io.Reader) (*admin.BackupOnlineA return out, nil } -func (opts *updateOnlineArchiveOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateOnlineArchiveOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -574,28 +613,29 @@ func (opts *updateOnlineArchiveOpts) run(ctx context.Context, r io.Reader, w io. BackupOnlineArchive: data, } - resp, _, err := opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OnlineArchiveApi.UpdateOnlineArchiveWithParams(ctx, params).Execute() + return err +} + +func (opts *updateOnlineArchiveOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateOnlineArchiveBuilder() *cobra.Command { @@ -609,7 +649,10 @@ func updateOnlineArchiveBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 26662083ef..654b4547a3 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -39,6 +39,7 @@ type createOrganizationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.CreateOrganizationResponse } func (opts *createOrganizationOpts) preRun() (err error) { @@ -47,10 +48,12 @@ func (opts *createOrganizationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createOrganizationOpts) readData(r io.Reader) (*admin.CreateOrganizationRequest, error) { @@ -75,7 +78,7 @@ func (opts *createOrganizationOpts) readData(r io.Reader) (*admin.CreateOrganiza return out, nil } -func (opts *createOrganizationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createOrganizationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -86,28 +89,29 @@ func (opts *createOrganizationOpts) run(ctx context.Context, r io.Reader, w io.W CreateOrganizationRequest: data, } - resp, _, err := opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.CreateOrganizationWithParams(ctx, params).Execute() + return err +} + +func (opts *createOrganizationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createOrganizationBuilder() *cobra.Command { @@ -121,7 +125,10 @@ func createOrganizationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } @@ -139,6 +146,7 @@ type createOrganizationInvitationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.OrganizationInvitation } func (opts *createOrganizationInvitationOpts) preRun() (err error) { @@ -158,10 +166,12 @@ func (opts *createOrganizationInvitationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createOrganizationInvitationOpts) readData(r io.Reader) (*admin.OrganizationInvitationRequest, error) { @@ -186,7 +196,7 @@ func (opts *createOrganizationInvitationOpts) readData(r io.Reader) (*admin.Orga return out, nil } -func (opts *createOrganizationInvitationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createOrganizationInvitationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -198,28 +208,29 @@ func (opts *createOrganizationInvitationOpts) run(ctx context.Context, r io.Read OrganizationInvitationRequest: data, } - resp, _, err := opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.CreateOrganizationInvitationWithParams(ctx, params).Execute() + return err +} + +func (opts *createOrganizationInvitationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createOrganizationInvitationBuilder() *cobra.Command { @@ -233,7 +244,10 @@ func createOrganizationInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -249,6 +263,7 @@ type deleteOrganizationOpts struct { orgId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteOrganizationOpts) preRun() (err error) { @@ -268,40 +283,43 @@ func (opts *deleteOrganizationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteOrganizationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteOrganizationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteOrganizationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.DeleteOrganizationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteOrganizationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteOrganizationBuilder() *cobra.Command { @@ -313,7 +331,10 @@ func deleteOrganizationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -328,6 +349,7 @@ type deleteOrganizationInvitationOpts struct { invitationId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteOrganizationInvitationOpts) preRun() (err error) { @@ -347,41 +369,44 @@ func (opts *deleteOrganizationInvitationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteOrganizationInvitationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteOrganizationInvitationApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.DeleteOrganizationInvitationWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteOrganizationInvitationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteOrganizationInvitationBuilder() *cobra.Command { @@ -393,7 +418,10 @@ func deleteOrganizationInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -409,6 +437,7 @@ type getOrganizationOpts struct { orgId string format string tmpl *template.Template + resp *admin.AtlasOrganization } func (opts *getOrganizationOpts) preRun() (err error) { @@ -428,40 +457,43 @@ func (opts *getOrganizationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getOrganizationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getOrganizationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetOrganizationApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.GetOrganizationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.GetOrganizationWithParams(ctx, params).Execute() + return err +} + +func (opts *getOrganizationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getOrganizationBuilder() *cobra.Command { @@ -473,7 +505,10 @@ func getOrganizationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -488,6 +523,7 @@ type getOrganizationInvitationOpts struct { invitationId string format string tmpl *template.Template + resp *admin.OrganizationInvitation } func (opts *getOrganizationInvitationOpts) preRun() (err error) { @@ -507,41 +543,44 @@ func (opts *getOrganizationInvitationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getOrganizationInvitationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getOrganizationInvitationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetOrganizationInvitationApiParams{ OrgId: opts.orgId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.GetOrganizationInvitationWithParams(ctx, params).Execute() + return err +} + +func (opts *getOrganizationInvitationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getOrganizationInvitationBuilder() *cobra.Command { @@ -553,7 +592,10 @@ func getOrganizationInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -569,6 +611,7 @@ type getOrganizationSettingsOpts struct { orgId string format string tmpl *template.Template + resp *admin.OrganizationSettings } func (opts *getOrganizationSettingsOpts) preRun() (err error) { @@ -588,40 +631,43 @@ func (opts *getOrganizationSettingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getOrganizationSettingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getOrganizationSettingsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetOrganizationSettingsApiParams{ OrgId: opts.orgId, } - resp, _, err := opts.client.OrganizationsApi.GetOrganizationSettingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.GetOrganizationSettingsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getOrganizationSettingsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getOrganizationSettingsBuilder() *cobra.Command { @@ -633,7 +679,10 @@ func getOrganizationSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -648,6 +697,7 @@ type listOrganizationInvitationsOpts struct { username string format string tmpl *template.Template + resp []admin.OrganizationInvitation } func (opts *listOrganizationInvitationsOpts) preRun() (err error) { @@ -667,41 +717,44 @@ func (opts *listOrganizationInvitationsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listOrganizationInvitationsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListOrganizationInvitationsApiParams{ OrgId: opts.orgId, Username: &opts.username, } - resp, _, err := opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.ListOrganizationInvitationsWithParams(ctx, params).Execute() + return err +} + +func (opts *listOrganizationInvitationsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listOrganizationInvitationsBuilder() *cobra.Command { @@ -713,7 +766,10 @@ func listOrganizationInvitationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -732,6 +788,7 @@ type listOrganizationProjectsOpts struct { name string format string tmpl *template.Template + resp *admin.PaginatedAtlasGroup } func (opts *listOrganizationProjectsOpts) preRun() (err error) { @@ -751,13 +808,15 @@ func (opts *listOrganizationProjectsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listOrganizationProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listOrganizationProjectsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListOrganizationProjectsApiParams{ OrgId: opts.orgId, @@ -767,28 +826,29 @@ func (opts *listOrganizationProjectsOpts) run(ctx context.Context, _ io.Reader, Name: &opts.name, } - resp, _, err := opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.ListOrganizationProjectsWithParams(ctx, params).Execute() + return err +} + +func (opts *listOrganizationProjectsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listOrganizationProjectsBuilder() *cobra.Command { @@ -800,7 +860,10 @@ func listOrganizationProjectsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -821,6 +884,7 @@ type listOrganizationUsersOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedAppUser } func (opts *listOrganizationUsersOpts) preRun() (err error) { @@ -840,13 +904,15 @@ func (opts *listOrganizationUsersOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listOrganizationUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listOrganizationUsersOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListOrganizationUsersApiParams{ OrgId: opts.orgId, @@ -855,28 +921,29 @@ func (opts *listOrganizationUsersOpts) run(ctx context.Context, _ io.Reader, w i PageNum: &opts.pageNum, } - resp, _, err := opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.ListOrganizationUsersWithParams(ctx, params).Execute() + return err +} + +func (opts *listOrganizationUsersOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listOrganizationUsersBuilder() *cobra.Command { @@ -888,7 +955,10 @@ func listOrganizationUsersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -908,6 +978,7 @@ type listOrganizationsOpts struct { name string format string tmpl *template.Template + resp *admin.PaginatedOrganization } func (opts *listOrganizationsOpts) preRun() (err error) { @@ -916,13 +987,15 @@ func (opts *listOrganizationsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listOrganizationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listOrganizationsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListOrganizationsApiParams{ IncludeCount: &opts.includeCount, @@ -931,28 +1004,29 @@ func (opts *listOrganizationsOpts) run(ctx context.Context, _ io.Reader, w io.Wr Name: &opts.name, } - resp, _, err := opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.ListOrganizationsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listOrganizationsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listOrganizationsBuilder() *cobra.Command { @@ -964,7 +1038,10 @@ func listOrganizationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -982,6 +1059,7 @@ type removeOrganizationUserOpts struct { userId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *removeOrganizationUserOpts) preRun() (err error) { @@ -1001,41 +1079,44 @@ func (opts *removeOrganizationUserOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *removeOrganizationUserOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *removeOrganizationUserOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.RemoveOrganizationUserApiParams{ OrgId: opts.orgId, UserId: opts.userId, } - resp, _, err := opts.client.OrganizationsApi.RemoveOrganizationUserWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.RemoveOrganizationUserWithParams(ctx, params).Execute() + return err +} + +func (opts *removeOrganizationUserOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func removeOrganizationUserBuilder() *cobra.Command { @@ -1047,7 +1128,10 @@ func removeOrganizationUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1066,6 +1150,7 @@ type renameOrganizationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.AtlasOrganization } func (opts *renameOrganizationOpts) preRun() (err error) { @@ -1085,10 +1170,12 @@ func (opts *renameOrganizationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *renameOrganizationOpts) readData(r io.Reader) (*admin.AtlasOrganization, error) { @@ -1113,7 +1200,7 @@ func (opts *renameOrganizationOpts) readData(r io.Reader) (*admin.AtlasOrganizat return out, nil } -func (opts *renameOrganizationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *renameOrganizationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1125,28 +1212,29 @@ func (opts *renameOrganizationOpts) run(ctx context.Context, r io.Reader, w io.W AtlasOrganization: data, } - resp, _, err := opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.RenameOrganizationWithParams(ctx, params).Execute() + return err +} + +func (opts *renameOrganizationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func renameOrganizationBuilder() *cobra.Command { @@ -1160,7 +1248,10 @@ func renameOrganizationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1179,6 +1270,7 @@ type updateOrganizationInvitationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.OrganizationInvitation } func (opts *updateOrganizationInvitationOpts) preRun() (err error) { @@ -1198,10 +1290,12 @@ func (opts *updateOrganizationInvitationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateOrganizationInvitationOpts) readData(r io.Reader) (*admin.OrganizationInvitationRequest, error) { @@ -1226,7 +1320,7 @@ func (opts *updateOrganizationInvitationOpts) readData(r io.Reader) (*admin.Orga return out, nil } -func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1238,28 +1332,29 @@ func (opts *updateOrganizationInvitationOpts) run(ctx context.Context, r io.Read OrganizationInvitationRequest: data, } - resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.UpdateOrganizationInvitationWithParams(ctx, params).Execute() + return err +} + +func (opts *updateOrganizationInvitationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateOrganizationInvitationBuilder() *cobra.Command { @@ -1273,7 +1368,10 @@ func updateOrganizationInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1293,6 +1391,7 @@ type updateOrganizationInvitationByIdOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.OrganizationInvitation } func (opts *updateOrganizationInvitationByIdOpts) preRun() (err error) { @@ -1312,10 +1411,12 @@ func (opts *updateOrganizationInvitationByIdOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateOrganizationInvitationByIdOpts) readData(r io.Reader) (*admin.OrganizationInvitationUpdateRequest, error) { @@ -1340,7 +1441,7 @@ func (opts *updateOrganizationInvitationByIdOpts) readData(r io.Reader) (*admin. return out, nil } -func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1353,28 +1454,29 @@ func (opts *updateOrganizationInvitationByIdOpts) run(ctx context.Context, r io. OrganizationInvitationUpdateRequest: data, } - resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.UpdateOrganizationInvitationByIdWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateOrganizationInvitationByIdOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateOrganizationInvitationByIdBuilder() *cobra.Command { @@ -1388,7 +1490,10 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1410,6 +1515,7 @@ type updateOrganizationRolesOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.UpdateOrgRolesForUser } func (opts *updateOrganizationRolesOpts) preRun() (err error) { @@ -1429,10 +1535,12 @@ func (opts *updateOrganizationRolesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateOrganizationRolesOpts) readData(r io.Reader) (*admin.UpdateOrgRolesForUser, error) { @@ -1457,7 +1565,7 @@ func (opts *updateOrganizationRolesOpts) readData(r io.Reader) (*admin.UpdateOrg return out, nil } -func (opts *updateOrganizationRolesOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateOrganizationRolesOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1470,28 +1578,29 @@ func (opts *updateOrganizationRolesOpts) run(ctx context.Context, r io.Reader, w UpdateOrgRolesForUser: data, } - resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationRolesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.UpdateOrganizationRolesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateOrganizationRolesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateOrganizationRolesBuilder() *cobra.Command { @@ -1505,7 +1614,10 @@ func updateOrganizationRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1526,6 +1638,7 @@ type updateOrganizationSettingsOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.OrganizationSettings } func (opts *updateOrganizationSettingsOpts) preRun() (err error) { @@ -1545,10 +1658,12 @@ func (opts *updateOrganizationSettingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateOrganizationSettingsOpts) readData(r io.Reader) (*admin.OrganizationSettings, error) { @@ -1573,7 +1688,7 @@ func (opts *updateOrganizationSettingsOpts) readData(r io.Reader) (*admin.Organi return out, nil } -func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1585,28 +1700,29 @@ func (opts *updateOrganizationSettingsOpts) run(ctx context.Context, r io.Reader OrganizationSettings: data, } - resp, _, err := opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.OrganizationsApi.UpdateOrganizationSettingsWithParams(ctx, params).Execute() + return err +} + +func (opts *updateOrganizationSettingsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateOrganizationSettingsBuilder() *cobra.Command { @@ -1620,7 +1736,10 @@ func updateOrganizationSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index dacca6cb4b..0233cfdf56 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -52,19 +52,25 @@ func (opts *disableSlowOperationThresholdingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *disableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *disableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DisableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } - _, err := opts.client.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(ctx, params).Execute() + var err error + _, err = opts.client.PerformanceAdvisorApi.DisableSlowOperationThresholdingWithParams(ctx, params).Execute() return err } +func (opts *disableSlowOperationThresholdingOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func disableSlowOperationThresholdingBuilder() *cobra.Command { opts := disableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ @@ -74,7 +80,10 @@ func disableSlowOperationThresholdingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -103,19 +112,25 @@ func (opts *enableSlowOperationThresholdingOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *enableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *enableSlowOperationThresholdingOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.EnableSlowOperationThresholdingApiParams{ GroupId: opts.groupId, } - _, err := opts.client.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(ctx, params).Execute() + var err error + _, err = opts.client.PerformanceAdvisorApi.EnableSlowOperationThresholdingWithParams(ctx, params).Execute() return err } +func (opts *enableSlowOperationThresholdingOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func enableSlowOperationThresholdingBuilder() *cobra.Command { opts := enableSlowOperationThresholdingOpts{} cmd := &cobra.Command{ @@ -125,7 +140,10 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -143,6 +161,7 @@ type listSlowQueriesOpts struct { since int64 format string tmpl *template.Template + resp *admin.PerformanceAdvisorSlowQueryList } func (opts *listSlowQueriesOpts) preRun() (err error) { @@ -162,13 +181,15 @@ func (opts *listSlowQueriesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listSlowQueriesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listSlowQueriesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListSlowQueriesApiParams{ GroupId: opts.groupId, @@ -179,28 +200,29 @@ func (opts *listSlowQueriesOpts) run(ctx context.Context, _ io.Reader, w io.Writ Since: &opts.since, } - resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueriesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PerformanceAdvisorApi.ListSlowQueriesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listSlowQueriesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listSlowQueriesBuilder() *cobra.Command { @@ -212,7 +234,10 @@ func listSlowQueriesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -241,6 +266,7 @@ type listSlowQueryNamespacesOpts struct { since int64 format string tmpl *template.Template + resp *admin.Namespaces } func (opts *listSlowQueryNamespacesOpts) preRun() (err error) { @@ -260,13 +286,15 @@ func (opts *listSlowQueryNamespacesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListSlowQueryNamespacesApiParams{ GroupId: opts.groupId, @@ -275,28 +303,29 @@ func (opts *listSlowQueryNamespacesOpts) run(ctx context.Context, _ io.Reader, w Since: &opts.since, } - resp, _, err := opts.client.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PerformanceAdvisorApi.ListSlowQueryNamespacesWithParams(ctx, params).Execute() + return err +} + +func (opts *listSlowQueryNamespacesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listSlowQueryNamespacesBuilder() *cobra.Command { @@ -308,7 +337,10 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -341,6 +373,7 @@ type listSuggestedIndexesOpts struct { since int64 format string tmpl *template.Template + resp *admin.PerformanceAdvisorResponse } func (opts *listSuggestedIndexesOpts) preRun() (err error) { @@ -360,13 +393,15 @@ func (opts *listSuggestedIndexesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listSuggestedIndexesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listSuggestedIndexesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListSuggestedIndexesApiParams{ GroupId: opts.groupId, @@ -381,28 +416,29 @@ func (opts *listSuggestedIndexesOpts) run(ctx context.Context, _ io.Reader, w io Since: &opts.since, } - resp, _, err := opts.client.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PerformanceAdvisorApi.ListSuggestedIndexesWithParams(ctx, params).Execute() + return err +} + +func (opts *listSuggestedIndexesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listSuggestedIndexesBuilder() *cobra.Command { @@ -414,7 +450,10 @@ func listSuggestedIndexesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 66129c185e..bddcb2925d 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -42,6 +42,7 @@ type createPrivateEndpointOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PrivateLinkEndpoint } func (opts *createPrivateEndpointOpts) preRun() (err error) { @@ -61,10 +62,12 @@ func (opts *createPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createPrivateEndpointOpts) readData(r io.Reader) (*admin.CreateEndpointRequest, error) { @@ -89,7 +92,7 @@ func (opts *createPrivateEndpointOpts) readData(r io.Reader) (*admin.CreateEndpo return out, nil } -func (opts *createPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createPrivateEndpointOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -103,28 +106,29 @@ func (opts *createPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w i CreateEndpointRequest: data, } - resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointWithParams(ctx, params).Execute() + return err +} + +func (opts *createPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createPrivateEndpointBuilder() *cobra.Command { @@ -138,7 +142,10 @@ func createPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -161,6 +168,7 @@ type createPrivateEndpointServiceOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.EndpointService } func (opts *createPrivateEndpointServiceOpts) preRun() (err error) { @@ -180,10 +188,12 @@ func (opts *createPrivateEndpointServiceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createPrivateEndpointServiceOpts) readData(r io.Reader) (*admin.CloudProviderEndpointServiceRequest, error) { @@ -208,7 +218,7 @@ func (opts *createPrivateEndpointServiceOpts) readData(r io.Reader) (*admin.Clou return out, nil } -func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -220,28 +230,29 @@ func (opts *createPrivateEndpointServiceOpts) run(ctx context.Context, r io.Read CloudProviderEndpointServiceRequest: data, } - resp, _, err := opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.CreatePrivateEndpointServiceWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createPrivateEndpointServiceOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createPrivateEndpointServiceBuilder() *cobra.Command { @@ -255,7 +266,10 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -274,6 +288,7 @@ type deletePrivateEndpointOpts struct { endpointServiceId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deletePrivateEndpointOpts) preRun() (err error) { @@ -293,13 +308,15 @@ func (opts *deletePrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deletePrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deletePrivateEndpointOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeletePrivateEndpointApiParams{ GroupId: opts.groupId, @@ -308,28 +325,29 @@ func (opts *deletePrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w i EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointWithParams(ctx, params).Execute() + return err +} + +func (opts *deletePrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deletePrivateEndpointBuilder() *cobra.Command { @@ -341,7 +359,10 @@ func deletePrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -363,6 +384,7 @@ type deletePrivateEndpointServiceOpts struct { endpointServiceId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deletePrivateEndpointServiceOpts) preRun() (err error) { @@ -382,13 +404,15 @@ func (opts *deletePrivateEndpointServiceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeletePrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -396,28 +420,29 @@ func (opts *deletePrivateEndpointServiceOpts) run(ctx context.Context, _ io.Read EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.DeletePrivateEndpointServiceWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deletePrivateEndpointServiceOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deletePrivateEndpointServiceBuilder() *cobra.Command { @@ -429,7 +454,10 @@ func deletePrivateEndpointServiceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -450,6 +478,7 @@ type getPrivateEndpointOpts struct { endpointServiceId string format string tmpl *template.Template + resp *admin.PrivateLinkEndpoint } func (opts *getPrivateEndpointOpts) preRun() (err error) { @@ -469,13 +498,15 @@ func (opts *getPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getPrivateEndpointOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -484,28 +515,29 @@ func (opts *getPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.W EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.GetPrivateEndpointWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getPrivateEndpointBuilder() *cobra.Command { @@ -517,7 +549,10 @@ func getPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -539,6 +574,7 @@ type getPrivateEndpointServiceOpts struct { endpointServiceId string format string tmpl *template.Template + resp *admin.EndpointService } func (opts *getPrivateEndpointServiceOpts) preRun() (err error) { @@ -558,13 +594,15 @@ func (opts *getPrivateEndpointServiceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetPrivateEndpointServiceApiParams{ GroupId: opts.groupId, @@ -572,28 +610,29 @@ func (opts *getPrivateEndpointServiceOpts) run(ctx context.Context, _ io.Reader, EndpointServiceId: opts.endpointServiceId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.GetPrivateEndpointServiceWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getPrivateEndpointServiceOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getPrivateEndpointServiceBuilder() *cobra.Command { @@ -605,7 +644,10 @@ func getPrivateEndpointServiceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -623,6 +665,7 @@ type getRegionalizedPrivateEndpointSettingOpts struct { groupId string format string tmpl *template.Template + resp *admin.ProjectSettingItem } func (opts *getRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { @@ -642,40 +685,43 @@ func (opts *getRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetRegionalizedPrivateEndpointSettingApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.GetRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() + return err +} + +func (opts *getRegionalizedPrivateEndpointSettingOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { @@ -687,7 +733,10 @@ func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -702,6 +751,7 @@ type listPrivateEndpointServicesOpts struct { cloudProvider string format string tmpl *template.Template + resp []admin.EndpointService } func (opts *listPrivateEndpointServicesOpts) preRun() (err error) { @@ -721,41 +771,44 @@ func (opts *listPrivateEndpointServicesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listPrivateEndpointServicesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListPrivateEndpointServicesApiParams{ GroupId: opts.groupId, CloudProvider: opts.cloudProvider, } - resp, _, err := opts.client.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.ListPrivateEndpointServicesWithParams(ctx, params).Execute() + return err +} + +func (opts *listPrivateEndpointServicesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listPrivateEndpointServicesBuilder() *cobra.Command { @@ -767,7 +820,10 @@ func listPrivateEndpointServicesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -786,6 +842,7 @@ type toggleRegionalizedPrivateEndpointSettingOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ProjectSettingItem } func (opts *toggleRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { @@ -805,10 +862,12 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData(r io.Reader) (*admin.ProjectSettingItem, error) { @@ -833,7 +892,7 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) readData(r io.Reader) return out, nil } -func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -845,28 +904,29 @@ func (opts *toggleRegionalizedPrivateEndpointSettingOpts) run(ctx context.Contex ProjectSettingItem: data, } - resp, _, err := opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PrivateEndpointServicesApi.ToggleRegionalizedPrivateEndpointSettingWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *toggleRegionalizedPrivateEndpointSettingOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { @@ -880,7 +940,10 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index d0c92bda08..44a7bdf041 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -41,6 +41,7 @@ type addProjectApiKeyOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ApiKeyUserDetails } func (opts *addProjectApiKeyOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *addProjectApiKeyOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *addProjectApiKeyOpts) readData(r io.Reader) (*[]admin.UserAccessRoleAssignment, error) { @@ -88,7 +91,7 @@ func (opts *addProjectApiKeyOpts) readData(r io.Reader) (*[]admin.UserAccessRole return out, nil } -func (opts *addProjectApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *addProjectApiKeyOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *addProjectApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Wri UserAccessRoleAssignment: data, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.AddProjectApiKeyWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *addProjectApiKeyOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func addProjectApiKeyBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func addProjectApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -157,6 +164,7 @@ type createApiKeyOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ApiKeyUserDetails } func (opts *createApiKeyOpts) preRun() (err error) { @@ -176,10 +184,12 @@ func (opts *createApiKeyOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createApiKeyOpts) readData(r io.Reader) (*admin.CreateAtlasOrganizationApiKey, error) { @@ -204,7 +214,7 @@ func (opts *createApiKeyOpts) readData(r io.Reader) (*admin.CreateAtlasOrganizat return out, nil } -func (opts *createApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createApiKeyOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -216,28 +226,29 @@ func (opts *createApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) CreateAtlasOrganizationApiKey: data, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.CreateApiKeyWithParams(ctx, params).Execute() + return err +} + +func (opts *createApiKeyOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createApiKeyBuilder() *cobra.Command { @@ -251,7 +262,10 @@ func createApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -274,6 +288,7 @@ type createApiKeyAccessListOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedApiUserAccessList } func (opts *createApiKeyAccessListOpts) preRun() (err error) { @@ -293,10 +308,12 @@ func (opts *createApiKeyAccessListOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createApiKeyAccessListOpts) readData(r io.Reader) (*[]admin.UserAccessList, error) { @@ -321,7 +338,7 @@ func (opts *createApiKeyAccessListOpts) readData(r io.Reader) (*[]admin.UserAcce return out, nil } -func (opts *createApiKeyAccessListOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createApiKeyAccessListOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -338,28 +355,29 @@ func (opts *createApiKeyAccessListOpts) run(ctx context.Context, r io.Reader, w UserAccessList: data, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.CreateApiKeyAccessListWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createApiKeyAccessListOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createApiKeyAccessListBuilder() *cobra.Command { @@ -373,7 +391,10 @@ func createApiKeyAccessListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -397,6 +418,7 @@ type createProjectApiKeyOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ApiKeyUserDetails } func (opts *createProjectApiKeyOpts) preRun() (err error) { @@ -416,10 +438,12 @@ func (opts *createProjectApiKeyOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createProjectApiKeyOpts) readData(r io.Reader) (*admin.CreateAtlasProjectApiKey, error) { @@ -444,7 +468,7 @@ func (opts *createProjectApiKeyOpts) readData(r io.Reader) (*admin.CreateAtlasPr return out, nil } -func (opts *createProjectApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createProjectApiKeyOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -456,28 +480,29 @@ func (opts *createProjectApiKeyOpts) run(ctx context.Context, r io.Reader, w io. CreateAtlasProjectApiKey: data, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.CreateProjectApiKeyWithParams(ctx, params).Execute() + return err +} + +func (opts *createProjectApiKeyOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createProjectApiKeyBuilder() *cobra.Command { @@ -491,7 +516,10 @@ func createProjectApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -508,6 +536,7 @@ type deleteApiKeyOpts struct { apiUserId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteApiKeyOpts) preRun() (err error) { @@ -527,41 +556,44 @@ func (opts *deleteApiKeyOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteApiKeyOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteApiKeyOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteApiKeyOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteApiKeyBuilder() *cobra.Command { @@ -573,7 +605,10 @@ func deleteApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -591,6 +626,7 @@ type deleteApiKeyAccessListEntryOpts struct { ipAddress string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteApiKeyAccessListEntryOpts) preRun() (err error) { @@ -610,13 +646,15 @@ func (opts *deleteApiKeyAccessListEntryOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteApiKeyAccessListEntryApiParams{ OrgId: opts.orgId, @@ -624,28 +662,29 @@ func (opts *deleteApiKeyAccessListEntryOpts) run(ctx context.Context, _ io.Reade IpAddress: opts.ipAddress, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyAccessListEntryWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.DeleteApiKeyAccessListEntryWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteApiKeyAccessListEntryOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteApiKeyAccessListEntryBuilder() *cobra.Command { @@ -657,7 +696,10 @@ func deleteApiKeyAccessListEntryBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -676,6 +718,7 @@ type getApiKeyOpts struct { apiUserId string format string tmpl *template.Template + resp *admin.ApiKeyUserDetails } func (opts *getApiKeyOpts) preRun() (err error) { @@ -695,41 +738,44 @@ func (opts *getApiKeyOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getApiKeyOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getApiKeyOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetApiKeyApiParams{ OrgId: opts.orgId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.GetApiKeyWithParams(ctx, params).Execute() + return err +} + +func (opts *getApiKeyOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getApiKeyBuilder() *cobra.Command { @@ -741,7 +787,10 @@ func getApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -759,6 +808,7 @@ type getApiKeyAccessListOpts struct { apiUserId string format string tmpl *template.Template + resp *admin.UserAccessList } func (opts *getApiKeyAccessListOpts) preRun() (err error) { @@ -778,13 +828,15 @@ func (opts *getApiKeyAccessListOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getApiKeyAccessListOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getApiKeyAccessListOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetApiKeyAccessListApiParams{ OrgId: opts.orgId, @@ -792,28 +844,29 @@ func (opts *getApiKeyAccessListOpts) run(ctx context.Context, _ io.Reader, w io. ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.GetApiKeyAccessListWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.GetApiKeyAccessListWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getApiKeyAccessListOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getApiKeyAccessListBuilder() *cobra.Command { @@ -825,7 +878,10 @@ func getApiKeyAccessListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -847,6 +903,7 @@ type listApiKeyAccessListsEntriesOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiUserAccessList } func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { @@ -866,13 +923,15 @@ func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListApiKeyAccessListsEntriesApiParams{ OrgId: opts.orgId, @@ -882,28 +941,29 @@ func (opts *listApiKeyAccessListsEntriesOpts) run(ctx context.Context, _ io.Read PageNum: &opts.pageNum, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.ListApiKeyAccessListsEntriesWithParams(ctx, params).Execute() + return err +} + +func (opts *listApiKeyAccessListsEntriesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listApiKeyAccessListsEntriesBuilder() *cobra.Command { @@ -915,7 +975,10 @@ func listApiKeyAccessListsEntriesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -937,6 +1000,7 @@ type listApiKeysOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiApiUser } func (opts *listApiKeysOpts) preRun() (err error) { @@ -956,13 +1020,15 @@ func (opts *listApiKeysOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listApiKeysOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listApiKeysOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListApiKeysApiParams{ OrgId: opts.orgId, @@ -971,28 +1037,29 @@ func (opts *listApiKeysOpts) run(ctx context.Context, _ io.Reader, w io.Writer) PageNum: &opts.pageNum, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListApiKeysWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.ListApiKeysWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listApiKeysOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listApiKeysBuilder() *cobra.Command { @@ -1004,7 +1071,10 @@ func listApiKeysBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1024,6 +1094,7 @@ type listProjectApiKeysOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiApiUser } func (opts *listProjectApiKeysOpts) preRun() (err error) { @@ -1043,13 +1114,15 @@ func (opts *listProjectApiKeysOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listProjectApiKeysOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listProjectApiKeysOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListProjectApiKeysApiParams{ GroupId: opts.groupId, @@ -1058,28 +1131,29 @@ func (opts *listProjectApiKeysOpts) run(ctx context.Context, _ io.Reader, w io.W PageNum: &opts.pageNum, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.ListProjectApiKeysWithParams(ctx, params).Execute() + return err +} + +func (opts *listProjectApiKeysOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listProjectApiKeysBuilder() *cobra.Command { @@ -1091,7 +1165,10 @@ func listProjectApiKeysBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1109,6 +1186,7 @@ type removeProjectApiKeyOpts struct { apiUserId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *removeProjectApiKeyOpts) preRun() (err error) { @@ -1128,41 +1206,44 @@ func (opts *removeProjectApiKeyOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *removeProjectApiKeyOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *removeProjectApiKeyOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.RemoveProjectApiKeyApiParams{ GroupId: opts.groupId, ApiUserId: opts.apiUserId, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.RemoveProjectApiKeyWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *removeProjectApiKeyOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func removeProjectApiKeyBuilder() *cobra.Command { @@ -1174,7 +1255,10 @@ func removeProjectApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1194,6 +1278,7 @@ type updateApiKeyOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ApiKeyUserDetails } func (opts *updateApiKeyOpts) preRun() (err error) { @@ -1213,10 +1298,12 @@ func (opts *updateApiKeyOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateApiKeyOpts) readData(r io.Reader) (*admin.UpdateAtlasOrganizationApiKey, error) { @@ -1241,7 +1328,7 @@ func (opts *updateApiKeyOpts) readData(r io.Reader) (*admin.UpdateAtlasOrganizat return out, nil } -func (opts *updateApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateApiKeyOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1254,28 +1341,29 @@ func (opts *updateApiKeyOpts) run(ctx context.Context, r io.Reader, w io.Writer) UpdateAtlasOrganizationApiKey: data, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateApiKeyOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateApiKeyBuilder() *cobra.Command { @@ -1289,7 +1377,10 @@ func updateApiKeyBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1314,6 +1405,7 @@ type updateApiKeyRolesOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ApiKeyUserDetails } func (opts *updateApiKeyRolesOpts) preRun() (err error) { @@ -1333,10 +1425,12 @@ func (opts *updateApiKeyRolesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateApiKeyRolesOpts) readData(r io.Reader) (*admin.UpdateAtlasProjectApiKey, error) { @@ -1361,7 +1455,7 @@ func (opts *updateApiKeyRolesOpts) readData(r io.Reader) (*admin.UpdateAtlasProj return out, nil } -func (opts *updateApiKeyRolesOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateApiKeyRolesOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1378,28 +1472,29 @@ func (opts *updateApiKeyRolesOpts) run(ctx context.Context, r io.Reader, w io.Wr UpdateAtlasProjectApiKey: data, } - resp, _, err := opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProgrammaticAPIKeysApi.UpdateApiKeyRolesWithParams(ctx, params).Execute() + return err +} + +func (opts *updateApiKeyRolesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateApiKeyRolesBuilder() *cobra.Command { @@ -1413,7 +1508,10 @@ func updateApiKeyRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 076e95727a..98b874b7e2 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -43,6 +43,7 @@ type createProjectIpAccessListOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedNetworkAccess } func (opts *createProjectIpAccessListOpts) preRun() (err error) { @@ -62,10 +63,12 @@ func (opts *createProjectIpAccessListOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createProjectIpAccessListOpts) readData(r io.Reader) (*[]admin.NetworkPermissionEntry, error) { @@ -90,7 +93,7 @@ func (opts *createProjectIpAccessListOpts) readData(r io.Reader) (*[]admin.Netwo return out, nil } -func (opts *createProjectIpAccessListOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createProjectIpAccessListOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -106,28 +109,29 @@ func (opts *createProjectIpAccessListOpts) run(ctx context.Context, r io.Reader, NetworkPermissionEntry: data, } - resp, _, err := opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectIPAccessListApi.CreateProjectIpAccessListWithParams(ctx, params).Execute() + return err +} + +func (opts *createProjectIpAccessListOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createProjectIpAccessListBuilder() *cobra.Command { @@ -141,7 +145,10 @@ func createProjectIpAccessListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -161,6 +168,7 @@ type deleteProjectIpAccessListOpts struct { entryValue string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteProjectIpAccessListOpts) preRun() (err error) { @@ -180,41 +188,44 @@ func (opts *deleteProjectIpAccessListOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteProjectIpAccessListOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteProjectIpAccessListApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.client.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectIPAccessListApi.DeleteProjectIpAccessListWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteProjectIpAccessListOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteProjectIpAccessListBuilder() *cobra.Command { @@ -226,7 +237,10 @@ func deleteProjectIpAccessListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -247,6 +261,7 @@ type getProjectIpAccessListStatusOpts struct { entryValue string format string tmpl *template.Template + resp *admin.NetworkPermissionEntryStatus } func (opts *getProjectIpAccessListStatusOpts) preRun() (err error) { @@ -266,41 +281,44 @@ func (opts *getProjectIpAccessListStatusOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getProjectIpAccessListStatusOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetProjectIpAccessListStatusApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectIPAccessListApi.GetProjectIpAccessListStatusWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getProjectIpAccessListStatusOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getProjectIpAccessListStatusBuilder() *cobra.Command { @@ -312,7 +330,10 @@ func getProjectIpAccessListStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -329,6 +350,7 @@ type getProjectIpListOpts struct { entryValue string format string tmpl *template.Template + resp *admin.NetworkPermissionEntry } func (opts *getProjectIpListOpts) preRun() (err error) { @@ -348,41 +370,44 @@ func (opts *getProjectIpListOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getProjectIpListOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getProjectIpListOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetProjectIpListApiParams{ GroupId: opts.groupId, EntryValue: opts.entryValue, } - resp, _, err := opts.client.ProjectIPAccessListApi.GetProjectIpListWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectIPAccessListApi.GetProjectIpListWithParams(ctx, params).Execute() + return err +} + +func (opts *getProjectIpListOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getProjectIpListBuilder() *cobra.Command { @@ -394,7 +419,10 @@ func getProjectIpListBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -413,6 +441,7 @@ type listProjectIpAccessListsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedNetworkAccess } func (opts *listProjectIpAccessListsOpts) preRun() (err error) { @@ -432,13 +461,15 @@ func (opts *listProjectIpAccessListsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListProjectIpAccessListsApiParams{ GroupId: opts.groupId, @@ -447,28 +478,29 @@ func (opts *listProjectIpAccessListsOpts) run(ctx context.Context, _ io.Reader, PageNum: &opts.pageNum, } - resp, _, err := opts.client.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectIPAccessListApi.ListProjectIpAccessListsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listProjectIpAccessListsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listProjectIpAccessListsBuilder() *cobra.Command { @@ -480,7 +512,10 @@ func listProjectIpAccessListsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 1145220378..8dc7a91367 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -40,6 +40,7 @@ type createProjectOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.Group } func (opts *createProjectOpts) preRun() (err error) { @@ -48,10 +49,12 @@ func (opts *createProjectOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createProjectOpts) readData(r io.Reader) (*admin.Group, error) { @@ -76,7 +79,7 @@ func (opts *createProjectOpts) readData(r io.Reader) (*admin.Group, error) { return out, nil } -func (opts *createProjectOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createProjectOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -89,28 +92,29 @@ func (opts *createProjectOpts) run(ctx context.Context, r io.Reader, w io.Writer Group: data, } - resp, _, err := opts.client.ProjectsApi.CreateProjectWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.CreateProjectWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createProjectOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createProjectBuilder() *cobra.Command { @@ -124,7 +128,10 @@ func createProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } @@ -143,6 +150,7 @@ type createProjectInvitationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GroupInvitation } func (opts *createProjectInvitationOpts) preRun() (err error) { @@ -162,10 +170,12 @@ func (opts *createProjectInvitationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createProjectInvitationOpts) readData(r io.Reader) (*admin.GroupInvitationRequest, error) { @@ -190,7 +200,7 @@ func (opts *createProjectInvitationOpts) readData(r io.Reader) (*admin.GroupInvi return out, nil } -func (opts *createProjectInvitationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createProjectInvitationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -202,28 +212,29 @@ func (opts *createProjectInvitationOpts) run(ctx context.Context, r io.Reader, w GroupInvitationRequest: data, } - resp, _, err := opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.CreateProjectInvitationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createProjectInvitationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createProjectInvitationBuilder() *cobra.Command { @@ -237,7 +248,10 @@ func createProjectInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -253,6 +267,7 @@ type deleteProjectOpts struct { groupId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteProjectOpts) preRun() (err error) { @@ -272,40 +287,43 @@ func (opts *deleteProjectOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteProjectOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteProjectOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.DeleteProjectWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.DeleteProjectWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteProjectOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteProjectBuilder() *cobra.Command { @@ -317,7 +335,10 @@ func deleteProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -332,6 +353,7 @@ type deleteProjectInvitationOpts struct { invitationId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteProjectInvitationOpts) preRun() (err error) { @@ -351,41 +373,44 @@ func (opts *deleteProjectInvitationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteProjectInvitationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteProjectInvitationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteProjectInvitationApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.ProjectsApi.DeleteProjectInvitationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.DeleteProjectInvitationWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteProjectInvitationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteProjectInvitationBuilder() *cobra.Command { @@ -397,7 +422,10 @@ func deleteProjectInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -414,6 +442,7 @@ type deleteProjectLimitOpts struct { groupId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteProjectLimitOpts) preRun() (err error) { @@ -433,41 +462,44 @@ func (opts *deleteProjectLimitOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteProjectLimitOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteProjectLimitOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.DeleteProjectLimitWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.DeleteProjectLimitWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteProjectLimitOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteProjectLimitBuilder() *cobra.Command { @@ -479,7 +511,10 @@ func deleteProjectLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -511,6 +546,7 @@ type getProjectOpts struct { groupId string format string tmpl *template.Template + resp *admin.Group } func (opts *getProjectOpts) preRun() (err error) { @@ -530,40 +566,43 @@ func (opts *getProjectOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getProjectOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getProjectOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetProjectApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.GetProjectWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.GetProjectWithParams(ctx, params).Execute() + return err +} + +func (opts *getProjectOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getProjectBuilder() *cobra.Command { @@ -575,7 +614,10 @@ func getProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -589,6 +631,7 @@ type getProjectByNameOpts struct { groupName string format string tmpl *template.Template + resp *admin.Group } func (opts *getProjectByNameOpts) preRun() (err error) { @@ -597,40 +640,43 @@ func (opts *getProjectByNameOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getProjectByNameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getProjectByNameOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetProjectByNameApiParams{ GroupName: opts.groupName, } - resp, _, err := opts.client.ProjectsApi.GetProjectByNameWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.GetProjectByNameWithParams(ctx, params).Execute() + return err +} + +func (opts *getProjectByNameOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getProjectByNameBuilder() *cobra.Command { @@ -642,7 +688,10 @@ func getProjectByNameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupName, "groupName", "", `Human-readable label that identifies this project.`) @@ -658,6 +707,7 @@ type getProjectInvitationOpts struct { invitationId string format string tmpl *template.Template + resp *admin.GroupInvitation } func (opts *getProjectInvitationOpts) preRun() (err error) { @@ -677,41 +727,44 @@ func (opts *getProjectInvitationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getProjectInvitationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getProjectInvitationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetProjectInvitationApiParams{ GroupId: opts.groupId, InvitationId: opts.invitationId, } - resp, _, err := opts.client.ProjectsApi.GetProjectInvitationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.GetProjectInvitationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getProjectInvitationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getProjectInvitationBuilder() *cobra.Command { @@ -723,7 +776,10 @@ func getProjectInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -740,6 +796,7 @@ type getProjectLimitOpts struct { groupId string format string tmpl *template.Template + resp *admin.DataFederationLimit } func (opts *getProjectLimitOpts) preRun() (err error) { @@ -759,41 +816,44 @@ func (opts *getProjectLimitOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getProjectLimitOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getProjectLimitOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetProjectLimitApiParams{ LimitName: opts.limitName, GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.GetProjectLimitWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.GetProjectLimitWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getProjectLimitOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getProjectLimitBuilder() *cobra.Command { @@ -805,7 +865,10 @@ func getProjectLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -837,6 +900,7 @@ type getProjectSettingsOpts struct { groupId string format string tmpl *template.Template + resp *admin.GroupSettings } func (opts *getProjectSettingsOpts) preRun() (err error) { @@ -856,40 +920,43 @@ func (opts *getProjectSettingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getProjectSettingsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getProjectSettingsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetProjectSettingsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.GetProjectSettingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.GetProjectSettingsWithParams(ctx, params).Execute() + return err +} + +func (opts *getProjectSettingsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getProjectSettingsBuilder() *cobra.Command { @@ -901,7 +968,10 @@ func getProjectSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -916,6 +986,7 @@ type listProjectInvitationsOpts struct { username string format string tmpl *template.Template + resp []admin.GroupInvitation } func (opts *listProjectInvitationsOpts) preRun() (err error) { @@ -935,41 +1006,44 @@ func (opts *listProjectInvitationsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listProjectInvitationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listProjectInvitationsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListProjectInvitationsApiParams{ GroupId: opts.groupId, Username: &opts.username, } - resp, _, err := opts.client.ProjectsApi.ListProjectInvitationsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.ListProjectInvitationsWithParams(ctx, params).Execute() + return err +} + +func (opts *listProjectInvitationsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listProjectInvitationsBuilder() *cobra.Command { @@ -981,7 +1055,10 @@ func listProjectInvitationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -996,6 +1073,7 @@ type listProjectLimitsOpts struct { groupId string format string tmpl *template.Template + resp []admin.DataFederationLimit } func (opts *listProjectLimitsOpts) preRun() (err error) { @@ -1015,40 +1093,43 @@ func (opts *listProjectLimitsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listProjectLimitsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listProjectLimitsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListProjectLimitsApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.ProjectsApi.ListProjectLimitsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.ListProjectLimitsWithParams(ctx, params).Execute() + return err +} + +func (opts *listProjectLimitsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listProjectLimitsBuilder() *cobra.Command { @@ -1060,7 +1141,10 @@ func listProjectLimitsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1079,6 +1163,7 @@ type listProjectUsersOpts struct { includeOrgUsers bool format string tmpl *template.Template + resp *admin.PaginatedAppUser } func (opts *listProjectUsersOpts) preRun() (err error) { @@ -1098,13 +1183,15 @@ func (opts *listProjectUsersOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listProjectUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listProjectUsersOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListProjectUsersApiParams{ GroupId: opts.groupId, @@ -1115,28 +1202,29 @@ func (opts *listProjectUsersOpts) run(ctx context.Context, _ io.Reader, w io.Wri IncludeOrgUsers: &opts.includeOrgUsers, } - resp, _, err := opts.client.ProjectsApi.ListProjectUsersWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.ListProjectUsersWithParams(ctx, params).Execute() + return err +} + +func (opts *listProjectUsersOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listProjectUsersBuilder() *cobra.Command { @@ -1148,7 +1236,10 @@ func listProjectUsersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1169,6 +1260,7 @@ type listProjectsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedAtlasGroup } func (opts *listProjectsOpts) preRun() (err error) { @@ -1177,13 +1269,15 @@ func (opts *listProjectsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listProjectsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListProjectsApiParams{ IncludeCount: &opts.includeCount, @@ -1191,28 +1285,29 @@ func (opts *listProjectsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) PageNum: &opts.pageNum, } - resp, _, err := opts.client.ProjectsApi.ListProjectsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.ListProjectsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listProjectsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listProjectsBuilder() *cobra.Command { @@ -1224,7 +1319,10 @@ func listProjectsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().BoolVar(&opts.includeCount, "includeCount", true, `Flag that indicates whether the response returns the total number of items (**totalCount**) in the response.`) @@ -1257,20 +1355,26 @@ func (opts *removeProjectUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *removeProjectUserOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *removeProjectUserOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.RemoveProjectUserApiParams{ GroupId: opts.groupId, UserId: opts.userId, } - _, err := opts.client.ProjectsApi.RemoveProjectUserWithParams(ctx, params).Execute() + var err error + _, err = opts.client.ProjectsApi.RemoveProjectUserWithParams(ctx, params).Execute() return err } +func (opts *removeProjectUserOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func removeProjectUserBuilder() *cobra.Command { opts := removeProjectUserOpts{} cmd := &cobra.Command{ @@ -1280,7 +1384,10 @@ func removeProjectUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1299,6 +1406,7 @@ type setProjectLimitOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.DataFederationLimit } func (opts *setProjectLimitOpts) preRun() (err error) { @@ -1318,10 +1426,12 @@ func (opts *setProjectLimitOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *setProjectLimitOpts) readData(r io.Reader) (*admin.DataFederationLimit, error) { @@ -1346,7 +1456,7 @@ func (opts *setProjectLimitOpts) readData(r io.Reader) (*admin.DataFederationLim return out, nil } -func (opts *setProjectLimitOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *setProjectLimitOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1359,28 +1469,29 @@ func (opts *setProjectLimitOpts) run(ctx context.Context, r io.Reader, w io.Writ DataFederationLimit: data, } - resp, _, err := opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.SetProjectLimitWithParams(ctx, params).Execute() + return err +} + +func (opts *setProjectLimitOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func setProjectLimitBuilder() *cobra.Command { @@ -1394,7 +1505,10 @@ func setProjectLimitBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.limitName, "limitName", "", `Human-readable label that identifies this project limit. @@ -1431,6 +1545,7 @@ type updateProjectOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.Group } func (opts *updateProjectOpts) preRun() (err error) { @@ -1450,10 +1565,12 @@ func (opts *updateProjectOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateProjectOpts) readData(r io.Reader) (*admin.GroupName, error) { @@ -1478,7 +1595,7 @@ func (opts *updateProjectOpts) readData(r io.Reader) (*admin.GroupName, error) { return out, nil } -func (opts *updateProjectOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateProjectOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1490,28 +1607,29 @@ func (opts *updateProjectOpts) run(ctx context.Context, r io.Reader, w io.Writer GroupName: data, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.UpdateProjectWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateProjectOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateProjectBuilder() *cobra.Command { @@ -1525,7 +1643,10 @@ func updateProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1544,6 +1665,7 @@ type updateProjectInvitationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GroupInvitation } func (opts *updateProjectInvitationOpts) preRun() (err error) { @@ -1563,10 +1685,12 @@ func (opts *updateProjectInvitationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateProjectInvitationOpts) readData(r io.Reader) (*admin.GroupInvitationRequest, error) { @@ -1591,7 +1715,7 @@ func (opts *updateProjectInvitationOpts) readData(r io.Reader) (*admin.GroupInvi return out, nil } -func (opts *updateProjectInvitationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateProjectInvitationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1603,28 +1727,29 @@ func (opts *updateProjectInvitationOpts) run(ctx context.Context, r io.Reader, w GroupInvitationRequest: data, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.UpdateProjectInvitationWithParams(ctx, params).Execute() + return err +} + +func (opts *updateProjectInvitationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateProjectInvitationBuilder() *cobra.Command { @@ -1638,7 +1763,10 @@ func updateProjectInvitationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1658,6 +1786,7 @@ type updateProjectInvitationByIdOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GroupInvitation } func (opts *updateProjectInvitationByIdOpts) preRun() (err error) { @@ -1677,10 +1806,12 @@ func (opts *updateProjectInvitationByIdOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateProjectInvitationByIdOpts) readData(r io.Reader) (*admin.GroupInvitationUpdateRequest, error) { @@ -1705,7 +1836,7 @@ func (opts *updateProjectInvitationByIdOpts) readData(r io.Reader) (*admin.Group return out, nil } -func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1718,28 +1849,29 @@ func (opts *updateProjectInvitationByIdOpts) run(ctx context.Context, r io.Reade GroupInvitationUpdateRequest: data, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.UpdateProjectInvitationByIdWithParams(ctx, params).Execute() + return err +} + +func (opts *updateProjectInvitationByIdOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateProjectInvitationByIdBuilder() *cobra.Command { @@ -1753,7 +1885,10 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1775,6 +1910,7 @@ type updateProjectRolesOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.UpdateGroupRolesForUser } func (opts *updateProjectRolesOpts) preRun() (err error) { @@ -1794,10 +1930,12 @@ func (opts *updateProjectRolesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateProjectRolesOpts) readData(r io.Reader) (*admin.UpdateGroupRolesForUser, error) { @@ -1822,7 +1960,7 @@ func (opts *updateProjectRolesOpts) readData(r io.Reader) (*admin.UpdateGroupRol return out, nil } -func (opts *updateProjectRolesOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateProjectRolesOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1835,28 +1973,29 @@ func (opts *updateProjectRolesOpts) run(ctx context.Context, r io.Reader, w io.W UpdateGroupRolesForUser: data, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectRolesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.UpdateProjectRolesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateProjectRolesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateProjectRolesBuilder() *cobra.Command { @@ -1870,7 +2009,10 @@ func updateProjectRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -1891,6 +2033,7 @@ type updateProjectSettingsOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.GroupSettings } func (opts *updateProjectSettingsOpts) preRun() (err error) { @@ -1910,10 +2053,12 @@ func (opts *updateProjectSettingsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateProjectSettingsOpts) readData(r io.Reader) (*admin.GroupSettings, error) { @@ -1938,7 +2083,7 @@ func (opts *updateProjectSettingsOpts) readData(r io.Reader) (*admin.GroupSettin return out, nil } -func (opts *updateProjectSettingsOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateProjectSettingsOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1950,28 +2095,29 @@ func (opts *updateProjectSettingsOpts) run(ctx context.Context, r io.Reader, w i GroupSettings: data, } - resp, _, err := opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ProjectsApi.UpdateProjectSettingsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateProjectSettingsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateProjectSettingsBuilder() *cobra.Command { @@ -1985,7 +2131,10 @@ func updateProjectSettingsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index b71cae367c..06634c2d57 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -56,7 +56,7 @@ func (opts *createPushBasedLogConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } func (opts *createPushBasedLogConfigurationOpts) readData(r io.Reader) (*admin.PushBasedLogExportProject, error) { @@ -81,7 +81,7 @@ func (opts *createPushBasedLogConfigurationOpts) readData(r io.Reader) (*admin.P return out, nil } -func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, r io.Reader, _ io.Writer) error { +func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -93,10 +93,16 @@ func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, r io.R PushBasedLogExportProject: data, } - _, err := opts.client.PushBasedLogExportApi.CreatePushBasedLogConfigurationWithParams(ctx, params).Execute() + var err error + _, err = opts.client.PushBasedLogExportApi.CreatePushBasedLogConfigurationWithParams(ctx, params).Execute() return err } +func (opts *createPushBasedLogConfigurationOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func createPushBasedLogConfigurationBuilder() *cobra.Command { opts := createPushBasedLogConfigurationOpts{ fs: afero.NewOsFs(), @@ -108,7 +114,10 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -139,19 +148,25 @@ func (opts *deletePushBasedLogConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *deletePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *deletePushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeletePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, } - _, err := opts.client.PushBasedLogExportApi.DeletePushBasedLogConfigurationWithParams(ctx, params).Execute() + var err error + _, err = opts.client.PushBasedLogExportApi.DeletePushBasedLogConfigurationWithParams(ctx, params).Execute() return err } +func (opts *deletePushBasedLogConfigurationOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func deletePushBasedLogConfigurationBuilder() *cobra.Command { opts := deletePushBasedLogConfigurationOpts{} cmd := &cobra.Command{ @@ -161,7 +176,10 @@ func deletePushBasedLogConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -174,6 +192,7 @@ type getPushBasedLogConfigurationOpts struct { groupId string format string tmpl *template.Template + resp *admin.PushBasedLogExportProject } func (opts *getPushBasedLogConfigurationOpts) preRun() (err error) { @@ -193,40 +212,43 @@ func (opts *getPushBasedLogConfigurationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getPushBasedLogConfigurationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetPushBasedLogConfigurationApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.PushBasedLogExportApi.GetPushBasedLogConfigurationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.PushBasedLogExportApi.GetPushBasedLogConfigurationWithParams(ctx, params).Execute() + return err +} + +func (opts *getPushBasedLogConfigurationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getPushBasedLogConfigurationBuilder() *cobra.Command { @@ -238,7 +260,10 @@ func getPushBasedLogConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -271,7 +296,7 @@ func (opts *updatePushBasedLogConfigurationOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } func (opts *updatePushBasedLogConfigurationOpts) readData(r io.Reader) (*admin.PushBasedLogExportProject, error) { @@ -296,7 +321,7 @@ func (opts *updatePushBasedLogConfigurationOpts) readData(r io.Reader) (*admin.P return out, nil } -func (opts *updatePushBasedLogConfigurationOpts) run(ctx context.Context, r io.Reader, _ io.Writer) error { +func (opts *updatePushBasedLogConfigurationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -308,10 +333,16 @@ func (opts *updatePushBasedLogConfigurationOpts) run(ctx context.Context, r io.R PushBasedLogExportProject: data, } - _, err := opts.client.PushBasedLogExportApi.UpdatePushBasedLogConfigurationWithParams(ctx, params).Execute() + var err error + _, err = opts.client.PushBasedLogExportApi.UpdatePushBasedLogConfigurationWithParams(ctx, params).Execute() return err } +func (opts *updatePushBasedLogConfigurationOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func updatePushBasedLogConfigurationBuilder() *cobra.Command { opts := updatePushBasedLogConfigurationOpts{ fs: afero.NewOsFs(), @@ -323,7 +354,10 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 34abe47e9b..e1c6625c7a 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -55,7 +55,7 @@ func (opts *createRollingIndexOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } func (opts *createRollingIndexOpts) readData(r io.Reader) (*admin.DatabaseRollingIndexRequest, error) { @@ -80,7 +80,7 @@ func (opts *createRollingIndexOpts) readData(r io.Reader) (*admin.DatabaseRollin return out, nil } -func (opts *createRollingIndexOpts) run(ctx context.Context, r io.Reader, _ io.Writer) error { +func (opts *createRollingIndexOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -93,10 +93,16 @@ func (opts *createRollingIndexOpts) run(ctx context.Context, r io.Reader, _ io.W DatabaseRollingIndexRequest: data, } - _, err := opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() + var err error + _, err = opts.client.RollingIndexApi.CreateRollingIndexWithParams(ctx, params).Execute() return err } +func (opts *createRollingIndexOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func createRollingIndexBuilder() *cobra.Command { opts := createRollingIndexOpts{ fs: afero.NewOsFs(), @@ -108,7 +114,10 @@ func createRollingIndexBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index f4cf07156e..215b7b6072 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -33,6 +33,7 @@ type getSystemStatusOpts struct { client *admin.APIClient format string tmpl *template.Template + resp *admin.SystemStatus } func (opts *getSystemStatusOpts) preRun() (err error) { @@ -41,38 +42,41 @@ func (opts *getSystemStatusOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getSystemStatusOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getSystemStatusOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetSystemStatusApiParams{} - resp, _, err := opts.client.RootApi.GetSystemStatusWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.RootApi.GetSystemStatusWithParams(ctx, params).Execute() + return err +} + +func (opts *getSystemStatusOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getSystemStatusBuilder() *cobra.Command { @@ -84,7 +88,10 @@ func getSystemStatusBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index 1ba5abca26..b368045e9f 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -40,6 +40,7 @@ type createServerlessInstanceOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ServerlessInstanceDescription } func (opts *createServerlessInstanceOpts) preRun() (err error) { @@ -59,10 +60,12 @@ func (opts *createServerlessInstanceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createServerlessInstanceOpts) readData(r io.Reader) (*admin.ServerlessInstanceDescriptionCreate, error) { @@ -87,7 +90,7 @@ func (opts *createServerlessInstanceOpts) readData(r io.Reader) (*admin.Serverle return out, nil } -func (opts *createServerlessInstanceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createServerlessInstanceOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +102,29 @@ func (opts *createServerlessInstanceOpts) run(ctx context.Context, r io.Reader, ServerlessInstanceDescriptionCreate: data, } - resp, _, err := opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessInstancesApi.CreateServerlessInstanceWithParams(ctx, params).Execute() + return err +} + +func (opts *createServerlessInstanceOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createServerlessInstanceBuilder() *cobra.Command { @@ -134,7 +138,10 @@ func createServerlessInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -151,6 +158,7 @@ type deleteServerlessInstanceOpts struct { name string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteServerlessInstanceOpts) preRun() (err error) { @@ -170,41 +178,44 @@ func (opts *deleteServerlessInstanceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteServerlessInstanceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessInstancesApi.DeleteServerlessInstanceWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteServerlessInstanceOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteServerlessInstanceBuilder() *cobra.Command { @@ -216,7 +227,10 @@ func deleteServerlessInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -233,6 +247,7 @@ type getServerlessInstanceOpts struct { name string format string tmpl *template.Template + resp *admin.ServerlessInstanceDescription } func (opts *getServerlessInstanceOpts) preRun() (err error) { @@ -252,41 +267,44 @@ func (opts *getServerlessInstanceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getServerlessInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getServerlessInstanceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetServerlessInstanceApiParams{ GroupId: opts.groupId, Name: opts.name, } - resp, _, err := opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessInstancesApi.GetServerlessInstanceWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getServerlessInstanceOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getServerlessInstanceBuilder() *cobra.Command { @@ -298,7 +316,10 @@ func getServerlessInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -317,6 +338,7 @@ type listServerlessInstancesOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedServerlessInstanceDescription } func (opts *listServerlessInstancesOpts) preRun() (err error) { @@ -336,13 +358,15 @@ func (opts *listServerlessInstancesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listServerlessInstancesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listServerlessInstancesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListServerlessInstancesApiParams{ GroupId: opts.groupId, @@ -351,28 +375,29 @@ func (opts *listServerlessInstancesOpts) run(ctx context.Context, _ io.Reader, w PageNum: &opts.pageNum, } - resp, _, err := opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessInstancesApi.ListServerlessInstancesWithParams(ctx, params).Execute() + return err +} + +func (opts *listServerlessInstancesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listServerlessInstancesBuilder() *cobra.Command { @@ -384,7 +409,10 @@ func listServerlessInstancesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -405,6 +433,7 @@ type updateServerlessInstanceOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ServerlessInstanceDescription } func (opts *updateServerlessInstanceOpts) preRun() (err error) { @@ -424,10 +453,12 @@ func (opts *updateServerlessInstanceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateServerlessInstanceOpts) readData(r io.Reader) (*admin.ServerlessInstanceDescriptionUpdate, error) { @@ -452,7 +483,7 @@ func (opts *updateServerlessInstanceOpts) readData(r io.Reader) (*admin.Serverle return out, nil } -func (opts *updateServerlessInstanceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateServerlessInstanceOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -465,28 +496,29 @@ func (opts *updateServerlessInstanceOpts) run(ctx context.Context, r io.Reader, ServerlessInstanceDescriptionUpdate: data, } - resp, _, err := opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessInstancesApi.UpdateServerlessInstanceWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateServerlessInstanceOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateServerlessInstanceBuilder() *cobra.Command { @@ -500,7 +532,10 @@ func updateServerlessInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index 81b5b5273c..889210bfce 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -41,6 +41,7 @@ type createServerlessPrivateEndpointOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ServerlessTenantEndpoint } func (opts *createServerlessPrivateEndpointOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createServerlessPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createServerlessPrivateEndpointOpts) readData(r io.Reader) (*admin.ServerlessTenantCreateRequest, error) { @@ -88,7 +91,7 @@ func (opts *createServerlessPrivateEndpointOpts) readData(r io.Reader) (*admin.S return out, nil } -func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *createServerlessPrivateEndpointOpts) run(ctx context.Context, r io.R ServerlessTenantCreateRequest: data, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessPrivateEndpointsApi.CreateServerlessPrivateEndpointWithParams(ctx, params).Execute() + return err +} + +func (opts *createServerlessPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createServerlessPrivateEndpointBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -156,6 +163,7 @@ type deleteServerlessPrivateEndpointOpts struct { endpointId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteServerlessPrivateEndpointOpts) preRun() (err error) { @@ -175,13 +183,15 @@ func (opts *deleteServerlessPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -189,28 +199,29 @@ func (opts *deleteServerlessPrivateEndpointOpts) run(ctx context.Context, _ io.R EndpointId: opts.endpointId, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessPrivateEndpointsApi.DeleteServerlessPrivateEndpointWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteServerlessPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteServerlessPrivateEndpointBuilder() *cobra.Command { @@ -222,7 +233,10 @@ func deleteServerlessPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -242,6 +256,7 @@ type getServerlessPrivateEndpointOpts struct { endpointId string format string tmpl *template.Template + resp *admin.ServerlessTenantEndpoint } func (opts *getServerlessPrivateEndpointOpts) preRun() (err error) { @@ -261,13 +276,15 @@ func (opts *getServerlessPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetServerlessPrivateEndpointApiParams{ GroupId: opts.groupId, @@ -275,28 +292,29 @@ func (opts *getServerlessPrivateEndpointOpts) run(ctx context.Context, _ io.Read EndpointId: opts.endpointId, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessPrivateEndpointsApi.GetServerlessPrivateEndpointWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getServerlessPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getServerlessPrivateEndpointBuilder() *cobra.Command { @@ -308,7 +326,10 @@ func getServerlessPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -327,6 +348,7 @@ type listServerlessPrivateEndpointsOpts struct { instanceName string format string tmpl *template.Template + resp []admin.ServerlessTenantEndpoint } func (opts *listServerlessPrivateEndpointsOpts) preRun() (err error) { @@ -346,41 +368,44 @@ func (opts *listServerlessPrivateEndpointsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listServerlessPrivateEndpointsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListServerlessPrivateEndpointsApiParams{ GroupId: opts.groupId, InstanceName: opts.instanceName, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessPrivateEndpointsApi.ListServerlessPrivateEndpointsWithParams(ctx, params).Execute() + return err +} + +func (opts *listServerlessPrivateEndpointsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listServerlessPrivateEndpointsBuilder() *cobra.Command { @@ -392,7 +417,10 @@ func listServerlessPrivateEndpointsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -413,6 +441,7 @@ type updateServerlessPrivateEndpointOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.ServerlessTenantEndpoint } func (opts *updateServerlessPrivateEndpointOpts) preRun() (err error) { @@ -432,10 +461,12 @@ func (opts *updateServerlessPrivateEndpointOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateServerlessPrivateEndpointOpts) readData(r io.Reader) (*admin.ServerlessTenantEndpointUpdate, error) { @@ -460,7 +491,7 @@ func (opts *updateServerlessPrivateEndpointOpts) readData(r io.Reader) (*admin.S return out, nil } -func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -474,28 +505,29 @@ func (opts *updateServerlessPrivateEndpointOpts) run(ctx context.Context, r io.R ServerlessTenantEndpointUpdate: data, } - resp, _, err := opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ServerlessPrivateEndpointsApi.UpdateServerlessPrivateEndpointWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateServerlessPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateServerlessPrivateEndpointBuilder() *cobra.Command { @@ -509,7 +541,10 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index 4b269113f4..d1c4edf810 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -41,6 +41,7 @@ type createSharedClusterBackupRestoreJobOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.TenantRestore } func (opts *createSharedClusterBackupRestoreJobOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createSharedClusterBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createSharedClusterBackupRestoreJobOpts) readData(r io.Reader) (*admin.TenantRestore, error) { @@ -88,7 +91,7 @@ func (opts *createSharedClusterBackupRestoreJobOpts) readData(r io.Reader) (*adm return out, nil } -func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *createSharedClusterBackupRestoreJobOpts) run(ctx context.Context, r TenantRestore: data, } - resp, _, err := opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.SharedTierRestoreJobsApi.CreateSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() + return err +} + +func (opts *createSharedClusterBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -156,6 +163,7 @@ type getSharedClusterBackupRestoreJobOpts struct { restoreId string format string tmpl *template.Template + resp *admin.TenantRestore } func (opts *getSharedClusterBackupRestoreJobOpts) preRun() (err error) { @@ -175,13 +183,15 @@ func (opts *getSharedClusterBackupRestoreJobOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetSharedClusterBackupRestoreJobApiParams{ ClusterName: opts.clusterName, @@ -189,28 +199,29 @@ func (opts *getSharedClusterBackupRestoreJobOpts) run(ctx context.Context, _ io. RestoreId: opts.restoreId, } - resp, _, err := opts.client.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.SharedTierRestoreJobsApi.GetSharedClusterBackupRestoreJobWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getSharedClusterBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { @@ -222,7 +233,10 @@ func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -241,6 +255,7 @@ type listSharedClusterBackupRestoreJobsOpts struct { groupId string format string tmpl *template.Template + resp *admin.PaginatedTenantRestore } func (opts *listSharedClusterBackupRestoreJobsOpts) preRun() (err error) { @@ -260,41 +275,44 @@ func (opts *listSharedClusterBackupRestoreJobsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listSharedClusterBackupRestoreJobsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListSharedClusterBackupRestoreJobsApiParams{ ClusterName: opts.clusterName, GroupId: opts.groupId, } - resp, _, err := opts.client.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.SharedTierRestoreJobsApi.ListSharedClusterBackupRestoreJobsWithParams(ctx, params).Execute() + return err +} + +func (opts *listSharedClusterBackupRestoreJobsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { @@ -306,7 +324,10 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index f389089467..8ef3a96a85 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -41,6 +41,7 @@ type downloadSharedClusterBackupOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.TenantRestore } func (opts *downloadSharedClusterBackupOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *downloadSharedClusterBackupOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *downloadSharedClusterBackupOpts) readData(r io.Reader) (*admin.TenantRestore, error) { @@ -88,7 +91,7 @@ func (opts *downloadSharedClusterBackupOpts) readData(r io.Reader) (*admin.Tenan return out, nil } -func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *downloadSharedClusterBackupOpts) run(ctx context.Context, r io.Reade TenantRestore: data, } - resp, _, err := opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.SharedTierSnapshotsApi.DownloadSharedClusterBackupWithParams(ctx, params).Execute() + return err +} + +func (opts *downloadSharedClusterBackupOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func downloadSharedClusterBackupBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) @@ -156,6 +163,7 @@ type getSharedClusterBackupOpts struct { snapshotId string format string tmpl *template.Template + resp *admin.BackupTenantSnapshot } func (opts *getSharedClusterBackupOpts) preRun() (err error) { @@ -175,13 +183,15 @@ func (opts *getSharedClusterBackupOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getSharedClusterBackupOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getSharedClusterBackupOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetSharedClusterBackupApiParams{ GroupId: opts.groupId, @@ -189,28 +199,29 @@ func (opts *getSharedClusterBackupOpts) run(ctx context.Context, _ io.Reader, w SnapshotId: opts.snapshotId, } - resp, _, err := opts.client.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.SharedTierSnapshotsApi.GetSharedClusterBackupWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getSharedClusterBackupOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getSharedClusterBackupBuilder() *cobra.Command { @@ -222,7 +233,10 @@ func getSharedClusterBackupBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -241,6 +255,7 @@ type listSharedClusterBackupsOpts struct { clusterName string format string tmpl *template.Template + resp *admin.PaginatedTenantSnapshot } func (opts *listSharedClusterBackupsOpts) preRun() (err error) { @@ -260,41 +275,44 @@ func (opts *listSharedClusterBackupsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listSharedClusterBackupsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListSharedClusterBackupsApiParams{ GroupId: opts.groupId, ClusterName: opts.clusterName, } - resp, _, err := opts.client.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.SharedTierSnapshotsApi.ListSharedClusterBackupsWithParams(ctx, params).Execute() + return err +} + +func (opts *listSharedClusterBackupsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listSharedClusterBackupsBuilder() *cobra.Command { @@ -306,7 +324,10 @@ func listSharedClusterBackupsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index ac061312da..898649e853 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -41,6 +41,7 @@ type createStreamConnectionOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.StreamsConnection } func (opts *createStreamConnectionOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createStreamConnectionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createStreamConnectionOpts) readData(r io.Reader) (*admin.StreamsConnection, error) { @@ -88,7 +91,7 @@ func (opts *createStreamConnectionOpts) readData(r io.Reader) (*admin.StreamsCon return out, nil } -func (opts *createStreamConnectionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createStreamConnectionOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *createStreamConnectionOpts) run(ctx context.Context, r io.Reader, w StreamsConnection: data, } - resp, _, err := opts.client.StreamsApi.CreateStreamConnectionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.CreateStreamConnectionWithParams(ctx, params).Execute() + return err +} + +func (opts *createStreamConnectionOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createStreamConnectionBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func createStreamConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -157,6 +164,7 @@ type createStreamInstanceOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.StreamsTenant } func (opts *createStreamInstanceOpts) preRun() (err error) { @@ -176,10 +184,12 @@ func (opts *createStreamInstanceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createStreamInstanceOpts) readData(r io.Reader) (*admin.StreamsTenant, error) { @@ -204,7 +214,7 @@ func (opts *createStreamInstanceOpts) readData(r io.Reader) (*admin.StreamsTenan return out, nil } -func (opts *createStreamInstanceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createStreamInstanceOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -216,28 +226,29 @@ func (opts *createStreamInstanceOpts) run(ctx context.Context, r io.Reader, w io StreamsTenant: data, } - resp, _, err := opts.client.StreamsApi.CreateStreamInstanceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.CreateStreamInstanceWithParams(ctx, params).Execute() + return err +} + +func (opts *createStreamInstanceOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createStreamInstanceBuilder() *cobra.Command { @@ -251,7 +262,10 @@ func createStreamInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -269,6 +283,7 @@ type deleteStreamConnectionOpts struct { connectionName string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteStreamConnectionOpts) preRun() (err error) { @@ -288,13 +303,15 @@ func (opts *deleteStreamConnectionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteStreamConnectionOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteStreamConnectionOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteStreamConnectionApiParams{ GroupId: opts.groupId, @@ -302,28 +319,29 @@ func (opts *deleteStreamConnectionOpts) run(ctx context.Context, _ io.Reader, w ConnectionName: opts.connectionName, } - resp, _, err := opts.client.StreamsApi.DeleteStreamConnectionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.DeleteStreamConnectionWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteStreamConnectionOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteStreamConnectionBuilder() *cobra.Command { @@ -335,7 +353,10 @@ func deleteStreamConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -354,6 +375,7 @@ type deleteStreamInstanceOpts struct { tenantName string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteStreamInstanceOpts) preRun() (err error) { @@ -373,41 +395,44 @@ func (opts *deleteStreamInstanceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteStreamInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteStreamInstanceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteStreamInstanceApiParams{ GroupId: opts.groupId, TenantName: opts.tenantName, } - resp, _, err := opts.client.StreamsApi.DeleteStreamInstanceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.DeleteStreamInstanceWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteStreamInstanceOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteStreamInstanceBuilder() *cobra.Command { @@ -419,7 +444,10 @@ func deleteStreamInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -437,6 +465,7 @@ type getStreamConnectionOpts struct { connectionName string format string tmpl *template.Template + resp *admin.StreamsConnection } func (opts *getStreamConnectionOpts) preRun() (err error) { @@ -456,13 +485,15 @@ func (opts *getStreamConnectionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getStreamConnectionOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getStreamConnectionOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetStreamConnectionApiParams{ GroupId: opts.groupId, @@ -470,28 +501,29 @@ func (opts *getStreamConnectionOpts) run(ctx context.Context, _ io.Reader, w io. ConnectionName: opts.connectionName, } - resp, _, err := opts.client.StreamsApi.GetStreamConnectionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.GetStreamConnectionWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getStreamConnectionOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getStreamConnectionBuilder() *cobra.Command { @@ -503,7 +535,10 @@ func getStreamConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -523,6 +558,7 @@ type getStreamInstanceOpts struct { includeConnections bool format string tmpl *template.Template + resp *admin.StreamsTenant } func (opts *getStreamInstanceOpts) preRun() (err error) { @@ -542,13 +578,15 @@ func (opts *getStreamInstanceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getStreamInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getStreamInstanceOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetStreamInstanceApiParams{ GroupId: opts.groupId, @@ -556,28 +594,29 @@ func (opts *getStreamInstanceOpts) run(ctx context.Context, _ io.Reader, w io.Wr IncludeConnections: &opts.includeConnections, } - resp, _, err := opts.client.StreamsApi.GetStreamInstanceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.GetStreamInstanceWithParams(ctx, params).Execute() + return err +} + +func (opts *getStreamInstanceOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getStreamInstanceBuilder() *cobra.Command { @@ -589,7 +628,10 @@ func getStreamInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -609,6 +651,7 @@ type listStreamConnectionsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiStreamsConnection } func (opts *listStreamConnectionsOpts) preRun() (err error) { @@ -628,13 +671,15 @@ func (opts *listStreamConnectionsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listStreamConnectionsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listStreamConnectionsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListStreamConnectionsApiParams{ GroupId: opts.groupId, @@ -643,28 +688,29 @@ func (opts *listStreamConnectionsOpts) run(ctx context.Context, _ io.Reader, w i PageNum: &opts.pageNum, } - resp, _, err := opts.client.StreamsApi.ListStreamConnectionsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.ListStreamConnectionsWithParams(ctx, params).Execute() + return err +} + +func (opts *listStreamConnectionsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listStreamConnectionsBuilder() *cobra.Command { @@ -676,7 +722,10 @@ func listStreamConnectionsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -696,6 +745,7 @@ type listStreamInstancesOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiStreamsTenant } func (opts *listStreamInstancesOpts) preRun() (err error) { @@ -715,13 +765,15 @@ func (opts *listStreamInstancesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listStreamInstancesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listStreamInstancesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListStreamInstancesApiParams{ GroupId: opts.groupId, @@ -729,28 +781,29 @@ func (opts *listStreamInstancesOpts) run(ctx context.Context, _ io.Reader, w io. PageNum: &opts.pageNum, } - resp, _, err := opts.client.StreamsApi.ListStreamInstancesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.ListStreamInstancesWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listStreamInstancesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listStreamInstancesBuilder() *cobra.Command { @@ -762,7 +815,10 @@ func listStreamInstancesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -783,6 +839,7 @@ type updateStreamConnectionOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.StreamsConnection } func (opts *updateStreamConnectionOpts) preRun() (err error) { @@ -802,10 +859,12 @@ func (opts *updateStreamConnectionOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateStreamConnectionOpts) readData(r io.Reader) (*admin.StreamsConnection, error) { @@ -830,7 +889,7 @@ func (opts *updateStreamConnectionOpts) readData(r io.Reader) (*admin.StreamsCon return out, nil } -func (opts *updateStreamConnectionOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateStreamConnectionOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -844,28 +903,29 @@ func (opts *updateStreamConnectionOpts) run(ctx context.Context, r io.Reader, w StreamsConnection: data, } - resp, _, err := opts.client.StreamsApi.UpdateStreamConnectionWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.UpdateStreamConnectionWithParams(ctx, params).Execute() + return err +} + +func (opts *updateStreamConnectionOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateStreamConnectionBuilder() *cobra.Command { @@ -879,7 +939,10 @@ func updateStreamConnectionBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -903,6 +966,7 @@ type updateStreamInstanceOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.StreamsTenant } func (opts *updateStreamInstanceOpts) preRun() (err error) { @@ -922,10 +986,12 @@ func (opts *updateStreamInstanceOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateStreamInstanceOpts) readData(r io.Reader) (*admin.StreamsDataProcessRegion, error) { @@ -950,7 +1016,7 @@ func (opts *updateStreamInstanceOpts) readData(r io.Reader) (*admin.StreamsDataP return out, nil } -func (opts *updateStreamInstanceOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateStreamInstanceOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -963,28 +1029,29 @@ func (opts *updateStreamInstanceOpts) run(ctx context.Context, r io.Reader, w io StreamsDataProcessRegion: data, } - resp, _, err := opts.client.StreamsApi.UpdateStreamInstanceWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.StreamsApi.UpdateStreamInstanceWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateStreamInstanceOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateStreamInstanceBuilder() *cobra.Command { @@ -998,7 +1065,10 @@ func updateStreamInstanceBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index 79917d63da..715716015f 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -40,6 +40,7 @@ type addAllTeamsToProjectOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedTeamRole } func (opts *addAllTeamsToProjectOpts) preRun() (err error) { @@ -59,10 +60,12 @@ func (opts *addAllTeamsToProjectOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *addAllTeamsToProjectOpts) readData(r io.Reader) (*[]admin.TeamRole, error) { @@ -87,7 +90,7 @@ func (opts *addAllTeamsToProjectOpts) readData(r io.Reader) (*[]admin.TeamRole, return out, nil } -func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -99,28 +102,29 @@ func (opts *addAllTeamsToProjectOpts) run(ctx context.Context, r io.Reader, w io TeamRole: data, } - resp, _, err := opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.AddAllTeamsToProjectWithParams(ctx, params).Execute() + return err +} + +func (opts *addAllTeamsToProjectOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func addAllTeamsToProjectBuilder() *cobra.Command { @@ -134,7 +138,10 @@ func addAllTeamsToProjectBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -154,6 +161,7 @@ type addTeamUserOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedApiAppUser } func (opts *addTeamUserOpts) preRun() (err error) { @@ -173,10 +181,12 @@ func (opts *addTeamUserOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *addTeamUserOpts) readData(r io.Reader) (*[]admin.AddUserToTeam, error) { @@ -201,7 +211,7 @@ func (opts *addTeamUserOpts) readData(r io.Reader) (*[]admin.AddUserToTeam, erro return out, nil } -func (opts *addTeamUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *addTeamUserOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -214,28 +224,29 @@ func (opts *addTeamUserOpts) run(ctx context.Context, r io.Reader, w io.Writer) AddUserToTeam: data, } - resp, _, err := opts.client.TeamsApi.AddTeamUserWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.AddTeamUserWithParams(ctx, params).Execute() + return err +} + +func (opts *addTeamUserOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func addTeamUserBuilder() *cobra.Command { @@ -249,7 +260,10 @@ func addTeamUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -270,6 +284,7 @@ type createTeamOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.Team } func (opts *createTeamOpts) preRun() (err error) { @@ -289,10 +304,12 @@ func (opts *createTeamOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createTeamOpts) readData(r io.Reader) (*admin.Team, error) { @@ -317,7 +334,7 @@ func (opts *createTeamOpts) readData(r io.Reader) (*admin.Team, error) { return out, nil } -func (opts *createTeamOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createTeamOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -329,28 +346,29 @@ func (opts *createTeamOpts) run(ctx context.Context, r io.Reader, w io.Writer) e Team: data, } - resp, _, err := opts.client.TeamsApi.CreateTeamWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.CreateTeamWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *createTeamOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createTeamBuilder() *cobra.Command { @@ -364,7 +382,10 @@ func createTeamBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -381,6 +402,7 @@ type deleteTeamOpts struct { teamId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteTeamOpts) preRun() (err error) { @@ -400,41 +422,44 @@ func (opts *deleteTeamOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteTeamOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteTeamOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteTeamApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.DeleteTeamWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.DeleteTeamWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *deleteTeamOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteTeamBuilder() *cobra.Command { @@ -446,7 +471,10 @@ func deleteTeamBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -463,6 +491,7 @@ type getTeamByIdOpts struct { teamId string format string tmpl *template.Template + resp *admin.TeamResponse } func (opts *getTeamByIdOpts) preRun() (err error) { @@ -482,41 +511,44 @@ func (opts *getTeamByIdOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getTeamByIdOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getTeamByIdOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetTeamByIdApiParams{ OrgId: opts.orgId, TeamId: opts.teamId, } - resp, _, err := opts.client.TeamsApi.GetTeamByIdWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.GetTeamByIdWithParams(ctx, params).Execute() + return err +} + +func (opts *getTeamByIdOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getTeamByIdBuilder() *cobra.Command { @@ -528,7 +560,10 @@ func getTeamByIdBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -545,6 +580,7 @@ type getTeamByNameOpts struct { teamName string format string tmpl *template.Template + resp *admin.TeamResponse } func (opts *getTeamByNameOpts) preRun() (err error) { @@ -564,41 +600,44 @@ func (opts *getTeamByNameOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getTeamByNameOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getTeamByNameOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetTeamByNameApiParams{ OrgId: opts.orgId, TeamName: opts.teamName, } - resp, _, err := opts.client.TeamsApi.GetTeamByNameWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.GetTeamByNameWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getTeamByNameOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getTeamByNameBuilder() *cobra.Command { @@ -610,7 +649,10 @@ func getTeamByNameBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -629,6 +671,7 @@ type listOrganizationTeamsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedTeam } func (opts *listOrganizationTeamsOpts) preRun() (err error) { @@ -648,13 +691,15 @@ func (opts *listOrganizationTeamsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listOrganizationTeamsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listOrganizationTeamsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListOrganizationTeamsApiParams{ OrgId: opts.orgId, @@ -663,28 +708,29 @@ func (opts *listOrganizationTeamsOpts) run(ctx context.Context, _ io.Reader, w i PageNum: &opts.pageNum, } - resp, _, err := opts.client.TeamsApi.ListOrganizationTeamsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.ListOrganizationTeamsWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listOrganizationTeamsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listOrganizationTeamsBuilder() *cobra.Command { @@ -696,7 +742,10 @@ func listOrganizationTeamsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -716,6 +765,7 @@ type listProjectTeamsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedTeamRole } func (opts *listProjectTeamsOpts) preRun() (err error) { @@ -735,13 +785,15 @@ func (opts *listProjectTeamsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listProjectTeamsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listProjectTeamsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListProjectTeamsApiParams{ GroupId: opts.groupId, @@ -750,28 +802,29 @@ func (opts *listProjectTeamsOpts) run(ctx context.Context, _ io.Reader, w io.Wri PageNum: &opts.pageNum, } - resp, _, err := opts.client.TeamsApi.ListProjectTeamsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.ListProjectTeamsWithParams(ctx, params).Execute() + return err +} + +func (opts *listProjectTeamsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listProjectTeamsBuilder() *cobra.Command { @@ -783,7 +836,10 @@ func listProjectTeamsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -803,6 +859,7 @@ type listTeamUsersOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedApiAppUser } func (opts *listTeamUsersOpts) preRun() (err error) { @@ -822,13 +879,15 @@ func (opts *listTeamUsersOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listTeamUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listTeamUsersOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListTeamUsersApiParams{ OrgId: opts.orgId, @@ -837,28 +896,29 @@ func (opts *listTeamUsersOpts) run(ctx context.Context, _ io.Reader, w io.Writer PageNum: &opts.pageNum, } - resp, _, err := opts.client.TeamsApi.ListTeamUsersWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.ListTeamUsersWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *listTeamUsersOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listTeamUsersBuilder() *cobra.Command { @@ -870,7 +930,10 @@ func listTeamUsersBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -905,20 +968,26 @@ func (opts *removeProjectTeamOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) } - return err + return nil } -func (opts *removeProjectTeamOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *removeProjectTeamOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.RemoveProjectTeamApiParams{ GroupId: opts.groupId, TeamId: opts.teamId, } - _, err := opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params).Execute() + var err error + _, err = opts.client.TeamsApi.RemoveProjectTeamWithParams(ctx, params).Execute() return err } +func (opts *removeProjectTeamOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func removeProjectTeamBuilder() *cobra.Command { opts := removeProjectTeamOpts{} cmd := &cobra.Command{ @@ -928,7 +997,10 @@ func removeProjectTeamBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -961,10 +1033,10 @@ func (opts *removeTeamUserOpts) preRun() (err error) { return fmt.Errorf("the provided value '%s' is not a valid ID", opts.orgId) } - return err + return nil } -func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Reader, _ io.Writer) error { +func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.RemoveTeamUserApiParams{ OrgId: opts.orgId, @@ -972,10 +1044,16 @@ func (opts *removeTeamUserOpts) run(ctx context.Context, _ io.Reader, _ io.Write UserId: opts.userId, } - _, err := opts.client.TeamsApi.RemoveTeamUserWithParams(ctx, params).Execute() + var err error + _, err = opts.client.TeamsApi.RemoveTeamUserWithParams(ctx, params).Execute() return err } +func (opts *removeTeamUserOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + func removeTeamUserBuilder() *cobra.Command { opts := removeTeamUserOpts{} cmd := &cobra.Command{ @@ -985,7 +1063,10 @@ func removeTeamUserBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1006,6 +1087,7 @@ type renameTeamOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.TeamResponse } func (opts *renameTeamOpts) preRun() (err error) { @@ -1025,10 +1107,12 @@ func (opts *renameTeamOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *renameTeamOpts) readData(r io.Reader) (*admin.Team, error) { @@ -1053,7 +1137,7 @@ func (opts *renameTeamOpts) readData(r io.Reader) (*admin.Team, error) { return out, nil } -func (opts *renameTeamOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *renameTeamOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1066,28 +1150,29 @@ func (opts *renameTeamOpts) run(ctx context.Context, r io.Reader, w io.Writer) e Team: data, } - resp, _, err := opts.client.TeamsApi.RenameTeamWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.RenameTeamWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *renameTeamOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func renameTeamBuilder() *cobra.Command { @@ -1101,7 +1186,10 @@ func renameTeamBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.orgId, "orgId", "", `Unique 24-hexadecimal digit string that identifies the organization`) @@ -1123,6 +1211,7 @@ type updateTeamRolesOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedTeamRole } func (opts *updateTeamRolesOpts) preRun() (err error) { @@ -1142,10 +1231,12 @@ func (opts *updateTeamRolesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateTeamRolesOpts) readData(r io.Reader) (*admin.TeamRole, error) { @@ -1170,7 +1261,7 @@ func (opts *updateTeamRolesOpts) readData(r io.Reader) (*admin.TeamRole, error) return out, nil } -func (opts *updateTeamRolesOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateTeamRolesOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -1183,28 +1274,29 @@ func (opts *updateTeamRolesOpts) run(ctx context.Context, r io.Reader, w io.Writ TeamRole: data, } - resp, _, err := opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.TeamsApi.UpdateTeamRolesWithParams(ctx, params).Execute() + return err +} + +func (opts *updateTeamRolesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateTeamRolesBuilder() *cobra.Command { @@ -1218,7 +1310,10 @@ func updateTeamRolesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 33b5a4de24..1bb25b973c 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -44,6 +44,7 @@ type createThirdPartyIntegrationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedIntegration } func (opts *createThirdPartyIntegrationOpts) preRun() (err error) { @@ -63,10 +64,12 @@ func (opts *createThirdPartyIntegrationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.ThridPartyIntegration, error) { @@ -91,7 +94,7 @@ func (opts *createThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.Thrid return out, nil } -func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -108,28 +111,29 @@ func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reade ThridPartyIntegration: data, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ThirdPartyIntegrationsApi.CreateThirdPartyIntegrationWithParams(ctx, params).Execute() + return err +} + +func (opts *createThirdPartyIntegrationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createThirdPartyIntegrationBuilder() *cobra.Command { @@ -143,7 +147,10 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -165,6 +172,7 @@ type deleteThirdPartyIntegrationOpts struct { groupId string format string tmpl *template.Template + resp map[string]interface{} } func (opts *deleteThirdPartyIntegrationOpts) preRun() (err error) { @@ -184,41 +192,44 @@ func (opts *deleteThirdPartyIntegrationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *deleteThirdPartyIntegrationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.DeleteThirdPartyIntegrationApiParams{ IntegrationType: opts.integrationType, GroupId: opts.groupId, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ThirdPartyIntegrationsApi.DeleteThirdPartyIntegrationWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteThirdPartyIntegrationOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func deleteThirdPartyIntegrationBuilder() *cobra.Command { @@ -230,7 +241,10 @@ func deleteThirdPartyIntegrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) @@ -247,6 +261,7 @@ type getThirdPartyIntegrationOpts struct { integrationType string format string tmpl *template.Template + resp *admin.ThridPartyIntegration } func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { @@ -266,41 +281,44 @@ func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *getThirdPartyIntegrationOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.GetThirdPartyIntegrationApiParams{ GroupId: opts.groupId, IntegrationType: opts.integrationType, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ThirdPartyIntegrationsApi.GetThirdPartyIntegrationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *getThirdPartyIntegrationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func getThirdPartyIntegrationBuilder() *cobra.Command { @@ -312,7 +330,10 @@ func getThirdPartyIntegrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -331,6 +352,7 @@ type listThirdPartyIntegrationsOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedIntegration } func (opts *listThirdPartyIntegrationsOpts) preRun() (err error) { @@ -350,13 +372,15 @@ func (opts *listThirdPartyIntegrationsOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListThirdPartyIntegrationsApiParams{ GroupId: opts.groupId, @@ -365,28 +389,29 @@ func (opts *listThirdPartyIntegrationsOpts) run(ctx context.Context, _ io.Reader PageNum: &opts.pageNum, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ThirdPartyIntegrationsApi.ListThirdPartyIntegrationsWithParams(ctx, params).Execute() + return err +} + +func (opts *listThirdPartyIntegrationsOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listThirdPartyIntegrationsBuilder() *cobra.Command { @@ -398,7 +423,10 @@ func listThirdPartyIntegrationsBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -422,6 +450,7 @@ type updateThirdPartyIntegrationOpts struct { fs afero.Fs format string tmpl *template.Template + resp *admin.PaginatedIntegration } func (opts *updateThirdPartyIntegrationOpts) preRun() (err error) { @@ -441,10 +470,12 @@ func (opts *updateThirdPartyIntegrationOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *updateThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.ThridPartyIntegration, error) { @@ -469,7 +500,7 @@ func (opts *updateThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.Thrid return out, nil } -func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -486,28 +517,29 @@ func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reade ThridPartyIntegration: data, } - resp, _, err := opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.ThirdPartyIntegrationsApi.UpdateThirdPartyIntegrationWithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *updateThirdPartyIntegrationOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func updateThirdPartyIntegrationBuilder() *cobra.Command { @@ -521,7 +553,10 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.integrationType, "integrationType", "", `Human-readable label that identifies the service which you want to integrate with MongoDB Cloud.`) diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index ed3b2b3620..f042875bdb 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -41,6 +41,7 @@ type createDatabaseUserCertificateOpts struct { fs afero.Fs format string tmpl *template.Template + resp string } func (opts *createDatabaseUserCertificateOpts) preRun() (err error) { @@ -60,10 +61,12 @@ func (opts *createDatabaseUserCertificateOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } func (opts *createDatabaseUserCertificateOpts) readData(r io.Reader) (*admin.UserCert, error) { @@ -88,7 +91,7 @@ func (opts *createDatabaseUserCertificateOpts) readData(r io.Reader) (*admin.Use return out, nil } -func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, r io.Reader, w io.Writer) error { +func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, r io.Reader) error { data, errData := opts.readData(r) if errData != nil { return errData @@ -101,28 +104,29 @@ func (opts *createDatabaseUserCertificateOpts) run(ctx context.Context, r io.Rea UserCert: data, } - resp, _, err := opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.X509AuthenticationApi.CreateDatabaseUserCertificateWithParams(ctx, params).Execute() + return err +} + +func (opts *createDatabaseUserCertificateOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func createDatabaseUserCertificateBuilder() *cobra.Command { @@ -136,7 +140,10 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -154,6 +161,7 @@ type disableCustomerManagedX509Opts struct { groupId string format string tmpl *template.Template + resp *admin.UserSecurity } func (opts *disableCustomerManagedX509Opts) preRun() (err error) { @@ -173,40 +181,43 @@ func (opts *disableCustomerManagedX509Opts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *disableCustomerManagedX509Opts) run(ctx context.Context, _ io.Reader) error { params := &admin.DisableCustomerManagedX509ApiParams{ GroupId: opts.groupId, } - resp, _, err := opts.client.X509AuthenticationApi.DisableCustomerManagedX509WithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.X509AuthenticationApi.DisableCustomerManagedX509WithParams(ctx, params).Execute() + return err +} - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") +func (opts *disableCustomerManagedX509Opts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func disableCustomerManagedX509Builder() *cobra.Command { @@ -218,7 +229,10 @@ func disableCustomerManagedX509Builder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) @@ -236,6 +250,7 @@ type listDatabaseUserCertificatesOpts struct { pageNum int format string tmpl *template.Template + resp *admin.PaginatedUserCert } func (opts *listDatabaseUserCertificatesOpts) preRun() (err error) { @@ -255,13 +270,15 @@ func (opts *listDatabaseUserCertificatesOpts) preRun() (err error) { } if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } - return err + return nil } -func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, _ io.Reader, w io.Writer) error { +func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, _ io.Reader) error { params := &admin.ListDatabaseUserCertificatesApiParams{ GroupId: opts.groupId, @@ -271,28 +288,29 @@ func (opts *listDatabaseUserCertificatesOpts) run(ctx context.Context, _ io.Read PageNum: &opts.pageNum, } - resp, _, err := opts.client.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(ctx, params).Execute() - if err != nil { - return err - } + var err error + opts.resp, _, err = opts.client.X509AuthenticationApi.ListDatabaseUserCertificatesWithParams(ctx, params).Execute() + return err +} + +func (opts *listDatabaseUserCertificatesOpts) postRun(_ context.Context, w io.Writer) error { - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) - return err + return opts.tmpl.Execute(w, parsedJSON) } func listDatabaseUserCertificatesBuilder() *cobra.Command { @@ -304,7 +322,10 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) diff --git a/tools/openapi-generator/config/atlas-api-changes.yaml b/tools/openapi-generator/config/atlas-api-changes.yaml index bdf5da47f9..3105c895d8 100644 --- a/tools/openapi-generator/config/atlas-api-changes.yaml +++ b/tools/openapi-generator/config/atlas-api-changes.yaml @@ -2,6 +2,16 @@ paths: "/api/atlas/v2/groups/{groupId}/clusters": post: summary: TEST DESCRIPTION + x-watcher-state: IDLE + x-watcher-operation: getCluster + x-watcher-description: WATCH DESCRIPTION + x-watcher-timeout-description: WATCH TIMEOUT DESCRIPTION + x-watcher-return-property: StateName + x-watcher-params: + - key: GroupId + value: GroupId + - key: ClusterName + value: Name components: parameters: groupId: diff --git a/tools/openapi-generator/config/atlas-api-transformed.yaml b/tools/openapi-generator/config/atlas-api-transformed.yaml index 89c66b779f..110ea275b9 100644 --- a/tools/openapi-generator/config/atlas-api-transformed.yaml +++ b/tools/openapi-generator/config/atlas-api-transformed.yaml @@ -2676,6 +2676,18 @@ paths: summary: TEST DESCRIPTION tags: - Clusters + x-watcher-params: + "0": + value: GroupId + key: GroupId + "1": + value: Name + key: ClusterName + x-watcher-return-property: StateName + x-watcher-timeout-description: WATCH TIMEOUT DESCRIPTION + x-watcher-description: WATCH DESCRIPTION + x-watcher-operation: getCluster + x-watcher-state: IDLE /api/atlas/v2/groups/{groupId}/clusters/provider/regions: get: description: Returns the list of regions available for the specified cloud diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index bcfb9a3c37..74e7e12315 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -13,6 +13,7 @@ import ( "text/template" "time" + "github.com/briandowns/spinner" "github.com/spf13/afero" "github.com/spf13/cobra" "{{sdkImport}}/admin" @@ -33,9 +34,18 @@ type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { {{#returnType}} format string tmpl *template.Template + {{#returnProperty}} + resp {{#isFile}}{{dataType}}{{/isFile}}{{#isPrimitiveType}}{{dataType}}{{/isPrimitiveType}}{{^isFile}}{{^isPrimitiveType}}{{#isArray}}[]{{/isArray}}{{^isArray}}*{{/isArray}}admin.{{complexType}}{{/isPrimitiveType}}{{/isFile}} + {{/returnProperty}} {{/returnType}} + {{#vendorExtensions.x-watcher-operation}} + watchEnabled bool + watchTimeout string + wt time.Duration + {{/vendorExtensions.x-watcher-operation}} } + func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) preRun() (err error) { if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { return err @@ -67,11 +77,18 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) preRu {{#returnType}} if opts.format != "" { - opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n") + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } } {{/returnType}} + {{#vendorExtensions.x-watcher-operation}} + if opts.wt, err = time.ParseDuration(opts.watchTimeout); err != nil { + return err + } + {{/vendorExtensions.x-watcher-operation}} - return err + return nil } {{#bodyParam}} @@ -98,7 +115,7 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) readD } {{/bodyParam}} -func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(ctx context.Context, {{^bodyParam}}_{{/bodyParam}}{{#bodyParam}}r{{/bodyParam}} io.Reader, {{^returnType}}_{{/returnType}}{{#returnType}}w{{/returnType}} io.Writer) error { +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(ctx context.Context, {{^bodyParam}}_{{/bodyParam}}{{#bodyParam}}r{{/bodyParam}} io.Reader) error { {{#bodyParam}} data, errData := opts.readData(r) if errData != nil { @@ -123,30 +140,79 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) run(c {{/bodyParam}} } - {{#returnType}}resp, {{/returnType}}_, err := opts.client.{{classname}}.{{operationId}}WithParams(ctx, params).Execute() - {{#returnType}} - if err != nil { - return err + var err error + {{#returnType}}opts.resp, {{/returnType}}_, err = opts.client.{{classname}}.{{operationId}}WithParams(ctx, params).Execute() + return err +} + +{{#vendorExtensions.x-watcher-operation}} +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) watch(ctx context.Context) error { + if !opts.watchEnabled { + return nil } - prettyJSON, errJson := json.MarshalIndent(resp, "", " ") + spin := spinner.New(spinner.CharSets[9], 100 * time.Millisecond) + spin.Start() + defer spin.Stop() + + watchCtx, cancel := context.WithTimeout(ctx, opts.wt) + defer cancel() + for { + select { + case <-watchCtx.Done(): + return watchCtx.Err() + default: + params := &admin.{{#lambda.titlecase}}{{.}}{{/lambda.titlecase}}ApiParams{ + {{#vendorExtensions.x-watcher-params.0}} + {{key}}: *opts.resp.{{value}}, + {{/vendorExtensions.x-watcher-params.0}} + {{#vendorExtensions.x-watcher-params.1}} + {{key}}: *opts.resp.{{value}}, + {{/vendorExtensions.x-watcher-params.1}} + {{#vendorExtensions.x-watcher-params.2}} + {{key}}: *opts.resp.{{value}}, + {{/vendorExtensions.x-watcher-params.2}} + } + resp, _, err := opts.client.{{classname}}.{{#lambda.titlecase}}{{.}}{{/lambda.titlecase}}WithParams(ctx, params).Execute() + if err != nil { + return err + } + if resp.{{vendorExtensions.x-watcher-return-property}} != nil && *resp.{{vendorExtensions.x-watcher-return-property}} == "{{vendorExtensions.x-watcher-state}}" { + return nil + } + } + } +} +{{/vendorExtensions.x-watcher-operation}} + +func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) postRun({{#vendorExtensions.x-watcher-operation}}ctx{{/vendorExtensions.x-watcher-operation}}{{^vendorExtensions.x-watcher-operation}}_{{/vendorExtensions.x-watcher-operation}} context.Context, {{^returnType}}_{{/returnType}}{{#returnType}}w{{/returnType}} io.Writer) error { + {{#vendorExtensions.x-watcher-operation}} + if err := opts.watch(ctx); err != nil { + return err + } + {{/vendorExtensions.x-watcher-operation}} + + {{^returnType}} + return nil + {{/returnType}} + {{#returnType}} + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") if errJson != nil { return errJson } if opts.format == "" { - _, err = fmt.Fprintln(w, string(prettyJSON)) + _, err := fmt.Fprintln(w, string(prettyJSON)) return err } var parsedJSON interface{} - if err = json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { return err } - err = opts.tmpl.Execute(w, parsedJSON) + return opts.tmpl.Execute(w, parsedJSON) {{/returnType}} - return err } func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.Command { @@ -162,7 +228,10 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C return opts.preRun() }, RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin(), cmd.OutOrStdout()) + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } {{#allParams}} @@ -176,6 +245,10 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C {{#returnType}} cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") {{/returnType}} + {{#vendorExtensions.x-watcher-operation}} + cmd.Flags().BoolVarP(&opts.watchEnabled, "watch", "w", false, "{{vendorExtensions.x-watcher-description}}") + cmd.Flags().StringVar(&opts.watchTimeout, "timeout", "5m", "{{vendorExtensions.x-watcher-timeout-description}}") + {{/vendorExtensions.x-watcher-operation}} return cmd } {{/operation}} From 24e07092bb71dfdd8cc7f3abb700ab7c9520d007 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 5 Oct 2023 16:04:24 +0100 Subject: [PATCH 38/44] refactor merge --- tools/openapi-generator/merge.js | 51 +++++++++++----------------- tools/openapi-generator/package.json | 2 +- 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/tools/openapi-generator/merge.js b/tools/openapi-generator/merge.js index 7d6a98b5b3..2e95179154 100644 --- a/tools/openapi-generator/merge.js +++ b/tools/openapi-generator/merge.js @@ -1,25 +1,15 @@ const fs = require('fs'); const yaml = require('yaml'); -var atlasApi, atlasApiChanges; +const args = process.argv.splice(2); -try { - atlasApi = yaml.parse(fs.readFileSync('config/atlas-api.yaml', 'utf8')); -} catch (err) { - console.error(err); - process.exit(1); -} - -try { - let f = fs.readFileSync('config/atlas-api-changes.yaml', 'utf8'); - Object.entries(process.env).forEach(entry => { - const [key, value] = entry; - f = f.replaceAll("${" + key + "}", value); - }); - atlasApiChanges = yaml.parse(f); -} catch (err) { +function loadYaml(p) { + try { + return yaml.parse(fs.readFileSync(p, 'utf8')); + } catch (err) { console.error(err); process.exit(1); + } } function visit(o, fn) { @@ -45,20 +35,19 @@ function visit(o, fn) { } } -visit(atlasApiChanges, function (k, v) { - let path = atlasApi; - k.forEach((key, i) => { - path[key] ||= {}; - if (i == (k.length - 1)) { - path[key] = v; - } - path = path[key]; +let actual = loadYaml(args[0]); +for (let i = 1; i < args.length; i++) { + let toMerge = loadYaml(args[i]); + visit(toMerge, function (k, v) { + let path = actual; + k.forEach((key, i) => { + path[key] ||= {}; + if (i == (k.length - 1)) { + path[key] = v; + } + path = path[key]; + }); }); -}); +} -try { - fs.writeFileSync('config/atlas-api-transformed.yaml', yaml.stringify(atlasApi), 'utf8') -} catch (err) { - console.error(err); - process.exit(1); -} \ No newline at end of file +process.stdout.write(yaml.stringify(actual)); diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index 05c6544380..a1ebb6b50d 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -6,7 +6,7 @@ "scripts": { "generate:clear": "rm -rf ../../internal/api && mkdir -p ../../internal/api && cp config/.openapi-generator-ignore ../../internal/api", "generate:download": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); curl -L -o config/atlas-api.yaml \"https://raw.githubusercontent.com/mongodb/atlas-sdk-go/$SDKVERSION/openapi/atlas-api-transformed.yaml\"", - "generate:transform": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $1}'); node merge.js", + "generate:transform": "node merge.js config/atlas-api.yaml config/atlas-api-changes.yaml > config/atlas-api-transformed.yaml", "generate:run": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $1}'); export GO_POST_PROCESS_FILE='goimports -w'; openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api --additional-properties=\"sdkImport=$SDKIMPORT,sdkVersion=$SDKVERSION\"", "generate": "npm run generate:clear && npm run generate:download && npm run generate:transform && npm run generate:run" }, From e54007594f8a654c706414697b5bb48bbf245e36 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 5 Oct 2023 16:12:58 +0100 Subject: [PATCH 39/44] add dates --- .../config/go-templates/partial_header.mustache | 2 +- tools/openapi-generator/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/openapi-generator/config/go-templates/partial_header.mustache b/tools/openapi-generator/config/go-templates/partial_header.mustache index 87bdd292fd..dc0e1554f1 100644 --- a/tools/openapi-generator/config/go-templates/partial_header.mustache +++ b/tools/openapi-generator/config/go-templates/partial_header.mustache @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright {{currentYear}} MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index a1ebb6b50d..3f35cbd063 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -7,7 +7,7 @@ "generate:clear": "rm -rf ../../internal/api && mkdir -p ../../internal/api && cp config/.openapi-generator-ignore ../../internal/api", "generate:download": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); curl -L -o config/atlas-api.yaml \"https://raw.githubusercontent.com/mongodb/atlas-sdk-go/$SDKVERSION/openapi/atlas-api-transformed.yaml\"", "generate:transform": "node merge.js config/atlas-api.yaml config/atlas-api-changes.yaml > config/atlas-api-transformed.yaml", - "generate:run": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $1}'); export GO_POST_PROCESS_FILE='goimports -w'; openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api --additional-properties=\"sdkImport=$SDKIMPORT,sdkVersion=$SDKVERSION\"", + "generate:run": "export CURRENTYEAR=$(date -u +\"%Y\"); export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $1}'); export GO_POST_PROCESS_FILE='goimports -w'; openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api --additional-properties=\"sdkImport=$SDKIMPORT,sdkVersion=$SDKVERSION,currentYear=$CURRENTYEAR\"", "generate": "npm run generate:clear && npm run generate:download && npm run generate:transform && npm run generate:run" }, "repository": { From b66016b52f9398ac6b229a02c33c4bc12013c655 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Thu, 5 Oct 2023 18:15:54 +0100 Subject: [PATCH 40/44] add sleep for watcher --- internal/api/api_clusters_cmd.go | 1 + tools/openapi-generator/config/go-templates/cmd.mustache | 1 + 2 files changed, 2 insertions(+) diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 2d7561413d..cd23c25678 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -142,6 +142,7 @@ func (opts *createClusterOpts) watch(ctx context.Context) error { if resp.StateName != nil && *resp.StateName == "IDLE" { return nil } + time.Sleep(4 * time.Second) } } } diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 74e7e12315..9f55d6a70e 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -180,6 +180,7 @@ func (opts *{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts) watch if resp.{{vendorExtensions.x-watcher-return-property}} != nil && *resp.{{vendorExtensions.x-watcher-return-property}} == "{{vendorExtensions.x-watcher-state}}" { return nil } + time.Sleep(4 * time.Second) } } } From 18ac3796a9a824e37ba2d470edcc209a2d94ff19 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Mon, 29 Apr 2024 17:36:47 +0100 Subject: [PATCH 41/44] update commands --- ...las-api-aWSClustersDNS-getAWSCustomDNS.txt | 66 + ...-api-aWSClustersDNS-toggleAWSCustomDNS.txt | 70 + docs/command/atlas-api-aWSClustersDNS.txt | 61 + ...ssTracking-listAccessLogsByClusterName.txt | 90 + ...ccessTracking-listAccessLogsByHostname.txt | 90 + docs/command/atlas-api-accessTracking.txt | 61 + ...onfigurations-createAlertConfiguration.txt | 70 + ...onfigurations-deleteAlertConfiguration.txt | 66 + ...rtConfigurations-getAlertConfiguration.txt | 70 + ...stAlertConfigurationMatchersFieldNames.txt | 62 + ...Configurations-listAlertConfigurations.txt | 78 + ...tions-listAlertConfigurationsByAlertId.txt | 82 + ...onfigurations-toggleAlertConfiguration.txt | 74 + ...onfigurations-updateAlertConfiguration.txt | 74 + .../command/atlas-api-alertConfigurations.txt | 73 + .../atlas-api-alerts-acknowledgeAlert.txt | 74 + docs/command/atlas-api-alerts-getAlert.txt | 70 + docs/command/atlas-api-alerts-listAlerts.txt | 82 + ...lerts-listAlertsByAlertConfigurationId.txt | 82 + docs/command/atlas-api-alerts.txt | 65 + ...tlasSearch-createAtlasSearchDeployment.txt | 74 + ...api-atlasSearch-createAtlasSearchIndex.txt | 74 + ...tlasSearch-deleteAtlasSearchDeployment.txt | 66 + ...api-atlasSearch-deleteAtlasSearchIndex.txt | 74 + ...i-atlasSearch-getAtlasSearchDeployment.txt | 70 + ...as-api-atlasSearch-getAtlasSearchIndex.txt | 74 + ...api-atlasSearch-listAtlasSearchIndexes.txt | 78 + ...tlasSearch-updateAtlasSearchDeployment.txt | 74 + ...api-atlasSearch-updateAtlasSearchIndex.txt | 78 + docs/command/atlas-api-atlasSearch.txt | 75 + ...-api-auditing-getAuditingConfiguration.txt | 66 + ...i-auditing-updateAuditingConfiguration.txt | 70 + docs/command/atlas-api-auditing.txt | 61 + ...pi-cloudBackups-cancelBackupRestoreJob.txt | 74 + ...api-cloudBackups-createBackupExportJob.txt | 74 + ...pi-cloudBackups-createBackupRestoreJob.txt | 74 + ...as-api-cloudBackups-createExportBucket.txt | 70 + ...ckups-createServerlessBackupRestoreJob.txt | 74 + ...-cloudBackups-deleteAllBackupSchedules.txt | 70 + ...as-api-cloudBackups-deleteExportBucket.txt | 70 + ...pi-cloudBackups-deleteReplicaSetBackup.txt | 74 + ...loudBackups-deleteShardedClusterBackup.txt | 74 + ...as-api-cloudBackups-getBackupExportJob.txt | 74 + ...s-api-cloudBackups-getBackupRestoreJob.txt | 74 + ...las-api-cloudBackups-getBackupSchedule.txt | 70 + ...cloudBackups-getDataProtectionSettings.txt | 66 + ...atlas-api-cloudBackups-getExportBucket.txt | 70 + ...s-api-cloudBackups-getReplicaSetBackup.txt | 74 + ...s-api-cloudBackups-getServerlessBackup.txt | 74 + ...dBackups-getServerlessBackupRestoreJob.txt | 74 + ...i-cloudBackups-getShardedClusterBackup.txt | 74 + ...-api-cloudBackups-listBackupExportJobs.txt | 82 + ...api-cloudBackups-listBackupRestoreJobs.txt | 82 + ...las-api-cloudBackups-listExportBuckets.txt | 78 + ...api-cloudBackups-listReplicaSetBackups.txt | 82 + ...ackups-listServerlessBackupRestoreJobs.txt | 82 + ...api-cloudBackups-listServerlessBackups.txt | 82 + ...cloudBackups-listShardedClusterBackups.txt | 70 + .../atlas-api-cloudBackups-takeSnapshot.txt | 74 + ...-api-cloudBackups-updateBackupSchedule.txt | 74 + ...udBackups-updateDataProtectionSettings.txt | 74 + ...i-cloudBackups-updateSnapshotRetention.txt | 78 + docs/command/atlas-api-cloudBackups.txt | 115 + ...-cloudMigrationService-createLinkToken.txt | 70 + ...udMigrationService-createPushMigration.txt | 70 + ...cloudMigrationService-cutoverMigration.txt | 66 + ...-cloudMigrationService-deleteLinkToken.txt | 66 + ...cloudMigrationService-getPushMigration.txt | 70 + ...udMigrationService-getValidationStatus.txt | 70 + ...oudMigrationService-listSourceProjects.txt | 66 + ...loudMigrationService-validateMigration.txt | 70 + .../atlas-api-cloudMigrationService.txt | 73 + ...ccess-authorizeCloudProviderAccessRole.txt | 74 + ...erAccess-createCloudProviderAccessRole.txt | 70 + ...ess-deauthorizeCloudProviderAccessRole.txt | 70 + ...viderAccess-getCloudProviderAccessRole.txt | 70 + ...derAccess-listCloudProviderAccessRoles.txt | 66 + .../command/atlas-api-cloudProviderAccess.txt | 67 + ...erOutageSimulation-endOutageSimulation.txt | 70 + ...erOutageSimulation-getOutageSimulation.txt | 70 + ...OutageSimulation-startOutageSimulation.txt | 74 + .../atlas-api-clusterOutageSimulation.txt | 63 + .../atlas-api-clusters-createCluster.txt | 78 + .../atlas-api-clusters-deleteCluster.txt | 70 + .../command/atlas-api-clusters-getCluster.txt | 70 + ...usters-getClusterAdvancedConfiguration.txt | 70 + .../atlas-api-clusters-getClusterStatus.txt | 70 + ...pi-clusters-getSampleDatasetLoadStatus.txt | 70 + ...-api-clusters-listCloudProviderRegions.txt | 86 + .../atlas-api-clusters-listClusters.txt | 82 + ...pi-clusters-listClustersForAllProjects.txt | 74 + .../atlas-api-clusters-loadSampleDataset.txt | 70 + .../atlas-api-clusters-testFailover.txt | 66 + .../atlas-api-clusters-updateCluster.txt | 74 + ...ers-updateClusterAdvancedConfiguration.txt | 74 + ...tlas-api-clusters-upgradeSharedCluster.txt | 70 + ...sters-upgradeSharedClusterToServerless.txt | 70 + docs/command/atlas-api-clusters.txt | 87 + ...atsLatencyNamespaceClusterMeasurements.txt | 98 + ...lStatsLatencyNamespaceHostMeasurements.txt | 94 + ...cs-getCollStatsLatencyNamespaceMetrics.txt | 66 + ...etCollStatsLatencyNamespacesForCluster.txt | 86 + ...s-getCollStatsLatencyNamespacesForHost.txt | 82 + ...ectionLevelMetrics-getPinnedNamespaces.txt | 70 + ...lectionLevelMetrics-pinNamespacesPatch.txt | 74 + ...ollectionLevelMetrics-pinNamespacesPut.txt | 74 + ...collectionLevelMetrics-unpinNamespaces.txt | 74 + .../atlas-api-collectionLevelMetrics.txt | 75 + ...DatabaseRoles-createCustomDatabaseRole.txt | 70 + ...DatabaseRoles-deleteCustomDatabaseRole.txt | 66 + ...tomDatabaseRoles-getCustomDatabaseRole.txt | 70 + ...mDatabaseRoles-listCustomDatabaseRoles.txt | 66 + ...DatabaseRoles-updateCustomDatabaseRole.txt | 74 + .../command/atlas-api-customDatabaseRoles.txt | 67 + ...on-createDataFederationPrivateEndpoint.txt | 70 + ...dataFederation-createFederatedDatabase.txt | 74 + ...tion-createOneDataFederationQueryLimit.txt | 86 + ...on-deleteDataFederationPrivateEndpoint.txt | 70 + ...dataFederation-deleteFederatedDatabase.txt | 70 + ...eteOneDataFederationInstanceQueryLimit.txt | 82 + ...ion-downloadFederatedDatabaseQueryLogs.txt | 78 + ...ation-getDataFederationPrivateEndpoint.txt | 70 + ...pi-dataFederation-getFederatedDatabase.txt | 70 + ...ion-listDataFederationPrivateEndpoints.txt | 78 + ...-dataFederation-listFederatedDatabases.txt | 70 + ...tion-returnFederatedDatabaseQueryLimit.txt | 82 + ...ion-returnFederatedDatabaseQueryLimits.txt | 70 + ...dataFederation-updateFederatedDatabase.txt | 78 + docs/command/atlas-api-dataFederation.txt | 85 + ...s-api-dataLakePipelines-createPipeline.txt | 70 + ...s-api-dataLakePipelines-deletePipeline.txt | 70 + ...LakePipelines-deletePipelineRunDataset.txt | 74 + ...tlas-api-dataLakePipelines-getPipeline.txt | 70 + ...s-api-dataLakePipelines-getPipelineRun.txt | 74 + ...api-dataLakePipelines-listPipelineRuns.txt | 86 + ...ataLakePipelines-listPipelineSchedules.txt | 70 + ...ataLakePipelines-listPipelineSnapshots.txt | 86 + ...as-api-dataLakePipelines-listPipelines.txt | 66 + ...as-api-dataLakePipelines-pausePipeline.txt | 70 + ...s-api-dataLakePipelines-resumePipeline.txt | 70 + ...LakePipelines-triggerSnapshotIngestion.txt | 74 + ...s-api-dataLakePipelines-updatePipeline.txt | 74 + docs/command/atlas-api-dataLakePipelines.txt | 83 + ...s-api-databaseUsers-createDatabaseUser.txt | 70 + ...s-api-databaseUsers-deleteDatabaseUser.txt | 86 + ...tlas-api-databaseUsers-getDatabaseUser.txt | 86 + ...as-api-databaseUsers-listDatabaseUsers.txt | 78 + ...s-api-databaseUsers-updateDatabaseUser.txt | 90 + docs/command/atlas-api-databaseUsers.txt | 67 + ...tomerKeyManagement-getEncryptionAtRest.txt | 66 + ...erKeyManagement-updateEncryptionAtRest.txt | 70 + ...yptionAtRestUsingCustomerKeyManagement.txt | 61 + .../atlas-api-events-getOrganizationEvent.txt | 74 + .../atlas-api-events-getProjectEvent.txt | 74 + ...tlas-api-events-listOrganizationEvents.txt | 96 + .../atlas-api-events-listProjectEvents.txt | 106 + docs/command/atlas-api-events.txt | 65 + ...dAuthentication-createIdentityProvider.txt | 70 + ...eratedAuthentication-createRoleMapping.txt | 74 + ...atedAuthentication-deleteFederationApp.txt | 62 + ...dAuthentication-deleteIdentityProvider.txt | 66 + ...eratedAuthentication-deleteRoleMapping.txt | 70 + ...edAuthentication-getConnectedOrgConfig.txt | 70 + ...edAuthentication-getFederationSettings.txt | 66 + ...atedAuthentication-getIdentityProvider.txt | 70 + ...entication-getIdentityProviderMetadata.txt | 70 + ...federatedAuthentication-getRoleMapping.txt | 74 + ...Authentication-listConnectedOrgConfigs.txt | 66 + ...edAuthentication-listIdentityProviders.txt | 82 + ...deratedAuthentication-listRoleMappings.txt | 70 + ...uthentication-removeConnectedOrgConfig.txt | 70 + ...ication-revokeJwksFromIdentityProvider.txt | 66 + ...uthentication-updateConnectedOrgConfig.txt | 74 + ...dAuthentication-updateIdentityProvider.txt | 74 + ...eratedAuthentication-updateRoleMapping.txt | 78 + .../atlas-api-federatedAuthentication.txt | 93 + ...globalClusters-createCustomZoneMapping.txt | 74 + ...-globalClusters-createManagedNamespace.txt | 74 + ...alClusters-deleteAllCustomZoneMappings.txt | 70 + ...-globalClusters-deleteManagedNamespace.txt | 78 + ...api-globalClusters-getManagedNamespace.txt | 70 + docs/command/atlas-api-globalClusters.txt | 68 + ...nvoices-createCostExplorerQueryProcess.txt | 70 + ...voices-createCostExplorerQueryProcess1.txt | 70 + .../atlas-api-invoices-downloadInvoiceCSV.txt | 70 + .../command/atlas-api-invoices-getInvoice.txt | 70 + .../atlas-api-invoices-listInvoices.txt | 78 + ...atlas-api-invoices-listPendingInvoices.txt | 66 + docs/command/atlas-api-invoices.txt | 69 + ...PConfiguration-deleteLDAPConfiguration.txt | 66 + ...lDAPConfiguration-getLDAPConfiguration.txt | 66 + ...nfiguration-getLDAPConfigurationStatus.txt | 70 + ...DAPConfiguration-saveLDAPConfiguration.txt | 70 + ...PConfiguration-verifyLDAPConfiguration.txt | 70 + docs/command/atlas-api-lDAPConfiguration.txt | 67 + ...acyBackup-createLegacyBackupRestoreJob.txt | 74 + ...-api-legacyBackup-deleteLegacySnapshot.txt | 74 + ...legacyBackup-getLegacyBackupCheckpoint.txt | 74 + ...legacyBackup-getLegacyBackupRestoreJob.txt | 74 + ...las-api-legacyBackup-getLegacySnapshot.txt | 74 + ...legacyBackup-getLegacySnapshotSchedule.txt | 70 + ...gacyBackup-listLegacyBackupCheckpoints.txt | 82 + ...gacyBackup-listLegacyBackupRestoreJobs.txt | 86 + ...s-api-legacyBackup-listLegacySnapshots.txt | 86 + ...cyBackup-updateLegacySnapshotRetention.txt | 78 + ...acyBackup-updateLegacySnapshotSchedule.txt | 74 + docs/command/atlas-api-legacyBackup.txt | 79 + ...ntenanceWindows-deferMaintenanceWindow.txt | 62 + ...aintenanceWindows-getMaintenanceWindow.txt | 66 + ...ntenanceWindows-resetMaintenanceWindow.txt | 62 + ...anceWindows-toggleMaintenanceAutoDefer.txt | 62 + ...tenanceWindows-updateMaintenanceWindow.txt | 70 + docs/command/atlas-api-maintenanceWindows.txt | 67 + ...atlas-api-mongoDBCloudUsers-createUser.txt | 66 + .../atlas-api-mongoDBCloudUsers-getUser.txt | 66 + ...pi-mongoDBCloudUsers-getUserByUsername.txt | 66 + docs/command/atlas-api-mongoDBCloudUsers.txt | 63 + ...-api-monitoringAndLogs-getAtlasProcess.txt | 70 + ...tlas-api-monitoringAndLogs-getDatabase.txt | 74 + ...itoringAndLogs-getDatabaseMeasurements.txt | 94 + ...-monitoringAndLogs-getDiskMeasurements.txt | 94 + ...tlas-api-monitoringAndLogs-getHostLogs.txt | 82 + ...-monitoringAndLogs-getHostMeasurements.txt | 90 + ...-api-monitoringAndLogs-getIndexMetrics.txt | 102 + ...-api-monitoringAndLogs-getMeasurements.txt | 90 + ...i-monitoringAndLogs-listAtlasProcesses.txt | 78 + ...as-api-monitoringAndLogs-listDatabases.txt | 82 + ...monitoringAndLogs-listDiskMeasurements.txt | 74 + ...i-monitoringAndLogs-listDiskPartitions.txt | 82 + ...api-monitoringAndLogs-listIndexMetrics.txt | 98 + ...-api-monitoringAndLogs-listMetricTypes.txt | 70 + docs/command/atlas-api-monitoringAndLogs.txt | 85 + ...networkPeering-createPeeringConnection.txt | 70 + ...-networkPeering-createPeeringContainer.txt | 70 + ...networkPeering-deletePeeringConnection.txt | 70 + ...-networkPeering-deletePeeringContainer.txt | 70 + ...tlas-api-networkPeering-disablePeering.txt | 70 + ...pi-networkPeering-getPeeringConnection.txt | 70 + ...api-networkPeering-getPeeringContainer.txt | 70 + ...-networkPeering-listPeeringConnections.txt | 82 + ...ng-listPeeringContainerByCloudProvider.txt | 82 + ...i-networkPeering-listPeeringContainers.txt | 78 + ...networkPeering-updatePeeringConnection.txt | 74 + ...-networkPeering-updatePeeringContainer.txt | 74 + ...ConnectViaPeeringOnlyModeForOneProject.txt | 66 + docs/command/atlas-api-networkPeering.txt | 84 + ...-api-onlineArchive-createOnlineArchive.txt | 74 + ...-api-onlineArchive-deleteOnlineArchive.txt | 74 + ...Archive-downloadOnlineArchiveQueryLogs.txt | 82 + ...las-api-onlineArchive-getOnlineArchive.txt | 74 + ...s-api-onlineArchive-listOnlineArchives.txt | 82 + ...-api-onlineArchive-updateOnlineArchive.txt | 78 + docs/command/atlas-api-onlineArchive.txt | 69 + ...s-api-organizations-createOrganization.txt | 66 + ...nizations-createOrganizationInvitation.txt | 70 + ...s-api-organizations-deleteOrganization.txt | 66 + ...nizations-deleteOrganizationInvitation.txt | 70 + ...tlas-api-organizations-getOrganization.txt | 66 + ...rganizations-getOrganizationInvitation.txt | 70 + ...-organizations-getOrganizationSettings.txt | 66 + ...anizations-listOrganizationInvitations.txt | 70 + ...organizations-listOrganizationProjects.txt | 82 + ...pi-organizations-listOrganizationUsers.txt | 78 + ...as-api-organizations-listOrganizations.txt | 78 + ...i-organizations-removeOrganizationUser.txt | 70 + ...s-api-organizations-renameOrganization.txt | 70 + ...nizations-updateOrganizationInvitation.txt | 70 + ...tions-updateOrganizationInvitationById.txt | 74 + ...-organizations-updateOrganizationRoles.txt | 74 + ...ganizations-updateOrganizationSettings.txt | 70 + docs/command/atlas-api-organizations.txt | 91 + ...visor-disableSlowOperationThresholding.txt | 62 + ...dvisor-enableSlowOperationThresholding.txt | 62 + ...manceAdvisor-getServerlessAutoIndexing.txt | 70 + ...api-performanceAdvisor-listSlowQueries.txt | 92 + ...ormanceAdvisor-listSlowQueryNamespaces.txt | 84 + ...erformanceAdvisor-listSuggestedIndexes.txt | 108 + ...manceAdvisor-setServerlessAutoIndexing.txt | 74 + docs/command/atlas-api-performanceAdvisor.txt | 71 + ...EndpointServices-createPrivateEndpoint.txt | 78 + ...tServices-createPrivateEndpointService.txt | 70 + ...EndpointServices-deletePrivateEndpoint.txt | 78 + ...tServices-deletePrivateEndpointService.txt | 74 + ...ateEndpointServices-getPrivateEndpoint.txt | 78 + ...ointServices-getPrivateEndpointService.txt | 74 + ...-getRegionalizedPrivateEndpointSetting.txt | 66 + ...ntServices-listPrivateEndpointServices.txt | 70 + ...ggleRegionalizedPrivateEndpointSetting.txt | 70 + .../atlas-api-privateEndpointServices.txt | 75 + ...i-programmaticAPIKeys-addProjectApiKey.txt | 74 + ...s-api-programmaticAPIKeys-createApiKey.txt | 70 + ...rammaticAPIKeys-createApiKeyAccessList.txt | 86 + ...rogrammaticAPIKeys-createProjectApiKey.txt | 70 + ...s-api-programmaticAPIKeys-deleteApiKey.txt | 70 + ...ticAPIKeys-deleteApiKeyAccessListEntry.txt | 74 + ...tlas-api-programmaticAPIKeys-getApiKey.txt | 70 + ...rogrammaticAPIKeys-getApiKeyAccessList.txt | 74 + ...icAPIKeys-listApiKeyAccessListsEntries.txt | 82 + ...as-api-programmaticAPIKeys-listApiKeys.txt | 78 + ...programmaticAPIKeys-listProjectApiKeys.txt | 78 + ...rogrammaticAPIKeys-removeProjectApiKey.txt | 70 + ...s-api-programmaticAPIKeys-updateApiKey.txt | 74 + ...-programmaticAPIKeys-updateApiKeyRoles.txt | 86 + .../command/atlas-api-programmaticAPIKeys.txt | 85 + ...IPAccessList-createProjectIpAccessList.txt | 82 + ...IPAccessList-deleteProjectIpAccessList.txt | 74 + ...ccessList-getProjectIpAccessListStatus.txt | 70 + ...i-projectIPAccessList-getProjectIpList.txt | 70 + ...tIPAccessList-listProjectIpAccessLists.txt | 78 + .../command/atlas-api-projectIPAccessList.txt | 67 + .../atlas-api-projects-addUserToProject.txt | 70 + .../atlas-api-projects-createProject.txt | 70 + ...s-api-projects-createProjectInvitation.txt | 70 + .../atlas-api-projects-deleteProject.txt | 66 + ...s-api-projects-deleteProjectInvitation.txt | 70 + .../atlas-api-projects-deleteProjectLimit.txt | 86 + .../command/atlas-api-projects-getProject.txt | 66 + .../atlas-api-projects-getProjectByName.txt | 66 + ...tlas-api-projects-getProjectInvitation.txt | 70 + .../atlas-api-projects-getProjectLimit.txt | 86 + .../atlas-api-projects-getProjectSettings.txt | 66 + ...as-api-projects-listProjectInvitations.txt | 70 + .../atlas-api-projects-listProjectLimits.txt | 66 + .../atlas-api-projects-listProjectUsers.txt | 86 + .../atlas-api-projects-listProjects.txt | 74 + .../atlas-api-projects-removeProjectUser.txt | 66 + ...tlas-api-projects-returnAllIPAddresses.txt | 66 + .../atlas-api-projects-setProjectLimit.txt | 90 + .../atlas-api-projects-updateProject.txt | 70 + ...s-api-projects-updateProjectInvitation.txt | 70 + ...i-projects-updateProjectInvitationById.txt | 74 + .../atlas-api-projects-updateProjectRoles.txt | 74 + ...las-api-projects-updateProjectSettings.txt | 70 + docs/command/atlas-api-projects.txt | 103 + ...Export-createPushBasedLogConfiguration.txt | 66 + ...Export-deletePushBasedLogConfiguration.txt | 62 + ...LogExport-getPushBasedLogConfiguration.txt | 66 + ...Export-updatePushBasedLogConfiguration.txt | 66 + docs/command/atlas-api-pushBasedLogExport.txt | 65 + ...as-api-rollingIndex-createRollingIndex.txt | 70 + docs/command/atlas-api-rollingIndex.txt | 59 + .../atlas-api-root-getSystemStatus.txt | 62 + ...-root-returnAllControlPlaneIPAddresses.txt | 62 + docs/command/atlas-api-root.txt | 61 + ...lessInstances-createServerlessInstance.txt | 70 + ...lessInstances-deleteServerlessInstance.txt | 70 + ...verlessInstances-getServerlessInstance.txt | 70 + ...rlessInstances-listServerlessInstances.txt | 78 + ...lessInstances-updateServerlessInstance.txt | 74 + .../command/atlas-api-serverlessInstances.txt | 67 + ...points-createServerlessPrivateEndpoint.txt | 74 + ...points-deleteServerlessPrivateEndpoint.txt | 74 + ...Endpoints-getServerlessPrivateEndpoint.txt | 74 + ...dpoints-listServerlessPrivateEndpoints.txt | 70 + ...points-updateServerlessPrivateEndpoint.txt | 78 + .../atlas-api-serverlessPrivateEndpoints.txt | 67 + ...bs-createSharedClusterBackupRestoreJob.txt | 74 + ...eJobs-getSharedClusterBackupRestoreJob.txt | 74 + ...obs-listSharedClusterBackupRestoreJobs.txt | 70 + .../atlas-api-sharedTierRestoreJobs.txt | 63 + ...rSnapshots-downloadSharedClusterBackup.txt | 74 + ...edTierSnapshots-getSharedClusterBackup.txt | 74 + ...TierSnapshots-listSharedClusterBackups.txt | 70 + .../command/atlas-api-sharedTierSnapshots.txt | 63 + ...las-api-streams-createStreamConnection.txt | 74 + ...atlas-api-streams-createStreamInstance.txt | 70 + ...las-api-streams-deleteStreamConnection.txt | 74 + ...atlas-api-streams-deleteStreamInstance.txt | 70 + ...-streams-downloadStreamTenantAuditLogs.txt | 78 + .../atlas-api-streams-getStreamConnection.txt | 74 + .../atlas-api-streams-getStreamInstance.txt | 74 + ...tlas-api-streams-listStreamConnections.txt | 78 + .../atlas-api-streams-listStreamInstances.txt | 74 + ...las-api-streams-updateStreamConnection.txt | 78 + ...atlas-api-streams-updateStreamInstance.txt | 74 + docs/command/atlas-api-streams.txt | 79 + .../atlas-api-teams-addAllTeamsToProject.txt | 70 + docs/command/atlas-api-teams-addTeamUser.txt | 74 + docs/command/atlas-api-teams-createTeam.txt | 70 + docs/command/atlas-api-teams-deleteTeam.txt | 70 + docs/command/atlas-api-teams-getTeamById.txt | 70 + .../command/atlas-api-teams-getTeamByName.txt | 70 + .../atlas-api-teams-listOrganizationTeams.txt | 78 + .../atlas-api-teams-listProjectTeams.txt | 78 + .../command/atlas-api-teams-listTeamUsers.txt | 78 + .../atlas-api-teams-removeProjectTeam.txt | 66 + .../atlas-api-teams-removeTeamUser.txt | 70 + docs/command/atlas-api-teams-renameTeam.txt | 74 + .../atlas-api-teams-updateTeamRoles.txt | 74 + docs/command/atlas-api-teams.txt | 83 + ...tegrations-createThirdPartyIntegration.txt | 86 + ...tegrations-deleteThirdPartyIntegration.txt | 70 + ...yIntegrations-getThirdPartyIntegration.txt | 70 + ...ntegrations-listThirdPartyIntegrations.txt | 78 + ...tegrations-updateThirdPartyIntegration.txt | 86 + .../atlas-api-thirdPartyIntegrations.txt | 69 + ...tication-createDatabaseUserCertificate.txt | 74 + ...hentication-disableCustomerManagedX509.txt | 66 + ...ntication-listDatabaseUserCertificates.txt | 82 + docs/command/atlas-api-x509Authentication.txt | 63 + docs/command/atlas-api.txt | 153 + docs/command/atlas.txt | 2 + internal/api/.openapi-generator/FILES | 2 +- internal/api/api.go | 4 +- internal/api/api_access_tracking_cmd.go | 6 +- internal/api/api_alert_configurations_cmd.go | 6 +- internal/api/api_alerts_cmd.go | 6 +- internal/api/api_atlas_search_cmd.go | 411 +- internal/api/api_auditing_cmd.go | 6 +- internal/api/api_aws_clusters_dns_cmd.go | 6 +- internal/api/api_cloud_backups_cmd.go | 28 +- .../api/api_cloud_migration_service_cmd.go | 6 +- internal/api/api_cloud_provider_access_cmd.go | 6 +- .../api/api_cluster_outage_simulation_cmd.go | 6 +- internal/api/api_clusters_cmd.go | 22 +- .../api/api_collection_level_metrics_cmd.go | 1093 ++++ internal/api/api_custom_database_roles_cmd.go | 6 +- internal/api/api_data_federation_cmd.go | 9 +- internal/api/api_data_lake_pipelines_cmd.go | 6 +- internal/api/api_database_users_cmd.go | 6 +- ..._rest_using_customer_key_management_cmd.go | 6 +- internal/api/api_events_cmd.go | 6 +- .../api/api_federated_authentication_cmd.go | 257 +- internal/api/api_global_clusters_cmd.go | 30 +- internal/api/api_invoices_cmd.go | 6 +- internal/api/api_ldap_configuration_cmd.go | 6 +- internal/api/api_legacy_backup_cmd.go | 131 +- .../api/api_legacy_backup_restore_jobs_cmd.go | 168 - internal/api/api_maintenance_windows__cmd.go | 6 +- internal/api/api_mongo_db_cloud_users_cmd.go | 6 +- internal/api/api_monitoring_and_logs_cmd.go | 9 +- internal/api/api_network_peering_cmd.go | 6 +- internal/api/api_online_archive_cmd.go | 9 +- internal/api/api_organizations_cmd.go | 6 +- internal/api/api_performance_advisor_cmd.go | 196 +- .../api/api_private_endpoint_services_cmd.go | 6 +- internal/api/api_programmatic_api_keys_cmd.go | 18 +- .../api/api_project_ip_access_list_cmd.go | 6 +- internal/api/api_projects_cmd.go | 221 +- internal/api/api_push_based_log_export_cmd.go | 14 +- internal/api/api_rolling_index_cmd.go | 6 +- internal/api/api_root_cmd.go | 77 +- internal/api/api_serverless_instances_cmd.go | 6 +- .../api_serverless_private_endpoints_cmd.go | 6 +- .../api/api_shared_tier_restore_jobs_cmd.go | 6 +- internal/api/api_shared_tier_snapshots_cmd.go | 6 +- internal/api/api_streams_cmd.go | 102 +- internal/api/api_teams_cmd.go | 12 +- .../api/api_third_party_integrations_cmd.go | 20 +- internal/api/api_x509_authentication_cmd.go | 6 +- internal/api/client.go | 8 +- .../config/atlas-api-transformed.yaml | 4389 +++++++++++++--- tools/openapi-generator/config/atlas-api.yaml | 4391 ++++++++++++++--- .../config/go-templates/client.mustache | 2 +- .../config/go-templates/cmd.mustache | 4 +- tools/openapi-generator/package.json | 4 +- 456 files changed, 39483 insertions(+), 1938 deletions(-) create mode 100644 docs/command/atlas-api-aWSClustersDNS-getAWSCustomDNS.txt create mode 100644 docs/command/atlas-api-aWSClustersDNS-toggleAWSCustomDNS.txt create mode 100644 docs/command/atlas-api-aWSClustersDNS.txt create mode 100644 docs/command/atlas-api-accessTracking-listAccessLogsByClusterName.txt create mode 100644 docs/command/atlas-api-accessTracking-listAccessLogsByHostname.txt create mode 100644 docs/command/atlas-api-accessTracking.txt create mode 100644 docs/command/atlas-api-alertConfigurations-createAlertConfiguration.txt create mode 100644 docs/command/atlas-api-alertConfigurations-deleteAlertConfiguration.txt create mode 100644 docs/command/atlas-api-alertConfigurations-getAlertConfiguration.txt create mode 100644 docs/command/atlas-api-alertConfigurations-listAlertConfigurationMatchersFieldNames.txt create mode 100644 docs/command/atlas-api-alertConfigurations-listAlertConfigurations.txt create mode 100644 docs/command/atlas-api-alertConfigurations-listAlertConfigurationsByAlertId.txt create mode 100644 docs/command/atlas-api-alertConfigurations-toggleAlertConfiguration.txt create mode 100644 docs/command/atlas-api-alertConfigurations-updateAlertConfiguration.txt create mode 100644 docs/command/atlas-api-alertConfigurations.txt create mode 100644 docs/command/atlas-api-alerts-acknowledgeAlert.txt create mode 100644 docs/command/atlas-api-alerts-getAlert.txt create mode 100644 docs/command/atlas-api-alerts-listAlerts.txt create mode 100644 docs/command/atlas-api-alerts-listAlertsByAlertConfigurationId.txt create mode 100644 docs/command/atlas-api-alerts.txt create mode 100644 docs/command/atlas-api-atlasSearch-createAtlasSearchDeployment.txt create mode 100644 docs/command/atlas-api-atlasSearch-createAtlasSearchIndex.txt create mode 100644 docs/command/atlas-api-atlasSearch-deleteAtlasSearchDeployment.txt create mode 100644 docs/command/atlas-api-atlasSearch-deleteAtlasSearchIndex.txt create mode 100644 docs/command/atlas-api-atlasSearch-getAtlasSearchDeployment.txt create mode 100644 docs/command/atlas-api-atlasSearch-getAtlasSearchIndex.txt create mode 100644 docs/command/atlas-api-atlasSearch-listAtlasSearchIndexes.txt create mode 100644 docs/command/atlas-api-atlasSearch-updateAtlasSearchDeployment.txt create mode 100644 docs/command/atlas-api-atlasSearch-updateAtlasSearchIndex.txt create mode 100644 docs/command/atlas-api-atlasSearch.txt create mode 100644 docs/command/atlas-api-auditing-getAuditingConfiguration.txt create mode 100644 docs/command/atlas-api-auditing-updateAuditingConfiguration.txt create mode 100644 docs/command/atlas-api-auditing.txt create mode 100644 docs/command/atlas-api-cloudBackups-cancelBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-cloudBackups-createBackupExportJob.txt create mode 100644 docs/command/atlas-api-cloudBackups-createBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-cloudBackups-createExportBucket.txt create mode 100644 docs/command/atlas-api-cloudBackups-createServerlessBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-cloudBackups-deleteAllBackupSchedules.txt create mode 100644 docs/command/atlas-api-cloudBackups-deleteExportBucket.txt create mode 100644 docs/command/atlas-api-cloudBackups-deleteReplicaSetBackup.txt create mode 100644 docs/command/atlas-api-cloudBackups-deleteShardedClusterBackup.txt create mode 100644 docs/command/atlas-api-cloudBackups-getBackupExportJob.txt create mode 100644 docs/command/atlas-api-cloudBackups-getBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-cloudBackups-getBackupSchedule.txt create mode 100644 docs/command/atlas-api-cloudBackups-getDataProtectionSettings.txt create mode 100644 docs/command/atlas-api-cloudBackups-getExportBucket.txt create mode 100644 docs/command/atlas-api-cloudBackups-getReplicaSetBackup.txt create mode 100644 docs/command/atlas-api-cloudBackups-getServerlessBackup.txt create mode 100644 docs/command/atlas-api-cloudBackups-getServerlessBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-cloudBackups-getShardedClusterBackup.txt create mode 100644 docs/command/atlas-api-cloudBackups-listBackupExportJobs.txt create mode 100644 docs/command/atlas-api-cloudBackups-listBackupRestoreJobs.txt create mode 100644 docs/command/atlas-api-cloudBackups-listExportBuckets.txt create mode 100644 docs/command/atlas-api-cloudBackups-listReplicaSetBackups.txt create mode 100644 docs/command/atlas-api-cloudBackups-listServerlessBackupRestoreJobs.txt create mode 100644 docs/command/atlas-api-cloudBackups-listServerlessBackups.txt create mode 100644 docs/command/atlas-api-cloudBackups-listShardedClusterBackups.txt create mode 100644 docs/command/atlas-api-cloudBackups-takeSnapshot.txt create mode 100644 docs/command/atlas-api-cloudBackups-updateBackupSchedule.txt create mode 100644 docs/command/atlas-api-cloudBackups-updateDataProtectionSettings.txt create mode 100644 docs/command/atlas-api-cloudBackups-updateSnapshotRetention.txt create mode 100644 docs/command/atlas-api-cloudBackups.txt create mode 100644 docs/command/atlas-api-cloudMigrationService-createLinkToken.txt create mode 100644 docs/command/atlas-api-cloudMigrationService-createPushMigration.txt create mode 100644 docs/command/atlas-api-cloudMigrationService-cutoverMigration.txt create mode 100644 docs/command/atlas-api-cloudMigrationService-deleteLinkToken.txt create mode 100644 docs/command/atlas-api-cloudMigrationService-getPushMigration.txt create mode 100644 docs/command/atlas-api-cloudMigrationService-getValidationStatus.txt create mode 100644 docs/command/atlas-api-cloudMigrationService-listSourceProjects.txt create mode 100644 docs/command/atlas-api-cloudMigrationService-validateMigration.txt create mode 100644 docs/command/atlas-api-cloudMigrationService.txt create mode 100644 docs/command/atlas-api-cloudProviderAccess-authorizeCloudProviderAccessRole.txt create mode 100644 docs/command/atlas-api-cloudProviderAccess-createCloudProviderAccessRole.txt create mode 100644 docs/command/atlas-api-cloudProviderAccess-deauthorizeCloudProviderAccessRole.txt create mode 100644 docs/command/atlas-api-cloudProviderAccess-getCloudProviderAccessRole.txt create mode 100644 docs/command/atlas-api-cloudProviderAccess-listCloudProviderAccessRoles.txt create mode 100644 docs/command/atlas-api-cloudProviderAccess.txt create mode 100644 docs/command/atlas-api-clusterOutageSimulation-endOutageSimulation.txt create mode 100644 docs/command/atlas-api-clusterOutageSimulation-getOutageSimulation.txt create mode 100644 docs/command/atlas-api-clusterOutageSimulation-startOutageSimulation.txt create mode 100644 docs/command/atlas-api-clusterOutageSimulation.txt create mode 100644 docs/command/atlas-api-clusters-createCluster.txt create mode 100644 docs/command/atlas-api-clusters-deleteCluster.txt create mode 100644 docs/command/atlas-api-clusters-getCluster.txt create mode 100644 docs/command/atlas-api-clusters-getClusterAdvancedConfiguration.txt create mode 100644 docs/command/atlas-api-clusters-getClusterStatus.txt create mode 100644 docs/command/atlas-api-clusters-getSampleDatasetLoadStatus.txt create mode 100644 docs/command/atlas-api-clusters-listCloudProviderRegions.txt create mode 100644 docs/command/atlas-api-clusters-listClusters.txt create mode 100644 docs/command/atlas-api-clusters-listClustersForAllProjects.txt create mode 100644 docs/command/atlas-api-clusters-loadSampleDataset.txt create mode 100644 docs/command/atlas-api-clusters-testFailover.txt create mode 100644 docs/command/atlas-api-clusters-updateCluster.txt create mode 100644 docs/command/atlas-api-clusters-updateClusterAdvancedConfiguration.txt create mode 100644 docs/command/atlas-api-clusters-upgradeSharedCluster.txt create mode 100644 docs/command/atlas-api-clusters-upgradeSharedClusterToServerless.txt create mode 100644 docs/command/atlas-api-clusters.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceClusterMeasurements.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceHostMeasurements.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceMetrics.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForCluster.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForHost.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-getPinnedNamespaces.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-pinNamespacesPatch.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-pinNamespacesPut.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics-unpinNamespaces.txt create mode 100644 docs/command/atlas-api-collectionLevelMetrics.txt create mode 100644 docs/command/atlas-api-customDatabaseRoles-createCustomDatabaseRole.txt create mode 100644 docs/command/atlas-api-customDatabaseRoles-deleteCustomDatabaseRole.txt create mode 100644 docs/command/atlas-api-customDatabaseRoles-getCustomDatabaseRole.txt create mode 100644 docs/command/atlas-api-customDatabaseRoles-listCustomDatabaseRoles.txt create mode 100644 docs/command/atlas-api-customDatabaseRoles-updateCustomDatabaseRole.txt create mode 100644 docs/command/atlas-api-customDatabaseRoles.txt create mode 100644 docs/command/atlas-api-dataFederation-createDataFederationPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-dataFederation-createFederatedDatabase.txt create mode 100644 docs/command/atlas-api-dataFederation-createOneDataFederationQueryLimit.txt create mode 100644 docs/command/atlas-api-dataFederation-deleteDataFederationPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-dataFederation-deleteFederatedDatabase.txt create mode 100644 docs/command/atlas-api-dataFederation-deleteOneDataFederationInstanceQueryLimit.txt create mode 100644 docs/command/atlas-api-dataFederation-downloadFederatedDatabaseQueryLogs.txt create mode 100644 docs/command/atlas-api-dataFederation-getDataFederationPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-dataFederation-getFederatedDatabase.txt create mode 100644 docs/command/atlas-api-dataFederation-listDataFederationPrivateEndpoints.txt create mode 100644 docs/command/atlas-api-dataFederation-listFederatedDatabases.txt create mode 100644 docs/command/atlas-api-dataFederation-returnFederatedDatabaseQueryLimit.txt create mode 100644 docs/command/atlas-api-dataFederation-returnFederatedDatabaseQueryLimits.txt create mode 100644 docs/command/atlas-api-dataFederation-updateFederatedDatabase.txt create mode 100644 docs/command/atlas-api-dataFederation.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-createPipeline.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-deletePipeline.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-deletePipelineRunDataset.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-getPipeline.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-getPipelineRun.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-listPipelineRuns.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-listPipelineSchedules.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-listPipelineSnapshots.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-listPipelines.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-pausePipeline.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-resumePipeline.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-triggerSnapshotIngestion.txt create mode 100644 docs/command/atlas-api-dataLakePipelines-updatePipeline.txt create mode 100644 docs/command/atlas-api-dataLakePipelines.txt create mode 100644 docs/command/atlas-api-databaseUsers-createDatabaseUser.txt create mode 100644 docs/command/atlas-api-databaseUsers-deleteDatabaseUser.txt create mode 100644 docs/command/atlas-api-databaseUsers-getDatabaseUser.txt create mode 100644 docs/command/atlas-api-databaseUsers-listDatabaseUsers.txt create mode 100644 docs/command/atlas-api-databaseUsers-updateDatabaseUser.txt create mode 100644 docs/command/atlas-api-databaseUsers.txt create mode 100644 docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement-getEncryptionAtRest.txt create mode 100644 docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement-updateEncryptionAtRest.txt create mode 100644 docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement.txt create mode 100644 docs/command/atlas-api-events-getOrganizationEvent.txt create mode 100644 docs/command/atlas-api-events-getProjectEvent.txt create mode 100644 docs/command/atlas-api-events-listOrganizationEvents.txt create mode 100644 docs/command/atlas-api-events-listProjectEvents.txt create mode 100644 docs/command/atlas-api-events.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-createIdentityProvider.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-createRoleMapping.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-deleteFederationApp.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-deleteIdentityProvider.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-deleteRoleMapping.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-getConnectedOrgConfig.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-getFederationSettings.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-getIdentityProvider.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-getIdentityProviderMetadata.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-getRoleMapping.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-listConnectedOrgConfigs.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-listIdentityProviders.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-listRoleMappings.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-removeConnectedOrgConfig.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-revokeJwksFromIdentityProvider.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-updateConnectedOrgConfig.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-updateIdentityProvider.txt create mode 100644 docs/command/atlas-api-federatedAuthentication-updateRoleMapping.txt create mode 100644 docs/command/atlas-api-federatedAuthentication.txt create mode 100644 docs/command/atlas-api-globalClusters-createCustomZoneMapping.txt create mode 100644 docs/command/atlas-api-globalClusters-createManagedNamespace.txt create mode 100644 docs/command/atlas-api-globalClusters-deleteAllCustomZoneMappings.txt create mode 100644 docs/command/atlas-api-globalClusters-deleteManagedNamespace.txt create mode 100644 docs/command/atlas-api-globalClusters-getManagedNamespace.txt create mode 100644 docs/command/atlas-api-globalClusters.txt create mode 100644 docs/command/atlas-api-invoices-createCostExplorerQueryProcess.txt create mode 100644 docs/command/atlas-api-invoices-createCostExplorerQueryProcess1.txt create mode 100644 docs/command/atlas-api-invoices-downloadInvoiceCSV.txt create mode 100644 docs/command/atlas-api-invoices-getInvoice.txt create mode 100644 docs/command/atlas-api-invoices-listInvoices.txt create mode 100644 docs/command/atlas-api-invoices-listPendingInvoices.txt create mode 100644 docs/command/atlas-api-invoices.txt create mode 100644 docs/command/atlas-api-lDAPConfiguration-deleteLDAPConfiguration.txt create mode 100644 docs/command/atlas-api-lDAPConfiguration-getLDAPConfiguration.txt create mode 100644 docs/command/atlas-api-lDAPConfiguration-getLDAPConfigurationStatus.txt create mode 100644 docs/command/atlas-api-lDAPConfiguration-saveLDAPConfiguration.txt create mode 100644 docs/command/atlas-api-lDAPConfiguration-verifyLDAPConfiguration.txt create mode 100644 docs/command/atlas-api-lDAPConfiguration.txt create mode 100644 docs/command/atlas-api-legacyBackup-createLegacyBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-legacyBackup-deleteLegacySnapshot.txt create mode 100644 docs/command/atlas-api-legacyBackup-getLegacyBackupCheckpoint.txt create mode 100644 docs/command/atlas-api-legacyBackup-getLegacyBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-legacyBackup-getLegacySnapshot.txt create mode 100644 docs/command/atlas-api-legacyBackup-getLegacySnapshotSchedule.txt create mode 100644 docs/command/atlas-api-legacyBackup-listLegacyBackupCheckpoints.txt create mode 100644 docs/command/atlas-api-legacyBackup-listLegacyBackupRestoreJobs.txt create mode 100644 docs/command/atlas-api-legacyBackup-listLegacySnapshots.txt create mode 100644 docs/command/atlas-api-legacyBackup-updateLegacySnapshotRetention.txt create mode 100644 docs/command/atlas-api-legacyBackup-updateLegacySnapshotSchedule.txt create mode 100644 docs/command/atlas-api-legacyBackup.txt create mode 100644 docs/command/atlas-api-maintenanceWindows-deferMaintenanceWindow.txt create mode 100644 docs/command/atlas-api-maintenanceWindows-getMaintenanceWindow.txt create mode 100644 docs/command/atlas-api-maintenanceWindows-resetMaintenanceWindow.txt create mode 100644 docs/command/atlas-api-maintenanceWindows-toggleMaintenanceAutoDefer.txt create mode 100644 docs/command/atlas-api-maintenanceWindows-updateMaintenanceWindow.txt create mode 100644 docs/command/atlas-api-maintenanceWindows.txt create mode 100644 docs/command/atlas-api-mongoDBCloudUsers-createUser.txt create mode 100644 docs/command/atlas-api-mongoDBCloudUsers-getUser.txt create mode 100644 docs/command/atlas-api-mongoDBCloudUsers-getUserByUsername.txt create mode 100644 docs/command/atlas-api-mongoDBCloudUsers.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-getAtlasProcess.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-getDatabase.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-getDatabaseMeasurements.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-getDiskMeasurements.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-getHostLogs.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-getHostMeasurements.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-getIndexMetrics.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-getMeasurements.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-listAtlasProcesses.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-listDatabases.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-listDiskMeasurements.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-listDiskPartitions.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-listIndexMetrics.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs-listMetricTypes.txt create mode 100644 docs/command/atlas-api-monitoringAndLogs.txt create mode 100644 docs/command/atlas-api-networkPeering-createPeeringConnection.txt create mode 100644 docs/command/atlas-api-networkPeering-createPeeringContainer.txt create mode 100644 docs/command/atlas-api-networkPeering-deletePeeringConnection.txt create mode 100644 docs/command/atlas-api-networkPeering-deletePeeringContainer.txt create mode 100644 docs/command/atlas-api-networkPeering-disablePeering.txt create mode 100644 docs/command/atlas-api-networkPeering-getPeeringConnection.txt create mode 100644 docs/command/atlas-api-networkPeering-getPeeringContainer.txt create mode 100644 docs/command/atlas-api-networkPeering-listPeeringConnections.txt create mode 100644 docs/command/atlas-api-networkPeering-listPeeringContainerByCloudProvider.txt create mode 100644 docs/command/atlas-api-networkPeering-listPeeringContainers.txt create mode 100644 docs/command/atlas-api-networkPeering-updatePeeringConnection.txt create mode 100644 docs/command/atlas-api-networkPeering-updatePeeringContainer.txt create mode 100644 docs/command/atlas-api-networkPeering-verifyConnectViaPeeringOnlyModeForOneProject.txt create mode 100644 docs/command/atlas-api-networkPeering.txt create mode 100644 docs/command/atlas-api-onlineArchive-createOnlineArchive.txt create mode 100644 docs/command/atlas-api-onlineArchive-deleteOnlineArchive.txt create mode 100644 docs/command/atlas-api-onlineArchive-downloadOnlineArchiveQueryLogs.txt create mode 100644 docs/command/atlas-api-onlineArchive-getOnlineArchive.txt create mode 100644 docs/command/atlas-api-onlineArchive-listOnlineArchives.txt create mode 100644 docs/command/atlas-api-onlineArchive-updateOnlineArchive.txt create mode 100644 docs/command/atlas-api-onlineArchive.txt create mode 100644 docs/command/atlas-api-organizations-createOrganization.txt create mode 100644 docs/command/atlas-api-organizations-createOrganizationInvitation.txt create mode 100644 docs/command/atlas-api-organizations-deleteOrganization.txt create mode 100644 docs/command/atlas-api-organizations-deleteOrganizationInvitation.txt create mode 100644 docs/command/atlas-api-organizations-getOrganization.txt create mode 100644 docs/command/atlas-api-organizations-getOrganizationInvitation.txt create mode 100644 docs/command/atlas-api-organizations-getOrganizationSettings.txt create mode 100644 docs/command/atlas-api-organizations-listOrganizationInvitations.txt create mode 100644 docs/command/atlas-api-organizations-listOrganizationProjects.txt create mode 100644 docs/command/atlas-api-organizations-listOrganizationUsers.txt create mode 100644 docs/command/atlas-api-organizations-listOrganizations.txt create mode 100644 docs/command/atlas-api-organizations-removeOrganizationUser.txt create mode 100644 docs/command/atlas-api-organizations-renameOrganization.txt create mode 100644 docs/command/atlas-api-organizations-updateOrganizationInvitation.txt create mode 100644 docs/command/atlas-api-organizations-updateOrganizationInvitationById.txt create mode 100644 docs/command/atlas-api-organizations-updateOrganizationRoles.txt create mode 100644 docs/command/atlas-api-organizations-updateOrganizationSettings.txt create mode 100644 docs/command/atlas-api-organizations.txt create mode 100644 docs/command/atlas-api-performanceAdvisor-disableSlowOperationThresholding.txt create mode 100644 docs/command/atlas-api-performanceAdvisor-enableSlowOperationThresholding.txt create mode 100644 docs/command/atlas-api-performanceAdvisor-getServerlessAutoIndexing.txt create mode 100644 docs/command/atlas-api-performanceAdvisor-listSlowQueries.txt create mode 100644 docs/command/atlas-api-performanceAdvisor-listSlowQueryNamespaces.txt create mode 100644 docs/command/atlas-api-performanceAdvisor-listSuggestedIndexes.txt create mode 100644 docs/command/atlas-api-performanceAdvisor-setServerlessAutoIndexing.txt create mode 100644 docs/command/atlas-api-performanceAdvisor.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-createPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-createPrivateEndpointService.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-deletePrivateEndpoint.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-deletePrivateEndpointService.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-getPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-getPrivateEndpointService.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-getRegionalizedPrivateEndpointSetting.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-listPrivateEndpointServices.txt create mode 100644 docs/command/atlas-api-privateEndpointServices-toggleRegionalizedPrivateEndpointSetting.txt create mode 100644 docs/command/atlas-api-privateEndpointServices.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-addProjectApiKey.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-createApiKey.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-createApiKeyAccessList.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-createProjectApiKey.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-deleteApiKey.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-deleteApiKeyAccessListEntry.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-getApiKey.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-getApiKeyAccessList.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-listApiKeyAccessListsEntries.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-listApiKeys.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-listProjectApiKeys.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-removeProjectApiKey.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-updateApiKey.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys-updateApiKeyRoles.txt create mode 100644 docs/command/atlas-api-programmaticAPIKeys.txt create mode 100644 docs/command/atlas-api-projectIPAccessList-createProjectIpAccessList.txt create mode 100644 docs/command/atlas-api-projectIPAccessList-deleteProjectIpAccessList.txt create mode 100644 docs/command/atlas-api-projectIPAccessList-getProjectIpAccessListStatus.txt create mode 100644 docs/command/atlas-api-projectIPAccessList-getProjectIpList.txt create mode 100644 docs/command/atlas-api-projectIPAccessList-listProjectIpAccessLists.txt create mode 100644 docs/command/atlas-api-projectIPAccessList.txt create mode 100644 docs/command/atlas-api-projects-addUserToProject.txt create mode 100644 docs/command/atlas-api-projects-createProject.txt create mode 100644 docs/command/atlas-api-projects-createProjectInvitation.txt create mode 100644 docs/command/atlas-api-projects-deleteProject.txt create mode 100644 docs/command/atlas-api-projects-deleteProjectInvitation.txt create mode 100644 docs/command/atlas-api-projects-deleteProjectLimit.txt create mode 100644 docs/command/atlas-api-projects-getProject.txt create mode 100644 docs/command/atlas-api-projects-getProjectByName.txt create mode 100644 docs/command/atlas-api-projects-getProjectInvitation.txt create mode 100644 docs/command/atlas-api-projects-getProjectLimit.txt create mode 100644 docs/command/atlas-api-projects-getProjectSettings.txt create mode 100644 docs/command/atlas-api-projects-listProjectInvitations.txt create mode 100644 docs/command/atlas-api-projects-listProjectLimits.txt create mode 100644 docs/command/atlas-api-projects-listProjectUsers.txt create mode 100644 docs/command/atlas-api-projects-listProjects.txt create mode 100644 docs/command/atlas-api-projects-removeProjectUser.txt create mode 100644 docs/command/atlas-api-projects-returnAllIPAddresses.txt create mode 100644 docs/command/atlas-api-projects-setProjectLimit.txt create mode 100644 docs/command/atlas-api-projects-updateProject.txt create mode 100644 docs/command/atlas-api-projects-updateProjectInvitation.txt create mode 100644 docs/command/atlas-api-projects-updateProjectInvitationById.txt create mode 100644 docs/command/atlas-api-projects-updateProjectRoles.txt create mode 100644 docs/command/atlas-api-projects-updateProjectSettings.txt create mode 100644 docs/command/atlas-api-projects.txt create mode 100644 docs/command/atlas-api-pushBasedLogExport-createPushBasedLogConfiguration.txt create mode 100644 docs/command/atlas-api-pushBasedLogExport-deletePushBasedLogConfiguration.txt create mode 100644 docs/command/atlas-api-pushBasedLogExport-getPushBasedLogConfiguration.txt create mode 100644 docs/command/atlas-api-pushBasedLogExport-updatePushBasedLogConfiguration.txt create mode 100644 docs/command/atlas-api-pushBasedLogExport.txt create mode 100644 docs/command/atlas-api-rollingIndex-createRollingIndex.txt create mode 100644 docs/command/atlas-api-rollingIndex.txt create mode 100644 docs/command/atlas-api-root-getSystemStatus.txt create mode 100644 docs/command/atlas-api-root-returnAllControlPlaneIPAddresses.txt create mode 100644 docs/command/atlas-api-root.txt create mode 100644 docs/command/atlas-api-serverlessInstances-createServerlessInstance.txt create mode 100644 docs/command/atlas-api-serverlessInstances-deleteServerlessInstance.txt create mode 100644 docs/command/atlas-api-serverlessInstances-getServerlessInstance.txt create mode 100644 docs/command/atlas-api-serverlessInstances-listServerlessInstances.txt create mode 100644 docs/command/atlas-api-serverlessInstances-updateServerlessInstance.txt create mode 100644 docs/command/atlas-api-serverlessInstances.txt create mode 100644 docs/command/atlas-api-serverlessPrivateEndpoints-createServerlessPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-serverlessPrivateEndpoints-deleteServerlessPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-serverlessPrivateEndpoints-getServerlessPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-serverlessPrivateEndpoints-listServerlessPrivateEndpoints.txt create mode 100644 docs/command/atlas-api-serverlessPrivateEndpoints-updateServerlessPrivateEndpoint.txt create mode 100644 docs/command/atlas-api-serverlessPrivateEndpoints.txt create mode 100644 docs/command/atlas-api-sharedTierRestoreJobs-createSharedClusterBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-sharedTierRestoreJobs-getSharedClusterBackupRestoreJob.txt create mode 100644 docs/command/atlas-api-sharedTierRestoreJobs-listSharedClusterBackupRestoreJobs.txt create mode 100644 docs/command/atlas-api-sharedTierRestoreJobs.txt create mode 100644 docs/command/atlas-api-sharedTierSnapshots-downloadSharedClusterBackup.txt create mode 100644 docs/command/atlas-api-sharedTierSnapshots-getSharedClusterBackup.txt create mode 100644 docs/command/atlas-api-sharedTierSnapshots-listSharedClusterBackups.txt create mode 100644 docs/command/atlas-api-sharedTierSnapshots.txt create mode 100644 docs/command/atlas-api-streams-createStreamConnection.txt create mode 100644 docs/command/atlas-api-streams-createStreamInstance.txt create mode 100644 docs/command/atlas-api-streams-deleteStreamConnection.txt create mode 100644 docs/command/atlas-api-streams-deleteStreamInstance.txt create mode 100644 docs/command/atlas-api-streams-downloadStreamTenantAuditLogs.txt create mode 100644 docs/command/atlas-api-streams-getStreamConnection.txt create mode 100644 docs/command/atlas-api-streams-getStreamInstance.txt create mode 100644 docs/command/atlas-api-streams-listStreamConnections.txt create mode 100644 docs/command/atlas-api-streams-listStreamInstances.txt create mode 100644 docs/command/atlas-api-streams-updateStreamConnection.txt create mode 100644 docs/command/atlas-api-streams-updateStreamInstance.txt create mode 100644 docs/command/atlas-api-streams.txt create mode 100644 docs/command/atlas-api-teams-addAllTeamsToProject.txt create mode 100644 docs/command/atlas-api-teams-addTeamUser.txt create mode 100644 docs/command/atlas-api-teams-createTeam.txt create mode 100644 docs/command/atlas-api-teams-deleteTeam.txt create mode 100644 docs/command/atlas-api-teams-getTeamById.txt create mode 100644 docs/command/atlas-api-teams-getTeamByName.txt create mode 100644 docs/command/atlas-api-teams-listOrganizationTeams.txt create mode 100644 docs/command/atlas-api-teams-listProjectTeams.txt create mode 100644 docs/command/atlas-api-teams-listTeamUsers.txt create mode 100644 docs/command/atlas-api-teams-removeProjectTeam.txt create mode 100644 docs/command/atlas-api-teams-removeTeamUser.txt create mode 100644 docs/command/atlas-api-teams-renameTeam.txt create mode 100644 docs/command/atlas-api-teams-updateTeamRoles.txt create mode 100644 docs/command/atlas-api-teams.txt create mode 100644 docs/command/atlas-api-thirdPartyIntegrations-createThirdPartyIntegration.txt create mode 100644 docs/command/atlas-api-thirdPartyIntegrations-deleteThirdPartyIntegration.txt create mode 100644 docs/command/atlas-api-thirdPartyIntegrations-getThirdPartyIntegration.txt create mode 100644 docs/command/atlas-api-thirdPartyIntegrations-listThirdPartyIntegrations.txt create mode 100644 docs/command/atlas-api-thirdPartyIntegrations-updateThirdPartyIntegration.txt create mode 100644 docs/command/atlas-api-thirdPartyIntegrations.txt create mode 100644 docs/command/atlas-api-x509Authentication-createDatabaseUserCertificate.txt create mode 100644 docs/command/atlas-api-x509Authentication-disableCustomerManagedX509.txt create mode 100644 docs/command/atlas-api-x509Authentication-listDatabaseUserCertificates.txt create mode 100644 docs/command/atlas-api-x509Authentication.txt create mode 100644 docs/command/atlas-api.txt create mode 100644 internal/api/api_collection_level_metrics_cmd.go delete mode 100644 internal/api/api_legacy_backup_restore_jobs_cmd.go diff --git a/docs/command/atlas-api-aWSClustersDNS-getAWSCustomDNS.txt b/docs/command/atlas-api-aWSClustersDNS-getAWSCustomDNS.txt new file mode 100644 index 0000000000..06224c5fd0 --- /dev/null +++ b/docs/command/atlas-api-aWSClustersDNS-getAWSCustomDNS.txt @@ -0,0 +1,66 @@ +.. _atlas-api-aWSClustersDNS-getAWSCustomDNS: + +======================================== +atlas api aWSClustersDNS getAWSCustomDNS +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Custom DNS Configuration for Atlas Clusters on AWS + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api aWSClustersDNS getAWSCustomDNS [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getAWSCustomDNS + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-aWSClustersDNS-toggleAWSCustomDNS.txt b/docs/command/atlas-api-aWSClustersDNS-toggleAWSCustomDNS.txt new file mode 100644 index 0000000000..52bf2c1558 --- /dev/null +++ b/docs/command/atlas-api-aWSClustersDNS-toggleAWSCustomDNS.txt @@ -0,0 +1,70 @@ +.. _atlas-api-aWSClustersDNS-toggleAWSCustomDNS: + +=========================================== +atlas api aWSClustersDNS toggleAWSCustomDNS +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api aWSClustersDNS toggleAWSCustomDNS [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for toggleAWSCustomDNS + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-aWSClustersDNS.txt b/docs/command/atlas-api-aWSClustersDNS.txt new file mode 100644 index 0000000000..d56b027596 --- /dev/null +++ b/docs/command/atlas-api-aWSClustersDNS.txt @@ -0,0 +1,61 @@ +.. _atlas-api-aWSClustersDNS: + +======================== +atlas api aWSClustersDNS +======================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns and edits custom DNS configurations for MongoDB Cloud database deployments on AWS. The resource requires your Project ID. If you use the VPC peering on AWS and you use your own DNS servers instead of Amazon Route 53, enable custom DNS. Before 31 March 2020, applications deployed within AWS using custom DNS services and VPC-peered with MongoDB Cloud couldn't connect over private IP addresses. Custom DNS resolved to public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for aWSClustersDNS + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-aWSClustersDNS-getAWSCustomDNS` - Return One Custom DNS Configuration for Atlas Clusters on AWS +* :ref:`atlas-api-aWSClustersDNS-toggleAWSCustomDNS` - Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS + + +.. toctree:: + :titlesonly: + + getAWSCustomDNS + toggleAWSCustomDNS + diff --git a/docs/command/atlas-api-accessTracking-listAccessLogsByClusterName.txt b/docs/command/atlas-api-accessTracking-listAccessLogsByClusterName.txt new file mode 100644 index 0000000000..ad3b28a837 --- /dev/null +++ b/docs/command/atlas-api-accessTracking-listAccessLogsByClusterName.txt @@ -0,0 +1,90 @@ +.. _atlas-api-accessTracking-listAccessLogsByClusterName: + +==================================================== +atlas api accessTracking listAccessLogsByClusterName +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Database Access History for One Cluster using Its Cluster Name + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api accessTracking listAccessLogsByClusterName [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --authResult + - + - false + - Flag that indicates whether the response returns the successful authentication attempts only. + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --end + - int + - false + - Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAccessLogsByClusterName + * - --ipAddress + - string + - false + - One Internet Protocol address that attempted to authenticate with the database. + * - --nLogs + - int + - false + - Maximum number of lines from the log to return. This value defaults to 20000. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - int + - false + - Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-accessTracking-listAccessLogsByHostname.txt b/docs/command/atlas-api-accessTracking-listAccessLogsByHostname.txt new file mode 100644 index 0000000000..aff23a2d90 --- /dev/null +++ b/docs/command/atlas-api-accessTracking-listAccessLogsByHostname.txt @@ -0,0 +1,90 @@ +.. _atlas-api-accessTracking-listAccessLogsByHostname: + +================================================= +atlas api accessTracking listAccessLogsByHostname +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Database Access History for One Cluster using Its Hostname + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api accessTracking listAccessLogsByHostname [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --authResult + - + - false + - Flag that indicates whether the response returns the successful authentication attempts only. + * - --end + - int + - false + - Date and time when to stop retrieving database history. If you specify **end**, you must also specify **start**. This parameter uses UNIX epoch time in milliseconds. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAccessLogsByHostname + * - --hostname + - string + - true + - Fully qualified domain name or IP address of the MongoDB host that stores the log files that you want to download. + * - --ipAddress + - string + - false + - One Internet Protocol address that attempted to authenticate with the database. + * - --nLogs + - int + - false + - Maximum number of lines from the log to return. This value defaults to 20000. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - int + - false + - Date and time when MongoDB Cloud begins retrieving database history. If you specify **start**, you must also specify **end**. This parameter uses UNIX epoch time in milliseconds. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-accessTracking.txt b/docs/command/atlas-api-accessTracking.txt new file mode 100644 index 0000000000..1b4e7cf506 --- /dev/null +++ b/docs/command/atlas-api-accessTracking.txt @@ -0,0 +1,61 @@ +.. _atlas-api-accessTracking: + +======================== +atlas api accessTracking +======================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns access logs for authentication attempts made to Atlas database deployments. To view database access history, you must have either the Project Owner or Organization Owner role. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for accessTracking + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-accessTracking-listAccessLogsByClusterName` - Return Database Access History for One Cluster using Its Cluster Name +* :ref:`atlas-api-accessTracking-listAccessLogsByHostname` - Return Database Access History for One Cluster using Its Hostname + + +.. toctree:: + :titlesonly: + + listAccessLogsByClusterName + listAccessLogsByHostname + diff --git a/docs/command/atlas-api-alertConfigurations-createAlertConfiguration.txt b/docs/command/atlas-api-alertConfigurations-createAlertConfiguration.txt new file mode 100644 index 0000000000..26ddccce60 --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations-createAlertConfiguration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-alertConfigurations-createAlertConfiguration: + +====================================================== +atlas api alertConfigurations createAlertConfiguration +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Alert Configuration in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alertConfigurations createAlertConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createAlertConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alertConfigurations-deleteAlertConfiguration.txt b/docs/command/atlas-api-alertConfigurations-deleteAlertConfiguration.txt new file mode 100644 index 0000000000..a86afcc87f --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations-deleteAlertConfiguration.txt @@ -0,0 +1,66 @@ +.. _atlas-api-alertConfigurations-deleteAlertConfiguration: + +====================================================== +atlas api alertConfigurations deleteAlertConfiguration +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Alert Configuration from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alertConfigurations deleteAlertConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --alertConfigId + - string + - true + - Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access. + * - -h, --help + - + - false + - help for deleteAlertConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alertConfigurations-getAlertConfiguration.txt b/docs/command/atlas-api-alertConfigurations-getAlertConfiguration.txt new file mode 100644 index 0000000000..4bb497a712 --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations-getAlertConfiguration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-alertConfigurations-getAlertConfiguration: + +=================================================== +atlas api alertConfigurations getAlertConfiguration +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Alert Configuration from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alertConfigurations getAlertConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --alertConfigId + - string + - true + - Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getAlertConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alertConfigurations-listAlertConfigurationMatchersFieldNames.txt b/docs/command/atlas-api-alertConfigurations-listAlertConfigurationMatchersFieldNames.txt new file mode 100644 index 0000000000..d41de98daf --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations-listAlertConfigurationMatchersFieldNames.txt @@ -0,0 +1,62 @@ +.. _atlas-api-alertConfigurations-listAlertConfigurationMatchersFieldNames: + +====================================================================== +atlas api alertConfigurations listAlertConfigurationMatchersFieldNames +====================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Get All Alert Configuration Matchers Field Names + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alertConfigurations listAlertConfigurationMatchersFieldNames [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAlertConfigurationMatchersFieldNames + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alertConfigurations-listAlertConfigurations.txt b/docs/command/atlas-api-alertConfigurations-listAlertConfigurations.txt new file mode 100644 index 0000000000..30082e15e8 --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations-listAlertConfigurations.txt @@ -0,0 +1,78 @@ +.. _atlas-api-alertConfigurations-listAlertConfigurations: + +===================================================== +atlas api alertConfigurations listAlertConfigurations +===================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Alert Configurations for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alertConfigurations listAlertConfigurations [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAlertConfigurations + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alertConfigurations-listAlertConfigurationsByAlertId.txt b/docs/command/atlas-api-alertConfigurations-listAlertConfigurationsByAlertId.txt new file mode 100644 index 0000000000..e1b3aa82a3 --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations-listAlertConfigurationsByAlertId.txt @@ -0,0 +1,82 @@ +.. _atlas-api-alertConfigurations-listAlertConfigurationsByAlertId: + +============================================================== +atlas api alertConfigurations listAlertConfigurationsByAlertId +============================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Alert Configurations Set for One Alert + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alertConfigurations listAlertConfigurationsByAlertId [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --alertId + - string + - true + - Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAlertConfigurationsByAlertId + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alertConfigurations-toggleAlertConfiguration.txt b/docs/command/atlas-api-alertConfigurations-toggleAlertConfiguration.txt new file mode 100644 index 0000000000..a76e3b098a --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations-toggleAlertConfiguration.txt @@ -0,0 +1,74 @@ +.. _atlas-api-alertConfigurations-toggleAlertConfiguration: + +====================================================== +atlas api alertConfigurations toggleAlertConfiguration +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Toggle One State of One Alert Configuration in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alertConfigurations toggleAlertConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --alertConfigId + - string + - true + - Unique 24-hexadecimal digit string that identifies the alert configuration that triggered this alert. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for toggleAlertConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alertConfigurations-updateAlertConfiguration.txt b/docs/command/atlas-api-alertConfigurations-updateAlertConfiguration.txt new file mode 100644 index 0000000000..bbe3125d5e --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations-updateAlertConfiguration.txt @@ -0,0 +1,74 @@ +.. _atlas-api-alertConfigurations-updateAlertConfiguration: + +====================================================== +atlas api alertConfigurations updateAlertConfiguration +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Alert Configuration for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alertConfigurations updateAlertConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --alertConfigId + - string + - true + - Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateAlertConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alertConfigurations.txt b/docs/command/atlas-api-alertConfigurations.txt new file mode 100644 index 0000000000..09dd75e9af --- /dev/null +++ b/docs/command/atlas-api-alertConfigurations.txt @@ -0,0 +1,73 @@ +.. _atlas-api-alertConfigurations: + +============================= +atlas api alertConfigurations +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for alertConfigurations + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-alertConfigurations-createAlertConfiguration` - Create One Alert Configuration in One Project +* :ref:`atlas-api-alertConfigurations-deleteAlertConfiguration` - Remove One Alert Configuration from One Project +* :ref:`atlas-api-alertConfigurations-getAlertConfiguration` - Return One Alert Configuration from One Project +* :ref:`atlas-api-alertConfigurations-listAlertConfigurationMatchersFieldNames` - Get All Alert Configuration Matchers Field Names +* :ref:`atlas-api-alertConfigurations-listAlertConfigurations` - Return All Alert Configurations for One Project +* :ref:`atlas-api-alertConfigurations-listAlertConfigurationsByAlertId` - Return All Alert Configurations Set for One Alert +* :ref:`atlas-api-alertConfigurations-toggleAlertConfiguration` - Toggle One State of One Alert Configuration in One Project +* :ref:`atlas-api-alertConfigurations-updateAlertConfiguration` - Update One Alert Configuration for One Project + + +.. toctree:: + :titlesonly: + + createAlertConfiguration + deleteAlertConfiguration + getAlertConfiguration + listAlertConfigurationMatchersFieldNames + listAlertConfigurations + listAlertConfigurationsByAlertId + toggleAlertConfiguration + updateAlertConfiguration + diff --git a/docs/command/atlas-api-alerts-acknowledgeAlert.txt b/docs/command/atlas-api-alerts-acknowledgeAlert.txt new file mode 100644 index 0000000000..41888e81cf --- /dev/null +++ b/docs/command/atlas-api-alerts-acknowledgeAlert.txt @@ -0,0 +1,74 @@ +.. _atlas-api-alerts-acknowledgeAlert: + +================================= +atlas api alerts acknowledgeAlert +================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Acknowledge One Alert from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alerts acknowledgeAlert [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --alertId + - string + - true + - Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for acknowledgeAlert + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alerts-getAlert.txt b/docs/command/atlas-api-alerts-getAlert.txt new file mode 100644 index 0000000000..bc55e30190 --- /dev/null +++ b/docs/command/atlas-api-alerts-getAlert.txt @@ -0,0 +1,70 @@ +.. _atlas-api-alerts-getAlert: + +========================= +atlas api alerts getAlert +========================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Alert from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alerts getAlert [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --alertId + - string + - true + - Unique 24-hexadecimal digit string that identifies the alert. Use the [/alerts](#tag/Alerts/operation/listAlerts) endpoint to retrieve all alerts to which the authenticated user has access. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getAlert + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alerts-listAlerts.txt b/docs/command/atlas-api-alerts-listAlerts.txt new file mode 100644 index 0000000000..cba3cc7e9c --- /dev/null +++ b/docs/command/atlas-api-alerts-listAlerts.txt @@ -0,0 +1,82 @@ +.. _atlas-api-alerts-listAlerts: + +=========================== +atlas api alerts listAlerts +=========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Alerts from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alerts listAlerts [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAlerts + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --status + - string + - false + - Status of the alerts to return. Omit to return all alerts in all statuses. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alerts-listAlertsByAlertConfigurationId.txt b/docs/command/atlas-api-alerts-listAlertsByAlertConfigurationId.txt new file mode 100644 index 0000000000..469d558cfa --- /dev/null +++ b/docs/command/atlas-api-alerts-listAlertsByAlertConfigurationId.txt @@ -0,0 +1,82 @@ +.. _atlas-api-alerts-listAlertsByAlertConfigurationId: + +================================================= +atlas api alerts listAlertsByAlertConfigurationId +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Open Alerts for Alert Configuration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api alerts listAlertsByAlertConfigurationId [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --alertConfigId + - string + - true + - Unique 24-hexadecimal digit string that identifies the alert configuration. Use the [/alertConfigs](#tag/Alert-Configurations/operation/listAlertConfigurations) endpoint to retrieve all alert configurations to which the authenticated user has access. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAlertsByAlertConfigurationId + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-alerts.txt b/docs/command/atlas-api-alerts.txt new file mode 100644 index 0000000000..e7cff4af59 --- /dev/null +++ b/docs/command/atlas-api-alerts.txt @@ -0,0 +1,65 @@ +.. _atlas-api-alerts: + +================ +atlas api alerts +================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for alerts + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-alerts-acknowledgeAlert` - Acknowledge One Alert from One Project +* :ref:`atlas-api-alerts-getAlert` - Return One Alert from One Project +* :ref:`atlas-api-alerts-listAlerts` - Return All Alerts from One Project +* :ref:`atlas-api-alerts-listAlertsByAlertConfigurationId` - Return All Open Alerts for Alert Configuration + + +.. toctree:: + :titlesonly: + + acknowledgeAlert + getAlert + listAlerts + listAlertsByAlertConfigurationId + diff --git a/docs/command/atlas-api-atlasSearch-createAtlasSearchDeployment.txt b/docs/command/atlas-api-atlasSearch-createAtlasSearchDeployment.txt new file mode 100644 index 0000000000..9b270b06ba --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-createAtlasSearchDeployment.txt @@ -0,0 +1,74 @@ +.. _atlas-api-atlasSearch-createAtlasSearchDeployment: + +================================================= +atlas api atlasSearch createAtlasSearchDeployment +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create Search Nodes + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch createAtlasSearchDeployment [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Label that identifies the cluster to create Search Nodes for. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createAtlasSearchDeployment + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch-createAtlasSearchIndex.txt b/docs/command/atlas-api-atlasSearch-createAtlasSearchIndex.txt new file mode 100644 index 0000000000..729c820320 --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-createAtlasSearchIndex.txt @@ -0,0 +1,74 @@ +.. _atlas-api-atlasSearch-createAtlasSearchIndex: + +============================================ +atlas api atlasSearch createAtlasSearchIndex +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Atlas Search Index + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch createAtlasSearchIndex [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Name of the cluster that contains the collection on which to create an Atlas Search index. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createAtlasSearchIndex + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch-deleteAtlasSearchDeployment.txt b/docs/command/atlas-api-atlasSearch-deleteAtlasSearchDeployment.txt new file mode 100644 index 0000000000..7825c356b5 --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-deleteAtlasSearchDeployment.txt @@ -0,0 +1,66 @@ +.. _atlas-api-atlasSearch-deleteAtlasSearchDeployment: + +================================================= +atlas api atlasSearch deleteAtlasSearchDeployment +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Delete Search Nodes + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch deleteAtlasSearchDeployment [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Label that identifies the cluster to delete. + * - -h, --help + - + - false + - help for deleteAtlasSearchDeployment + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch-deleteAtlasSearchIndex.txt b/docs/command/atlas-api-atlasSearch-deleteAtlasSearchIndex.txt new file mode 100644 index 0000000000..3e06196302 --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-deleteAtlasSearchIndex.txt @@ -0,0 +1,74 @@ +.. _atlas-api-atlasSearch-deleteAtlasSearchIndex: + +============================================ +atlas api atlasSearch deleteAtlasSearchIndex +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Atlas Search Index + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch deleteAtlasSearchIndex [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Name of the cluster that contains the database and collection with one or more Application Search indexes. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteAtlasSearchIndex + * - --indexId + - string + - true + - Unique 24-hexadecimal digit string that identifies the Atlas Search index. Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch-getAtlasSearchDeployment.txt b/docs/command/atlas-api-atlasSearch-getAtlasSearchDeployment.txt new file mode 100644 index 0000000000..10a76c8f1e --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-getAtlasSearchDeployment.txt @@ -0,0 +1,70 @@ +.. _atlas-api-atlasSearch-getAtlasSearchDeployment: + +============================================== +atlas api atlasSearch getAtlasSearchDeployment +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Search Nodes + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch getAtlasSearchDeployment [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Label that identifies the cluster to return the Search Nodes for. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getAtlasSearchDeployment + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch-getAtlasSearchIndex.txt b/docs/command/atlas-api-atlasSearch-getAtlasSearchIndex.txt new file mode 100644 index 0000000000..d62fb3c70b --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-getAtlasSearchIndex.txt @@ -0,0 +1,74 @@ +.. _atlas-api-atlasSearch-getAtlasSearchIndex: + +========================================= +atlas api atlasSearch getAtlasSearchIndex +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Atlas Search Index + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch getAtlasSearchIndex [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Name of the cluster that contains the collection with one or more Atlas Search indexes. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getAtlasSearchIndex + * - --indexId + - string + - true + - Unique 24-hexadecimal digit string that identifies the Application Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Application Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Application Search indexes. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch-listAtlasSearchIndexes.txt b/docs/command/atlas-api-atlasSearch-listAtlasSearchIndexes.txt new file mode 100644 index 0000000000..19d2fed3dd --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-listAtlasSearchIndexes.txt @@ -0,0 +1,78 @@ +.. _atlas-api-atlasSearch-listAtlasSearchIndexes: + +============================================ +atlas api atlasSearch listAtlasSearchIndexes +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Atlas Search Indexes for One Collection + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch listAtlasSearchIndexes [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Name of the cluster that contains the collection with one or more Atlas Search indexes. + * - --collectionName + - string + - true + - Name of the collection that contains one or more Atlas Search indexes. + * - --databaseName + - string + - true + - Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAtlasSearchIndexes + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch-updateAtlasSearchDeployment.txt b/docs/command/atlas-api-atlasSearch-updateAtlasSearchDeployment.txt new file mode 100644 index 0000000000..2bb2f2c422 --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-updateAtlasSearchDeployment.txt @@ -0,0 +1,74 @@ +.. _atlas-api-atlasSearch-updateAtlasSearchDeployment: + +================================================= +atlas api atlasSearch updateAtlasSearchDeployment +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Search Nodes + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch updateAtlasSearchDeployment [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Label that identifies the cluster to update the Search Nodes for. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateAtlasSearchDeployment + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch-updateAtlasSearchIndex.txt b/docs/command/atlas-api-atlasSearch-updateAtlasSearchIndex.txt new file mode 100644 index 0000000000..07510b44ad --- /dev/null +++ b/docs/command/atlas-api-atlasSearch-updateAtlasSearchIndex.txt @@ -0,0 +1,78 @@ +.. _atlas-api-atlasSearch-updateAtlasSearchIndex: + +============================================ +atlas api atlasSearch updateAtlasSearchIndex +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Atlas Search Index + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api atlasSearch updateAtlasSearchIndex [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Name of the cluster that contains the collection whose Atlas Search index to update. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateAtlasSearchIndex + * - --indexId + - string + - true + - Unique 24-hexadecimal digit string that identifies the Atlas Search [index](https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/). Use the [Get All Atlas Search Indexes for a Collection API](https://docs.atlas.mongodb.com/reference/api/fts-indexes-get-all/) endpoint to find the IDs of all Atlas Search indexes. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-atlasSearch.txt b/docs/command/atlas-api-atlasSearch.txt new file mode 100644 index 0000000000..a8436ab186 --- /dev/null +++ b/docs/command/atlas-api-atlasSearch.txt @@ -0,0 +1,75 @@ +.. _atlas-api-atlasSearch: + +===================== +atlas api atlasSearch +===================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for atlasSearch + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-atlasSearch-createAtlasSearchDeployment` - Create Search Nodes +* :ref:`atlas-api-atlasSearch-createAtlasSearchIndex` - Create One Atlas Search Index +* :ref:`atlas-api-atlasSearch-deleteAtlasSearchDeployment` - Delete Search Nodes +* :ref:`atlas-api-atlasSearch-deleteAtlasSearchIndex` - Remove One Atlas Search Index +* :ref:`atlas-api-atlasSearch-getAtlasSearchDeployment` - Return Search Nodes +* :ref:`atlas-api-atlasSearch-getAtlasSearchIndex` - Return One Atlas Search Index +* :ref:`atlas-api-atlasSearch-listAtlasSearchIndexes` - Return All Atlas Search Indexes for One Collection +* :ref:`atlas-api-atlasSearch-updateAtlasSearchDeployment` - Update Search Nodes +* :ref:`atlas-api-atlasSearch-updateAtlasSearchIndex` - Update One Atlas Search Index + + +.. toctree:: + :titlesonly: + + createAtlasSearchDeployment + createAtlasSearchIndex + deleteAtlasSearchDeployment + deleteAtlasSearchIndex + getAtlasSearchDeployment + getAtlasSearchIndex + listAtlasSearchIndexes + updateAtlasSearchDeployment + updateAtlasSearchIndex + diff --git a/docs/command/atlas-api-auditing-getAuditingConfiguration.txt b/docs/command/atlas-api-auditing-getAuditingConfiguration.txt new file mode 100644 index 0000000000..e76b186f18 --- /dev/null +++ b/docs/command/atlas-api-auditing-getAuditingConfiguration.txt @@ -0,0 +1,66 @@ +.. _atlas-api-auditing-getAuditingConfiguration: + +=========================================== +atlas api auditing getAuditingConfiguration +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return the Auditing Configuration for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api auditing getAuditingConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getAuditingConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-auditing-updateAuditingConfiguration.txt b/docs/command/atlas-api-auditing-updateAuditingConfiguration.txt new file mode 100644 index 0000000000..c18031c8e4 --- /dev/null +++ b/docs/command/atlas-api-auditing-updateAuditingConfiguration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-auditing-updateAuditingConfiguration: + +============================================== +atlas api auditing updateAuditingConfiguration +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Auditing Configuration for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api auditing updateAuditingConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateAuditingConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-auditing.txt b/docs/command/atlas-api-auditing.txt new file mode 100644 index 0000000000..0719db2c54 --- /dev/null +++ b/docs/command/atlas-api-auditing.txt @@ -0,0 +1,61 @@ +.. _atlas-api-auditing: + +================== +atlas api auditing +================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns and edits database auditing settings for MongoDB Cloud projects. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for auditing + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-auditing-getAuditingConfiguration` - Return the Auditing Configuration for One Project +* :ref:`atlas-api-auditing-updateAuditingConfiguration` - Update Auditing Configuration for One Project + + +.. toctree:: + :titlesonly: + + getAuditingConfiguration + updateAuditingConfiguration + diff --git a/docs/command/atlas-api-cloudBackups-cancelBackupRestoreJob.txt b/docs/command/atlas-api-cloudBackups-cancelBackupRestoreJob.txt new file mode 100644 index 0000000000..929818beef --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-cancelBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-cancelBackupRestoreJob: + +============================================= +atlas api cloudBackups cancelBackupRestoreJob +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Cancel One Restore Job of One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups cancelBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for cancelBackupRestoreJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --restoreJobId + - string + - true + - Unique 24-hexadecimal digit string that identifies the restore job to remove. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-createBackupExportJob.txt b/docs/command/atlas-api-cloudBackups-createBackupExportJob.txt new file mode 100644 index 0000000000..e3d7e60952 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-createBackupExportJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-createBackupExportJob: + +============================================ +atlas api cloudBackups createBackupExportJob +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Cloud Backup Snapshot Export Job + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups createBackupExportJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createBackupExportJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-createBackupRestoreJob.txt b/docs/command/atlas-api-cloudBackups-createBackupRestoreJob.txt new file mode 100644 index 0000000000..52b88b5bd1 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-createBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-createBackupRestoreJob: + +============================================= +atlas api cloudBackups createBackupRestoreJob +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Restore One Snapshot of One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups createBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createBackupRestoreJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-createExportBucket.txt b/docs/command/atlas-api-cloudBackups-createExportBucket.txt new file mode 100644 index 0000000000..0a35419e32 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-createExportBucket.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudBackups-createExportBucket: + +========================================= +atlas api cloudBackups createExportBucket +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups createExportBucket [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createExportBucket + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-createServerlessBackupRestoreJob.txt b/docs/command/atlas-api-cloudBackups-createServerlessBackupRestoreJob.txt new file mode 100644 index 0000000000..fa84398870 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-createServerlessBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-createServerlessBackupRestoreJob: + +======================================================= +atlas api cloudBackups createServerlessBackupRestoreJob +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Restore One Snapshot of One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups createServerlessBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the serverless instance whose snapshot you want to restore. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createServerlessBackupRestoreJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-deleteAllBackupSchedules.txt b/docs/command/atlas-api-cloudBackups-deleteAllBackupSchedules.txt new file mode 100644 index 0000000000..06d24ef67d --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-deleteAllBackupSchedules.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudBackups-deleteAllBackupSchedules: + +=============================================== +atlas api cloudBackups deleteAllBackupSchedules +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove All Cloud Backup Schedules + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups deleteAllBackupSchedules [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteAllBackupSchedules + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-deleteExportBucket.txt b/docs/command/atlas-api-cloudBackups-deleteExportBucket.txt new file mode 100644 index 0000000000..0efcaf6898 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-deleteExportBucket.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudBackups-deleteExportBucket: + +========================================= +atlas api cloudBackups deleteExportBucket +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups deleteExportBucket [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --exportBucketId + - string + - true + - Unique string that identifies the AWS S3 bucket to which you export your snapshots. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteExportBucket + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-deleteReplicaSetBackup.txt b/docs/command/atlas-api-cloudBackups-deleteReplicaSetBackup.txt new file mode 100644 index 0000000000..309598beab --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-deleteReplicaSetBackup.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-deleteReplicaSetBackup: + +============================================= +atlas api cloudBackups deleteReplicaSetBackup +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Replica Set Cloud Backup + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups deleteReplicaSetBackup [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteReplicaSetBackup + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-deleteShardedClusterBackup.txt b/docs/command/atlas-api-cloudBackups-deleteShardedClusterBackup.txt new file mode 100644 index 0000000000..1cc430196a --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-deleteShardedClusterBackup.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-deleteShardedClusterBackup: + +================================================= +atlas api cloudBackups deleteShardedClusterBackup +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Sharded Cluster Cloud Backup + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups deleteShardedClusterBackup [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteShardedClusterBackup + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getBackupExportJob.txt b/docs/command/atlas-api-cloudBackups-getBackupExportJob.txt new file mode 100644 index 0000000000..6716b5b305 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getBackupExportJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-getBackupExportJob: + +========================================= +atlas api cloudBackups getBackupExportJob +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Cloud Backup Snapshot Export Job + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getBackupExportJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --exportId + - string + - true + - Unique string that identifies the AWS S3 bucket to which you export your snapshots. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getBackupExportJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getBackupRestoreJob.txt b/docs/command/atlas-api-cloudBackups-getBackupRestoreJob.txt new file mode 100644 index 0000000000..083b1b5fdb --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-getBackupRestoreJob: + +========================================== +atlas api cloudBackups getBackupRestoreJob +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Restore Job of One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster with the restore jobs you want to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getBackupRestoreJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --restoreJobId + - string + - true + - Unique 24-hexadecimal digit string that identifies the restore job to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getBackupSchedule.txt b/docs/command/atlas-api-cloudBackups-getBackupSchedule.txt new file mode 100644 index 0000000000..48e049457b --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getBackupSchedule.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudBackups-getBackupSchedule: + +======================================== +atlas api cloudBackups getBackupSchedule +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Cloud Backup Schedule + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getBackupSchedule [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getBackupSchedule + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getDataProtectionSettings.txt b/docs/command/atlas-api-cloudBackups-getDataProtectionSettings.txt new file mode 100644 index 0000000000..5d4b89d7fe --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getDataProtectionSettings.txt @@ -0,0 +1,66 @@ +.. _atlas-api-cloudBackups-getDataProtectionSettings: + +================================================ +atlas api cloudBackups getDataProtectionSettings +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return the Backup Compliance Policy settings + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getDataProtectionSettings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getDataProtectionSettings + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getExportBucket.txt b/docs/command/atlas-api-cloudBackups-getExportBucket.txt new file mode 100644 index 0000000000..9d32cfb9c5 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getExportBucket.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudBackups-getExportBucket: + +====================================== +atlas api cloudBackups getExportBucket +====================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getExportBucket [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --exportBucketId + - string + - true + - Unique string that identifies the AWS S3 bucket to which you export your snapshots. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getExportBucket + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getReplicaSetBackup.txt b/docs/command/atlas-api-cloudBackups-getReplicaSetBackup.txt new file mode 100644 index 0000000000..3e4181d2c6 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getReplicaSetBackup.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-getReplicaSetBackup: + +========================================== +atlas api cloudBackups getReplicaSetBackup +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Replica Set Cloud Backup + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getReplicaSetBackup [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getReplicaSetBackup + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getServerlessBackup.txt b/docs/command/atlas-api-cloudBackups-getServerlessBackup.txt new file mode 100644 index 0000000000..00288b4fd7 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getServerlessBackup.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-getServerlessBackup: + +========================================== +atlas api cloudBackups getServerlessBackup +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Snapshot of One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getServerlessBackup [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the serverless instance. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getServerlessBackup + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getServerlessBackupRestoreJob.txt b/docs/command/atlas-api-cloudBackups-getServerlessBackupRestoreJob.txt new file mode 100644 index 0000000000..56f71e05ab --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getServerlessBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-getServerlessBackupRestoreJob: + +==================================================== +atlas api cloudBackups getServerlessBackupRestoreJob +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Restore Job for One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getServerlessBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the serverless instance. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getServerlessBackupRestoreJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --restoreJobId + - string + - true + - Unique 24-hexadecimal digit string that identifies the restore job to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-getShardedClusterBackup.txt b/docs/command/atlas-api-cloudBackups-getShardedClusterBackup.txt new file mode 100644 index 0000000000..6d4330b54f --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-getShardedClusterBackup.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-getShardedClusterBackup: + +============================================== +atlas api cloudBackups getShardedClusterBackup +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Sharded Cluster Cloud Backup + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups getShardedClusterBackup [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getShardedClusterBackup + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-listBackupExportJobs.txt b/docs/command/atlas-api-cloudBackups-listBackupExportJobs.txt new file mode 100644 index 0000000000..040ba95679 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-listBackupExportJobs.txt @@ -0,0 +1,82 @@ +.. _atlas-api-cloudBackups-listBackupExportJobs: + +=========================================== +atlas api cloudBackups listBackupExportJobs +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Cloud Backup Snapshot Export Jobs + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups listBackupExportJobs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listBackupExportJobs + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-listBackupRestoreJobs.txt b/docs/command/atlas-api-cloudBackups-listBackupRestoreJobs.txt new file mode 100644 index 0000000000..768b8752e3 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-listBackupRestoreJobs.txt @@ -0,0 +1,82 @@ +.. _atlas-api-cloudBackups-listBackupRestoreJobs: + +============================================ +atlas api cloudBackups listBackupRestoreJobs +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Restore Jobs for One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups listBackupRestoreJobs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster with the restore jobs you want to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listBackupRestoreJobs + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-listExportBuckets.txt b/docs/command/atlas-api-cloudBackups-listExportBuckets.txt new file mode 100644 index 0000000000..2de4d994d9 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-listExportBuckets.txt @@ -0,0 +1,78 @@ +.. _atlas-api-cloudBackups-listExportBuckets: + +======================================== +atlas api cloudBackups listExportBuckets +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups listExportBuckets [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listExportBuckets + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-listReplicaSetBackups.txt b/docs/command/atlas-api-cloudBackups-listReplicaSetBackups.txt new file mode 100644 index 0000000000..2948d0fc67 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-listReplicaSetBackups.txt @@ -0,0 +1,82 @@ +.. _atlas-api-cloudBackups-listReplicaSetBackups: + +============================================ +atlas api cloudBackups listReplicaSetBackups +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Replica Set Cloud Backups + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups listReplicaSetBackups [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listReplicaSetBackups + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-listServerlessBackupRestoreJobs.txt b/docs/command/atlas-api-cloudBackups-listServerlessBackupRestoreJobs.txt new file mode 100644 index 0000000000..95d85819f0 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-listServerlessBackupRestoreJobs.txt @@ -0,0 +1,82 @@ +.. _atlas-api-cloudBackups-listServerlessBackupRestoreJobs: + +====================================================== +atlas api cloudBackups listServerlessBackupRestoreJobs +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Restore Jobs for One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups listServerlessBackupRestoreJobs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the serverless instance. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listServerlessBackupRestoreJobs + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-listServerlessBackups.txt b/docs/command/atlas-api-cloudBackups-listServerlessBackups.txt new file mode 100644 index 0000000000..37abd2edc2 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-listServerlessBackups.txt @@ -0,0 +1,82 @@ +.. _atlas-api-cloudBackups-listServerlessBackups: + +============================================ +atlas api cloudBackups listServerlessBackups +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Snapshots of One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups listServerlessBackups [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the serverless instance. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listServerlessBackups + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-listShardedClusterBackups.txt b/docs/command/atlas-api-cloudBackups-listShardedClusterBackups.txt new file mode 100644 index 0000000000..f069f2738d --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-listShardedClusterBackups.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudBackups-listShardedClusterBackups: + +================================================ +atlas api cloudBackups listShardedClusterBackups +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Sharded Cluster Cloud Backups + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups listShardedClusterBackups [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listShardedClusterBackups + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-takeSnapshot.txt b/docs/command/atlas-api-cloudBackups-takeSnapshot.txt new file mode 100644 index 0000000000..d2c1b98410 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-takeSnapshot.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-takeSnapshot: + +=================================== +atlas api cloudBackups takeSnapshot +=================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Take One On-Demand Snapshot + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups takeSnapshot [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for takeSnapshot + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-updateBackupSchedule.txt b/docs/command/atlas-api-cloudBackups-updateBackupSchedule.txt new file mode 100644 index 0000000000..7139c887f8 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-updateBackupSchedule.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-updateBackupSchedule: + +=========================================== +atlas api cloudBackups updateBackupSchedule +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Cloud Backup Schedule for One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups updateBackupSchedule [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateBackupSchedule + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-updateDataProtectionSettings.txt b/docs/command/atlas-api-cloudBackups-updateDataProtectionSettings.txt new file mode 100644 index 0000000000..64fd67ccca --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-updateDataProtectionSettings.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudBackups-updateDataProtectionSettings: + +=================================================== +atlas api cloudBackups updateDataProtectionSettings +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update or enable the Backup Compliance Policy settings + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups updateDataProtectionSettings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateDataProtectionSettings + * - --overwriteBackupPolicies + - + - false + - Flag that indicates whether to overwrite non complying backup policies with the new data protection settings or not. This value defaults to true. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups-updateSnapshotRetention.txt b/docs/command/atlas-api-cloudBackups-updateSnapshotRetention.txt new file mode 100644 index 0000000000..6309086749 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups-updateSnapshotRetention.txt @@ -0,0 +1,78 @@ +.. _atlas-api-cloudBackups-updateSnapshotRetention: + +============================================== +atlas api cloudBackups updateSnapshotRetention +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Change Expiration Date for One Cloud Backup + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudBackups updateSnapshotRetention [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateSnapshotRetention + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudBackups.txt b/docs/command/atlas-api-cloudBackups.txt new file mode 100644 index 0000000000..f54fdbfc68 --- /dev/null +++ b/docs/command/atlas-api-cloudBackups.txt @@ -0,0 +1,115 @@ +.. _atlas-api-cloudBackups: + +====================== +atlas api cloudBackups +====================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for cloudBackups + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-cloudBackups-cancelBackupRestoreJob` - Cancel One Restore Job of One Cluster +* :ref:`atlas-api-cloudBackups-createBackupExportJob` - Create One Cloud Backup Snapshot Export Job +* :ref:`atlas-api-cloudBackups-createBackupRestoreJob` - Restore One Snapshot of One Cluster +* :ref:`atlas-api-cloudBackups-createExportBucket` - Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports +* :ref:`atlas-api-cloudBackups-createServerlessBackupRestoreJob` - Restore One Snapshot of One Serverless Instance +* :ref:`atlas-api-cloudBackups-deleteAllBackupSchedules` - Remove All Cloud Backup Schedules +* :ref:`atlas-api-cloudBackups-deleteExportBucket` - Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports +* :ref:`atlas-api-cloudBackups-deleteReplicaSetBackup` - Remove One Replica Set Cloud Backup +* :ref:`atlas-api-cloudBackups-deleteShardedClusterBackup` - Remove One Sharded Cluster Cloud Backup +* :ref:`atlas-api-cloudBackups-getBackupExportJob` - Return One Cloud Backup Snapshot Export Job +* :ref:`atlas-api-cloudBackups-getBackupRestoreJob` - Return One Restore Job of One Cluster +* :ref:`atlas-api-cloudBackups-getBackupSchedule` - Return One Cloud Backup Schedule +* :ref:`atlas-api-cloudBackups-getDataProtectionSettings` - Return the Backup Compliance Policy settings +* :ref:`atlas-api-cloudBackups-getExportBucket` - Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports +* :ref:`atlas-api-cloudBackups-getReplicaSetBackup` - Return One Replica Set Cloud Backup +* :ref:`atlas-api-cloudBackups-getServerlessBackup` - Return One Snapshot of One Serverless Instance +* :ref:`atlas-api-cloudBackups-getServerlessBackupRestoreJob` - Return One Restore Job for One Serverless Instance +* :ref:`atlas-api-cloudBackups-getShardedClusterBackup` - Return One Sharded Cluster Cloud Backup +* :ref:`atlas-api-cloudBackups-listBackupExportJobs` - Return All Cloud Backup Snapshot Export Jobs +* :ref:`atlas-api-cloudBackups-listBackupRestoreJobs` - Return All Restore Jobs for One Cluster +* :ref:`atlas-api-cloudBackups-listExportBuckets` - Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports +* :ref:`atlas-api-cloudBackups-listReplicaSetBackups` - Return All Replica Set Cloud Backups +* :ref:`atlas-api-cloudBackups-listServerlessBackupRestoreJobs` - Return All Restore Jobs for One Serverless Instance +* :ref:`atlas-api-cloudBackups-listServerlessBackups` - Return All Snapshots of One Serverless Instance +* :ref:`atlas-api-cloudBackups-listShardedClusterBackups` - Return All Sharded Cluster Cloud Backups +* :ref:`atlas-api-cloudBackups-takeSnapshot` - Take One On-Demand Snapshot +* :ref:`atlas-api-cloudBackups-updateBackupSchedule` - Update Cloud Backup Schedule for One Cluster +* :ref:`atlas-api-cloudBackups-updateDataProtectionSettings` - Update or enable the Backup Compliance Policy settings +* :ref:`atlas-api-cloudBackups-updateSnapshotRetention` - Change Expiration Date for One Cloud Backup + + +.. toctree:: + :titlesonly: + + cancelBackupRestoreJob + createBackupExportJob + createBackupRestoreJob + createExportBucket + createServerlessBackupRestoreJob + deleteAllBackupSchedules + deleteExportBucket + deleteReplicaSetBackup + deleteShardedClusterBackup + getBackupExportJob + getBackupRestoreJob + getBackupSchedule + getDataProtectionSettings + getExportBucket + getReplicaSetBackup + getServerlessBackup + getServerlessBackupRestoreJob + getShardedClusterBackup + listBackupExportJobs + listBackupRestoreJobs + listExportBuckets + listReplicaSetBackups + listServerlessBackupRestoreJobs + listServerlessBackups + listShardedClusterBackups + takeSnapshot + updateBackupSchedule + updateDataProtectionSettings + updateSnapshotRetention + diff --git a/docs/command/atlas-api-cloudMigrationService-createLinkToken.txt b/docs/command/atlas-api-cloudMigrationService-createLinkToken.txt new file mode 100644 index 0000000000..fbd7fb5d34 --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService-createLinkToken.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudMigrationService-createLinkToken: + +=============================================== +atlas api cloudMigrationService createLinkToken +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Link-Token + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudMigrationService createLinkToken [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createLinkToken + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudMigrationService-createPushMigration.txt b/docs/command/atlas-api-cloudMigrationService-createPushMigration.txt new file mode 100644 index 0000000000..1b711e7cfc --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService-createPushMigration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudMigrationService-createPushMigration: + +=================================================== +atlas api cloudMigrationService createPushMigration +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Migrate One Local Managed Cluster to MongoDB Atlas + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudMigrationService createPushMigration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createPushMigration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudMigrationService-cutoverMigration.txt b/docs/command/atlas-api-cloudMigrationService-cutoverMigration.txt new file mode 100644 index 0000000000..6480deb2d3 --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService-cutoverMigration.txt @@ -0,0 +1,66 @@ +.. _atlas-api-cloudMigrationService-cutoverMigration: + +================================================ +atlas api cloudMigrationService cutoverMigration +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Cut Over the Migrated Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudMigrationService cutoverMigration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for cutoverMigration + * - --liveMigrationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the migration. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudMigrationService-deleteLinkToken.txt b/docs/command/atlas-api-cloudMigrationService-deleteLinkToken.txt new file mode 100644 index 0000000000..6d7ff6364f --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService-deleteLinkToken.txt @@ -0,0 +1,66 @@ +.. _atlas-api-cloudMigrationService-deleteLinkToken: + +=============================================== +atlas api cloudMigrationService deleteLinkToken +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Link-Token + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudMigrationService deleteLinkToken [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteLinkToken + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudMigrationService-getPushMigration.txt b/docs/command/atlas-api-cloudMigrationService-getPushMigration.txt new file mode 100644 index 0000000000..99e3b12eda --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService-getPushMigration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudMigrationService-getPushMigration: + +================================================ +atlas api cloudMigrationService getPushMigration +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Migration Job + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudMigrationService getPushMigration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPushMigration + * - --liveMigrationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the migration. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudMigrationService-getValidationStatus.txt b/docs/command/atlas-api-cloudMigrationService-getValidationStatus.txt new file mode 100644 index 0000000000..5b6106c148 --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService-getValidationStatus.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudMigrationService-getValidationStatus: + +=================================================== +atlas api cloudMigrationService getValidationStatus +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Migration Validation Job + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudMigrationService getValidationStatus [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getValidationStatus + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --validationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the validation job. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudMigrationService-listSourceProjects.txt b/docs/command/atlas-api-cloudMigrationService-listSourceProjects.txt new file mode 100644 index 0000000000..a5ada12bd4 --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService-listSourceProjects.txt @@ -0,0 +1,66 @@ +.. _atlas-api-cloudMigrationService-listSourceProjects: + +================================================== +atlas api cloudMigrationService listSourceProjects +================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Projects Available for Migration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudMigrationService listSourceProjects [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listSourceProjects + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudMigrationService-validateMigration.txt b/docs/command/atlas-api-cloudMigrationService-validateMigration.txt new file mode 100644 index 0000000000..d941d54156 --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService-validateMigration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudMigrationService-validateMigration: + +================================================= +atlas api cloudMigrationService validateMigration +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Validate One Migration Request + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudMigrationService validateMigration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for validateMigration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudMigrationService.txt b/docs/command/atlas-api-cloudMigrationService.txt new file mode 100644 index 0000000000..087f6e5081 --- /dev/null +++ b/docs/command/atlas-api-cloudMigrationService.txt @@ -0,0 +1,73 @@ +.. _atlas-api-cloudMigrationService: + +=============================== +atlas api cloudMigrationService +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for cloudMigrationService + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-cloudMigrationService-createLinkToken` - Create One Link-Token +* :ref:`atlas-api-cloudMigrationService-createPushMigration` - Migrate One Local Managed Cluster to MongoDB Atlas +* :ref:`atlas-api-cloudMigrationService-cutoverMigration` - Cut Over the Migrated Cluster +* :ref:`atlas-api-cloudMigrationService-deleteLinkToken` - Remove One Link-Token +* :ref:`atlas-api-cloudMigrationService-getPushMigration` - Return One Migration Job +* :ref:`atlas-api-cloudMigrationService-getValidationStatus` - Return One Migration Validation Job +* :ref:`atlas-api-cloudMigrationService-listSourceProjects` - Return All Projects Available for Migration +* :ref:`atlas-api-cloudMigrationService-validateMigration` - Validate One Migration Request + + +.. toctree:: + :titlesonly: + + createLinkToken + createPushMigration + cutoverMigration + deleteLinkToken + getPushMigration + getValidationStatus + listSourceProjects + validateMigration + diff --git a/docs/command/atlas-api-cloudProviderAccess-authorizeCloudProviderAccessRole.txt b/docs/command/atlas-api-cloudProviderAccess-authorizeCloudProviderAccessRole.txt new file mode 100644 index 0000000000..1690409297 --- /dev/null +++ b/docs/command/atlas-api-cloudProviderAccess-authorizeCloudProviderAccessRole.txt @@ -0,0 +1,74 @@ +.. _atlas-api-cloudProviderAccess-authorizeCloudProviderAccessRole: + +============================================================== +atlas api cloudProviderAccess authorizeCloudProviderAccessRole +============================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Authorize One Cloud Provider Access Role + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudProviderAccess authorizeCloudProviderAccessRole [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for authorizeCloudProviderAccessRole + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --roleId + - string + - true + - Unique 24-hexadecimal digit string that identifies the role. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudProviderAccess-createCloudProviderAccessRole.txt b/docs/command/atlas-api-cloudProviderAccess-createCloudProviderAccessRole.txt new file mode 100644 index 0000000000..93988f0d7c --- /dev/null +++ b/docs/command/atlas-api-cloudProviderAccess-createCloudProviderAccessRole.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudProviderAccess-createCloudProviderAccessRole: + +=========================================================== +atlas api cloudProviderAccess createCloudProviderAccessRole +=========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Cloud Provider Access Role + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudProviderAccess createCloudProviderAccessRole [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createCloudProviderAccessRole + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudProviderAccess-deauthorizeCloudProviderAccessRole.txt b/docs/command/atlas-api-cloudProviderAccess-deauthorizeCloudProviderAccessRole.txt new file mode 100644 index 0000000000..41ca4ec220 --- /dev/null +++ b/docs/command/atlas-api-cloudProviderAccess-deauthorizeCloudProviderAccessRole.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudProviderAccess-deauthorizeCloudProviderAccessRole: + +================================================================ +atlas api cloudProviderAccess deauthorizeCloudProviderAccessRole +================================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Deauthorize One Cloud Provider Access Role + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudProviderAccess deauthorizeCloudProviderAccessRole [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --cloudProvider + - string + - true + - Human-readable label that identifies the cloud provider of the role to deauthorize. + * - -h, --help + - + - false + - help for deauthorizeCloudProviderAccessRole + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --roleId + - string + - true + - Unique 24-hexadecimal digit string that identifies the role. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudProviderAccess-getCloudProviderAccessRole.txt b/docs/command/atlas-api-cloudProviderAccess-getCloudProviderAccessRole.txt new file mode 100644 index 0000000000..c463cb20bb --- /dev/null +++ b/docs/command/atlas-api-cloudProviderAccess-getCloudProviderAccessRole.txt @@ -0,0 +1,70 @@ +.. _atlas-api-cloudProviderAccess-getCloudProviderAccessRole: + +======================================================== +atlas api cloudProviderAccess getCloudProviderAccessRole +======================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return specified Cloud Provider Access Role + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudProviderAccess getCloudProviderAccessRole [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getCloudProviderAccessRole + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --roleId + - string + - true + - Unique 24-hexadecimal digit string that identifies the role. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudProviderAccess-listCloudProviderAccessRoles.txt b/docs/command/atlas-api-cloudProviderAccess-listCloudProviderAccessRoles.txt new file mode 100644 index 0000000000..b102fe0f66 --- /dev/null +++ b/docs/command/atlas-api-cloudProviderAccess-listCloudProviderAccessRoles.txt @@ -0,0 +1,66 @@ +.. _atlas-api-cloudProviderAccess-listCloudProviderAccessRoles: + +========================================================== +atlas api cloudProviderAccess listCloudProviderAccessRoles +========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Cloud Provider Access Roles + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api cloudProviderAccess listCloudProviderAccessRoles [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listCloudProviderAccessRoles + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-cloudProviderAccess.txt b/docs/command/atlas-api-cloudProviderAccess.txt new file mode 100644 index 0000000000..76d37aba95 --- /dev/null +++ b/docs/command/atlas-api-cloudProviderAccess.txt @@ -0,0 +1,67 @@ +.. _atlas-api-cloudProviderAccess: + +============================= +atlas api cloudProviderAccess +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, authorizes, and removes AWS IAM roles in Atlas. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for cloudProviderAccess + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-cloudProviderAccess-authorizeCloudProviderAccessRole` - Authorize One Cloud Provider Access Role +* :ref:`atlas-api-cloudProviderAccess-createCloudProviderAccessRole` - Create One Cloud Provider Access Role +* :ref:`atlas-api-cloudProviderAccess-deauthorizeCloudProviderAccessRole` - Deauthorize One Cloud Provider Access Role +* :ref:`atlas-api-cloudProviderAccess-getCloudProviderAccessRole` - Return specified Cloud Provider Access Role +* :ref:`atlas-api-cloudProviderAccess-listCloudProviderAccessRoles` - Return All Cloud Provider Access Roles + + +.. toctree:: + :titlesonly: + + authorizeCloudProviderAccessRole + createCloudProviderAccessRole + deauthorizeCloudProviderAccessRole + getCloudProviderAccessRole + listCloudProviderAccessRoles + diff --git a/docs/command/atlas-api-clusterOutageSimulation-endOutageSimulation.txt b/docs/command/atlas-api-clusterOutageSimulation-endOutageSimulation.txt new file mode 100644 index 0000000000..ae09ba40a7 --- /dev/null +++ b/docs/command/atlas-api-clusterOutageSimulation-endOutageSimulation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusterOutageSimulation-endOutageSimulation: + +===================================================== +atlas api clusterOutageSimulation endOutageSimulation +===================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +End an Outage Simulation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusterOutageSimulation endOutageSimulation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that is undergoing outage simulation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for endOutageSimulation + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusterOutageSimulation-getOutageSimulation.txt b/docs/command/atlas-api-clusterOutageSimulation-getOutageSimulation.txt new file mode 100644 index 0000000000..719555b1c1 --- /dev/null +++ b/docs/command/atlas-api-clusterOutageSimulation-getOutageSimulation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusterOutageSimulation-getOutageSimulation: + +===================================================== +atlas api clusterOutageSimulation getOutageSimulation +===================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Outage Simulation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusterOutageSimulation getOutageSimulation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that is undergoing outage simulation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getOutageSimulation + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusterOutageSimulation-startOutageSimulation.txt b/docs/command/atlas-api-clusterOutageSimulation-startOutageSimulation.txt new file mode 100644 index 0000000000..68b56accdb --- /dev/null +++ b/docs/command/atlas-api-clusterOutageSimulation-startOutageSimulation.txt @@ -0,0 +1,74 @@ +.. _atlas-api-clusterOutageSimulation-startOutageSimulation: + +======================================================= +atlas api clusterOutageSimulation startOutageSimulation +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Start an Outage Simulation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusterOutageSimulation startOutageSimulation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster to undergo an outage simulation. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for startOutageSimulation + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusterOutageSimulation.txt b/docs/command/atlas-api-clusterOutageSimulation.txt new file mode 100644 index 0000000000..f0f24236cd --- /dev/null +++ b/docs/command/atlas-api-clusterOutageSimulation.txt @@ -0,0 +1,63 @@ +.. _atlas-api-clusterOutageSimulation: + +================================= +atlas api clusterOutageSimulation +================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, starts, or ends a cluster outage simulation. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for clusterOutageSimulation + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-clusterOutageSimulation-endOutageSimulation` - End an Outage Simulation +* :ref:`atlas-api-clusterOutageSimulation-getOutageSimulation` - Return One Outage Simulation +* :ref:`atlas-api-clusterOutageSimulation-startOutageSimulation` - Start an Outage Simulation + + +.. toctree:: + :titlesonly: + + endOutageSimulation + getOutageSimulation + startOutageSimulation + diff --git a/docs/command/atlas-api-clusters-createCluster.txt b/docs/command/atlas-api-clusters-createCluster.txt new file mode 100644 index 0000000000..37e897e734 --- /dev/null +++ b/docs/command/atlas-api-clusters-createCluster.txt @@ -0,0 +1,78 @@ +.. _atlas-api-clusters-createCluster: + +================================ +atlas api clusters createCluster +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +TEST DESCRIPTION + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters createCluster [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createCluster + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --timeout + - string + - false + - WATCH TIMEOUT DESCRIPTION This value defaults to "5m". + * - -w, --watch + - + - false + - WATCH DESCRIPTION + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-deleteCluster.txt b/docs/command/atlas-api-clusters-deleteCluster.txt new file mode 100644 index 0000000000..e90762ccb4 --- /dev/null +++ b/docs/command/atlas-api-clusters-deleteCluster.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusters-deleteCluster: + +================================ +atlas api clusters deleteCluster +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Cluster from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters deleteCluster [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -h, --help + - + - false + - help for deleteCluster + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --retainBackups + - + - false + - Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-getCluster.txt b/docs/command/atlas-api-clusters-getCluster.txt new file mode 100644 index 0000000000..e5302ccaca --- /dev/null +++ b/docs/command/atlas-api-clusters-getCluster.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusters-getCluster: + +============================= +atlas api clusters getCluster +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Cluster from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters getCluster [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies this cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getCluster + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-getClusterAdvancedConfiguration.txt b/docs/command/atlas-api-clusters-getClusterAdvancedConfiguration.txt new file mode 100644 index 0000000000..dbdb942fa5 --- /dev/null +++ b/docs/command/atlas-api-clusters-getClusterAdvancedConfiguration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusters-getClusterAdvancedConfiguration: + +================================================== +atlas api clusters getClusterAdvancedConfiguration +================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Advanced Configuration Options for One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters getClusterAdvancedConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getClusterAdvancedConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-getClusterStatus.txt b/docs/command/atlas-api-clusters-getClusterStatus.txt new file mode 100644 index 0000000000..e421c966b9 --- /dev/null +++ b/docs/command/atlas-api-clusters-getClusterStatus.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusters-getClusterStatus: + +=================================== +atlas api clusters getClusterStatus +=================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Status of All Cluster Operations + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters getClusterStatus [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getClusterStatus + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-getSampleDatasetLoadStatus.txt b/docs/command/atlas-api-clusters-getSampleDatasetLoadStatus.txt new file mode 100644 index 0000000000..8ee40f3a04 --- /dev/null +++ b/docs/command/atlas-api-clusters-getSampleDatasetLoadStatus.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusters-getSampleDatasetLoadStatus: + +============================================= +atlas api clusters getSampleDatasetLoadStatus +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Check Status of Cluster Sample Dataset Request + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters getSampleDatasetLoadStatus [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getSampleDatasetLoadStatus + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --sampleDatasetId + - string + - true + - Unique 24-hexadecimal digit string that identifies the loaded sample dataset. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-listCloudProviderRegions.txt b/docs/command/atlas-api-clusters-listCloudProviderRegions.txt new file mode 100644 index 0000000000..e9a890eb37 --- /dev/null +++ b/docs/command/atlas-api-clusters-listCloudProviderRegions.txt @@ -0,0 +1,86 @@ +.. _atlas-api-clusters-listCloudProviderRegions: + +=========================================== +atlas api clusters listCloudProviderRegions +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Cloud Provider Regions + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters listCloudProviderRegions [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listCloudProviderRegions + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --providers + - strings + - false + - Cloud providers whose regions to retrieve. When you specify multiple providers, the response can return only tiers and regions that support multi-cloud clusters. + * - --tier + - string + - false + - Cluster tier for which to retrieve the regions. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-listClusters.txt b/docs/command/atlas-api-clusters-listClusters.txt new file mode 100644 index 0000000000..20e775a539 --- /dev/null +++ b/docs/command/atlas-api-clusters-listClusters.txt @@ -0,0 +1,82 @@ +.. _atlas-api-clusters-listClusters: + +=============================== +atlas api clusters listClusters +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Clusters in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters listClusters [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listClusters + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --includeDeletedWithRetainedBackups + - + - false + - Flag that indicates whether to return Clusters with retain backups. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-listClustersForAllProjects.txt b/docs/command/atlas-api-clusters-listClustersForAllProjects.txt new file mode 100644 index 0000000000..40a20f391c --- /dev/null +++ b/docs/command/atlas-api-clusters-listClustersForAllProjects.txt @@ -0,0 +1,74 @@ +.. _atlas-api-clusters-listClustersForAllProjects: + +============================================= +atlas api clusters listClustersForAllProjects +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Authorized Clusters in All Projects + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters listClustersForAllProjects [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listClustersForAllProjects + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-loadSampleDataset.txt b/docs/command/atlas-api-clusters-loadSampleDataset.txt new file mode 100644 index 0000000000..d4637fcb30 --- /dev/null +++ b/docs/command/atlas-api-clusters-loadSampleDataset.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusters-loadSampleDataset: + +==================================== +atlas api clusters loadSampleDataset +==================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Load Sample Dataset Request into Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters loadSampleDataset [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for loadSampleDataset + * - --name + - string + - true + - Human-readable label that identifies the cluster into which you load the sample dataset. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-testFailover.txt b/docs/command/atlas-api-clusters-testFailover.txt new file mode 100644 index 0000000000..290c6d7982 --- /dev/null +++ b/docs/command/atlas-api-clusters-testFailover.txt @@ -0,0 +1,66 @@ +.. _atlas-api-clusters-testFailover: + +=============================== +atlas api clusters testFailover +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Test Failover for One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters testFailover [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -h, --help + - + - false + - help for testFailover + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-updateCluster.txt b/docs/command/atlas-api-clusters-updateCluster.txt new file mode 100644 index 0000000000..33a4f0368e --- /dev/null +++ b/docs/command/atlas-api-clusters-updateCluster.txt @@ -0,0 +1,74 @@ +.. _atlas-api-clusters-updateCluster: + +================================ +atlas api clusters updateCluster +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Modify One Cluster from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters updateCluster [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateCluster + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-updateClusterAdvancedConfiguration.txt b/docs/command/atlas-api-clusters-updateClusterAdvancedConfiguration.txt new file mode 100644 index 0000000000..db1e6f0841 --- /dev/null +++ b/docs/command/atlas-api-clusters-updateClusterAdvancedConfiguration.txt @@ -0,0 +1,74 @@ +.. _atlas-api-clusters-updateClusterAdvancedConfiguration: + +===================================================== +atlas api clusters updateClusterAdvancedConfiguration +===================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Advanced Configuration Options for One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters updateClusterAdvancedConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateClusterAdvancedConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-upgradeSharedCluster.txt b/docs/command/atlas-api-clusters-upgradeSharedCluster.txt new file mode 100644 index 0000000000..21a4d5584f --- /dev/null +++ b/docs/command/atlas-api-clusters-upgradeSharedCluster.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusters-upgradeSharedCluster: + +======================================= +atlas api clusters upgradeSharedCluster +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Upgrade One Shared-tier Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters upgradeSharedCluster [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for upgradeSharedCluster + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters-upgradeSharedClusterToServerless.txt b/docs/command/atlas-api-clusters-upgradeSharedClusterToServerless.txt new file mode 100644 index 0000000000..c5d4169966 --- /dev/null +++ b/docs/command/atlas-api-clusters-upgradeSharedClusterToServerless.txt @@ -0,0 +1,70 @@ +.. _atlas-api-clusters-upgradeSharedClusterToServerless: + +=================================================== +atlas api clusters upgradeSharedClusterToServerless +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Upgrades One Shared-Tier Cluster to the Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api clusters upgradeSharedClusterToServerless [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for upgradeSharedClusterToServerless + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-clusters.txt b/docs/command/atlas-api-clusters.txt new file mode 100644 index 0000000000..e0eb64444d --- /dev/null +++ b/docs/command/atlas-api-clusters.txt @@ -0,0 +1,87 @@ +.. _atlas-api-clusters: + +================== +atlas api clusters +================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for clusters + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-clusters-createCluster` - TEST DESCRIPTION +* :ref:`atlas-api-clusters-deleteCluster` - Remove One Cluster from One Project +* :ref:`atlas-api-clusters-getCluster` - Return One Cluster from One Project +* :ref:`atlas-api-clusters-getClusterAdvancedConfiguration` - Return One Advanced Configuration Options for One Cluster +* :ref:`atlas-api-clusters-getClusterStatus` - Return Status of All Cluster Operations +* :ref:`atlas-api-clusters-getSampleDatasetLoadStatus` - Check Status of Cluster Sample Dataset Request +* :ref:`atlas-api-clusters-listCloudProviderRegions` - Return All Cloud Provider Regions +* :ref:`atlas-api-clusters-listClusters` - Return All Clusters in One Project +* :ref:`atlas-api-clusters-listClustersForAllProjects` - Return All Authorized Clusters in All Projects +* :ref:`atlas-api-clusters-loadSampleDataset` - Load Sample Dataset Request into Cluster +* :ref:`atlas-api-clusters-testFailover` - Test Failover for One Cluster +* :ref:`atlas-api-clusters-updateCluster` - Modify One Cluster from One Project +* :ref:`atlas-api-clusters-updateClusterAdvancedConfiguration` - Update Advanced Configuration Options for One Cluster +* :ref:`atlas-api-clusters-upgradeSharedCluster` - Upgrade One Shared-tier Cluster +* :ref:`atlas-api-clusters-upgradeSharedClusterToServerless` - Upgrades One Shared-Tier Cluster to the Serverless Instance + + +.. toctree:: + :titlesonly: + + createCluster + deleteCluster + getCluster + getClusterAdvancedConfiguration + getClusterStatus + getSampleDatasetLoadStatus + listCloudProviderRegions + listClusters + listClustersForAllProjects + loadSampleDataset + testFailover + updateCluster + updateClusterAdvancedConfiguration + upgradeSharedCluster + upgradeSharedClusterToServerless + diff --git a/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceClusterMeasurements.txt b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceClusterMeasurements.txt new file mode 100644 index 0000000000..e11338473b --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceClusterMeasurements.txt @@ -0,0 +1,98 @@ +.. _atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceClusterMeasurements: + +================================================================================ +atlas api collectionLevelMetrics getCollStatsLatencyNamespaceClusterMeasurements +================================================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Cluster-Level Query Latency + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics getCollStatsLatencyNamespaceClusterMeasurements [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster to retrieve metrics for. + * - --clusterView + - string + - true + - Human-readable label that identifies the cluster topology to retrieve metrics for. + * - --collectionName + - string + - true + - Human-readable label that identifies the collection. + * - --databaseName + - string + - true + - Human-readable label that identifies the database. + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getCollStatsLatencyNamespaceClusterMeasurements + * - --metrics + - strings + - false + - List that contains the metrics that you want to retrieve for the associated data series. If you don't set this parameter, this resource returns data series for all Coll Stats Latency metrics. + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceHostMeasurements.txt b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceHostMeasurements.txt new file mode 100644 index 0000000000..670d017e61 --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceHostMeasurements.txt @@ -0,0 +1,94 @@ +.. _atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceHostMeasurements: + +============================================================================= +atlas api collectionLevelMetrics getCollStatsLatencyNamespaceHostMeasurements +============================================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Host-Level Query Latency + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics getCollStatsLatencyNamespaceHostMeasurements [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --collectionName + - string + - true + - Human-readable label that identifies the collection. + * - --databaseName + - string + - true + - Human-readable label that identifies the database. + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getCollStatsLatencyNamespaceHostMeasurements + * - --metrics + - strings + - false + - List that contains the metrics that you want to retrieve for the associated data series. If you don't set this parameter, this resource returns data series for all Coll Stats Latency metrics. + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --processId + - string + - true + - Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceMetrics.txt b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceMetrics.txt new file mode 100644 index 0000000000..56b0156b46 --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceMetrics.txt @@ -0,0 +1,66 @@ +.. _atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceMetrics: + +==================================================================== +atlas api collectionLevelMetrics getCollStatsLatencyNamespaceMetrics +==================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return all metric names + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics getCollStatsLatencyNamespaceMetrics [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getCollStatsLatencyNamespaceMetrics + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForCluster.txt b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForCluster.txt new file mode 100644 index 0000000000..0d88bcbca4 --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForCluster.txt @@ -0,0 +1,86 @@ +.. _atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForCluster: + +======================================================================== +atlas api collectionLevelMetrics getCollStatsLatencyNamespacesForCluster +======================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Ranked Namespaces from a Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics getCollStatsLatencyNamespacesForCluster [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster to pin namespaces to. + * - --clusterView + - string + - true + - Human-readable label that identifies the cluster topology to retrieve metrics for. + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getCollStatsLatencyNamespacesForCluster + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForHost.txt b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForHost.txt new file mode 100644 index 0000000000..83bd4885b8 --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForHost.txt @@ -0,0 +1,82 @@ +.. _atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForHost: + +===================================================================== +atlas api collectionLevelMetrics getCollStatsLatencyNamespacesForHost +===================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Ranked Namespaces from a Host + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics getCollStatsLatencyNamespacesForHost [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getCollStatsLatencyNamespacesForHost + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --processId + - string + - true + - Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics-getPinnedNamespaces.txt b/docs/command/atlas-api-collectionLevelMetrics-getPinnedNamespaces.txt new file mode 100644 index 0000000000..677416e50f --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-getPinnedNamespaces.txt @@ -0,0 +1,70 @@ +.. _atlas-api-collectionLevelMetrics-getPinnedNamespaces: + +==================================================== +atlas api collectionLevelMetrics getPinnedNamespaces +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Pinned Namespaces + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics getPinnedNamespaces [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster to retrieve pinned namespaces for. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPinnedNamespaces + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics-pinNamespacesPatch.txt b/docs/command/atlas-api-collectionLevelMetrics-pinNamespacesPatch.txt new file mode 100644 index 0000000000..ccd1398f8d --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-pinNamespacesPatch.txt @@ -0,0 +1,74 @@ +.. _atlas-api-collectionLevelMetrics-pinNamespacesPatch: + +=================================================== +atlas api collectionLevelMetrics pinNamespacesPatch +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Add Pinned Namespaces + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics pinNamespacesPatch [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster to pin namespaces to. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for pinNamespacesPatch + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics-pinNamespacesPut.txt b/docs/command/atlas-api-collectionLevelMetrics-pinNamespacesPut.txt new file mode 100644 index 0000000000..15009bcb60 --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-pinNamespacesPut.txt @@ -0,0 +1,74 @@ +.. _atlas-api-collectionLevelMetrics-pinNamespacesPut: + +================================================= +atlas api collectionLevelMetrics pinNamespacesPut +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Pin Namespaces + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics pinNamespacesPut [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster to pin namespaces to. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for pinNamespacesPut + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics-unpinNamespaces.txt b/docs/command/atlas-api-collectionLevelMetrics-unpinNamespaces.txt new file mode 100644 index 0000000000..c340b190dc --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics-unpinNamespaces.txt @@ -0,0 +1,74 @@ +.. _atlas-api-collectionLevelMetrics-unpinNamespaces: + +================================================ +atlas api collectionLevelMetrics unpinNamespaces +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Unpin namespaces + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api collectionLevelMetrics unpinNamespaces [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster to unpin namespaces from. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for unpinNamespaces + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-collectionLevelMetrics.txt b/docs/command/atlas-api-collectionLevelMetrics.txt new file mode 100644 index 0000000000..0923aab85f --- /dev/null +++ b/docs/command/atlas-api-collectionLevelMetrics.txt @@ -0,0 +1,75 @@ +.. _atlas-api-collectionLevelMetrics: + +================================ +atlas api collectionLevelMetrics +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, and edits pinned namespaces for the specified cluster or process. Also returns collection level latency metric data. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for collectionLevelMetrics + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceClusterMeasurements` - Return Cluster-Level Query Latency +* :ref:`atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceHostMeasurements` - Return Host-Level Query Latency +* :ref:`atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespaceMetrics` - Return all metric names +* :ref:`atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForCluster` - Return Ranked Namespaces from a Cluster +* :ref:`atlas-api-collectionLevelMetrics-getCollStatsLatencyNamespacesForHost` - Return Ranked Namespaces from a Host +* :ref:`atlas-api-collectionLevelMetrics-getPinnedNamespaces` - Return Pinned Namespaces +* :ref:`atlas-api-collectionLevelMetrics-pinNamespacesPatch` - Add Pinned Namespaces +* :ref:`atlas-api-collectionLevelMetrics-pinNamespacesPut` - Pin Namespaces +* :ref:`atlas-api-collectionLevelMetrics-unpinNamespaces` - Unpin namespaces + + +.. toctree:: + :titlesonly: + + getCollStatsLatencyNamespaceClusterMeasurements + getCollStatsLatencyNamespaceHostMeasurements + getCollStatsLatencyNamespaceMetrics + getCollStatsLatencyNamespacesForCluster + getCollStatsLatencyNamespacesForHost + getPinnedNamespaces + pinNamespacesPatch + pinNamespacesPut + unpinNamespaces + diff --git a/docs/command/atlas-api-customDatabaseRoles-createCustomDatabaseRole.txt b/docs/command/atlas-api-customDatabaseRoles-createCustomDatabaseRole.txt new file mode 100644 index 0000000000..99f360c58f --- /dev/null +++ b/docs/command/atlas-api-customDatabaseRoles-createCustomDatabaseRole.txt @@ -0,0 +1,70 @@ +.. _atlas-api-customDatabaseRoles-createCustomDatabaseRole: + +====================================================== +atlas api customDatabaseRoles createCustomDatabaseRole +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Custom Role + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api customDatabaseRoles createCustomDatabaseRole [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createCustomDatabaseRole + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-customDatabaseRoles-deleteCustomDatabaseRole.txt b/docs/command/atlas-api-customDatabaseRoles-deleteCustomDatabaseRole.txt new file mode 100644 index 0000000000..9d67776656 --- /dev/null +++ b/docs/command/atlas-api-customDatabaseRoles-deleteCustomDatabaseRole.txt @@ -0,0 +1,66 @@ +.. _atlas-api-customDatabaseRoles-deleteCustomDatabaseRole: + +====================================================== +atlas api customDatabaseRoles deleteCustomDatabaseRole +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Custom Role from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api customDatabaseRoles deleteCustomDatabaseRole [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for deleteCustomDatabaseRole + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --roleName + - string + - true + - Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-customDatabaseRoles-getCustomDatabaseRole.txt b/docs/command/atlas-api-customDatabaseRoles-getCustomDatabaseRole.txt new file mode 100644 index 0000000000..58826a50df --- /dev/null +++ b/docs/command/atlas-api-customDatabaseRoles-getCustomDatabaseRole.txt @@ -0,0 +1,70 @@ +.. _atlas-api-customDatabaseRoles-getCustomDatabaseRole: + +=================================================== +atlas api customDatabaseRoles getCustomDatabaseRole +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Custom Role in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api customDatabaseRoles getCustomDatabaseRole [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getCustomDatabaseRole + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --roleName + - string + - true + - Human-readable label that identifies the role for the request. This name must be unique for this custom role in this project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-customDatabaseRoles-listCustomDatabaseRoles.txt b/docs/command/atlas-api-customDatabaseRoles-listCustomDatabaseRoles.txt new file mode 100644 index 0000000000..13a062add6 --- /dev/null +++ b/docs/command/atlas-api-customDatabaseRoles-listCustomDatabaseRoles.txt @@ -0,0 +1,66 @@ +.. _atlas-api-customDatabaseRoles-listCustomDatabaseRoles: + +===================================================== +atlas api customDatabaseRoles listCustomDatabaseRoles +===================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Custom Roles in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api customDatabaseRoles listCustomDatabaseRoles [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listCustomDatabaseRoles + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-customDatabaseRoles-updateCustomDatabaseRole.txt b/docs/command/atlas-api-customDatabaseRoles-updateCustomDatabaseRole.txt new file mode 100644 index 0000000000..6d2ede1046 --- /dev/null +++ b/docs/command/atlas-api-customDatabaseRoles-updateCustomDatabaseRole.txt @@ -0,0 +1,74 @@ +.. _atlas-api-customDatabaseRoles-updateCustomDatabaseRole: + +====================================================== +atlas api customDatabaseRoles updateCustomDatabaseRole +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Custom Role in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api customDatabaseRoles updateCustomDatabaseRole [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateCustomDatabaseRole + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --roleName + - string + - true + - Human-readable label that identifies the role for the request. This name must beunique for this custom role in this project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-customDatabaseRoles.txt b/docs/command/atlas-api-customDatabaseRoles.txt new file mode 100644 index 0000000000..9e49d0e754 --- /dev/null +++ b/docs/command/atlas-api-customDatabaseRoles.txt @@ -0,0 +1,67 @@ +.. _atlas-api-customDatabaseRoles: + +============================= +atlas api customDatabaseRoles +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the project level, for all clusters in the project. This resource supports a subset of MongoDB privilege actions. You can create a subset of custom role actions. To create a wider list of custom role actions, use the MongoDB Cloud user interface. Custom roles must include actions that all project's clusters support, and that are compatible with each MongoDB version that your project's clusters use. For example, if your project has MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for customDatabaseRoles + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-customDatabaseRoles-createCustomDatabaseRole` - Create One Custom Role +* :ref:`atlas-api-customDatabaseRoles-deleteCustomDatabaseRole` - Remove One Custom Role from One Project +* :ref:`atlas-api-customDatabaseRoles-getCustomDatabaseRole` - Return One Custom Role in One Project +* :ref:`atlas-api-customDatabaseRoles-listCustomDatabaseRoles` - Return All Custom Roles in One Project +* :ref:`atlas-api-customDatabaseRoles-updateCustomDatabaseRole` - Update One Custom Role in One Project + + +.. toctree:: + :titlesonly: + + createCustomDatabaseRole + deleteCustomDatabaseRole + getCustomDatabaseRole + listCustomDatabaseRoles + updateCustomDatabaseRole + diff --git a/docs/command/atlas-api-dataFederation-createDataFederationPrivateEndpoint.txt b/docs/command/atlas-api-dataFederation-createDataFederationPrivateEndpoint.txt new file mode 100644 index 0000000000..e939b945df --- /dev/null +++ b/docs/command/atlas-api-dataFederation-createDataFederationPrivateEndpoint.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataFederation-createDataFederationPrivateEndpoint: + +============================================================ +atlas api dataFederation createDataFederationPrivateEndpoint +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Federated Database Instance and Online Archive Private Endpoint for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation createDataFederationPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createDataFederationPrivateEndpoint + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-createFederatedDatabase.txt b/docs/command/atlas-api-dataFederation-createFederatedDatabase.txt new file mode 100644 index 0000000000..1362b07dd2 --- /dev/null +++ b/docs/command/atlas-api-dataFederation-createFederatedDatabase.txt @@ -0,0 +1,74 @@ +.. _atlas-api-dataFederation-createFederatedDatabase: + +================================================ +atlas api dataFederation createFederatedDatabase +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Federated Database Instance in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation createFederatedDatabase [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createFederatedDatabase + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --skipRoleValidation + - + - false + - Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-createOneDataFederationQueryLimit.txt b/docs/command/atlas-api-dataFederation-createOneDataFederationQueryLimit.txt new file mode 100644 index 0000000000..5d1c5fcfea --- /dev/null +++ b/docs/command/atlas-api-dataFederation-createOneDataFederationQueryLimit.txt @@ -0,0 +1,86 @@ +.. _atlas-api-dataFederation-createOneDataFederationQueryLimit: + +========================================================== +atlas api dataFederation createOneDataFederationQueryLimit +========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Configure One Query Limit for One Federated Database Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation createOneDataFederationQueryLimit [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createOneDataFederationQueryLimit + * - --limitName + - string + - true + - Human-readable label that identifies this data federation instance limit. + + | Limit Name | Description | Default | + | --- | --- | --- | + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | + + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the federated database instance to which the query limit applies. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-deleteDataFederationPrivateEndpoint.txt b/docs/command/atlas-api-dataFederation-deleteDataFederationPrivateEndpoint.txt new file mode 100644 index 0000000000..9a67e45877 --- /dev/null +++ b/docs/command/atlas-api-dataFederation-deleteDataFederationPrivateEndpoint.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataFederation-deleteDataFederationPrivateEndpoint: + +============================================================ +atlas api dataFederation deleteDataFederationPrivateEndpoint +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Federated Database Instance and Online Archive Private Endpoint from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation deleteDataFederationPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --endpointId + - string + - true + - Unique 22-character alphanumeric string that identifies the private endpoint to remove. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteDataFederationPrivateEndpoint + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-deleteFederatedDatabase.txt b/docs/command/atlas-api-dataFederation-deleteFederatedDatabase.txt new file mode 100644 index 0000000000..d3ca9a08ea --- /dev/null +++ b/docs/command/atlas-api-dataFederation-deleteFederatedDatabase.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataFederation-deleteFederatedDatabase: + +================================================ +atlas api dataFederation deleteFederatedDatabase +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Federated Database Instance from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation deleteFederatedDatabase [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteFederatedDatabase + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the federated database instance to remove. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-deleteOneDataFederationInstanceQueryLimit.txt b/docs/command/atlas-api-dataFederation-deleteOneDataFederationInstanceQueryLimit.txt new file mode 100644 index 0000000000..57052345da --- /dev/null +++ b/docs/command/atlas-api-dataFederation-deleteOneDataFederationInstanceQueryLimit.txt @@ -0,0 +1,82 @@ +.. _atlas-api-dataFederation-deleteOneDataFederationInstanceQueryLimit: + +================================================================== +atlas api dataFederation deleteOneDataFederationInstanceQueryLimit +================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Delete One Query Limit For One Federated Database Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation deleteOneDataFederationInstanceQueryLimit [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteOneDataFederationInstanceQueryLimit + * - --limitName + - string + - true + - Human-readable label that identifies this data federation instance limit. + + | Limit Name | Description | Default | + | --- | --- | --- | + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | + + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the federated database instance to which the query limit applies. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-downloadFederatedDatabaseQueryLogs.txt b/docs/command/atlas-api-dataFederation-downloadFederatedDatabaseQueryLogs.txt new file mode 100644 index 0000000000..63f8226b13 --- /dev/null +++ b/docs/command/atlas-api-dataFederation-downloadFederatedDatabaseQueryLogs.txt @@ -0,0 +1,78 @@ +.. _atlas-api-dataFederation-downloadFederatedDatabaseQueryLogs: + +=========================================================== +atlas api dataFederation downloadFederatedDatabaseQueryLogs +=========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Download Query Logs for One Federated Database Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation downloadFederatedDatabaseQueryLogs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --endDate + - int + - false + - Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for downloadFederatedDatabaseQueryLogs + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --startDate + - int + - false + - Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. + * - --tenantName + - string + - true + - Human-readable label that identifies the federated database instance for which you want to download query logs. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-getDataFederationPrivateEndpoint.txt b/docs/command/atlas-api-dataFederation-getDataFederationPrivateEndpoint.txt new file mode 100644 index 0000000000..14e9772505 --- /dev/null +++ b/docs/command/atlas-api-dataFederation-getDataFederationPrivateEndpoint.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataFederation-getDataFederationPrivateEndpoint: + +========================================================= +atlas api dataFederation getDataFederationPrivateEndpoint +========================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Federated Database Instance and Online Archive Private Endpoint in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation getDataFederationPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --endpointId + - string + - true + - Unique 22-character alphanumeric string that identifies the private endpoint to return. Atlas Data Federation supports AWS private endpoints using the AWS PrivateLink feature. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getDataFederationPrivateEndpoint + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-getFederatedDatabase.txt b/docs/command/atlas-api-dataFederation-getFederatedDatabase.txt new file mode 100644 index 0000000000..4b3ac2a1ac --- /dev/null +++ b/docs/command/atlas-api-dataFederation-getFederatedDatabase.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataFederation-getFederatedDatabase: + +============================================= +atlas api dataFederation getFederatedDatabase +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Federated Database Instance in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation getFederatedDatabase [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getFederatedDatabase + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the Federated Database to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-listDataFederationPrivateEndpoints.txt b/docs/command/atlas-api-dataFederation-listDataFederationPrivateEndpoints.txt new file mode 100644 index 0000000000..921e53266a --- /dev/null +++ b/docs/command/atlas-api-dataFederation-listDataFederationPrivateEndpoints.txt @@ -0,0 +1,78 @@ +.. _atlas-api-dataFederation-listDataFederationPrivateEndpoints: + +=========================================================== +atlas api dataFederation listDataFederationPrivateEndpoints +=========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Federated Database Instance and Online Archive Private Endpoints in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation listDataFederationPrivateEndpoints [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listDataFederationPrivateEndpoints + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-listFederatedDatabases.txt b/docs/command/atlas-api-dataFederation-listFederatedDatabases.txt new file mode 100644 index 0000000000..b787e88797 --- /dev/null +++ b/docs/command/atlas-api-dataFederation-listFederatedDatabases.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataFederation-listFederatedDatabases: + +=============================================== +atlas api dataFederation listFederatedDatabases +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Federated Database Instances in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation listFederatedDatabases [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listFederatedDatabases + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --type_ + - string + - false + - Type of Federated Database Instances to return. This value defaults to ""USER"". + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-returnFederatedDatabaseQueryLimit.txt b/docs/command/atlas-api-dataFederation-returnFederatedDatabaseQueryLimit.txt new file mode 100644 index 0000000000..5eca305dca --- /dev/null +++ b/docs/command/atlas-api-dataFederation-returnFederatedDatabaseQueryLimit.txt @@ -0,0 +1,82 @@ +.. _atlas-api-dataFederation-returnFederatedDatabaseQueryLimit: + +========================================================== +atlas api dataFederation returnFederatedDatabaseQueryLimit +========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Federated Database Instance Query Limit for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation returnFederatedDatabaseQueryLimit [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for returnFederatedDatabaseQueryLimit + * - --limitName + - string + - true + - Human-readable label that identifies this data federation instance limit. + + | Limit Name | Description | Default | + | --- | --- | --- | + | bytesProcessed.query | Limit on the number of bytes processed during a single data federation query | N/A | + | bytesProcessed.daily | Limit on the number of bytes processed for the data federation instance for the current day | N/A | + | bytesProcessed.weekly | Limit on the number of bytes processed for the data federation instance for the current week | N/A | + | bytesProcessed.monthly | Limit on the number of bytes processed for the data federation instance for the current month | N/A | + + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the federated database instance to which the query limit applies. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-returnFederatedDatabaseQueryLimits.txt b/docs/command/atlas-api-dataFederation-returnFederatedDatabaseQueryLimits.txt new file mode 100644 index 0000000000..262c757270 --- /dev/null +++ b/docs/command/atlas-api-dataFederation-returnFederatedDatabaseQueryLimits.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataFederation-returnFederatedDatabaseQueryLimits: + +=========================================================== +atlas api dataFederation returnFederatedDatabaseQueryLimits +=========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Query Limits for One Federated Database Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation returnFederatedDatabaseQueryLimits [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for returnFederatedDatabaseQueryLimits + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the federated database instance for which you want to retrieve query limits. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation-updateFederatedDatabase.txt b/docs/command/atlas-api-dataFederation-updateFederatedDatabase.txt new file mode 100644 index 0000000000..0e246b1256 --- /dev/null +++ b/docs/command/atlas-api-dataFederation-updateFederatedDatabase.txt @@ -0,0 +1,78 @@ +.. _atlas-api-dataFederation-updateFederatedDatabase: + +================================================ +atlas api dataFederation updateFederatedDatabase +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Federated Database Instance in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataFederation updateFederatedDatabase [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateFederatedDatabase + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --skipRoleValidation + - + - true + - Flag that indicates whether this request should check if the requesting IAM role can read from the S3 bucket. AWS checks if the role can list the objects in the bucket before writing to it. Some IAM roles only need write permissions. This flag allows you to skip that check. + * - --tenantName + - string + - true + - Human-readable label that identifies the federated database instance to update. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataFederation.txt b/docs/command/atlas-api-dataFederation.txt new file mode 100644 index 0000000000..161e611237 --- /dev/null +++ b/docs/command/atlas-api-dataFederation.txt @@ -0,0 +1,85 @@ +.. _atlas-api-dataFederation: + +======================== +atlas api dataFederation +======================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for dataFederation + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-dataFederation-createDataFederationPrivateEndpoint` - Create One Federated Database Instance and Online Archive Private Endpoint for One Project +* :ref:`atlas-api-dataFederation-createFederatedDatabase` - Create One Federated Database Instance in One Project +* :ref:`atlas-api-dataFederation-createOneDataFederationQueryLimit` - Configure One Query Limit for One Federated Database Instance +* :ref:`atlas-api-dataFederation-deleteDataFederationPrivateEndpoint` - Remove One Federated Database Instance and Online Archive Private Endpoint from One Project +* :ref:`atlas-api-dataFederation-deleteFederatedDatabase` - Remove One Federated Database Instance from One Project +* :ref:`atlas-api-dataFederation-deleteOneDataFederationInstanceQueryLimit` - Delete One Query Limit For One Federated Database Instance +* :ref:`atlas-api-dataFederation-downloadFederatedDatabaseQueryLogs` - Download Query Logs for One Federated Database Instance +* :ref:`atlas-api-dataFederation-getDataFederationPrivateEndpoint` - Return One Federated Database Instance and Online Archive Private Endpoint in One Project +* :ref:`atlas-api-dataFederation-getFederatedDatabase` - Return One Federated Database Instance in One Project +* :ref:`atlas-api-dataFederation-listDataFederationPrivateEndpoints` - Return All Federated Database Instance and Online Archive Private Endpoints in One Project +* :ref:`atlas-api-dataFederation-listFederatedDatabases` - Return All Federated Database Instances in One Project +* :ref:`atlas-api-dataFederation-returnFederatedDatabaseQueryLimit` - Return One Federated Database Instance Query Limit for One Project +* :ref:`atlas-api-dataFederation-returnFederatedDatabaseQueryLimits` - Return All Query Limits for One Federated Database Instance +* :ref:`atlas-api-dataFederation-updateFederatedDatabase` - Update One Federated Database Instance in One Project + + +.. toctree:: + :titlesonly: + + createDataFederationPrivateEndpoint + createFederatedDatabase + createOneDataFederationQueryLimit + deleteDataFederationPrivateEndpoint + deleteFederatedDatabase + deleteOneDataFederationInstanceQueryLimit + downloadFederatedDatabaseQueryLogs + getDataFederationPrivateEndpoint + getFederatedDatabase + listDataFederationPrivateEndpoints + listFederatedDatabases + returnFederatedDatabaseQueryLimit + returnFederatedDatabaseQueryLimits + updateFederatedDatabase + diff --git a/docs/command/atlas-api-dataLakePipelines-createPipeline.txt b/docs/command/atlas-api-dataLakePipelines-createPipeline.txt new file mode 100644 index 0000000000..26b5e2334a --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-createPipeline.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataLakePipelines-createPipeline: + +========================================== +atlas api dataLakePipelines createPipeline +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Data Lake Pipeline + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines createPipeline [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createPipeline + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-deletePipeline.txt b/docs/command/atlas-api-dataLakePipelines-deletePipeline.txt new file mode 100644 index 0000000000..823b3142a7 --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-deletePipeline.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataLakePipelines-deletePipeline: + +========================================== +atlas api dataLakePipelines deletePipeline +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Data Lake Pipeline + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines deletePipeline [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deletePipeline + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-deletePipelineRunDataset.txt b/docs/command/atlas-api-dataLakePipelines-deletePipelineRunDataset.txt new file mode 100644 index 0000000000..e6b1da82fa --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-deletePipelineRunDataset.txt @@ -0,0 +1,74 @@ +.. _atlas-api-dataLakePipelines-deletePipelineRunDataset: + +==================================================== +atlas api dataLakePipelines deletePipelineRunDataset +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Delete Pipeline Run Dataset + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines deletePipelineRunDataset [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deletePipelineRunDataset + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --pipelineRunId + - string + - true + - Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-getPipeline.txt b/docs/command/atlas-api-dataLakePipelines-getPipeline.txt new file mode 100644 index 0000000000..85fb3a9013 --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-getPipeline.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataLakePipelines-getPipeline: + +======================================= +atlas api dataLakePipelines getPipeline +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Data Lake Pipeline + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines getPipeline [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPipeline + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-getPipelineRun.txt b/docs/command/atlas-api-dataLakePipelines-getPipelineRun.txt new file mode 100644 index 0000000000..8665aee426 --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-getPipelineRun.txt @@ -0,0 +1,74 @@ +.. _atlas-api-dataLakePipelines-getPipelineRun: + +========================================== +atlas api dataLakePipelines getPipelineRun +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Data Lake Pipeline Run + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines getPipelineRun [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPipelineRun + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --pipelineRunId + - string + - true + - Unique 24-hexadecimal character string that identifies a Data Lake Pipeline run. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-listPipelineRuns.txt b/docs/command/atlas-api-dataLakePipelines-listPipelineRuns.txt new file mode 100644 index 0000000000..8d401c18d2 --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-listPipelineRuns.txt @@ -0,0 +1,86 @@ +.. _atlas-api-dataLakePipelines-listPipelineRuns: + +============================================ +atlas api dataLakePipelines listPipelineRuns +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Data Lake Pipeline Runs from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines listPipelineRuns [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --createdBefore + - string + - false + - If specified, Atlas returns only Data Lake Pipeline runs initiated before this time and date. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPipelineRuns + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-listPipelineSchedules.txt b/docs/command/atlas-api-dataLakePipelines-listPipelineSchedules.txt new file mode 100644 index 0000000000..db1d64fd8c --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-listPipelineSchedules.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataLakePipelines-listPipelineSchedules: + +================================================= +atlas api dataLakePipelines listPipelineSchedules +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Available Ingestion Schedules for One Data Lake Pipeline + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines listPipelineSchedules [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPipelineSchedules + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-listPipelineSnapshots.txt b/docs/command/atlas-api-dataLakePipelines-listPipelineSnapshots.txt new file mode 100644 index 0000000000..9d4418a63e --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-listPipelineSnapshots.txt @@ -0,0 +1,86 @@ +.. _atlas-api-dataLakePipelines-listPipelineSnapshots: + +================================================= +atlas api dataLakePipelines listPipelineSnapshots +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Available Backup Snapshots for One Data Lake Pipeline + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines listPipelineSnapshots [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --completedAfter + - string + - false + - Date and time after which MongoDB Cloud created the snapshot. If specified, MongoDB Cloud returns available backup snapshots created after this time and date only. This parameter expresses its value in the ISO 8601 timestamp format in UTC. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPipelineSnapshots + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-listPipelines.txt b/docs/command/atlas-api-dataLakePipelines-listPipelines.txt new file mode 100644 index 0000000000..e612986541 --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-listPipelines.txt @@ -0,0 +1,66 @@ +.. _atlas-api-dataLakePipelines-listPipelines: + +========================================= +atlas api dataLakePipelines listPipelines +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Data Lake Pipelines from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines listPipelines [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPipelines + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-pausePipeline.txt b/docs/command/atlas-api-dataLakePipelines-pausePipeline.txt new file mode 100644 index 0000000000..e8f0243d6e --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-pausePipeline.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataLakePipelines-pausePipeline: + +========================================= +atlas api dataLakePipelines pausePipeline +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Pause One Data Lake Pipeline + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines pausePipeline [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for pausePipeline + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-resumePipeline.txt b/docs/command/atlas-api-dataLakePipelines-resumePipeline.txt new file mode 100644 index 0000000000..90df41d538 --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-resumePipeline.txt @@ -0,0 +1,70 @@ +.. _atlas-api-dataLakePipelines-resumePipeline: + +========================================== +atlas api dataLakePipelines resumePipeline +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Resume One Data Lake Pipeline + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines resumePipeline [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for resumePipeline + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-triggerSnapshotIngestion.txt b/docs/command/atlas-api-dataLakePipelines-triggerSnapshotIngestion.txt new file mode 100644 index 0000000000..fedbcc8465 --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-triggerSnapshotIngestion.txt @@ -0,0 +1,74 @@ +.. _atlas-api-dataLakePipelines-triggerSnapshotIngestion: + +==================================================== +atlas api dataLakePipelines triggerSnapshotIngestion +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Trigger on demand snapshot ingestion + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines triggerSnapshotIngestion [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for triggerSnapshotIngestion + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines-updatePipeline.txt b/docs/command/atlas-api-dataLakePipelines-updatePipeline.txt new file mode 100644 index 0000000000..2a5d483d7c --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines-updatePipeline.txt @@ -0,0 +1,74 @@ +.. _atlas-api-dataLakePipelines-updatePipeline: + +========================================== +atlas api dataLakePipelines updatePipeline +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Data Lake Pipeline + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api dataLakePipelines updatePipeline [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updatePipeline + * - --pipelineName + - string + - true + - Human-readable label that identifies the Data Lake Pipeline. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-dataLakePipelines.txt b/docs/command/atlas-api-dataLakePipelines.txt new file mode 100644 index 0000000000..92dae85e05 --- /dev/null +++ b/docs/command/atlas-api-dataLakePipelines.txt @@ -0,0 +1,83 @@ +.. _atlas-api-dataLakePipelines: + +=========================== +atlas api dataLakePipelines +=========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for dataLakePipelines + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-dataLakePipelines-createPipeline` - Create One Data Lake Pipeline +* :ref:`atlas-api-dataLakePipelines-deletePipeline` - Remove One Data Lake Pipeline +* :ref:`atlas-api-dataLakePipelines-deletePipelineRunDataset` - Delete Pipeline Run Dataset +* :ref:`atlas-api-dataLakePipelines-getPipeline` - Return One Data Lake Pipeline +* :ref:`atlas-api-dataLakePipelines-getPipelineRun` - Return One Data Lake Pipeline Run +* :ref:`atlas-api-dataLakePipelines-listPipelineRuns` - Return All Data Lake Pipeline Runs from One Project +* :ref:`atlas-api-dataLakePipelines-listPipelineSchedules` - Return Available Ingestion Schedules for One Data Lake Pipeline +* :ref:`atlas-api-dataLakePipelines-listPipelineSnapshots` - Return Available Backup Snapshots for One Data Lake Pipeline +* :ref:`atlas-api-dataLakePipelines-listPipelines` - Return All Data Lake Pipelines from One Project +* :ref:`atlas-api-dataLakePipelines-pausePipeline` - Pause One Data Lake Pipeline +* :ref:`atlas-api-dataLakePipelines-resumePipeline` - Resume One Data Lake Pipeline +* :ref:`atlas-api-dataLakePipelines-triggerSnapshotIngestion` - Trigger on demand snapshot ingestion +* :ref:`atlas-api-dataLakePipelines-updatePipeline` - Update One Data Lake Pipeline + + +.. toctree:: + :titlesonly: + + createPipeline + deletePipeline + deletePipelineRunDataset + getPipeline + getPipelineRun + listPipelineRuns + listPipelineSchedules + listPipelineSnapshots + listPipelines + pausePipeline + resumePipeline + triggerSnapshotIngestion + updatePipeline + diff --git a/docs/command/atlas-api-databaseUsers-createDatabaseUser.txt b/docs/command/atlas-api-databaseUsers-createDatabaseUser.txt new file mode 100644 index 0000000000..2ed8147f6e --- /dev/null +++ b/docs/command/atlas-api-databaseUsers-createDatabaseUser.txt @@ -0,0 +1,70 @@ +.. _atlas-api-databaseUsers-createDatabaseUser: + +========================================== +atlas api databaseUsers createDatabaseUser +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Database User in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api databaseUsers createDatabaseUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createDatabaseUser + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-databaseUsers-deleteDatabaseUser.txt b/docs/command/atlas-api-databaseUsers-deleteDatabaseUser.txt new file mode 100644 index 0000000000..48b42d52f6 --- /dev/null +++ b/docs/command/atlas-api-databaseUsers-deleteDatabaseUser.txt @@ -0,0 +1,86 @@ +.. _atlas-api-databaseUsers-deleteDatabaseUser: + +========================================== +atlas api databaseUsers deleteDatabaseUser +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Database User from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api databaseUsers deleteDatabaseUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --databaseName + - string + - true + - Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteDatabaseUser + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --username + - string + - true + - Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + + | Authentication Method | Parameter Needed | Parameter Value | username Format | + |---|---|---|---| + | AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | + | AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | + + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-databaseUsers-getDatabaseUser.txt b/docs/command/atlas-api-databaseUsers-getDatabaseUser.txt new file mode 100644 index 0000000000..4ba8530385 --- /dev/null +++ b/docs/command/atlas-api-databaseUsers-getDatabaseUser.txt @@ -0,0 +1,86 @@ +.. _atlas-api-databaseUsers-getDatabaseUser: + +======================================= +atlas api databaseUsers getDatabaseUser +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Database User from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api databaseUsers getDatabaseUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --databaseName + - string + - true + - Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getDatabaseUser + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --username + - string + - true + - Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + + | Authentication Method | Parameter Needed | Parameter Value | username Format | + |---|---|---|---| + | AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | + | AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | + + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-databaseUsers-listDatabaseUsers.txt b/docs/command/atlas-api-databaseUsers-listDatabaseUsers.txt new file mode 100644 index 0000000000..a01f81b5c6 --- /dev/null +++ b/docs/command/atlas-api-databaseUsers-listDatabaseUsers.txt @@ -0,0 +1,78 @@ +.. _atlas-api-databaseUsers-listDatabaseUsers: + +========================================= +atlas api databaseUsers listDatabaseUsers +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Database Users from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api databaseUsers listDatabaseUsers [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listDatabaseUsers + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-databaseUsers-updateDatabaseUser.txt b/docs/command/atlas-api-databaseUsers-updateDatabaseUser.txt new file mode 100644 index 0000000000..623a0aafcb --- /dev/null +++ b/docs/command/atlas-api-databaseUsers-updateDatabaseUser.txt @@ -0,0 +1,90 @@ +.. _atlas-api-databaseUsers-updateDatabaseUser: + +========================================== +atlas api databaseUsers updateDatabaseUser +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Database User in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api databaseUsers updateDatabaseUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --databaseName + - string + - true + - Human-readable label that identifies the database against which the database user authenticates. Database users must provide both a username and authentication database to log into MongoDB. If the user authenticates with AWS IAM, x.509, or LDAP, this value should be `$external`. If the user authenticates with SCRAM-SHA or OIDC, this value should be `admin`. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateDatabaseUser + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --username + - string + - true + - Human-readable label that represents the user that authenticates to MongoDB. The format of this label depends on the method of authentication: + + | Authentication Method | Parameter Needed | Parameter Value | username Format | + |---|---|---|---| + | AWS IAM | awsType | ROLE | <abbr title="Amazon Resource Name">ARN</abbr> | + | AWS IAM | awsType | USER | <abbr title="Amazon Resource Name">ARN</abbr> | + | x.509 | x509Type | CUSTOMER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | x.509 | x509Type | MANAGED | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | USER | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | LDAP | ldapAuthType | GROUP | [RFC 2253](https://tools.ietf.org/html/2253) Distinguished Name | + | OIDC | oidcAuthType | IDP_GROUP | Atlas OIDC IdP ID (found in federation settings), followed by a '/', followed by the IdP group name | + | SCRAM-SHA | awsType, x509Type, ldapAuthType, oidcAuthType | NONE | Alphanumeric string | + + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-databaseUsers.txt b/docs/command/atlas-api-databaseUsers.txt new file mode 100644 index 0000000000..676dec19ee --- /dev/null +++ b/docs/command/atlas-api-databaseUsers.txt @@ -0,0 +1,67 @@ +.. _atlas-api-databaseUsers: + +======================= +atlas api databaseUsers +======================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes database users. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for databaseUsers + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-databaseUsers-createDatabaseUser` - Create One Database User in One Project +* :ref:`atlas-api-databaseUsers-deleteDatabaseUser` - Remove One Database User from One Project +* :ref:`atlas-api-databaseUsers-getDatabaseUser` - Return One Database User from One Project +* :ref:`atlas-api-databaseUsers-listDatabaseUsers` - Return All Database Users from One Project +* :ref:`atlas-api-databaseUsers-updateDatabaseUser` - Update One Database User in One Project + + +.. toctree:: + :titlesonly: + + createDatabaseUser + deleteDatabaseUser + getDatabaseUser + listDatabaseUsers + updateDatabaseUser + diff --git a/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement-getEncryptionAtRest.txt b/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement-getEncryptionAtRest.txt new file mode 100644 index 0000000000..f679730085 --- /dev/null +++ b/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement-getEncryptionAtRest.txt @@ -0,0 +1,66 @@ +.. _atlas-api-encryptionAtRestUsingCustomerKeyManagement-getEncryptionAtRest: + +======================================================================== +atlas api encryptionAtRestUsingCustomerKeyManagement getEncryptionAtRest +======================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api encryptionAtRestUsingCustomerKeyManagement getEncryptionAtRest [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getEncryptionAtRest + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement-updateEncryptionAtRest.txt b/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement-updateEncryptionAtRest.txt new file mode 100644 index 0000000000..122935c94b --- /dev/null +++ b/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement-updateEncryptionAtRest.txt @@ -0,0 +1,70 @@ +.. _atlas-api-encryptionAtRestUsingCustomerKeyManagement-updateEncryptionAtRest: + +=========================================================================== +atlas api encryptionAtRestUsingCustomerKeyManagement updateEncryptionAtRest +=========================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api encryptionAtRestUsingCustomerKeyManagement updateEncryptionAtRest [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateEncryptionAtRest + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement.txt b/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement.txt new file mode 100644 index 0000000000..af0c165ada --- /dev/null +++ b/docs/command/atlas-api-encryptionAtRestUsingCustomerKeyManagement.txt @@ -0,0 +1,61 @@ +.. _atlas-api-encryptionAtRestUsingCustomerKeyManagement: + +==================================================== +atlas api encryptionAtRestUsingCustomerKeyManagement +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for encryptionAtRestUsingCustomerKeyManagement + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-encryptionAtRestUsingCustomerKeyManagement-getEncryptionAtRest` - Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project +* :ref:`atlas-api-encryptionAtRestUsingCustomerKeyManagement-updateEncryptionAtRest` - Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project + + +.. toctree:: + :titlesonly: + + getEncryptionAtRest + updateEncryptionAtRest + diff --git a/docs/command/atlas-api-events-getOrganizationEvent.txt b/docs/command/atlas-api-events-getOrganizationEvent.txt new file mode 100644 index 0000000000..b3d9d7d258 --- /dev/null +++ b/docs/command/atlas-api-events-getOrganizationEvent.txt @@ -0,0 +1,74 @@ +.. _atlas-api-events-getOrganizationEvent: + +===================================== +atlas api events getOrganizationEvent +===================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Event from One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api events getOrganizationEvent [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --eventId + - string + - true + - Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listOrganizationEvents) endpoint to retrieve all events to which the authenticated user has access. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getOrganizationEvent + * - --includeRaw + - + - false + - Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-events-getProjectEvent.txt b/docs/command/atlas-api-events-getProjectEvent.txt new file mode 100644 index 0000000000..116739bceb --- /dev/null +++ b/docs/command/atlas-api-events-getProjectEvent.txt @@ -0,0 +1,74 @@ +.. _atlas-api-events-getProjectEvent: + +================================ +atlas api events getProjectEvent +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Event from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api events getProjectEvent [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --eventId + - string + - true + - Unique 24-hexadecimal digit string that identifies the event that you want to return. Use the [/events](#tag/Events/operation/listProjectEvents) endpoint to retrieve all events to which the authenticated user has access. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getProjectEvent + * - --includeRaw + - + - false + - Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-events-listOrganizationEvents.txt b/docs/command/atlas-api-events-listOrganizationEvents.txt new file mode 100644 index 0000000000..b980d32115 --- /dev/null +++ b/docs/command/atlas-api-events-listOrganizationEvents.txt @@ -0,0 +1,96 @@ +.. _atlas-api-events-listOrganizationEvents: + +======================================= +atlas api events listOrganizationEvents +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Events from One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api events listOrganizationEvents [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --eventType + - strings + - false + - Category of incident recorded at this moment in time. + + **IMPORTANT**: The complete list of event type values changes frequently. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listOrganizationEvents + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --includeRaw + - + - false + - Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --maxDate + - string + - false + - Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. + * - --minDate + - string + - false + - Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-events-listProjectEvents.txt b/docs/command/atlas-api-events-listProjectEvents.txt new file mode 100644 index 0000000000..486f0f006b --- /dev/null +++ b/docs/command/atlas-api-events-listProjectEvents.txt @@ -0,0 +1,106 @@ +.. _atlas-api-events-listProjectEvents: + +================================== +atlas api events listProjectEvents +================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Events from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api events listProjectEvents [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterNames + - strings + - false + - Human-readable label that identifies the cluster. + * - --eventType + - strings + - false + - Category of incident recorded at this moment in time. + + **IMPORTANT**: The complete list of event type values changes frequently. + * - --excludedEventType + - strings + - false + - Category of event that you would like to exclude from query results, such as CLUSTER_CREATED + + **IMPORTANT**: Event type names change frequently. Verify that you specify the event type correctly by checking the complete list of event types. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listProjectEvents + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --includeRaw + - + - false + - Flag that indicates whether to include the raw document in the output. The raw document contains additional meta information about the event. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --maxDate + - string + - false + - Date and time from when MongoDB Cloud stops returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. + * - --minDate + - string + - false + - Date and time from when MongoDB Cloud starts returning events. This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank" rel="noopener noreferrer">ISO 8601</a> timestamp format in UTC. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-events.txt b/docs/command/atlas-api-events.txt new file mode 100644 index 0000000000..16a5178b08 --- /dev/null +++ b/docs/command/atlas-api-events.txt @@ -0,0 +1,65 @@ +.. _atlas-api-events: + +================ +atlas api events +================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns events. This collection remains under revision and may change. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for events + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-events-getOrganizationEvent` - Return One Event from One Organization +* :ref:`atlas-api-events-getProjectEvent` - Return One Event from One Project +* :ref:`atlas-api-events-listOrganizationEvents` - Return All Events from One Organization +* :ref:`atlas-api-events-listProjectEvents` - Return All Events from One Project + + +.. toctree:: + :titlesonly: + + getOrganizationEvent + getProjectEvent + listOrganizationEvents + listProjectEvents + diff --git a/docs/command/atlas-api-federatedAuthentication-createIdentityProvider.txt b/docs/command/atlas-api-federatedAuthentication-createIdentityProvider.txt new file mode 100644 index 0000000000..98065ec1cb --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-createIdentityProvider.txt @@ -0,0 +1,70 @@ +.. _atlas-api-federatedAuthentication-createIdentityProvider: + +======================================================== +atlas api federatedAuthentication createIdentityProvider +======================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create one identity provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication createIdentityProvider [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createIdentityProvider + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-createRoleMapping.txt b/docs/command/atlas-api-federatedAuthentication-createRoleMapping.txt new file mode 100644 index 0000000000..225777f06a --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-createRoleMapping.txt @@ -0,0 +1,74 @@ +.. _atlas-api-federatedAuthentication-createRoleMapping: + +=================================================== +atlas api federatedAuthentication createRoleMapping +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Add One Role Mapping to One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication createRoleMapping [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createRoleMapping + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-deleteFederationApp.txt b/docs/command/atlas-api-federatedAuthentication-deleteFederationApp.txt new file mode 100644 index 0000000000..603a5d5777 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-deleteFederationApp.txt @@ -0,0 +1,62 @@ +.. _atlas-api-federatedAuthentication-deleteFederationApp: + +===================================================== +atlas api federatedAuthentication deleteFederationApp +===================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Delete the federation settings instance. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication deleteFederationApp [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -h, --help + - + - false + - help for deleteFederationApp + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-deleteIdentityProvider.txt b/docs/command/atlas-api-federatedAuthentication-deleteIdentityProvider.txt new file mode 100644 index 0000000000..e107eb5d65 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-deleteIdentityProvider.txt @@ -0,0 +1,66 @@ +.. _atlas-api-federatedAuthentication-deleteIdentityProvider: + +======================================================== +atlas api federatedAuthentication deleteIdentityProvider +======================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Delete the identity provider. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication deleteIdentityProvider [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -h, --help + - + - false + - help for deleteIdentityProvider + * - --identityProviderId + - string + - true + - Unique 24-hexadecimal digit string that identifies the identity provider to connect. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-deleteRoleMapping.txt b/docs/command/atlas-api-federatedAuthentication-deleteRoleMapping.txt new file mode 100644 index 0000000000..50690de5d7 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-deleteRoleMapping.txt @@ -0,0 +1,70 @@ +.. _atlas-api-federatedAuthentication-deleteRoleMapping: + +=================================================== +atlas api federatedAuthentication deleteRoleMapping +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Role Mapping from One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication deleteRoleMapping [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -h, --help + - + - false + - help for deleteRoleMapping + * - --id + - string + - true + - Unique 24-hexadecimal digit string that identifies the role mapping that you want to remove. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-getConnectedOrgConfig.txt b/docs/command/atlas-api-federatedAuthentication-getConnectedOrgConfig.txt new file mode 100644 index 0000000000..f6a01f994b --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-getConnectedOrgConfig.txt @@ -0,0 +1,70 @@ +.. _atlas-api-federatedAuthentication-getConnectedOrgConfig: + +======================================================= +atlas api federatedAuthentication getConnectedOrgConfig +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Org Config Connected to One Federation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication getConnectedOrgConfig [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getConnectedOrgConfig + * - --orgId + - string + - true + - Unique 24-hexadecimal digit string that identifies the connected organization configuration to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-getFederationSettings.txt b/docs/command/atlas-api-federatedAuthentication-getFederationSettings.txt new file mode 100644 index 0000000000..262405d22d --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-getFederationSettings.txt @@ -0,0 +1,66 @@ +.. _atlas-api-federatedAuthentication-getFederationSettings: + +======================================================= +atlas api federatedAuthentication getFederationSettings +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Federation Settings for One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication getFederationSettings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getFederationSettings + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-getIdentityProvider.txt b/docs/command/atlas-api-federatedAuthentication-getIdentityProvider.txt new file mode 100644 index 0000000000..1a41909427 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-getIdentityProvider.txt @@ -0,0 +1,70 @@ +.. _atlas-api-federatedAuthentication-getIdentityProvider: + +===================================================== +atlas api federatedAuthentication getIdentityProvider +===================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return one identity provider from the specified federation by id. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication getIdentityProvider [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getIdentityProvider + * - --identityProviderId + - string + - true + - Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the legacy 20-hexadecimal digit id. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. For all other versions, use the 24-hexadecimal digit id. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-getIdentityProviderMetadata.txt b/docs/command/atlas-api-federatedAuthentication-getIdentityProviderMetadata.txt new file mode 100644 index 0000000000..d352a9da56 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-getIdentityProviderMetadata.txt @@ -0,0 +1,70 @@ +.. _atlas-api-federatedAuthentication-getIdentityProviderMetadata: + +============================================================= +atlas api federatedAuthentication getIdentityProviderMetadata +============================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return the metadata of one identity provider in the specified federation. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication getIdentityProviderMetadata [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getIdentityProviderMetadata + * - --identityProviderId + - string + - true + - Legacy 20-hexadecimal digit string that identifies the identity provider. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-getRoleMapping.txt b/docs/command/atlas-api-federatedAuthentication-getRoleMapping.txt new file mode 100644 index 0000000000..4293bada43 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-getRoleMapping.txt @@ -0,0 +1,74 @@ +.. _atlas-api-federatedAuthentication-getRoleMapping: + +================================================ +atlas api federatedAuthentication getRoleMapping +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Role Mapping from One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication getRoleMapping [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getRoleMapping + * - --id + - string + - true + - Unique 24-hexadecimal digit string that identifies the role mapping that you want to return. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-listConnectedOrgConfigs.txt b/docs/command/atlas-api-federatedAuthentication-listConnectedOrgConfigs.txt new file mode 100644 index 0000000000..e9abcedf63 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-listConnectedOrgConfigs.txt @@ -0,0 +1,66 @@ +.. _atlas-api-federatedAuthentication-listConnectedOrgConfigs: + +========================================================= +atlas api federatedAuthentication listConnectedOrgConfigs +========================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Connected Org Configs from the Federation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication listConnectedOrgConfigs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listConnectedOrgConfigs + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-listIdentityProviders.txt b/docs/command/atlas-api-federatedAuthentication-listIdentityProviders.txt new file mode 100644 index 0000000000..b92c114f8b --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-listIdentityProviders.txt @@ -0,0 +1,82 @@ +.. _atlas-api-federatedAuthentication-listIdentityProviders: + +======================================================= +atlas api federatedAuthentication listIdentityProviders +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return all identity providers from the specified federation. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication listIdentityProviders [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listIdentityProviders + * - --idpType + - strings + - false + - The types of the target identity providers. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --protocol + - strings + - false + - The protocols of the target identity providers. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-listRoleMappings.txt b/docs/command/atlas-api-federatedAuthentication-listRoleMappings.txt new file mode 100644 index 0000000000..1a7eff6ed0 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-listRoleMappings.txt @@ -0,0 +1,70 @@ +.. _atlas-api-federatedAuthentication-listRoleMappings: + +================================================== +atlas api federatedAuthentication listRoleMappings +================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Role Mappings from One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication listRoleMappings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listRoleMappings + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-removeConnectedOrgConfig.txt b/docs/command/atlas-api-federatedAuthentication-removeConnectedOrgConfig.txt new file mode 100644 index 0000000000..975da0c5e8 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-removeConnectedOrgConfig.txt @@ -0,0 +1,70 @@ +.. _atlas-api-federatedAuthentication-removeConnectedOrgConfig: + +========================================================== +atlas api federatedAuthentication removeConnectedOrgConfig +========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Org Config Connected to One Federation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication removeConnectedOrgConfig [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for removeConnectedOrgConfig + * - --orgId + - string + - true + - Unique 24-hexadecimal digit string that identifies the connected organization configuration to remove. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-revokeJwksFromIdentityProvider.txt b/docs/command/atlas-api-federatedAuthentication-revokeJwksFromIdentityProvider.txt new file mode 100644 index 0000000000..6222a790af --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-revokeJwksFromIdentityProvider.txt @@ -0,0 +1,66 @@ +.. _atlas-api-federatedAuthentication-revokeJwksFromIdentityProvider: + +================================================================ +atlas api federatedAuthentication revokeJwksFromIdentityProvider +================================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Revoke the JWKS tokens from an OIDC identity provider. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication revokeJwksFromIdentityProvider [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -h, --help + - + - false + - help for revokeJwksFromIdentityProvider + * - --identityProviderId + - string + - true + - Unique 24-hexadecimal digit string that identifies the identity provider to connect. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-updateConnectedOrgConfig.txt b/docs/command/atlas-api-federatedAuthentication-updateConnectedOrgConfig.txt new file mode 100644 index 0000000000..df590b570f --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-updateConnectedOrgConfig.txt @@ -0,0 +1,74 @@ +.. _atlas-api-federatedAuthentication-updateConnectedOrgConfig: + +========================================================== +atlas api federatedAuthentication updateConnectedOrgConfig +========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Org Config Connected to One Federation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication updateConnectedOrgConfig [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateConnectedOrgConfig + * - --orgId + - string + - true + - Unique 24-hexadecimal digit string that identifies the connected organization configuration to update. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-updateIdentityProvider.txt b/docs/command/atlas-api-federatedAuthentication-updateIdentityProvider.txt new file mode 100644 index 0000000000..09209ea421 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-updateIdentityProvider.txt @@ -0,0 +1,74 @@ +.. _atlas-api-federatedAuthentication-updateIdentityProvider: + +======================================================== +atlas api federatedAuthentication updateIdentityProvider +======================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update the identity provider. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication updateIdentityProvider [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateIdentityProvider + * - --identityProviderId + - string + - true + - Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the legacy 20-hexadecimal digit id. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. For all other versions, use the 24-hexadecimal digit id. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication-updateRoleMapping.txt b/docs/command/atlas-api-federatedAuthentication-updateRoleMapping.txt new file mode 100644 index 0000000000..34db52b44d --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication-updateRoleMapping.txt @@ -0,0 +1,78 @@ +.. _atlas-api-federatedAuthentication-updateRoleMapping: + +=================================================== +atlas api federatedAuthentication updateRoleMapping +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Role Mapping in One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api federatedAuthentication updateRoleMapping [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --federationSettingsId + - string + - true + - Unique 24-hexadecimal digit string that identifies your federation. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateRoleMapping + * - --id + - string + - true + - Unique 24-hexadecimal digit string that identifies the role mapping that you want to update. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-federatedAuthentication.txt b/docs/command/atlas-api-federatedAuthentication.txt new file mode 100644 index 0000000000..90a075d3c0 --- /dev/null +++ b/docs/command/atlas-api-federatedAuthentication.txt @@ -0,0 +1,93 @@ +.. _atlas-api-federatedAuthentication: + +================================= +atlas api federatedAuthentication +================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for federatedAuthentication + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-federatedAuthentication-createIdentityProvider` - Create one identity provider +* :ref:`atlas-api-federatedAuthentication-createRoleMapping` - Add One Role Mapping to One Organization +* :ref:`atlas-api-federatedAuthentication-deleteFederationApp` - Delete the federation settings instance. +* :ref:`atlas-api-federatedAuthentication-deleteIdentityProvider` - Delete the identity provider. +* :ref:`atlas-api-federatedAuthentication-deleteRoleMapping` - Remove One Role Mapping from One Organization +* :ref:`atlas-api-federatedAuthentication-getConnectedOrgConfig` - Return One Org Config Connected to One Federation +* :ref:`atlas-api-federatedAuthentication-getFederationSettings` - Return Federation Settings for One Organization +* :ref:`atlas-api-federatedAuthentication-getIdentityProvider` - Return one identity provider from the specified federation by id. +* :ref:`atlas-api-federatedAuthentication-getIdentityProviderMetadata` - Return the metadata of one identity provider in the specified federation. +* :ref:`atlas-api-federatedAuthentication-getRoleMapping` - Return One Role Mapping from One Organization +* :ref:`atlas-api-federatedAuthentication-listConnectedOrgConfigs` - Return All Connected Org Configs from the Federation +* :ref:`atlas-api-federatedAuthentication-listIdentityProviders` - Return all identity providers from the specified federation. +* :ref:`atlas-api-federatedAuthentication-listRoleMappings` - Return All Role Mappings from One Organization +* :ref:`atlas-api-federatedAuthentication-removeConnectedOrgConfig` - Remove One Org Config Connected to One Federation +* :ref:`atlas-api-federatedAuthentication-revokeJwksFromIdentityProvider` - Revoke the JWKS tokens from an OIDC identity provider. +* :ref:`atlas-api-federatedAuthentication-updateConnectedOrgConfig` - Update One Org Config Connected to One Federation +* :ref:`atlas-api-federatedAuthentication-updateIdentityProvider` - Update the identity provider. +* :ref:`atlas-api-federatedAuthentication-updateRoleMapping` - Update One Role Mapping in One Organization + + +.. toctree:: + :titlesonly: + + createIdentityProvider + createRoleMapping + deleteFederationApp + deleteIdentityProvider + deleteRoleMapping + getConnectedOrgConfig + getFederationSettings + getIdentityProvider + getIdentityProviderMetadata + getRoleMapping + listConnectedOrgConfigs + listIdentityProviders + listRoleMappings + removeConnectedOrgConfig + revokeJwksFromIdentityProvider + updateConnectedOrgConfig + updateIdentityProvider + updateRoleMapping + diff --git a/docs/command/atlas-api-globalClusters-createCustomZoneMapping.txt b/docs/command/atlas-api-globalClusters-createCustomZoneMapping.txt new file mode 100644 index 0000000000..683a3caebf --- /dev/null +++ b/docs/command/atlas-api-globalClusters-createCustomZoneMapping.txt @@ -0,0 +1,74 @@ +.. _atlas-api-globalClusters-createCustomZoneMapping: + +================================================ +atlas api globalClusters createCustomZoneMapping +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Add One Entry to One Custom Zone Mapping + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api globalClusters createCustomZoneMapping [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies this cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createCustomZoneMapping + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-globalClusters-createManagedNamespace.txt b/docs/command/atlas-api-globalClusters-createManagedNamespace.txt new file mode 100644 index 0000000000..1ffa30f5a5 --- /dev/null +++ b/docs/command/atlas-api-globalClusters-createManagedNamespace.txt @@ -0,0 +1,74 @@ +.. _atlas-api-globalClusters-createManagedNamespace: + +=============================================== +atlas api globalClusters createManagedNamespace +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Managed Namespace in One Global Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api globalClusters createManagedNamespace [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies this cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createManagedNamespace + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-globalClusters-deleteAllCustomZoneMappings.txt b/docs/command/atlas-api-globalClusters-deleteAllCustomZoneMappings.txt new file mode 100644 index 0000000000..a236f42c63 --- /dev/null +++ b/docs/command/atlas-api-globalClusters-deleteAllCustomZoneMappings.txt @@ -0,0 +1,70 @@ +.. _atlas-api-globalClusters-deleteAllCustomZoneMappings: + +==================================================== +atlas api globalClusters deleteAllCustomZoneMappings +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove All Custom Zone Mappings from One Global Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api globalClusters deleteAllCustomZoneMappings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies this cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteAllCustomZoneMappings + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-globalClusters-deleteManagedNamespace.txt b/docs/command/atlas-api-globalClusters-deleteManagedNamespace.txt new file mode 100644 index 0000000000..54ea539282 --- /dev/null +++ b/docs/command/atlas-api-globalClusters-deleteManagedNamespace.txt @@ -0,0 +1,78 @@ +.. _atlas-api-globalClusters-deleteManagedNamespace: + +=============================================== +atlas api globalClusters deleteManagedNamespace +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Managed Namespace from One Global Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api globalClusters deleteManagedNamespace [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies this cluster. + * - --collection + - string + - false + - Human-readable label that identifies the collection associated with the managed namespace. + * - --db + - string + - false + - Human-readable label that identifies the database that contains the collection. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteManagedNamespace + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-globalClusters-getManagedNamespace.txt b/docs/command/atlas-api-globalClusters-getManagedNamespace.txt new file mode 100644 index 0000000000..06fc853ea4 --- /dev/null +++ b/docs/command/atlas-api-globalClusters-getManagedNamespace.txt @@ -0,0 +1,70 @@ +.. _atlas-api-globalClusters-getManagedNamespace: + +============================================ +atlas api globalClusters getManagedNamespace +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Managed Namespace in One Global Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api globalClusters getManagedNamespace [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies this cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getManagedNamespace + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-globalClusters.txt b/docs/command/atlas-api-globalClusters.txt new file mode 100644 index 0000000000..ef381cbaba --- /dev/null +++ b/docs/command/atlas-api-globalClusters.txt @@ -0,0 +1,68 @@ +.. _atlas-api-globalClusters: + +======================== +atlas api globalClusters +======================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. +MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for globalClusters + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-globalClusters-createCustomZoneMapping` - Add One Entry to One Custom Zone Mapping +* :ref:`atlas-api-globalClusters-createManagedNamespace` - Create One Managed Namespace in One Global Cluster +* :ref:`atlas-api-globalClusters-deleteAllCustomZoneMappings` - Remove All Custom Zone Mappings from One Global Cluster +* :ref:`atlas-api-globalClusters-deleteManagedNamespace` - Remove One Managed Namespace from One Global Cluster +* :ref:`atlas-api-globalClusters-getManagedNamespace` - Return One Managed Namespace in One Global Cluster + + +.. toctree:: + :titlesonly: + + createCustomZoneMapping + createManagedNamespace + deleteAllCustomZoneMappings + deleteManagedNamespace + getManagedNamespace + diff --git a/docs/command/atlas-api-invoices-createCostExplorerQueryProcess.txt b/docs/command/atlas-api-invoices-createCostExplorerQueryProcess.txt new file mode 100644 index 0000000000..10b0029000 --- /dev/null +++ b/docs/command/atlas-api-invoices-createCostExplorerQueryProcess.txt @@ -0,0 +1,70 @@ +.. _atlas-api-invoices-createCostExplorerQueryProcess: + +================================================= +atlas api invoices createCostExplorerQueryProcess +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create Cost Explorer query process + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api invoices createCostExplorerQueryProcess [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createCostExplorerQueryProcess + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-invoices-createCostExplorerQueryProcess1.txt b/docs/command/atlas-api-invoices-createCostExplorerQueryProcess1.txt new file mode 100644 index 0000000000..b3c0deb079 --- /dev/null +++ b/docs/command/atlas-api-invoices-createCostExplorerQueryProcess1.txt @@ -0,0 +1,70 @@ +.. _atlas-api-invoices-createCostExplorerQueryProcess1: + +================================================== +atlas api invoices createCostExplorerQueryProcess1 +================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return results from a given Cost Explorer query, or notify that the results are not ready yet. + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api invoices createCostExplorerQueryProcess1 [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createCostExplorerQueryProcess1 + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --token + - string + - true + - Unique 64 digit string that identifies the Cost Explorer query. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-invoices-downloadInvoiceCSV.txt b/docs/command/atlas-api-invoices-downloadInvoiceCSV.txt new file mode 100644 index 0000000000..ed3cfc53ae --- /dev/null +++ b/docs/command/atlas-api-invoices-downloadInvoiceCSV.txt @@ -0,0 +1,70 @@ +.. _atlas-api-invoices-downloadInvoiceCSV: + +===================================== +atlas api invoices downloadInvoiceCSV +===================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Organization Invoice as CSV + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api invoices downloadInvoiceCSV [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for downloadInvoiceCSV + * - --invoiceId + - string + - true + - Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-invoices-getInvoice.txt b/docs/command/atlas-api-invoices-getInvoice.txt new file mode 100644 index 0000000000..b6d2202f48 --- /dev/null +++ b/docs/command/atlas-api-invoices-getInvoice.txt @@ -0,0 +1,70 @@ +.. _atlas-api-invoices-getInvoice: + +============================= +atlas api invoices getInvoice +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Organization Invoice + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api invoices getInvoice [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getInvoice + * - --invoiceId + - string + - true + - Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-invoices-listInvoices.txt b/docs/command/atlas-api-invoices-listInvoices.txt new file mode 100644 index 0000000000..9f5d8001b3 --- /dev/null +++ b/docs/command/atlas-api-invoices-listInvoices.txt @@ -0,0 +1,78 @@ +.. _atlas-api-invoices-listInvoices: + +=============================== +atlas api invoices listInvoices +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Invoices for One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api invoices listInvoices [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listInvoices + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-invoices-listPendingInvoices.txt b/docs/command/atlas-api-invoices-listPendingInvoices.txt new file mode 100644 index 0000000000..93e6367d5c --- /dev/null +++ b/docs/command/atlas-api-invoices-listPendingInvoices.txt @@ -0,0 +1,66 @@ +.. _atlas-api-invoices-listPendingInvoices: + +====================================== +atlas api invoices listPendingInvoices +====================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Pending Invoices for One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api invoices listPendingInvoices [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPendingInvoices + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-invoices.txt b/docs/command/atlas-api-invoices.txt new file mode 100644 index 0000000000..b1a9afe995 --- /dev/null +++ b/docs/command/atlas-api-invoices.txt @@ -0,0 +1,69 @@ +.. _atlas-api-invoices: + +================== +atlas api invoices +================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns invoices. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for invoices + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-invoices-createCostExplorerQueryProcess` - Create Cost Explorer query process +* :ref:`atlas-api-invoices-createCostExplorerQueryProcess1` - Return results from a given Cost Explorer query, or notify that the results are not ready yet. +* :ref:`atlas-api-invoices-downloadInvoiceCSV` - Return One Organization Invoice as CSV +* :ref:`atlas-api-invoices-getInvoice` - Return One Organization Invoice +* :ref:`atlas-api-invoices-listInvoices` - Return All Invoices for One Organization +* :ref:`atlas-api-invoices-listPendingInvoices` - Return All Pending Invoices for One Organization + + +.. toctree:: + :titlesonly: + + createCostExplorerQueryProcess + createCostExplorerQueryProcess1 + downloadInvoiceCSV + getInvoice + listInvoices + listPendingInvoices + diff --git a/docs/command/atlas-api-lDAPConfiguration-deleteLDAPConfiguration.txt b/docs/command/atlas-api-lDAPConfiguration-deleteLDAPConfiguration.txt new file mode 100644 index 0000000000..5405d38813 --- /dev/null +++ b/docs/command/atlas-api-lDAPConfiguration-deleteLDAPConfiguration.txt @@ -0,0 +1,66 @@ +.. _atlas-api-lDAPConfiguration-deleteLDAPConfiguration: + +=================================================== +atlas api lDAPConfiguration deleteLDAPConfiguration +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove the Current LDAP User to DN Mapping + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api lDAPConfiguration deleteLDAPConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteLDAPConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-lDAPConfiguration-getLDAPConfiguration.txt b/docs/command/atlas-api-lDAPConfiguration-getLDAPConfiguration.txt new file mode 100644 index 0000000000..544307771f --- /dev/null +++ b/docs/command/atlas-api-lDAPConfiguration-getLDAPConfiguration.txt @@ -0,0 +1,66 @@ +.. _atlas-api-lDAPConfiguration-getLDAPConfiguration: + +================================================ +atlas api lDAPConfiguration getLDAPConfiguration +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return the Current LDAP or X.509 Configuration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api lDAPConfiguration getLDAPConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getLDAPConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-lDAPConfiguration-getLDAPConfigurationStatus.txt b/docs/command/atlas-api-lDAPConfiguration-getLDAPConfigurationStatus.txt new file mode 100644 index 0000000000..ec5a95cda0 --- /dev/null +++ b/docs/command/atlas-api-lDAPConfiguration-getLDAPConfigurationStatus.txt @@ -0,0 +1,70 @@ +.. _atlas-api-lDAPConfiguration-getLDAPConfigurationStatus: + +====================================================== +atlas api lDAPConfiguration getLDAPConfigurationStatus +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return the Status of One Verify LDAP Configuration Request + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api lDAPConfiguration getLDAPConfigurationStatus [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getLDAPConfigurationStatus + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --requestId + - string + - true + - Unique string that identifies the request to verify an <abbr title="Lightweight Directory Access Protocol">LDAP</abbr> configuration. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-lDAPConfiguration-saveLDAPConfiguration.txt b/docs/command/atlas-api-lDAPConfiguration-saveLDAPConfiguration.txt new file mode 100644 index 0000000000..763112b53a --- /dev/null +++ b/docs/command/atlas-api-lDAPConfiguration-saveLDAPConfiguration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-lDAPConfiguration-saveLDAPConfiguration: + +================================================= +atlas api lDAPConfiguration saveLDAPConfiguration +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Edit the LDAP or X.509 Configuration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api lDAPConfiguration saveLDAPConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for saveLDAPConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-lDAPConfiguration-verifyLDAPConfiguration.txt b/docs/command/atlas-api-lDAPConfiguration-verifyLDAPConfiguration.txt new file mode 100644 index 0000000000..92befc5a92 --- /dev/null +++ b/docs/command/atlas-api-lDAPConfiguration-verifyLDAPConfiguration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-lDAPConfiguration-verifyLDAPConfiguration: + +=================================================== +atlas api lDAPConfiguration verifyLDAPConfiguration +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Verify the LDAP Configuration in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api lDAPConfiguration verifyLDAPConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for verifyLDAPConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-lDAPConfiguration.txt b/docs/command/atlas-api-lDAPConfiguration.txt new file mode 100644 index 0000000000..78a72e486b --- /dev/null +++ b/docs/command/atlas-api-lDAPConfiguration.txt @@ -0,0 +1,67 @@ +.. _atlas-api-lDAPConfiguration: + +=========================== +atlas api lDAPConfiguration +=========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for lDAPConfiguration + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-lDAPConfiguration-deleteLDAPConfiguration` - Remove the Current LDAP User to DN Mapping +* :ref:`atlas-api-lDAPConfiguration-getLDAPConfiguration` - Return the Current LDAP or X.509 Configuration +* :ref:`atlas-api-lDAPConfiguration-getLDAPConfigurationStatus` - Return the Status of One Verify LDAP Configuration Request +* :ref:`atlas-api-lDAPConfiguration-saveLDAPConfiguration` - Edit the LDAP or X.509 Configuration +* :ref:`atlas-api-lDAPConfiguration-verifyLDAPConfiguration` - Verify the LDAP Configuration in One Project + + +.. toctree:: + :titlesonly: + + deleteLDAPConfiguration + getLDAPConfiguration + getLDAPConfigurationStatus + saveLDAPConfiguration + verifyLDAPConfiguration + diff --git a/docs/command/atlas-api-legacyBackup-createLegacyBackupRestoreJob.txt b/docs/command/atlas-api-legacyBackup-createLegacyBackupRestoreJob.txt new file mode 100644 index 0000000000..e306eea746 --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-createLegacyBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-legacyBackup-createLegacyBackupRestoreJob: + +=================================================== +atlas api legacyBackup createLegacyBackupRestoreJob +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Legacy Backup Restore Job + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup createLegacyBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster with the snapshot you want to return. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createLegacyBackupRestoreJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-deleteLegacySnapshot.txt b/docs/command/atlas-api-legacyBackup-deleteLegacySnapshot.txt new file mode 100644 index 0000000000..f1e158807e --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-deleteLegacySnapshot.txt @@ -0,0 +1,74 @@ +.. _atlas-api-legacyBackup-deleteLegacySnapshot: + +=========================================== +atlas api legacyBackup deleteLegacySnapshot +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Legacy Backup Snapshot + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup deleteLegacySnapshot [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteLegacySnapshot + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-getLegacyBackupCheckpoint.txt b/docs/command/atlas-api-legacyBackup-getLegacyBackupCheckpoint.txt new file mode 100644 index 0000000000..8126b9156e --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-getLegacyBackupCheckpoint.txt @@ -0,0 +1,74 @@ +.. _atlas-api-legacyBackup-getLegacyBackupCheckpoint: + +================================================ +atlas api legacyBackup getLegacyBackupCheckpoint +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Legacy Backup Checkpoint + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup getLegacyBackupCheckpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --checkpointId + - string + - true + - Unique 24-hexadecimal digit string that identifies the checkpoint. + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that contains the checkpoints that you want to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getLegacyBackupCheckpoint + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-getLegacyBackupRestoreJob.txt b/docs/command/atlas-api-legacyBackup-getLegacyBackupRestoreJob.txt new file mode 100644 index 0000000000..00544f7b79 --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-getLegacyBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-legacyBackup-getLegacyBackupRestoreJob: + +================================================ +atlas api legacyBackup getLegacyBackupRestoreJob +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Legacy Backup Restore Job + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup getLegacyBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster with the snapshot you want to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getLegacyBackupRestoreJob + * - --jobId + - string + - true + - Unique 24-hexadecimal digit string that identifies the restore job. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-getLegacySnapshot.txt b/docs/command/atlas-api-legacyBackup-getLegacySnapshot.txt new file mode 100644 index 0000000000..5a7d66724c --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-getLegacySnapshot.txt @@ -0,0 +1,74 @@ +.. _atlas-api-legacyBackup-getLegacySnapshot: + +======================================== +atlas api legacyBackup getLegacySnapshot +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Legacy Backup Snapshot + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup getLegacySnapshot [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getLegacySnapshot + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-getLegacySnapshotSchedule.txt b/docs/command/atlas-api-legacyBackup-getLegacySnapshotSchedule.txt new file mode 100644 index 0000000000..615b0edb55 --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-getLegacySnapshotSchedule.txt @@ -0,0 +1,70 @@ +.. _atlas-api-legacyBackup-getLegacySnapshotSchedule: + +================================================ +atlas api legacyBackup getLegacySnapshotSchedule +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Snapshot Schedule + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup getLegacySnapshotSchedule [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster with the snapshot you want to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getLegacySnapshotSchedule + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-listLegacyBackupCheckpoints.txt b/docs/command/atlas-api-legacyBackup-listLegacyBackupCheckpoints.txt new file mode 100644 index 0000000000..62475c0040 --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-listLegacyBackupCheckpoints.txt @@ -0,0 +1,82 @@ +.. _atlas-api-legacyBackup-listLegacyBackupCheckpoints: + +================================================== +atlas api legacyBackup listLegacyBackupCheckpoints +================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Legacy Backup Checkpoints + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup listLegacyBackupCheckpoints [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that contains the checkpoints that you want to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listLegacyBackupCheckpoints + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-listLegacyBackupRestoreJobs.txt b/docs/command/atlas-api-legacyBackup-listLegacyBackupRestoreJobs.txt new file mode 100644 index 0000000000..2530695bb8 --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-listLegacyBackupRestoreJobs.txt @@ -0,0 +1,86 @@ +.. _atlas-api-legacyBackup-listLegacyBackupRestoreJobs: + +================================================== +atlas api legacyBackup listLegacyBackupRestoreJobs +================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Legacy Backup Restore Jobs + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup listLegacyBackupRestoreJobs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --batchId + - string + - false + - Unique 24-hexadecimal digit string that identifies the batch of restore jobs to return. Timestamp in ISO 8601 date and time format in UTC when creating a restore job for a sharded cluster, Application creates a separate job for each shard, plus another for the config host. Each of these jobs comprise one batch. A restore job for a replica set can't be part of a batch. + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster with the snapshot you want to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listLegacyBackupRestoreJobs + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-listLegacySnapshots.txt b/docs/command/atlas-api-legacyBackup-listLegacySnapshots.txt new file mode 100644 index 0000000000..b6507b7cf1 --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-listLegacySnapshots.txt @@ -0,0 +1,86 @@ +.. _atlas-api-legacyBackup-listLegacySnapshots: + +========================================== +atlas api legacyBackup listLegacySnapshots +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Legacy Backup Snapshots + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup listLegacySnapshots [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --completed + - string + - false + - Human-readable label that specifies whether to return only completed, incomplete, or all snapshots. By default, MongoDB Cloud only returns completed snapshots. This value defaults to ""true"". + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listLegacySnapshots + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-updateLegacySnapshotRetention.txt b/docs/command/atlas-api-legacyBackup-updateLegacySnapshotRetention.txt new file mode 100644 index 0000000000..173be0739e --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-updateLegacySnapshotRetention.txt @@ -0,0 +1,78 @@ +.. _atlas-api-legacyBackup-updateLegacySnapshotRetention: + +==================================================== +atlas api legacyBackup updateLegacySnapshotRetention +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Change One Legacy Backup Snapshot Expiration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup updateLegacySnapshotRetention [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateLegacySnapshotRetention + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup-updateLegacySnapshotSchedule.txt b/docs/command/atlas-api-legacyBackup-updateLegacySnapshotSchedule.txt new file mode 100644 index 0000000000..6e41eeeab1 --- /dev/null +++ b/docs/command/atlas-api-legacyBackup-updateLegacySnapshotSchedule.txt @@ -0,0 +1,74 @@ +.. _atlas-api-legacyBackup-updateLegacySnapshotSchedule: + +=================================================== +atlas api legacyBackup updateLegacySnapshotSchedule +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Snapshot Schedule for One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api legacyBackup updateLegacySnapshotSchedule [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster with the snapshot you want to return. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateLegacySnapshotSchedule + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-legacyBackup.txt b/docs/command/atlas-api-legacyBackup.txt new file mode 100644 index 0000000000..7ed2ffcee2 --- /dev/null +++ b/docs/command/atlas-api-legacyBackup.txt @@ -0,0 +1,79 @@ +.. _atlas-api-legacyBackup: + +====================== +atlas api legacyBackup +====================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for legacyBackup + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-legacyBackup-createLegacyBackupRestoreJob` - Create One Legacy Backup Restore Job +* :ref:`atlas-api-legacyBackup-deleteLegacySnapshot` - Remove One Legacy Backup Snapshot +* :ref:`atlas-api-legacyBackup-getLegacyBackupCheckpoint` - Return One Legacy Backup Checkpoint +* :ref:`atlas-api-legacyBackup-getLegacyBackupRestoreJob` - Return One Legacy Backup Restore Job +* :ref:`atlas-api-legacyBackup-getLegacySnapshot` - Return One Legacy Backup Snapshot +* :ref:`atlas-api-legacyBackup-getLegacySnapshotSchedule` - Return One Snapshot Schedule +* :ref:`atlas-api-legacyBackup-listLegacyBackupCheckpoints` - Return All Legacy Backup Checkpoints +* :ref:`atlas-api-legacyBackup-listLegacyBackupRestoreJobs` - Return All Legacy Backup Restore Jobs +* :ref:`atlas-api-legacyBackup-listLegacySnapshots` - Return All Legacy Backup Snapshots +* :ref:`atlas-api-legacyBackup-updateLegacySnapshotRetention` - Change One Legacy Backup Snapshot Expiration +* :ref:`atlas-api-legacyBackup-updateLegacySnapshotSchedule` - Update Snapshot Schedule for One Cluster + + +.. toctree:: + :titlesonly: + + createLegacyBackupRestoreJob + deleteLegacySnapshot + getLegacyBackupCheckpoint + getLegacyBackupRestoreJob + getLegacySnapshot + getLegacySnapshotSchedule + listLegacyBackupCheckpoints + listLegacyBackupRestoreJobs + listLegacySnapshots + updateLegacySnapshotRetention + updateLegacySnapshotSchedule + diff --git a/docs/command/atlas-api-maintenanceWindows-deferMaintenanceWindow.txt b/docs/command/atlas-api-maintenanceWindows-deferMaintenanceWindow.txt new file mode 100644 index 0000000000..5b44ff70ac --- /dev/null +++ b/docs/command/atlas-api-maintenanceWindows-deferMaintenanceWindow.txt @@ -0,0 +1,62 @@ +.. _atlas-api-maintenanceWindows-deferMaintenanceWindow: + +=================================================== +atlas api maintenanceWindows deferMaintenanceWindow +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Defer One Maintenance Window for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api maintenanceWindows deferMaintenanceWindow [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for deferMaintenanceWindow + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-maintenanceWindows-getMaintenanceWindow.txt b/docs/command/atlas-api-maintenanceWindows-getMaintenanceWindow.txt new file mode 100644 index 0000000000..dcb937c49d --- /dev/null +++ b/docs/command/atlas-api-maintenanceWindows-getMaintenanceWindow.txt @@ -0,0 +1,66 @@ +.. _atlas-api-maintenanceWindows-getMaintenanceWindow: + +================================================= +atlas api maintenanceWindows getMaintenanceWindow +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Maintenance Window for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api maintenanceWindows getMaintenanceWindow [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getMaintenanceWindow + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-maintenanceWindows-resetMaintenanceWindow.txt b/docs/command/atlas-api-maintenanceWindows-resetMaintenanceWindow.txt new file mode 100644 index 0000000000..fe43872c33 --- /dev/null +++ b/docs/command/atlas-api-maintenanceWindows-resetMaintenanceWindow.txt @@ -0,0 +1,62 @@ +.. _atlas-api-maintenanceWindows-resetMaintenanceWindow: + +=================================================== +atlas api maintenanceWindows resetMaintenanceWindow +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Reset One Maintenance Window for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api maintenanceWindows resetMaintenanceWindow [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for resetMaintenanceWindow + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-maintenanceWindows-toggleMaintenanceAutoDefer.txt b/docs/command/atlas-api-maintenanceWindows-toggleMaintenanceAutoDefer.txt new file mode 100644 index 0000000000..3fbfec0556 --- /dev/null +++ b/docs/command/atlas-api-maintenanceWindows-toggleMaintenanceAutoDefer.txt @@ -0,0 +1,62 @@ +.. _atlas-api-maintenanceWindows-toggleMaintenanceAutoDefer: + +======================================================= +atlas api maintenanceWindows toggleMaintenanceAutoDefer +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Toggle Automatic Deferral of Maintenance for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api maintenanceWindows toggleMaintenanceAutoDefer [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for toggleMaintenanceAutoDefer + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-maintenanceWindows-updateMaintenanceWindow.txt b/docs/command/atlas-api-maintenanceWindows-updateMaintenanceWindow.txt new file mode 100644 index 0000000000..50441486f1 --- /dev/null +++ b/docs/command/atlas-api-maintenanceWindows-updateMaintenanceWindow.txt @@ -0,0 +1,70 @@ +.. _atlas-api-maintenanceWindows-updateMaintenanceWindow: + +==================================================== +atlas api maintenanceWindows updateMaintenanceWindow +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Maintenance Window for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api maintenanceWindows updateMaintenanceWindow [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateMaintenanceWindow + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-maintenanceWindows.txt b/docs/command/atlas-api-maintenanceWindows.txt new file mode 100644 index 0000000000..e87c5e8fc1 --- /dev/null +++ b/docs/command/atlas-api-maintenanceWindows.txt @@ -0,0 +1,67 @@ +.. _atlas-api-maintenanceWindows: + +============================ +atlas api maintenanceWindows +============================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, edits, and removes maintenance windows. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. You can defer a scheduled maintenance event for a project up to two times. Deferred maintenance events occur during your preferred maintenance window exactly one week after the previously scheduled date and time. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for maintenanceWindows + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-maintenanceWindows-deferMaintenanceWindow` - Defer One Maintenance Window for One Project +* :ref:`atlas-api-maintenanceWindows-getMaintenanceWindow` - Return One Maintenance Window for One Project +* :ref:`atlas-api-maintenanceWindows-resetMaintenanceWindow` - Reset One Maintenance Window for One Project +* :ref:`atlas-api-maintenanceWindows-toggleMaintenanceAutoDefer` - Toggle Automatic Deferral of Maintenance for One Project +* :ref:`atlas-api-maintenanceWindows-updateMaintenanceWindow` - Update Maintenance Window for One Project + + +.. toctree:: + :titlesonly: + + deferMaintenanceWindow + getMaintenanceWindow + resetMaintenanceWindow + toggleMaintenanceAutoDefer + updateMaintenanceWindow + diff --git a/docs/command/atlas-api-mongoDBCloudUsers-createUser.txt b/docs/command/atlas-api-mongoDBCloudUsers-createUser.txt new file mode 100644 index 0000000000..fddd13609c --- /dev/null +++ b/docs/command/atlas-api-mongoDBCloudUsers-createUser.txt @@ -0,0 +1,66 @@ +.. _atlas-api-mongoDBCloudUsers-createUser: + +====================================== +atlas api mongoDBCloudUsers createUser +====================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One MongoDB Cloud User + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api mongoDBCloudUsers createUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createUser + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-mongoDBCloudUsers-getUser.txt b/docs/command/atlas-api-mongoDBCloudUsers-getUser.txt new file mode 100644 index 0000000000..3e9961361a --- /dev/null +++ b/docs/command/atlas-api-mongoDBCloudUsers-getUser.txt @@ -0,0 +1,66 @@ +.. _atlas-api-mongoDBCloudUsers-getUser: + +=================================== +atlas api mongoDBCloudUsers getUser +=================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One MongoDB Cloud User using Its ID + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api mongoDBCloudUsers getUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getUser + * - --userId + - string + - true + - Unique 24-hexadecimal digit string that identifies this user. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-mongoDBCloudUsers-getUserByUsername.txt b/docs/command/atlas-api-mongoDBCloudUsers-getUserByUsername.txt new file mode 100644 index 0000000000..9220601789 --- /dev/null +++ b/docs/command/atlas-api-mongoDBCloudUsers-getUserByUsername.txt @@ -0,0 +1,66 @@ +.. _atlas-api-mongoDBCloudUsers-getUserByUsername: + +============================================= +atlas api mongoDBCloudUsers getUserByUsername +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One MongoDB Cloud User using Their Username + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api mongoDBCloudUsers getUserByUsername [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getUserByUsername + * - --userName + - string + - true + - Email address that belongs to the MongoDB Cloud user account. You cannot modify this address after creating the user. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-mongoDBCloudUsers.txt b/docs/command/atlas-api-mongoDBCloudUsers.txt new file mode 100644 index 0000000000..d0784e89eb --- /dev/null +++ b/docs/command/atlas-api-mongoDBCloudUsers.txt @@ -0,0 +1,63 @@ +.. _atlas-api-mongoDBCloudUsers: + +=========================== +atlas api mongoDBCloudUsers +=========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, and edits MongoDB Cloud users. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for mongoDBCloudUsers + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-mongoDBCloudUsers-createUser` - Create One MongoDB Cloud User +* :ref:`atlas-api-mongoDBCloudUsers-getUser` - Return One MongoDB Cloud User using Its ID +* :ref:`atlas-api-mongoDBCloudUsers-getUserByUsername` - Return One MongoDB Cloud User using Their Username + + +.. toctree:: + :titlesonly: + + createUser + getUser + getUserByUsername + diff --git a/docs/command/atlas-api-monitoringAndLogs-getAtlasProcess.txt b/docs/command/atlas-api-monitoringAndLogs-getAtlasProcess.txt new file mode 100644 index 0000000000..91aa6a0a2c --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-getAtlasProcess.txt @@ -0,0 +1,70 @@ +.. _atlas-api-monitoringAndLogs-getAtlasProcess: + +=========================================== +atlas api monitoringAndLogs getAtlasProcess +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One MongoDB Process by ID + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs getAtlasProcess [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getAtlasProcess + * - --processId + - string + - true + - Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-getDatabase.txt b/docs/command/atlas-api-monitoringAndLogs-getDatabase.txt new file mode 100644 index 0000000000..8a1d1852b6 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-getDatabase.txt @@ -0,0 +1,74 @@ +.. _atlas-api-monitoringAndLogs-getDatabase: + +======================================= +atlas api monitoringAndLogs getDatabase +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Database for a MongoDB Process + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs getDatabase [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --databaseName + - string + - true + - Human-readable label that identifies the database that the specified MongoDB process serves. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getDatabase + * - --processId + - string + - true + - Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-getDatabaseMeasurements.txt b/docs/command/atlas-api-monitoringAndLogs-getDatabaseMeasurements.txt new file mode 100644 index 0000000000..e7344d8b44 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-getDatabaseMeasurements.txt @@ -0,0 +1,94 @@ +.. _atlas-api-monitoringAndLogs-getDatabaseMeasurements: + +=================================================== +atlas api monitoringAndLogs getDatabaseMeasurements +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Measurements of One Database for One MongoDB Process + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs getDatabaseMeasurements [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --databaseName + - string + - true + - Human-readable label that identifies the database that the specified MongoDB process serves. + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - --granularity + - string + - true + - Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. + * - -h, --help + - + - false + - help for getDatabaseMeasurements + * - --m + - strings + - false + - One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements. + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --processId + - string + - true + - Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-getDiskMeasurements.txt b/docs/command/atlas-api-monitoringAndLogs-getDiskMeasurements.txt new file mode 100644 index 0000000000..a8ed9cd2ec --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-getDiskMeasurements.txt @@ -0,0 +1,94 @@ +.. _atlas-api-monitoringAndLogs-getDiskMeasurements: + +=============================================== +atlas api monitoringAndLogs getDiskMeasurements +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Measurements of One Disk for One MongoDB Process + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs getDiskMeasurements [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - --granularity + - string + - true + - Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. + * - -h, --help + - + - false + - help for getDiskMeasurements + * - --m + - strings + - false + - One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements. + * - --partitionName + - string + - true + - Human-readable label of the disk or partition to which the measurements apply. + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --processId + - string + - true + - Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-getHostLogs.txt b/docs/command/atlas-api-monitoringAndLogs-getHostLogs.txt new file mode 100644 index 0000000000..82db21f475 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-getHostLogs.txt @@ -0,0 +1,82 @@ +.. _atlas-api-monitoringAndLogs-getHostLogs: + +======================================= +atlas api monitoringAndLogs getHostLogs +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Download Logs for One Cluster Host in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs getHostLogs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --endDate + - int + - false + - Date and time when the period specifies the inclusive ending point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getHostLogs + * - --hostName + - string + - true + - Human-readable label that identifies the host that stores the log files that you want to download. + * - --logName + - string + - true + - Human-readable label that identifies the log file that you want to return. To return audit logs, enable *Database Auditing* for the specified project. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --startDate + - int + - false + - Date and time when the period specifies the inclusive starting point for the range of log messages to retrieve. This parameter expresses its value in the number of seconds that have elapsed since the UNIX epoch. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-getHostMeasurements.txt b/docs/command/atlas-api-monitoringAndLogs-getHostMeasurements.txt new file mode 100644 index 0000000000..356d0a8974 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-getHostMeasurements.txt @@ -0,0 +1,90 @@ +.. _atlas-api-monitoringAndLogs-getHostMeasurements: + +=============================================== +atlas api monitoringAndLogs getHostMeasurements +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Measurements for One MongoDB Process + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs getHostMeasurements [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - --granularity + - string + - true + - Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. + * - -h, --help + - + - false + - help for getHostMeasurements + * - --m + - strings + - false + - One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for `m`, repeat the `m` parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements. + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --processId + - string + - true + - Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-getIndexMetrics.txt b/docs/command/atlas-api-monitoringAndLogs-getIndexMetrics.txt new file mode 100644 index 0000000000..bbb421212b --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-getIndexMetrics.txt @@ -0,0 +1,102 @@ +.. _atlas-api-monitoringAndLogs-getIndexMetrics: + +=========================================== +atlas api monitoringAndLogs getIndexMetrics +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Atlas Search Metrics for One Index in One Specified Namespace + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs getIndexMetrics [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --collectionName + - string + - true + - Human-readable label that identifies the collection. + * - --databaseName + - string + - true + - Human-readable label that identifies the database. + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - --granularity + - string + - true + - Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. + * - -h, --help + - + - false + - help for getIndexMetrics + * - --indexName + - string + - true + - Human-readable label that identifies the index. + * - --metrics + - strings + - true + - List that contains the measurements that MongoDB Atlas reports for the associated data series. + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --processId + - string + - true + - Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-getMeasurements.txt b/docs/command/atlas-api-monitoringAndLogs-getMeasurements.txt new file mode 100644 index 0000000000..4d27e362c0 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-getMeasurements.txt @@ -0,0 +1,90 @@ +.. _atlas-api-monitoringAndLogs-getMeasurements: + +=========================================== +atlas api monitoringAndLogs getMeasurements +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Atlas Search Hardware and Status Metrics + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs getMeasurements [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - --granularity + - string + - true + - Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. + * - -h, --help + - + - false + - help for getMeasurements + * - --metrics + - strings + - true + - List that contains the metrics that you want MongoDB Atlas to report for the associated data series. If you don't set this parameter, this resource returns all hardware and status metrics for the associated data series. + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --processId + - string + - true + - Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-listAtlasProcesses.txt b/docs/command/atlas-api-monitoringAndLogs-listAtlasProcesses.txt new file mode 100644 index 0000000000..d8b44d01b9 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-listAtlasProcesses.txt @@ -0,0 +1,78 @@ +.. _atlas-api-monitoringAndLogs-listAtlasProcesses: + +============================================== +atlas api monitoringAndLogs listAtlasProcesses +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All MongoDB Processes in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs listAtlasProcesses [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listAtlasProcesses + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-listDatabases.txt b/docs/command/atlas-api-monitoringAndLogs-listDatabases.txt new file mode 100644 index 0000000000..b4bb4b6811 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-listDatabases.txt @@ -0,0 +1,82 @@ +.. _atlas-api-monitoringAndLogs-listDatabases: + +========================================= +atlas api monitoringAndLogs listDatabases +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Available Databases for One MongoDB Process + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs listDatabases [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listDatabases + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --processId + - string + - true + - Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-listDiskMeasurements.txt b/docs/command/atlas-api-monitoringAndLogs-listDiskMeasurements.txt new file mode 100644 index 0000000000..c4194757bf --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-listDiskMeasurements.txt @@ -0,0 +1,74 @@ +.. _atlas-api-monitoringAndLogs-listDiskMeasurements: + +================================================ +atlas api monitoringAndLogs listDiskMeasurements +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Measurements of One Disk + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs listDiskMeasurements [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listDiskMeasurements + * - --partitionName + - string + - true + - Human-readable label of the disk or partition to which the measurements apply. + * - --processId + - string + - true + - Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-listDiskPartitions.txt b/docs/command/atlas-api-monitoringAndLogs-listDiskPartitions.txt new file mode 100644 index 0000000000..654c8b7829 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-listDiskPartitions.txt @@ -0,0 +1,82 @@ +.. _atlas-api-monitoringAndLogs-listDiskPartitions: + +============================================== +atlas api monitoringAndLogs listDiskPartitions +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Available Disks for One MongoDB Process + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs listDiskPartitions [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listDiskPartitions + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --processId + - string + - true + - Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-listIndexMetrics.txt b/docs/command/atlas-api-monitoringAndLogs-listIndexMetrics.txt new file mode 100644 index 0000000000..ec6b6af0c6 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-listIndexMetrics.txt @@ -0,0 +1,98 @@ +.. _atlas-api-monitoringAndLogs-listIndexMetrics: + +============================================ +atlas api monitoringAndLogs listIndexMetrics +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Atlas Search Index Metrics for One Namespace + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs listIndexMetrics [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --collectionName + - string + - true + - Human-readable label that identifies the collection. + * - --databaseName + - string + - true + - Human-readable label that identifies the database. + * - --end + - string + - false + - Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + * - --format + - string + - false + - Format of the output + * - --granularity + - string + - true + - Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. + * - -h, --help + - + - false + - help for listIndexMetrics + * - --metrics + - strings + - true + - List that contains the measurements that MongoDB Atlas reports for the associated data series. + * - --period + - string + - false + - Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**. + * - --processId + - string + - true + - Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --start + - string + - false + - Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs-listMetricTypes.txt b/docs/command/atlas-api-monitoringAndLogs-listMetricTypes.txt new file mode 100644 index 0000000000..284c6f62e9 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs-listMetricTypes.txt @@ -0,0 +1,70 @@ +.. _atlas-api-monitoringAndLogs-listMetricTypes: + +=========================================== +atlas api monitoringAndLogs listMetricTypes +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Atlas Search Metric Types for One Process + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api monitoringAndLogs listMetricTypes [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listMetricTypes + * - --processId + - string + - true + - Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-monitoringAndLogs.txt b/docs/command/atlas-api-monitoringAndLogs.txt new file mode 100644 index 0000000000..0d55669450 --- /dev/null +++ b/docs/command/atlas-api-monitoringAndLogs.txt @@ -0,0 +1,85 @@ +.. _atlas-api-monitoringAndLogs: + +=========================== +atlas api monitoringAndLogs +=========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns database deployment monitoring and logging data. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for monitoringAndLogs + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-monitoringAndLogs-getAtlasProcess` - Return One MongoDB Process by ID +* :ref:`atlas-api-monitoringAndLogs-getDatabase` - Return One Database for a MongoDB Process +* :ref:`atlas-api-monitoringAndLogs-getDatabaseMeasurements` - Return Measurements of One Database for One MongoDB Process +* :ref:`atlas-api-monitoringAndLogs-getDiskMeasurements` - Return Measurements of One Disk for One MongoDB Process +* :ref:`atlas-api-monitoringAndLogs-getHostLogs` - Download Logs for One Cluster Host in One Project +* :ref:`atlas-api-monitoringAndLogs-getHostMeasurements` - Return Measurements for One MongoDB Process +* :ref:`atlas-api-monitoringAndLogs-getIndexMetrics` - Return Atlas Search Metrics for One Index in One Specified Namespace +* :ref:`atlas-api-monitoringAndLogs-getMeasurements` - Return Atlas Search Hardware and Status Metrics +* :ref:`atlas-api-monitoringAndLogs-listAtlasProcesses` - Return All MongoDB Processes in One Project +* :ref:`atlas-api-monitoringAndLogs-listDatabases` - Return Available Databases for One MongoDB Process +* :ref:`atlas-api-monitoringAndLogs-listDiskMeasurements` - Return Measurements of One Disk +* :ref:`atlas-api-monitoringAndLogs-listDiskPartitions` - Return Available Disks for One MongoDB Process +* :ref:`atlas-api-monitoringAndLogs-listIndexMetrics` - Return All Atlas Search Index Metrics for One Namespace +* :ref:`atlas-api-monitoringAndLogs-listMetricTypes` - Return All Atlas Search Metric Types for One Process + + +.. toctree:: + :titlesonly: + + getAtlasProcess + getDatabase + getDatabaseMeasurements + getDiskMeasurements + getHostLogs + getHostMeasurements + getIndexMetrics + getMeasurements + listAtlasProcesses + listDatabases + listDiskMeasurements + listDiskPartitions + listIndexMetrics + listMetricTypes + diff --git a/docs/command/atlas-api-networkPeering-createPeeringConnection.txt b/docs/command/atlas-api-networkPeering-createPeeringConnection.txt new file mode 100644 index 0000000000..8ff6ca02df --- /dev/null +++ b/docs/command/atlas-api-networkPeering-createPeeringConnection.txt @@ -0,0 +1,70 @@ +.. _atlas-api-networkPeering-createPeeringConnection: + +================================================ +atlas api networkPeering createPeeringConnection +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One New Network Peering Connection + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering createPeeringConnection [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createPeeringConnection + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-createPeeringContainer.txt b/docs/command/atlas-api-networkPeering-createPeeringContainer.txt new file mode 100644 index 0000000000..2684307574 --- /dev/null +++ b/docs/command/atlas-api-networkPeering-createPeeringContainer.txt @@ -0,0 +1,70 @@ +.. _atlas-api-networkPeering-createPeeringContainer: + +=============================================== +atlas api networkPeering createPeeringContainer +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One New Network Peering Container + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering createPeeringContainer [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createPeeringContainer + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-deletePeeringConnection.txt b/docs/command/atlas-api-networkPeering-deletePeeringConnection.txt new file mode 100644 index 0000000000..b999d6d14a --- /dev/null +++ b/docs/command/atlas-api-networkPeering-deletePeeringConnection.txt @@ -0,0 +1,70 @@ +.. _atlas-api-networkPeering-deletePeeringConnection: + +================================================ +atlas api networkPeering deletePeeringConnection +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Existing Network Peering Connection + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering deletePeeringConnection [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deletePeeringConnection + * - --peerId + - string + - true + - Unique 24-hexadecimal digit string that identifies the network peering connection that you want to delete. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-deletePeeringContainer.txt b/docs/command/atlas-api-networkPeering-deletePeeringContainer.txt new file mode 100644 index 0000000000..4fd52d29e4 --- /dev/null +++ b/docs/command/atlas-api-networkPeering-deletePeeringContainer.txt @@ -0,0 +1,70 @@ +.. _atlas-api-networkPeering-deletePeeringContainer: + +=============================================== +atlas api networkPeering deletePeeringContainer +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Network Peering Container + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering deletePeeringContainer [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --containerId + - string + - true + - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deletePeeringContainer + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-disablePeering.txt b/docs/command/atlas-api-networkPeering-disablePeering.txt new file mode 100644 index 0000000000..ec1cd3fa4d --- /dev/null +++ b/docs/command/atlas-api-networkPeering-disablePeering.txt @@ -0,0 +1,70 @@ +.. _atlas-api-networkPeering-disablePeering: + +======================================= +atlas api networkPeering disablePeering +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Disable Connect via Peering Only Mode for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering disablePeering [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for disablePeering + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-getPeeringConnection.txt b/docs/command/atlas-api-networkPeering-getPeeringConnection.txt new file mode 100644 index 0000000000..ede77eaf4b --- /dev/null +++ b/docs/command/atlas-api-networkPeering-getPeeringConnection.txt @@ -0,0 +1,70 @@ +.. _atlas-api-networkPeering-getPeeringConnection: + +============================================= +atlas api networkPeering getPeeringConnection +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Network Peering Connection in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering getPeeringConnection [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPeeringConnection + * - --peerId + - string + - true + - Unique 24-hexadecimal digit string that identifies the network peering connection that you want to retrieve. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-getPeeringContainer.txt b/docs/command/atlas-api-networkPeering-getPeeringContainer.txt new file mode 100644 index 0000000000..2c661406c8 --- /dev/null +++ b/docs/command/atlas-api-networkPeering-getPeeringContainer.txt @@ -0,0 +1,70 @@ +.. _atlas-api-networkPeering-getPeeringContainer: + +============================================ +atlas api networkPeering getPeeringContainer +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Network Peering Container + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering getPeeringContainer [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --containerId + - string + - true + - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPeeringContainer + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-listPeeringConnections.txt b/docs/command/atlas-api-networkPeering-listPeeringConnections.txt new file mode 100644 index 0000000000..a438681b42 --- /dev/null +++ b/docs/command/atlas-api-networkPeering-listPeeringConnections.txt @@ -0,0 +1,82 @@ +.. _atlas-api-networkPeering-listPeeringConnections: + +=============================================== +atlas api networkPeering listPeeringConnections +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Network Peering Connections in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering listPeeringConnections [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPeeringConnections + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --providerName + - string + - false + - Cloud service provider to use for this VPC peering connection. This value defaults to ""AWS"". + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-listPeeringContainerByCloudProvider.txt b/docs/command/atlas-api-networkPeering-listPeeringContainerByCloudProvider.txt new file mode 100644 index 0000000000..a986442198 --- /dev/null +++ b/docs/command/atlas-api-networkPeering-listPeeringContainerByCloudProvider.txt @@ -0,0 +1,82 @@ +.. _atlas-api-networkPeering-listPeeringContainerByCloudProvider: + +============================================================ +atlas api networkPeering listPeeringContainerByCloudProvider +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Network Peering Containers in One Project for One Cloud Provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering listPeeringContainerByCloudProvider [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPeeringContainerByCloudProvider + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --providerName + - string + - true + - Cloud service provider that serves the desired network peering containers. This value defaults to ""AWS"". + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-listPeeringContainers.txt b/docs/command/atlas-api-networkPeering-listPeeringContainers.txt new file mode 100644 index 0000000000..d31f72a061 --- /dev/null +++ b/docs/command/atlas-api-networkPeering-listPeeringContainers.txt @@ -0,0 +1,78 @@ +.. _atlas-api-networkPeering-listPeeringContainers: + +============================================== +atlas api networkPeering listPeeringContainers +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Network Peering Containers in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering listPeeringContainers [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPeeringContainers + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-updatePeeringConnection.txt b/docs/command/atlas-api-networkPeering-updatePeeringConnection.txt new file mode 100644 index 0000000000..8f47e9022b --- /dev/null +++ b/docs/command/atlas-api-networkPeering-updatePeeringConnection.txt @@ -0,0 +1,74 @@ +.. _atlas-api-networkPeering-updatePeeringConnection: + +================================================ +atlas api networkPeering updatePeeringConnection +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One New Network Peering Connection + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering updatePeeringConnection [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updatePeeringConnection + * - --peerId + - string + - true + - Unique 24-hexadecimal digit string that identifies the network peering connection that you want to update. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-updatePeeringContainer.txt b/docs/command/atlas-api-networkPeering-updatePeeringContainer.txt new file mode 100644 index 0000000000..e3fb7915a9 --- /dev/null +++ b/docs/command/atlas-api-networkPeering-updatePeeringContainer.txt @@ -0,0 +1,74 @@ +.. _atlas-api-networkPeering-updatePeeringContainer: + +=============================================== +atlas api networkPeering updatePeeringContainer +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Network Peering Container + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering updatePeeringContainer [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --containerId + - string + - true + - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud network container that you want to remove. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updatePeeringContainer + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering-verifyConnectViaPeeringOnlyModeForOneProject.txt b/docs/command/atlas-api-networkPeering-verifyConnectViaPeeringOnlyModeForOneProject.txt new file mode 100644 index 0000000000..f0a9bfeef0 --- /dev/null +++ b/docs/command/atlas-api-networkPeering-verifyConnectViaPeeringOnlyModeForOneProject.txt @@ -0,0 +1,66 @@ +.. _atlas-api-networkPeering-verifyConnectViaPeeringOnlyModeForOneProject: + +===================================================================== +atlas api networkPeering verifyConnectViaPeeringOnlyModeForOneProject +===================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Verify Connect via Peering Only Mode for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api networkPeering verifyConnectViaPeeringOnlyModeForOneProject [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for verifyConnectViaPeeringOnlyModeForOneProject + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-networkPeering.txt b/docs/command/atlas-api-networkPeering.txt new file mode 100644 index 0000000000..926bc4de03 --- /dev/null +++ b/docs/command/atlas-api-networkPeering.txt @@ -0,0 +1,84 @@ +.. _atlas-api-networkPeering: + +======================== +atlas api networkPeering +======================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes network peering containers and peering connections. +When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for networkPeering + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-networkPeering-createPeeringConnection` - Create One New Network Peering Connection +* :ref:`atlas-api-networkPeering-createPeeringContainer` - Create One New Network Peering Container +* :ref:`atlas-api-networkPeering-deletePeeringConnection` - Remove One Existing Network Peering Connection +* :ref:`atlas-api-networkPeering-deletePeeringContainer` - Remove One Network Peering Container +* :ref:`atlas-api-networkPeering-disablePeering` - Disable Connect via Peering Only Mode for One Project +* :ref:`atlas-api-networkPeering-getPeeringConnection` - Return One Network Peering Connection in One Project +* :ref:`atlas-api-networkPeering-getPeeringContainer` - Return One Network Peering Container +* :ref:`atlas-api-networkPeering-listPeeringConnections` - Return All Network Peering Connections in One Project +* :ref:`atlas-api-networkPeering-listPeeringContainerByCloudProvider` - Return All Network Peering Containers in One Project for One Cloud Provider +* :ref:`atlas-api-networkPeering-listPeeringContainers` - Return All Network Peering Containers in One Project +* :ref:`atlas-api-networkPeering-updatePeeringConnection` - Update One New Network Peering Connection +* :ref:`atlas-api-networkPeering-updatePeeringContainer` - Update One Network Peering Container +* :ref:`atlas-api-networkPeering-verifyConnectViaPeeringOnlyModeForOneProject` - Verify Connect via Peering Only Mode for One Project + + +.. toctree:: + :titlesonly: + + createPeeringConnection + createPeeringContainer + deletePeeringConnection + deletePeeringContainer + disablePeering + getPeeringConnection + getPeeringContainer + listPeeringConnections + listPeeringContainerByCloudProvider + listPeeringContainers + updatePeeringConnection + updatePeeringContainer + verifyConnectViaPeeringOnlyModeForOneProject + diff --git a/docs/command/atlas-api-onlineArchive-createOnlineArchive.txt b/docs/command/atlas-api-onlineArchive-createOnlineArchive.txt new file mode 100644 index 0000000000..83ea1b53ab --- /dev/null +++ b/docs/command/atlas-api-onlineArchive-createOnlineArchive.txt @@ -0,0 +1,74 @@ +.. _atlas-api-onlineArchive-createOnlineArchive: + +=========================================== +atlas api onlineArchive createOnlineArchive +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Online Archive + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api onlineArchive createOnlineArchive [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that contains the collection for which you want to create one online archive. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createOnlineArchive + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-onlineArchive-deleteOnlineArchive.txt b/docs/command/atlas-api-onlineArchive-deleteOnlineArchive.txt new file mode 100644 index 0000000000..35a70977df --- /dev/null +++ b/docs/command/atlas-api-onlineArchive-deleteOnlineArchive.txt @@ -0,0 +1,74 @@ +.. _atlas-api-onlineArchive-deleteOnlineArchive: + +=========================================== +atlas api onlineArchive deleteOnlineArchive +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Online Archive + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api onlineArchive deleteOnlineArchive [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --archiveId + - string + - true + - Unique 24-hexadecimal digit string that identifies the online archive to delete. + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that contains the collection from which you want to remove an online archive. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteOnlineArchive + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-onlineArchive-downloadOnlineArchiveQueryLogs.txt b/docs/command/atlas-api-onlineArchive-downloadOnlineArchiveQueryLogs.txt new file mode 100644 index 0000000000..dbf7075225 --- /dev/null +++ b/docs/command/atlas-api-onlineArchive-downloadOnlineArchiveQueryLogs.txt @@ -0,0 +1,82 @@ +.. _atlas-api-onlineArchive-downloadOnlineArchiveQueryLogs: + +====================================================== +atlas api onlineArchive downloadOnlineArchiveQueryLogs +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Download Online Archive Query Logs + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api onlineArchive downloadOnlineArchiveQueryLogs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --archiveOnly + - + - false + - Flag that indicates whether to download logs for queries against your online archive only or both your online archive and cluster. + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that contains the collection for which you want to return the query logs from one online archive. + * - --endDate + - int + - false + - Date and time that specifies the end point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for downloadOnlineArchiveQueryLogs + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --startDate + - int + - false + - Date and time that specifies the starting point for the range of log messages to return. This resource expresses this value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-onlineArchive-getOnlineArchive.txt b/docs/command/atlas-api-onlineArchive-getOnlineArchive.txt new file mode 100644 index 0000000000..3d178d41e6 --- /dev/null +++ b/docs/command/atlas-api-onlineArchive-getOnlineArchive.txt @@ -0,0 +1,74 @@ +.. _atlas-api-onlineArchive-getOnlineArchive: + +======================================== +atlas api onlineArchive getOnlineArchive +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Online Archive + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api onlineArchive getOnlineArchive [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --archiveId + - string + - true + - Unique 24-hexadecimal digit string that identifies the online archive to return. + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getOnlineArchive + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-onlineArchive-listOnlineArchives.txt b/docs/command/atlas-api-onlineArchive-listOnlineArchives.txt new file mode 100644 index 0000000000..24b17fd8fe --- /dev/null +++ b/docs/command/atlas-api-onlineArchive-listOnlineArchives.txt @@ -0,0 +1,82 @@ +.. _atlas-api-onlineArchive-listOnlineArchives: + +========================================== +atlas api onlineArchive listOnlineArchives +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Online Archives for One Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api onlineArchive listOnlineArchives [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that contains the collection for which you want to return the online archives. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listOnlineArchives + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-onlineArchive-updateOnlineArchive.txt b/docs/command/atlas-api-onlineArchive-updateOnlineArchive.txt new file mode 100644 index 0000000000..33918878c8 --- /dev/null +++ b/docs/command/atlas-api-onlineArchive-updateOnlineArchive.txt @@ -0,0 +1,78 @@ +.. _atlas-api-onlineArchive-updateOnlineArchive: + +=========================================== +atlas api onlineArchive updateOnlineArchive +=========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Online Archive + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api onlineArchive updateOnlineArchive [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --archiveId + - string + - true + - Unique 24-hexadecimal digit string that identifies the online archive to update. + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster that contains the specified collection from which Application created the online archive. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateOnlineArchive + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-onlineArchive.txt b/docs/command/atlas-api-onlineArchive.txt new file mode 100644 index 0000000000..9075d906d6 --- /dev/null +++ b/docs/command/atlas-api-onlineArchive.txt @@ -0,0 +1,69 @@ +.. _atlas-api-onlineArchive: + +======================= +atlas api onlineArchive +======================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, or removes an online archive. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for onlineArchive + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-onlineArchive-createOnlineArchive` - Create One Online Archive +* :ref:`atlas-api-onlineArchive-deleteOnlineArchive` - Remove One Online Archive +* :ref:`atlas-api-onlineArchive-downloadOnlineArchiveQueryLogs` - Download Online Archive Query Logs +* :ref:`atlas-api-onlineArchive-getOnlineArchive` - Return One Online Archive +* :ref:`atlas-api-onlineArchive-listOnlineArchives` - Return All Online Archives for One Cluster +* :ref:`atlas-api-onlineArchive-updateOnlineArchive` - Update One Online Archive + + +.. toctree:: + :titlesonly: + + createOnlineArchive + deleteOnlineArchive + downloadOnlineArchiveQueryLogs + getOnlineArchive + listOnlineArchives + updateOnlineArchive + diff --git a/docs/command/atlas-api-organizations-createOrganization.txt b/docs/command/atlas-api-organizations-createOrganization.txt new file mode 100644 index 0000000000..75a0f8d845 --- /dev/null +++ b/docs/command/atlas-api-organizations-createOrganization.txt @@ -0,0 +1,66 @@ +.. _atlas-api-organizations-createOrganization: + +========================================== +atlas api organizations createOrganization +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations createOrganization [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createOrganization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-createOrganizationInvitation.txt b/docs/command/atlas-api-organizations-createOrganizationInvitation.txt new file mode 100644 index 0000000000..be5f6dc625 --- /dev/null +++ b/docs/command/atlas-api-organizations-createOrganizationInvitation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-organizations-createOrganizationInvitation: + +==================================================== +atlas api organizations createOrganizationInvitation +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Invite One MongoDB Cloud User to Join One Atlas Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations createOrganizationInvitation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createOrganizationInvitation + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-deleteOrganization.txt b/docs/command/atlas-api-organizations-deleteOrganization.txt new file mode 100644 index 0000000000..524eff46e7 --- /dev/null +++ b/docs/command/atlas-api-organizations-deleteOrganization.txt @@ -0,0 +1,66 @@ +.. _atlas-api-organizations-deleteOrganization: + +========================================== +atlas api organizations deleteOrganization +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations deleteOrganization [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteOrganization + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-deleteOrganizationInvitation.txt b/docs/command/atlas-api-organizations-deleteOrganizationInvitation.txt new file mode 100644 index 0000000000..979a1f5cbe --- /dev/null +++ b/docs/command/atlas-api-organizations-deleteOrganizationInvitation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-organizations-deleteOrganizationInvitation: + +==================================================== +atlas api organizations deleteOrganizationInvitation +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Cancel One Organization Invitation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations deleteOrganizationInvitation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteOrganizationInvitation + * - --invitationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the invitation. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-getOrganization.txt b/docs/command/atlas-api-organizations-getOrganization.txt new file mode 100644 index 0000000000..cdfd91064a --- /dev/null +++ b/docs/command/atlas-api-organizations-getOrganization.txt @@ -0,0 +1,66 @@ +.. _atlas-api-organizations-getOrganization: + +======================================= +atlas api organizations getOrganization +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations getOrganization [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getOrganization + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-getOrganizationInvitation.txt b/docs/command/atlas-api-organizations-getOrganizationInvitation.txt new file mode 100644 index 0000000000..fd83df90e4 --- /dev/null +++ b/docs/command/atlas-api-organizations-getOrganizationInvitation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-organizations-getOrganizationInvitation: + +================================================= +atlas api organizations getOrganizationInvitation +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Organization Invitation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations getOrganizationInvitation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getOrganizationInvitation + * - --invitationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the invitation. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-getOrganizationSettings.txt b/docs/command/atlas-api-organizations-getOrganizationSettings.txt new file mode 100644 index 0000000000..d1bf69eee2 --- /dev/null +++ b/docs/command/atlas-api-organizations-getOrganizationSettings.txt @@ -0,0 +1,66 @@ +.. _atlas-api-organizations-getOrganizationSettings: + +=============================================== +atlas api organizations getOrganizationSettings +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Settings for One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations getOrganizationSettings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getOrganizationSettings + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-listOrganizationInvitations.txt b/docs/command/atlas-api-organizations-listOrganizationInvitations.txt new file mode 100644 index 0000000000..8cf44255e6 --- /dev/null +++ b/docs/command/atlas-api-organizations-listOrganizationInvitations.txt @@ -0,0 +1,70 @@ +.. _atlas-api-organizations-listOrganizationInvitations: + +=================================================== +atlas api organizations listOrganizationInvitations +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Organization Invitations + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations listOrganizationInvitations [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listOrganizationInvitations + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --username + - string + - false + - Email address of the user account invited to this organization. If you exclude this parameter, this resource returns all pending invitations. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-listOrganizationProjects.txt b/docs/command/atlas-api-organizations-listOrganizationProjects.txt new file mode 100644 index 0000000000..a65f053066 --- /dev/null +++ b/docs/command/atlas-api-organizations-listOrganizationProjects.txt @@ -0,0 +1,82 @@ +.. _atlas-api-organizations-listOrganizationProjects: + +================================================ +atlas api organizations listOrganizationProjects +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One or More Projects in One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations listOrganizationProjects [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listOrganizationProjects + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --name + - string + - false + - Human-readable label of the project to use to filter the returned list. Performs a case-insensitive search for a project within the organization which is prefixed by the specified name. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-listOrganizationUsers.txt b/docs/command/atlas-api-organizations-listOrganizationUsers.txt new file mode 100644 index 0000000000..08b423cf42 --- /dev/null +++ b/docs/command/atlas-api-organizations-listOrganizationUsers.txt @@ -0,0 +1,78 @@ +.. _atlas-api-organizations-listOrganizationUsers: + +============================================= +atlas api organizations listOrganizationUsers +============================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All MongoDB Cloud Users in One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations listOrganizationUsers [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listOrganizationUsers + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-listOrganizations.txt b/docs/command/atlas-api-organizations-listOrganizations.txt new file mode 100644 index 0000000000..4ede49541b --- /dev/null +++ b/docs/command/atlas-api-organizations-listOrganizations.txt @@ -0,0 +1,78 @@ +.. _atlas-api-organizations-listOrganizations: + +========================================= +atlas api organizations listOrganizations +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Organizations + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations listOrganizations [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listOrganizations + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --name + - string + - false + - Human-readable label of the organization to use to filter the returned list. Performs a case-insensitive search for an organization that starts with the specified name. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-removeOrganizationUser.txt b/docs/command/atlas-api-organizations-removeOrganizationUser.txt new file mode 100644 index 0000000000..12c5bf29f1 --- /dev/null +++ b/docs/command/atlas-api-organizations-removeOrganizationUser.txt @@ -0,0 +1,70 @@ +.. _atlas-api-organizations-removeOrganizationUser: + +============================================== +atlas api organizations removeOrganizationUser +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One MongoDB Cloud User from One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations removeOrganizationUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for removeOrganizationUser + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --userId + - string + - true + - Unique 24-hexadecimal digit string that identifies the user to be deleted. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-renameOrganization.txt b/docs/command/atlas-api-organizations-renameOrganization.txt new file mode 100644 index 0000000000..7db69702c4 --- /dev/null +++ b/docs/command/atlas-api-organizations-renameOrganization.txt @@ -0,0 +1,70 @@ +.. _atlas-api-organizations-renameOrganization: + +========================================== +atlas api organizations renameOrganization +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Rename One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations renameOrganization [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for renameOrganization + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-updateOrganizationInvitation.txt b/docs/command/atlas-api-organizations-updateOrganizationInvitation.txt new file mode 100644 index 0000000000..41da5433a0 --- /dev/null +++ b/docs/command/atlas-api-organizations-updateOrganizationInvitation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-organizations-updateOrganizationInvitation: + +==================================================== +atlas api organizations updateOrganizationInvitation +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Organization Invitation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations updateOrganizationInvitation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateOrganizationInvitation + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-updateOrganizationInvitationById.txt b/docs/command/atlas-api-organizations-updateOrganizationInvitationById.txt new file mode 100644 index 0000000000..fa3f3cd4c0 --- /dev/null +++ b/docs/command/atlas-api-organizations-updateOrganizationInvitationById.txt @@ -0,0 +1,74 @@ +.. _atlas-api-organizations-updateOrganizationInvitationById: + +======================================================== +atlas api organizations updateOrganizationInvitationById +======================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Organization Invitation by Invitation ID + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations updateOrganizationInvitationById [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateOrganizationInvitationById + * - --invitationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the invitation. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-updateOrganizationRoles.txt b/docs/command/atlas-api-organizations-updateOrganizationRoles.txt new file mode 100644 index 0000000000..d15e21e55c --- /dev/null +++ b/docs/command/atlas-api-organizations-updateOrganizationRoles.txt @@ -0,0 +1,74 @@ +.. _atlas-api-organizations-updateOrganizationRoles: + +=============================================== +atlas api organizations updateOrganizationRoles +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Organization Roles for One MongoDB Cloud User + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations updateOrganizationRoles [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateOrganizationRoles + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --userId + - string + - true + - Unique 24-hexadecimal digit string that identifies the user to modify. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations-updateOrganizationSettings.txt b/docs/command/atlas-api-organizations-updateOrganizationSettings.txt new file mode 100644 index 0000000000..4433ebef41 --- /dev/null +++ b/docs/command/atlas-api-organizations-updateOrganizationSettings.txt @@ -0,0 +1,70 @@ +.. _atlas-api-organizations-updateOrganizationSettings: + +================================================== +atlas api organizations updateOrganizationSettings +================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Settings for One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api organizations updateOrganizationSettings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateOrganizationSettings + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-organizations.txt b/docs/command/atlas-api-organizations.txt new file mode 100644 index 0000000000..12e6335f67 --- /dev/null +++ b/docs/command/atlas-api-organizations.txt @@ -0,0 +1,91 @@ +.. _atlas-api-organizations: + +======================= +atlas api organizations +======================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, and edits organizational units in MongoDB Cloud. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for organizations + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-organizations-createOrganization` - Create One Organization +* :ref:`atlas-api-organizations-createOrganizationInvitation` - Invite One MongoDB Cloud User to Join One Atlas Organization +* :ref:`atlas-api-organizations-deleteOrganization` - Remove One Organization +* :ref:`atlas-api-organizations-deleteOrganizationInvitation` - Cancel One Organization Invitation +* :ref:`atlas-api-organizations-getOrganization` - Return One Organization +* :ref:`atlas-api-organizations-getOrganizationInvitation` - Return One Organization Invitation +* :ref:`atlas-api-organizations-getOrganizationSettings` - Return Settings for One Organization +* :ref:`atlas-api-organizations-listOrganizationInvitations` - Return All Organization Invitations +* :ref:`atlas-api-organizations-listOrganizationProjects` - Return One or More Projects in One Organization +* :ref:`atlas-api-organizations-listOrganizationUsers` - Return All MongoDB Cloud Users in One Organization +* :ref:`atlas-api-organizations-listOrganizations` - Return All Organizations +* :ref:`atlas-api-organizations-removeOrganizationUser` - Remove One MongoDB Cloud User from One Organization +* :ref:`atlas-api-organizations-renameOrganization` - Rename One Organization +* :ref:`atlas-api-organizations-updateOrganizationInvitation` - Update One Organization Invitation +* :ref:`atlas-api-organizations-updateOrganizationInvitationById` - Update One Organization Invitation by Invitation ID +* :ref:`atlas-api-organizations-updateOrganizationRoles` - Update Organization Roles for One MongoDB Cloud User +* :ref:`atlas-api-organizations-updateOrganizationSettings` - Update Settings for One Organization + + +.. toctree:: + :titlesonly: + + createOrganization + createOrganizationInvitation + deleteOrganization + deleteOrganizationInvitation + getOrganization + getOrganizationInvitation + getOrganizationSettings + listOrganizationInvitations + listOrganizationProjects + listOrganizationUsers + listOrganizations + removeOrganizationUser + renameOrganization + updateOrganizationInvitation + updateOrganizationInvitationById + updateOrganizationRoles + updateOrganizationSettings + diff --git a/docs/command/atlas-api-performanceAdvisor-disableSlowOperationThresholding.txt b/docs/command/atlas-api-performanceAdvisor-disableSlowOperationThresholding.txt new file mode 100644 index 0000000000..d3a3f0c86b --- /dev/null +++ b/docs/command/atlas-api-performanceAdvisor-disableSlowOperationThresholding.txt @@ -0,0 +1,62 @@ +.. _atlas-api-performanceAdvisor-disableSlowOperationThresholding: + +============================================================= +atlas api performanceAdvisor disableSlowOperationThresholding +============================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Disable Managed Slow Operation Threshold + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api performanceAdvisor disableSlowOperationThresholding [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for disableSlowOperationThresholding + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-performanceAdvisor-enableSlowOperationThresholding.txt b/docs/command/atlas-api-performanceAdvisor-enableSlowOperationThresholding.txt new file mode 100644 index 0000000000..f11fe047d1 --- /dev/null +++ b/docs/command/atlas-api-performanceAdvisor-enableSlowOperationThresholding.txt @@ -0,0 +1,62 @@ +.. _atlas-api-performanceAdvisor-enableSlowOperationThresholding: + +============================================================ +atlas api performanceAdvisor enableSlowOperationThresholding +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Enable Managed Slow Operation Threshold + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api performanceAdvisor enableSlowOperationThresholding [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for enableSlowOperationThresholding + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-performanceAdvisor-getServerlessAutoIndexing.txt b/docs/command/atlas-api-performanceAdvisor-getServerlessAutoIndexing.txt new file mode 100644 index 0000000000..4159502801 --- /dev/null +++ b/docs/command/atlas-api-performanceAdvisor-getServerlessAutoIndexing.txt @@ -0,0 +1,70 @@ +.. _atlas-api-performanceAdvisor-getServerlessAutoIndexing: + +====================================================== +atlas api performanceAdvisor getServerlessAutoIndexing +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Serverless Auto Indexing Enabled + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api performanceAdvisor getServerlessAutoIndexing [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getServerlessAutoIndexing + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-performanceAdvisor-listSlowQueries.txt b/docs/command/atlas-api-performanceAdvisor-listSlowQueries.txt new file mode 100644 index 0000000000..7f385120b2 --- /dev/null +++ b/docs/command/atlas-api-performanceAdvisor-listSlowQueries.txt @@ -0,0 +1,92 @@ +.. _atlas-api-performanceAdvisor-listSlowQueries: + +============================================ +atlas api performanceAdvisor listSlowQueries +============================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Slow Queries + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api performanceAdvisor listSlowQueries [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --duration + - int + - false + - Length of time expressed during which the query finds slow queries among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. + + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listSlowQueries + * - --nLogs + - int + - false + - Maximum number of lines from the log to return. This value defaults to 20000. + * - --namespaces + - strings + - false + - Namespaces from which to retrieve slow queries. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces. + * - --processId + - string + - true + - Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --since + - int + - false + - Date and time from which the query retrieves the slow queries. This parameter expresses its value in the number of milliseconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-performanceAdvisor-listSlowQueryNamespaces.txt b/docs/command/atlas-api-performanceAdvisor-listSlowQueryNamespaces.txt new file mode 100644 index 0000000000..3f0662c0bb --- /dev/null +++ b/docs/command/atlas-api-performanceAdvisor-listSlowQueryNamespaces.txt @@ -0,0 +1,84 @@ +.. _atlas-api-performanceAdvisor-listSlowQueryNamespaces: + +==================================================== +atlas api performanceAdvisor listSlowQueryNamespaces +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Namespaces for One Host + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api performanceAdvisor listSlowQueryNamespaces [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --duration + - int + - false + - Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. + + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listSlowQueryNamespaces + * - --processId + - string + - true + - Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --since + - int + - false + - Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of milliseconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-performanceAdvisor-listSuggestedIndexes.txt b/docs/command/atlas-api-performanceAdvisor-listSuggestedIndexes.txt new file mode 100644 index 0000000000..2f30b83dcd --- /dev/null +++ b/docs/command/atlas-api-performanceAdvisor-listSuggestedIndexes.txt @@ -0,0 +1,108 @@ +.. _atlas-api-performanceAdvisor-listSuggestedIndexes: + +================================================= +atlas api performanceAdvisor listSuggestedIndexes +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Suggested Indexes + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api performanceAdvisor listSuggestedIndexes [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --duration + - int + - false + - Length of time expressed during which the query finds suggested indexes among the managed namespaces in the cluster. This parameter expresses its value in milliseconds. + + - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. + - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listSuggestedIndexes + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --nExamples + - int + - false + - Maximum number of example queries that benefit from the suggested index. This value defaults to 5. + * - --nIndexes + - int + - false + - Number that indicates the maximum indexes to suggest. + * - --namespaces + - strings + - false + - Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --processId + - string + - true + - Combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (`mongod` or `mongos`). The port must be the IANA port on which the MongoDB process listens for requests. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --since + - int + - false + - Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of milliseconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + + - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. + - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-performanceAdvisor-setServerlessAutoIndexing.txt b/docs/command/atlas-api-performanceAdvisor-setServerlessAutoIndexing.txt new file mode 100644 index 0000000000..556483ea36 --- /dev/null +++ b/docs/command/atlas-api-performanceAdvisor-setServerlessAutoIndexing.txt @@ -0,0 +1,74 @@ +.. _atlas-api-performanceAdvisor-setServerlessAutoIndexing: + +====================================================== +atlas api performanceAdvisor setServerlessAutoIndexing +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Set Serverless Auto Indexing + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api performanceAdvisor setServerlessAutoIndexing [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --enable + - + - true + - Value that we want to set for the Serverless Auto Indexing toggle. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for setServerlessAutoIndexing + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-performanceAdvisor.txt b/docs/command/atlas-api-performanceAdvisor.txt new file mode 100644 index 0000000000..e806bd3316 --- /dev/null +++ b/docs/command/atlas-api-performanceAdvisor.txt @@ -0,0 +1,71 @@ +.. _atlas-api-performanceAdvisor: + +============================ +atlas api performanceAdvisor +============================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns suggested indexes and slow query data for a database deployment. Also enables or disables MongoDB Cloud-managed slow operation thresholds. To view field values in a sample query, you must have the Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted data rather than the field values. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for performanceAdvisor + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-performanceAdvisor-disableSlowOperationThresholding` - Disable Managed Slow Operation Threshold +* :ref:`atlas-api-performanceAdvisor-enableSlowOperationThresholding` - Enable Managed Slow Operation Threshold +* :ref:`atlas-api-performanceAdvisor-getServerlessAutoIndexing` - Return Serverless Auto Indexing Enabled +* :ref:`atlas-api-performanceAdvisor-listSlowQueries` - Return Slow Queries +* :ref:`atlas-api-performanceAdvisor-listSlowQueryNamespaces` - Return All Namespaces for One Host +* :ref:`atlas-api-performanceAdvisor-listSuggestedIndexes` - Return Suggested Indexes +* :ref:`atlas-api-performanceAdvisor-setServerlessAutoIndexing` - Set Serverless Auto Indexing + + +.. toctree:: + :titlesonly: + + disableSlowOperationThresholding + enableSlowOperationThresholding + getServerlessAutoIndexing + listSlowQueries + listSlowQueryNamespaces + listSuggestedIndexes + setServerlessAutoIndexing + diff --git a/docs/command/atlas-api-privateEndpointServices-createPrivateEndpoint.txt b/docs/command/atlas-api-privateEndpointServices-createPrivateEndpoint.txt new file mode 100644 index 0000000000..5f4eca2e57 --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-createPrivateEndpoint.txt @@ -0,0 +1,78 @@ +.. _atlas-api-privateEndpointServices-createPrivateEndpoint: + +======================================================= +atlas api privateEndpointServices createPrivateEndpoint +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Private Endpoint for One Provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices createPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --cloudProvider + - string + - true + - Cloud service provider that manages this private endpoint. This value defaults to ""AWS"". + * - --endpointServiceId + - string + - true + - Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to create a private endpoint. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createPrivateEndpoint + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices-createPrivateEndpointService.txt b/docs/command/atlas-api-privateEndpointServices-createPrivateEndpointService.txt new file mode 100644 index 0000000000..a3cfa9c8cb --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-createPrivateEndpointService.txt @@ -0,0 +1,70 @@ +.. _atlas-api-privateEndpointServices-createPrivateEndpointService: + +============================================================== +atlas api privateEndpointServices createPrivateEndpointService +============================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Private Endpoint Service for One Provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices createPrivateEndpointService [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createPrivateEndpointService + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices-deletePrivateEndpoint.txt b/docs/command/atlas-api-privateEndpointServices-deletePrivateEndpoint.txt new file mode 100644 index 0000000000..544ee3781d --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-deletePrivateEndpoint.txt @@ -0,0 +1,78 @@ +.. _atlas-api-privateEndpointServices-deletePrivateEndpoint: + +======================================================= +atlas api privateEndpointServices deletePrivateEndpoint +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Private Endpoint for One Provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices deletePrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --cloudProvider + - string + - true + - Cloud service provider that manages this private endpoint. This value defaults to ""AWS"". + * - --endpointId + - string + - true + - Unique string that identifies the private endpoint you want to delete. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints. + * - --endpointServiceId + - string + - true + - Unique 24-hexadecimal digit string that identifies the private endpoint service from which you want to delete a private endpoint. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deletePrivateEndpoint + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices-deletePrivateEndpointService.txt b/docs/command/atlas-api-privateEndpointServices-deletePrivateEndpointService.txt new file mode 100644 index 0000000000..6bddbc6ee1 --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-deletePrivateEndpointService.txt @@ -0,0 +1,74 @@ +.. _atlas-api-privateEndpointServices-deletePrivateEndpointService: + +============================================================== +atlas api privateEndpointServices deletePrivateEndpointService +============================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Private Endpoint Service for One Provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices deletePrivateEndpointService [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --cloudProvider + - string + - true + - Cloud service provider that manages this private endpoint service. This value defaults to ""AWS"". + * - --endpointServiceId + - string + - true + - Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to delete. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deletePrivateEndpointService + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices-getPrivateEndpoint.txt b/docs/command/atlas-api-privateEndpointServices-getPrivateEndpoint.txt new file mode 100644 index 0000000000..86c103477f --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-getPrivateEndpoint.txt @@ -0,0 +1,78 @@ +.. _atlas-api-privateEndpointServices-getPrivateEndpoint: + +==================================================== +atlas api privateEndpointServices getPrivateEndpoint +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Private Endpoint for One Provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices getPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --cloudProvider + - string + - true + - Cloud service provider that manages this private endpoint. This value defaults to ""AWS"". + * - --endpointId + - string + - true + - Unique string that identifies the private endpoint you want to return. The format of the **endpointId** parameter differs for AWS and Azure. You must URL encode the **endpointId** for Azure private endpoints. + * - --endpointServiceId + - string + - true + - Unique 24-hexadecimal digit string that identifies the private endpoint service for which you want to return a private endpoint. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPrivateEndpoint + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices-getPrivateEndpointService.txt b/docs/command/atlas-api-privateEndpointServices-getPrivateEndpointService.txt new file mode 100644 index 0000000000..2cc5541fa9 --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-getPrivateEndpointService.txt @@ -0,0 +1,74 @@ +.. _atlas-api-privateEndpointServices-getPrivateEndpointService: + +=========================================================== +atlas api privateEndpointServices getPrivateEndpointService +=========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Private Endpoint Service for One Provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices getPrivateEndpointService [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --cloudProvider + - string + - true + - Cloud service provider that manages this private endpoint service. This value defaults to ""AWS"". + * - --endpointServiceId + - string + - true + - Unique 24-hexadecimal digit string that identifies the private endpoint service that you want to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPrivateEndpointService + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices-getRegionalizedPrivateEndpointSetting.txt b/docs/command/atlas-api-privateEndpointServices-getRegionalizedPrivateEndpointSetting.txt new file mode 100644 index 0000000000..1adedd2b89 --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-getRegionalizedPrivateEndpointSetting.txt @@ -0,0 +1,66 @@ +.. _atlas-api-privateEndpointServices-getRegionalizedPrivateEndpointSetting: + +======================================================================= +atlas api privateEndpointServices getRegionalizedPrivateEndpointSetting +======================================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Regionalized Private Endpoint Status + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices getRegionalizedPrivateEndpointSetting [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getRegionalizedPrivateEndpointSetting + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices-listPrivateEndpointServices.txt b/docs/command/atlas-api-privateEndpointServices-listPrivateEndpointServices.txt new file mode 100644 index 0000000000..aa8b70b9b2 --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-listPrivateEndpointServices.txt @@ -0,0 +1,70 @@ +.. _atlas-api-privateEndpointServices-listPrivateEndpointServices: + +============================================================= +atlas api privateEndpointServices listPrivateEndpointServices +============================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Private Endpoint Services for One Provider + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices listPrivateEndpointServices [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --cloudProvider + - string + - true + - Cloud service provider that manages this private endpoint service. This value defaults to ""AWS"". + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listPrivateEndpointServices + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices-toggleRegionalizedPrivateEndpointSetting.txt b/docs/command/atlas-api-privateEndpointServices-toggleRegionalizedPrivateEndpointSetting.txt new file mode 100644 index 0000000000..7912595106 --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices-toggleRegionalizedPrivateEndpointSetting.txt @@ -0,0 +1,70 @@ +.. _atlas-api-privateEndpointServices-toggleRegionalizedPrivateEndpointSetting: + +========================================================================== +atlas api privateEndpointServices toggleRegionalizedPrivateEndpointSetting +========================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Toggle Regionalized Private Endpoint Status + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api privateEndpointServices toggleRegionalizedPrivateEndpointSetting [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for toggleRegionalizedPrivateEndpointSetting + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-privateEndpointServices.txt b/docs/command/atlas-api-privateEndpointServices.txt new file mode 100644 index 0000000000..216464cf69 --- /dev/null +++ b/docs/command/atlas-api-privateEndpointServices.txt @@ -0,0 +1,75 @@ +.. _atlas-api-privateEndpointServices: + +================================= +atlas api privateEndpointServices +================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes private endpoint services. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for privateEndpointServices + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-privateEndpointServices-createPrivateEndpoint` - Create One Private Endpoint for One Provider +* :ref:`atlas-api-privateEndpointServices-createPrivateEndpointService` - Create One Private Endpoint Service for One Provider +* :ref:`atlas-api-privateEndpointServices-deletePrivateEndpoint` - Remove One Private Endpoint for One Provider +* :ref:`atlas-api-privateEndpointServices-deletePrivateEndpointService` - Remove One Private Endpoint Service for One Provider +* :ref:`atlas-api-privateEndpointServices-getPrivateEndpoint` - Return One Private Endpoint for One Provider +* :ref:`atlas-api-privateEndpointServices-getPrivateEndpointService` - Return One Private Endpoint Service for One Provider +* :ref:`atlas-api-privateEndpointServices-getRegionalizedPrivateEndpointSetting` - Return Regionalized Private Endpoint Status +* :ref:`atlas-api-privateEndpointServices-listPrivateEndpointServices` - Return All Private Endpoint Services for One Provider +* :ref:`atlas-api-privateEndpointServices-toggleRegionalizedPrivateEndpointSetting` - Toggle Regionalized Private Endpoint Status + + +.. toctree:: + :titlesonly: + + createPrivateEndpoint + createPrivateEndpointService + deletePrivateEndpoint + deletePrivateEndpointService + getPrivateEndpoint + getPrivateEndpointService + getRegionalizedPrivateEndpointSetting + listPrivateEndpointServices + toggleRegionalizedPrivateEndpointSetting + diff --git a/docs/command/atlas-api-programmaticAPIKeys-addProjectApiKey.txt b/docs/command/atlas-api-programmaticAPIKeys-addProjectApiKey.txt new file mode 100644 index 0000000000..ba9919603a --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-addProjectApiKey.txt @@ -0,0 +1,74 @@ +.. _atlas-api-programmaticAPIKeys-addProjectApiKey: + +============================================== +atlas api programmaticAPIKeys addProjectApiKey +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Assign One Organization API Key to One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys addProjectApiKey [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key that you want to assign to one project. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for addProjectApiKey + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-createApiKey.txt b/docs/command/atlas-api-programmaticAPIKeys-createApiKey.txt new file mode 100644 index 0000000000..b1dd661ca9 --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-createApiKey.txt @@ -0,0 +1,70 @@ +.. _atlas-api-programmaticAPIKeys-createApiKey: + +========================================== +atlas api programmaticAPIKeys createApiKey +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Organization API Key + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys createApiKey [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createApiKey + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-createApiKeyAccessList.txt b/docs/command/atlas-api-programmaticAPIKeys-createApiKeyAccessList.txt new file mode 100644 index 0000000000..ebf1a1e498 --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-createApiKeyAccessList.txt @@ -0,0 +1,86 @@ +.. _atlas-api-programmaticAPIKeys-createApiKeyAccessList: + +==================================================== +atlas api programmaticAPIKeys createApiKeyAccessList +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create Access List Entries for One Organization API Key + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys createApiKeyAccessList [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key for which you want to create a new access list entry. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createApiKeyAccessList + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-createProjectApiKey.txt b/docs/command/atlas-api-programmaticAPIKeys-createProjectApiKey.txt new file mode 100644 index 0000000000..196316e501 --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-createProjectApiKey.txt @@ -0,0 +1,70 @@ +.. _atlas-api-programmaticAPIKeys-createProjectApiKey: + +================================================= +atlas api programmaticAPIKeys createProjectApiKey +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create and Assign One Organization API Key to One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys createProjectApiKey [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createProjectApiKey + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-deleteApiKey.txt b/docs/command/atlas-api-programmaticAPIKeys-deleteApiKey.txt new file mode 100644 index 0000000000..57cf617136 --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-deleteApiKey.txt @@ -0,0 +1,70 @@ +.. _atlas-api-programmaticAPIKeys-deleteApiKey: + +========================================== +atlas api programmaticAPIKeys deleteApiKey +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Organization API Key + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys deleteApiKey [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteApiKey + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-deleteApiKeyAccessListEntry.txt b/docs/command/atlas-api-programmaticAPIKeys-deleteApiKeyAccessListEntry.txt new file mode 100644 index 0000000000..d66162f94b --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-deleteApiKeyAccessListEntry.txt @@ -0,0 +1,74 @@ +.. _atlas-api-programmaticAPIKeys-deleteApiKeyAccessListEntry: + +========================================================= +atlas api programmaticAPIKeys deleteApiKeyAccessListEntry +========================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Access List Entry for One Organization API Key + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys deleteApiKeyAccessListEntry [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key for which you want to remove access list entries. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteApiKeyAccessListEntry + * - --ipAddress + - string + - true + - One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-getApiKey.txt b/docs/command/atlas-api-programmaticAPIKeys-getApiKey.txt new file mode 100644 index 0000000000..b69e4d718b --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-getApiKey.txt @@ -0,0 +1,70 @@ +.. _atlas-api-programmaticAPIKeys-getApiKey: + +======================================= +atlas api programmaticAPIKeys getApiKey +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Organization API Key + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys getApiKey [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key that you want to update. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getApiKey + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-getApiKeyAccessList.txt b/docs/command/atlas-api-programmaticAPIKeys-getApiKeyAccessList.txt new file mode 100644 index 0000000000..8d0e0f9518 --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-getApiKeyAccessList.txt @@ -0,0 +1,74 @@ +.. _atlas-api-programmaticAPIKeys-getApiKeyAccessList: + +================================================= +atlas api programmaticAPIKeys getApiKeyAccessList +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Access List Entry for One Organization API Key + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys getApiKeyAccessList [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getApiKeyAccessList + * - --ipAddress + - string + - true + - One IP address or multiple IP addresses represented as one CIDR block to limit requests to API resources in the specified organization. When adding a CIDR block with a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-listApiKeyAccessListsEntries.txt b/docs/command/atlas-api-programmaticAPIKeys-listApiKeyAccessListsEntries.txt new file mode 100644 index 0000000000..54ad980e0d --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-listApiKeyAccessListsEntries.txt @@ -0,0 +1,82 @@ +.. _atlas-api-programmaticAPIKeys-listApiKeyAccessListsEntries: + +========================================================== +atlas api programmaticAPIKeys listApiKeyAccessListsEntries +========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Access List Entries for One Organization API Key + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys listApiKeyAccessListsEntries [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key for which you want to return access list entries. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listApiKeyAccessListsEntries + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-listApiKeys.txt b/docs/command/atlas-api-programmaticAPIKeys-listApiKeys.txt new file mode 100644 index 0000000000..384bdb4f4b --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-listApiKeys.txt @@ -0,0 +1,78 @@ +.. _atlas-api-programmaticAPIKeys-listApiKeys: + +========================================= +atlas api programmaticAPIKeys listApiKeys +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Organization API Keys + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys listApiKeys [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listApiKeys + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-listProjectApiKeys.txt b/docs/command/atlas-api-programmaticAPIKeys-listProjectApiKeys.txt new file mode 100644 index 0000000000..bd477fd75e --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-listProjectApiKeys.txt @@ -0,0 +1,78 @@ +.. _atlas-api-programmaticAPIKeys-listProjectApiKeys: + +================================================ +atlas api programmaticAPIKeys listProjectApiKeys +================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Organization API Keys Assigned to One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys listProjectApiKeys [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listProjectApiKeys + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-removeProjectApiKey.txt b/docs/command/atlas-api-programmaticAPIKeys-removeProjectApiKey.txt new file mode 100644 index 0000000000..2212c9cbe5 --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-removeProjectApiKey.txt @@ -0,0 +1,70 @@ +.. _atlas-api-programmaticAPIKeys-removeProjectApiKey: + +================================================= +atlas api programmaticAPIKeys removeProjectApiKey +================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Unassign One Organization API Key from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys removeProjectApiKey [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for removeProjectApiKey + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-updateApiKey.txt b/docs/command/atlas-api-programmaticAPIKeys-updateApiKey.txt new file mode 100644 index 0000000000..68eaab077e --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-updateApiKey.txt @@ -0,0 +1,74 @@ +.. _atlas-api-programmaticAPIKeys-updateApiKey: + +========================================== +atlas api programmaticAPIKeys updateApiKey +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Organization API Key + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys updateApiKey [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key you want to update. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateApiKey + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys-updateApiKeyRoles.txt b/docs/command/atlas-api-programmaticAPIKeys-updateApiKeyRoles.txt new file mode 100644 index 0000000000..d25a19ab71 --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys-updateApiKeyRoles.txt @@ -0,0 +1,86 @@ +.. _atlas-api-programmaticAPIKeys-updateApiKeyRoles: + +=============================================== +atlas api programmaticAPIKeys updateApiKeyRoles +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Roles of One Organization API Key to One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api programmaticAPIKeys updateApiKeyRoles [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --apiUserId + - string + - true + - Unique 24-hexadecimal digit string that identifies this organization API key that you want to unassign from one project. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateApiKeyRoles + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-programmaticAPIKeys.txt b/docs/command/atlas-api-programmaticAPIKeys.txt new file mode 100644 index 0000000000..730cfb12d5 --- /dev/null +++ b/docs/command/atlas-api-programmaticAPIKeys.txt @@ -0,0 +1,85 @@ +.. _atlas-api-programmaticAPIKeys: + +============================= +atlas api programmaticAPIKeys +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes access tokens to use the MongoDB Cloud API. MongoDB Cloud applies these keys to organizations. These resources can return, assign, or revoke use of these keys within a specified project. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for programmaticAPIKeys + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-programmaticAPIKeys-addProjectApiKey` - Assign One Organization API Key to One Project +* :ref:`atlas-api-programmaticAPIKeys-createApiKey` - Create One Organization API Key +* :ref:`atlas-api-programmaticAPIKeys-createApiKeyAccessList` - Create Access List Entries for One Organization API Key +* :ref:`atlas-api-programmaticAPIKeys-createProjectApiKey` - Create and Assign One Organization API Key to One Project +* :ref:`atlas-api-programmaticAPIKeys-deleteApiKey` - Remove One Organization API Key +* :ref:`atlas-api-programmaticAPIKeys-deleteApiKeyAccessListEntry` - Remove One Access List Entry for One Organization API Key +* :ref:`atlas-api-programmaticAPIKeys-getApiKey` - Return One Organization API Key +* :ref:`atlas-api-programmaticAPIKeys-getApiKeyAccessList` - Return One Access List Entry for One Organization API Key +* :ref:`atlas-api-programmaticAPIKeys-listApiKeyAccessListsEntries` - Return All Access List Entries for One Organization API Key +* :ref:`atlas-api-programmaticAPIKeys-listApiKeys` - Return All Organization API Keys +* :ref:`atlas-api-programmaticAPIKeys-listProjectApiKeys` - Return All Organization API Keys Assigned to One Project +* :ref:`atlas-api-programmaticAPIKeys-removeProjectApiKey` - Unassign One Organization API Key from One Project +* :ref:`atlas-api-programmaticAPIKeys-updateApiKey` - Update One Organization API Key +* :ref:`atlas-api-programmaticAPIKeys-updateApiKeyRoles` - Update Roles of One Organization API Key to One Project + + +.. toctree:: + :titlesonly: + + addProjectApiKey + createApiKey + createApiKeyAccessList + createProjectApiKey + deleteApiKey + deleteApiKeyAccessListEntry + getApiKey + getApiKeyAccessList + listApiKeyAccessListsEntries + listApiKeys + listProjectApiKeys + removeProjectApiKey + updateApiKey + updateApiKeyRoles + diff --git a/docs/command/atlas-api-projectIPAccessList-createProjectIpAccessList.txt b/docs/command/atlas-api-projectIPAccessList-createProjectIpAccessList.txt new file mode 100644 index 0000000000..f0c965b64a --- /dev/null +++ b/docs/command/atlas-api-projectIPAccessList-createProjectIpAccessList.txt @@ -0,0 +1,82 @@ +.. _atlas-api-projectIPAccessList-createProjectIpAccessList: + +======================================================= +atlas api projectIPAccessList createProjectIpAccessList +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Add Entries to Project IP Access List + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projectIPAccessList createProjectIpAccessList [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createProjectIpAccessList + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projectIPAccessList-deleteProjectIpAccessList.txt b/docs/command/atlas-api-projectIPAccessList-deleteProjectIpAccessList.txt new file mode 100644 index 0000000000..4539628199 --- /dev/null +++ b/docs/command/atlas-api-projectIPAccessList-deleteProjectIpAccessList.txt @@ -0,0 +1,74 @@ +.. _atlas-api-projectIPAccessList-deleteProjectIpAccessList: + +======================================================= +atlas api projectIPAccessList deleteProjectIpAccessList +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Entry from One Project IP Access List + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projectIPAccessList deleteProjectIpAccessList [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --entryValue + - string + - true + - Access list entry that you want to remove from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). When you remove an entry from the IP access list, existing connections from the removed address or addresses may remain open for a variable amount of time. The amount of time it takes MongoDB Cloud to close the connection depends upon several factors, including: + + - how your application established the connection, + - how MongoDB Cloud or the driver using the address behaves, and + - which protocol (like TCP or UDP) the connection uses. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteProjectIpAccessList + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projectIPAccessList-getProjectIpAccessListStatus.txt b/docs/command/atlas-api-projectIPAccessList-getProjectIpAccessListStatus.txt new file mode 100644 index 0000000000..8a73927034 --- /dev/null +++ b/docs/command/atlas-api-projectIPAccessList-getProjectIpAccessListStatus.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projectIPAccessList-getProjectIpAccessListStatus: + +========================================================== +atlas api projectIPAccessList getProjectIpAccessListStatus +========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Status of One Project IP Access List Entry + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projectIPAccessList getProjectIpAccessListStatus [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --entryValue + - string + - true + - Network address or cloud provider security construct that identifies which project access list entry to be verified. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getProjectIpAccessListStatus + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projectIPAccessList-getProjectIpList.txt b/docs/command/atlas-api-projectIPAccessList-getProjectIpList.txt new file mode 100644 index 0000000000..fb8a09e152 --- /dev/null +++ b/docs/command/atlas-api-projectIPAccessList-getProjectIpList.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projectIPAccessList-getProjectIpList: + +============================================== +atlas api projectIPAccessList getProjectIpList +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Project IP Access List Entry + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projectIPAccessList getProjectIpList [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --entryValue + - string + - true + - Access list entry that you want to return from the project's IP access list. This value can use one of the following: one AWS security group ID, one IP address, or one CIDR block of addresses. For CIDR blocks that use a subnet mask, replace the forward slash (`/`) with its URL-encoded value (`%2F`). + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getProjectIpList + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projectIPAccessList-listProjectIpAccessLists.txt b/docs/command/atlas-api-projectIPAccessList-listProjectIpAccessLists.txt new file mode 100644 index 0000000000..8927d1385b --- /dev/null +++ b/docs/command/atlas-api-projectIPAccessList-listProjectIpAccessLists.txt @@ -0,0 +1,78 @@ +.. _atlas-api-projectIPAccessList-listProjectIpAccessLists: + +====================================================== +atlas api projectIPAccessList listProjectIpAccessLists +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return Project IP Access List + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projectIPAccessList listProjectIpAccessLists [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listProjectIpAccessLists + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projectIPAccessList.txt b/docs/command/atlas-api-projectIPAccessList.txt new file mode 100644 index 0000000000..1eeba7a13d --- /dev/null +++ b/docs/command/atlas-api-projectIPAccessList.txt @@ -0,0 +1,67 @@ +.. _atlas-api-projectIPAccessList: + +============================= +atlas api projectIPAccessList +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for projectIPAccessList + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-projectIPAccessList-createProjectIpAccessList` - Add Entries to Project IP Access List +* :ref:`atlas-api-projectIPAccessList-deleteProjectIpAccessList` - Remove One Entry from One Project IP Access List +* :ref:`atlas-api-projectIPAccessList-getProjectIpAccessListStatus` - Return Status of One Project IP Access List Entry +* :ref:`atlas-api-projectIPAccessList-getProjectIpList` - Return One Project IP Access List Entry +* :ref:`atlas-api-projectIPAccessList-listProjectIpAccessLists` - Return Project IP Access List + + +.. toctree:: + :titlesonly: + + createProjectIpAccessList + deleteProjectIpAccessList + getProjectIpAccessListStatus + getProjectIpList + listProjectIpAccessLists + diff --git a/docs/command/atlas-api-projects-addUserToProject.txt b/docs/command/atlas-api-projects-addUserToProject.txt new file mode 100644 index 0000000000..df427665bc --- /dev/null +++ b/docs/command/atlas-api-projects-addUserToProject.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-addUserToProject: + +=================================== +atlas api projects addUserToProject +=================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Add One MongoDB Cloud User to One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects addUserToProject [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for addUserToProject + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-createProject.txt b/docs/command/atlas-api-projects-createProject.txt new file mode 100644 index 0000000000..5a3df38191 --- /dev/null +++ b/docs/command/atlas-api-projects-createProject.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-createProject: + +================================ +atlas api projects createProject +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects createProject [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createProject + * - --projectOwnerId + - string + - false + - Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user to whom to grant the Project Owner role on the specified project. If you set this parameter, it overrides the default value of the oldest Organization Owner. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-createProjectInvitation.txt b/docs/command/atlas-api-projects-createProjectInvitation.txt new file mode 100644 index 0000000000..70aac2402b --- /dev/null +++ b/docs/command/atlas-api-projects-createProjectInvitation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-createProjectInvitation: + +========================================== +atlas api projects createProjectInvitation +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Invite One MongoDB Cloud User to Join One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects createProjectInvitation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createProjectInvitation + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-deleteProject.txt b/docs/command/atlas-api-projects-deleteProject.txt new file mode 100644 index 0000000000..aa3943e991 --- /dev/null +++ b/docs/command/atlas-api-projects-deleteProject.txt @@ -0,0 +1,66 @@ +.. _atlas-api-projects-deleteProject: + +================================ +atlas api projects deleteProject +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects deleteProject [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteProject + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-deleteProjectInvitation.txt b/docs/command/atlas-api-projects-deleteProjectInvitation.txt new file mode 100644 index 0000000000..0989e80efc --- /dev/null +++ b/docs/command/atlas-api-projects-deleteProjectInvitation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-deleteProjectInvitation: + +========================================== +atlas api projects deleteProjectInvitation +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Cancel One Project Invitation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects deleteProjectInvitation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteProjectInvitation + * - --invitationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the invitation. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-deleteProjectLimit.txt b/docs/command/atlas-api-projects-deleteProjectLimit.txt new file mode 100644 index 0000000000..d58432599a --- /dev/null +++ b/docs/command/atlas-api-projects-deleteProjectLimit.txt @@ -0,0 +1,86 @@ +.. _atlas-api-projects-deleteProjectLimit: + +===================================== +atlas api projects deleteProjectLimit +===================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Project Limit + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects deleteProjectLimit [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteProjectLimit + * - --limitName + - string + - true + - Human-readable label that identifies this project limit. + + | Limit Name | Description | Default | API Override Limit | + | --- | --- | --- | --- | + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-getProject.txt b/docs/command/atlas-api-projects-getProject.txt new file mode 100644 index 0000000000..a069ba7f7a --- /dev/null +++ b/docs/command/atlas-api-projects-getProject.txt @@ -0,0 +1,66 @@ +.. _atlas-api-projects-getProject: + +============================= +atlas api projects getProject +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects getProject [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getProject + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-getProjectByName.txt b/docs/command/atlas-api-projects-getProjectByName.txt new file mode 100644 index 0000000000..b298a83a1d --- /dev/null +++ b/docs/command/atlas-api-projects-getProjectByName.txt @@ -0,0 +1,66 @@ +.. _atlas-api-projects-getProjectByName: + +=================================== +atlas api projects getProjectByName +=================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Project using Its Name + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects getProjectByName [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - --groupName + - string + - true + - Human-readable label that identifies this project. + * - -h, --help + - + - false + - help for getProjectByName + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-getProjectInvitation.txt b/docs/command/atlas-api-projects-getProjectInvitation.txt new file mode 100644 index 0000000000..08e00f2984 --- /dev/null +++ b/docs/command/atlas-api-projects-getProjectInvitation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-getProjectInvitation: + +======================================= +atlas api projects getProjectInvitation +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Project Invitation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects getProjectInvitation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getProjectInvitation + * - --invitationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the invitation. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-getProjectLimit.txt b/docs/command/atlas-api-projects-getProjectLimit.txt new file mode 100644 index 0000000000..a5c5b8180c --- /dev/null +++ b/docs/command/atlas-api-projects-getProjectLimit.txt @@ -0,0 +1,86 @@ +.. _atlas-api-projects-getProjectLimit: + +================================== +atlas api projects getProjectLimit +================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Limit for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects getProjectLimit [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getProjectLimit + * - --limitName + - string + - true + - Human-readable label that identifies this project limit. + + | Limit Name | Description | Default | API Override Limit | + | --- | --- | --- | --- | + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-getProjectSettings.txt b/docs/command/atlas-api-projects-getProjectSettings.txt new file mode 100644 index 0000000000..17d4ccdec9 --- /dev/null +++ b/docs/command/atlas-api-projects-getProjectSettings.txt @@ -0,0 +1,66 @@ +.. _atlas-api-projects-getProjectSettings: + +===================================== +atlas api projects getProjectSettings +===================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Project Settings + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects getProjectSettings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getProjectSettings + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-listProjectInvitations.txt b/docs/command/atlas-api-projects-listProjectInvitations.txt new file mode 100644 index 0000000000..c072b57e94 --- /dev/null +++ b/docs/command/atlas-api-projects-listProjectInvitations.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-listProjectInvitations: + +========================================= +atlas api projects listProjectInvitations +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Project Invitations + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects listProjectInvitations [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listProjectInvitations + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --username + - string + - false + - Email address of the user account invited to this project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-listProjectLimits.txt b/docs/command/atlas-api-projects-listProjectLimits.txt new file mode 100644 index 0000000000..9a46a48938 --- /dev/null +++ b/docs/command/atlas-api-projects-listProjectLimits.txt @@ -0,0 +1,66 @@ +.. _atlas-api-projects-listProjectLimits: + +==================================== +atlas api projects listProjectLimits +==================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Limits for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects listProjectLimits [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listProjectLimits + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-listProjectUsers.txt b/docs/command/atlas-api-projects-listProjectUsers.txt new file mode 100644 index 0000000000..9c154e4735 --- /dev/null +++ b/docs/command/atlas-api-projects-listProjectUsers.txt @@ -0,0 +1,86 @@ +.. _atlas-api-projects-listProjectUsers: + +=================================== +atlas api projects listProjectUsers +=================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Users in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects listProjectUsers [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --flattenTeams + - + - false + - Flag that indicates whether the returned list should include users who belong to a team with a role in this project. You might not have assigned the individual users a role in this project. If `"flattenTeams" : false`, this resource returns only users with a role in the project. If `"flattenTeams" : true`, this resource returns both users with roles in the project and users who belong to teams with roles in the project. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listProjectUsers + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --includeOrgUsers + - + - false + - Flag that indicates whether the returned list should include users with implicit access to the project, the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project. If `"includeOrgUsers": false`, this resource returns only users with a role in the project. If `"includeOrgUsers": true`, this resource returns both users with roles in the project and users who have implicit access to the project through their organization role. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-listProjects.txt b/docs/command/atlas-api-projects-listProjects.txt new file mode 100644 index 0000000000..6b73ad4f53 --- /dev/null +++ b/docs/command/atlas-api-projects-listProjects.txt @@ -0,0 +1,74 @@ +.. _atlas-api-projects-listProjects: + +=============================== +atlas api projects listProjects +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Projects + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects listProjects [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listProjects + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-removeProjectUser.txt b/docs/command/atlas-api-projects-removeProjectUser.txt new file mode 100644 index 0000000000..a82431d3b7 --- /dev/null +++ b/docs/command/atlas-api-projects-removeProjectUser.txt @@ -0,0 +1,66 @@ +.. _atlas-api-projects-removeProjectUser: + +==================================== +atlas api projects removeProjectUser +==================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One User from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects removeProjectUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for removeProjectUser + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --userId + - string + - true + - Unique 24-hexadecimal string that identifies MongoDB Cloud user you want to remove from the specified project. To return a application user's ID using their application username, use the Get All application users in One Project endpoint. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-returnAllIPAddresses.txt b/docs/command/atlas-api-projects-returnAllIPAddresses.txt new file mode 100644 index 0000000000..7567ed93f5 --- /dev/null +++ b/docs/command/atlas-api-projects-returnAllIPAddresses.txt @@ -0,0 +1,66 @@ +.. _atlas-api-projects-returnAllIPAddresses: + +======================================= +atlas api projects returnAllIPAddresses +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All IP Addresses for One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects returnAllIPAddresses [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for returnAllIPAddresses + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-setProjectLimit.txt b/docs/command/atlas-api-projects-setProjectLimit.txt new file mode 100644 index 0000000000..442dca2af9 --- /dev/null +++ b/docs/command/atlas-api-projects-setProjectLimit.txt @@ -0,0 +1,90 @@ +.. _atlas-api-projects-setProjectLimit: + +================================== +atlas api projects setProjectLimit +================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Set One Project Limit + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects setProjectLimit [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for setProjectLimit + * - --limitName + - string + - true + - Human-readable label that identifies this project limit. + + | Limit Name | Description | Default | API Override Limit | + | --- | --- | --- | --- | + | atlas.project.deployment.clusters | Limit on the number of clusters in this project | 25 | 90 | + | atlas.project.deployment.nodesPerPrivateLinkRegion | Limit on the number of nodes per Private Link region in this project | 50 | 90 | + | atlas.project.security.databaseAccess.customRoles | Limit on the number of custom roles in this project | 100 | 1400 | + | atlas.project.security.databaseAccess.users | Limit on the number of database users in this project | 100 | 900 | + | atlas.project.security.networkAccess.crossRegionEntries | Limit on the number of cross-region network access entries in this project | 40 | 220 | + | atlas.project.security.networkAccess.entries | Limit on the number of network access entries in this project | 200 | 20 | + | dataFederation.bytesProcessed.query | Limit on the number of bytes processed during a single Data Federation query | N/A | N/A | + | dataFederation.bytesProcessed.daily | Limit on the number of bytes processed across all Data Federation tenants for the current day | N/A | N/A | + | dataFederation.bytesProcessed.weekly | Limit on the number of bytes processed across all Data Federation tenants for the current week | N/A | N/A | + | dataFederation.bytesProcessed.monthly | Limit on the number of bytes processed across all Data Federation tenants for the current month | N/A | N/A | + | atlas.project.deployment.privateServiceConnectionsPerRegionGroup | Number of Private Serivce Connections per Region Group | 50 | 100| + | atlas.project.deployment.privateServiceConnectionsSubnetMask | Subnet mask for GCP PSC Networks. Has lower limit of 20. | 27 | 27| + + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-updateProject.txt b/docs/command/atlas-api-projects-updateProject.txt new file mode 100644 index 0000000000..121bb7f501 --- /dev/null +++ b/docs/command/atlas-api-projects-updateProject.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-updateProject: + +================================ +atlas api projects updateProject +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects updateProject [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateProject + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-updateProjectInvitation.txt b/docs/command/atlas-api-projects-updateProjectInvitation.txt new file mode 100644 index 0000000000..73729661a4 --- /dev/null +++ b/docs/command/atlas-api-projects-updateProjectInvitation.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-updateProjectInvitation: + +========================================== +atlas api projects updateProjectInvitation +========================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Project Invitation + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects updateProjectInvitation [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateProjectInvitation + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-updateProjectInvitationById.txt b/docs/command/atlas-api-projects-updateProjectInvitationById.txt new file mode 100644 index 0000000000..486d39ad9d --- /dev/null +++ b/docs/command/atlas-api-projects-updateProjectInvitationById.txt @@ -0,0 +1,74 @@ +.. _atlas-api-projects-updateProjectInvitationById: + +============================================== +atlas api projects updateProjectInvitationById +============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Project Invitation by Invitation ID + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects updateProjectInvitationById [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateProjectInvitationById + * - --invitationId + - string + - true + - Unique 24-hexadecimal digit string that identifies the invitation. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-updateProjectRoles.txt b/docs/command/atlas-api-projects-updateProjectRoles.txt new file mode 100644 index 0000000000..87381f1157 --- /dev/null +++ b/docs/command/atlas-api-projects-updateProjectRoles.txt @@ -0,0 +1,74 @@ +.. _atlas-api-projects-updateProjectRoles: + +===================================== +atlas api projects updateProjectRoles +===================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Project Roles for One MongoDB Cloud User + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects updateProjectRoles [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateProjectRoles + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --userId + - string + - true + - Unique 24-hexadecimal digit string that identifies the user to modify. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects-updateProjectSettings.txt b/docs/command/atlas-api-projects-updateProjectSettings.txt new file mode 100644 index 0000000000..b928db422f --- /dev/null +++ b/docs/command/atlas-api-projects-updateProjectSettings.txt @@ -0,0 +1,70 @@ +.. _atlas-api-projects-updateProjectSettings: + +======================================== +atlas api projects updateProjectSettings +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Project Settings + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api projects updateProjectSettings [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateProjectSettings + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-projects.txt b/docs/command/atlas-api-projects.txt new file mode 100644 index 0000000000..7de0b4d464 --- /dev/null +++ b/docs/command/atlas-api-projects.txt @@ -0,0 +1,103 @@ +.. _atlas-api-projects: + +================== +atlas api projects +================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, and edits collections of clusters and users in MongoDB Cloud. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for projects + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-projects-addUserToProject` - Add One MongoDB Cloud User to One Project +* :ref:`atlas-api-projects-createProject` - Create One Project +* :ref:`atlas-api-projects-createProjectInvitation` - Invite One MongoDB Cloud User to Join One Project +* :ref:`atlas-api-projects-deleteProject` - Remove One Project +* :ref:`atlas-api-projects-deleteProjectInvitation` - Cancel One Project Invitation +* :ref:`atlas-api-projects-deleteProjectLimit` - Remove One Project Limit +* :ref:`atlas-api-projects-getProject` - Return One Project +* :ref:`atlas-api-projects-getProjectByName` - Return One Project using Its Name +* :ref:`atlas-api-projects-getProjectInvitation` - Return One Project Invitation +* :ref:`atlas-api-projects-getProjectLimit` - Return One Limit for One Project +* :ref:`atlas-api-projects-getProjectSettings` - Return One Project Settings +* :ref:`atlas-api-projects-listProjectInvitations` - Return All Project Invitations +* :ref:`atlas-api-projects-listProjectLimits` - Return All Limits for One Project +* :ref:`atlas-api-projects-listProjectUsers` - Return All Users in One Project +* :ref:`atlas-api-projects-listProjects` - Return All Projects +* :ref:`atlas-api-projects-removeProjectUser` - Remove One User from One Project +* :ref:`atlas-api-projects-returnAllIPAddresses` - Return All IP Addresses for One Project +* :ref:`atlas-api-projects-setProjectLimit` - Set One Project Limit +* :ref:`atlas-api-projects-updateProject` - Update One Project +* :ref:`atlas-api-projects-updateProjectInvitation` - Update One Project Invitation +* :ref:`atlas-api-projects-updateProjectInvitationById` - Update One Project Invitation by Invitation ID +* :ref:`atlas-api-projects-updateProjectRoles` - Update Project Roles for One MongoDB Cloud User +* :ref:`atlas-api-projects-updateProjectSettings` - Update One Project Settings + + +.. toctree:: + :titlesonly: + + addUserToProject + createProject + createProjectInvitation + deleteProject + deleteProjectInvitation + deleteProjectLimit + getProject + getProjectByName + getProjectInvitation + getProjectLimit + getProjectSettings + listProjectInvitations + listProjectLimits + listProjectUsers + listProjects + removeProjectUser + returnAllIPAddresses + setProjectLimit + updateProject + updateProjectInvitation + updateProjectInvitationById + updateProjectRoles + updateProjectSettings + diff --git a/docs/command/atlas-api-pushBasedLogExport-createPushBasedLogConfiguration.txt b/docs/command/atlas-api-pushBasedLogExport-createPushBasedLogConfiguration.txt new file mode 100644 index 0000000000..e5dfca4c09 --- /dev/null +++ b/docs/command/atlas-api-pushBasedLogExport-createPushBasedLogConfiguration.txt @@ -0,0 +1,66 @@ +.. _atlas-api-pushBasedLogExport-createPushBasedLogConfiguration: + +============================================================ +atlas api pushBasedLogExport createPushBasedLogConfiguration +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Enable the push-based log export feature for a project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api pushBasedLogExport createPushBasedLogConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - -h, --help + - + - false + - help for createPushBasedLogConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-pushBasedLogExport-deletePushBasedLogConfiguration.txt b/docs/command/atlas-api-pushBasedLogExport-deletePushBasedLogConfiguration.txt new file mode 100644 index 0000000000..ce6361c023 --- /dev/null +++ b/docs/command/atlas-api-pushBasedLogExport-deletePushBasedLogConfiguration.txt @@ -0,0 +1,62 @@ +.. _atlas-api-pushBasedLogExport-deletePushBasedLogConfiguration: + +============================================================ +atlas api pushBasedLogExport deletePushBasedLogConfiguration +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Disable the push-based log export feature for a project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api pushBasedLogExport deletePushBasedLogConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for deletePushBasedLogConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-pushBasedLogExport-getPushBasedLogConfiguration.txt b/docs/command/atlas-api-pushBasedLogExport-getPushBasedLogConfiguration.txt new file mode 100644 index 0000000000..d951341cee --- /dev/null +++ b/docs/command/atlas-api-pushBasedLogExport-getPushBasedLogConfiguration.txt @@ -0,0 +1,66 @@ +.. _atlas-api-pushBasedLogExport-getPushBasedLogConfiguration: + +========================================================= +atlas api pushBasedLogExport getPushBasedLogConfiguration +========================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Get the push-based log export configuration for a project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api pushBasedLogExport getPushBasedLogConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getPushBasedLogConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-pushBasedLogExport-updatePushBasedLogConfiguration.txt b/docs/command/atlas-api-pushBasedLogExport-updatePushBasedLogConfiguration.txt new file mode 100644 index 0000000000..ff95ca5eec --- /dev/null +++ b/docs/command/atlas-api-pushBasedLogExport-updatePushBasedLogConfiguration.txt @@ -0,0 +1,66 @@ +.. _atlas-api-pushBasedLogExport-updatePushBasedLogConfiguration: + +============================================================ +atlas api pushBasedLogExport updatePushBasedLogConfiguration +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update the push-based log export feature for a project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api pushBasedLogExport updatePushBasedLogConfiguration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - -h, --help + - + - false + - help for updatePushBasedLogConfiguration + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-pushBasedLogExport.txt b/docs/command/atlas-api-pushBasedLogExport.txt new file mode 100644 index 0000000000..f086b21c07 --- /dev/null +++ b/docs/command/atlas-api-pushBasedLogExport.txt @@ -0,0 +1,65 @@ +.. _atlas-api-pushBasedLogExport: + +============================ +atlas api pushBasedLogExport +============================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +You can continually push logs from mongod, mongos, and audit logs to an AWS S3 bucket. Atlas exports logs every 5 minutes. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for pushBasedLogExport + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-pushBasedLogExport-createPushBasedLogConfiguration` - Enable the push-based log export feature for a project +* :ref:`atlas-api-pushBasedLogExport-deletePushBasedLogConfiguration` - Disable the push-based log export feature for a project +* :ref:`atlas-api-pushBasedLogExport-getPushBasedLogConfiguration` - Get the push-based log export configuration for a project +* :ref:`atlas-api-pushBasedLogExport-updatePushBasedLogConfiguration` - Update the push-based log export feature for a project + + +.. toctree:: + :titlesonly: + + createPushBasedLogConfiguration + deletePushBasedLogConfiguration + getPushBasedLogConfiguration + updatePushBasedLogConfiguration + diff --git a/docs/command/atlas-api-rollingIndex-createRollingIndex.txt b/docs/command/atlas-api-rollingIndex-createRollingIndex.txt new file mode 100644 index 0000000000..926900c0db --- /dev/null +++ b/docs/command/atlas-api-rollingIndex-createRollingIndex.txt @@ -0,0 +1,70 @@ +.. _atlas-api-rollingIndex-createRollingIndex: + +========================================= +atlas api rollingIndex createRollingIndex +========================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Rolling Index + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api rollingIndex createRollingIndex [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster on which MongoDB Cloud creates an index. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - -h, --help + - + - false + - help for createRollingIndex + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-rollingIndex.txt b/docs/command/atlas-api-rollingIndex.txt new file mode 100644 index 0000000000..0334ea07c5 --- /dev/null +++ b/docs/command/atlas-api-rollingIndex.txt @@ -0,0 +1,59 @@ +.. _atlas-api-rollingIndex: + +====================== +atlas api rollingIndex +====================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for rollingIndex + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-rollingIndex-createRollingIndex` - Create One Rolling Index + + +.. toctree:: + :titlesonly: + + createRollingIndex + diff --git a/docs/command/atlas-api-root-getSystemStatus.txt b/docs/command/atlas-api-root-getSystemStatus.txt new file mode 100644 index 0000000000..5ced8342f4 --- /dev/null +++ b/docs/command/atlas-api-root-getSystemStatus.txt @@ -0,0 +1,62 @@ +.. _atlas-api-root-getSystemStatus: + +============================== +atlas api root getSystemStatus +============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return the status of this MongoDB application + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api root getSystemStatus [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getSystemStatus + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-root-returnAllControlPlaneIPAddresses.txt b/docs/command/atlas-api-root-returnAllControlPlaneIPAddresses.txt new file mode 100644 index 0000000000..89ab4de733 --- /dev/null +++ b/docs/command/atlas-api-root-returnAllControlPlaneIPAddresses.txt @@ -0,0 +1,62 @@ +.. _atlas-api-root-returnAllControlPlaneIPAddresses: + +=============================================== +atlas api root returnAllControlPlaneIPAddresses +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Control Plane IP Addresses + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api root returnAllControlPlaneIPAddresses [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for returnAllControlPlaneIPAddresses + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-root.txt b/docs/command/atlas-api-root.txt new file mode 100644 index 0000000000..0035ef0dc1 --- /dev/null +++ b/docs/command/atlas-api-root.txt @@ -0,0 +1,61 @@ +.. _atlas-api-root: + +============== +atlas api root +============== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns details that describe the MongoDB Cloud build and the access token that requests this resource. This starts the MongoDB Cloud API. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for root + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-root-getSystemStatus` - Return the status of this MongoDB application +* :ref:`atlas-api-root-returnAllControlPlaneIPAddresses` - Return All Control Plane IP Addresses + + +.. toctree:: + :titlesonly: + + getSystemStatus + returnAllControlPlaneIPAddresses + diff --git a/docs/command/atlas-api-serverlessInstances-createServerlessInstance.txt b/docs/command/atlas-api-serverlessInstances-createServerlessInstance.txt new file mode 100644 index 0000000000..e525fd357c --- /dev/null +++ b/docs/command/atlas-api-serverlessInstances-createServerlessInstance.txt @@ -0,0 +1,70 @@ +.. _atlas-api-serverlessInstances-createServerlessInstance: + +====================================================== +atlas api serverlessInstances createServerlessInstance +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Serverless Instance in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessInstances createServerlessInstance [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createServerlessInstance + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessInstances-deleteServerlessInstance.txt b/docs/command/atlas-api-serverlessInstances-deleteServerlessInstance.txt new file mode 100644 index 0000000000..707ab9816d --- /dev/null +++ b/docs/command/atlas-api-serverlessInstances-deleteServerlessInstance.txt @@ -0,0 +1,70 @@ +.. _atlas-api-serverlessInstances-deleteServerlessInstance: + +====================================================== +atlas api serverlessInstances deleteServerlessInstance +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Serverless Instance from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessInstances deleteServerlessInstance [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteServerlessInstance + * - --name + - string + - true + - Human-readable label that identifies the serverless instance. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessInstances-getServerlessInstance.txt b/docs/command/atlas-api-serverlessInstances-getServerlessInstance.txt new file mode 100644 index 0000000000..45ec00d708 --- /dev/null +++ b/docs/command/atlas-api-serverlessInstances-getServerlessInstance.txt @@ -0,0 +1,70 @@ +.. _atlas-api-serverlessInstances-getServerlessInstance: + +=================================================== +atlas api serverlessInstances getServerlessInstance +=================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Serverless Instance from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessInstances getServerlessInstance [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getServerlessInstance + * - --name + - string + - true + - Human-readable label that identifies the serverless instance. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessInstances-listServerlessInstances.txt b/docs/command/atlas-api-serverlessInstances-listServerlessInstances.txt new file mode 100644 index 0000000000..f1b3a7da58 --- /dev/null +++ b/docs/command/atlas-api-serverlessInstances-listServerlessInstances.txt @@ -0,0 +1,78 @@ +.. _atlas-api-serverlessInstances-listServerlessInstances: + +===================================================== +atlas api serverlessInstances listServerlessInstances +===================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Serverless Instances from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessInstances listServerlessInstances [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listServerlessInstances + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessInstances-updateServerlessInstance.txt b/docs/command/atlas-api-serverlessInstances-updateServerlessInstance.txt new file mode 100644 index 0000000000..cb0fd39e58 --- /dev/null +++ b/docs/command/atlas-api-serverlessInstances-updateServerlessInstance.txt @@ -0,0 +1,74 @@ +.. _atlas-api-serverlessInstances-updateServerlessInstance: + +====================================================== +atlas api serverlessInstances updateServerlessInstance +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Serverless Instance in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessInstances updateServerlessInstance [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateServerlessInstance + * - --name + - string + - true + - Human-readable label that identifies the serverless instance. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessInstances.txt b/docs/command/atlas-api-serverlessInstances.txt new file mode 100644 index 0000000000..46e73ddb36 --- /dev/null +++ b/docs/command/atlas-api-serverlessInstances.txt @@ -0,0 +1,67 @@ +.. _atlas-api-serverlessInstances: + +============================= +atlas api serverlessInstances +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes serverless instances. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for serverlessInstances + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-serverlessInstances-createServerlessInstance` - Create One Serverless Instance in One Project +* :ref:`atlas-api-serverlessInstances-deleteServerlessInstance` - Remove One Serverless Instance from One Project +* :ref:`atlas-api-serverlessInstances-getServerlessInstance` - Return One Serverless Instance from One Project +* :ref:`atlas-api-serverlessInstances-listServerlessInstances` - Return All Serverless Instances from One Project +* :ref:`atlas-api-serverlessInstances-updateServerlessInstance` - Update One Serverless Instance in One Project + + +.. toctree:: + :titlesonly: + + createServerlessInstance + deleteServerlessInstance + getServerlessInstance + listServerlessInstances + updateServerlessInstance + diff --git a/docs/command/atlas-api-serverlessPrivateEndpoints-createServerlessPrivateEndpoint.txt b/docs/command/atlas-api-serverlessPrivateEndpoints-createServerlessPrivateEndpoint.txt new file mode 100644 index 0000000000..165d39e95c --- /dev/null +++ b/docs/command/atlas-api-serverlessPrivateEndpoints-createServerlessPrivateEndpoint.txt @@ -0,0 +1,74 @@ +.. _atlas-api-serverlessPrivateEndpoints-createServerlessPrivateEndpoint: + +==================================================================== +atlas api serverlessPrivateEndpoints createServerlessPrivateEndpoint +==================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Private Endpoint for One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessPrivateEndpoints createServerlessPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createServerlessPrivateEndpoint + * - --instanceName + - string + - true + - Human-readable label that identifies the serverless instance for which the tenant endpoint will be created. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessPrivateEndpoints-deleteServerlessPrivateEndpoint.txt b/docs/command/atlas-api-serverlessPrivateEndpoints-deleteServerlessPrivateEndpoint.txt new file mode 100644 index 0000000000..f5cc0c8cc5 --- /dev/null +++ b/docs/command/atlas-api-serverlessPrivateEndpoints-deleteServerlessPrivateEndpoint.txt @@ -0,0 +1,74 @@ +.. _atlas-api-serverlessPrivateEndpoints-deleteServerlessPrivateEndpoint: + +==================================================================== +atlas api serverlessPrivateEndpoints deleteServerlessPrivateEndpoint +==================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Private Endpoint for One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessPrivateEndpoints deleteServerlessPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --endpointId + - string + - true + - Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be removed. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteServerlessPrivateEndpoint + * - --instanceName + - string + - true + - Human-readable label that identifies the serverless instance from which the tenant endpoint will be removed. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessPrivateEndpoints-getServerlessPrivateEndpoint.txt b/docs/command/atlas-api-serverlessPrivateEndpoints-getServerlessPrivateEndpoint.txt new file mode 100644 index 0000000000..d2123f8cf8 --- /dev/null +++ b/docs/command/atlas-api-serverlessPrivateEndpoints-getServerlessPrivateEndpoint.txt @@ -0,0 +1,74 @@ +.. _atlas-api-serverlessPrivateEndpoints-getServerlessPrivateEndpoint: + +================================================================= +atlas api serverlessPrivateEndpoints getServerlessPrivateEndpoint +================================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Private Endpoint for One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessPrivateEndpoints getServerlessPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --endpointId + - string + - true + - Unique 24-hexadecimal digit string that identifies the tenant endpoint. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getServerlessPrivateEndpoint + * - --instanceName + - string + - true + - Human-readable label that identifies the serverless instance associated with the tenant endpoint. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessPrivateEndpoints-listServerlessPrivateEndpoints.txt b/docs/command/atlas-api-serverlessPrivateEndpoints-listServerlessPrivateEndpoints.txt new file mode 100644 index 0000000000..b8cdeae1c2 --- /dev/null +++ b/docs/command/atlas-api-serverlessPrivateEndpoints-listServerlessPrivateEndpoints.txt @@ -0,0 +1,70 @@ +.. _atlas-api-serverlessPrivateEndpoints-listServerlessPrivateEndpoints: + +=================================================================== +atlas api serverlessPrivateEndpoints listServerlessPrivateEndpoints +=================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Private Endpoints for One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessPrivateEndpoints listServerlessPrivateEndpoints [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listServerlessPrivateEndpoints + * - --instanceName + - string + - true + - Human-readable label that identifies the serverless instance associated with the tenant endpoint. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessPrivateEndpoints-updateServerlessPrivateEndpoint.txt b/docs/command/atlas-api-serverlessPrivateEndpoints-updateServerlessPrivateEndpoint.txt new file mode 100644 index 0000000000..a1db911b3b --- /dev/null +++ b/docs/command/atlas-api-serverlessPrivateEndpoints-updateServerlessPrivateEndpoint.txt @@ -0,0 +1,78 @@ +.. _atlas-api-serverlessPrivateEndpoints-updateServerlessPrivateEndpoint: + +==================================================================== +atlas api serverlessPrivateEndpoints updateServerlessPrivateEndpoint +==================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Private Endpoint for One Serverless Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api serverlessPrivateEndpoints updateServerlessPrivateEndpoint [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --endpointId + - string + - true + - Unique 24-hexadecimal digit string that identifies the tenant endpoint which will be updated. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateServerlessPrivateEndpoint + * - --instanceName + - string + - true + - Human-readable label that identifies the serverless instance associated with the tenant endpoint that will be updated. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-serverlessPrivateEndpoints.txt b/docs/command/atlas-api-serverlessPrivateEndpoints.txt new file mode 100644 index 0000000000..0081ef1cb2 --- /dev/null +++ b/docs/command/atlas-api-serverlessPrivateEndpoints.txt @@ -0,0 +1,67 @@ +.. _atlas-api-serverlessPrivateEndpoints: + +==================================== +atlas api serverlessPrivateEndpoints +==================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for serverlessPrivateEndpoints + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-serverlessPrivateEndpoints-createServerlessPrivateEndpoint` - Create One Private Endpoint for One Serverless Instance +* :ref:`atlas-api-serverlessPrivateEndpoints-deleteServerlessPrivateEndpoint` - Remove One Private Endpoint for One Serverless Instance +* :ref:`atlas-api-serverlessPrivateEndpoints-getServerlessPrivateEndpoint` - Return One Private Endpoint for One Serverless Instance +* :ref:`atlas-api-serverlessPrivateEndpoints-listServerlessPrivateEndpoints` - Return All Private Endpoints for One Serverless Instance +* :ref:`atlas-api-serverlessPrivateEndpoints-updateServerlessPrivateEndpoint` - Update One Private Endpoint for One Serverless Instance + + +.. toctree:: + :titlesonly: + + createServerlessPrivateEndpoint + deleteServerlessPrivateEndpoint + getServerlessPrivateEndpoint + listServerlessPrivateEndpoints + updateServerlessPrivateEndpoint + diff --git a/docs/command/atlas-api-sharedTierRestoreJobs-createSharedClusterBackupRestoreJob.txt b/docs/command/atlas-api-sharedTierRestoreJobs-createSharedClusterBackupRestoreJob.txt new file mode 100644 index 0000000000..26b10f4994 --- /dev/null +++ b/docs/command/atlas-api-sharedTierRestoreJobs-createSharedClusterBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-sharedTierRestoreJobs-createSharedClusterBackupRestoreJob: + +=================================================================== +atlas api sharedTierRestoreJobs createSharedClusterBackupRestoreJob +=================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Restore Job from One M2 or M5 Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api sharedTierRestoreJobs createSharedClusterBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createSharedClusterBackupRestoreJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-sharedTierRestoreJobs-getSharedClusterBackupRestoreJob.txt b/docs/command/atlas-api-sharedTierRestoreJobs-getSharedClusterBackupRestoreJob.txt new file mode 100644 index 0000000000..bae80775b0 --- /dev/null +++ b/docs/command/atlas-api-sharedTierRestoreJobs-getSharedClusterBackupRestoreJob.txt @@ -0,0 +1,74 @@ +.. _atlas-api-sharedTierRestoreJobs-getSharedClusterBackupRestoreJob: + +================================================================ +atlas api sharedTierRestoreJobs getSharedClusterBackupRestoreJob +================================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Restore Job for One M2 or M5 Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api sharedTierRestoreJobs getSharedClusterBackupRestoreJob [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getSharedClusterBackupRestoreJob + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --restoreId + - string + - true + - Unique 24-hexadecimal digit string that identifies the restore job to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-sharedTierRestoreJobs-listSharedClusterBackupRestoreJobs.txt b/docs/command/atlas-api-sharedTierRestoreJobs-listSharedClusterBackupRestoreJobs.txt new file mode 100644 index 0000000000..2dfd4f6609 --- /dev/null +++ b/docs/command/atlas-api-sharedTierRestoreJobs-listSharedClusterBackupRestoreJobs.txt @@ -0,0 +1,70 @@ +.. _atlas-api-sharedTierRestoreJobs-listSharedClusterBackupRestoreJobs: + +================================================================== +atlas api sharedTierRestoreJobs listSharedClusterBackupRestoreJobs +================================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Restore Jobs for One M2 or M5 Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api sharedTierRestoreJobs listSharedClusterBackupRestoreJobs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listSharedClusterBackupRestoreJobs + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-sharedTierRestoreJobs.txt b/docs/command/atlas-api-sharedTierRestoreJobs.txt new file mode 100644 index 0000000000..5772a982b1 --- /dev/null +++ b/docs/command/atlas-api-sharedTierRestoreJobs.txt @@ -0,0 +1,63 @@ +.. _atlas-api-sharedTierRestoreJobs: + +=============================== +atlas api sharedTierRestoreJobs +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns and adds restore jobs for shared-tier database deployments. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for sharedTierRestoreJobs + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-sharedTierRestoreJobs-createSharedClusterBackupRestoreJob` - Create One Restore Job from One M2 or M5 Cluster +* :ref:`atlas-api-sharedTierRestoreJobs-getSharedClusterBackupRestoreJob` - Return One Restore Job for One M2 or M5 Cluster +* :ref:`atlas-api-sharedTierRestoreJobs-listSharedClusterBackupRestoreJobs` - Return All Restore Jobs for One M2 or M5 Cluster + + +.. toctree:: + :titlesonly: + + createSharedClusterBackupRestoreJob + getSharedClusterBackupRestoreJob + listSharedClusterBackupRestoreJobs + diff --git a/docs/command/atlas-api-sharedTierSnapshots-downloadSharedClusterBackup.txt b/docs/command/atlas-api-sharedTierSnapshots-downloadSharedClusterBackup.txt new file mode 100644 index 0000000000..ba62874053 --- /dev/null +++ b/docs/command/atlas-api-sharedTierSnapshots-downloadSharedClusterBackup.txt @@ -0,0 +1,74 @@ +.. _atlas-api-sharedTierSnapshots-downloadSharedClusterBackup: + +========================================================= +atlas api sharedTierSnapshots downloadSharedClusterBackup +========================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Download One M2 or M5 Cluster Snapshot + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api sharedTierSnapshots downloadSharedClusterBackup [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for downloadSharedClusterBackup + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-sharedTierSnapshots-getSharedClusterBackup.txt b/docs/command/atlas-api-sharedTierSnapshots-getSharedClusterBackup.txt new file mode 100644 index 0000000000..7bed155bb4 --- /dev/null +++ b/docs/command/atlas-api-sharedTierSnapshots-getSharedClusterBackup.txt @@ -0,0 +1,74 @@ +.. _atlas-api-sharedTierSnapshots-getSharedClusterBackup: + +==================================================== +atlas api sharedTierSnapshots getSharedClusterBackup +==================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Snapshot for One M2 or M5 Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api sharedTierSnapshots getSharedClusterBackup [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getSharedClusterBackup + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --snapshotId + - string + - true + - Unique 24-hexadecimal digit string that identifies the desired snapshot. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-sharedTierSnapshots-listSharedClusterBackups.txt b/docs/command/atlas-api-sharedTierSnapshots-listSharedClusterBackups.txt new file mode 100644 index 0000000000..a6a6a6bed1 --- /dev/null +++ b/docs/command/atlas-api-sharedTierSnapshots-listSharedClusterBackups.txt @@ -0,0 +1,70 @@ +.. _atlas-api-sharedTierSnapshots-listSharedClusterBackups: + +====================================================== +atlas api sharedTierSnapshots listSharedClusterBackups +====================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Snapshots for One M2 or M5 Cluster + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api sharedTierSnapshots listSharedClusterBackups [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --clusterName + - string + - true + - Human-readable label that identifies the cluster. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listSharedClusterBackups + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-sharedTierSnapshots.txt b/docs/command/atlas-api-sharedTierSnapshots.txt new file mode 100644 index 0000000000..241e1ca0b9 --- /dev/null +++ b/docs/command/atlas-api-sharedTierSnapshots.txt @@ -0,0 +1,63 @@ +.. _atlas-api-sharedTierSnapshots: + +============================= +atlas api sharedTierSnapshots +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns and requests to download shared-tier database deployment snapshots. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for sharedTierSnapshots + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-sharedTierSnapshots-downloadSharedClusterBackup` - Download One M2 or M5 Cluster Snapshot +* :ref:`atlas-api-sharedTierSnapshots-getSharedClusterBackup` - Return One Snapshot for One M2 or M5 Cluster +* :ref:`atlas-api-sharedTierSnapshots-listSharedClusterBackups` - Return All Snapshots for One M2 or M5 Cluster + + +.. toctree:: + :titlesonly: + + downloadSharedClusterBackup + getSharedClusterBackup + listSharedClusterBackups + diff --git a/docs/command/atlas-api-streams-createStreamConnection.txt b/docs/command/atlas-api-streams-createStreamConnection.txt new file mode 100644 index 0000000000..b22bfbb8a8 --- /dev/null +++ b/docs/command/atlas-api-streams-createStreamConnection.txt @@ -0,0 +1,74 @@ +.. _atlas-api-streams-createStreamConnection: + +======================================== +atlas api streams createStreamConnection +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Connection + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams createStreamConnection [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createStreamConnection + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-createStreamInstance.txt b/docs/command/atlas-api-streams-createStreamInstance.txt new file mode 100644 index 0000000000..bd69e5bea6 --- /dev/null +++ b/docs/command/atlas-api-streams-createStreamInstance.txt @@ -0,0 +1,70 @@ +.. _atlas-api-streams-createStreamInstance: + +====================================== +atlas api streams createStreamInstance +====================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Stream Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams createStreamInstance [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createStreamInstance + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-deleteStreamConnection.txt b/docs/command/atlas-api-streams-deleteStreamConnection.txt new file mode 100644 index 0000000000..660fe9a93b --- /dev/null +++ b/docs/command/atlas-api-streams-deleteStreamConnection.txt @@ -0,0 +1,74 @@ +.. _atlas-api-streams-deleteStreamConnection: + +======================================== +atlas api streams deleteStreamConnection +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Delete One Stream Connection + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams deleteStreamConnection [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --connectionName + - string + - true + - Human-readable label that identifies the stream connection. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteStreamConnection + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-deleteStreamInstance.txt b/docs/command/atlas-api-streams-deleteStreamInstance.txt new file mode 100644 index 0000000000..f792cac913 --- /dev/null +++ b/docs/command/atlas-api-streams-deleteStreamInstance.txt @@ -0,0 +1,70 @@ +.. _atlas-api-streams-deleteStreamInstance: + +====================================== +atlas api streams deleteStreamInstance +====================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Delete One Stream Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams deleteStreamInstance [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteStreamInstance + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance to delete. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-downloadStreamTenantAuditLogs.txt b/docs/command/atlas-api-streams-downloadStreamTenantAuditLogs.txt new file mode 100644 index 0000000000..dd56c3c2cd --- /dev/null +++ b/docs/command/atlas-api-streams-downloadStreamTenantAuditLogs.txt @@ -0,0 +1,78 @@ +.. _atlas-api-streams-downloadStreamTenantAuditLogs: + +=============================================== +atlas api streams downloadStreamTenantAuditLogs +=============================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Download Audit Logs for One Atlas Stream Processing Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams downloadStreamTenantAuditLogs [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --endDate + - int + - false + - Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for downloadStreamTenantAuditLogs + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --startDate + - int + - false + - Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-getStreamConnection.txt b/docs/command/atlas-api-streams-getStreamConnection.txt new file mode 100644 index 0000000000..2bdf0acde2 --- /dev/null +++ b/docs/command/atlas-api-streams-getStreamConnection.txt @@ -0,0 +1,74 @@ +.. _atlas-api-streams-getStreamConnection: + +===================================== +atlas api streams getStreamConnection +===================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Stream Connection + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams getStreamConnection [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --connectionName + - string + - true + - Human-readable label that identifies the stream connection to return. + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getStreamConnection + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-getStreamInstance.txt b/docs/command/atlas-api-streams-getStreamInstance.txt new file mode 100644 index 0000000000..c48c914b4b --- /dev/null +++ b/docs/command/atlas-api-streams-getStreamInstance.txt @@ -0,0 +1,74 @@ +.. _atlas-api-streams-getStreamInstance: + +=================================== +atlas api streams getStreamInstance +=================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Stream Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams getStreamInstance [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getStreamInstance + * - --includeConnections + - + - false + - Flag to indicate whether connections information should be included in the stream instance. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-listStreamConnections.txt b/docs/command/atlas-api-streams-listStreamConnections.txt new file mode 100644 index 0000000000..b5145d5792 --- /dev/null +++ b/docs/command/atlas-api-streams-listStreamConnections.txt @@ -0,0 +1,78 @@ +.. _atlas-api-streams-listStreamConnections: + +======================================= +atlas api streams listStreamConnections +======================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Connections Of The Stream Instances + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams listStreamConnections [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listStreamConnections + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-listStreamInstances.txt b/docs/command/atlas-api-streams-listStreamInstances.txt new file mode 100644 index 0000000000..2666e390dc --- /dev/null +++ b/docs/command/atlas-api-streams-listStreamInstances.txt @@ -0,0 +1,74 @@ +.. _atlas-api-streams-listStreamInstances: + +===================================== +atlas api streams listStreamInstances +===================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Project Stream Instances + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams listStreamInstances [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listStreamInstances + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-updateStreamConnection.txt b/docs/command/atlas-api-streams-updateStreamConnection.txt new file mode 100644 index 0000000000..361a198657 --- /dev/null +++ b/docs/command/atlas-api-streams-updateStreamConnection.txt @@ -0,0 +1,78 @@ +.. _atlas-api-streams-updateStreamConnection: + +======================================== +atlas api streams updateStreamConnection +======================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Stream Connection + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams updateStreamConnection [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --connectionName + - string + - true + - Human-readable label that identifies the stream connection. + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateStreamConnection + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams-updateStreamInstance.txt b/docs/command/atlas-api-streams-updateStreamInstance.txt new file mode 100644 index 0000000000..72d18d4406 --- /dev/null +++ b/docs/command/atlas-api-streams-updateStreamInstance.txt @@ -0,0 +1,74 @@ +.. _atlas-api-streams-updateStreamInstance: + +====================================== +atlas api streams updateStreamInstance +====================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Stream Instance + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api streams updateStreamInstance [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateStreamInstance + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --tenantName + - string + - true + - Human-readable label that identifies the stream instance to update. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-streams.txt b/docs/command/atlas-api-streams.txt new file mode 100644 index 0000000000..6cad5115bc --- /dev/null +++ b/docs/command/atlas-api-streams.txt @@ -0,0 +1,79 @@ +.. _atlas-api-streams: + +================= +atlas api streams +================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes Streams Instances. This resource requires your project ID. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for streams + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-streams-createStreamConnection` - Create One Connection +* :ref:`atlas-api-streams-createStreamInstance` - Create One Stream Instance +* :ref:`atlas-api-streams-deleteStreamConnection` - Delete One Stream Connection +* :ref:`atlas-api-streams-deleteStreamInstance` - Delete One Stream Instance +* :ref:`atlas-api-streams-downloadStreamTenantAuditLogs` - Download Audit Logs for One Atlas Stream Processing Instance +* :ref:`atlas-api-streams-getStreamConnection` - Return One Stream Connection +* :ref:`atlas-api-streams-getStreamInstance` - Return One Stream Instance +* :ref:`atlas-api-streams-listStreamConnections` - Return All Connections Of The Stream Instances +* :ref:`atlas-api-streams-listStreamInstances` - Return All Project Stream Instances +* :ref:`atlas-api-streams-updateStreamConnection` - Update One Stream Connection +* :ref:`atlas-api-streams-updateStreamInstance` - Update One Stream Instance + + +.. toctree:: + :titlesonly: + + createStreamConnection + createStreamInstance + deleteStreamConnection + deleteStreamInstance + downloadStreamTenantAuditLogs + getStreamConnection + getStreamInstance + listStreamConnections + listStreamInstances + updateStreamConnection + updateStreamInstance + diff --git a/docs/command/atlas-api-teams-addAllTeamsToProject.txt b/docs/command/atlas-api-teams-addAllTeamsToProject.txt new file mode 100644 index 0000000000..b1768e4580 --- /dev/null +++ b/docs/command/atlas-api-teams-addAllTeamsToProject.txt @@ -0,0 +1,70 @@ +.. _atlas-api-teams-addAllTeamsToProject: + +==================================== +atlas api teams addAllTeamsToProject +==================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Add One or More Teams to One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams addAllTeamsToProject [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for addAllTeamsToProject + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-addTeamUser.txt b/docs/command/atlas-api-teams-addTeamUser.txt new file mode 100644 index 0000000000..fddcf78a7e --- /dev/null +++ b/docs/command/atlas-api-teams-addTeamUser.txt @@ -0,0 +1,74 @@ +.. _atlas-api-teams-addTeamUser: + +=========================== +atlas api teams addTeamUser +=========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Assign MongoDB Cloud Users from One Organization to One Team + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams addTeamUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for addTeamUser + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --teamId + - string + - true + - Unique 24-hexadecimal character string that identifies the team to which you want to add MongoDB Cloud users. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-createTeam.txt b/docs/command/atlas-api-teams-createTeam.txt new file mode 100644 index 0000000000..7a46848230 --- /dev/null +++ b/docs/command/atlas-api-teams-createTeam.txt @@ -0,0 +1,70 @@ +.. _atlas-api-teams-createTeam: + +========================== +atlas api teams createTeam +========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One Team in One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams createTeam [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createTeam + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-deleteTeam.txt b/docs/command/atlas-api-teams-deleteTeam.txt new file mode 100644 index 0000000000..6c50087a7b --- /dev/null +++ b/docs/command/atlas-api-teams-deleteTeam.txt @@ -0,0 +1,70 @@ +.. _atlas-api-teams-deleteTeam: + +========================== +atlas api teams deleteTeam +========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Team from One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams deleteTeam [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteTeam + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --teamId + - string + - true + - Unique 24-hexadecimal digit string that identifies the team that you want to delete. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-getTeamById.txt b/docs/command/atlas-api-teams-getTeamById.txt new file mode 100644 index 0000000000..6be3fa16c6 --- /dev/null +++ b/docs/command/atlas-api-teams-getTeamById.txt @@ -0,0 +1,70 @@ +.. _atlas-api-teams-getTeamById: + +=========================== +atlas api teams getTeamById +=========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Team using its ID + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams getTeamById [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getTeamById + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --teamId + - string + - true + - Unique 24-hexadecimal digit string that identifies the team whose information you want to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-getTeamByName.txt b/docs/command/atlas-api-teams-getTeamByName.txt new file mode 100644 index 0000000000..20e16e8249 --- /dev/null +++ b/docs/command/atlas-api-teams-getTeamByName.txt @@ -0,0 +1,70 @@ +.. _atlas-api-teams-getTeamByName: + +============================= +atlas api teams getTeamByName +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Team using its Name + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams getTeamByName [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getTeamByName + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --teamName + - string + - true + - Name of the team whose information you want to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-listOrganizationTeams.txt b/docs/command/atlas-api-teams-listOrganizationTeams.txt new file mode 100644 index 0000000000..81bb84dd2c --- /dev/null +++ b/docs/command/atlas-api-teams-listOrganizationTeams.txt @@ -0,0 +1,78 @@ +.. _atlas-api-teams-listOrganizationTeams: + +===================================== +atlas api teams listOrganizationTeams +===================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Teams in One Organization + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams listOrganizationTeams [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listOrganizationTeams + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-listProjectTeams.txt b/docs/command/atlas-api-teams-listProjectTeams.txt new file mode 100644 index 0000000000..868e6e10da --- /dev/null +++ b/docs/command/atlas-api-teams-listProjectTeams.txt @@ -0,0 +1,78 @@ +.. _atlas-api-teams-listProjectTeams: + +================================ +atlas api teams listProjectTeams +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Teams in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams listProjectTeams [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listProjectTeams + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-listTeamUsers.txt b/docs/command/atlas-api-teams-listTeamUsers.txt new file mode 100644 index 0000000000..7952f75340 --- /dev/null +++ b/docs/command/atlas-api-teams-listTeamUsers.txt @@ -0,0 +1,78 @@ +.. _atlas-api-teams-listTeamUsers: + +============================= +atlas api teams listTeamUsers +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All MongoDB Cloud Users Assigned to One Team + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams listTeamUsers [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listTeamUsers + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --teamId + - string + - true + - Unique 24-hexadecimal digit string that identifies the team whose application users you want to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-removeProjectTeam.txt b/docs/command/atlas-api-teams-removeProjectTeam.txt new file mode 100644 index 0000000000..ed5e7ec206 --- /dev/null +++ b/docs/command/atlas-api-teams-removeProjectTeam.txt @@ -0,0 +1,66 @@ +.. _atlas-api-teams-removeProjectTeam: + +================================= +atlas api teams removeProjectTeam +================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Team from One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams removeProjectTeam [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for removeProjectTeam + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --teamId + - string + - true + - Unique 24-hexadecimal digit string that identifies the team that you want to remove from the specified project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-removeTeamUser.txt b/docs/command/atlas-api-teams-removeTeamUser.txt new file mode 100644 index 0000000000..50facc90bc --- /dev/null +++ b/docs/command/atlas-api-teams-removeTeamUser.txt @@ -0,0 +1,70 @@ +.. _atlas-api-teams-removeTeamUser: + +============================== +atlas api teams removeTeamUser +============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One MongoDB Cloud User from One Team + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams removeTeamUser [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for removeTeamUser + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --teamId + - string + - true + - Unique 24-hexadecimal digit string that identifies the team from which you want to remove one database application user. + * - --userId + - string + - true + - Unique 24-hexadecimal digit string that identifies MongoDB Cloud user that you want to remove from the specified team. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-renameTeam.txt b/docs/command/atlas-api-teams-renameTeam.txt new file mode 100644 index 0000000000..9fb0f85df8 --- /dev/null +++ b/docs/command/atlas-api-teams-renameTeam.txt @@ -0,0 +1,74 @@ +.. _atlas-api-teams-renameTeam: + +========================== +atlas api teams renameTeam +========================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Rename One Team + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams renameTeam [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for renameTeam + * - --orgId + - string + - false + - Unique 24-hexadecimal digit string that identifies the organization + * - --teamId + - string + - true + - Unique 24-hexadecimal digit string that identifies the team that you want to rename. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams-updateTeamRoles.txt b/docs/command/atlas-api-teams-updateTeamRoles.txt new file mode 100644 index 0000000000..7cf2f6393c --- /dev/null +++ b/docs/command/atlas-api-teams-updateTeamRoles.txt @@ -0,0 +1,74 @@ +.. _atlas-api-teams-updateTeamRoles: + +=============================== +atlas api teams updateTeamRoles +=============================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update Team Roles in One Project + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api teams updateTeamRoles [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateTeamRoles + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --teamId + - string + - true + - Unique 24-hexadecimal digit string that identifies the team for which you want to update roles. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-teams.txt b/docs/command/atlas-api-teams.txt new file mode 100644 index 0000000000..3dd82d8813 --- /dev/null +++ b/docs/command/atlas-api-teams.txt @@ -0,0 +1,83 @@ +.. _atlas-api-teams: + +=============== +atlas api teams +=============== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, or removes teams. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for teams + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-teams-addAllTeamsToProject` - Add One or More Teams to One Project +* :ref:`atlas-api-teams-addTeamUser` - Assign MongoDB Cloud Users from One Organization to One Team +* :ref:`atlas-api-teams-createTeam` - Create One Team in One Organization +* :ref:`atlas-api-teams-deleteTeam` - Remove One Team from One Organization +* :ref:`atlas-api-teams-getTeamById` - Return One Team using its ID +* :ref:`atlas-api-teams-getTeamByName` - Return One Team using its Name +* :ref:`atlas-api-teams-listOrganizationTeams` - Return All Teams in One Organization +* :ref:`atlas-api-teams-listProjectTeams` - Return All Teams in One Project +* :ref:`atlas-api-teams-listTeamUsers` - Return All MongoDB Cloud Users Assigned to One Team +* :ref:`atlas-api-teams-removeProjectTeam` - Remove One Team from One Project +* :ref:`atlas-api-teams-removeTeamUser` - Remove One MongoDB Cloud User from One Team +* :ref:`atlas-api-teams-renameTeam` - Rename One Team +* :ref:`atlas-api-teams-updateTeamRoles` - Update Team Roles in One Project + + +.. toctree:: + :titlesonly: + + addAllTeamsToProject + addTeamUser + createTeam + deleteTeam + getTeamById + getTeamByName + listOrganizationTeams + listProjectTeams + listTeamUsers + removeProjectTeam + removeTeamUser + renameTeam + updateTeamRoles + diff --git a/docs/command/atlas-api-thirdPartyIntegrations-createThirdPartyIntegration.txt b/docs/command/atlas-api-thirdPartyIntegrations-createThirdPartyIntegration.txt new file mode 100644 index 0000000000..0376117077 --- /dev/null +++ b/docs/command/atlas-api-thirdPartyIntegrations-createThirdPartyIntegration.txt @@ -0,0 +1,86 @@ +.. _atlas-api-thirdPartyIntegrations-createThirdPartyIntegration: + +============================================================ +atlas api thirdPartyIntegrations createThirdPartyIntegration +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Configure One Third-Party Service Integration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api thirdPartyIntegrations createThirdPartyIntegration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createThirdPartyIntegration + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --integrationType + - string + - true + - Human-readable label that identifies the service which you want to integrate with MongoDB Cloud. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-thirdPartyIntegrations-deleteThirdPartyIntegration.txt b/docs/command/atlas-api-thirdPartyIntegrations-deleteThirdPartyIntegration.txt new file mode 100644 index 0000000000..c89c98e544 --- /dev/null +++ b/docs/command/atlas-api-thirdPartyIntegrations-deleteThirdPartyIntegration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-thirdPartyIntegrations-deleteThirdPartyIntegration: + +============================================================ +atlas api thirdPartyIntegrations deleteThirdPartyIntegration +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Remove One Third-Party Service Integration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api thirdPartyIntegrations deleteThirdPartyIntegration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for deleteThirdPartyIntegration + * - --integrationType + - string + - true + - Human-readable label that identifies the service which you want to integrate with MongoDB Cloud. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-thirdPartyIntegrations-getThirdPartyIntegration.txt b/docs/command/atlas-api-thirdPartyIntegrations-getThirdPartyIntegration.txt new file mode 100644 index 0000000000..2bf14ff5a6 --- /dev/null +++ b/docs/command/atlas-api-thirdPartyIntegrations-getThirdPartyIntegration.txt @@ -0,0 +1,70 @@ +.. _atlas-api-thirdPartyIntegrations-getThirdPartyIntegration: + +========================================================= +atlas api thirdPartyIntegrations getThirdPartyIntegration +========================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return One Third-Party Service Integration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api thirdPartyIntegrations getThirdPartyIntegration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for getThirdPartyIntegration + * - --integrationType + - string + - true + - Human-readable label that identifies the service which you want to integrate with MongoDB Cloud. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-thirdPartyIntegrations-listThirdPartyIntegrations.txt b/docs/command/atlas-api-thirdPartyIntegrations-listThirdPartyIntegrations.txt new file mode 100644 index 0000000000..401d2d230e --- /dev/null +++ b/docs/command/atlas-api-thirdPartyIntegrations-listThirdPartyIntegrations.txt @@ -0,0 +1,78 @@ +.. _atlas-api-thirdPartyIntegrations-listThirdPartyIntegrations: + +=========================================================== +atlas api thirdPartyIntegrations listThirdPartyIntegrations +=========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All Active Third-Party Service Integrations + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api thirdPartyIntegrations listThirdPartyIntegrations [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listThirdPartyIntegrations + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-thirdPartyIntegrations-updateThirdPartyIntegration.txt b/docs/command/atlas-api-thirdPartyIntegrations-updateThirdPartyIntegration.txt new file mode 100644 index 0000000000..1b92f202b0 --- /dev/null +++ b/docs/command/atlas-api-thirdPartyIntegrations-updateThirdPartyIntegration.txt @@ -0,0 +1,86 @@ +.. _atlas-api-thirdPartyIntegrations-updateThirdPartyIntegration: + +============================================================ +atlas api thirdPartyIntegrations updateThirdPartyIntegration +============================================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Update One Third-Party Service Integration + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api thirdPartyIntegrations updateThirdPartyIntegration [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for updateThirdPartyIntegration + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --integrationType + - string + - true + - Human-readable label that identifies the service which you want to integrate with MongoDB Cloud. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-thirdPartyIntegrations.txt b/docs/command/atlas-api-thirdPartyIntegrations.txt new file mode 100644 index 0000000000..b0f43b25f4 --- /dev/null +++ b/docs/command/atlas-api-thirdPartyIntegrations.txt @@ -0,0 +1,69 @@ +.. _atlas-api-thirdPartyIntegrations: + +================================ +atlas api thirdPartyIntegrations +================================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, adds, edits, and removes third-party service integration configurations. MongoDB Cloud sends alerts to each third-party service that you configure. + +**IMPORTANT**: Each project can only have one configuration per integrationType. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for thirdPartyIntegrations + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-thirdPartyIntegrations-createThirdPartyIntegration` - Configure One Third-Party Service Integration +* :ref:`atlas-api-thirdPartyIntegrations-deleteThirdPartyIntegration` - Remove One Third-Party Service Integration +* :ref:`atlas-api-thirdPartyIntegrations-getThirdPartyIntegration` - Return One Third-Party Service Integration +* :ref:`atlas-api-thirdPartyIntegrations-listThirdPartyIntegrations` - Return All Active Third-Party Service Integrations +* :ref:`atlas-api-thirdPartyIntegrations-updateThirdPartyIntegration` - Update One Third-Party Service Integration + + +.. toctree:: + :titlesonly: + + createThirdPartyIntegration + deleteThirdPartyIntegration + getThirdPartyIntegration + listThirdPartyIntegrations + updateThirdPartyIntegration + diff --git a/docs/command/atlas-api-x509Authentication-createDatabaseUserCertificate.txt b/docs/command/atlas-api-x509Authentication-createDatabaseUserCertificate.txt new file mode 100644 index 0000000000..fc0dd9defc --- /dev/null +++ b/docs/command/atlas-api-x509Authentication-createDatabaseUserCertificate.txt @@ -0,0 +1,74 @@ +.. _atlas-api-x509Authentication-createDatabaseUserCertificate: + +========================================================== +atlas api x509Authentication createDatabaseUserCertificate +========================================================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Create One X.509 Certificate for One MongoDB User + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api x509Authentication createDatabaseUserCertificate [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -f, --file + - string + - false + - Path to an optional JSON configuration file if not passed stdin is expected + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for createDatabaseUserCertificate + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --username + - string + - true + - Human-readable label that represents the MongoDB database user account for whom to create a certificate. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-x509Authentication-disableCustomerManagedX509.txt b/docs/command/atlas-api-x509Authentication-disableCustomerManagedX509.txt new file mode 100644 index 0000000000..74e0bdf8ed --- /dev/null +++ b/docs/command/atlas-api-x509Authentication-disableCustomerManagedX509.txt @@ -0,0 +1,66 @@ +.. _atlas-api-x509Authentication-disableCustomerManagedX509: + +======================================================= +atlas api x509Authentication disableCustomerManagedX509 +======================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Disable Customer-Managed X.509 + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api x509Authentication disableCustomerManagedX509 [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for disableCustomerManagedX509 + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-x509Authentication-listDatabaseUserCertificates.txt b/docs/command/atlas-api-x509Authentication-listDatabaseUserCertificates.txt new file mode 100644 index 0000000000..9f8b274bb5 --- /dev/null +++ b/docs/command/atlas-api-x509Authentication-listDatabaseUserCertificates.txt @@ -0,0 +1,82 @@ +.. _atlas-api-x509Authentication-listDatabaseUserCertificates: + +========================================================= +atlas api x509Authentication listDatabaseUserCertificates +========================================================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Return All X.509 Certificates Assigned to One MongoDB User + +Syntax +------ + +.. code-block:: + :caption: Command Syntax + + atlas api x509Authentication listDatabaseUserCertificates [options] + +.. Code end marker, please don't delete this comment + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - --format + - string + - false + - Format of the output + * - -h, --help + - + - false + - help for listDatabaseUserCertificates + * - --includeCount + - + - false + - Flag that indicates whether the response returns the total number of items (**totalCount**) in the response. This value defaults to true. + * - --itemsPerPage + - int + - false + - Number of items that the response returns per page. This value defaults to 100. + * - --pageNum + - int + - false + - Number of the page that displays the current set of the total objects that the response returns. This value defaults to 1. + * - --projectId + - string + - false + - Unique 24-hexadecimal digit string that identifies your project. + * - --username + - string + - true + - Human-readable label that represents the MongoDB database user account whose certificates you want to return. + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + diff --git a/docs/command/atlas-api-x509Authentication.txt b/docs/command/atlas-api-x509Authentication.txt new file mode 100644 index 0000000000..c46241f24d --- /dev/null +++ b/docs/command/atlas-api-x509Authentication.txt @@ -0,0 +1,63 @@ +.. _atlas-api-x509Authentication: + +============================ +atlas api x509Authentication +============================ + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages your certificates, it also manages your Certificate Authority and can generate certificates for your database users. No additional X.509 configuration is required. If you manage your certificates, you must provide a Certificate Authority and generate certificates for your database users. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for x509Authentication + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-x509Authentication-createDatabaseUserCertificate` - Create One X.509 Certificate for One MongoDB User +* :ref:`atlas-api-x509Authentication-disableCustomerManagedX509` - Disable Customer-Managed X.509 +* :ref:`atlas-api-x509Authentication-listDatabaseUserCertificates` - Return All X.509 Certificates Assigned to One MongoDB User + + +.. toctree:: + :titlesonly: + + createDatabaseUserCertificate + disableCustomerManagedX509 + listDatabaseUserCertificates + diff --git a/docs/command/atlas-api.txt b/docs/command/atlas-api.txt new file mode 100644 index 0000000000..c7b2cf8f31 --- /dev/null +++ b/docs/command/atlas-api.txt @@ -0,0 +1,153 @@ +.. _atlas-api: + +========= +atlas api +========= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Access to api resources. + +This command provides access to API resources specified in https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/. + +Options +------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -h, --help + - + - false + - help for api + +Inherited Options +----------------- + +.. list-table:: + :header-rows: 1 + :widths: 20 10 10 60 + + * - Name + - Type + - Required + - Description + * - -P, --profile + - string + - false + - 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. + +Related Commands +---------------- + +* :ref:`atlas-api-aWSClustersDNS` - Returns and edits custom DNS configurations for MongoDB Cloud database deployments on AWS. The resource requires your Project ID. If you use the VPC peering on AWS and you use your own DNS servers instead of Amazon Route 53, enable custom DNS. Before 31 March 2020, applications deployed within AWS using custom DNS services and VPC-peered with MongoDB Cloud couldn't connect over private IP addresses. Custom DNS resolved to public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings. +* :ref:`atlas-api-accessTracking` - Returns access logs for authentication attempts made to Atlas database deployments. To view database access history, you must have either the Project Owner or Organization Owner role. +* :ref:`atlas-api-alertConfigurations` - Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change. +* :ref:`atlas-api-alerts` - Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change. +* :ref:`atlas-api-atlasSearch` - Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster. +* :ref:`atlas-api-auditing` - Returns and edits database auditing settings for MongoDB Cloud projects. +* :ref:`atlas-api-cloudBackups` - Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups. +* :ref:`atlas-api-cloudMigrationService` - Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA. +* :ref:`atlas-api-cloudProviderAccess` - Returns, adds, authorizes, and removes AWS IAM roles in Atlas. +* :ref:`atlas-api-clusterOutageSimulation` - Returns, starts, or ends a cluster outage simulation. +* :ref:`atlas-api-clusters` - Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID. +* :ref:`atlas-api-collectionLevelMetrics` - Returns, adds, and edits pinned namespaces for the specified cluster or process. Also returns collection level latency metric data. +* :ref:`atlas-api-customDatabaseRoles` - Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the project level, for all clusters in the project. This resource supports a subset of MongoDB privilege actions. You can create a subset of custom role actions. To create a wider list of custom role actions, use the MongoDB Cloud user interface. Custom roles must include actions that all project's clusters support, and that are compatible with each MongoDB version that your project's clusters use. For example, if your project has MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4. +* :ref:`atlas-api-dataFederation` - Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs. +* :ref:`atlas-api-dataLakePipelines` - Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs. +* :ref:`atlas-api-databaseUsers` - Returns, adds, edits, and removes database users. +* :ref:`atlas-api-encryptionAtRestUsingCustomerKeyManagement` - Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management. +* :ref:`atlas-api-events` - Returns events. This collection remains under revision and may change. +* :ref:`atlas-api-federatedAuthentication` - Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations. +* :ref:`atlas-api-globalClusters` - Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. +MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster. +* :ref:`atlas-api-invoices` - Returns invoices. +* :ref:`atlas-api-lDAPConfiguration` - Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower. +* :ref:`atlas-api-legacyBackup` - Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints. +* :ref:`atlas-api-maintenanceWindows` - Returns, edits, and removes maintenance windows. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. You can defer a scheduled maintenance event for a project up to two times. Deferred maintenance events occur during your preferred maintenance window exactly one week after the previously scheduled date and time. +* :ref:`atlas-api-mongoDBCloudUsers` - Returns, adds, and edits MongoDB Cloud users. +* :ref:`atlas-api-monitoringAndLogs` - Returns database deployment monitoring and logging data. +* :ref:`atlas-api-networkPeering` - Returns, adds, edits, and removes network peering containers and peering connections. +When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block. +* :ref:`atlas-api-onlineArchive` - Returns, adds, edits, or removes an online archive. +* :ref:`atlas-api-organizations` - Returns, adds, and edits organizational units in MongoDB Cloud. +* :ref:`atlas-api-performanceAdvisor` - Returns suggested indexes and slow query data for a database deployment. Also enables or disables MongoDB Cloud-managed slow operation thresholds. To view field values in a sample query, you must have the Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted data rather than the field values. +* :ref:`atlas-api-privateEndpointServices` - Returns, adds, edits, and removes private endpoint services. +* :ref:`atlas-api-programmaticAPIKeys` - Returns, adds, edits, and removes access tokens to use the MongoDB Cloud API. MongoDB Cloud applies these keys to organizations. These resources can return, assign, or revoke use of these keys within a specified project. +* :ref:`atlas-api-projectIPAccessList` - Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period. +* :ref:`atlas-api-projects` - Returns, adds, and edits collections of clusters and users in MongoDB Cloud. +* :ref:`atlas-api-pushBasedLogExport` - You can continually push logs from mongod, mongos, and audit logs to an AWS S3 bucket. Atlas exports logs every 5 minutes. +* :ref:`atlas-api-rollingIndex` - Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster. +* :ref:`atlas-api-root` - Returns details that describe the MongoDB Cloud build and the access token that requests this resource. This starts the MongoDB Cloud API. +* :ref:`atlas-api-serverlessInstances` - Returns, adds, edits, and removes serverless instances. +* :ref:`atlas-api-serverlessPrivateEndpoints` - Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial. +* :ref:`atlas-api-sharedTierRestoreJobs` - Returns and adds restore jobs for shared-tier database deployments. +* :ref:`atlas-api-sharedTierSnapshots` - Returns and requests to download shared-tier database deployment snapshots. +* :ref:`atlas-api-streams` - Returns, adds, edits, and removes Streams Instances. This resource requires your project ID. +* :ref:`atlas-api-teams` - Returns, adds, edits, or removes teams. +* :ref:`atlas-api-thirdPartyIntegrations` - Returns, adds, edits, and removes third-party service integration configurations. MongoDB Cloud sends alerts to each third-party service that you configure. + +**IMPORTANT**: Each project can only have one configuration per integrationType. +* :ref:`atlas-api-x509Authentication` - Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages your certificates, it also manages your Certificate Authority and can generate certificates for your database users. No additional X.509 configuration is required. If you manage your certificates, you must provide a Certificate Authority and generate certificates for your database users. + + +.. toctree:: + :titlesonly: + + aWSClustersDNS + accessTracking + alertConfigurations + alerts + atlasSearch + auditing + cloudBackups + cloudMigrationService + cloudProviderAccess + clusterOutageSimulation + clusters + collectionLevelMetrics + customDatabaseRoles + dataFederation + dataLakePipelines + databaseUsers + encryptionAtRestUsingCustomerKeyManagement + events + federatedAuthentication + globalClusters + invoices + lDAPConfiguration + legacyBackup + maintenanceWindows + mongoDBCloudUsers + monitoringAndLogs + networkPeering + onlineArchive + organizations + performanceAdvisor + privateEndpointServices + programmaticAPIKeys + projectIPAccessList + projects + pushBasedLogExport + rollingIndex + root + serverlessInstances + serverlessPrivateEndpoints + sharedTierRestoreJobs + sharedTierSnapshots + streams + teams + thirdPartyIntegrations + x509Authentication + diff --git a/docs/command/atlas.txt b/docs/command/atlas.txt index 48bca6515f..e0f16ae646 100644 --- a/docs/command/atlas.txt +++ b/docs/command/atlas.txt @@ -52,6 +52,7 @@ Related Commands * :ref:`atlas-accessLists` - Manage the list of IP addresses that can access your Atlas project. * :ref:`atlas-accessLogs` - Return the access logs for a cluster. * :ref:`atlas-alerts` - Manage alerts for your project. +* :ref:`atlas-api` - Access to api resources. * :ref:`atlas-auditing` - Returns database auditing settings for MongoDB Cloud projects. * :ref:`atlas-auth` - Manage the CLI's authentication state. * :ref:`atlas-backups` - Manage cloud backups for your project. @@ -93,6 +94,7 @@ Related Commands accessLists accessLogs alerts + api auditing auth backups diff --git a/internal/api/.openapi-generator/FILES b/internal/api/.openapi-generator/FILES index fca7b95d03..fc10f0cac9 100644 --- a/internal/api/.openapi-generator/FILES +++ b/internal/api/.openapi-generator/FILES @@ -10,6 +10,7 @@ api_cloud_migration_service_cmd.go api_cloud_provider_access_cmd.go api_cluster_outage_simulation_cmd.go api_clusters_cmd.go +api_collection_level_metrics_cmd.go api_custom_database_roles_cmd.go api_data_federation_cmd.go api_data_lake_pipelines_cmd.go @@ -21,7 +22,6 @@ api_global_clusters_cmd.go api_invoices_cmd.go api_ldap_configuration_cmd.go api_legacy_backup_cmd.go -api_legacy_backup_restore_jobs_cmd.go api_maintenance_windows__cmd.go api_mongo_db_cloud_users_cmd.go api_monitoring_and_logs_cmd.go diff --git a/internal/api/api.go b/internal/api/api.go index b50c894644..63d6e48281 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ func Builder() *cobra.Command { cloudProviderAccessBuilder(), clusterOutageSimulationBuilder(), clustersBuilder(), + collectionLevelMetricsBuilder(), customDatabaseRolesBuilder(), dataFederationBuilder(), dataLakePipelinesBuilder(), @@ -51,7 +52,6 @@ func Builder() *cobra.Command { invoicesBuilder(), lDAPConfigurationBuilder(), legacyBackupBuilder(), - legacyBackupRestoreJobsBuilder(), maintenanceWindowsBuilder(), mongoDBCloudUsersBuilder(), monitoringAndLogsBuilder(), diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index 1fac1be096..b2af802512 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type listAccessLogsByClusterNameOpts struct { diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index f581245aec..d57f2c253f 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createAlertConfigurationOpts struct { diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index c3387f7a8c..af472937c4 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type acknowledgeAlertOpts struct { diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index f24d0cf827..bbbfeef86c 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,12 +26,136 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) +type createAtlasSearchDeploymentOpts struct { + client *admin.APIClient + groupId string + clusterName string + + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.ApiSearchDeploymentResponse +} + +func (opts *createAtlasSearchDeploymentOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *createAtlasSearchDeploymentOpts) readData(r io.Reader) (*admin.ApiSearchDeploymentRequest, error) { + var out *admin.ApiSearchDeploymentRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(r) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createAtlasSearchDeploymentOpts) run(ctx context.Context, r io.Reader) error { + data, errData := opts.readData(r) + if errData != nil { + return errData + } + + params := &admin.CreateAtlasSearchDeploymentApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + + ApiSearchDeploymentRequest: data, + } + + var err error + opts.resp, _, err = opts.client.AtlasSearchApi.CreateAtlasSearchDeploymentWithParams(ctx, params).Execute() + return err +} + +func (opts *createAtlasSearchDeploymentOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func createAtlasSearchDeploymentBuilder() *cobra.Command { + opts := createAtlasSearchDeploymentOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "createAtlasSearchDeployment", + Short: "Create Search Nodes", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Label that identifies the cluster to create Search Nodes for.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type createAtlasSearchIndexOpts struct { client *admin.APIClient groupId string @@ -156,6 +280,70 @@ func createAtlasSearchIndexBuilder() *cobra.Command { return cmd } +type deleteAtlasSearchDeploymentOpts struct { + client *admin.APIClient + groupId string + clusterName string +} + +func (opts *deleteAtlasSearchDeploymentOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + return nil +} + +func (opts *deleteAtlasSearchDeploymentOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.DeleteAtlasSearchDeploymentApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + + var err error + _, err = opts.client.AtlasSearchApi.DeleteAtlasSearchDeploymentWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteAtlasSearchDeploymentOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + +func deleteAtlasSearchDeploymentBuilder() *cobra.Command { + opts := deleteAtlasSearchDeploymentOpts{} + cmd := &cobra.Command{ + Use: "deleteAtlasSearchDeployment", + Short: "Delete Search Nodes", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Label that identifies the cluster to delete.`) + + _ = cmd.MarkFlagRequired("clusterName") + return cmd +} + type deleteAtlasSearchIndexOpts struct { client *admin.APIClient groupId string @@ -249,6 +437,95 @@ func deleteAtlasSearchIndexBuilder() *cobra.Command { return cmd } +type getAtlasSearchDeploymentOpts struct { + client *admin.APIClient + groupId string + clusterName string + format string + tmpl *template.Template + resp *admin.ApiSearchDeploymentResponse +} + +func (opts *getAtlasSearchDeploymentOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *getAtlasSearchDeploymentOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.GetAtlasSearchDeploymentApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + + var err error + opts.resp, _, err = opts.client.AtlasSearchApi.GetAtlasSearchDeploymentWithParams(ctx, params).Execute() + return err +} + +func (opts *getAtlasSearchDeploymentOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func getAtlasSearchDeploymentBuilder() *cobra.Command { + opts := getAtlasSearchDeploymentOpts{} + cmd := &cobra.Command{ + Use: "getAtlasSearchDeployment", + Short: "Return Search Nodes", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Label that identifies the cluster to return the Search Nodes for.`) + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type getAtlasSearchIndexOpts struct { client *admin.APIClient groupId string @@ -439,6 +716,130 @@ func listAtlasSearchIndexesBuilder() *cobra.Command { return cmd } +type updateAtlasSearchDeploymentOpts struct { + client *admin.APIClient + groupId string + clusterName string + + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.ApiSearchDeploymentResponse +} + +func (opts *updateAtlasSearchDeploymentOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *updateAtlasSearchDeploymentOpts) readData(r io.Reader) (*admin.ApiSearchDeploymentRequest, error) { + var out *admin.ApiSearchDeploymentRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(r) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *updateAtlasSearchDeploymentOpts) run(ctx context.Context, r io.Reader) error { + data, errData := opts.readData(r) + if errData != nil { + return errData + } + + params := &admin.UpdateAtlasSearchDeploymentApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + + ApiSearchDeploymentRequest: data, + } + + var err error + opts.resp, _, err = opts.client.AtlasSearchApi.UpdateAtlasSearchDeploymentWithParams(ctx, params).Execute() + return err +} + +func (opts *updateAtlasSearchDeploymentOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func updateAtlasSearchDeploymentBuilder() *cobra.Command { + opts := updateAtlasSearchDeploymentOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "updateAtlasSearchDeployment", + Short: "Update Search Nodes", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Label that identifies the cluster to update the Search Nodes for.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type updateAtlasSearchIndexOpts struct { client *admin.APIClient groupId string @@ -573,10 +974,14 @@ func atlasSearchBuilder() *cobra.Command { Short: `Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.`, } cmd.AddCommand( + createAtlasSearchDeploymentBuilder(), createAtlasSearchIndexBuilder(), + deleteAtlasSearchDeploymentBuilder(), deleteAtlasSearchIndexBuilder(), + getAtlasSearchDeploymentBuilder(), getAtlasSearchIndexBuilder(), listAtlasSearchIndexesBuilder(), + updateAtlasSearchDeploymentBuilder(), updateAtlasSearchIndexBuilder(), ) return cmd diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 222523282a..363a4e1dcd 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type getAuditingConfigurationOpts struct { diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index 1135d686d7..85f52723d9 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type getAWSCustomDNSOpts struct { diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 7a4f1ddc39..01500d7283 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type cancelBackupRestoreJobOpts struct { @@ -1261,7 +1261,7 @@ type getDataProtectionSettingsOpts struct { groupId string format string tmpl *template.Template - resp *admin.DataProtectionSettings + resp *admin.DataProtectionSettings20231001 } func (opts *getDataProtectionSettingsOpts) preRun() (err error) { @@ -2727,11 +2727,12 @@ type updateDataProtectionSettingsOpts struct { client *admin.APIClient groupId string - filename string - fs afero.Fs - format string - tmpl *template.Template - resp *admin.DataProtectionSettings + overwriteBackupPolicies bool + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.DataProtectionSettings20231001 } func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { @@ -2759,8 +2760,8 @@ func (opts *updateDataProtectionSettingsOpts) preRun() (err error) { return nil } -func (opts *updateDataProtectionSettingsOpts) readData(r io.Reader) (*admin.DataProtectionSettings, error) { - var out *admin.DataProtectionSettings +func (opts *updateDataProtectionSettingsOpts) readData(r io.Reader) (*admin.DataProtectionSettings20231001, error) { + var out *admin.DataProtectionSettings20231001 var buf []byte var err error @@ -2790,7 +2791,9 @@ func (opts *updateDataProtectionSettingsOpts) run(ctx context.Context, r io.Read params := &admin.UpdateDataProtectionSettingsApiParams{ GroupId: opts.groupId, - DataProtectionSettings: data, + OverwriteBackupPolicies: &opts.overwriteBackupPolicies, + + DataProtectionSettings20231001: data, } var err error @@ -2837,6 +2840,7 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().BoolVar(&opts.overwriteBackupPolicies, "overwriteBackupPolicies", true, `Flag that indicates whether to overwrite non complying backup policies with the new data protection settings or not.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index f9bcd20bff..b2a9309805 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createLinkTokenOpts struct { diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index 5963142d26..7d18334c37 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type authorizeCloudProviderAccessRoleOpts struct { diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index 509dec7eec..ab29d62892 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type endOutageSimulationOpts struct { diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index cd23c25678..ffd249cb8b 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -28,10 +28,10 @@ import ( "time" "github.com/briandowns/spinner" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createClusterOpts struct { @@ -245,7 +245,7 @@ func deleteClusterBuilder() *cobra.Command { opts := deleteClusterOpts{} cmd := &cobra.Command{ Use: "deleteCluster", - Short: "Remove One Multi-Cloud Cluster from One Project", + Short: "Remove One Cluster from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -334,7 +334,7 @@ func getClusterBuilder() *cobra.Command { opts := getClusterOpts{} cmd := &cobra.Command{ Use: "getCluster", - Short: "Return One Multi-Cloud Cluster from One Project", + Short: "Return One Cluster from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -346,7 +346,7 @@ func getClusterBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this cluster.`) _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") @@ -1032,7 +1032,7 @@ func testFailoverBuilder() *cobra.Command { opts := testFailoverOpts{} cmd := &cobra.Command{ Use: "testFailover", - Short: "Test Failover for One Multi-Cloud Cluster", + Short: "Test Failover for One Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1153,7 +1153,7 @@ func updateClusterBuilder() *cobra.Command { } cmd := &cobra.Command{ Use: "updateCluster", - Short: "Modify One Multi-Cloud Cluster from One Project", + Short: "Modify One Cluster from One Project", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1334,8 +1334,8 @@ func (opts *upgradeSharedClusterOpts) preRun() (err error) { return nil } -func (opts *upgradeSharedClusterOpts) readData(r io.Reader) (*admin.LegacyAtlasCluster, error) { - var out *admin.LegacyAtlasCluster +func (opts *upgradeSharedClusterOpts) readData(r io.Reader) (*admin.LegacyAtlasTenantClusterUpgradeRequest, error) { + var out *admin.LegacyAtlasTenantClusterUpgradeRequest var buf []byte var err error @@ -1365,7 +1365,7 @@ func (opts *upgradeSharedClusterOpts) run(ctx context.Context, r io.Reader) erro params := &admin.UpgradeSharedClusterApiParams{ GroupId: opts.groupId, - LegacyAtlasCluster: data, + LegacyAtlasTenantClusterUpgradeRequest: data, } var err error diff --git a/internal/api/api_collection_level_metrics_cmd.go b/internal/api/api_collection_level_metrics_cmd.go new file mode 100644 index 0000000000..e358b7cc92 --- /dev/null +++ b/internal/api/api_collection_level_metrics_cmd.go @@ -0,0 +1,1093 @@ +// Copyright 2024 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. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "context" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "io" + "strings" + "text/template" + "time" + + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" + "github.com/spf13/afero" + "github.com/spf13/cobra" + "go.mongodb.org/atlas-sdk/v20231115012/admin" +) + +type getCollStatsLatencyNamespaceClusterMeasurementsOpts struct { + client *admin.APIClient + groupId string + clusterName string + clusterView string + databaseName string + collectionName string + metrics []string + start string + end string + period string + format string + tmpl *template.Template + resp *admin.MeasurementsCollStatsLatencyCluster +} + +func (opts *getCollStatsLatencyNamespaceClusterMeasurementsOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *getCollStatsLatencyNamespaceClusterMeasurementsOpts) run(ctx context.Context, _ io.Reader) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + + params := &admin.GetCollStatsLatencyNamespaceClusterMeasurementsApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + ClusterView: opts.clusterView, + DatabaseName: opts.databaseName, + CollectionName: opts.collectionName, + Metrics: &opts.metrics, + Start: start, + End: end, + Period: &opts.period, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.GetCollStatsLatencyNamespaceClusterMeasurementsWithParams(ctx, params).Execute() + return err +} + +func (opts *getCollStatsLatencyNamespaceClusterMeasurementsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func getCollStatsLatencyNamespaceClusterMeasurementsBuilder() *cobra.Command { + opts := getCollStatsLatencyNamespaceClusterMeasurementsOpts{} + cmd := &cobra.Command{ + Use: "getCollStatsLatencyNamespaceClusterMeasurements", + Short: "Return Cluster-Level Query Latency", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to retrieve metrics for.`) + cmd.Flags().StringVar(&opts.clusterView, "clusterView", "", `Human-readable label that identifies the cluster topology to retrieve metrics for.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database.`) + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection.`) + cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the metrics that you want to retrieve for the associated data series. If you don't set this parameter, this resource returns data series for all Coll Stats Latency metrics.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + + _ = cmd.MarkFlagRequired("clusterName") + _ = cmd.MarkFlagRequired("clusterView") + _ = cmd.MarkFlagRequired("databaseName") + _ = cmd.MarkFlagRequired("collectionName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +type getCollStatsLatencyNamespaceHostMeasurementsOpts struct { + client *admin.APIClient + groupId string + processId string + databaseName string + collectionName string + metrics []string + start string + end string + period string + format string + tmpl *template.Template + resp *admin.MeasurementsCollStatsLatencyHost +} + +func (opts *getCollStatsLatencyNamespaceHostMeasurementsOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *getCollStatsLatencyNamespaceHostMeasurementsOpts) run(ctx context.Context, _ io.Reader) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + + params := &admin.GetCollStatsLatencyNamespaceHostMeasurementsApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + DatabaseName: opts.databaseName, + CollectionName: opts.collectionName, + Metrics: &opts.metrics, + Start: start, + End: end, + Period: &opts.period, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.GetCollStatsLatencyNamespaceHostMeasurementsWithParams(ctx, params).Execute() + return err +} + +func (opts *getCollStatsLatencyNamespaceHostMeasurementsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func getCollStatsLatencyNamespaceHostMeasurementsBuilder() *cobra.Command { + opts := getCollStatsLatencyNamespaceHostMeasurementsOpts{} + cmd := &cobra.Command{ + Use: "getCollStatsLatencyNamespaceHostMeasurements", + Short: "Return Host-Level Query Latency", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.databaseName, "databaseName", "", `Human-readable label that identifies the database.`) + cmd.Flags().StringVar(&opts.collectionName, "collectionName", "", `Human-readable label that identifies the collection.`) + cmd.Flags().StringSliceVar(&opts.metrics, "metrics", nil, `List that contains the metrics that you want to retrieve for the associated data series. If you don't set this parameter, this resource returns data series for all Coll Stats Latency metrics.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + + _ = cmd.MarkFlagRequired("processId") + _ = cmd.MarkFlagRequired("databaseName") + _ = cmd.MarkFlagRequired("collectionName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +type getCollStatsLatencyNamespaceMetricsOpts struct { + client *admin.APIClient + groupId string + format string + tmpl *template.Template + resp map[string]interface{} +} + +func (opts *getCollStatsLatencyNamespaceMetricsOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *getCollStatsLatencyNamespaceMetricsOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.GetCollStatsLatencyNamespaceMetricsApiParams{ + GroupId: opts.groupId, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.GetCollStatsLatencyNamespaceMetricsWithParams(ctx, params).Execute() + return err +} + +func (opts *getCollStatsLatencyNamespaceMetricsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func getCollStatsLatencyNamespaceMetricsBuilder() *cobra.Command { + opts := getCollStatsLatencyNamespaceMetricsOpts{} + cmd := &cobra.Command{ + Use: "getCollStatsLatencyNamespaceMetrics", + Short: "Return all metric names", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +type getCollStatsLatencyNamespacesForClusterOpts struct { + client *admin.APIClient + groupId string + clusterName string + clusterView string + start string + end string + period string + format string + tmpl *template.Template + resp *admin.CollStatsRankedNamespaces +} + +func (opts *getCollStatsLatencyNamespacesForClusterOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *getCollStatsLatencyNamespacesForClusterOpts) run(ctx context.Context, _ io.Reader) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + + params := &admin.GetCollStatsLatencyNamespacesForClusterApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + ClusterView: opts.clusterView, + Start: start, + End: end, + Period: &opts.period, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.GetCollStatsLatencyNamespacesForClusterWithParams(ctx, params).Execute() + return err +} + +func (opts *getCollStatsLatencyNamespacesForClusterOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func getCollStatsLatencyNamespacesForClusterBuilder() *cobra.Command { + opts := getCollStatsLatencyNamespacesForClusterOpts{} + cmd := &cobra.Command{ + Use: "getCollStatsLatencyNamespacesForCluster", + Short: "Return Ranked Namespaces from a Cluster", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to pin namespaces to.`) + cmd.Flags().StringVar(&opts.clusterView, "clusterView", "", `Human-readable label that identifies the cluster topology to retrieve metrics for.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + + _ = cmd.MarkFlagRequired("clusterName") + _ = cmd.MarkFlagRequired("clusterView") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +type getCollStatsLatencyNamespacesForHostOpts struct { + client *admin.APIClient + groupId string + processId string + start string + end string + period string + format string + tmpl *template.Template + resp *admin.CollStatsRankedNamespaces +} + +func (opts *getCollStatsLatencyNamespacesForHostOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *getCollStatsLatencyNamespacesForHostOpts) run(ctx context.Context, _ io.Reader) error { + + var start *time.Time + var errStart error + if opts.start != "" { + *start, errStart = time.Parse(time.RFC3339, opts.start) + if errStart != nil { + return errStart + } + } + + var end *time.Time + var errEnd error + if opts.end != "" { + *end, errEnd = time.Parse(time.RFC3339, opts.end) + if errEnd != nil { + return errEnd + } + } + + params := &admin.GetCollStatsLatencyNamespacesForHostApiParams{ + GroupId: opts.groupId, + ProcessId: opts.processId, + Start: start, + End: end, + Period: &opts.period, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.GetCollStatsLatencyNamespacesForHostWithParams(ctx, params).Execute() + return err +} + +func (opts *getCollStatsLatencyNamespacesForHostOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func getCollStatsLatencyNamespacesForHostBuilder() *cobra.Command { + opts := getCollStatsLatencyNamespacesForHostOpts{} + cmd := &cobra.Command{ + Use: "getCollStatsLatencyNamespacesForHost", + Short: "Return Ranked Namespaces from a Host", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.processId, "processId", "", `Combination of hostname and IANA port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (mongod or mongos). The port must be the IANA port on which the MongoDB process listens for requests.`) + cmd.Flags().StringVar(&opts.start, "start", "", `Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.end, "end", "", `Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set **period**.`) + cmd.Flags().StringVar(&opts.period, "period", "", `Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set **start** and **end**.`) + + _ = cmd.MarkFlagRequired("processId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +type getPinnedNamespacesOpts struct { + client *admin.APIClient + groupId string + clusterName string + format string + tmpl *template.Template + resp *admin.PinnedNamespaces +} + +func (opts *getPinnedNamespacesOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *getPinnedNamespacesOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.GetPinnedNamespacesApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.GetPinnedNamespacesWithParams(ctx, params).Execute() + return err +} + +func (opts *getPinnedNamespacesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func getPinnedNamespacesBuilder() *cobra.Command { + opts := getPinnedNamespacesOpts{} + cmd := &cobra.Command{ + Use: "getPinnedNamespaces", + Short: "Return Pinned Namespaces", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to retrieve pinned namespaces for.`) + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +type pinNamespacesPatchOpts struct { + client *admin.APIClient + groupId string + clusterName string + + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.PinnedNamespaces +} + +func (opts *pinNamespacesPatchOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *pinNamespacesPatchOpts) readData(r io.Reader) (*admin.NamespacesRequest, error) { + var out *admin.NamespacesRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(r) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *pinNamespacesPatchOpts) run(ctx context.Context, r io.Reader) error { + data, errData := opts.readData(r) + if errData != nil { + return errData + } + + params := &admin.PinNamespacesPatchApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + + NamespacesRequest: data, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.PinNamespacesPatchWithParams(ctx, params).Execute() + return err +} + +func (opts *pinNamespacesPatchOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func pinNamespacesPatchBuilder() *cobra.Command { + opts := pinNamespacesPatchOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "pinNamespacesPatch", + Short: "Add Pinned Namespaces", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to pin namespaces to.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +type pinNamespacesPutOpts struct { + client *admin.APIClient + groupId string + clusterName string + + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.PinnedNamespaces +} + +func (opts *pinNamespacesPutOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *pinNamespacesPutOpts) readData(r io.Reader) (*admin.NamespacesRequest, error) { + var out *admin.NamespacesRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(r) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *pinNamespacesPutOpts) run(ctx context.Context, r io.Reader) error { + data, errData := opts.readData(r) + if errData != nil { + return errData + } + + params := &admin.PinNamespacesPutApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + + NamespacesRequest: data, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.PinNamespacesPutWithParams(ctx, params).Execute() + return err +} + +func (opts *pinNamespacesPutOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func pinNamespacesPutBuilder() *cobra.Command { + opts := pinNamespacesPutOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "pinNamespacesPut", + Short: "Pin Namespaces", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to pin namespaces to.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +type unpinNamespacesOpts struct { + client *admin.APIClient + groupId string + clusterName string + + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.PinnedNamespaces +} + +func (opts *unpinNamespacesOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *unpinNamespacesOpts) readData(r io.Reader) (*admin.NamespacesRequest, error) { + var out *admin.NamespacesRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(r) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *unpinNamespacesOpts) run(ctx context.Context, r io.Reader) error { + data, errData := opts.readData(r) + if errData != nil { + return errData + } + + params := &admin.UnpinNamespacesApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + + NamespacesRequest: data, + } + + var err error + opts.resp, _, err = opts.client.CollectionLevelMetricsApi.UnpinNamespacesWithParams(ctx, params).Execute() + return err +} + +func (opts *unpinNamespacesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func unpinNamespacesBuilder() *cobra.Command { + opts := unpinNamespacesOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "unpinNamespaces", + Short: "Unpin namespaces", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster to unpin namespaces from.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + +func collectionLevelMetricsBuilder() *cobra.Command { + cmd := &cobra.Command{ + Use: "collectionLevelMetrics", + Short: `Returns, adds, and edits pinned namespaces for the specified cluster or process. Also returns collection level latency metric data.`, + } + cmd.AddCommand( + getCollStatsLatencyNamespaceClusterMeasurementsBuilder(), + getCollStatsLatencyNamespaceHostMeasurementsBuilder(), + getCollStatsLatencyNamespaceMetricsBuilder(), + getCollStatsLatencyNamespacesForClusterBuilder(), + getCollStatsLatencyNamespacesForHostBuilder(), + getPinnedNamespacesBuilder(), + pinNamespacesPatchBuilder(), + pinNamespacesPutBuilder(), + unpinNamespacesBuilder(), + ) + return cmd +} diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 5755342eb5..9ee3595965 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createCustomDatabaseRoleOpts struct { diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index 69b86bcd95..97ed9bfc11 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,14 +23,13 @@ import ( "errors" "fmt" "io" - "os" "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createDataFederationPrivateEndpointOpts struct { @@ -700,7 +699,7 @@ type downloadFederatedDatabaseQueryLogsOpts struct { startDate int64 format string tmpl *template.Template - resp *os.File + resp io.ReadCloser } func (opts *downloadFederatedDatabaseQueryLogsOpts) preRun() (err error) { diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 719943970f..59f2f32138 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,10 +27,10 @@ import ( "text/template" "time" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createPipelineOpts struct { diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index 634f7ef6ec..bb2aac366f 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createDatabaseUserOpts struct { diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index 9db6ba234d..8316a7bc74 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type getEncryptionAtRestOpts struct { diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index c06e490fb4..e2f9548c52 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,9 +27,9 @@ import ( "text/template" "time" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type getOrganizationEventOpts struct { diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index 112b10673c..a87363dc69 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,12 +26,122 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) +type createIdentityProviderOpts struct { + client *admin.APIClient + federationSettingsId string + + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.FederationOidcIdentityProvider +} + +func (opts *createIdentityProviderOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *createIdentityProviderOpts) readData(r io.Reader) (*admin.FederationOidcIdentityProviderUpdate, error) { + var out *admin.FederationOidcIdentityProviderUpdate + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(r) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createIdentityProviderOpts) run(ctx context.Context, r io.Reader) error { + data, errData := opts.readData(r) + if errData != nil { + return errData + } + + params := &admin.CreateIdentityProviderApiParams{ + FederationSettingsId: opts.federationSettingsId, + + FederationOidcIdentityProviderUpdate: data, + } + + var err error + opts.resp, _, err = opts.client.FederatedAuthenticationApi.CreateIdentityProviderWithParams(ctx, params).Execute() + return err +} + +func (opts *createIdentityProviderOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func createIdentityProviderBuilder() *cobra.Command { + opts := createIdentityProviderOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "createIdentityProvider", + Short: "Create one identity provider", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + _ = cmd.MarkFlagRequired("federationSettingsId") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type createRoleMappingOpts struct { client *admin.APIClient federationSettingsId string @@ -206,6 +316,60 @@ func deleteFederationAppBuilder() *cobra.Command { return cmd } +type deleteIdentityProviderOpts struct { + client *admin.APIClient + federationSettingsId string + identityProviderId string +} + +func (opts *deleteIdentityProviderOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + return nil +} + +func (opts *deleteIdentityProviderOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.DeleteIdentityProviderApiParams{ + FederationSettingsId: opts.federationSettingsId, + IdentityProviderId: opts.identityProviderId, + } + + var err error + _, err = opts.client.FederatedAuthenticationApi.DeleteIdentityProviderWithParams(ctx, params).Execute() + return err +} + +func (opts *deleteIdentityProviderOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + +func deleteIdentityProviderBuilder() *cobra.Command { + opts := deleteIdentityProviderOpts{} + cmd := &cobra.Command{ + Use: "deleteIdentityProvider", + Short: "Delete the identity provider.", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 24-hexadecimal digit string that identifies the identity provider to connect.`) + + _ = cmd.MarkFlagRequired("federationSettingsId") + _ = cmd.MarkFlagRequired("identityProviderId") + return cmd +} + type deleteRoleMappingOpts struct { client *admin.APIClient federationSettingsId string @@ -497,7 +661,7 @@ func getIdentityProviderBuilder() *cobra.Command { opts := getIdentityProviderOpts{} cmd := &cobra.Command{ Use: "getIdentityProvider", - Short: "Return one identity provider from the specified federation.", + Short: "Return one identity provider from the specified federation by id.", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -509,7 +673,7 @@ func getIdentityProviderBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the legacy 20-hexadecimal digit id. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. For all other versions, use the 24-hexadecimal digit id.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") @@ -588,7 +752,7 @@ func getIdentityProviderMetadataBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Legacy 20-hexadecimal digit string that identifies the identity provider. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider.`) _ = cmd.MarkFlagRequired("federationSettingsId") _ = cmd.MarkFlagRequired("identityProviderId") @@ -767,9 +931,13 @@ func listConnectedOrgConfigsBuilder() *cobra.Command { type listIdentityProvidersOpts struct { client *admin.APIClient federationSettingsId string + itemsPerPage int + pageNum int + protocol []string + idpType []string format string tmpl *template.Template - resp []admin.FederationIdentityProvider + resp *admin.PaginatedFederationIdentityProvider } func (opts *listIdentityProvidersOpts) preRun() (err error) { @@ -790,6 +958,10 @@ func (opts *listIdentityProvidersOpts) run(ctx context.Context, _ io.Reader) err params := &admin.ListIdentityProvidersApiParams{ FederationSettingsId: opts.federationSettingsId, + ItemsPerPage: &opts.itemsPerPage, + PageNum: &opts.pageNum, + Protocol: &opts.protocol, + IdpType: &opts.idpType, } var err error @@ -833,6 +1005,10 @@ func listIdentityProvidersBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().IntVar(&opts.itemsPerPage, "itemsPerPage", 100, `Number of items that the response returns per page.`) + cmd.Flags().IntVar(&opts.pageNum, "pageNum", 1, `Number of the page that displays the current set of the total objects that the response returns.`) + cmd.Flags().StringSliceVar(&opts.protocol, "protocol", nil, `The protocols of the target identity providers.`) + cmd.Flags().StringSliceVar(&opts.idpType, "idpType", nil, `The types of the target identity providers.`) _ = cmd.MarkFlagRequired("federationSettingsId") cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") @@ -845,7 +1021,7 @@ type listRoleMappingsOpts struct { orgId string format string tmpl *template.Template - resp []admin.AuthFederationRoleMapping + resp *admin.PaginatedRoleMapping } func (opts *listRoleMappingsOpts) preRun() (err error) { @@ -1007,6 +1183,60 @@ func removeConnectedOrgConfigBuilder() *cobra.Command { return cmd } +type revokeJwksFromIdentityProviderOpts struct { + client *admin.APIClient + federationSettingsId string + identityProviderId string +} + +func (opts *revokeJwksFromIdentityProviderOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + return nil +} + +func (opts *revokeJwksFromIdentityProviderOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.RevokeJwksFromIdentityProviderApiParams{ + FederationSettingsId: opts.federationSettingsId, + IdentityProviderId: opts.identityProviderId, + } + + var err error + _, err = opts.client.FederatedAuthenticationApi.RevokeJwksFromIdentityProviderWithParams(ctx, params).Execute() + return err +} + +func (opts *revokeJwksFromIdentityProviderOpts) postRun(_ context.Context, _ io.Writer) error { + + return nil +} + +func revokeJwksFromIdentityProviderBuilder() *cobra.Command { + opts := revokeJwksFromIdentityProviderOpts{} + cmd := &cobra.Command{ + Use: "revokeJwksFromIdentityProvider", + Short: "Revoke the JWKS tokens from an OIDC identity provider.", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 24-hexadecimal digit string that identifies the identity provider to connect.`) + + _ = cmd.MarkFlagRequired("federationSettingsId") + _ = cmd.MarkFlagRequired("identityProviderId") + return cmd +} + type updateConnectedOrgConfigOpts struct { client *admin.APIClient federationSettingsId string @@ -1147,8 +1377,8 @@ func (opts *updateIdentityProviderOpts) preRun() (err error) { return nil } -func (opts *updateIdentityProviderOpts) readData(r io.Reader) (*admin.SamlIdentityProviderUpdate, error) { - var out *admin.SamlIdentityProviderUpdate +func (opts *updateIdentityProviderOpts) readData(r io.Reader) (*admin.FederationIdentityProviderUpdate, error) { + var out *admin.FederationIdentityProviderUpdate var buf []byte var err error @@ -1179,7 +1409,7 @@ func (opts *updateIdentityProviderOpts) run(ctx context.Context, r io.Reader) er FederationSettingsId: opts.federationSettingsId, IdentityProviderId: opts.identityProviderId, - SamlIdentityProviderUpdate: data, + FederationIdentityProviderUpdate: data, } var err error @@ -1225,7 +1455,7 @@ func updateIdentityProviderBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.federationSettingsId, "federationSettingsId", "", `Unique 24-hexadecimal digit string that identifies your federation.`) - cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique 20-hexadecimal digit string that identifies the identity provider.`) + cmd.Flags().StringVar(&opts.identityProviderId, "identityProviderId", "", `Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the legacy 20-hexadecimal digit id. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. For all other versions, use the 24-hexadecimal digit id.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -1369,8 +1599,10 @@ func federatedAuthenticationBuilder() *cobra.Command { Short: `Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.`, } cmd.AddCommand( + createIdentityProviderBuilder(), createRoleMappingBuilder(), deleteFederationAppBuilder(), + deleteIdentityProviderBuilder(), deleteRoleMappingBuilder(), getConnectedOrgConfigBuilder(), getFederationSettingsBuilder(), @@ -1381,6 +1613,7 @@ func federatedAuthenticationBuilder() *cobra.Command { listIdentityProvidersBuilder(), listRoleMappingsBuilder(), removeConnectedOrgConfigBuilder(), + revokeJwksFromIdentityProviderBuilder(), updateConnectedOrgConfigBuilder(), updateIdentityProviderBuilder(), updateRoleMappingBuilder(), diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index f27bd87ab8..01ad5a3ca9 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createCustomZoneMappingOpts struct { @@ -69,8 +69,8 @@ func (opts *createCustomZoneMappingOpts) preRun() (err error) { return nil } -func (opts *createCustomZoneMappingOpts) readData(r io.Reader) (*admin.GeoSharding, error) { - var out *admin.GeoSharding +func (opts *createCustomZoneMappingOpts) readData(r io.Reader) (*admin.CustomZoneMappings, error) { + var out *admin.CustomZoneMappings var buf []byte var err error @@ -101,7 +101,7 @@ func (opts *createCustomZoneMappingOpts) run(ctx context.Context, r io.Reader) e GroupId: opts.groupId, ClusterName: opts.clusterName, - GeoSharding: data, + CustomZoneMappings: data, } var err error @@ -147,7 +147,7 @@ func createCustomZoneMappingBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -259,7 +259,7 @@ func createManagedNamespaceBuilder() *cobra.Command { } cmd := &cobra.Command{ Use: "createManagedNamespace", - Short: "Create One Managed Namespace in One Global Multi-Cloud Cluster", + Short: "Create One Managed Namespace in One Global Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -271,7 +271,7 @@ func createManagedNamespaceBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this cluster.`) cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") @@ -350,7 +350,7 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { opts := deleteAllCustomZoneMappingsOpts{} cmd := &cobra.Command{ Use: "deleteAllCustomZoneMappings", - Short: "Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster", + Short: "Remove All Custom Zone Mappings from One Global Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -362,7 +362,7 @@ func deleteAllCustomZoneMappingsBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this cluster.`) _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") @@ -443,7 +443,7 @@ func deleteManagedNamespaceBuilder() *cobra.Command { opts := deleteManagedNamespaceOpts{} cmd := &cobra.Command{ Use: "deleteManagedNamespace", - Short: "Remove One Managed Namespace from One Global Multi-Cloud Cluster", + Short: "Remove One Managed Namespace from One Global Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -454,7 +454,7 @@ func deleteManagedNamespaceBuilder() *cobra.Command { return opts.postRun(cmd.Context(), cmd.OutOrStdout()) }, } - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this cluster.`) cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) cmd.Flags().StringVar(&opts.db, "db", "", `Human-readable label that identifies the database that contains the collection.`) cmd.Flags().StringVar(&opts.collection, "collection", "", `Human-readable label that identifies the collection associated with the managed namespace.`) @@ -534,7 +534,7 @@ func getManagedNamespaceBuilder() *cobra.Command { opts := getManagedNamespaceOpts{} cmd := &cobra.Command{ Use: "getManagedNamespace", - Short: "Return One Managed Namespace in One Global Multi-Cloud Cluster", + Short: "Return One Managed Namespace in One Global Cluster", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -546,7 +546,7 @@ func getManagedNamespaceBuilder() *cobra.Command { }, } cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this advanced cluster.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies this cluster.`) _ = cmd.MarkFlagRequired("clusterName") cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index 5ef95af6e6..f1f0def2fc 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createCostExplorerQueryProcessOpts struct { diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 8d4ef38c6d..806d65b5ea 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type deleteLDAPConfigurationOpts struct { diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 3bf274d59b..b6c7c3f81b 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,12 +26,136 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) +type createLegacyBackupRestoreJobOpts struct { + client *admin.APIClient + groupId string + clusterName string + + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.PaginatedRestoreJob +} + +func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *createLegacyBackupRestoreJobOpts) readData(r io.Reader) (*admin.BackupRestoreJob, error) { + var out *admin.BackupRestoreJob + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(r) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, r io.Reader) error { + data, errData := opts.readData(r) + if errData != nil { + return errData + } + + params := &admin.CreateLegacyBackupRestoreJobApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + + BackupRestoreJob: data, + } + + var err error + opts.resp, _, err = opts.client.LegacyBackupApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() + return err +} + +func (opts *createLegacyBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func createLegacyBackupRestoreJobBuilder() *cobra.Command { + opts := createLegacyBackupRestoreJobOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "createLegacyBackupRestoreJob", + Short: "Create One Legacy Backup Restore Job", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type deleteLegacySnapshotOpts struct { client *admin.APIClient groupId string @@ -1051,6 +1175,7 @@ func legacyBackupBuilder() *cobra.Command { Short: `Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.`, } cmd.AddCommand( + createLegacyBackupRestoreJobBuilder(), deleteLegacySnapshotBuilder(), getLegacyBackupCheckpointBuilder(), getLegacyBackupRestoreJobBuilder(), diff --git a/internal/api/api_legacy_backup_restore_jobs_cmd.go b/internal/api/api_legacy_backup_restore_jobs_cmd.go deleted file mode 100644 index fbb71ad962..0000000000 --- a/internal/api/api_legacy_backup_restore_jobs_cmd.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2023 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. - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package api - -import ( - "context" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - "io" - "strings" - "text/template" - - "github.com/mongodb/mongodb-atlas-cli/internal/config" - "github.com/spf13/afero" - "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" -) - -type createLegacyBackupRestoreJobOpts struct { - client *admin.APIClient - groupId string - clusterName string - - filename string - fs afero.Fs - format string - tmpl *template.Template - resp *admin.PaginatedRestoreJob -} - -func (opts *createLegacyBackupRestoreJobOpts) preRun() (err error) { - if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { - return err - } - - if opts.groupId == "" { - opts.groupId = config.ProjectID() - } - if opts.groupId == "" { - return errors.New(`required flag(s) "projectId" not set`) - } - b, errDecode := hex.DecodeString(opts.groupId) - if errDecode != nil || len(b) != 12 { - return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) - } - - if opts.format != "" { - if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { - return err - } - } - - return nil -} - -func (opts *createLegacyBackupRestoreJobOpts) readData(r io.Reader) (*admin.BackupRestoreJob, error) { - var out *admin.BackupRestoreJob - - var buf []byte - var err error - if opts.filename == "" { - buf, err = io.ReadAll(r) - } else { - if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { - return nil, fmt.Errorf("file not found: %s", opts.filename) - } - buf, err = afero.ReadFile(opts.fs, opts.filename) - } - if err != nil { - return nil, err - } - if err = json.Unmarshal(buf, &out); err != nil { - return nil, err - } - return out, nil -} - -func (opts *createLegacyBackupRestoreJobOpts) run(ctx context.Context, r io.Reader) error { - data, errData := opts.readData(r) - if errData != nil { - return errData - } - - params := &admin.CreateLegacyBackupRestoreJobApiParams{ - GroupId: opts.groupId, - ClusterName: opts.clusterName, - - BackupRestoreJob: data, - } - - var err error - opts.resp, _, err = opts.client.LegacyBackupRestoreJobsApi.CreateLegacyBackupRestoreJobWithParams(ctx, params).Execute() - return err -} - -func (opts *createLegacyBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) error { - - prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") - if errJson != nil { - return errJson - } - - if opts.format == "" { - _, err := fmt.Fprintln(w, string(prettyJSON)) - return err - } - - var parsedJSON interface{} - if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { - return err - } - - return opts.tmpl.Execute(w, parsedJSON) -} - -func createLegacyBackupRestoreJobBuilder() *cobra.Command { - opts := createLegacyBackupRestoreJobOpts{ - fs: afero.NewOsFs(), - } - cmd := &cobra.Command{ - Use: "createLegacyBackupRestoreJob", - Short: "Create One Legacy Backup Restore Job", - PreRunE: func(cmd *cobra.Command, args []string) error { - return opts.preRun() - }, - RunE: func(cmd *cobra.Command, args []string) error { - return opts.run(cmd.Context(), cmd.InOrStdin()) - }, - PostRunE: func(cmd *cobra.Command, args []string) error { - return opts.postRun(cmd.Context(), cmd.OutOrStdout()) - }, - } - cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) - cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster with the snapshot you want to return.`) - - cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") - - _ = cmd.MarkFlagRequired("clusterName") - cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") - return cmd -} - -func legacyBackupRestoreJobsBuilder() *cobra.Command { - cmd := &cobra.Command{ - Use: "legacyBackupRestoreJobs", - Short: ``, - } - cmd.AddCommand( - createLegacyBackupRestoreJobBuilder(), - ) - return cmd -} diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index 3619e4518f..d3dabafed9 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type deferMaintenanceWindowOpts struct { diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index ebac6a93ca..ca5f244fd8 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,10 +24,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createUserOpts struct { diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index acb569a09e..d5fbf91472 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,14 +23,13 @@ import ( "errors" "fmt" "io" - "os" "strings" "text/template" "time" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type getAtlasProcessOpts struct { @@ -478,7 +477,7 @@ type getHostLogsOpts struct { startDate int64 format string tmpl *template.Template - resp *os.File + resp io.ReadCloser } func (opts *getHostLogsOpts) preRun() (err error) { diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index 09dc0ead61..1e040be709 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createPeeringConnectionOpts struct { diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index fb2dfb45b3..b2b9acd755 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,14 +23,13 @@ import ( "errors" "fmt" "io" - "os" "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createOnlineArchiveOpts struct { @@ -259,7 +258,7 @@ type downloadOnlineArchiveQueryLogsOpts struct { archiveOnly bool format string tmpl *template.Template - resp *os.File + resp io.ReadCloser } func (opts *downloadOnlineArchiveQueryLogsOpts) preRun() (err error) { diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 654b4547a3..89ce93709f 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createOrganizationOpts struct { diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index 0233cfdf56..51a75425a5 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type disableSlowOperationThresholdingOpts struct { @@ -151,6 +151,95 @@ func enableSlowOperationThresholdingBuilder() *cobra.Command { return cmd } +type getServerlessAutoIndexingOpts struct { + client *admin.APIClient + groupId string + clusterName string + format string + tmpl *template.Template + resp bool +} + +func (opts *getServerlessAutoIndexingOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *getServerlessAutoIndexingOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.GetServerlessAutoIndexingApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + } + + var err error + opts.resp, _, err = opts.client.PerformanceAdvisorApi.GetServerlessAutoIndexingWithParams(ctx, params).Execute() + return err +} + +func (opts *getServerlessAutoIndexingOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func getServerlessAutoIndexingBuilder() *cobra.Command { + opts := getServerlessAutoIndexingOpts{} + cmd := &cobra.Command{ + Use: "getServerlessAutoIndexing", + Short: "Return Serverless Auto Indexing Enabled", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + + _ = cmd.MarkFlagRequired("clusterName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type listSlowQueriesOpts struct { client *admin.APIClient groupId string @@ -248,7 +337,7 @@ func listSlowQueriesBuilder() *cobra.Command { - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.`) cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, `Namespaces from which to retrieve slow queries. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.`) cmd.Flags().Int64Var(&opts.nLogs, "nLogs", 20000, `Maximum number of lines from the log to return.`) - cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the slow queries. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the slow queries. This parameter expresses its value in the number of milliseconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) @@ -349,7 +438,7 @@ func listSlowQueryNamespacesBuilder() *cobra.Command { - If you don't specify the **since** parameter, the endpoint returns data covering the duration before the current time. - If you specify neither the **duration** nor **since** parameters, the endpoint returns data from the previous 24 hours.`) - cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of milliseconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) @@ -468,7 +557,7 @@ func listSuggestedIndexesBuilder() *cobra.Command { cmd.Flags().StringSliceVar(&opts.namespaces, "namespaces", nil, `Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as `.`: `<database>.<collection>`. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (`&`) between each namespace. Omit this parameter to return results for all namespaces.`) cmd.Flags().Int64Var(&opts.nExamples, "nExamples", 5, `Maximum number of example queries that benefit from the suggested index.`) cmd.Flags().Int64Var(&opts.nIndexes, "nIndexes", 0, `Number that indicates the maximum indexes to suggest.`) - cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of seconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). + cmd.Flags().Int64Var(&opts.since, "since", 0, `Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of milliseconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don't specify the **duration** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **duration** nor the **since** parameters, the endpoint returns data from the previous 24 hours.`) @@ -478,6 +567,99 @@ func listSuggestedIndexesBuilder() *cobra.Command { return cmd } +type setServerlessAutoIndexingOpts struct { + client *admin.APIClient + groupId string + clusterName string + enable bool + format string + tmpl *template.Template + resp map[string]interface{} +} + +func (opts *setServerlessAutoIndexingOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *setServerlessAutoIndexingOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.SetServerlessAutoIndexingApiParams{ + GroupId: opts.groupId, + ClusterName: opts.clusterName, + Enable: &opts.enable, + } + + var err error + opts.resp, _, err = opts.client.PerformanceAdvisorApi.SetServerlessAutoIndexingWithParams(ctx, params).Execute() + return err +} + +func (opts *setServerlessAutoIndexingOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func setServerlessAutoIndexingBuilder() *cobra.Command { + opts := setServerlessAutoIndexingOpts{} + cmd := &cobra.Command{ + Use: "setServerlessAutoIndexing", + Short: "Set Serverless Auto Indexing", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.clusterName, "clusterName", "", `Human-readable label that identifies the cluster.`) + cmd.Flags().BoolVar(&opts.enable, "enable", false, `Value that we want to set for the Serverless Auto Indexing toggle.`) + + _ = cmd.MarkFlagRequired("clusterName") + _ = cmd.MarkFlagRequired("enable") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + func performanceAdvisorBuilder() *cobra.Command { cmd := &cobra.Command{ Use: "performanceAdvisor", @@ -486,9 +668,11 @@ func performanceAdvisorBuilder() *cobra.Command { cmd.AddCommand( disableSlowOperationThresholdingBuilder(), enableSlowOperationThresholdingBuilder(), + getServerlessAutoIndexingBuilder(), listSlowQueriesBuilder(), listSlowQueryNamespacesBuilder(), listSuggestedIndexesBuilder(), + setServerlessAutoIndexingBuilder(), ) return cmd } diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index bddcb2925d..605c7f12f8 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createPrivateEndpointOpts struct { diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index 44a7bdf041..7bf4d03dd6 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type addProjectApiKeyOpts struct { @@ -288,7 +288,7 @@ type createApiKeyAccessListOpts struct { fs afero.Fs format string tmpl *template.Template - resp *admin.PaginatedApiUserAccessList + resp *admin.PaginatedApiUserAccessListResponse } func (opts *createApiKeyAccessListOpts) preRun() (err error) { @@ -316,8 +316,8 @@ func (opts *createApiKeyAccessListOpts) preRun() (err error) { return nil } -func (opts *createApiKeyAccessListOpts) readData(r io.Reader) (*[]admin.UserAccessList, error) { - var out *[]admin.UserAccessList +func (opts *createApiKeyAccessListOpts) readData(r io.Reader) (*[]admin.UserAccessListRequest, error) { + var out *[]admin.UserAccessListRequest var buf []byte var err error @@ -352,7 +352,7 @@ func (opts *createApiKeyAccessListOpts) run(ctx context.Context, r io.Reader) er ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, - UserAccessList: data, + UserAccessListRequest: data, } var err error @@ -808,7 +808,7 @@ type getApiKeyAccessListOpts struct { apiUserId string format string tmpl *template.Template - resp *admin.UserAccessList + resp *admin.UserAccessListResponse } func (opts *getApiKeyAccessListOpts) preRun() (err error) { @@ -903,7 +903,7 @@ type listApiKeyAccessListsEntriesOpts struct { pageNum int format string tmpl *template.Template - resp *admin.PaginatedApiUserAccessList + resp *admin.PaginatedApiUserAccessListResponse } func (opts *listApiKeyAccessListsEntriesOpts) preRun() (err error) { diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index 98b874b7e2..c243574061 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createProjectIpAccessListOpts struct { diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 8dc7a91367..6a4ff56a13 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,12 +26,132 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) +type addUserToProjectOpts struct { + client *admin.APIClient + groupId string + + filename string + fs afero.Fs + format string + tmpl *template.Template + resp *admin.OrganizationInvitation +} + +func (opts *addUserToProjectOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *addUserToProjectOpts) readData(r io.Reader) (*admin.GroupInvitationRequest, error) { + var out *admin.GroupInvitationRequest + + var buf []byte + var err error + if opts.filename == "" { + buf, err = io.ReadAll(r) + } else { + if exists, errExists := afero.Exists(opts.fs, opts.filename); !exists || errExists != nil { + return nil, fmt.Errorf("file not found: %s", opts.filename) + } + buf, err = afero.ReadFile(opts.fs, opts.filename) + } + if err != nil { + return nil, err + } + if err = json.Unmarshal(buf, &out); err != nil { + return nil, err + } + return out, nil +} + +func (opts *addUserToProjectOpts) run(ctx context.Context, r io.Reader) error { + data, errData := opts.readData(r) + if errData != nil { + return errData + } + + params := &admin.AddUserToProjectApiParams{ + GroupId: opts.groupId, + + GroupInvitationRequest: data, + } + + var err error + opts.resp, _, err = opts.client.ProjectsApi.AddUserToProjectWithParams(ctx, params).Execute() + return err +} + +func (opts *addUserToProjectOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func addUserToProjectBuilder() *cobra.Command { + opts := addUserToProjectOpts{ + fs: afero.NewOsFs(), + } + cmd := &cobra.Command{ + Use: "addUserToProject", + Short: "Add One MongoDB Cloud User to One Project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + + cmd.Flags().StringVarP(&opts.filename, "file", "f", "", "Path to an optional JSON configuration file if not passed stdin is expected") + + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type createProjectOpts struct { client *admin.APIClient @@ -1397,6 +1517,91 @@ func removeProjectUserBuilder() *cobra.Command { return cmd } +type returnAllIPAddressesOpts struct { + client *admin.APIClient + groupId string + format string + tmpl *template.Template + resp *admin.GroupIPAddresses +} + +func (opts *returnAllIPAddressesOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *returnAllIPAddressesOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.ReturnAllIPAddressesApiParams{ + GroupId: opts.groupId, + } + + var err error + opts.resp, _, err = opts.client.ProjectsApi.ReturnAllIPAddressesWithParams(ctx, params).Execute() + return err +} + +func (opts *returnAllIPAddressesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func returnAllIPAddressesBuilder() *cobra.Command { + opts := returnAllIPAddressesOpts{} + cmd := &cobra.Command{ + Use: "returnAllIPAddresses", + Short: "Return All IP Addresses for One Project", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type setProjectLimitOpts struct { client *admin.APIClient limitName string @@ -1573,8 +1778,8 @@ func (opts *updateProjectOpts) preRun() (err error) { return nil } -func (opts *updateProjectOpts) readData(r io.Reader) (*admin.GroupName, error) { - var out *admin.GroupName +func (opts *updateProjectOpts) readData(r io.Reader) (*admin.GroupUpdate, error) { + var out *admin.GroupUpdate var buf []byte var err error @@ -1604,7 +1809,7 @@ func (opts *updateProjectOpts) run(ctx context.Context, r io.Reader) error { params := &admin.UpdateProjectApiParams{ GroupId: opts.groupId, - GroupName: data, + GroupUpdate: data, } var err error @@ -1638,7 +1843,7 @@ func updateProjectBuilder() *cobra.Command { } cmd := &cobra.Command{ Use: "updateProject", - Short: "Update One Project Name", + Short: "Update One Project", PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2151,6 +2356,7 @@ func projectsBuilder() *cobra.Command { Short: `Returns, adds, and edits collections of clusters and users in MongoDB Cloud.`, } cmd.AddCommand( + addUserToProjectBuilder(), createProjectBuilder(), createProjectInvitationBuilder(), deleteProjectBuilder(), @@ -2166,6 +2372,7 @@ func projectsBuilder() *cobra.Command { listProjectUsersBuilder(), listProjectsBuilder(), removeProjectUserBuilder(), + returnAllIPAddressesBuilder(), setProjectLimitBuilder(), updateProjectBuilder(), updateProjectInvitationBuilder(), diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index 06634c2d57..2f1ecb3e99 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createPushBasedLogConfigurationOpts struct { @@ -59,8 +59,8 @@ func (opts *createPushBasedLogConfigurationOpts) preRun() (err error) { return nil } -func (opts *createPushBasedLogConfigurationOpts) readData(r io.Reader) (*admin.PushBasedLogExportProject, error) { - var out *admin.PushBasedLogExportProject +func (opts *createPushBasedLogConfigurationOpts) readData(r io.Reader) (*admin.CreatePushBasedLogExportProjectRequest, error) { + var out *admin.CreatePushBasedLogExportProjectRequest var buf []byte var err error @@ -90,7 +90,7 @@ func (opts *createPushBasedLogConfigurationOpts) run(ctx context.Context, r io.R params := &admin.CreatePushBasedLogConfigurationApiParams{ GroupId: opts.groupId, - PushBasedLogExportProject: data, + CreatePushBasedLogExportProjectRequest: data, } var err error @@ -370,7 +370,7 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { func pushBasedLogExportBuilder() *cobra.Command { cmd := &cobra.Command{ Use: "pushBasedLogExport", - Short: ``, + Short: `You can continually push logs from mongod, mongos, and audit logs to an AWS S3 bucket. Atlas exports logs every 5 minutes.`, } cmd.AddCommand( createPushBasedLogConfigurationBuilder(), diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index e1c6625c7a..744f9c5cb4 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,10 +24,10 @@ import ( "fmt" "io" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createRollingIndexOpts struct { diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index 215b7b6072..95c55992cc 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,9 +24,9 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type getSystemStatusOpts struct { @@ -99,6 +99,76 @@ func getSystemStatusBuilder() *cobra.Command { return cmd } +type returnAllControlPlaneIPAddressesOpts struct { + client *admin.APIClient + format string + tmpl *template.Template + resp *admin.ControlPlaneIPAddresses +} + +func (opts *returnAllControlPlaneIPAddressesOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *returnAllControlPlaneIPAddressesOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.ReturnAllControlPlaneIPAddressesApiParams{} + + var err error + opts.resp, _, err = opts.client.RootApi.ReturnAllControlPlaneIPAddressesWithParams(ctx, params).Execute() + return err +} + +func (opts *returnAllControlPlaneIPAddressesOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func returnAllControlPlaneIPAddressesBuilder() *cobra.Command { + opts := returnAllControlPlaneIPAddressesOpts{} + cmd := &cobra.Command{ + Use: "returnAllControlPlaneIPAddresses", + Short: "Return All Control Plane IP Addresses", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + func rootBuilder() *cobra.Command { cmd := &cobra.Command{ Use: "root", @@ -106,6 +176,7 @@ func rootBuilder() *cobra.Command { } cmd.AddCommand( getSystemStatusBuilder(), + returnAllControlPlaneIPAddressesBuilder(), ) return cmd } diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index b368045e9f..accb1ef436 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createServerlessInstanceOpts struct { diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index 889210bfce..08bff42e24 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createServerlessPrivateEndpointOpts struct { diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index d1c4edf810..cf50d945d1 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createSharedClusterBackupRestoreJobOpts struct { diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index 8ef3a96a85..69c0aa5e20 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type downloadSharedClusterBackupOpts struct { diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index 898649e853..c109ca56ae 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createStreamConnectionOpts struct { @@ -458,6 +458,101 @@ func deleteStreamInstanceBuilder() *cobra.Command { return cmd } +type downloadStreamTenantAuditLogsOpts struct { + client *admin.APIClient + groupId string + tenantName string + endDate int64 + startDate int64 + format string + tmpl *template.Template + resp io.ReadCloser +} + +func (opts *downloadStreamTenantAuditLogsOpts) preRun() (err error) { + if opts.client, err = newClientWithAuth(config.UserAgent, config.Default()); err != nil { + return err + } + + if opts.groupId == "" { + opts.groupId = config.ProjectID() + } + if opts.groupId == "" { + return errors.New(`required flag(s) "projectId" not set`) + } + b, errDecode := hex.DecodeString(opts.groupId) + if errDecode != nil || len(b) != 12 { + return fmt.Errorf("the provided value '%s' is not a valid ID", opts.groupId) + } + + if opts.format != "" { + if opts.tmpl, err = template.New("").Parse(strings.ReplaceAll(opts.format, "\\n", "\n") + "\n"); err != nil { + return err + } + } + + return nil +} + +func (opts *downloadStreamTenantAuditLogsOpts) run(ctx context.Context, _ io.Reader) error { + + params := &admin.DownloadStreamTenantAuditLogsApiParams{ + GroupId: opts.groupId, + TenantName: opts.tenantName, + EndDate: &opts.endDate, + StartDate: &opts.startDate, + } + + var err error + opts.resp, _, err = opts.client.StreamsApi.DownloadStreamTenantAuditLogsWithParams(ctx, params).Execute() + return err +} + +func (opts *downloadStreamTenantAuditLogsOpts) postRun(_ context.Context, w io.Writer) error { + + prettyJSON, errJson := json.MarshalIndent(opts.resp, "", " ") + if errJson != nil { + return errJson + } + + if opts.format == "" { + _, err := fmt.Fprintln(w, string(prettyJSON)) + return err + } + + var parsedJSON interface{} + if err := json.Unmarshal([]byte(prettyJSON), &parsedJSON); err != nil { + return err + } + + return opts.tmpl.Execute(w, parsedJSON) +} + +func downloadStreamTenantAuditLogsBuilder() *cobra.Command { + opts := downloadStreamTenantAuditLogsOpts{} + cmd := &cobra.Command{ + Use: "downloadStreamTenantAuditLogs", + Short: "Download Audit Logs for One Atlas Stream Processing Instance", + PreRunE: func(cmd *cobra.Command, args []string) error { + return opts.preRun() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return opts.run(cmd.Context(), cmd.InOrStdin()) + }, + PostRunE: func(cmd *cobra.Command, args []string) error { + return opts.postRun(cmd.Context(), cmd.OutOrStdout()) + }, + } + cmd.Flags().StringVar(&opts.groupId, "projectId", "", `Unique 24-hexadecimal digit string that identifies your project.`) + cmd.Flags().StringVar(&opts.tenantName, "tenantName", "", `Human-readable label that identifies the stream instance.`) + cmd.Flags().Int64Var(&opts.endDate, "endDate", 0, `Timestamp that specifies the end point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) + cmd.Flags().Int64Var(&opts.startDate, "startDate", 0, `Timestamp that specifies the starting point for the range of log messages to download. MongoDB Cloud expresses this timestamp in the number of seconds that have elapsed since the UNIX epoch.`) + + _ = cmd.MarkFlagRequired("tenantName") + cmd.Flags().StringVar(&opts.format, "format", "", "Format of the output") + return cmd +} + type getStreamConnectionOpts struct { client *admin.APIClient groupId string @@ -1091,6 +1186,7 @@ func streamsBuilder() *cobra.Command { createStreamInstanceBuilder(), deleteStreamConnectionBuilder(), deleteStreamInstanceBuilder(), + downloadStreamTenantAuditLogsBuilder(), getStreamConnectionBuilder(), getStreamInstanceBuilder(), listStreamConnectionsBuilder(), diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index 715716015f..ed442b6715 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type addAllTeamsToProjectOpts struct { @@ -1115,8 +1115,8 @@ func (opts *renameTeamOpts) preRun() (err error) { return nil } -func (opts *renameTeamOpts) readData(r io.Reader) (*admin.Team, error) { - var out *admin.Team +func (opts *renameTeamOpts) readData(r io.Reader) (*admin.TeamUpdate, error) { + var out *admin.TeamUpdate var buf []byte var err error @@ -1147,7 +1147,7 @@ func (opts *renameTeamOpts) run(ctx context.Context, r io.Reader) error { OrgId: opts.orgId, TeamId: opts.teamId, - Team: data, + TeamUpdate: data, } var err error diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 1bb25b973c..65ffb64313 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createThirdPartyIntegrationOpts struct { @@ -72,8 +72,8 @@ func (opts *createThirdPartyIntegrationOpts) preRun() (err error) { return nil } -func (opts *createThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.ThridPartyIntegration, error) { - var out *admin.ThridPartyIntegration +func (opts *createThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.ThirdPartyIntegration, error) { + var out *admin.ThirdPartyIntegration var buf []byte var err error @@ -108,7 +108,7 @@ func (opts *createThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reade ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, - ThridPartyIntegration: data, + ThirdPartyIntegration: data, } var err error @@ -261,7 +261,7 @@ type getThirdPartyIntegrationOpts struct { integrationType string format string tmpl *template.Template - resp *admin.ThridPartyIntegration + resp *admin.ThirdPartyIntegration } func (opts *getThirdPartyIntegrationOpts) preRun() (err error) { @@ -478,8 +478,8 @@ func (opts *updateThirdPartyIntegrationOpts) preRun() (err error) { return nil } -func (opts *updateThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.ThridPartyIntegration, error) { - var out *admin.ThridPartyIntegration +func (opts *updateThirdPartyIntegrationOpts) readData(r io.Reader) (*admin.ThirdPartyIntegration, error) { + var out *admin.ThirdPartyIntegration var buf []byte var err error @@ -514,7 +514,7 @@ func (opts *updateThirdPartyIntegrationOpts) run(ctx context.Context, r io.Reade ItemsPerPage: &opts.itemsPerPage, PageNum: &opts.pageNum, - ThridPartyIntegration: data, + ThirdPartyIntegration: data, } var err error diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index f042875bdb..a4910670b1 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import ( "strings" "text/template" - "github.com/mongodb/mongodb-atlas-cli/internal/config" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "go.mongodb.org/atlas-sdk/v20231115012/admin" ) type createDatabaseUserCertificateOpts struct { diff --git a/internal/api/client.go b/internal/api/client.go index 740606760d..ed959ce322 100644 --- a/internal/api/client.go +++ b/internal/api/client.go @@ -1,4 +1,4 @@ -// Copyright 2023 MongoDB Inc +// Copyright 2024 MongoDB Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,14 +17,14 @@ package api import ( - "time" "net" "net/http" + "time" "github.com/mongodb-forks/digest" - "go.mongodb.org/atlas-sdk/v20230201008/admin" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/log" + "go.mongodb.org/atlas-sdk/v20231115012/admin" "go.mongodb.org/atlas/auth" - "github.com/mongodb/mongodb-atlas-cli/internal/log" ) const ( diff --git a/tools/openapi-generator/config/atlas-api-transformed.yaml b/tools/openapi-generator/config/atlas-api-transformed.yaml index 110ea275b9..5a6011208a 100644 --- a/tools/openapi-generator/config/atlas-api-transformed.yaml +++ b/tools/openapi-generator/config/atlas-api-transformed.yaml @@ -12,8 +12,8 @@ info: curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" \ --digest \ - --header "Accept: application/vnd.atlas.2023-02-01+json" \ - GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true" + --header "Accept: application/vnd.atlas.2023-11-15+json" \ + -X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true" ``` @@ -23,8 +23,8 @@ info: url: https://creativecommons.org/licenses/by-nc-sa/3.0/us/ termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions title: MongoDB Atlas Administration API - version: 2.0~6e54278ed8 - x-xgen-sha: 6e54278ed80f8e54655f8d970425d6ee8247ae30 + version: "2.0" + x-xgen-sha: f37d3212e72e54807be6b0c0d1b6c2f47c7b8c83 servers: - url: https://cloud.mongodb.com tags: @@ -46,6 +46,16 @@ tags: name: Atlas Search - description: Returns and edits database auditing settings for MongoDB Cloud projects. name: Auditing + - description: Returns and edits custom DNS configurations for MongoDB Cloud + database deployments on AWS. The resource requires your Project ID. If you + use the VPC peering on AWS and you use your own DNS servers instead of + Amazon Route 53, enable custom DNS. Before 31 March 2020, applications + deployed within AWS using custom DNS services and VPC-peered with MongoDB + Cloud couldn't connect over private IP addresses. Custom DNS resolved to + public IP addresses. AWS internal DNS resolved to private IP addresses. + Applications deployed with custom DNS services in AWS should use Private + IP for Peering connection strings. + name: AWS Clusters DNS - description: Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups. @@ -64,16 +74,9 @@ tags: cluster configurations can affect costs. This resource requires your Project ID. name: Clusters - - description: Returns and edits custom DNS configurations for MongoDB Cloud - database deployments on AWS. The resource requires your Project ID. If you - use the VPC peering on AWS and you use your own DNS servers instead of - Amazon Route 53, enable custom DNS. Before 31 March 2020, applications - deployed within AWS using custom DNS services and VPC-peered with MongoDB - Cloud couldn't connect over private IP addresses. Custom DNS resolved to - public IP addresses. AWS internal DNS resolved to private IP addresses. - Applications deployed with custom DNS services in AWS should use Private - IP for Peering connection strings. - name: AWS Clusters DNS + - description: Returns, adds, and edits pinned namespaces for the specified + cluster or process. Also returns collection level latency metric data. + name: Collection Level Metrics - description: Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the @@ -86,8 +89,6 @@ tags: MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4. name: Custom Database Roles - - description: Returns, adds, edits, and removes database users. - name: Database Users - description: Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs. @@ -95,6 +96,8 @@ tags: - description: Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs. name: Data Lake Pipelines + - description: Returns, adds, edits, and removes database users. + name: Database Users - description: Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management. @@ -174,6 +177,9 @@ tags: - description: Returns, adds, and edits collections of clusters and users in MongoDB Cloud. name: Projects + - description: You can continually push logs from mongod, mongos, and audit logs + to an AWS S3 bucket. Atlas exports logs every 5 minutes. + name: Push-Based Log Export - description: Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster. @@ -238,11 +244,11 @@ paths: x-xgen-version: 2023-01-01 description: OK "401": - $ref: "#/components/responses/unauthorized" - "404": - $ref: "#/components/responses/notFound" + description: Unauthorized. "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return the status of this MongoDB application tags: - Root @@ -359,6 +365,8 @@ paths: $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return All Connected Org Configs from the Federation tags: - Federated Authentication @@ -458,7 +466,10 @@ paths: **Note**: The domainRestrictionEnabled field defaults to false if not provided in the request. - **Note**: If the identityProviderId field is not provided, you will disconnect the organization and the identity provider. + **Note**: If the identityProviderId field is not provided, you will disconnect the organization and the identity provider. + + + **Note**: Currently connected data access identity providers missing from the dataAccessIdentityProviderIds field will be disconnected. operationId: updateConnectedOrgConfig parameters: - $ref: "#/components/parameters/federationSettingsId" @@ -516,9 +527,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - type: array - items: - $ref: "#/components/schemas/AuthFederationRoleMapping" + $ref: "#/components/schemas/PaginatedRoleMapping" x-xgen-version: 2023-01-01 description: OK "400": @@ -703,20 +712,39 @@ paths: x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders: get: - description: Returns all identity providers in the specified federation. To use - this resource, the requesting API Key must have the Organization Owner - role in one of the connected organizations. + description: Returns all identity providers with the provided protocol and type + in the specified federation. If no protocol is specified, only SAML + identity providers will be returned. If no idpType is specified, only + WORKFORCE identity providers will be returned. To use this resource, the + requesting API Key must have the Organization Owner role in one of the + connected organizations. operationId: listIdentityProviders parameters: - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: The protocols of the target identity providers. + in: query + name: protocol + schema: + type: array + items: + type: string + default: SAML + - description: The types of the target identity providers. + in: query + name: idpType + schema: + type: array + items: + type: string + default: WORKFORCE responses: "200": content: application/vnd.atlas.2023-01-01+json: schema: - type: array - items: - $ref: "#/components/schemas/FederationIdentityProvider" + $ref: "#/components/schemas/PaginatedFederationIdentityProvider" x-xgen-version: 2023-01-01 description: OK "400": @@ -733,59 +761,169 @@ paths: tags: - Federated Authentication x-xgen-experimental: true - /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}: - get: - description: Returns one identity provider from the specified federation. To use + post: + description: >- + Creates one identity provider within the specified federation. To use this resource, the requesting API Key must have the Organization Owner role in one of the connected organizations. + + + **Note**: This resource only supports the creation of OIDC identity providers. + operationId: createIdentityProvider + parameters: + - $ref: "#/components/parameters/federationSettingsId" + requestBody: + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/FederationOidcIdentityProviderUpdate" + description: The identity provider that you want to create. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/FederationOidcIdentityProvider" + x-xgen-version: 2023-11-15 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create one identity provider + tags: + - Federated Authentication + x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}: + delete: + description: >- + Deletes one identity provider in the specified federation. To use this + resource, the requesting API Key must have the Organization Owner role + in one of the connected organizations. + + + **Note**: Requests to this resource will fail if the identity provider has any connected organizations. Before deleting an identity provider, disconnect all organizations and confirm that no organization in your account uses this identity provider. To learn more, see [Manage Organization Mapping for Federated Authentication](https://www.mongodb.com/docs/atlas/security/manage-org-mapping/). + operationId: deleteIdentityProvider + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the identity + provider to connect. + in: path + name: identityProviderId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + responses: + "204": + content: + application/vnd.atlas.2023-11-15+json: + x-xgen-version: 2023-11-15 + description: No Response + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Delete the identity provider. + tags: + - Federated Authentication + x-xgen-experimental: true + get: + description: "Returns one identity provider in the specified federation by the + identity provider's id. To use this resource, the requesting API Key + must have the Organization Owner role in one of the connected + organizations. Deprecated versions: v2-{2023-01-01}" operationId: getIdentityProvider parameters: - $ref: "#/components/parameters/federationSettingsId" - - $ref: "#/components/parameters/identityProviderId" + - description: Unique string that identifies the identity provider to connect. If + using an API version before 11-15-2023, use the legacy + 20-hexadecimal digit id. This id can be found within the Federation + Management Console > Identity Providers tab by clicking the info + icon in the IdP ID row of a configured identity provider. For all + other versions, use the 24-hexadecimal digit id. + in: path + name: identityProviderId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-11-15+json: schema: $ref: "#/components/schemas/FederationIdentityProvider" - x-xgen-version: 2023-01-01 + x-xgen-version: 2023-11-15 description: OK "400": $ref: "#/components/responses/badRequest" "401": $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" "404": $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return one identity provider from the specified federation. + summary: Return one identity provider from the specified federation by id. tags: - Federated Authentication x-xgen-experimental: true patch: - description: Updates one identity provider in the specified federation. To use - this resource, the requesting API Key must have the Organization Owner - role in one of the connected organizations. + description: >- + Updates one identity provider in the specified federation. To use this + resource, the requesting API Key must have the Organization Owner role + in one of the connected organizations. + + + **Note**: Changing authorization types and/or updating authorization claims can prevent current users and/or groups from accessing the database. Deprecated versions: v2-{2023-01-01} operationId: updateIdentityProvider parameters: - $ref: "#/components/parameters/federationSettingsId" - - $ref: "#/components/parameters/identityProviderId" + - description: Unique string that identifies the identity provider to connect. If + using an API version before 11-15-2023, use the legacy + 20-hexadecimal digit id. This id can be found within the Federation + Management Console > Identity Providers tab by clicking the info + icon in the IdP ID row of a configured identity provider. For all + other versions, use the 24-hexadecimal digit id. + in: path + name: identityProviderId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 requestBody: content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-11-15+json: schema: - $ref: "#/components/schemas/SamlIdentityProviderUpdate" + $ref: "#/components/schemas/FederationIdentityProviderUpdate" description: The identity provider that you want to update. required: true responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-11-15+json: schema: $ref: "#/components/schemas/FederationIdentityProvider" - x-xgen-version: 2023-01-01 + x-xgen-version: 2023-11-15 description: OK "400": $ref: "#/components/responses/badRequest" @@ -801,6 +939,46 @@ paths: tags: - Federated Authentication x-xgen-experimental: true + /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}/jwks: + delete: + description: >- + Revokes the JWKS tokens from the requested OIDC identity provider. To + use this resource, the requesting API Key must have the Organization + Owner role in one of the connected organizations. + + + **Note**: Revoking your JWKS tokens immediately refreshes your IdP public keys from all your Atlas clusters, invalidating previously signed access tokens and logging out all users. You may need to restart your MongoDB clients. All organizations connected to the identity provider will be affected. To learn more, see [Configure OIDC Authorization](https://www.mongodb.com/docs/atlas/security-oidc/#revoke-jwks). + operationId: revokeJwksFromIdentityProvider + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the identity + provider to connect. + in: path + name: identityProviderId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + responses: + "204": + content: + application/vnd.atlas.2023-11-15+json: + x-xgen-version: 2023-11-15 + description: No Response + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Revoke the JWKS tokens from an OIDC identity provider. + tags: + - Federated Authentication + x-xgen-experimental: true /api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}/metadata.xml: get: description: Returns the metadata of one identity provider in the specified @@ -836,9 +1014,9 @@ paths: get: description: Returns details about all projects. Projects group clusters into logical collections that support an application environment, workload, - or both. Each project can have its own users, teams, security, and alert - settings. To use this resource, the requesting API Key must have the - Read Write role. + or both. Each project can have its own users, teams, security, tags, and + alert settings. To use this resource, the requesting API Key must have + the Read Write role. operationId: listProjects parameters: - $ref: "#/components/parameters/includeCount" @@ -858,13 +1036,15 @@ paths: $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return All Projects tags: - Projects post: description: Creates one project. Projects group clusters into logical collections that support an application environment, workload, or both. - Each project can have its own users, teams, security, and alert + Each project can have its own users, teams, security, tags, and alert settings. To use this resource, the requesting API Key must have the Read Write role. operationId: createProject @@ -917,7 +1097,7 @@ paths: description: Returns details about the specified project. Projects group clusters into logical collections that support an application environment, workload, or both. Each project can have its own users, - teams, security, and alert settings. To use this resource, the + teams, security, tags, and alert settings. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getProjectByName parameters: @@ -947,6 +1127,8 @@ paths: $ref: "#/components/responses/conflict" "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return One Project using Its Name tags: - Projects @@ -954,7 +1136,7 @@ paths: delete: description: Removes the specified project. Projects group clusters into logical collections that support an application environment, workload, or both. - Each project can have its own users, teams, security, and alert + Each project can have its own users, teams, security, tags, and alert settings. You can delete a project only if there are no Online Archives for the clusters in the project. To use this resource, the requesting API Key must have the Project Owner role. @@ -984,7 +1166,7 @@ paths: description: Returns details about the specified project. Projects group clusters into logical collections that support an application environment, workload, or both. Each project can have its own users, - teams, security, and alert settings. To use this resource, the + teams, security, tags, and alert settings. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getProject parameters: @@ -1010,8 +1192,8 @@ paths: - Projects patch: description: Updates the human-readable label that identifies the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + project, or the tags associated with the project. To use this resource, + the requesting API Key must have the Project Owner role. operationId: updateProject parameters: - $ref: "#/components/parameters/groupId" @@ -1019,7 +1201,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/GroupName" + $ref: "#/components/schemas/GroupUpdate" description: Project to update. required: true responses: @@ -1042,7 +1224,50 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Update One Project Name + summary: Update One Project + tags: + - Projects + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/access: + post: + description: Adds one MongoDB Cloud user to the specified project. If the + MongoDB Cloud user is not a member of the project's organization, then + the user must accept their invitation to the organization to access + information within the specified project. If the MongoDB Cloud User is + already a member of the project's organization, then they will be added + to the project immediately and an invitation will not be returned by + this resource. To use this resource, the requesting API Key must have + the Group User Admin role. + operationId: addUserToProject + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/GroupInvitationRequest" + description: Adds one MongoDB Cloud user to the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-02-01 + description: OK + "204": + content: + application/vnd.atlas.2023-02-01+json: + x-xgen-version: 2023-02-01 + description: No Content + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Add One MongoDB Cloud User to One Project tags: - Projects x-xgen-experimental: true @@ -1817,7 +2042,7 @@ paths: specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting API Key must have - the Project User Admin role. + the Project Owner role. externalDocs: description: Programmatic API Keys url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key @@ -1849,7 +2074,7 @@ paths: specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting API Key must have - the Project User Admin role. + the Project Owner role. operationId: createProjectApiKey parameters: - $ref: "#/components/parameters/groupId" @@ -1881,8 +2106,7 @@ paths: /api/atlas/v2/groups/{groupId}/apiKeys/{apiUserId}: delete: description: Removes one organization API key from the specified project. To use - this resource, the requesting API Key must have the Project User Admin - role. + this resource, the requesting API Key must have the Project Owner role. externalDocs: description: Programmatic API Keys url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key @@ -1972,7 +2196,7 @@ paths: project. Users with the Project Owner role in the project associated with the API key can then use the organization API key to access the resources. To use this resource, the requesting API Key must have the - Project User Admin role. + Project Owner role. operationId: addProjectApiKey parameters: - $ref: "#/components/parameters/groupId" @@ -2199,8 +2423,10 @@ paths: /api/atlas/v2/groups/{groupId}/backup/exportBuckets/{exportBucketId}: delete: description: Revoke MongoDB Cloud access to the specified AWS S3 bucket. This - prevents this bucket to receive Atlas Cloud Backup snapshots. To use - this resource, the requesting API Key must have the Project Owner role. + prevents this bucket to receive Atlas Cloud Backup snapshots. Auto + export must be disabled on all clusters in this project exporting to + this bucket before revoking access. To use this resource, the requesting + API Key must have the Project Owner role. operationId: deleteExportBucket parameters: - $ref: "#/components/parameters/groupId" @@ -2273,19 +2499,19 @@ paths: - Cloud Backups /api/atlas/v2/groups/{groupId}/backupCompliancePolicy: get: - description: Returns the Backup Compliance Policy settings with the specified + description: "Returns the Backup Compliance Policy settings with the specified project. To use this resource, the requesting API Key must have the - Project Owner role. + Project Owner role. Deprecated versions: v2-{2023-01-01}" operationId: getDataProtectionSettings parameters: - $ref: "#/components/parameters/groupId" responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-10-01+json: schema: - $ref: "#/components/schemas/DataProtectionSettings" - x-xgen-version: 2023-01-01 + $ref: "#/components/schemas/DataProtectionSettings20231001" + x-xgen-version: 2023-10-01 description: OK "401": $ref: "#/components/responses/unauthorized" @@ -2299,28 +2525,37 @@ paths: tags: - Cloud Backups put: - description: Updates the Backup Compliance Policy settings for the specified + description: "Updates the Backup Compliance Policy settings for the specified project. To use this resource, the requesting API Key must have the - Project Owner role. + Project Owner role. Deprecated versions: v2-{2023-01-01}" operationId: updateDataProtectionSettings parameters: - $ref: "#/components/parameters/groupId" + - description: Flag that indicates whether to overwrite non complying backup + policies with the new data protection settings or not. + in: query + name: overwriteBackupPolicies + schema: + type: boolean + default: true requestBody: content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-10-01+json: schema: - $ref: "#/components/schemas/DataProtectionSettings" - x-xgen-version: 2023-01-01 + $ref: "#/components/schemas/DataProtectionSettings20231001" + x-xgen-version: 2023-10-01 description: The new Backup Compliance Policy settings. required: true responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-10-01+json: schema: - $ref: "#/components/schemas/DataProtectionSettings" - x-xgen-version: 2023-01-01 + $ref: "#/components/schemas/DataProtectionSettings20231001" + x-xgen-version: 2023-10-01 description: OK + "400": + $ref: "#/components/responses/badRequest" "401": $ref: "#/components/responses/unauthorized" "404": @@ -2742,7 +2977,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/LegacyAtlasCluster" + $ref: "#/components/schemas/LegacyAtlasTenantClusterUpgradeRequest" description: Details of the shared-tier cluster upgrade in the specified project. required: true responses: @@ -2814,11 +3049,11 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}: delete: - description: "Removes one cluster with advanced features from the specified - project. The cluster must have termination protection disabled in order - to be deleted. To use this resource, the requesting API Key must have - the Project Owner role. This feature is not available for serverless - clusters. Deprecated versions: v2-{2023-01-01}" + description: "Removes one cluster from the specified project. The cluster must + have termination protection disabled in order to be deleted. To use this + resource, the requesting API Key must have the Project Owner role. This + feature is not available for serverless clusters. Deprecated versions: + v2-{2023-01-01}" operationId: deleteCluster parameters: - $ref: "#/components/parameters/groupId" @@ -2855,7 +3090,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Remove One Multi-Cloud Cluster from One Project + summary: Remove One Cluster from One Project tags: - Clusters get: @@ -2868,7 +3103,7 @@ paths: operationId: getCluster parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -2895,7 +3130,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return One Multi-Cloud Cluster from One Project + summary: Return One Cluster from One Project tags: - Clusters patch: @@ -2948,7 +3183,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Modify One Multi-Cloud Cluster from One Project + summary: Modify One Cluster from One Project tags: - Clusters /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/exports: @@ -4091,21 +4326,16 @@ paths: tags: - Legacy Backup x-xgen-experimental: true - /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes: - post: - description: Creates one Atlas Search index on the specified collection. Atlas - Search indexes define the fields on which to create the index and the - analyzers to use when creating the index. Only clusters running MongoDB - v4.2 or later can use Atlas Search. To use this resource, the requesting - API Key must have the Project Data Access Admin role. - externalDocs: - description: Atlas Search Indexes - url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ - operationId: createAtlasSearchIndex + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned: + get: + description: Returns a list of given cluster's pinned namespaces, a set of + namespaces manually selected by users to collect query latency metrics + on. + operationId: getPinnedNamespaces parameters: - $ref: "#/components/parameters/groupId" - - description: Name of the cluster that contains the collection on which to create - an Atlas Search index. + - description: Human-readable label that identifies the cluster to retrieve pinned + namespaces for. in: path name: clusterName required: true @@ -4114,33 +4344,234 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - requestBody: - content: - application/vnd.atlas.2023-01-01+json: - schema: - $ref: "#/components/schemas/ClusterSearchIndex" - description: Creates one Atlas Search index on the specified collection. - required: true responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-11-15+json: schema: - $ref: "#/components/schemas/ClusterSearchIndex" - x-xgen-version: 2023-01-01 + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 description: OK "400": $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" "404": $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Create One Atlas Search Index + summary: Return Pinned Namespaces tags: - - Atlas Search - /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{databaseName}/{collectionName}: + - Collection Level Metrics + x-xgen-experimental: true + patch: + description: Add provided list of namespaces to existing pinned namespaces list + for collection-level latency metrics collection for the given Group and + Cluster + operationId: pinNamespacesPatch + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to pin namespaces + to. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/NamespacesRequest" + description: List of namespace strings (combination of database and collection + name) to pin for query latency metric collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: OK + "201": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Add Pinned Namespaces + tags: + - Collection Level Metrics + x-xgen-experimental: true + put: + description: Pin provided list of namespaces for collection-level latency + metrics collection for the given Group and Cluster. This initializes a + pinned namespaces list or replaces any existing pinned namespaces list + for the Group and Cluster. + operationId: pinNamespacesPut + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to pin namespaces + to. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/NamespacesRequest" + description: List of namespace strings (combination of database and collection + name) to pin for query latency metric collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: OK + "201": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Pin Namespaces + tags: + - Collection Level Metrics + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/unpin: + patch: + description: Unpin provided list of namespaces for collection-level latency + metrics collection for the given Group and Cluster + operationId: unpinNamespaces + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to unpin + namespaces from. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/NamespacesRequest" + description: List of namespace strings (combination of database and collection + name) to pin for query latency metric collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Unpin namespaces + tags: + - Collection Level Metrics + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes: + post: + description: Creates one Atlas Search index on the specified collection. Atlas + Search indexes define the fields on which to create the index and the + analyzers to use when creating the index. Only clusters running MongoDB + v4.2 or later can use Atlas Search. To use this resource, the requesting + API Key must have the Project Data Access Admin role. + externalDocs: + description: Atlas Search Indexes + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: createAtlasSearchIndex + parameters: + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection on which to create + an Atlas Search index. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + description: Creates one Atlas Search index on the specified collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Atlas Search Index + tags: + - Atlas Search + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{databaseName}/{collectionName}: get: description: Returns all Atlas Search indexes on the specified collection. Atlas Search indexes contain the indexed fields and the analyzers used to @@ -4373,7 +4804,7 @@ paths: operationId: getManagedNamespace parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4396,7 +4827,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return One Managed Namespace in One Global Multi-Cloud Cluster + summary: Return One Managed Namespace in One Global Cluster tags: - Global Clusters /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/customZoneMapping: @@ -4414,7 +4845,7 @@ paths: operationId: deleteAllCustomZoneMappings parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4437,7 +4868,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster + summary: Remove All Custom Zone Mappings from One Global Cluster tags: - Global Clusters x-xgen-experimental: true @@ -4454,7 +4885,7 @@ paths: operationId: createCustomZoneMapping parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4467,7 +4898,7 @@ paths: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: "#/components/schemas/GeoSharding" + $ref: "#/components/schemas/CustomZoneMappings" description: Custom zone mapping to add to the specified global cluster. required: true responses: @@ -4503,7 +4934,7 @@ paths: url: https://www.mongodb.com/docs/atlas/global-clusters/ operationId: deleteManagedNamespace parameters: - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4541,7 +4972,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Remove One Managed Namespace from One Global Multi-Cloud Cluster + summary: Remove One Managed Namespace from One Global Cluster tags: - Global Clusters x-xgen-experimental: true @@ -4557,7 +4988,7 @@ paths: operationId: createManagedNamespace parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4591,7 +5022,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Create One Managed Namespace in One Global Multi-Cloud Cluster + summary: Create One Managed Namespace in One Global Cluster tags: - Global Clusters x-xgen-experimental: true @@ -4622,6 +5053,71 @@ paths: requestBody: content: application/vnd.atlas.2023-01-01+json: + examples: + 2dspere Index: + description: 2dspere Index + value: + collation: + alternate: non-ignorable + backwards: false + caseFirst: lower + caseLevel: false + locale: af + maxVariable: punct + normalization: false + numericOrdering: false + strength: 3 + collection: accounts + db: sample_airbnb + keys: + - property_type: "1" + options: + name: PartialIndexTest + partialFilterExpression: + limit: + $gt: 900 + Partial Index: + description: Partial Index + value: + collation: + alternate: non-ignorable + backwards: false + caseFirst: lower + caseLevel: false + locale: af + maxVariable: punct + normalization: false + numericOrdering: false + strength: 3 + collection: accounts + db: sample_airbnb + keys: + - property_type: "1" + options: + name: PartialIndexTest + partialFilterExpression: + limit: + $gt: 900 + Sparse Index: + description: Sparse Index + value: + collation: + alternate: non-ignorable + backwards: false + caseFirst: lower + caseLevel: false + locale: af + maxVariable: punct + normalization: false + numericOrdering: false + strength: 3 + collection: accounts + db: sample_airbnb + keys: + - test_field: "1" + options: + name: SparseIndexTest + sparse: true schema: $ref: "#/components/schemas/DatabaseRollingIndexRequest" description: Rolling index to create on the specified cluster. @@ -5234,7 +5730,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Test Failover for One Multi-Cloud Cluster + summary: Test Failover for One Cluster tags: - Clusters /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs: @@ -5352,7 +5848,7 @@ paths: - DigestAuth: [] summary: Create One Legacy Backup Restore Job tags: - - Legacy Backup Restore Jobs + - Legacy Backup x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs/{jobId}: get: @@ -5405,20 +5901,13 @@ paths: tags: - Legacy Backup x-xgen-experimental: true - /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshotSchedule: - get: - deprecated: true - description: >- - Returns the snapshot schedule for one cluster in the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. - - Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). - operationId: getLegacySnapshotSchedule + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/search/deployment: + delete: + description: Deletes the Search Nodes for the specified cluster. + operationId: deleteAtlasSearchDeployment parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies the cluster with the snapshot - you want to return. + - description: Label that identifies the cluster to delete. in: path name: clusterName required: true @@ -5431,33 +5920,26 @@ paths: "200": content: application/vnd.atlas.2023-01-01+json: - schema: - $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" x-xgen-version: 2023-01-01 description: OK + "400": + $ref: "#/components/responses/badRequest" "404": $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return One Snapshot Schedule + summary: Delete Search Nodes tags: - - Legacy Backup + - Atlas Search x-xgen-experimental: true - patch: - deprecated: true - description: >- - Updates the snapshot schedule for one cluster in the specified project. - To use this resource, the requesting API Key must have the Project Owner - role. - - Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). - operationId: updateLegacySnapshotSchedule + get: + description: Return the Search Nodes for the specified cluster. + operationId: getAtlasSearchDeployment parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies the cluster with the snapshot - you want to return. + - description: Label that identifies the cluster to return the Search Nodes for. in: path name: clusterName required: true @@ -5466,52 +5948,32 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - requestBody: - content: - application/vnd.atlas.2023-01-01+json: - schema: - $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" - description: Update the snapshot schedule for one cluster in the specified project. - required: true responses: "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + $ref: "#/components/schemas/ApiSearchDeploymentResponse" x-xgen-version: 2023-01-01 description: OK "400": $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Update Snapshot Schedule for One Cluster + summary: Return Search Nodes tags: - - Legacy Backup + - Atlas Search x-xgen-experimental: true - /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots: - get: - deprecated: true - description: Returns all legacy backup snapshots for one cluster in the - specified project. To use this resource, the requesting API Key must - have the Project Read Only role. Effective 23 March 2020, all new - clusters can use only Cloud Backups. When you upgrade to 4.2, your - backup system upgrades to cloud backup if it is currently set to legacy - backup. After this upgrade, all your existing legacy backup snapshots - remain available. They expire over time in accordance with your - retention policy. Your backup policy resets to the default schedule. If - you had a custom backup policy in place with legacy backups, you must - re-create it with the procedure outlined in the [Cloud Backup - documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). - operationId: listLegacySnapshots + patch: + description: Updates the Search Nodes for the specified cluster. + operationId: updateAtlasSearchDeployment parameters: - $ref: "#/components/parameters/groupId" - - $ref: "#/components/parameters/includeCount" - - $ref: "#/components/parameters/itemsPerPage" - - $ref: "#/components/parameters/pageNum" - - description: Human-readable label that identifies the cluster. + - description: Label that identifies the cluster to update the Search Nodes for. in: path name: clusterName required: true @@ -5520,40 +5982,223 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: Human-readable label that specifies whether to return only - completed, incomplete, or all snapshots. By default, MongoDB Cloud - only returns completed snapshots. - in: query - name: completed - schema: - type: string - default: "true" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiSearchDeploymentRequest" + description: Updates the Search Nodes for the specified cluster. + required: true responses: "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/PaginatedSnapshot" + $ref: "#/components/schemas/ApiSearchDeploymentResponse" x-xgen-version: 2023-01-01 description: OK - "401": - $ref: "#/components/responses/unauthorized" + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return All Legacy Backup Snapshots + summary: Update Search Nodes tags: - - Legacy Backup + - Atlas Search x-xgen-experimental: true - /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots/{snapshotId}: - delete: - deprecated: true - description: Removes one legacy backup snapshot for one cluster in the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. Effective 23 March 2020, all new clusters can use - only Cloud Backups. When you upgrade to 4.2, your backup system upgrades - to cloud backup if it is currently set to legacy backup. After this + post: + description: Creates Search Nodes for the specified cluster. + operationId: createAtlasSearchDeployment + parameters: + - $ref: "#/components/parameters/groupId" + - description: Label that identifies the cluster to create Search Nodes for. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiSearchDeploymentRequest" + description: Creates Search Nodes for the specified cluster. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiSearchDeploymentResponse" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create Search Nodes + tags: + - Atlas Search + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshotSchedule: + get: + deprecated: true + description: >- + Returns the snapshot schedule for one cluster in the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: getLegacySnapshotSchedule + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Snapshot Schedule + tags: + - Legacy Backup + x-xgen-experimental: true + patch: + deprecated: true + description: >- + Updates the snapshot schedule for one cluster in the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: updateLegacySnapshotSchedule + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + description: Update the snapshot schedule for one cluster in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Snapshot Schedule for One Cluster + tags: + - Legacy Backup + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots: + get: + deprecated: true + description: Returns all legacy backup snapshots for one cluster in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. Effective 23 March 2020, all new + clusters can use only Cloud Backups. When you upgrade to 4.2, your + backup system upgrades to cloud backup if it is currently set to legacy + backup. After this upgrade, all your existing legacy backup snapshots + remain available. They expire over time in accordance with your + retention policy. Your backup policy resets to the default schedule. If + you had a custom backup policy in place with legacy backups, you must + re-create it with the procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: listLegacySnapshots + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Human-readable label that specifies whether to return only + completed, incomplete, or all snapshots. By default, MongoDB Cloud + only returns completed snapshots. + in: query + name: completed + schema: + type: string + default: "true" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Legacy Backup Snapshots + tags: + - Legacy Backup + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots/{snapshotId}: + delete: + deprecated: true + description: Removes one legacy backup snapshot for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. Effective 23 March 2020, all new clusters can use + only Cloud Backups. When you upgrade to 4.2, your backup system upgrades + to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup @@ -5752,95 +6397,232 @@ paths: tags: - Clusters x-xgen-experimental: true - /api/atlas/v2/groups/{groupId}/clusters/{hostName}/logs/{logName}.gz: + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/collStats/namespaces: get: - description: "Returns a compressed (.gz) log file that contains a range of log - messages for the specified host for the specified project. MongoDB - updates process and audit logs from the cluster backend infrastructure - every five minutes and contain log data from the previous five minutes. - If you poll the API for log files, we recommend polling every five - minutes. For example, if the logs are updated at 4:00 UTC and then you - poll the API, the API returns log data from the interval between 3:55 - UTC and 4:00 UTC. This feature isn't available for `M0` free clusters, - `M2`, `M5`, or serverless clusters. To use this resource, the requesting - API Key must have the Project Data Access Read Only or higher role. - Deprecated versions: v2-{2023-01-01}" - operationId: getHostLogs + description: Return the subset of namespaces from the given cluster sorted by + highest total execution time (descending) within the given time window. + operationId: getCollStatsLatencyNamespacesForCluster parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies the host that stores the log - files that you want to download. + - description: Human-readable label that identifies the cluster to pin namespaces + to. in: path - name: hostName + name: clusterName required: true schema: type: string - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ - - description: Human-readable label that identifies the log file that you want to - return. To return audit logs, enable *Database Auditing* for the - specified project. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Human-readable label that identifies the cluster topology to + retrieve metrics for. in: path - name: logName + name: clusterView required: true schema: type: string - externalDocs: - description: Set up Database Auditing - url: https://docs.atlas.mongodb.com/database-auditing/ - - description: Date and time when the period specifies the inclusive ending point - for the range of log messages to retrieve. This parameter expresses - its value in the number of seconds that have elapsed since the UNIX - epoch. - in: query - name: endDate - schema: - type: integer - format: int64 - minimum: 1199145600 - - description: Date and time when the period specifies the inclusive starting - point for the range of log messages to retrieve. This parameter - expresses its value in the number of seconds that have elapsed since - the UNIX epoch. - in: query - name: startDate - schema: - type: integer - format: int64 - minimum: 1199145600 + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - $ref: "#/components/parameters/period" responses: "200": content: - application/vnd.atlas.2023-02-01+gzip: + application/vnd.atlas.2023-11-15+json: schema: - type: string - format: binary - description: Compressed (.gz) log file that contains a range of log messages for - the specified host for the specified project - x-xgen-version: 2023-02-01 - description: OK - "400": - $ref: "#/components/responses/badRequest" - "401": - $ref: "#/components/responses/unauthorized" + $ref: "#/components/schemas/CollStatsRankedNamespaces" + x-xgen-version: 2023-11-15 + description: Succeeded "403": $ref: "#/components/responses/forbidden" - "404": - $ref: "#/components/responses/notFound" - "409": - $ref: "#/components/responses/conflict" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Download Logs for One Cluster Host in One Project + summary: Return Ranked Namespaces from a Cluster tags: - - Monitoring and Logs - /api/atlas/v2/groups/{groupId}/containers: + - Collection Level Metrics + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/{databaseName}/{collectionName}/collStats/measurements: get: - description: Returns details about all network peering containers in the - specified project for the specified cloud provider. If you do not - specify the cloud provider, MongoDB Cloud returns details about all - network peering containers in the project for Amazon Web Services (AWS). + description: Get a list of the Coll Stats Latency cluster-level measurements for + the given namespace. + operationId: getCollStatsLatencyNamespaceClusterMeasurements + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to retrieve + metrics for. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Human-readable label that identifies the cluster topology to + retrieve metrics for. + in: path + name: clusterView + required: true + schema: + type: string + - $ref: "#/components/parameters/databaseName" + - $ref: "#/components/parameters/collectionName" + - description: List that contains the metrics that you want to retrieve for the + associated data series. If you don't set this parameter, this + resource returns data series for all Coll Stats Latency metrics. + in: query + name: metrics + schema: + type: array + items: + type: string + description: Metric requested for the given cluster + uniqueItems: true + style: form + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - $ref: "#/components/parameters/period" + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/MeasurementsCollStatsLatencyCluster" + x-xgen-version: 2023-11-15 + description: Succeeded + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Cluster-Level Query Latency + tags: + - Collection Level Metrics + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/clusters/{hostName}/logs/{logName}.gz: + get: + description: "Returns a compressed (.gz) log file that contains a range of log + messages for the specified host for the specified project. MongoDB + updates process and audit logs from the cluster backend infrastructure + every five minutes and contain log data from the previous five minutes. + If you poll the API for log files, we recommend polling every five + minutes. For example, if the logs are updated at 4:00 UTC and then you + poll the API, the API returns log data from the interval between 3:55 + UTC and 4:00 UTC. This feature isn't available for `M0` free clusters, + `M2`, `M5`, or serverless clusters. To use this resource, the requesting + API Key must have the Project Data Access Read Only or higher role. + Deprecated versions: v2-{2023-01-01}" + operationId: getHostLogs + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the host that stores the log + files that you want to download. + in: path + name: hostName + required: true + schema: + type: string + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + - description: Human-readable label that identifies the log file that you want to + return. To return audit logs, enable *Database Auditing* for the + specified project. + in: path + name: logName + required: true + schema: + type: string + externalDocs: + description: Set up Database Auditing + url: https://docs.atlas.mongodb.com/database-auditing/ + - description: Date and time when the period specifies the inclusive ending point + for the range of log messages to retrieve. This parameter expresses + its value in the number of seconds that have elapsed since the UNIX + epoch. + in: query + name: endDate + schema: + type: integer + format: int64 + minimum: 1199145600 + - description: Date and time when the period specifies the inclusive starting + point for the range of log messages to retrieve. This parameter + expresses its value in the number of seconds that have elapsed since + the UNIX epoch. + in: query + name: startDate + schema: + type: integer + format: int64 + minimum: 1199145600 + responses: + "200": + content: + application/vnd.atlas.2023-02-01+gzip: + schema: + type: string + format: binary + description: Compressed (.gz) log file that contains a range of log messages for + the specified host for the specified project + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Download Logs for One Cluster Host in One Project + tags: + - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/collStats/metrics: + get: + description: Returns all available Coll Stats Latency metric names and their + respective units for the specified project at the time of request. + operationId: getCollStatsLatencyNamespaceMetrics + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-11-15 + description: Succeeded + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return all metric names + tags: + - Collection Level Metrics + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/containers: + get: + description: Returns details about all network peering containers in the + specified project for the specified cloud provider. If you do not + specify the cloud provider, MongoDB Cloud returns details about all + network peering containers in the project for Amazon Web Services (AWS). To use this resource, the requesting API Key must have the Project Read Only role. operationId: listPeeringContainerByCloudProvider @@ -6838,7 +7620,7 @@ paths: description: Creates one database user in the specified project. required: true responses: - "200": + "201": content: application/vnd.atlas.2023-01-01+json: schema: @@ -7164,7 +7946,7 @@ paths: description: Generates one X.509 certificate for the specified MongoDB user. required: true responses: - "200": + "201": content: application/vnd.atlas.2023-01-01+json: schema: @@ -7233,7 +8015,7 @@ paths: name: ipAddress schema: type: string - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ - description: Maximum number of lines from the log to return. in: query name: nLogs @@ -7310,7 +8092,7 @@ paths: name: ipAddress schema: type: string - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ - description: Maximum number of lines from the log to return. in: query name: nLogs @@ -7859,7 +8641,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/ThridPartyIntegration" + $ref: "#/components/schemas/ThirdPartyIntegration" x-xgen-version: 2023-01-01 description: OK "400": @@ -7900,7 +8682,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/ThridPartyIntegration" + $ref: "#/components/schemas/ThirdPartyIntegration" description: Third-party integration that you want to configure for your project. required: true responses: @@ -7949,7 +8731,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/ThridPartyIntegration" + $ref: "#/components/schemas/ThirdPartyIntegration" description: Third-party integration that you want to configure for your project. required: true responses: @@ -7976,6 +8758,7 @@ paths: x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/invites: get: + deprecated: true description: Returns all pending invitations to the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: listProjectInvitations @@ -8006,7 +8789,9 @@ paths: summary: Return All Project Invitations tags: - Projects + x-sunset: 2024-10-04 patch: + deprecated: true description: Updates the details of one pending invitation to the specified project. To specify which invitation to update, provide the username of the invited user. To use this resource, the requesting API Key must have @@ -8042,7 +8827,9 @@ paths: summary: Update One Project Invitation tags: - Projects + x-sunset: 2024-10-04 post: + deprecated: true description: Invites one MongoDB Cloud user to join the specified project. The MongoDB Cloud user must accept the invitation to access information within the specified project. To use this resource, the requesting API @@ -8074,8 +8861,10 @@ paths: summary: Invite One MongoDB Cloud User to Join One Project tags: - Projects + x-sunset: 2024-10-04 /api/atlas/v2/groups/{groupId}/invites/{invitationId}: delete: + deprecated: true description: Cancels one pending invitation sent to the specified MongoDB Cloud user to join a project. You can't cancel an invitation that the user accepted. To use this resource, the requesting API Key must have the @@ -8109,7 +8898,9 @@ paths: summary: Cancel One Project Invitation tags: - Projects + x-sunset: 2024-10-04 get: + deprecated: true description: Returns the details of one pending invitation to the specified project. To use this resource, the requesting API Key must have the Project Owner role. @@ -8144,7 +8935,9 @@ paths: summary: Return One Project Invitation tags: - Projects + x-sunset: 2024-10-04 patch: + deprecated: true description: Updates the details of one pending invitation to the specified project. To specify which invitation to update, provide the unique identification string for that invitation. Use the Return All Project @@ -8191,6 +8984,34 @@ paths: summary: Update One Project Invitation by Invitation ID tags: - Projects + x-sunset: 2024-10-04 + /api/atlas/v2/groups/{groupId}/ipAddresses: + get: + description: Returns all IP addresses for this project. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: returnAllIPAddresses + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupIPAddresses" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All IP Addresses for One Project + tags: + - Projects + x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/limits: get: description: Returns all the limits for the specified project. To use this @@ -8439,9 +9260,11 @@ paths: description: >- Migrate one cluster that Cloud or Ops Manager manages to MongoDB Atlas. - Please make sure to [validate](#tag/Cloud-Migration-Service/operation/validateOneMigration) your migration before initiating it. + Please make sure to [validate](#tag/Cloud-Migration-Service/operation/validateMigration) your migration before initiating it. You can use this API endpoint for push live migrations only. Your API Key must have the Organization Owner role to successfully call this resource. + + **NOTE**: Migrating time-series collections is not yet supported on MongoDB 6.0 or higher. Migrations on MongoDB 6.0 or higher will skip any time-series collections on the source cluster. operationId: createPushMigration parameters: - $ref: "#/components/parameters/groupId" @@ -9567,8 +10390,12 @@ paths: endpoint service for the project. When you create a private endpoint service, MongoDB Cloud creates a network container in the project for the cloud provider for which you create the private endpoint service if - one doesn't already exist. To use this resource, the requesting API Key - must have the Project Owner role. + one doesn't already exist. To learn more about private endpoint + terminology in MongoDB Cloud, see Private Endpoint Concepts. To use this + resource, the requesting API Key must have the Project Owner role. + externalDocs: + description: Private Endpoint Concepts + url: https://dochub.mongodb.org/core/private-endpoint-concepts operationId: createPrivateEndpointService parameters: - $ref: "#/components/parameters/groupId" @@ -10493,6 +11320,35 @@ paths: summary: Return One MongoDB Process by ID tags: - Monitoring and Logs + /api/atlas/v2/groups/{groupId}/processes/{processId}/collStats/namespaces: + get: + description: Return the subset of namespaces from the given process ranked by + highest total execution time (descending) within the given time window. + operationId: getCollStatsLatencyNamespacesForHost + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - $ref: "#/components/parameters/period" + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/CollStatsRankedNamespaces" + x-xgen-version: 2023-11-15 + description: Succeeded + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Ranked Namespaces from a Host + tags: + - Collection Level Metrics + x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/processes/{processId}/databases: get: description: Returns the list of databases running on the specified host for the @@ -10650,6 +11506,8 @@ paths: $ref: "#/components/responses/unauthorized" "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return Measurements of One Database for One MongoDB Process tags: - Monitoring and Logs @@ -10927,8 +11785,8 @@ paths: pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the suggested indexes. - This parameter expresses its value in the number of seconds that - have elapsed since the [UNIX + This parameter expresses its value in the number of milliseconds + that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). @@ -10940,7 +11798,7 @@ paths: schema: type: integer format: int64 - minimum: 1199145600 + minimum: 1199145600000 responses: "200": content: @@ -11019,8 +11877,8 @@ paths: pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the slow queries. This - parameter expresses its value in the number of seconds that have - elapsed since the [UNIX + parameter expresses its value in the number of milliseconds that + have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). @@ -11032,7 +11890,7 @@ paths: schema: type: integer format: int64 - minimum: 1199145600 + minimum: 1199145600000 responses: "200": content: @@ -11116,8 +11974,8 @@ paths: pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the suggested indexes. - This parameter expresses its value in the number of seconds that - have elapsed since the [UNIX + This parameter expresses its value in the number of milliseconds + that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). @@ -11129,6 +11987,7 @@ paths: schema: type: integer format: int64 + minimum: 1199145600000 responses: "200": content: @@ -11146,6 +12005,52 @@ paths: summary: Return Suggested Indexes tags: - Performance Advisor + /api/atlas/v2/groups/{groupId}/processes/{processId}/{databaseName}/{collectionName}/collStats/measurements: + get: + description: Get a list of the Coll Stats Latency process-level measurements for + the given namespace + operationId: getCollStatsLatencyNamespaceHostMeasurements + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/databaseName" + - $ref: "#/components/parameters/collectionName" + - description: List that contains the metrics that you want to retrieve for the + associated data series. If you don't set this parameter, this + resource returns data series for all Coll Stats Latency metrics. + in: query + name: metrics + schema: + type: array + items: + type: string + description: Metric requested for the given process + uniqueItems: true + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - $ref: "#/components/parameters/period" + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/MeasurementsCollStatsLatencyHost" + x-xgen-version: 2023-11-15 + description: Succeeded + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Host-Level Query Latency + tags: + - Collection Level Metrics + x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/pushBasedLogExport: delete: description: Disables the push-based log export feature by resetting the project @@ -11250,7 +12155,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/PushBasedLogExportProject" + $ref: "#/components/schemas/CreatePushBasedLogExportProjectRequest" x-xgen-version: 2023-01-01 description: The project configuration details. The S3 bucket name, IAM role ID, and prefix path fields are required. @@ -11632,13 +12537,84 @@ paths: summary: Return One Snapshot of One Serverless Instance tags: - Cloud Backups - /api/atlas/v2/groups/{groupId}/serverless/{name}: - delete: - description: Removes one serverless instance from the specified project. The - serverless instance must have termination protection disabled in order - to be deleted. To use this resource, the requesting API Key must have - the Project Owner role. - operationId: deleteServerlessInstance + /api/atlas/v2/groups/{groupId}/serverless/{clusterName}/performanceAdvisor/autoIndexing: + get: + description: Get whether the Serverless Auto Indexing feature is enabled. + operationId: getServerlessAutoIndexing + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: boolean + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Serverless Auto Indexing Enabled + tags: + - Performance Advisor + x-xgen-experimental: true + post: + description: Set whether the Serverless Auto Indexing feature is enabled. + operationId: setServerlessAutoIndexing + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Value that we want to set for the Serverless Auto Indexing toggle. + in: query + name: enable + required: true + schema: + type: boolean + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Set Serverless Auto Indexing + tags: + - Performance Advisor + x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/serverless/{name}: + delete: + description: Removes one serverless instance from the specified project. The + serverless instance must have termination protection disabled in order + to be deleted. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: deleteServerlessInstance parameters: - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the serverless instance. @@ -11844,7 +12820,8 @@ paths: x-xgen-experimental: true post: description: Creates one stream instance in the specified project. To use this - resource, the requesting API Key must have the Project Owner roles. + resource, the requesting API Key must have the Project Data Access Admin + role, Project Owner role or Project Stream Processing Owner role. operationId: createStreamInstance parameters: - $ref: "#/components/parameters/groupId" @@ -11881,7 +12858,8 @@ paths: /api/atlas/v2/groups/{groupId}/streams/{tenantName}: delete: description: Delete one stream instance in the specified project. To use this - resource, the requesting API Key must have the Project Owner roles. + resource, the requesting API Key must have the Project Data Access Admin + role, Project Owner role or Project Stream Processing Owner role. operationId: deleteStreamInstance parameters: - $ref: "#/components/parameters/groupId" @@ -11919,7 +12897,8 @@ paths: get: description: Returns the details of one stream instance within the specified project. To use this resource, the requesting API Key must have the - Project Read Only role. + Project Data Access roles, Project Owner role or Project Stream + Processing Owner role. operationId: getStreamInstance parameters: - $ref: "#/components/parameters/groupId" @@ -11962,7 +12941,8 @@ paths: x-xgen-experimental: true patch: description: Update one stream instance in the specified project. To use this - resource, the requesting API Key must have the Project Owner roles. + resource, the requesting API Key must have the Project Data Access Admin + role, Project Owner role or Project Stream Processing Owner role. operationId: updateStreamInstance parameters: - $ref: "#/components/parameters/groupId" @@ -12007,9 +12987,75 @@ paths: 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true + /api/atlas/v2/groups/{groupId}/streams/{tenantName}/auditLogs: + get: + description: Downloads the audit logs for the specified Atlas Streams Processing + instance. By default, logs cover periods of 30 days. To use this + resource, the requesting API Key must have the Project Data Access + roles, Project Owner role or Project Stream Processing Owner role. + operationId: downloadStreamTenantAuditLogs + parameters: + - $ref: "#/components/parameters/groupId" + - description: Timestamp that specifies the end point for the range of log + messages to download. MongoDB Cloud expresses this timestamp in the + number of seconds that have elapsed since the UNIX epoch. + in: query + name: endDate + schema: + type: integer + format: int64 + example: 1636481348 + pattern: "1199145600" + - description: Timestamp that specifies the starting point for the range of log + messages to download. MongoDB Cloud expresses this timestamp in the + number of seconds that have elapsed since the UNIX epoch. + in: query + name: startDate + schema: + type: integer + format: int64 + example: 1636466948 + pattern: "1199145600" + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-02-01+gzip: + schema: + type: string + format: binary + description: Compressed archive labeled `auditLogs.gz` downloads + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Download Audit Logs for One Atlas Stream Processing Instance + tags: + - Streams + x-xgen-experimental: true /api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections: get: - description: Returns all connections of the stream instance for the specified project. + description: Returns all connections of the stream instance for the specified + project.To use this resource, the requesting API Key must have the + Project Data Access roles, Project Owner role or Project Stream + Processing Owner role. operationId: listStreamConnections parameters: - $ref: "#/components/parameters/groupId" @@ -12047,7 +13093,7 @@ paths: post: description: Creates one connection for a stream instance in the specified project. To use this resource, the requesting API Key must have the - Project Owner roles. + Project Owner or Project Stream Processing Owner role. operationId: createStreamConnection parameters: - $ref: "#/components/parameters/groupId" @@ -12093,7 +13139,8 @@ paths: /api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}: delete: description: Delete one connection of the specified stream instance. To use this - resource, the requesting API Key must have the Project Owner roles. + resource, the requesting API Key must have the Project Owner role or + Project Stream Processing Owner role. operationId: deleteStreamConnection parameters: - $ref: "#/components/parameters/groupId" @@ -12179,7 +13226,7 @@ paths: patch: description: Update one connection for the specified stream instance in the specified project. To use this resource, the requesting API Key must - have the Project Owner roles. + have the Project Owner role or Project Stream Processing Owner role. operationId: updateStreamConnection parameters: - $ref: "#/components/parameters/groupId" @@ -13136,7 +14183,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/PaginatedApiUserAccessList" + $ref: "#/components/schemas/PaginatedApiUserAccessListResponse" x-xgen-version: 2023-01-01 description: OK "401": @@ -13176,7 +14223,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/UserAccessList" + $ref: "#/components/schemas/UserAccessListRequest" description: Access list entries to be created for the specified organization API key. required: true @@ -13185,7 +14232,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/PaginatedApiUserAccessList" + $ref: "#/components/schemas/PaginatedApiUserAccessListResponse" x-xgen-version: 2023-01-01 description: OK "400": @@ -13297,7 +14344,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/UserAccessList" + $ref: "#/components/schemas/UserAccessListResponse" x-xgen-version: 2023-01-01 description: OK "401": @@ -13316,7 +14363,7 @@ paths: post: description: Creates a query process within the Cost Explorer for the given parameters. A token is returned that can be used to poll the status of - the query and eventually retrievethe results. + the query and eventually retrieve the results. operationId: createCostExplorerQueryProcess parameters: - $ref: "#/components/parameters/orgId" @@ -13977,6 +15024,8 @@ paths: description: OK "401": $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: @@ -14369,7 +15418,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/Team" + $ref: "#/components/schemas/TeamUpdate" description: Details to update on the specified team. required: true responses: @@ -14675,6 +15724,27 @@ paths: tags: - Organizations x-xgen-experimental: true + /api/atlas/v2/unauth/controlPlaneIPAddresses: + get: + description: Returns all control plane IP addresses. + operationId: returnAllControlPlaneIPAddresses + parameters: [] + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/ControlPlaneIPAddresses" + x-xgen-version: 2023-11-15 + description: OK + "500": + $ref: "#/components/responses/internalServerError" + security: + - Unauthenticated: [] + summary: Return All Control Plane IP Addresses + tags: + - Root + x-xgen-experimental: true /api/atlas/v2/users: post: description: >- @@ -14870,7 +15940,10 @@ components: x-flag-name: projectId x-group-id: true identityProviderId: - description: Unique 20-hexadecimal digit string that identifies the identity provider. + description: Legacy 20-hexadecimal digit string that identifies the identity + provider. This id can be found within the Federation Management Console + > Identity Providers tab by clicking the info icon in the IdP ID row of + a configured identity provider. in: path name: identityProviderId required: true @@ -14997,9 +16070,7 @@ components: detail: (This is just an example, the exception may not be related to this endpoint) No provider AWS exists. error: 400 - errorCode: INVALID_PROVIDER - parameters: - - AWS + errorCode: VALIDATION_ERROR reason: Bad Request schema: $ref: "#/components/schemas/ApiError" @@ -15012,9 +16083,7 @@ components: endpoint) Cannot delete organization link while there is active migration in following project ids: 60c4fd418ebe251047c50554" error: 409 - errorCode: CANNOT_DELETE_ORG_LINK_WITH_RUNNING_LIVE_EXPORT - parameters: - - 60c4fd418ebe251047c50554 + errorCode: CANNOT_DELETE_ORG_ACTIVE_LIVE_MIGRATION_ATLAS_ORG_LINK reason: Conflict schema: $ref: "#/components/schemas/ApiError" @@ -15027,8 +16096,6 @@ components: endpoint) error: 403 errorCode: CANNOT_CHANGE_GROUP_NAME - parameters: - - EXAMPLE reason: Forbidden schema: $ref: "#/components/schemas/ApiError" @@ -15041,8 +16108,6 @@ components: in the past. error: 410 errorCode: VERSION_GONE - parameters: - - EXAMPLE reason: Gone schema: $ref: "#/components/schemas/ApiError" @@ -15055,8 +16120,6 @@ components: endpoint) error: 500 errorCode: UNEXPECTED_ERROR - parameters: - - EXAMPLE reason: Internal Server Error schema: $ref: "#/components/schemas/ApiError" @@ -15069,8 +16132,6 @@ components: endpoint) error: 405 errorCode: ATLAS_BACKUP_CANCEL_SHARD_RESTORE_JOB_NOT_ALLOWED - parameters: - - EXAMPLE reason: Method Not Allowed schema: $ref: "#/components/schemas/ApiError" @@ -15085,8 +16146,6 @@ components: endpoint) Cannot find resource AWS error: 404 errorCode: RESOURCE_NOT_FOUND - parameters: - - AWS reason: Not Found schema: $ref: "#/components/schemas/ApiError" @@ -15099,8 +16158,6 @@ components: endpoint) error: 402 errorCode: NO_PAYMENT_INFORMATION_FOUND - parameters: - - EXAMPLE reason: Payment Required schema: $ref: "#/components/schemas/ApiError" @@ -15113,8 +16170,6 @@ components: endpoint) error: 401 errorCode: NOT_ORG_GROUP_CREATOR - parameters: - - EXAMPLE reason: Unauthorized schema: $ref: "#/components/schemas/ApiError" @@ -15263,6 +16318,13 @@ components: storage space, consider upgrading your cluster to a higher tier. maximum: 4096 minimum: 10 + diskWarmingMode: + type: string + default: FULLY_WARMED + description: Disk warming mode selection. + externalDocs: + description: Reduce Secondary Disk Warming Impact + url: https://docs.atlas.mongodb.com/reference/replica-set-tags/#reduce-secondary-disk-warming-impact encryptionAtRestProvider: type: string description: 'Cloud service provider that manages your customer keys to provide @@ -15297,13 +16359,14 @@ components: readOnly: true labels: type: array + deprecated: true description: >- Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels. - Cluster labels will be deprecated in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. + Cluster labels are deprecated and will be removed in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. items: $ref: "#/components/schemas/ComponentLabel" links: @@ -15319,7 +16382,7 @@ components: readOnly: true mongoDBMajorVersion: type: string - default: "6.0" + default: "7.0" description: Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version. mongoDBVersion: @@ -15609,6 +16672,35 @@ components: minLength: 1 pattern: ^([a-f0-9]{24})$ readOnly: true + instanceName: + type: string + description: The name of the Stream Processing Instance to which this alert + applies. The resource returns this parameter for alerts of events + impacting Stream Processing Instances. + example: foobar + readOnly: true + processorErrorMsg: + type: string + description: The error message associated with the Stream Processor to which + this alert applies. + example: "MongoServerError: Failed to start stream processor: (Location77175) + Could not connect to the Kafka topic with kafka error code: -195, + message: Local: Broker transport failure.: (Location77175)" + readOnly: true + processorName: + type: string + description: The name of the Stream Processor to which this alert applies. The + resource returns this parameter for alerts of events impacting + Stream Processors. + example: foobar + readOnly: true + processorState: + type: string + description: The state of the Stream Processor to which this alert applies. The + resource returns this parameter for alerts of events impacting + Stream Processors. + example: STARTED + readOnly: true AlertsNotificationRootForGroup: type: object description: One target that MongoDB Cloud sends notifications when an alert triggers. @@ -15645,6 +16737,11 @@ components: format: int32 description: Number of minutes that MongoDB Cloud waits after detecting an alert condition before it sends out the first notification. + integrationId: + type: string + description: The id of the associated integration, the credentials of which to + use for requests. + example: 32b6e34b3d91647abb20e7b8 intervalMin: type: integer format: int32 @@ -15661,7 +16758,7 @@ components: description: The notifierId is a system-generated unique identifier assigned to each notification method. This is needed when updating third-party notifications without requiring explicit authentication credentials. - example: 6462742adc47d365036da07c + example: 32b6e34b3d91647abb20e7b8 typeName: type: string description: Human-readable label that displays the alert notification type. @@ -15671,7 +16768,7 @@ components: description: >- Email address to which MongoDB Cloud sends alert notifications. The resource requires this parameter when `"notifications.[n].typeName" - : "EMAIL"`. You don’t need to set this value to send emails to + : "EMAIL"`. You don't need to set this value to send emails to individual or groups of MongoDB Cloud users including: @@ -15938,21 +17035,18 @@ components: type: integer format: int32 description: HTTP status code returned with this error. - maximum: 599 - minimum: 200 + externalDocs: + url: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status errorCode: type: string description: Application error code returned with this error. - example: TOO_MANY_GROUP_NOTIFICATIONS parameters: type: array - description: Parameter uses to give more information about the error. + description: Parameters used to give more information about the error. items: {} reason: type: string description: Application error message returned with this error. - example: At most one group notification can be specified for an alert - configuration. ApiHostView_Atlas: type: object properties: @@ -15978,7 +17072,7 @@ components: description: Hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ readOnly: true id: type: string @@ -16086,6 +17180,7 @@ components: - publicKey ApiKeyUserDetails: type: object + description: Details of the Programmatic API Keys. properties: desc: type: string @@ -16240,6 +17335,7 @@ components: | `REGION` | Simulates a cluster outage for a region.| AtlasOrganization: type: object + description: Details that describe the organization. properties: id: type: string @@ -16302,10 +17398,6 @@ components: default: false description: Flag that indicates whether someone enabled database auditing for the specified project. - required: - - auditAuthorizationSuccess - - auditFilter - - enabled AuthFederationRoleMapping: type: object description: Mapping settings that link one IdP and MongoDB Cloud. @@ -16313,7 +17405,7 @@ components: externalGroupName: type: string description: Unique human-readable label that identifies the identity provider - group to whichthis role mapping applies. + group to which this role mapping applies. maxLength: 200 minLength: 1 id: @@ -16336,7 +17428,6 @@ components: title: Federated Authentication Role Mapping AvailableCloudProviderRegion: type: object - description: List of regions that this cloud provider supports for this instance size. properties: default: type: boolean @@ -16348,7 +17439,6 @@ components: type: string description: Human-readable label that identifies the supported region. readOnly: true - readOnly: true AvailableClustersDeployment: type: object description: Deployments that can be migrated to MongoDB Atlas. @@ -16486,6 +17576,103 @@ components: description: Flag that indicates whether the Azure encryption key can encrypt and decrypt data. readOnly: true + BackupComplianceOnDemandPolicyItem: + type: object + description: Specifications for on-demand policy. + properties: + frequencyInterval: + type: integer + format: int32 + description: Number that indicates the frequency interval for a set of + snapshots. MongoDB Cloud ignores this setting for non-hourly policy + items in Backup Compliance Policy settings. + frequencyType: + type: string + description: Human-readable label that identifies the frequency type associated + with the backup policy. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this backup + policy item. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + retentionUnit: + type: string + description: Unit of time in which MongoDB Cloud measures snapshot retention. + retentionValue: + type: integer + format: int32 + description: >- + Duration in days, weeks, months, or years that MongoDB Cloud retains + the snapshot. For less frequent policy items, MongoDB Cloud requires + that you specify a value greater than or equal to the value + specified for more frequent policy items. + + + For example: If the hourly policy item specifies a retention of two days, you must specify two days or greater for the retention of the weekly policy item. + required: + - frequencyInterval + - frequencyType + - retentionUnit + - retentionValue + BackupComplianceScheduledPolicyItem: + type: object + description: Specifications for scheduled policy. + properties: + frequencyInterval: + type: integer + format: int32 + description: >- + Number that indicates the frequency interval for a set of snapshots. + A value of `1` specifies the first instance of the corresponding + `frequencyType`. + + + - In a yearly policy item, `1` indicates that the yearly snapshot occurs on the first day of January and `12` indicates the first day of December. + + + - In a monthly policy item, `1` indicates that the monthly snapshot occurs on the first day of the month and `40` indicates the last day of the month. + + + - In a weekly policy item, `1` indicates that the weekly snapshot occurs on Monday and `7` indicates Sunday. + + + - In an hourly policy item, you can set the frequency interval to `1`, `2`, `4`, `6`, `8`, or `12`. For hourly policy items for NVMe clusters, MongoDB Cloud accepts only `12` as the frequency interval value. + + MongoDB Cloud ignores this setting for non-hourly policy items in Backup Compliance Policy settings. + frequencyType: + type: string + description: Human-readable label that identifies the frequency type associated + with the backup policy. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this backup + policy item. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + retentionUnit: + type: string + description: Unit of time in which MongoDB Cloud measures snapshot retention. + retentionValue: + type: integer + format: int32 + description: >- + Duration in days, weeks, months, or years that MongoDB Cloud retains + the snapshot. For less frequent policy items, MongoDB Cloud requires + that you specify a value greater than or equal to the value + specified for more frequent policy items. + + + For example: If the hourly policy item specifies a retention of two days, you must specify two days or greater for the retention of the weekly policy item. + required: + - frequencyInterval + - frequencyType + - retentionUnit + - retentionValue BackupLabel: type: object description: Collection of key-value pairs that represent custom data to add to @@ -16524,6 +17711,7 @@ components: type: string description: Human-readable label that identifies the collection for which you created the online archive. + readOnly: true collectionType: type: string default: STANDARD @@ -16533,8 +17721,11 @@ components: If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`. + readOnly: true criteria: $ref: "#/components/schemas/Criteria" + dataExpirationRule: + $ref: "#/components/schemas/DataExpirationRule" dataProcessRegion: $ref: "#/components/schemas/DataProcessRegion" dataSetName: @@ -16546,6 +17737,7 @@ components: type: string description: Human-readable label of the database that contains the collection that contains the online archive. + readOnly: true groupId: type: string description: Unique 24-hexadecimal digit string that identifies the project that @@ -16574,6 +17766,7 @@ components: items: $ref: "#/components/schemas/PartitionField" minItems: 1 + readOnly: true paused: type: boolean description: Flag that indicates whether this online archive exists in the @@ -16633,6 +17826,7 @@ components: type: string description: Human-readable label that identifies the collection for which you created the online archive. + writeOnly: true collectionType: type: string default: STANDARD @@ -16642,10 +17836,13 @@ components: If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`. + writeOnly: true criteria: $ref: "#/components/schemas/Criteria" + dataExpirationRule: + $ref: "#/components/schemas/DataExpirationRule" dataProcessRegion: - $ref: "#/components/schemas/DataProcessRegion" + $ref: "#/components/schemas/CreateDataProcessRegion" dataSetName: type: string description: Human-readable label that identifies the dataset that Atlas @@ -16655,6 +17852,7 @@ components: type: string description: Human-readable label of the database that contains the collection that contains the online archive. + writeOnly: true groupId: type: string description: Unique 24-hexadecimal digit string that identifies the project that @@ -16683,6 +17881,7 @@ components: items: $ref: "#/components/schemas/PartitionField" minItems: 1 + writeOnly: true paused: type: boolean description: Flag that indicates whether this online archive exists in the @@ -17182,12 +18381,12 @@ components: retentionValue: type: integer format: int32 - description: Number that indicates the amount of days, weeks, or months that - MongoDB Cloud retains the snapshot. For less frequent policy items, - MongoDB Cloud requires that you specify a value greater than or - equal to the value specified for more frequent policy items. If the - hourly policy item specifies a retention of two days, specify two - days or greater for the retention of the weekly policy item. + description: Number that indicates the amount of days, weeks, months, or years + that MongoDB Cloud retains the snapshot. For less frequent policy + items, MongoDB Cloud requires that you specify a value greater than + or equal to the value specified for more frequent policy items. If + the hourly policy item specifies a retention of two days, specify + two days or greater for the retention of the weekly policy item. example: 5 required: - retentionUnit @@ -17314,7 +18513,7 @@ components: description: Internet Protocol (IP) addresses expressed in Classless Inter-Domain Routing (CIDR) notation of the VPC's subnet that you want to peer with the MongoDB Cloud VPC. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ statusName: type: string description: State of the network peering connection at the time you made the @@ -17385,6 +18584,13 @@ components: BaseStreamsRegion: type: string description: Name of the cloud provider region hosting Atlas Stream Processing. + BasicDBObject: + type: object + additionalProperties: + description: Fields to index for vector search. + title: Field + description: Fields to index for vector search. + title: Field BiConnector: type: object description: Settings needed to configure the MongoDB Connector for Business @@ -17757,6 +18963,8 @@ components: * GROUP_SEARCH_INDEX_EDITOR + * GROUP_STREAM_PROCESSING_OWNER + title: Role Assignment CloudAppUser: type: object @@ -17776,7 +18984,9 @@ components: emailAddress: type: string format: email + deprecated: true description: Email address that belongs to the MongoDB Cloud user. + readOnly: true firstName: type: string description: First or given name that belongs to the MongoDB Cloud user. @@ -18013,10 +19223,11 @@ components: $ref: "#/components/schemas/DatabaseUserRole" scopes: type: array - description: List that contains clusters and MongoDB Atlas Data Lakes that this - database user can access. If omitted, MongoDB Cloud grants the - database user access to all the clusters and MongoDB Atlas Data - Lakes in the project. + description: List that contains clusters, MongoDB Atlas Data Lakes, and MongoDB + Atlas Streams Instances that this database user can access. If + omitted, MongoDB Cloud grants the database user access to all the + clusters, MongoDB Atlas Data Lakes, and MongoDB Atlas Streams + Instances in the project. items: $ref: "#/components/schemas/UserScope" username: @@ -18413,7 +19624,7 @@ components: You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. **Example:** A project in an Amazon Web Services (AWS) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. - pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|(:{0,2}([0-9a-f]{1,4}:){0,7}[0-9a-f]{1,4}[:]{0,2}))((%2[fF]|/)[0-9]{1,3})+$ azureSubscriptionId: type: string description: Unique string that identifies the Azure subscription in which the @@ -18542,15 +19753,16 @@ components: type: string description: Physical location of your MongoDB cluster nodes. The region you choose can affect network latency for clients accessing your - databases. When MongoDB Cloud deploys a dedicated cluster, it checks - if a VPC or VPC connection exists for that provider and region. If - not, MongoDB Cloud creates them as part of the deployment. It - assigns the VPC a Classless Inter-Domain Routing (CIDR) block. To - limit a new VPC peering connection to one Classless Inter-Domain - Routing (CIDR) block and region, create the connection first. Deploy - the cluster after the connection starts. GCP Clusters and - Multi-region clusters require one VPC peering connection for each - region. MongoDB nodes can use only the peering connection that + databases. The region name is only returned in the response for + single-region clusters. When MongoDB Cloud deploys a dedicated + cluster, it checks if a VPC or VPC connection exists for that + provider and region. If not, MongoDB Cloud creates them as part of + the deployment. It assigns the VPC a Classless Inter-Domain Routing + (CIDR) block. To limit a new VPC peering connection to one Classless + Inter-Domain Routing (CIDR) block and region, create the connection + first. Deploy the cluster after the connection starts. GCP Clusters + and Multi-region clusters require one VPC peering connection for + each region. MongoDB nodes can use only the peering connection that resides in the same region as the nodes to communicate with the peered VPC. analyticsAutoScaling: @@ -18565,8 +19777,8 @@ components: type: string description: Cloud service provider on which MongoDB Cloud provisioned the multi-tenant cluster. The resource returns this parameter when - **providerSettings.providerName** is `TENANT` and - **providerSetting.instanceSizeName** is `M2` or `M5`. + **providerName** is `TENANT` and **electableSpecs.instanceSize** is + `M0`, `M2` or `M5`. title: Cloud Service Provider Settings for Multi-Cloud Clusters CloudSearchMetrics: type: object @@ -18638,7 +19850,6 @@ components: title: Automatic Cluster Scaling Settings ClusterCloudProviderInstanceSize: type: object - description: List of instances sizes that this cloud provider supports. properties: availableRegions: type: array @@ -18652,7 +19863,6 @@ components: description: Human-readable label that identifies the instance size or cluster tier. readOnly: true - readOnly: true ClusterComputeAutoScaling: type: object description: Collection of settings that configures how a cluster might scale @@ -18908,11 +20118,14 @@ components: failIndexKeyTooLong: type: boolean default: true + deprecated: true description: Flag that indicates whether you can insert or update documents where all indexed entries don't exceed 1024 bytes. If you set this to false, [mongod](https://docs.mongodb.com/upcoming/reference/program/mongod/#mongodb-binary-bin.mongod) - writes documents that exceed this limit but doesn't index them. + writes documents that exceed this limit but doesn't index them. This + parameter has been removed as of [MongoDB + 4.4](https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.failIndexKeyTooLong). externalDocs: description: This option corresponds to the `failIndexKeyTooLong` `mongod` configuration file option. @@ -18969,6 +20182,18 @@ components: description: This option corresponds to the `replication.oplogSizeMB` `mongod` configuration file option. url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-replication.oplogSizeMB + queryStatsLogVerbosity: + type: integer + format: int32 + default: 1 + description: May be set to 1 (disabled) or 3 (enabled). When set to 3, Atlas + will include redacted and anonymized $queryStats output in MongoDB + logs. $queryStats output does not contain literals or field values. + Enabling this setting might impact the performance of your cluster. + externalDocs: + description: This option corresponds to the queryStats component for the + logComponentVerbosity server parameter. + url: https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.logComponentVerbosity sampleRefreshIntervalBIConnector: type: integer format: int32 @@ -19011,6 +20236,33 @@ components: description: Collection of settings that configures how a cluster might scale its cluster tier and whether the cluster can scale down. title: Tenant + ClusterIPAddresses: + type: object + description: List of IP addresses in a cluster. + properties: + clusterName: + type: string + description: Human-readable label that identifies the cluster. + readOnly: true + inbound: + type: array + description: List of inbound IP addresses associated with the cluster. If your + network allows outbound HTTP requests only to specific IP addresses, + you must allow access to the following IP addresses so that your + application can connect to your Atlas cluster. + items: + type: string + readOnly: true + outbound: + type: array + description: List of outbound IP addresses associated with the cluster. If your + network allows inbound HTTP requests only from specific IP + addresses, you must allow access from the following IP addresses so + that your Atlas cluster can communicate with your webhooks and KMS. + items: + type: string + readOnly: true + title: Cluster IP Addresses ClusterOutageSimulation: type: object properties: @@ -19144,7 +20396,8 @@ components: default Input/Output Operations per Second (IOPS) rate for the selected volume size (`STANDARD`), or must fall within the allowable Input/Output Operations per Second (IOPS) range for the selected - volume size (`PROVISIONED`). + volume size (`PROVISIONED`). You must set this value to + (`PROVISIONED`) for NVMe clusters. diskTypeName: type: string description: Disk type that corresponds to the host's root volume for Azure @@ -19158,13 +20411,51 @@ components: description: Cloud service provider on which MongoDB Cloud provisioned the multi-tenant host. The resource returns this parameter when **providerSettings.providerName** is `TENANT` and - **providerSetting.instanceSizeName** is `M2` or `M5`. + **providerSetting.instanceSizeName** is `M0`, `M2` or `M5`. required: - providerName title: Cloud Service Provider Settings for a Cluster ClusterSearchIndex: type: object properties: + collectionName: + type: string + description: Human-readable label that identifies the collection that contains + one or more Atlas Search indexes. + database: + type: string + description: Human-readable label that identifies the database that contains the + collection with one or more Atlas Search indexes. + indexID: + type: string + description: Unique 24-hexadecimal digit string that identifies this Atlas + Search index. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + name: + type: string + description: Human-readable label that identifies this index. Within each + namespace, names of all indexes in the namespace must be unique. + status: + type: string + description: > + Condition of the search index when you made this request. + + + | Status | Index Condition | + |---|---| + | IN_PROGRESS | Atlas is building or re-building the index after an edit. | + | STEADY | You can use this search index. | + | FAILED | Atlas could not build the index. | + | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | + | PAUSED | The cluster is paused. | + readOnly: true + type: + type: string + description: Type of the index. Default type is search. analyzer: type: string default: lucene.standard @@ -19202,47 +20493,26 @@ components: url: https://docs.atlas.mongodb.com/atlas-search/analyzers/custom/ items: $ref: "#/components/schemas/ApiAtlasFTSAnalyzers" - collectionName: - type: string - description: Human-readable label that identifies the collection that contains - one or more Atlas Search indexes. - database: - type: string - description: Human-readable label that identifies the database that contains the - collection with one or more Atlas Search indexes. - indexID: - type: string - description: Unique 24-hexadecimal digit string that identifies this Atlas - Search index. - example: 32b6e34b3d91647abb20e7b8 - maxLength: 24 - minLength: 24 - pattern: ^([a-f0-9]{24})$ - readOnly: true mappings: $ref: "#/components/schemas/ApiAtlasFTSMappings" - name: - type: string - description: Human-readable label that identifies this index. Within each - namespace, names of all indexes in the namespace must be unique. searchAnalyzer: type: string default: lucene.standard description: Method applied to identify words when searching this index. - status: - type: string - description: > - Condition of the search index when you made this request. - - - | Status | Index Condition | - |---|---| - | IN_PROGRESS | Atlas is building or re-building the index after an edit. | - | STEADY | You can use this search index. | - | FAILED | Atlas could not build the index. | - | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | - | PAUSED | The cluster is paused. | - readOnly: true + storedSource: + type: object + description: Flag that indicates whether to store all fields (true) on Atlas + Search. By default, Atlas doesn't store (false) the fields on Atlas + Search. Alternatively, you can specify an object that only contains + the list of fields to store (include) or not store (exclude) on + Atlas Search. To learn more, see documentation. + example: + include | exclude: + - field1 + - field2 + externalDocs: + description: Stored Source Fields + url: https://dochub.mongodb.org/core/atlas-search-stored-source synonyms: type: array description: Rule sets that map words to their synonyms in this index. @@ -19251,6 +20521,16 @@ components: url: https://docs.atlas.mongodb.com/atlas-search/synonyms/ items: $ref: "#/components/schemas/SearchSynonymMappingDefinition" + fields: + type: array + description: Settings that configure the fields, one per object, to index. You + must define at least one "vector" type field. You can optionally + define "filter" type fields also. + externalDocs: + description: Vector Search Fields + url: https://dochub.mongodb.org/core/avs-vector-type + items: + $ref: "#/components/schemas/BasicDBObject" required: - collectionName - database @@ -19447,12 +20727,13 @@ components: properties: dataAccessIdentityProviderIds: type: array - description: The collection of unique ids of the identity providers for org's - data access. + description: The collection of unique ids representing the identity providers + that can be used for data access in this organization. items: type: string - description: Unique 24-hexadecimal digit string that identifies the id of the - identity provider for org's data access. + description: Unique 24-hexadecimal digit string that represents the id of the + identity providers that can be used for data access in this + organization. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -19471,8 +20752,11 @@ components: connected org. identityProviderId: type: string - description: Unique 20-hexadecimal digit string that identifies the identity - provider that this connected org config is associated with. + description: Legacy 20-hexadecimal digit string that identifies the UI access + identity provider that this connected org config is associated with. + This id can be found within the Federation Management Console > + Identity Providers tab by clicking the info icon in the IdP ID row + of a configured identity provider. maxLength: 20 minLength: 20 pattern: ^([a-f0-9]{20})$ @@ -19488,10 +20772,12 @@ components: postAuthRoleGrants: type: array description: Atlas roles that are granted to a user in this organization after - authenticating. + authenticating. Roles are a human-readable label that identifies the + collection of privileges that MongoDB Cloud grants a specific + MongoDB Cloud user. These roles can only be organization specific + roles. items: type: string - description: Organization role the user has in Atlas. uniqueItems: true roleMappings: type: array @@ -19507,8 +20793,16 @@ components: $ref: "#/components/schemas/FederatedUser" required: - domainRestrictionEnabled - - identityProviderId - orgId + ControlPlaneIPAddresses: + type: object + description: List of IP addresses in the Atlas control plane. + properties: + inbound: + $ref: "#/components/schemas/InboundControlPlaneCloudProviderIPAddresses" + outbound: + $ref: "#/components/schemas/OutboundControlPlaneCloudProviderIPAddresses" + title: Control Plane IP Addresses CostExplorerFilterRequestBody: type: object description: Request body for a cost explorer query. @@ -19574,6 +20868,7 @@ components: type: object CreateAtlasOrganizationApiKey: type: object + description: Details of the programmatic API key to be created. properties: desc: type: string @@ -19625,7 +20920,7 @@ components: type: string description: IPv4 address of the private endpoint in your Azure VNet that someone added to this private endpoint service. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ endpointGroupName: type: string description: Human-readable label that identifies a set of endpoints. @@ -19664,7 +20959,7 @@ components: type: string description: One Private Internet Protocol version 4 (IPv4) address to which this Google Cloud consumer forwarding rule resolves. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ writeOnly: true title: GCP Forwarding Rules CreateOrganizationRequest: @@ -19730,6 +21025,73 @@ components: readOnly: true organization: $ref: "#/components/schemas/AtlasOrganization" + CreatePushBasedLogExportProjectRequest: + type: object + properties: + bucketName: + type: string + description: The name of the bucket to which the agent will send the logs to. + iamRoleId: + type: string + description: ID of the AWS IAM role that will be used to write to the S3 bucket. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + prefixPath: + type: string + description: S3 directory in which vector will write to in order to store the + logs. An empty string denotes the root directory. + required: + - bucketName + - iamRoleId + - prefixPath + CustomZoneMappings: + type: object + properties: + customZoneMappings: + type: array + description: >- + List that contains comma-separated key value pairs to map zones to + geographic regions. These pairs map an ISO 3166-1a2 location code, + with an ISO 3166-2 subdivision code when possible, to the + human-readable label for the desired custom zone. MongoDB Cloud maps + the ISO 3166-1a2 code to the nearest geographical zone by default. + Include this parameter to override the default mappings. + + + This parameter returns an empty object if no custom zones exist. + items: + $ref: "#/components/schemas/ZoneMapping" + DBRoleToExecute: + type: object + description: The name of a Built in or Custom DB Role to connect to an Atlas Cluster. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + role: + type: string + description: The name of the role to use. Can be a built in role or a custom role. + type: + type: string + description: Type of the DB role. Can be either BuiltIn or Custom. + title: DB Role Type DBUserTLSX509Settings: type: object description: Settings to configure TLS Certificates for database users. @@ -19911,10 +21273,11 @@ components: properties: level: type: string - description: "[Read Concern - level](https://www.mongodb.com/docs/manual/reference/read-concern/#\ - read-concern-levels) that specifies the consistency and availability - of the data read." + description: Read Concern level that specifies the consistency and availability + of the data read. + externalDocs: + description: Read Concern Level + url: https://www.mongodb.com/docs/manual/reference/read-concern/#read-concern-levels DataLakeAtlasStoreReadPreference: type: object description: MongoDB Cloud cluster read preference, which describes how to route @@ -20111,6 +21474,8 @@ components: format: date-time description: Timestamp that indicates when the Data Lake Pipeline was created. readOnly: true + datasetRetentionPolicy: + $ref: "#/components/schemas/DatasetRetentionPolicy" groupId: type: string description: Unique 24-hexadecimal digit string that identifies the group. @@ -20325,25 +21690,40 @@ components: name: type: string description: Human-readable label that identifies the data lake. + privateEndpointHostnames: + type: array + description: List that contains the sets of private endpoints and hostnames. + items: + $ref: "#/components/schemas/PrivateEndpointHostname" + readOnly: true state: type: string description: Label that indicates the status of the Data Lake instance. readOnly: true storage: $ref: "#/components/schemas/DataLakeStorage" - DataProtectionSettings: + DataProtectionSettings20231001: type: object properties: authorizedEmail: type: string format: email - description: Email address of the user who authorized to updated the Backup + description: Email address of the user who authorized to update the Backup + Compliance Policy settings. + authorizedUserFirstName: + type: string + description: First name of the user who authorized to updated the Backup + Compliance Policy settings. + authorizedUserLastName: + type: string + description: Last name of the user who authorized to updated the Backup Compliance Policy settings. copyProtectionEnabled: type: boolean default: false - description: Flag that indicates whether to enable additional backup copies for - the cluster. If unspecified, this value defaults to false. + description: Flag that indicates whether to prevent cluster users from deleting + backups copied to other regions, even if those additional snapshot + regions are removed. If unspecified, this value defaults to false. encryptionAtRestEnabled: type: boolean default: false @@ -20354,7 +21734,7 @@ components: description: Encryption at Rest using Customer Key Management url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ onDemandPolicyItem: - $ref: "#/components/schemas/DiskBackupApiPolicyItem" + $ref: "#/components/schemas/BackupComplianceOnDemandPolicyItem" pitEnabled: type: boolean default: false @@ -20385,7 +21765,7 @@ components: type: array description: List that contains the specifications for one scheduled policy. items: - $ref: "#/components/schemas/DiskBackupApiPolicyItem" + $ref: "#/components/schemas/BackupComplianceScheduledPolicyItem" state: type: string description: Label that indicates the state of the Backup Compliance Policy @@ -20409,6 +21789,8 @@ components: readOnly: true required: - authorizedEmail + - authorizedUserFirstName + - authorizedUserLastName DatabaseInheritedRole: type: object description: Role inherited from another context for this database user. @@ -20549,6 +21931,29 @@ components: - databaseName - roleName title: Database User Role + DatasetRetentionPolicy: + type: object + description: Dataset Retention Policy for a Scheduled Data Lake Pipeline. + properties: + lastModifiedDate: + type: string + format: date-time + description: Date when retention policy was last modified. + readOnly: true + units: + type: string + description: Quantity of time in which the Data Lake Pipeline measures dataset + retention. + value: + type: integer + format: int32 + description: Number that indicates the amount of days, weeks, or months that the + Data Lake Pipeline will retain datasets. + minimum: 1 + required: + - units + - value + title: Dataset Retention Policy DedicatedHardwareSpec: type: object description: Hardware specifications for read-only nodes in the region. @@ -20596,7 +22001,7 @@ components: - `STANDARD` volume types can't exceed the default input/output operations per second (IOPS) rate for the selected volume size. - - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. + - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. You must set this value to (`PROVISIONED`) for NVMe clusters. instanceSize: type: string description: Hardware specification for the instance sizes in this region. Each @@ -20673,6 +22078,9 @@ components: `frequencyType`. + - In a yearly policy item, `1` indicates that the yearly snapshot occurs on the first day of January and `12` indicates the first day of December. + + - In a monthly policy item, `1` indicates that the monthly snapshot occurs on the first day of the month and `40` indicates the last day of the month. @@ -20701,8 +22109,8 @@ components: type: integer format: int32 description: >- - Duration in days, weeks, or months that MongoDB Cloud retains the - snapshot. For less frequent policy items, MongoDB Cloud requires + Duration in days, weeks, months, or years that MongoDB Cloud retains + the snapshot. For less frequent policy items, MongoDB Cloud requires that you specify a value greater than or equal to the value specified for more frequent policy items. @@ -21011,7 +22419,7 @@ components: storageSizeBytes: type: integer format: int64 - description: Number of bytes taken to store the backup snapshot. + description: Number of bytes taken to store the backup at time of snapshot. readOnly: true type: type: string @@ -21023,6 +22431,11 @@ components: type: object description: Details of the sharded cluster snapshot that MongoDB Cloud created. properties: + configServerType: + type: string + description: Human-readable label that identifies the config server type for + this snapshot. + readOnly: true createdAt: type: string format: date-time @@ -21128,7 +22541,7 @@ components: storageSizeBytes: type: integer format: int64 - description: Number of bytes taken to store the backup snapshot. + description: Number of bytes taken to store the backup at time of snapshot. readOnly: true type: type: string @@ -21244,7 +22657,7 @@ components: storageSizeBytes: type: integer format: int64 - description: Number of bytes taken to store the backup snapshot. + description: Number of bytes taken to store the backup at time of snapshot. readOnly: true type: type: string @@ -21270,6 +22683,11 @@ components: MongoDB Cloud took this snapshot. The resource returns this parameter when `"type": "replicaSet"`.' readOnly: true + configServerType: + type: string + description: Human-readable label that identifies the config server type for + this snapshot. + readOnly: true members: type: array description: 'List that includes the snapshots and the cloud provider that @@ -21318,8 +22736,10 @@ components: this snapshot. iamRoleId: type: string - description: Unique 24-hexadecimal character string that identifies the AWS IAM - role that MongoDB Cloud uses to access the AWS S3 bucket. + description: Unique 24-hexadecimal character string that identifies the Unified AWS Access role ID that MongoDB Cloud + uses to access the AWS S3 bucket. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -21504,6 +22924,12 @@ components: writeOnly: true export: $ref: "#/components/schemas/AutoExportPolicy" + extraRetentionSettings: + type: array + description: List that contains a document for each extra retention setting item + in the desired backup policy. + items: + $ref: "#/components/schemas/ExtraRetentionSetting" links: type: array description: List of one or more Uniform Resource Locators (URLs) that point to @@ -21705,7 +23131,7 @@ components: format in UTC. readOnly: true eventTypeName: - $ref: "#/components/schemas/ResourceEventType" + $ref: "#/components/schemas/StreamProcessorEventTypeViewForNdsGroup" groupId: type: string description: Unique 24-hexadecimal digit string that identifies the project in @@ -21765,7 +23191,7 @@ components: type: string description: IPv4 or IPv6 address from which the user triggered this event. example: 216.172.40.186 - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true userId: type: string @@ -21921,6 +23347,27 @@ components: type: string description: Unique identifier of resource type. example: cluster + instanceName: + type: string + description: Name of the stream processing instance associated with the event. + example: foobar + readOnly: true + processorErrorMsg: + type: string + description: Error message linked to the stream processor associated with the + event. + example: invalid auth + readOnly: true + processorName: + type: string + description: Name of the stream processor associated with the event. + example: foobar + readOnly: true + processorState: + type: string + description: State of the stream processor associated with the event. + example: FAILED + readOnly: true EventViewForOrg: type: object properties: @@ -22004,7 +23451,7 @@ components: type: string description: IPv4 or IPv6 address from which the user triggered this event. example: 216.172.40.186 - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true userId: type: string @@ -22115,6 +23562,17 @@ components: format: int32 description: Total number of collections on the replica set to export. readOnly: true + ExtraRetentionSetting: + type: object + description: extra retention setting item in the desired backup policy. + properties: + frequencyType: + type: string + description: The frequency type for the extra retention settings for the cluster. + retentionDays: + type: integer + format: int32 + description: The number of extra retention days for the cluster. FTSMetric: type: object description: Measurement of one Atlas Search status when MongoDB Atlas received @@ -22173,15 +23631,6 @@ components: FederationIdentityProvider: type: object properties: - acsUrl: - type: string - description: URL that points to where to send the SAML response. - associatedDomains: - type: array - description: List that contains the domains associated with the identity provider. - items: - type: string - uniqueItems: true associatedOrgs: type: array description: List that contains the connected organization configurations @@ -22189,23 +23638,62 @@ components: items: $ref: "#/components/schemas/ConnectedOrgConfig" uniqueItems: true - audienceUri: + createdAt: type: string - description: Unique string that identifies the intended audience of the SAML - assertion. + format: date-time + description: Date that the identity provider was created on. + readOnly: true + description: + type: string + description: The description of the identity provider. displayName: type: string description: Human-readable label that identifies the identity provider. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the identity + provider. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + idpType: + type: string + description: String enum that indicates the type of the identity provider. + Default is WORKFORCE. issuerUri: type: string - description: Unique string that identifies the issuer of the SAML Assertion. + description: Unique string that identifies the issuer of the SAML Assertion or + OIDC metadata/discovery document URL. oktaIdpId: type: string - description: Unique 20-hexadecimal digit string that identifies the identity + description: Legacy 20-hexadecimal digit string that identifies the identity provider. maxLength: 20 minLength: 20 pattern: ^([a-f0-9]{20})$ + protocol: + type: string + description: The protocol of the identity provider. Either SAML or OIDC. + updatedAt: + type: string + format: date-time + description: Date that the identity provider was last updated on. + readOnly: true + acsUrl: + type: string + description: URL that points to where to send the SAML response. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + audienceUri: + type: string + description: Unique string that identifies the intended audience of the SAML + assertion. pemFileInfo: $ref: "#/components/schemas/PemFileInfo" requestBinding: @@ -22217,6 +23705,9 @@ components: type: string description: Signature algorithm that Federated Authentication uses to encrypt the identity provider signature. + slug: + type: string + description: Custom SSO Url for the identity provider. ssoDebugEnabled: type: boolean description: Flag that indicates whether the identity provider has SSO debug @@ -22227,11 +23718,249 @@ components: status: type: string description: String enum that indicates whether the identity provider is active. - required: - - oktaIdpId - FieldTransformation: - type: object - description: Field Transformations during ingestion of a Data Lake Pipeline. + audience: + type: string + description: Identifier of the intended recipient of the token. + authorizationType: + type: string + description: Indicates whether authorization is granted based on group + membership or user ID. + clientId: + type: string + description: Client identifier that is assigned to an application by the + Identity Provider. + groupsClaim: + type: string + description: Identifier of the claim which contains IdP Group IDs in the token. + requestedScopes: + type: array + description: Scopes that MongoDB applications will request from the + authorization endpoint. + items: + type: string + userClaim: + type: string + description: Identifier of the claim which contains the user ID in the token. + required: + - id + - oktaIdpId + FederationIdentityProviderUpdate: + type: object + properties: + description: + type: string + description: The description of the identity provider. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + maxLength: 50 + minLength: 1 + idpType: + type: string + description: String enum that indicates the type of the identity provider. + Default is WORKFORCE. + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion or + OIDC metadata/discovery document URL. + example: urn:idp:default + protocol: + type: string + description: The protocol of the identity provider. Either SAML or OIDC. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + pemFileInfo: + $ref: "#/components/schemas/PemFileInfoUpdate" + requestBinding: + type: string + description: SAML Authentication Request Protocol HTTP method binding (POST or + REDIRECT) that Federated Authentication uses to send the + authentication request. + responseSignatureAlgorithm: + type: string + description: Signature algorithm that Federated Authentication uses to encrypt + the identity provider signature. + slug: + type: string + description: Custom SSO Url for the identity provider. + ssoDebugEnabled: + type: boolean + description: Flag that indicates whether the identity provider has SSO debug + enabled. + ssoUrl: + type: string + description: URL that points to the receiver of the SAML authentication request. + example: https://example.com + status: + type: string + description: String enum that indicates whether the identity provider is active. + audience: + type: string + description: Identifier of the intended recipient of the token. + authorizationType: + type: string + description: Indicates whether authorization is granted based on group + membership or user ID. + clientId: + type: string + description: Client identifier that is assigned to an application by the + Identity Provider. + groupsClaim: + type: string + description: Identifier of the claim which contains IdP Group IDs in the token. + requestedScopes: + type: array + description: Scopes that MongoDB applications will request from the + authorization endpoint. + items: + type: string + userClaim: + type: string + description: Identifier of the claim which contains the user ID in the token. + FederationOidcIdentityProvider: + type: object + properties: + associatedOrgs: + type: array + description: List that contains the connected organization configurations + associated with the identity provider. + items: + $ref: "#/components/schemas/ConnectedOrgConfig" + uniqueItems: true + audience: + type: string + description: Identifier of the intended recipient of the token. + authorizationType: + type: string + description: Indicates whether authorization is granted based on group + membership or user ID. + createdAt: + type: string + format: date-time + description: Date that the identity provider was created on. + readOnly: true + description: + type: string + description: The description of the identity provider. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + groupsClaim: + type: string + description: Identifier of the claim which contains IdP Group IDs in the token. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the identity + provider. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + idpType: + type: string + description: String enum that indicates the type of the identity provider. + Default is WORKFORCE. + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion or + OIDC metadata/discovery document URL. + oktaIdpId: + type: string + description: Legacy 20-hexadecimal digit string that identifies the identity + provider. + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + protocol: + type: string + description: The protocol of the identity provider. Either SAML or OIDC. + updatedAt: + type: string + format: date-time + description: Date that the identity provider was last updated on. + readOnly: true + userClaim: + type: string + description: Identifier of the claim which contains the user ID in the token. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + clientId: + type: string + description: Client identifier that is assigned to an application by the + Identity Provider. + requestedScopes: + type: array + description: Scopes that MongoDB applications will request from the + authorization endpoint. + items: + type: string + required: + - id + - oktaIdpId + FederationOidcIdentityProviderUpdate: + type: object + properties: + audience: + type: string + description: Identifier of the intended recipient of the token. + authorizationType: + type: string + description: Indicates whether authorization is granted based on group + membership or user ID. + description: + type: string + description: The description of the identity provider. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + maxLength: 50 + minLength: 1 + groupsClaim: + type: string + description: Identifier of the claim which contains IdP Group IDs in the token. + idpType: + type: string + description: String enum that indicates the type of the identity provider. + Default is WORKFORCE. + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion or + OIDC metadata/discovery document URL. + example: urn:idp:default + protocol: + type: string + description: The protocol of the identity provider. Either SAML or OIDC. + userClaim: + type: string + description: Identifier of the claim which contains the user ID in the token. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + clientId: + type: string + description: Client identifier that is assigned to an application by the + Identity Provider. + requestedScopes: + type: array + description: Scopes that MongoDB applications will request from the + authorization endpoint. + items: + type: string + FieldTransformation: + type: object + description: Field Transformations during ingestion of a Data Lake Pipeline. properties: field: type: string @@ -22256,7 +23985,7 @@ components: type: string description: One Private Internet Protocol version 4 (IPv4) address to which this Google Cloud consumer forwarding rule resolves. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true status: type: string @@ -22295,6 +24024,15 @@ components: items: $ref: "#/components/schemas/ManagedNamespaces" readOnly: true + selfManagedSharding: + type: boolean + description: Boolean that controls which management mode the Global Cluster is + operating under. If this parameter is true Self-Managed Sharding is + enabled and users are in control of the zone sharding within the + Global Cluster. If this parameter is false Atlas-Managed Sharding is + enabled and Atlas is control of zone sharding within the Global + Cluster. + readOnly: true GoogleCloudKMS: type: object description: Details that define the configuration of Encryption at Rest using @@ -22394,8 +24132,35 @@ components: pattern: ^([a-f0-9]{24})$ regionUsageRestrictions: type: string - default: NONE - description: Region usage restrictions that designate the project's AWS region. + default: COMMERCIAL_FEDRAMP_REGIONS_ONLY + description: >- + Applies to Atlas for Government only. + + + In Commercial Atlas, this field will be rejected in requests and missing in responses. + + + This field sets restrictions on available regions in the project. + + + | Value | Available Regions | + + |-----------------------------------|------------| + + | `COMMERCIAL_FEDRAMP_REGIONS_ONLY` | Only allows deployments in FedRAMP Moderate regions.| + + | `GOV_REGIONS_ONLY` | Only allows deployments in GovCloud regions.| + externalDocs: + url: https://www.mongodb.com/docs/atlas/government/overview/supported-regions/#supported-cloud-providers-and-regions + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the project. + externalDocs: + description: Resource Tags + url: https://www.mongodb.com/docs/atlas/tags + items: + $ref: "#/components/schemas/ResourceTag" withDefaultAlertsSettings: type: boolean description: Flag that indicates whether to create the project with default @@ -22423,7 +24188,7 @@ components: description: Flag that indicates whether someone enabled this alert configuration for the specified project. eventTypeName: - $ref: "#/components/schemas/ServerlessEventTypeViewAlertable" + $ref: "#/components/schemas/StreamProcessorEventTypeViewAlertable" groupId: type: string description: Unique 24-hexadecimal digit string that identifies the project that @@ -22518,9 +24283,13 @@ components: Alternatively: No matchers are available for these alert types. The list is always empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. items: - type: object - readOnly: true + $ref: "#/components/schemas/StreamsMatcher" notifications: type: array description: List that contains the targets that MongoDB Cloud sends @@ -22539,6 +24308,22 @@ components: $ref: "#/components/schemas/ServerlessMetricThreshold" threshold: $ref: "#/components/schemas/GreaterThanRawThreshold" + GroupIPAddresses: + type: object + description: List of IP addresses in a project. + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + services: + $ref: "#/components/schemas/GroupService" + title: Group IP Address GroupInvitation: type: object properties: @@ -22612,8 +24397,7 @@ components: properties: roles: type: array - description: One or more organization or project level roles to assign to the - MongoDB Cloud user. + description: One or more project level roles to assign to the MongoDB Cloud user. items: type: string uniqueItems: true @@ -22674,6 +24458,12 @@ components: for midnight and `12` for noon. maximum: 23 minimum: 0 + numberOfDeferrals: + type: integer + format: int32 + description: Number of times the current maintenance event for this project has + been deferred. + readOnly: true startASAP: type: boolean description: Flag that indicates whether MongoDB Cloud starts the maintenance @@ -22684,15 +24474,56 @@ components: maintenance. required: - dayOfWeek - - hourOfDay - GroupName: + GroupRole: type: object - description: Request view to update the group name. properties: - name: + groupId: type: string - description: Human-readable label that identifies the project included in the - MongoDB Cloud organization. + description: Unique 24-hexadecimal digit string that identifies the project to + which this role belongs. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + groupRole: + type: string + description: >+ + Human-readable label that identifies the collection of privileges + that MongoDB Cloud grants a specific API key, MongoDB Cloud user, or + MongoDB Cloud team. These roles include project-level roles. + + + Project Roles + + + * GROUP_CLUSTER_MANAGER + + * GROUP_DATA_ACCESS_ADMIN + + * GROUP_DATA_ACCESS_READ_ONLY + + * GROUP_DATA_ACCESS_READ_WRITE + + * GROUP_OWNER + + * GROUP_READ_ONLY + + * GROUP_SEARCH_INDEX_EDITOR + + * GROUP_STREAM_PROCESSING_OWNER + + GroupService: + type: object + description: List of IP addresses in a project categorized by services. + properties: + clusters: + type: array + description: IP addresses of clusters. + items: + $ref: "#/components/schemas/ClusterIPAddresses" + readOnly: true + readOnly: true + title: Group Service IP Addresses GroupSettings: type: object description: Collection of settings that configures the project. @@ -22721,6 +24552,23 @@ components: type: boolean description: Flag that indicates whether to enable the Schema Advisor for the specified project. + GroupUpdate: + type: object + description: Request view to update the group. + properties: + name: + type: string + description: Human-readable label that identifies the project included in the + MongoDB Cloud organization. + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the project. + externalDocs: + description: Resource Tags + url: https://www.mongodb.com/docs/atlas/tags + items: + $ref: "#/components/schemas/ResourceTag" HardwareSpec: type: object description: Hardware specifications for all electable nodes deployed in the @@ -22763,7 +24611,7 @@ components: - `STANDARD` volume types can't exceed the default input/output operations per second (IOPS) rate for the selected volume size. - - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. + - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. You must set this value to (`PROVISIONED`) for NVMe clusters. instanceSize: type: string description: Hardware specification for the instance sizes in this region. Each @@ -22776,13 +24624,77 @@ components: format: int32 description: Number of nodes of the given type for MongoDB Cloud to deploy to the region. - IndexOptions: + InboundControlPlaneCloudProviderIPAddresses: type: object - description: One or more settings that determine how the MongoDB Cloud creates - this MongoDB index. - externalDocs: - description: Index Options - url: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options + description: List of inbound IP addresses to the Atlas control plane, + categorized by cloud provider. If your application allows outbound HTTP + requests only to specific IP addresses, you must allow access to the + following IP addresses so that your API requests can reach the Atlas + control plane. + properties: + aws: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane IP + addresses in the AWS region. + items: + type: string + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane + IP addresses in the AWS region. + readOnly: true + readOnly: true + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane IP + addresses in the AWS region. + readOnly: true + azure: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + items: + type: string + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + readOnly: true + readOnly: true + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + readOnly: true + gcp: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP + addresses in the GCP region. + items: + type: string + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP + addresses in the GCP region. + readOnly: true + readOnly: true + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP addresses + in the GCP region. + readOnly: true + readOnly: true + title: Inbound Control Plane IP Addresses By Cloud Provider + IndexOptions: + type: object + description: One or more settings that determine how the MongoDB Cloud creates + this MongoDB index. + externalDocs: + description: Index Options + url: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options properties: 2dsphereIndexVersion: type: integer @@ -23017,6 +24929,8 @@ components: `dataSource` in a Federated Database collection. example: v1$atlas$snapshot$Cluster0$myDatabase$myCollection$19700101T000000Z readOnly: true + datasetRetentionPolicy: + $ref: "#/components/schemas/DatasetRetentionPolicy" groupId: type: string description: Unique 24-hexadecimal character string that identifies the project. @@ -23044,6 +24958,12 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ readOnly: true + scheduledDeletionDate: + type: string + format: date-time + description: Timestamp that indicates when the pipeline run will expire and its + dataset will be deleted. + readOnly: true snapshotId: type: string description: Unique 24-hexadecimal character string that identifies the snapshot @@ -23272,8 +25192,9 @@ components: authorization. Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query - according to [RFC 4515](https://tools.ietf.org/search/rfc4515) and - [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). + according to [RFC + 4515](https://datatracker.ietf.org/doc/html/rfc4515) and [RFC + 4516](https://datatracker.ietf.org/doc/html/rfc4516). example: "{USER}?memberOf?base" bindPassword: type: string @@ -23304,7 +25225,7 @@ components: Protocol (IP) address of the Lightweight Directory Access Protocol (LDAP) host. This host must have access to the internet or have a Virtual Private Cloud (VPC) peering connection to your cluster. - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ links: type: array description: List of one or more Uniform Resource Locators (URLs) that point to @@ -23398,81 +25319,326 @@ components: uses this parameter only for user authorization. - Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query per [RFC 4515](https://tools.ietf.org/search/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). - example: "{USER}?memberOf?base" - writeOnly: true - bindPassword: + Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query per [RFC 4515](https://datatracker.ietf.org/doc/html/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). + example: "{USER}?memberOf?base" + writeOnly: true + bindPassword: + type: string + description: Password that MongoDB Cloud uses to authenticate the + **bindUsername**. + writeOnly: true + bindUsername: + type: string + description: Full Distinguished Name (DN) of the Lightweight Directory Access + Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP + host. LDAP distinguished names must be formatted according to RFC + 2253. + example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + externalDocs: + description: RFC 2253 + url: https://tools.ietf.org/html/2253 + pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + caCertificate: + type: string + description: 'Certificate Authority (CA) certificate that MongoDB Cloud uses to + verify the identity of the Lightweight Directory Access Protocol + (LDAP) host. MongoDB Cloud allows self-signed certificates. To + delete an assigned value, pass an empty string: `"caCertificate": + ""`.' + hostname: + type: string + description: Human-readable label that identifies the hostname or Internet + Protocol (IP) address of the Lightweight Directory Access Protocol + (LDAP) host. This host must have access to the internet or have a + Virtual Private Cloud (VPC) peering connection to your cluster. + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + port: + type: integer + format: int32 + default: 636 + description: IANA port to which the Lightweight Directory Access Protocol (LDAP) + host listens for client connections. + required: + - bindPassword + - bindUsername + - hostname + - port + LDAPVerifyConnectivityJobRequestValidation: + type: object + description: One test that MongoDB Cloud runs to test verification of the + provided Lightweight Directory Access Protocol (LDAP) over Transport + Layer Security (TLS) configuration details. + properties: + status: + type: string + description: Human-readable string that indicates the result of this + verification test. + readOnly: true + validationType: + type: string + description: Human-readable label that identifies this verification test that + MongoDB Cloud runs. + readOnly: true + readOnly: true + LegacyAtlasCluster: + type: object + description: Group of settings that configure a MongoDB cluster. + properties: + acceptDataRisksAndForceReplicaSetReconfig: + type: string + format: date-time + description: If reconfiguration is necessary to regain a primary due to a + regional outage, submit this field alongside your topology + reconfiguration to request a new regional outage resistant topology. + Forced reconfigurations during an outage of the majority of + electable nodes carry a risk of data loss if replicated writes (even + majority committed writes) have not been replicated to the new + primary node. MongoDB Atlas docs contain more information. To + proceed with an operation which carries that risk, set + **acceptDataRisksAndForceReplicaSetReconfig** to the current date. + externalDocs: + description: Reconfiguring a Replica Set during a regional outage + url: https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set + autoScaling: + $ref: "#/components/schemas/ClusterAutoScalingSettings" + backupEnabled: + type: boolean + description: Flag that indicates whether the cluster can perform backups. If set + to `true`, the cluster can perform backups. You must set this value + to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated + clusters and Shared Cluster Backups for tenant clusters. If set to + `false`, the cluster doesn't use MongoDB Cloud backups. + biConnector: + $ref: "#/components/schemas/BiConnector" + clusterType: + type: string + description: Configuration of nodes that comprise the cluster. + connectionStrings: + $ref: "#/components/schemas/ClusterConnectionStrings" + createDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this serverless instance. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + diskSizeGB: + type: number + format: double + description: Storage capacity that the host's root volume possesses expressed in + gigabytes. Increase this number to add capacity. MongoDB Cloud + requires this parameter if you set **replicationSpecs**. If you + specify a disk size below the minimum (10 GB), this parameter + defaults to the minimum disk size value. Storage charge calculations + depend on whether you choose the default value or a custom + value. The maximum value for disk storage cannot exceed 50 times + the maximum RAM for the selected cluster. If you require more + storage space, consider upgrading your cluster to a higher tier. + maximum: 4096 + minimum: 10 + diskWarmingMode: + type: string + default: FULLY_WARMED + description: Disk warming mode selection. + externalDocs: + description: Reduce Secondary Disk Warming Impact + url: https://docs.atlas.mongodb.com/reference/replica-set-tags/#reduce-secondary-disk-warming-impact + encryptionAtRestProvider: + type: string + description: Cloud service provider that manages your customer keys to provide + an additional layer of Encryption at Rest for the cluster. + externalDocs: + description: Encryption at Rest using Customer Key Management + url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + labels: + type: array + deprecated: true + description: >- + Collection of key-value pairs between 1 to 255 characters in length + that tag and categorize the cluster. The MongoDB Cloud console + doesn't display your labels. + + + Cluster labels are deprecated and will be removed in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. + items: + $ref: "#/components/schemas/ComponentLabel" + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mongoDBMajorVersion: + type: string + default: "7.0" + description: Major MongoDB version of the cluster. MongoDB Cloud deploys the + cluster with the latest stable release of the specified version. + mongoDBVersion: + type: string + description: Version of MongoDB that the cluster runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + mongoURI: + type: string + description: Base connection string that you can use to connect to the cluster. + MongoDB Cloud displays the string only after the cluster starts, not + while it builds the cluster. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + mongoURIUpdated: + type: string + format: date-time + description: Date and time when someone last updated the connection string. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + mongoURIWithOptions: + type: string + description: Connection string that you can use to connect to the cluster + including the `replicaSet`, `ssl`, and `authSource` query parameters + with values appropriate for the cluster. You may need to add MongoDB + database users. The response returns this parameter once the cluster + can receive requests, not while it builds the cluster. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + name: + type: string + description: Human-readable label that identifies the cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + numShards: + type: integer + format: int32 + default: 1 + description: Number of shards up to 50 to deploy for a sharded cluster. The + resource returns `1` to indicate a replica set and values of `2` and + higher to indicate a sharded cluster. The returned value equals the + number of shards in the cluster. + externalDocs: + description: Sharding + url: https://docs.mongodb.com/manual/sharding/ + maximum: 50 + minimum: 1 + paused: + type: boolean + description: Flag that indicates whether the cluster is paused. + pitEnabled: + type: boolean + description: Flag that indicates whether the cluster uses continuous cloud + backups. + externalDocs: + description: Continuous Cloud Backups + url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ + providerBackupEnabled: + type: boolean + description: Flag that indicates whether the M10 or higher cluster can perform + Cloud Backups. If set to `true`, the cluster can perform backups. If + this and **backupEnabled** are set to `false`, the cluster doesn't + use MongoDB Cloud backups. + providerSettings: + $ref: "#/components/schemas/ClusterProviderSettings" + replicationFactor: + type: integer + format: int32 + default: 3 + deprecated: true + description: Number of members that belong to the replica set. Each member + retains a copy of your databases, providing high availability and + data redundancy. Use **replicationSpecs** instead. + replicationSpec: + type: object + additionalProperties: + $ref: "#/components/schemas/RegionSpec" + description: Physical location where MongoDB Cloud provisions cluster nodes. + title: Region Configuration + replicationSpecs: + type: array + description: >- + List of settings that configure your cluster regions. + + + - For Global Clusters, each object in the array represents one zone where MongoDB Cloud deploys your clusters nodes. + + - For non-Global sharded clusters and replica sets, the single object represents where MongoDB Cloud deploys your clusters nodes. + items: + $ref: "#/components/schemas/LegacyReplicationSpec" + rootCertType: type: string - description: Password that MongoDB Cloud uses to authenticate the - **bindUsername**. - writeOnly: true - bindUsername: + default: ISRGROOTX1 + description: Root Certificate Authority that MongoDB Atlas clusters uses. + MongoDB Cloud supports Internet Security Research Group. + srvAddress: type: string - description: Full Distinguished Name (DN) of the Lightweight Directory Access - Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP - host. LDAP distinguished names must be formatted according to RFC - 2253. - example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + description: Connection string that you can use to connect to the cluster. The + `+srv` modifier forces the connection to use Transport Layer + Security (TLS). The `mongoURI` parameter lists additional options. externalDocs: - description: RFC 2253 - url: https://tools.ietf.org/html/2253 - pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ - caCertificate: - type: string - description: 'Certificate Authority (CA) certificate that MongoDB Cloud uses to - verify the identity of the Lightweight Directory Access Protocol - (LDAP) host. MongoDB Cloud allows self-signed certificates. To - delete an assigned value, pass an empty string: `"caCertificate": - ""`.' - hostname: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + stateName: type: string - description: Human-readable label that identifies the hostname or Internet - Protocol (IP) address of the Lightweight Directory Access Protocol - (LDAP) host. This host must have access to the internet or have a - Virtual Private Cloud (VPC) peering connection to your cluster. - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ - links: + description: Human-readable label that indicates the current operating condition + of the cluster. + readOnly: true + tags: type: array - description: List of one or more Uniform Resource Locators (URLs) that point to - API sub-resources, related API resources, or both. RFC 5988 outlines - these relationships. + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the cluster. externalDocs: - description: Web Linking Specification (RFC 5988) - url: https://datatracker.ietf.org/doc/html/rfc5988 + description: Resource Tags + url: https://dochub.mongodb.org/core/add-cluster-tag-atlas items: - $ref: "#/components/schemas/Link" - readOnly: true - port: - type: integer - format: int32 - default: 636 - description: IANA port to which the Lightweight Directory Access Protocol (LDAP) - host listens for client connections. - required: - - bindPassword - - bindUsername - - hostname - - port - LDAPVerifyConnectivityJobRequestValidation: - type: object - description: One test that MongoDB Cloud runs to test verification of the - provided Lightweight Directory Access Protocol (LDAP) over Transport - Layer Security (TLS) configuration details. - properties: - status: - type: string - description: Human-readable string that indicates the result of this - verification test. - readOnly: true - validationType: + $ref: "#/components/schemas/ResourceTag" + terminationProtectionEnabled: + type: boolean + default: false + description: Flag that indicates whether termination protection is enabled on + the cluster. If set to `true`, MongoDB Cloud won't delete the + cluster. If set to `false`, MongoDB Cloud will delete the cluster. + versionReleaseSystem: type: string - description: Human-readable label that identifies this verification test that - MongoDB Cloud runs. - readOnly: true - readOnly: true - LegacyAtlasCluster: + default: LTS + description: Method by which the cluster maintains the MongoDB versions. If + value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. + title: Cluster Description + LegacyAtlasTenantClusterUpgradeRequest: type: object - description: Group of settings that configure a MongoDB cluster. + description: Request containing target state of tenant cluster to be upgraded properties: acceptDataRisksAndForceReplicaSetReconfig: type: string @@ -23525,6 +25691,13 @@ components: storage space, consider upgrading your cluster to a higher tier. maximum: 4096 minimum: 10 + diskWarmingMode: + type: string + default: FULLY_WARMED + description: Disk warming mode selection. + externalDocs: + description: Reduce Secondary Disk Warming Impact + url: https://docs.atlas.mongodb.com/reference/replica-set-tags/#reduce-secondary-disk-warming-impact encryptionAtRestProvider: type: string description: Cloud service provider that manages your customer keys to provide @@ -23550,13 +25723,14 @@ components: readOnly: true labels: type: array + deprecated: true description: >- Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels. - Cluster labels will be deprecated in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. + Cluster labels are deprecated and will be removed in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. items: $ref: "#/components/schemas/ComponentLabel" links: @@ -23572,7 +25746,7 @@ components: readOnly: true mongoDBMajorVersion: type: string - default: "6.0" + default: "7.0" description: Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version. mongoDBVersion: @@ -23706,7 +25880,9 @@ components: default: LTS description: Method by which the cluster maintains the MongoDB versions. If value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. - title: Cluster Description + required: + - name + title: Tenant Cluster Upgrade Request LegacyReplicationSpec: type: object properties: @@ -23729,12 +25905,15 @@ components: type: integer format: int32 default: 1 - description: Positive integer that specifies the number of shards to deploy in + description: >- + Positive integer that specifies the number of shards to deploy in each specified zone If you set this value to `1` and **clusterType** is `SHARDED`, MongoDB Cloud deploys a single-shard sharded cluster. Don't create a sharded cluster with a single shard for production environments. Single-shard sharded clusters don't provide the same benefits as multi-shard configurations. + + If you are upgrading a replica set to a sharded cluster, you cannot increase the number of shards in the same update request. You should wait until after the cluster has completed upgrading to sharded and you have reconnected all application clients to the MongoDB router before adding additional shards. Otherwise, your data might become inconsistent once MongoDB Cloud begins distributing data across shards. regionsConfig: type: object additionalProperties: @@ -23874,6 +26053,8 @@ components: example: vm001.example.com maxItems: 1 minItems: 1 + sharding: + $ref: "#/components/schemas/ShardingRequest" source: $ref: "#/components/schemas/Source" required: @@ -23907,7 +26088,7 @@ components: description: One host running a MongoDB Agent. This Agent can transfer your MongoDB data between one source and one target cluster. example: vm001.example.com - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ readOnly: true readyForCutover: type: boolean @@ -24016,6 +26197,160 @@ components: description: Human-readable label of the disk or partition to which the measurements apply. readOnly: true + MeasurementsCollStatsLatencyCluster: + type: object + properties: + clusterId: + type: string + description: Unique identifier for Clusters. + readOnly: true + clusterView: + type: string + description: Cluster topology view. + readOnly: true + collectionName: + type: string + description: Human-readable label that identifies the collection. + readOnly: true + databaseName: + type: string + description: Human-readable label that identifies the database that the + specified MongoDB process serves. + readOnly: true + end: + type: string + format: date-time + description: Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + measurements: + type: array + description: List that contains measurements and their data points. + items: + $ref: "#/components/schemas/MetricsMeasurement" + readOnly: true + processId: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + MeasurementsCollStatsLatencyHost: + type: object + properties: + collectionName: + type: string + description: Human-readable label that identifies the collection. + readOnly: true + databaseName: + type: string + description: Human-readable label that identifies the database that the + specified MongoDB process serves. + readOnly: true + end: + type: string + format: date-time + description: Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + measurements: + type: array + description: List that contains measurements and their data points. + items: + $ref: "#/components/schemas/MetricsMeasurement" + readOnly: true + processId: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true MeasurementsIndexes: type: object properties: @@ -24298,7 +26633,7 @@ components: type: string description: Internet Protocol address that attempted to authenticate with the database. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true logLine: type: string @@ -24351,6 +26686,21 @@ components: $ref: "#/components/schemas/NamespaceObj" readOnly: true uniqueItems: true + NamespacesRequest: + type: object + properties: + namespaces: + type: array + description: List of namespace strings (combination of database and collection) + on the specified host or cluster. + items: + type: string + description: Human-readable label that identifies the namespace on the specified + host or cluster. The resource expresses this parameter value as + `.`. + writeOnly: true + uniqueItems: true + writeOnly: true NetworkPermissionEntry: type: object properties: @@ -24364,7 +26714,7 @@ components: an IP access list. You cannot set AWS security groups as temporary access list entries. Don't set this parameter if you set **cidrBlock** or **ipAddress**. - pattern: ^([0-9]*\/)?sg-([0-9]*) + pattern: ^([0-9]*/)?sg-([0-9]*) cidrBlock: type: string description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) @@ -24404,7 +26754,7 @@ components: Your IP access list entry can be one **awsSecurityGroup**, one **cidrBlock**, or one **ipAddress**. Don't set this parameter if you set **awsSecurityGroup** or **cidrBlock**. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ links: type: array description: List of one or more Uniform Resource Locators (URLs) that point to @@ -24525,7 +26875,7 @@ components: readOnly: true identityProviderId: type: string - description: Unique 20-hexadecimal digit string that identifies the identity + description: Legacy 20-hexadecimal digit string that identifies the identity provider connected to this organization. example: c2777a9eca931f29fc2f maxLength: 20 @@ -24600,9 +26950,16 @@ components: description: Date and time when the invitation from MongoDB Cloud expires. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true + groupRoleAssignments: + type: array + description: List of projects that the user will be added to when they accept + their invitation to the organization. + items: + $ref: "#/components/schemas/GroupRole" + uniqueItems: true id: type: string - description: Unique 24-hexadecimal digit string that identifies this organization. + description: Unique 24-hexadecimal digit string that identifies this invitation. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -24639,8 +26996,8 @@ components: pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ roles: type: array - description: One or more organization or project level roles to assign to the - MongoDB Cloud user. + description: One or more organization level roles to assign to the MongoDB Cloud + user. items: type: string uniqueItems: true @@ -24664,13 +27021,36 @@ components: organization. required: - orgName + OrganizationInvitationGroupRoleAssignmentsRequest: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project to + which these roles belong. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + roles: + type: array + description: One or more project level roles to assign to the MongoDB Cloud user. + items: + type: string + uniqueItems: true OrganizationInvitationRequest: type: object properties: + groupRoleAssignments: + type: array + description: List of projects that the user will be added to when they accept + their invitation to the organization. + items: + $ref: "#/components/schemas/OrganizationInvitationGroupRoleAssignmentsRequest" roles: type: array - description: One or more organization or project level roles to assign to the - MongoDB Cloud user. + description: One or more organization level roles to assign to the MongoDB Cloud + user. items: type: string uniqueItems: true @@ -24693,10 +27073,16 @@ components: OrganizationInvitationUpdateRequest: type: object properties: + groupRoleAssignments: + type: array + description: List of projects that the user will be added to when they accept + their invitation to the organization. + items: + $ref: "#/components/schemas/OrganizationInvitationGroupRoleAssignmentsRequest" roles: type: array - description: One or more organization or project level roles to assign to the - MongoDB Cloud user. + description: One or more organization level roles to assign to the MongoDB Cloud + user. items: type: string uniqueItems: true @@ -24737,6 +27123,98 @@ components: the Atlas deployment to resolve support issues. To learn more, see: https://www.mongodb.com/docs/atlas/security-restrict-support-access\ /." + OutboundControlPlaneCloudProviderIPAddresses: + type: object + description: List of outbound IP addresses from the Atlas control plane, + categorized by cloud provider. If your network allows inbound HTTP + requests only from specific IP addresses, you must allow access from the + following IP addresses so that Atlas can communicate with your webhooks + and KMS. + properties: + aws: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane IP + addresses in the AWS region. + items: + type: string + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane + IP addresses in the AWS region. + readOnly: true + readOnly: true + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane IP + addresses in the AWS region. + readOnly: true + azure: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + items: + type: string + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + readOnly: true + readOnly: true + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + readOnly: true + gcp: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP + addresses in the GCP region. + items: + type: string + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP + addresses in the GCP region. + readOnly: true + readOnly: true + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP addresses + in the GCP region. + readOnly: true + readOnly: true + title: Outbound Control Plane IP Addresses By Cloud Provider + PaginatedFederationIdentityProvider: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/FederationIdentityProvider" + readOnly: true + totalCount: + type: integer + format: int32 + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. + minimum: 0 + readOnly: true PaginatedHostView_Atlas: type: object properties: @@ -24761,19 +27239,34 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PemFileInfo: type: object - description: PEM file information for the identity provider's certificates. + description: PEM file information for the identity provider's current certificates. properties: certificates: type: array + description: List of certificates in the file. items: $ref: "#/components/schemas/X509Certificate" fileName: type: string + description: Human-readable label given to the file. + PemFileInfoUpdate: + type: object + description: PEM file information for the identity provider's current certificates. + properties: + certificates: + type: array + description: List of certificates in the file. + items: + $ref: "#/components/schemas/X509CertificateUpdate" + fileName: + type: string + description: Human-readable label given to the file. PerformanceAdvisorIndex: type: object properties: @@ -24950,6 +27443,28 @@ components: items: $ref: "#/components/schemas/PerformanceAdvisorSlowQuery" readOnly: true + PinnedNamespaces: + type: object + description: Pinned namespaces view for cluster + properties: + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the request + cluster. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the request + project. + readOnly: true + pinnedNamespaces: + type: array + description: List of all pinned namespaces. + items: + type: string + description: A single pinned namespace. + readOnly: true + readOnly: true PipelineRunStats: type: object description: Runtime statistics for this Data Lake Pipeline run. @@ -24966,6 +27481,19 @@ components: readOnly: true readOnly: true title: Data Lake Pipeline Run Statistics + PrivateEndpointHostname: + type: object + description: Set of Private endpoint and hostnames. + properties: + hostname: + type: string + description: Human-readable label that identifies the hostname. + readOnly: true + privateEndpoint: + type: string + description: Human-readable label that identifies private endpoint. + readOnly: true + readOnly: true PrivateLinkEndpoint: type: object properties: @@ -24998,6 +27526,34 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ readOnly: true + privateEndpointConnectionName: + type: string + description: Human-readable label that MongoDB Cloud generates that identifies + the private endpoint connection. + pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]([-\w._()]+)%2[fF]([-\w._()]+) + readOnly: true + privateEndpointIPAddress: + type: string + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ + privateEndpointResourceId: + type: string + description: Unique string that identifies the Azure private endpoint's network + interface that someone added to this private endpoint service. + example: /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln + readOnly: true + status: + type: string + description: >- + State of the Azure Private Link Service connection when MongoDB + Cloud received this request. + + + Alternatively: + + State of the Google Cloud network endpoint group when MongoDB Cloud received this request. + readOnly: true endpointGroupName: type: string description: Human-readable label that identifies a set of endpoints. @@ -25015,34 +27571,6 @@ components: items: $ref: "#/components/schemas/GCPConsumerForwardingRule" readOnly: true - status: - type: string - description: >- - State of the Google Cloud network endpoint group when MongoDB Cloud - received this request. - - - Alternatively: - - State of the Azure Private Link Service connection when MongoDB Cloud received this request. - readOnly: true - privateEndpointConnectionName: - type: string - description: Human-readable label that MongoDB Cloud generates that identifies - the private endpoint connection. - pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]([-\w._()]+)%2[fF]([-\w._()]+) - readOnly: true - privateEndpointIPAddress: - type: string - description: IPv4 address of the private endpoint in your Azure VNet that - someone added to this private endpoint service. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ - privateEndpointResourceId: - type: string - description: Unique string that identifies the Azure private endpoint's network - interface that someone added to this private endpoint service. - example: /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln - readOnly: true required: - cloudProvider PrivateNetworkEndpointIdEntry: @@ -25051,6 +27579,9 @@ components: comment: type: string description: Human-readable string to associate with this private endpoint. + customerEndpointDNSName: + type: string + description: Human-readable label to identify customer's VPC endpoint DNS name. endpointId: type: string description: Unique 22-character alphanumeric string that identifies the private @@ -25068,6 +27599,10 @@ components: default: AWS description: Human-readable label that identifies the cloud service provider. Atlas Data Lake supports Amazon Web Services only. + region: + type: string + description: Human-readable label to identify the region of customer's VPC + endpoint. type: type: string default: DATA_LAKE @@ -25103,11 +27638,12 @@ components: prefixPath: type: string description: S3 directory in which vector will write to in order to store the - logs. + logs. An empty string denotes the root directory. state: type: string description: Describes whether or not the feature is enabled and what status it is in. + readOnly: true RawMetricUnits: type: string default: RAW @@ -25169,12 +27705,15 @@ components: numShards: type: integer format: int32 - description: Positive integer that specifies the number of shards to deploy in + description: >- + Positive integer that specifies the number of shards to deploy in each specified zone. If you set this value to `1` and **clusterType** is `SHARDED`, MongoDB Cloud deploys a single-shard sharded cluster. Don't create a sharded cluster with a single shard for production environments. Single-shard sharded clusters don't provide the same benefits as multi-shard configurations. + + If you are upgrading a replica set to a sharded cluster, you cannot increase the number of shards in the same update request. You should wait until after the cluster has completed upgrading to sharded and you have reconnected all application clients to the MongoDB router before adding additional shards. Otherwise, your data might become inconsistent once MongoDB Cloud begins distributing data across shards. minimum: 1 regionConfigs: type: array @@ -25228,6 +27767,9 @@ components: `production` in the `environment : production` tag." maxLength: 255 minLength: 1 + required: + - key + - value title: Resource Tag RestoreJobFileHash: type: object @@ -25294,82 +27836,35 @@ components: * ORG_OWNER - - * ORG_MEMBER - - * ORG_GROUP_CREATOR - - * ORG_BILLING_ADMIN - - * ORG_READ_ONLY - - - Project Roles - - - * GROUP_CLUSTER_MANAGER - - * GROUP_DATA_ACCESS_ADMIN - - * GROUP_DATA_ACCESS_READ_ONLY - - * GROUP_DATA_ACCESS_READ_WRITE - - * GROUP_OWNER - - * GROUP_READ_ONLY - - * GROUP_SEARCH_INDEX_EDITOR - - SamlIdentityProviderUpdate: - type: object - properties: - associatedDomains: - type: array - description: List that contains the domains associated with the identity provider. - items: - type: string - uniqueItems: true - description: - type: string - description: The description for the identity provider. - displayName: - type: string - description: Human-readable label that identifies the identity provider. - maxLength: 50 - minLength: 1 - issuerUri: - type: string - description: Unique string that identifies the issuer of the SAML Assertion. - example: urn:idp:default - pemFileInfo: - $ref: "#/components/schemas/PemFileInfo" - protocol: - type: string - description: The protocol for the identity provider. - requestBinding: - type: string - description: SAML Authentication Request Protocol HTTP method binding (POST or - REDIRECT) that Federated Authentication uses to send the - authentication request. - responseSignatureAlgorithm: - type: string - description: Signature algorithm that Federated Authentication uses to encrypt - the identity provider signature. - ssoDebugEnabled: - type: boolean - description: Flag that indicates whether the identity provider has SSO debug - enabled. - ssoUrl: - type: string - description: Unique string that identifies the intended audience of the SAML - assertion. - example: https://example.com - status: - type: string - description: String enum that indicates whether the identity provider is active. - required: - - ssoDebugEnabled + + * ORG_MEMBER + + * ORG_GROUP_CREATOR + + * ORG_BILLING_ADMIN + + * ORG_READ_ONLY + + + Project Roles + + + * GROUP_CLUSTER_MANAGER + + * GROUP_DATA_ACCESS_ADMIN + + * GROUP_DATA_ACCESS_READ_ONLY + + * GROUP_DATA_ACCESS_READ_WRITE + + * GROUP_OWNER + + * GROUP_READ_ONLY + + * GROUP_SEARCH_INDEX_EDITOR + + * GROUP_STREAM_PROCESSING_OWNER + SampleDatasetStatus: type: object properties: @@ -25668,11 +28163,6 @@ components: description: MongoDB process type to which your application connects. readOnly: true title: Serverless Instance Private Endpoint Connection String - ServerlessEventTypeViewAlertable: - type: string - description: Event type that triggers an alert. - example: OUTSIDE_SERVERLESS_METRIC_THRESHOLD - title: Serverless Event Types ServerlessInstanceDescription: type: object description: Group of settings that configure a MongoDB serverless instance. @@ -25922,7 +28412,7 @@ components: Alternatively: Unique string that identifies the Azure private endpoint's network interface that someone added to this private endpoint service. - pattern: ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + pattern: ^/subscriptions/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/resource[gG]roups/private[Ll]ink/providers/Microsoft\.Network/privateEndpoints/[-\w._()]+$ readOnly: true comment: type: string @@ -25964,9 +28454,7 @@ components: type: string description: IPv4 address of the private endpoint in your Azure VNet that someone added to this private endpoint service. - maxLength: 24 - minLength: 24 - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true privateLinkServiceResourceId: type: string @@ -25998,16 +28486,75 @@ components: Alternatively: Unique string that identifies the Azure private endpoint's network interface for this private endpoint service. - pattern: ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + pattern: ^/subscriptions/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/resource[gG]roups/private[Ll]ink/providers/Microsoft\.Network/privateEndpoints/[-\w._()]+$ writeOnly: true privateEndpointIpAddress: type: string description: IPv4 address of the private endpoint in your Azure VNet that someone added to this private endpoint service. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ writeOnly: true required: - providerName + ShardEntry: + type: object + description: Sharding configuration for a collection to be sharded on the + destination cluster. + properties: + collection: + type: string + description: Human-readable label that identifies the collection to be sharded + on the destination cluster. + writeOnly: true + database: + type: string + description: Human-readable label that identifies the database that contains the + collection to be sharded on the destination cluster. + writeOnly: true + shardCollection: + $ref: "#/components/schemas/ShardKeys" + required: + - collection + - database + - shardCollection + ShardKeys: + type: object + description: Document that configures the shard key on the destination cluster. + properties: + key: + type: array + description: List of fields to use for the shard key. + items: + type: object + additionalProperties: {} + uniqueItems: true + writeOnly: true + writeOnly: true + ShardingRequest: + type: object + description: Document that configures sharding on the destination cluster when + migrating from a replica set source to a sharded cluster destination on + MongoDB 6.0 or higher. If you don't wish to shard any collections on the + destination cluster, leave this empty. + properties: + createSupportingIndexes: + type: boolean + description: Flag that lets the migration create supporting indexes for the + shard keys, if none exists, as the destination cluster also needs + compatible indexes for the specified shard keys. + writeOnly: true + shardingEntries: + type: array + description: List of shard configurations to shard destination collections. + Atlas shards only those collections that you include in the sharding + entries array. + items: + $ref: "#/components/schemas/ShardEntry" + uniqueItems: true + writeOnly: true + required: + - createSupportingIndexes + writeOnly: true Source: type: object description: Document that describes the source of the migration. @@ -26049,6 +28596,36 @@ components: - groupId - managedAuthentication - ssl + StreamConfig: + type: object + description: Configuration options for an Atlas Stream Processing Instance. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + tier: + type: string + description: Selected tier for the Stream Instance. Configures Memory / VCPU + allowances. + title: Stream Instance Tier + StreamProcessorEventTypeViewAlertable: + type: string + description: Event type that triggers an alert. + example: STREAM_PROCESSOR_STATE_IS_FAILED + title: Stream Processor Event Types + StreamProcessorEventTypeViewForNdsGroup: + type: string + description: Unique identifier of event type. + example: STREAM_PROCESSOR_STATE_IS_FAILED + title: Stream Processor Event Types StreamsConnection: type: object description: Settings that define a connection to an external data store. @@ -26066,13 +28643,16 @@ components: readOnly: true name: type: string - description: Human-readable label that identifies the stream connection. + description: Human-readable label that identifies the stream connection. In the + case of the Sample type, this is the name of the sample source. type: type: string description: Type of the connection. Can be either Cluster or Kafka. clusterName: type: string description: Name of the cluster configured for this connection. + dbRoleToExecute: + $ref: "#/components/schemas/DBRoleToExecute" authentication: $ref: "#/components/schemas/StreamsKafkaAuthentication" bootstrapServers: @@ -26095,6 +28675,8 @@ components: readOnly: true StreamsDataProcessRegion: type: object + description: Information about the cloud provider region in which MongoDB Cloud + processes the stream. properties: cloudProvider: type: string @@ -26168,6 +28750,33 @@ components: protocol: type: string description: Describes the transport type. Can be either PLAINTEXT or SSL. + StreamsMatcher: + type: object + description: Rules to apply when comparing a stream processing instance or + stream processor against this alert configuration. + properties: + fieldName: + $ref: "#/components/schemas/StreamsMatcherField" + operator: + type: string + description: Comparison operator to apply when checking the current metric value + against **matcher[n].value**. + value: + type: string + description: Value to match or exceed using the specified **matchers.operator**. + example: event-replica-set + required: + - fieldName + - operator + - value + title: Matchers + StreamsMatcherField: + type: string + description: Name of the parameter in the target object that MongoDB Cloud + checks. The parameter must match all rules for MongoDB Cloud to check + for alert configurations. + example: INSTANCE_NAME + title: Streams Matcher Fields StreamsTenant: type: object properties: @@ -26217,6 +28826,8 @@ components: name: type: string description: Human-readable label that identifies the stream instance. + streamConfig: + $ref: "#/components/schemas/StreamConfig" SynonymSource: type: object description: Data set that stores the mapping one or more words map to one or @@ -26372,6 +28983,26 @@ components: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ + TeamUpdate: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + name: + type: string + description: Human-readable label that identifies the team. + writeOnly: true + required: + - name TenantRestore: type: object properties: @@ -26482,10 +29113,13 @@ components: required: - snapshotId - targetDeploymentItemName - ThridPartyIntegration: + ThirdPartyIntegration: type: object description: Collection of settings that describe third-party integrations. properties: + id: + type: string + description: Integration id. type: type: string description: >- @@ -26652,31 +29286,14 @@ components: type: boolean description: Flag that indicates whether someone has activated the Prometheus integration. - listenAddress: - type: string - default: :9216 - description: Combination of IPv4 address and Internet Assigned Numbers Authority - (IANA) port or the IANA port alone to which Prometheus binds to - ingest MongoDB metrics. password: type: string + description: Password needed to allow MongoDB Cloud to access your Prometheus + account. writeOnly: true - rateLimitInterval: - type: integer - format: int32 - writeOnly: true - scheme: - type: string - description: Security Scheme to apply to HyperText Transfer Protocol (HTTP) - traffic between Prometheus and MongoDB Cloud. serviceDiscovery: type: string description: Desired method to discover the Prometheus service. - tlsPemPath: - type: string - description: Root-relative path to the Transport Layer Security (TLS) Privacy - Enhanced Mail (PEM) key and certificate file on the host. - example: /path/to/file username: type: string description: Human-readable label that identifies your Prometheus incoming @@ -26737,6 +29354,8 @@ components: TriggerIngestionPipelineRequest: type: object properties: + datasetRetentionPolicy: + $ref: "#/components/schemas/DatasetRetentionPolicy" snapshotId: type: string description: Unique 24-hexadecimal character string that identifies the snapshot. @@ -26834,7 +29453,7 @@ components: items: type: string uniqueItems: true - UserAccessList: + UserAccessListRequest: type: object properties: cidrBlock: @@ -26845,6 +29464,24 @@ components: Protocol version 4 or version 6 addresses. You can set a value for this parameter or **ipAddress** but not both in the same request. example: 203.0.113.0/24 + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|(:{0,2}([0-9a-f]{1,4}:){0,7}[0-9a-f]{1,4}[:]{0,2}))((%2[fF]|/)[0-9]{1,3})+$ + ipAddress: + type: string + description: Network address that you want to add to the access list for the API + key. This parameter requires the address to be expressed as one + Internet Protocol version 4 or version 6 address. You can set a + value for this parameter or **cidrBlock** but not both in the same + request. + example: 203.0.113.10 + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ + UserAccessListResponse: + type: object + properties: + cidrBlock: + type: string + description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) + notation in the access list for the API key. + example: 203.0.113.0/24 pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ count: type: integer @@ -26863,11 +29500,7 @@ components: readOnly: true ipAddress: type: string - description: Network address that you want to add to the access list for the API - key. This parameter requires the address to be expressed as one - Internet Protocol version 4 or version 6 address. You can set a - value for this parameter or **cidrBlock** but not both in the same - request. + description: Network address in the access list for the API key. example: 203.0.113.10 pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ lastUsed: @@ -27064,16 +29697,47 @@ components: - match title: User to Distinguished Name Mapping X509Certificate: + type: object + properties: + notAfter: + type: string + format: date-time + description: Latest date that the certificate is valid. + notBefore: + type: string + format: date-time + description: Earliest date that the certificate is valid. + X509CertificateUpdate: type: object properties: content: type: string + description: Certificate content. notAfter: type: string format: date-time + description: Latest date that the certificate is valid. notBefore: type: string format: date-time + description: Earliest date that the certificate is valid. + ZoneMapping: + type: object + description: Human-readable label that identifies the subset of a global cluster. + properties: + location: + type: string + description: Code that represents a location that maps to a zone in your global + cluster. MongoDB Cloud represents this location with a ISO 3166-2 + location and subdivision codes when possible. + zone: + type: string + description: Human-readable label that identifies the zone in your global + cluster. This zone maps to a location code. + required: + - location + - zone + title: Global Cluster Zone raw: type: object description: Additional meta information captured about this event. The response @@ -27147,6 +29811,7 @@ components: minLength: 1 severity: type: string + description: Severity of the event. readOnly: true AWSCustomDNSEnabled: type: object @@ -27171,12 +29836,12 @@ components: type: string description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) notation that found in this project's access list. - pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|(:{0,2}([0-9a-f]{1,4}:){0,7}[0-9a-f]{1,4}[:]{0,2}))((%2[fF]|/)[0-9]{1,3})+$ readOnly: true ipAddress: type: string description: IP address included in the API access list. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true required: - ipAddress @@ -27383,6 +30048,65 @@ components: represents. readOnly: true readOnly: true + ApiSearchDeploymentRequest: + type: object + properties: + specs: + type: array + description: List of settings that configure the Search Nodes for your cluster. + items: + $ref: "#/components/schemas/ApiSearchDeploymentSpec" + maxItems: 1 + minItems: 1 + required: + - specs + ApiSearchDeploymentResponse: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the search + deployment. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + specs: + type: array + description: List of settings that configure the Search Nodes for your cluster. + items: + $ref: "#/components/schemas/ApiSearchDeploymentSpec" + readOnly: true + stateName: + type: string + description: Human-readable label that indicates the current operating condition + of this search deployment. + readOnly: true + ApiSearchDeploymentSpec: + type: object + properties: + instanceSize: + type: string + description: Hardware specification for the Search Node instance sizes. + nodeCount: + type: integer + format: int32 + description: Number of Search Nodes in the cluster. + example: 2 + maximum: 32 + minimum: 2 + required: + - instanceSize + - nodeCount AutoExportPolicy: type: object description: Policy for automatically exporting cloud backup snapshots. @@ -27400,6 +30124,27 @@ components: description: Human-readable label that indicates the rate at which the export policy item occurs. title: export + CollStatsRankedNamespaces: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the request + project. + readOnly: true + identifierId: + type: string + description: Unique 24-hexadecimal digit string that identifies the request + process. + readOnly: true + rankedNamespaces: + type: array + description: Ordered list of the hottest namespaces, highest value first. + items: + type: string + description: A single namespace. + readOnly: true + readOnly: true CostExplorerFilterResponse: type: object description: Response object to give information about created query. @@ -27410,10 +30155,27 @@ components: example: d9ab638a801efe182f98ae3e18ea4bb47b9fda808a28a8c7de205bb0e94f7d71 maxLength: 64 minLength: 64 + CreateDataProcessRegion: + type: object + description: Settings to configure the region where you wish to store your + archived data. + properties: + cloudProvider: + type: string + description: Human-readable label that identifies the Cloud service provider + where you wish to store your archived data. **AZURE** may be + selected only if **AZURE** is the Cloud service provider for the + cluster and no **AWS** online archive has been created for the + cluster. + region: + type: string + description: Human-readable label that identifies the geographic location of the + region where you wish to store your archived data. + writeOnly: true Criteria: type: object description: >- - Rules by which MongoDB MongoDB Cloud archives data. + Rules by which MongoDB Cloud archives data. Use the **criteria.type** field to choose how MongoDB Cloud selects data to archive. Choose data using the age of the data or a MongoDB query. @@ -27462,6 +30224,17 @@ components: description: 'Number of days after the value in the **criteria.dateField** when MongoDB Cloud archives data in the specified cluster. Set this parameter when you set **"criteria.type" : "DATE"**.' + DataExpirationRule: + type: object + description: Rule for specifying when data should be deleted from the archive. + properties: + expireAfterDays: + type: integer + format: int32 + description: Number of days used in the date criteria for nominating documents + for deletion. + maximum: 9215 + minimum: 7 DataProcessRegion: type: object description: Settings to configure the region where you wish to store your @@ -27470,11 +30243,14 @@ components: cloudProvider: type: string description: Human-readable label that identifies the Cloud service provider - where you wish to store your archived data. + where you store your archived data. + readOnly: true region: type: string description: Human-readable label that identifies the geographic location of the - region where you wish to store your archived data. + region where you store your archived data. + readOnly: true + readOnly: true GroupPaginatedEvent: type: object properties: @@ -27499,8 +30275,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true ManagedNamespace: @@ -27582,8 +30358,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAdvancedClusterDescription: @@ -27610,7 +30386,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAlertConfig: @@ -27637,8 +30414,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAlert: @@ -27665,8 +30442,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiApiUser: @@ -27693,7 +30470,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAppUser: @@ -27720,7 +30498,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasCheckpoint: @@ -27747,7 +30526,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasDatabaseUser: @@ -27776,7 +30556,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasDiskBackupExportJob: @@ -27803,7 +30584,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasProviderRegions: @@ -27830,7 +30612,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasServerlessBackupRestoreJob: @@ -27857,7 +30640,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasServerlessBackupSnapshot: @@ -27884,7 +30668,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiInvoice: @@ -27911,7 +30696,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiStreamsConnection: @@ -27938,8 +30724,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiStreamsTenant: @@ -27966,11 +30752,11 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true - PaginatedApiUserAccessList: + PaginatedApiUserAccessListResponse: type: object properties: links: @@ -27989,12 +30775,13 @@ components: description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: "#/components/schemas/UserAccessList" + $ref: "#/components/schemas/UserAccessListResponse" readOnly: true totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAppUser: @@ -28021,7 +30808,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAtlasGroup: @@ -28048,7 +30836,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedBackupSnapshotExportBucket: @@ -28075,7 +30864,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedBackupSnapshot: @@ -28102,7 +30892,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedCloudBackupReplicaSet: @@ -28129,7 +30920,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedCloudBackupRestoreJob: @@ -28156,7 +30948,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedCloudBackupShardedClusterSnapshot: @@ -28183,7 +30976,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedCloudProviderContainer: @@ -28211,7 +31005,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true title: Network Peering @@ -28240,8 +31035,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedDatabase: @@ -28268,7 +31063,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedDiskPartition: @@ -28295,7 +31091,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedIntegration: @@ -28317,13 +31114,13 @@ components: description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: "#/components/schemas/ThridPartyIntegration" + $ref: "#/components/schemas/ThirdPartyIntegration" readOnly: true totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedNetworkAccess: @@ -28350,7 +31147,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedOnlineArchive: @@ -28377,7 +31175,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedOrgGroup: @@ -28404,7 +31203,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedOrganization: @@ -28431,7 +31231,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedPipelineRun: @@ -28458,7 +31259,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedPrivateNetworkEndpointIdEntry: @@ -28485,8 +31287,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedRestoreJob: @@ -28513,7 +31315,38 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. + minimum: 0 + readOnly: true + PaginatedRoleMapping: + type: object + description: List role mappings from the specified organization in the specified + federation. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/AuthFederationRoleMapping" + readOnly: true + totalCount: + type: integer + format: int32 + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedServerlessInstanceDescription: @@ -28540,7 +31373,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedSnapshot: @@ -28567,7 +31401,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedTeamRole: @@ -28594,7 +31429,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedTeam: @@ -28621,7 +31457,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedTenantRestore: @@ -28648,7 +31485,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedTenantSnapshot: @@ -28675,7 +31513,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedUserCert: @@ -28702,7 +31541,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PartitionField: @@ -28784,11 +31624,6 @@ components: - Set this value to `false` to disable regionalized private endpoints. required: - enabled - ResourceEventType: - type: string - description: Unique identifier of event type. - example: TAGS_MODIFIED - title: Resource Event Types ApiAtlasFTSAnalyzers: type: object description: Settings that describe one Atlas Search custom analyzer. diff --git a/tools/openapi-generator/config/atlas-api.yaml b/tools/openapi-generator/config/atlas-api.yaml index 59df5fdcf7..0bb2c23d39 100644 --- a/tools/openapi-generator/config/atlas-api.yaml +++ b/tools/openapi-generator/config/atlas-api.yaml @@ -12,8 +12,8 @@ info: curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" \ --digest \ - --header "Accept: application/vnd.atlas.2023-02-01+json" \ - GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true" + --header "Accept: application/vnd.atlas.2023-11-15+json" \ + -X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/dbAccessHistory/clusters/{clusterName}?pretty=true" ``` @@ -23,8 +23,8 @@ info: url: https://creativecommons.org/licenses/by-nc-sa/3.0/us/ termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions title: MongoDB Atlas Administration API - version: 2.0~6e54278ed8 - x-xgen-sha: 6e54278ed80f8e54655f8d970425d6ee8247ae30 + version: "2.0" + x-xgen-sha: f37d3212e72e54807be6b0c0d1b6c2f47c7b8c83 servers: - url: https://cloud.mongodb.com tags: @@ -46,6 +46,16 @@ tags: name: Atlas Search - description: Returns and edits database auditing settings for MongoDB Cloud projects. name: Auditing + - description: Returns and edits custom DNS configurations for MongoDB Cloud + database deployments on AWS. The resource requires your Project ID. If you + use the VPC peering on AWS and you use your own DNS servers instead of + Amazon Route 53, enable custom DNS. Before 31 March 2020, applications + deployed within AWS using custom DNS services and VPC-peered with MongoDB + Cloud couldn't connect over private IP addresses. Custom DNS resolved to + public IP addresses. AWS internal DNS resolved to private IP addresses. + Applications deployed with custom DNS services in AWS should use Private + IP for Peering connection strings. + name: AWS Clusters DNS - description: Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups. @@ -64,16 +74,9 @@ tags: cluster configurations can affect costs. This resource requires your Project ID. name: Clusters - - description: Returns and edits custom DNS configurations for MongoDB Cloud - database deployments on AWS. The resource requires your Project ID. If you - use the VPC peering on AWS and you use your own DNS servers instead of - Amazon Route 53, enable custom DNS. Before 31 March 2020, applications - deployed within AWS using custom DNS services and VPC-peered with MongoDB - Cloud couldn't connect over private IP addresses. Custom DNS resolved to - public IP addresses. AWS internal DNS resolved to private IP addresses. - Applications deployed with custom DNS services in AWS should use Private - IP for Peering connection strings. - name: AWS Clusters DNS + - description: Returns, adds, and edits pinned namespaces for the specified + cluster or process. Also returns collection level latency metric data. + name: Collection Level Metrics - description: Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the @@ -86,8 +89,6 @@ tags: MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4. name: Custom Database Roles - - description: Returns, adds, edits, and removes database users. - name: Database Users - description: Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs. @@ -95,6 +96,8 @@ tags: - description: Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs. name: Data Lake Pipelines + - description: Returns, adds, edits, and removes database users. + name: Database Users - description: Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management. @@ -174,6 +177,9 @@ tags: - description: Returns, adds, and edits collections of clusters and users in MongoDB Cloud. name: Projects + - description: You can continually push logs from mongod, mongos, and audit logs + to an AWS S3 bucket. Atlas exports logs every 5 minutes. + name: Push-Based Log Export - description: Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster. @@ -238,11 +244,11 @@ paths: x-xgen-version: 2023-01-01 description: OK "401": - $ref: "#/components/responses/unauthorized" - "404": - $ref: "#/components/responses/notFound" + description: Unauthorized. "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return the status of this MongoDB application tags: - Root @@ -359,6 +365,8 @@ paths: $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return All Connected Org Configs from the Federation tags: - Federated Authentication @@ -458,7 +466,10 @@ paths: **Note**: The domainRestrictionEnabled field defaults to false if not provided in the request. - **Note**: If the identityProviderId field is not provided, you will disconnect the organization and the identity provider. + **Note**: If the identityProviderId field is not provided, you will disconnect the organization and the identity provider. + + + **Note**: Currently connected data access identity providers missing from the dataAccessIdentityProviderIds field will be disconnected. operationId: updateConnectedOrgConfig parameters: - $ref: "#/components/parameters/federationSettingsId" @@ -516,9 +527,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - type: array - items: - $ref: "#/components/schemas/AuthFederationRoleMapping" + $ref: "#/components/schemas/PaginatedRoleMapping" x-xgen-version: 2023-01-01 description: OK "400": @@ -703,20 +712,39 @@ paths: x-xgen-experimental: true "/api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders": get: - description: Returns all identity providers in the specified federation. To use - this resource, the requesting API Key must have the Organization Owner - role in one of the connected organizations. + description: Returns all identity providers with the provided protocol and type + in the specified federation. If no protocol is specified, only SAML + identity providers will be returned. If no idpType is specified, only + WORKFORCE identity providers will be returned. To use this resource, the + requesting API Key must have the Organization Owner role in one of the + connected organizations. operationId: listIdentityProviders parameters: - $ref: "#/components/parameters/federationSettingsId" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: The protocols of the target identity providers. + in: query + name: protocol + schema: + type: array + items: + type: string + default: SAML + - description: The types of the target identity providers. + in: query + name: idpType + schema: + type: array + items: + type: string + default: WORKFORCE responses: "200": content: application/vnd.atlas.2023-01-01+json: schema: - type: array - items: - $ref: "#/components/schemas/FederationIdentityProvider" + $ref: "#/components/schemas/PaginatedFederationIdentityProvider" x-xgen-version: 2023-01-01 description: OK "400": @@ -733,59 +761,169 @@ paths: tags: - Federated Authentication x-xgen-experimental: true - "/api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}": - get: - description: Returns one identity provider from the specified federation. To use + post: + description: >- + Creates one identity provider within the specified federation. To use this resource, the requesting API Key must have the Organization Owner role in one of the connected organizations. + + + **Note**: This resource only supports the creation of OIDC identity providers. + operationId: createIdentityProvider + parameters: + - $ref: "#/components/parameters/federationSettingsId" + requestBody: + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/FederationOidcIdentityProviderUpdate" + description: The identity provider that you want to create. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/FederationOidcIdentityProvider" + x-xgen-version: 2023-11-15 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create one identity provider + tags: + - Federated Authentication + x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}": + delete: + description: >- + Deletes one identity provider in the specified federation. To use this + resource, the requesting API Key must have the Organization Owner role + in one of the connected organizations. + + + **Note**: Requests to this resource will fail if the identity provider has any connected organizations. Before deleting an identity provider, disconnect all organizations and confirm that no organization in your account uses this identity provider. To learn more, see [Manage Organization Mapping for Federated Authentication](https://www.mongodb.com/docs/atlas/security/manage-org-mapping/). + operationId: deleteIdentityProvider + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the identity + provider to connect. + in: path + name: identityProviderId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + responses: + "204": + content: + application/vnd.atlas.2023-11-15+json: + x-xgen-version: 2023-11-15 + description: No Response + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Delete the identity provider. + tags: + - Federated Authentication + x-xgen-experimental: true + get: + description: "Returns one identity provider in the specified federation by the + identity provider's id. To use this resource, the requesting API Key + must have the Organization Owner role in one of the connected + organizations. Deprecated versions: v2-{2023-01-01}" operationId: getIdentityProvider parameters: - $ref: "#/components/parameters/federationSettingsId" - - $ref: "#/components/parameters/identityProviderId" + - description: Unique string that identifies the identity provider to connect. If + using an API version before 11-15-2023, use the legacy + 20-hexadecimal digit id. This id can be found within the Federation + Management Console > Identity Providers tab by clicking the info + icon in the IdP ID row of a configured identity provider. For all + other versions, use the 24-hexadecimal digit id. + in: path + name: identityProviderId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-11-15+json: schema: $ref: "#/components/schemas/FederationIdentityProvider" - x-xgen-version: 2023-01-01 + x-xgen-version: 2023-11-15 description: OK "400": $ref: "#/components/responses/badRequest" "401": $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" "404": $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return one identity provider from the specified federation. + summary: Return one identity provider from the specified federation by id. tags: - Federated Authentication x-xgen-experimental: true patch: - description: Updates one identity provider in the specified federation. To use - this resource, the requesting API Key must have the Organization Owner - role in one of the connected organizations. + description: >- + Updates one identity provider in the specified federation. To use this + resource, the requesting API Key must have the Organization Owner role + in one of the connected organizations. + + + **Note**: Changing authorization types and/or updating authorization claims can prevent current users and/or groups from accessing the database. Deprecated versions: v2-{2023-01-01} operationId: updateIdentityProvider parameters: - $ref: "#/components/parameters/federationSettingsId" - - $ref: "#/components/parameters/identityProviderId" + - description: Unique string that identifies the identity provider to connect. If + using an API version before 11-15-2023, use the legacy + 20-hexadecimal digit id. This id can be found within the Federation + Management Console > Identity Providers tab by clicking the info + icon in the IdP ID row of a configured identity provider. For all + other versions, use the 24-hexadecimal digit id. + in: path + name: identityProviderId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 requestBody: content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-11-15+json: schema: - $ref: "#/components/schemas/SamlIdentityProviderUpdate" + $ref: "#/components/schemas/FederationIdentityProviderUpdate" description: The identity provider that you want to update. required: true responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-11-15+json: schema: $ref: "#/components/schemas/FederationIdentityProvider" - x-xgen-version: 2023-01-01 + x-xgen-version: 2023-11-15 description: OK "400": $ref: "#/components/responses/badRequest" @@ -801,6 +939,46 @@ paths: tags: - Federated Authentication x-xgen-experimental: true + "/api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}/jwks": + delete: + description: >- + Revokes the JWKS tokens from the requested OIDC identity provider. To + use this resource, the requesting API Key must have the Organization + Owner role in one of the connected organizations. + + + **Note**: Revoking your JWKS tokens immediately refreshes your IdP public keys from all your Atlas clusters, invalidating previously signed access tokens and logging out all users. You may need to restart your MongoDB clients. All organizations connected to the identity provider will be affected. To learn more, see [Configure OIDC Authorization](https://www.mongodb.com/docs/atlas/security-oidc/#revoke-jwks). + operationId: revokeJwksFromIdentityProvider + parameters: + - $ref: "#/components/parameters/federationSettingsId" + - description: Unique 24-hexadecimal digit string that identifies the identity + provider to connect. + in: path + name: identityProviderId + required: true + schema: + type: string + example: 32b6e34b3d91647abb20e7b8 + responses: + "204": + content: + application/vnd.atlas.2023-11-15+json: + x-xgen-version: 2023-11-15 + description: No Response + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Revoke the JWKS tokens from an OIDC identity provider. + tags: + - Federated Authentication + x-xgen-experimental: true "/api/atlas/v2/federationSettings/{federationSettingsId}/identityProviders/{identityProviderId}/metadata.xml": get: description: Returns the metadata of one identity provider in the specified @@ -836,9 +1014,9 @@ paths: get: description: Returns details about all projects. Projects group clusters into logical collections that support an application environment, workload, - or both. Each project can have its own users, teams, security, and alert - settings. To use this resource, the requesting API Key must have the - Read Write role. + or both. Each project can have its own users, teams, security, tags, and + alert settings. To use this resource, the requesting API Key must have + the Read Write role. operationId: listProjects parameters: - $ref: "#/components/parameters/includeCount" @@ -858,13 +1036,15 @@ paths: $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return All Projects tags: - Projects post: description: Creates one project. Projects group clusters into logical collections that support an application environment, workload, or both. - Each project can have its own users, teams, security, and alert + Each project can have its own users, teams, security, tags, and alert settings. To use this resource, the requesting API Key must have the Read Write role. operationId: createProject @@ -917,7 +1097,7 @@ paths: description: Returns details about the specified project. Projects group clusters into logical collections that support an application environment, workload, or both. Each project can have its own users, - teams, security, and alert settings. To use this resource, the + teams, security, tags, and alert settings. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getProjectByName parameters: @@ -947,6 +1127,8 @@ paths: $ref: "#/components/responses/conflict" "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return One Project using Its Name tags: - Projects @@ -954,7 +1136,7 @@ paths: delete: description: Removes the specified project. Projects group clusters into logical collections that support an application environment, workload, or both. - Each project can have its own users, teams, security, and alert + Each project can have its own users, teams, security, tags, and alert settings. You can delete a project only if there are no Online Archives for the clusters in the project. To use this resource, the requesting API Key must have the Project Owner role. @@ -984,7 +1166,7 @@ paths: description: Returns details about the specified project. Projects group clusters into logical collections that support an application environment, workload, or both. Each project can have its own users, - teams, security, and alert settings. To use this resource, the + teams, security, tags, and alert settings. To use this resource, the requesting API Key must have the Project Read Only role. operationId: getProject parameters: @@ -1010,8 +1192,8 @@ paths: - Projects patch: description: Updates the human-readable label that identifies the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. + project, or the tags associated with the project. To use this resource, + the requesting API Key must have the Project Owner role. operationId: updateProject parameters: - $ref: "#/components/parameters/groupId" @@ -1019,7 +1201,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/GroupName" + $ref: "#/components/schemas/GroupUpdate" description: Project to update. required: true responses: @@ -1042,7 +1224,50 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Update One Project Name + summary: Update One Project + tags: + - Projects + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/access": + post: + description: Adds one MongoDB Cloud user to the specified project. If the + MongoDB Cloud user is not a member of the project's organization, then + the user must accept their invitation to the organization to access + information within the specified project. If the MongoDB Cloud User is + already a member of the project's organization, then they will be added + to the project immediately and an invitation will not be returned by + this resource. To use this resource, the requesting API Key must have + the Group User Admin role. + operationId: addUserToProject + parameters: + - $ref: "#/components/parameters/groupId" + requestBody: + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/GroupInvitationRequest" + description: Adds one MongoDB Cloud user to the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-02-01+json: + schema: + $ref: "#/components/schemas/OrganizationInvitation" + x-xgen-version: 2023-02-01 + description: OK + "204": + content: + application/vnd.atlas.2023-02-01+json: + x-xgen-version: 2023-02-01 + description: No Content + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Add One MongoDB Cloud User to One Project tags: - Projects x-xgen-experimental: true @@ -1817,7 +2042,7 @@ paths: specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting API Key must have - the Project User Admin role. + the Project Owner role. externalDocs: description: Programmatic API Keys url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key @@ -1849,7 +2074,7 @@ paths: specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting API Key must have - the Project User Admin role. + the Project Owner role. operationId: createProjectApiKey parameters: - $ref: "#/components/parameters/groupId" @@ -1881,8 +2106,7 @@ paths: "/api/atlas/v2/groups/{groupId}/apiKeys/{apiUserId}": delete: description: Removes one organization API key from the specified project. To use - this resource, the requesting API Key must have the Project User Admin - role. + this resource, the requesting API Key must have the Project Owner role. externalDocs: description: Programmatic API Keys url: https://docs.atlas.mongodb.com/configure-api-access/#std-label-atlas-prog-api-key @@ -1972,7 +2196,7 @@ paths: project. Users with the Project Owner role in the project associated with the API key can then use the organization API key to access the resources. To use this resource, the requesting API Key must have the - Project User Admin role. + Project Owner role. operationId: addProjectApiKey parameters: - $ref: "#/components/parameters/groupId" @@ -2199,8 +2423,10 @@ paths: "/api/atlas/v2/groups/{groupId}/backup/exportBuckets/{exportBucketId}": delete: description: Revoke MongoDB Cloud access to the specified AWS S3 bucket. This - prevents this bucket to receive Atlas Cloud Backup snapshots. To use - this resource, the requesting API Key must have the Project Owner role. + prevents this bucket to receive Atlas Cloud Backup snapshots. Auto + export must be disabled on all clusters in this project exporting to + this bucket before revoking access. To use this resource, the requesting + API Key must have the Project Owner role. operationId: deleteExportBucket parameters: - $ref: "#/components/parameters/groupId" @@ -2273,19 +2499,19 @@ paths: - Cloud Backups "/api/atlas/v2/groups/{groupId}/backupCompliancePolicy": get: - description: Returns the Backup Compliance Policy settings with the specified + description: "Returns the Backup Compliance Policy settings with the specified project. To use this resource, the requesting API Key must have the - Project Owner role. + Project Owner role. Deprecated versions: v2-{2023-01-01}" operationId: getDataProtectionSettings parameters: - $ref: "#/components/parameters/groupId" responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-10-01+json: schema: - $ref: "#/components/schemas/DataProtectionSettings" - x-xgen-version: 2023-01-01 + $ref: "#/components/schemas/DataProtectionSettings20231001" + x-xgen-version: 2023-10-01 description: OK "401": $ref: "#/components/responses/unauthorized" @@ -2299,28 +2525,37 @@ paths: tags: - Cloud Backups put: - description: Updates the Backup Compliance Policy settings for the specified + description: "Updates the Backup Compliance Policy settings for the specified project. To use this resource, the requesting API Key must have the - Project Owner role. + Project Owner role. Deprecated versions: v2-{2023-01-01}" operationId: updateDataProtectionSettings parameters: - $ref: "#/components/parameters/groupId" + - description: Flag that indicates whether to overwrite non complying backup + policies with the new data protection settings or not. + in: query + name: overwriteBackupPolicies + schema: + type: boolean + default: true requestBody: content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-10-01+json: schema: - $ref: "#/components/schemas/DataProtectionSettings" - x-xgen-version: 2023-01-01 + $ref: "#/components/schemas/DataProtectionSettings20231001" + x-xgen-version: 2023-10-01 description: The new Backup Compliance Policy settings. required: true responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-10-01+json: schema: - $ref: "#/components/schemas/DataProtectionSettings" - x-xgen-version: 2023-01-01 + $ref: "#/components/schemas/DataProtectionSettings20231001" + x-xgen-version: 2023-10-01 description: OK + "400": + $ref: "#/components/responses/badRequest" "401": $ref: "#/components/responses/unauthorized" "404": @@ -2673,7 +2908,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Create One Multi-Cloud Cluster from One Project + summary: Create One Cluster from One Project tags: - Clusters "/api/atlas/v2/groups/{groupId}/clusters/provider/regions": @@ -2730,7 +2965,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/LegacyAtlasCluster" + $ref: "#/components/schemas/LegacyAtlasTenantClusterUpgradeRequest" description: Details of the shared-tier cluster upgrade in the specified project. required: true responses: @@ -2802,11 +3037,11 @@ paths: x-xgen-experimental: true "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}": delete: - description: "Removes one cluster with advanced features from the specified - project. The cluster must have termination protection disabled in order - to be deleted. To use this resource, the requesting API Key must have - the Project Owner role. This feature is not available for serverless - clusters. Deprecated versions: v2-{2023-01-01}" + description: "Removes one cluster from the specified project. The cluster must + have termination protection disabled in order to be deleted. To use this + resource, the requesting API Key must have the Project Owner role. This + feature is not available for serverless clusters. Deprecated versions: + v2-{2023-01-01}" operationId: deleteCluster parameters: - $ref: "#/components/parameters/groupId" @@ -2843,7 +3078,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Remove One Multi-Cloud Cluster from One Project + summary: Remove One Cluster from One Project tags: - Clusters get: @@ -2856,7 +3091,7 @@ paths: operationId: getCluster parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -2883,7 +3118,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return One Multi-Cloud Cluster from One Project + summary: Return One Cluster from One Project tags: - Clusters patch: @@ -2936,7 +3171,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Modify One Multi-Cloud Cluster from One Project + summary: Modify One Cluster from One Project tags: - Clusters "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/backup/exports": @@ -4079,21 +4314,16 @@ paths: tags: - Legacy Backup x-xgen-experimental: true - "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes": - post: - description: Creates one Atlas Search index on the specified collection. Atlas - Search indexes define the fields on which to create the index and the - analyzers to use when creating the index. Only clusters running MongoDB - v4.2 or later can use Atlas Search. To use this resource, the requesting - API Key must have the Project Data Access Admin role. - externalDocs: - description: Atlas Search Indexes - url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ - operationId: createAtlasSearchIndex + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned": + get: + description: Returns a list of given cluster's pinned namespaces, a set of + namespaces manually selected by users to collect query latency metrics + on. + operationId: getPinnedNamespaces parameters: - $ref: "#/components/parameters/groupId" - - description: Name of the cluster that contains the collection on which to create - an Atlas Search index. + - description: Human-readable label that identifies the cluster to retrieve pinned + namespaces for. in: path name: clusterName required: true @@ -4102,33 +4332,234 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - requestBody: - content: - application/vnd.atlas.2023-01-01+json: - schema: - $ref: "#/components/schemas/ClusterSearchIndex" - description: Creates one Atlas Search index on the specified collection. - required: true responses: "200": content: - application/vnd.atlas.2023-01-01+json: + application/vnd.atlas.2023-11-15+json: schema: - $ref: "#/components/schemas/ClusterSearchIndex" - x-xgen-version: 2023-01-01 + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 description: OK "400": $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" "404": $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Create One Atlas Search Index + summary: Return Pinned Namespaces tags: - - Atlas Search - "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{databaseName}/{collectionName}": + - Collection Level Metrics + x-xgen-experimental: true + patch: + description: Add provided list of namespaces to existing pinned namespaces list + for collection-level latency metrics collection for the given Group and + Cluster + operationId: pinNamespacesPatch + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to pin namespaces + to. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/NamespacesRequest" + description: List of namespace strings (combination of database and collection + name) to pin for query latency metric collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: OK + "201": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Add Pinned Namespaces + tags: + - Collection Level Metrics + x-xgen-experimental: true + put: + description: Pin provided list of namespaces for collection-level latency + metrics collection for the given Group and Cluster. This initializes a + pinned namespaces list or replaces any existing pinned namespaces list + for the Group and Cluster. + operationId: pinNamespacesPut + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to pin namespaces + to. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/NamespacesRequest" + description: List of namespace strings (combination of database and collection + name) to pin for query latency metric collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: OK + "201": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: Created + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Pin Namespaces + tags: + - Collection Level Metrics + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/unpin": + patch: + description: Unpin provided list of namespaces for collection-level latency + metrics collection for the given Group and Cluster + operationId: unpinNamespaces + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to unpin + namespaces from. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/NamespacesRequest" + description: List of namespace strings (combination of database and collection + name) to pin for query latency metric collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/PinnedNamespaces" + x-xgen-version: 2023-11-15 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Unpin namespaces + tags: + - Collection Level Metrics + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes": + post: + description: Creates one Atlas Search index on the specified collection. Atlas + Search indexes define the fields on which to create the index and the + analyzers to use when creating the index. Only clusters running MongoDB + v4.2 or later can use Atlas Search. To use this resource, the requesting + API Key must have the Project Data Access Admin role. + externalDocs: + description: Atlas Search Indexes + url: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/ + operationId: createAtlasSearchIndex + parameters: + - $ref: "#/components/parameters/groupId" + - description: Name of the cluster that contains the collection on which to create + an Atlas Search index. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + description: Creates one Atlas Search index on the specified collection. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ClusterSearchIndex" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create One Atlas Search Index + tags: + - Atlas Search + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/fts/indexes/{databaseName}/{collectionName}": get: description: Returns all Atlas Search indexes on the specified collection. Atlas Search indexes contain the indexed fields and the analyzers used to @@ -4361,7 +4792,7 @@ paths: operationId: getManagedNamespace parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4384,7 +4815,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return One Managed Namespace in One Global Multi-Cloud Cluster + summary: Return One Managed Namespace in One Global Cluster tags: - Global Clusters "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/globalWrites/customZoneMapping": @@ -4402,7 +4833,7 @@ paths: operationId: deleteAllCustomZoneMappings parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4425,7 +4856,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Remove All Custom Zone Mappings from One Global Multi-Cloud Cluster + summary: Remove All Custom Zone Mappings from One Global Cluster tags: - Global Clusters x-xgen-experimental: true @@ -4442,7 +4873,7 @@ paths: operationId: createCustomZoneMapping parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4455,7 +4886,7 @@ paths: content: application/vnd.atlas.2023-02-01+json: schema: - $ref: "#/components/schemas/GeoSharding" + $ref: "#/components/schemas/CustomZoneMappings" description: Custom zone mapping to add to the specified global cluster. required: true responses: @@ -4491,7 +4922,7 @@ paths: url: https://www.mongodb.com/docs/atlas/global-clusters/ operationId: deleteManagedNamespace parameters: - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4529,7 +4960,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Remove One Managed Namespace from One Global Multi-Cloud Cluster + summary: Remove One Managed Namespace from One Global Cluster tags: - Global Clusters x-xgen-experimental: true @@ -4545,7 +4976,7 @@ paths: operationId: createManagedNamespace parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies this advanced cluster. + - description: Human-readable label that identifies this cluster. in: path name: clusterName required: true @@ -4579,7 +5010,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Create One Managed Namespace in One Global Multi-Cloud Cluster + summary: Create One Managed Namespace in One Global Cluster tags: - Global Clusters x-xgen-experimental: true @@ -4610,6 +5041,71 @@ paths: requestBody: content: application/vnd.atlas.2023-01-01+json: + examples: + 2dspere Index: + description: 2dspere Index + value: + collation: + alternate: non-ignorable + backwards: false + caseFirst: lower + caseLevel: false + locale: af + maxVariable: punct + normalization: false + numericOrdering: false + strength: 3 + collection: accounts + db: sample_airbnb + keys: + - property_type: "1" + options: + name: PartialIndexTest + partialFilterExpression: + limit: + $gt: 900 + Partial Index: + description: Partial Index + value: + collation: + alternate: non-ignorable + backwards: false + caseFirst: lower + caseLevel: false + locale: af + maxVariable: punct + normalization: false + numericOrdering: false + strength: 3 + collection: accounts + db: sample_airbnb + keys: + - property_type: "1" + options: + name: PartialIndexTest + partialFilterExpression: + limit: + $gt: 900 + Sparse Index: + description: Sparse Index + value: + collation: + alternate: non-ignorable + backwards: false + caseFirst: lower + caseLevel: false + locale: af + maxVariable: punct + normalization: false + numericOrdering: false + strength: 3 + collection: accounts + db: sample_airbnb + keys: + - test_field: "1" + options: + name: SparseIndexTest + sparse: true schema: $ref: "#/components/schemas/DatabaseRollingIndexRequest" description: Rolling index to create on the specified cluster. @@ -5222,7 +5718,7 @@ paths: $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Test Failover for One Multi-Cloud Cluster + summary: Test Failover for One Cluster tags: - Clusters "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs": @@ -5340,7 +5836,7 @@ paths: - DigestAuth: [] summary: Create One Legacy Backup Restore Job tags: - - Legacy Backup Restore Jobs + - Legacy Backup x-xgen-experimental: true "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs/{jobId}": get: @@ -5393,20 +5889,13 @@ paths: tags: - Legacy Backup x-xgen-experimental: true - "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshotSchedule": - get: - deprecated: true - description: >- - Returns the snapshot schedule for one cluster in the specified project. - To use this resource, the requesting API Key must have the Project Read - Only role. - - Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). - operationId: getLegacySnapshotSchedule + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/search/deployment": + delete: + description: Deletes the Search Nodes for the specified cluster. + operationId: deleteAtlasSearchDeployment parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies the cluster with the snapshot - you want to return. + - description: Label that identifies the cluster to delete. in: path name: clusterName required: true @@ -5419,33 +5908,26 @@ paths: "200": content: application/vnd.atlas.2023-01-01+json: - schema: - $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" x-xgen-version: 2023-01-01 description: OK + "400": + $ref: "#/components/responses/badRequest" "404": $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return One Snapshot Schedule + summary: Delete Search Nodes tags: - - Legacy Backup + - Atlas Search x-xgen-experimental: true - patch: - deprecated: true - description: >- - Updates the snapshot schedule for one cluster in the specified project. - To use this resource, the requesting API Key must have the Project Owner - role. - - Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). - operationId: updateLegacySnapshotSchedule + get: + description: Return the Search Nodes for the specified cluster. + operationId: getAtlasSearchDeployment parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies the cluster with the snapshot - you want to return. + - description: Label that identifies the cluster to return the Search Nodes for. in: path name: clusterName required: true @@ -5454,52 +5936,32 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - requestBody: - content: - application/vnd.atlas.2023-01-01+json: - schema: - $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" - description: Update the snapshot schedule for one cluster in the specified project. - required: true responses: "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + $ref: "#/components/schemas/ApiSearchDeploymentResponse" x-xgen-version: 2023-01-01 description: OK "400": $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Update Snapshot Schedule for One Cluster + summary: Return Search Nodes tags: - - Legacy Backup + - Atlas Search x-xgen-experimental: true - "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots": - get: - deprecated: true - description: Returns all legacy backup snapshots for one cluster in the - specified project. To use this resource, the requesting API Key must - have the Project Read Only role. Effective 23 March 2020, all new - clusters can use only Cloud Backups. When you upgrade to 4.2, your - backup system upgrades to cloud backup if it is currently set to legacy - backup. After this upgrade, all your existing legacy backup snapshots - remain available. They expire over time in accordance with your - retention policy. Your backup policy resets to the default schedule. If - you had a custom backup policy in place with legacy backups, you must - re-create it with the procedure outlined in the [Cloud Backup - documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). - operationId: listLegacySnapshots + patch: + description: Updates the Search Nodes for the specified cluster. + operationId: updateAtlasSearchDeployment parameters: - $ref: "#/components/parameters/groupId" - - $ref: "#/components/parameters/includeCount" - - $ref: "#/components/parameters/itemsPerPage" - - $ref: "#/components/parameters/pageNum" - - description: Human-readable label that identifies the cluster. + - description: Label that identifies the cluster to update the Search Nodes for. in: path name: clusterName required: true @@ -5508,40 +5970,223 @@ paths: maxLength: 64 minLength: 1 pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ - - description: Human-readable label that specifies whether to return only - completed, incomplete, or all snapshots. By default, MongoDB Cloud - only returns completed snapshots. - in: query - name: completed - schema: - type: string - default: "true" + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiSearchDeploymentRequest" + description: Updates the Search Nodes for the specified cluster. + required: true responses: "200": content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/PaginatedSnapshot" + $ref: "#/components/schemas/ApiSearchDeploymentResponse" x-xgen-version: 2023-01-01 description: OK - "401": - $ref: "#/components/responses/unauthorized" + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Return All Legacy Backup Snapshots + summary: Update Search Nodes tags: - - Legacy Backup + - Atlas Search x-xgen-experimental: true - "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots/{snapshotId}": - delete: - deprecated: true - description: Removes one legacy backup snapshot for one cluster in the specified - project. To use this resource, the requesting API Key must have the - Project Owner role. Effective 23 March 2020, all new clusters can use - only Cloud Backups. When you upgrade to 4.2, your backup system upgrades - to cloud backup if it is currently set to legacy backup. After this + post: + description: Creates Search Nodes for the specified cluster. + operationId: createAtlasSearchDeployment + parameters: + - $ref: "#/components/parameters/groupId" + - description: Label that identifies the cluster to create Search Nodes for. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiSearchDeploymentRequest" + description: Creates Search Nodes for the specified cluster. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiSearchDeploymentResponse" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Create Search Nodes + tags: + - Atlas Search + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshotSchedule": + get: + deprecated: true + description: >- + Returns the snapshot schedule for one cluster in the specified project. + To use this resource, the requesting API Key must have the Project Read + Only role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: getLegacySnapshotSchedule + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return One Snapshot Schedule + tags: + - Legacy Backup + x-xgen-experimental: true + patch: + deprecated: true + description: >- + Updates the snapshot schedule for one cluster in the specified project. + To use this resource, the requesting API Key must have the Project Owner + role. + + Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: updateLegacySnapshotSchedule + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster with the snapshot + you want to return. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + requestBody: + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + description: Update the snapshot schedule for one cluster in the specified project. + required: true + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/ApiAtlasSnapshotSchedule" + x-xgen-version: 2023-01-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Update Snapshot Schedule for One Cluster + tags: + - Legacy Backup + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots": + get: + deprecated: true + description: Returns all legacy backup snapshots for one cluster in the + specified project. To use this resource, the requesting API Key must + have the Project Read Only role. Effective 23 March 2020, all new + clusters can use only Cloud Backups. When you upgrade to 4.2, your + backup system upgrades to cloud backup if it is currently set to legacy + backup. After this upgrade, all your existing legacy backup snapshots + remain available. They expire over time in accordance with your + retention policy. Your backup policy resets to the default schedule. If + you had a custom backup policy in place with legacy backups, you must + re-create it with the procedure outlined in the [Cloud Backup + documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). + operationId: listLegacySnapshots + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/includeCount" + - $ref: "#/components/parameters/itemsPerPage" + - $ref: "#/components/parameters/pageNum" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Human-readable label that specifies whether to return only + completed, incomplete, or all snapshots. By default, MongoDB Cloud + only returns completed snapshots. + in: query + name: completed + schema: + type: string + default: "true" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/PaginatedSnapshot" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All Legacy Backup Snapshots + tags: + - Legacy Backup + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/snapshots/{snapshotId}": + delete: + deprecated: true + description: Removes one legacy backup snapshot for one cluster in the specified + project. To use this resource, the requesting API Key must have the + Project Owner role. Effective 23 March 2020, all new clusters can use + only Cloud Backups. When you upgrade to 4.2, your backup system upgrades + to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup @@ -5740,95 +6385,232 @@ paths: tags: - Clusters x-xgen-experimental: true - "/api/atlas/v2/groups/{groupId}/clusters/{hostName}/logs/{logName}.gz": + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/collStats/namespaces": get: - description: "Returns a compressed (.gz) log file that contains a range of log - messages for the specified host for the specified project. MongoDB - updates process and audit logs from the cluster backend infrastructure - every five minutes and contain log data from the previous five minutes. - If you poll the API for log files, we recommend polling every five - minutes. For example, if the logs are updated at 4:00 UTC and then you - poll the API, the API returns log data from the interval between 3:55 - UTC and 4:00 UTC. This feature isn't available for `M0` free clusters, - `M2`, `M5`, or serverless clusters. To use this resource, the requesting - API Key must have the Project Data Access Read Only or higher role. - Deprecated versions: v2-{2023-01-01}" - operationId: getHostLogs + description: Return the subset of namespaces from the given cluster sorted by + highest total execution time (descending) within the given time window. + operationId: getCollStatsLatencyNamespacesForCluster parameters: - $ref: "#/components/parameters/groupId" - - description: Human-readable label that identifies the host that stores the log - files that you want to download. + - description: Human-readable label that identifies the cluster to pin namespaces + to. in: path - name: hostName + name: clusterName required: true schema: type: string - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ - - description: Human-readable label that identifies the log file that you want to - return. To return audit logs, enable *Database Auditing* for the - specified project. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Human-readable label that identifies the cluster topology to + retrieve metrics for. in: path - name: logName + name: clusterView required: true schema: type: string - externalDocs: - description: Set up Database Auditing - url: https://docs.atlas.mongodb.com/database-auditing/ - - description: Date and time when the period specifies the inclusive ending point - for the range of log messages to retrieve. This parameter expresses - its value in the number of seconds that have elapsed since the UNIX - epoch. - in: query - name: endDate - schema: - type: integer - format: int64 - minimum: 1199145600 - - description: Date and time when the period specifies the inclusive starting - point for the range of log messages to retrieve. This parameter - expresses its value in the number of seconds that have elapsed since - the UNIX epoch. - in: query - name: startDate - schema: - type: integer - format: int64 - minimum: 1199145600 + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - $ref: "#/components/parameters/period" responses: "200": content: - application/vnd.atlas.2023-02-01+gzip: + application/vnd.atlas.2023-11-15+json: schema: - type: string - format: binary - description: Compressed (.gz) log file that contains a range of log messages for - the specified host for the specified project - x-xgen-version: 2023-02-01 - description: OK - "400": - $ref: "#/components/responses/badRequest" - "401": - $ref: "#/components/responses/unauthorized" + $ref: "#/components/schemas/CollStatsRankedNamespaces" + x-xgen-version: 2023-11-15 + description: Succeeded "403": $ref: "#/components/responses/forbidden" - "404": - $ref: "#/components/responses/notFound" - "409": - $ref: "#/components/responses/conflict" "500": $ref: "#/components/responses/internalServerError" security: - DigestAuth: [] - summary: Download Logs for One Cluster Host in One Project + summary: Return Ranked Namespaces from a Cluster tags: - - Monitoring and Logs - "/api/atlas/v2/groups/{groupId}/containers": + - Collection Level Metrics + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/{databaseName}/{collectionName}/collStats/measurements": get: - description: Returns details about all network peering containers in the - specified project for the specified cloud provider. If you do not - specify the cloud provider, MongoDB Cloud returns details about all - network peering containers in the project for Amazon Web Services (AWS). + description: Get a list of the Coll Stats Latency cluster-level measurements for + the given namespace. + operationId: getCollStatsLatencyNamespaceClusterMeasurements + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster to retrieve + metrics for. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Human-readable label that identifies the cluster topology to + retrieve metrics for. + in: path + name: clusterView + required: true + schema: + type: string + - $ref: "#/components/parameters/databaseName" + - $ref: "#/components/parameters/collectionName" + - description: List that contains the metrics that you want to retrieve for the + associated data series. If you don't set this parameter, this + resource returns data series for all Coll Stats Latency metrics. + in: query + name: metrics + schema: + type: array + items: + type: string + description: Metric requested for the given cluster + uniqueItems: true + style: form + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - $ref: "#/components/parameters/period" + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/MeasurementsCollStatsLatencyCluster" + x-xgen-version: 2023-11-15 + description: Succeeded + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Cluster-Level Query Latency + tags: + - Collection Level Metrics + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/clusters/{hostName}/logs/{logName}.gz": + get: + description: "Returns a compressed (.gz) log file that contains a range of log + messages for the specified host for the specified project. MongoDB + updates process and audit logs from the cluster backend infrastructure + every five minutes and contain log data from the previous five minutes. + If you poll the API for log files, we recommend polling every five + minutes. For example, if the logs are updated at 4:00 UTC and then you + poll the API, the API returns log data from the interval between 3:55 + UTC and 4:00 UTC. This feature isn't available for `M0` free clusters, + `M2`, `M5`, or serverless clusters. To use this resource, the requesting + API Key must have the Project Data Access Read Only or higher role. + Deprecated versions: v2-{2023-01-01}" + operationId: getHostLogs + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the host that stores the log + files that you want to download. + in: path + name: hostName + required: true + schema: + type: string + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + - description: Human-readable label that identifies the log file that you want to + return. To return audit logs, enable *Database Auditing* for the + specified project. + in: path + name: logName + required: true + schema: + type: string + externalDocs: + description: Set up Database Auditing + url: https://docs.atlas.mongodb.com/database-auditing/ + - description: Date and time when the period specifies the inclusive ending point + for the range of log messages to retrieve. This parameter expresses + its value in the number of seconds that have elapsed since the UNIX + epoch. + in: query + name: endDate + schema: + type: integer + format: int64 + minimum: 1199145600 + - description: Date and time when the period specifies the inclusive starting + point for the range of log messages to retrieve. This parameter + expresses its value in the number of seconds that have elapsed since + the UNIX epoch. + in: query + name: startDate + schema: + type: integer + format: int64 + minimum: 1199145600 + responses: + "200": + content: + application/vnd.atlas.2023-02-01+gzip: + schema: + type: string + format: binary + description: Compressed (.gz) log file that contains a range of log messages for + the specified host for the specified project + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Download Logs for One Cluster Host in One Project + tags: + - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/collStats/metrics": + get: + description: Returns all available Coll Stats Latency metric names and their + respective units for the specified project at the time of request. + operationId: getCollStatsLatencyNamespaceMetrics + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-11-15 + description: Succeeded + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return all metric names + tags: + - Collection Level Metrics + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/containers": + get: + description: Returns details about all network peering containers in the + specified project for the specified cloud provider. If you do not + specify the cloud provider, MongoDB Cloud returns details about all + network peering containers in the project for Amazon Web Services (AWS). To use this resource, the requesting API Key must have the Project Read Only role. operationId: listPeeringContainerByCloudProvider @@ -6826,7 +7608,7 @@ paths: description: Creates one database user in the specified project. required: true responses: - "200": + "201": content: application/vnd.atlas.2023-01-01+json: schema: @@ -7152,7 +7934,7 @@ paths: description: Generates one X.509 certificate for the specified MongoDB user. required: true responses: - "200": + "201": content: application/vnd.atlas.2023-01-01+json: schema: @@ -7221,7 +8003,7 @@ paths: name: ipAddress schema: type: string - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ - description: Maximum number of lines from the log to return. in: query name: nLogs @@ -7298,7 +8080,7 @@ paths: name: ipAddress schema: type: string - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ - description: Maximum number of lines from the log to return. in: query name: nLogs @@ -7847,7 +8629,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/ThridPartyIntegration" + $ref: "#/components/schemas/ThirdPartyIntegration" x-xgen-version: 2023-01-01 description: OK "400": @@ -7888,7 +8670,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/ThridPartyIntegration" + $ref: "#/components/schemas/ThirdPartyIntegration" description: Third-party integration that you want to configure for your project. required: true responses: @@ -7937,7 +8719,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/ThridPartyIntegration" + $ref: "#/components/schemas/ThirdPartyIntegration" description: Third-party integration that you want to configure for your project. required: true responses: @@ -7964,6 +8746,7 @@ paths: x-xgen-experimental: true "/api/atlas/v2/groups/{groupId}/invites": get: + deprecated: true description: Returns all pending invitations to the specified project. To use this resource, the requesting API Key must have the Project Owner role. operationId: listProjectInvitations @@ -7994,7 +8777,9 @@ paths: summary: Return All Project Invitations tags: - Projects + x-sunset: 2024-10-04 patch: + deprecated: true description: Updates the details of one pending invitation to the specified project. To specify which invitation to update, provide the username of the invited user. To use this resource, the requesting API Key must have @@ -8030,7 +8815,9 @@ paths: summary: Update One Project Invitation tags: - Projects + x-sunset: 2024-10-04 post: + deprecated: true description: Invites one MongoDB Cloud user to join the specified project. The MongoDB Cloud user must accept the invitation to access information within the specified project. To use this resource, the requesting API @@ -8062,8 +8849,10 @@ paths: summary: Invite One MongoDB Cloud User to Join One Project tags: - Projects + x-sunset: 2024-10-04 "/api/atlas/v2/groups/{groupId}/invites/{invitationId}": delete: + deprecated: true description: Cancels one pending invitation sent to the specified MongoDB Cloud user to join a project. You can't cancel an invitation that the user accepted. To use this resource, the requesting API Key must have the @@ -8097,7 +8886,9 @@ paths: summary: Cancel One Project Invitation tags: - Projects + x-sunset: 2024-10-04 get: + deprecated: true description: Returns the details of one pending invitation to the specified project. To use this resource, the requesting API Key must have the Project Owner role. @@ -8132,7 +8923,9 @@ paths: summary: Return One Project Invitation tags: - Projects + x-sunset: 2024-10-04 patch: + deprecated: true description: Updates the details of one pending invitation to the specified project. To specify which invitation to update, provide the unique identification string for that invitation. Use the Return All Project @@ -8179,6 +8972,34 @@ paths: summary: Update One Project Invitation by Invitation ID tags: - Projects + x-sunset: 2024-10-04 + "/api/atlas/v2/groups/{groupId}/ipAddresses": + get: + description: Returns all IP addresses for this project. To use this resource, + the requesting API Key must have the Project Read Only role. + operationId: returnAllIPAddresses + parameters: + - $ref: "#/components/parameters/groupId" + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/GroupIPAddresses" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return All IP Addresses for One Project + tags: + - Projects + x-xgen-experimental: true "/api/atlas/v2/groups/{groupId}/limits": get: description: Returns all the limits for the specified project. To use this @@ -8427,9 +9248,11 @@ paths: description: >- Migrate one cluster that Cloud or Ops Manager manages to MongoDB Atlas. - Please make sure to [validate](#tag/Cloud-Migration-Service/operation/validateOneMigration) your migration before initiating it. + Please make sure to [validate](#tag/Cloud-Migration-Service/operation/validateMigration) your migration before initiating it. You can use this API endpoint for push live migrations only. Your API Key must have the Organization Owner role to successfully call this resource. + + **NOTE**: Migrating time-series collections is not yet supported on MongoDB 6.0 or higher. Migrations on MongoDB 6.0 or higher will skip any time-series collections on the source cluster. operationId: createPushMigration parameters: - $ref: "#/components/parameters/groupId" @@ -9555,8 +10378,12 @@ paths: endpoint service for the project. When you create a private endpoint service, MongoDB Cloud creates a network container in the project for the cloud provider for which you create the private endpoint service if - one doesn't already exist. To use this resource, the requesting API Key - must have the Project Owner role. + one doesn't already exist. To learn more about private endpoint + terminology in MongoDB Cloud, see Private Endpoint Concepts. To use this + resource, the requesting API Key must have the Project Owner role. + externalDocs: + description: Private Endpoint Concepts + url: https://dochub.mongodb.org/core/private-endpoint-concepts operationId: createPrivateEndpointService parameters: - $ref: "#/components/parameters/groupId" @@ -10481,6 +11308,35 @@ paths: summary: Return One MongoDB Process by ID tags: - Monitoring and Logs + "/api/atlas/v2/groups/{groupId}/processes/{processId}/collStats/namespaces": + get: + description: Return the subset of namespaces from the given process ranked by + highest total execution time (descending) within the given time window. + operationId: getCollStatsLatencyNamespacesForHost + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - $ref: "#/components/parameters/period" + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/CollStatsRankedNamespaces" + x-xgen-version: 2023-11-15 + description: Succeeded + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Ranked Namespaces from a Host + tags: + - Collection Level Metrics + x-xgen-experimental: true "/api/atlas/v2/groups/{groupId}/processes/{processId}/databases": get: description: Returns the list of databases running on the specified host for the @@ -10638,6 +11494,8 @@ paths: $ref: "#/components/responses/unauthorized" "500": $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] summary: Return Measurements of One Database for One MongoDB Process tags: - Monitoring and Logs @@ -10915,8 +11773,8 @@ paths: pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the suggested indexes. - This parameter expresses its value in the number of seconds that - have elapsed since the [UNIX + This parameter expresses its value in the number of milliseconds + that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). @@ -10928,7 +11786,7 @@ paths: schema: type: integer format: int64 - minimum: 1199145600 + minimum: 1199145600000 responses: "200": content: @@ -11007,8 +11865,8 @@ paths: pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the slow queries. This - parameter expresses its value in the number of seconds that have - elapsed since the [UNIX + parameter expresses its value in the number of milliseconds that + have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). @@ -11020,7 +11878,7 @@ paths: schema: type: integer format: int64 - minimum: 1199145600 + minimum: 1199145600000 responses: "200": content: @@ -11104,8 +11962,8 @@ paths: pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ - description: >- Date and time from which the query retrieves the suggested indexes. - This parameter expresses its value in the number of seconds that - have elapsed since the [UNIX + This parameter expresses its value in the number of milliseconds + that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). @@ -11117,6 +11975,7 @@ paths: schema: type: integer format: int64 + minimum: 1199145600000 responses: "200": content: @@ -11134,6 +11993,52 @@ paths: summary: Return Suggested Indexes tags: - Performance Advisor + "/api/atlas/v2/groups/{groupId}/processes/{processId}/{databaseName}/{collectionName}/collStats/measurements": + get: + description: Get a list of the Coll Stats Latency process-level measurements for + the given namespace + operationId: getCollStatsLatencyNamespaceHostMeasurements + parameters: + - $ref: "#/components/parameters/groupId" + - $ref: "#/components/parameters/processId" + - $ref: "#/components/parameters/databaseName" + - $ref: "#/components/parameters/collectionName" + - description: List that contains the metrics that you want to retrieve for the + associated data series. If you don't set this parameter, this + resource returns data series for all Coll Stats Latency metrics. + in: query + name: metrics + schema: + type: array + items: + type: string + description: Metric requested for the given process + uniqueItems: true + - $ref: "#/components/parameters/start" + - $ref: "#/components/parameters/end" + - $ref: "#/components/parameters/period" + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/MeasurementsCollStatsLatencyHost" + x-xgen-version: 2023-11-15 + description: Succeeded + "400": + $ref: "#/components/responses/badRequest" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Host-Level Query Latency + tags: + - Collection Level Metrics + x-xgen-experimental: true "/api/atlas/v2/groups/{groupId}/pushBasedLogExport": delete: description: Disables the push-based log export feature by resetting the project @@ -11238,7 +12143,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/PushBasedLogExportProject" + $ref: "#/components/schemas/CreatePushBasedLogExportProjectRequest" x-xgen-version: 2023-01-01 description: The project configuration details. The S3 bucket name, IAM role ID, and prefix path fields are required. @@ -11620,13 +12525,84 @@ paths: summary: Return One Snapshot of One Serverless Instance tags: - Cloud Backups - "/api/atlas/v2/groups/{groupId}/serverless/{name}": - delete: - description: Removes one serverless instance from the specified project. The - serverless instance must have termination protection disabled in order - to be deleted. To use this resource, the requesting API Key must have - the Project Owner role. - operationId: deleteServerlessInstance + "/api/atlas/v2/groups/{groupId}/serverless/{clusterName}/performanceAdvisor/autoIndexing": + get: + description: Get whether the Serverless Auto Indexing feature is enabled. + operationId: getServerlessAutoIndexing + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + type: boolean + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Return Serverless Auto Indexing Enabled + tags: + - Performance Advisor + x-xgen-experimental: true + post: + description: Set whether the Serverless Auto Indexing feature is enabled. + operationId: setServerlessAutoIndexing + parameters: + - $ref: "#/components/parameters/groupId" + - description: Human-readable label that identifies the cluster. + in: path + name: clusterName + required: true + schema: + type: string + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + - description: Value that we want to set for the Serverless Auto Indexing toggle. + in: query + name: enable + required: true + schema: + type: boolean + responses: + "200": + content: + application/vnd.atlas.2023-01-01+json: + schema: + $ref: "#/components/schemas/NoBody" + x-xgen-version: 2023-01-01 + description: OK + "401": + $ref: "#/components/responses/unauthorized" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Set Serverless Auto Indexing + tags: + - Performance Advisor + x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/serverless/{name}": + delete: + description: Removes one serverless instance from the specified project. The + serverless instance must have termination protection disabled in order + to be deleted. To use this resource, the requesting API Key must have + the Project Owner role. + operationId: deleteServerlessInstance parameters: - $ref: "#/components/parameters/groupId" - description: Human-readable label that identifies the serverless instance. @@ -11832,7 +12808,8 @@ paths: x-xgen-experimental: true post: description: Creates one stream instance in the specified project. To use this - resource, the requesting API Key must have the Project Owner roles. + resource, the requesting API Key must have the Project Data Access Admin + role, Project Owner role or Project Stream Processing Owner role. operationId: createStreamInstance parameters: - $ref: "#/components/parameters/groupId" @@ -11869,7 +12846,8 @@ paths: "/api/atlas/v2/groups/{groupId}/streams/{tenantName}": delete: description: Delete one stream instance in the specified project. To use this - resource, the requesting API Key must have the Project Owner roles. + resource, the requesting API Key must have the Project Data Access Admin + role, Project Owner role or Project Stream Processing Owner role. operationId: deleteStreamInstance parameters: - $ref: "#/components/parameters/groupId" @@ -11907,7 +12885,8 @@ paths: get: description: Returns the details of one stream instance within the specified project. To use this resource, the requesting API Key must have the - Project Read Only role. + Project Data Access roles, Project Owner role or Project Stream + Processing Owner role. operationId: getStreamInstance parameters: - $ref: "#/components/parameters/groupId" @@ -11950,7 +12929,8 @@ paths: x-xgen-experimental: true patch: description: Update one stream instance in the specified project. To use this - resource, the requesting API Key must have the Project Owner roles. + resource, the requesting API Key must have the Project Data Access Admin + role, Project Owner role or Project Stream Processing Owner role. operationId: updateStreamInstance parameters: - $ref: "#/components/parameters/groupId" @@ -11995,9 +12975,75 @@ paths: 2023-09-11: The MongoDB Atlas Streams Processing API is now exposed as part of private preview, but is subject to change until GA. x-xgen-experimental: true + "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/auditLogs": + get: + description: Downloads the audit logs for the specified Atlas Streams Processing + instance. By default, logs cover periods of 30 days. To use this + resource, the requesting API Key must have the Project Data Access + roles, Project Owner role or Project Stream Processing Owner role. + operationId: downloadStreamTenantAuditLogs + parameters: + - $ref: "#/components/parameters/groupId" + - description: Timestamp that specifies the end point for the range of log + messages to download. MongoDB Cloud expresses this timestamp in the + number of seconds that have elapsed since the UNIX epoch. + in: query + name: endDate + schema: + type: integer + format: int64 + example: 1636481348 + pattern: "1199145600" + - description: Timestamp that specifies the starting point for the range of log + messages to download. MongoDB Cloud expresses this timestamp in the + number of seconds that have elapsed since the UNIX epoch. + in: query + name: startDate + schema: + type: integer + format: int64 + example: 1636466948 + pattern: "1199145600" + - description: Human-readable label that identifies the stream instance. + in: path + name: tenantName + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.atlas.2023-02-01+gzip: + schema: + type: string + format: binary + description: Compressed archive labeled `auditLogs.gz` downloads + x-xgen-version: 2023-02-01 + description: OK + "400": + $ref: "#/components/responses/badRequest" + "401": + $ref: "#/components/responses/unauthorized" + "403": + $ref: "#/components/responses/forbidden" + "404": + $ref: "#/components/responses/notFound" + "409": + $ref: "#/components/responses/conflict" + "500": + $ref: "#/components/responses/internalServerError" + security: + - DigestAuth: [] + summary: Download Audit Logs for One Atlas Stream Processing Instance + tags: + - Streams + x-xgen-experimental: true "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections": get: - description: Returns all connections of the stream instance for the specified project. + description: Returns all connections of the stream instance for the specified + project.To use this resource, the requesting API Key must have the + Project Data Access roles, Project Owner role or Project Stream + Processing Owner role. operationId: listStreamConnections parameters: - $ref: "#/components/parameters/groupId" @@ -12035,7 +13081,7 @@ paths: post: description: Creates one connection for a stream instance in the specified project. To use this resource, the requesting API Key must have the - Project Owner roles. + Project Owner or Project Stream Processing Owner role. operationId: createStreamConnection parameters: - $ref: "#/components/parameters/groupId" @@ -12081,7 +13127,8 @@ paths: "/api/atlas/v2/groups/{groupId}/streams/{tenantName}/connections/{connectionName}": delete: description: Delete one connection of the specified stream instance. To use this - resource, the requesting API Key must have the Project Owner roles. + resource, the requesting API Key must have the Project Owner role or + Project Stream Processing Owner role. operationId: deleteStreamConnection parameters: - $ref: "#/components/parameters/groupId" @@ -12167,7 +13214,7 @@ paths: patch: description: Update one connection for the specified stream instance in the specified project. To use this resource, the requesting API Key must - have the Project Owner roles. + have the Project Owner role or Project Stream Processing Owner role. operationId: updateStreamConnection parameters: - $ref: "#/components/parameters/groupId" @@ -13124,7 +14171,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/PaginatedApiUserAccessList" + $ref: "#/components/schemas/PaginatedApiUserAccessListResponse" x-xgen-version: 2023-01-01 description: OK "401": @@ -13164,7 +14211,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/UserAccessList" + $ref: "#/components/schemas/UserAccessListRequest" description: Access list entries to be created for the specified organization API key. required: true @@ -13173,7 +14220,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/PaginatedApiUserAccessList" + $ref: "#/components/schemas/PaginatedApiUserAccessListResponse" x-xgen-version: 2023-01-01 description: OK "400": @@ -13285,7 +14332,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/UserAccessList" + $ref: "#/components/schemas/UserAccessListResponse" x-xgen-version: 2023-01-01 description: OK "401": @@ -13304,7 +14351,7 @@ paths: post: description: Creates a query process within the Cost Explorer for the given parameters. A token is returned that can be used to poll the status of - the query and eventually retrievethe results. + the query and eventually retrieve the results. operationId: createCostExplorerQueryProcess parameters: - $ref: "#/components/parameters/orgId" @@ -13965,6 +15012,8 @@ paths: description: OK "401": $ref: "#/components/responses/unauthorized" + "404": + $ref: "#/components/responses/notFound" "500": $ref: "#/components/responses/internalServerError" security: @@ -14357,7 +15406,7 @@ paths: content: application/vnd.atlas.2023-01-01+json: schema: - $ref: "#/components/schemas/Team" + $ref: "#/components/schemas/TeamUpdate" description: Details to update on the specified team. required: true responses: @@ -14663,6 +15712,27 @@ paths: tags: - Organizations x-xgen-experimental: true + /api/atlas/v2/unauth/controlPlaneIPAddresses: + get: + description: Returns all control plane IP addresses. + operationId: returnAllControlPlaneIPAddresses + parameters: [] + responses: + "200": + content: + application/vnd.atlas.2023-11-15+json: + schema: + $ref: "#/components/schemas/ControlPlaneIPAddresses" + x-xgen-version: 2023-11-15 + description: OK + "500": + $ref: "#/components/responses/internalServerError" + security: + - Unauthenticated: [] + summary: Return All Control Plane IP Addresses + tags: + - Root + x-xgen-experimental: true /api/atlas/v2/users: post: description: >- @@ -14862,7 +15932,10 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ identityProviderId: - description: Unique 20-hexadecimal digit string that identifies the identity provider. + description: Legacy 20-hexadecimal digit string that identifies the identity + provider. This id can be found within the Federation Management Console + > Identity Providers tab by clicking the info icon in the IdP ID row of + a configured identity provider. in: path name: identityProviderId required: true @@ -14991,9 +16064,7 @@ components: detail: (This is just an example, the exception may not be related to this endpoint) No provider AWS exists. error: 400 - errorCode: INVALID_PROVIDER - parameters: - - AWS + errorCode: VALIDATION_ERROR reason: Bad Request schema: $ref: "#/components/schemas/ApiError" @@ -15006,9 +16077,7 @@ components: endpoint) Cannot delete organization link while there is active migration in following project ids: 60c4fd418ebe251047c50554" error: 409 - errorCode: CANNOT_DELETE_ORG_LINK_WITH_RUNNING_LIVE_EXPORT - parameters: - - 60c4fd418ebe251047c50554 + errorCode: CANNOT_DELETE_ORG_ACTIVE_LIVE_MIGRATION_ATLAS_ORG_LINK reason: Conflict schema: $ref: "#/components/schemas/ApiError" @@ -15021,8 +16090,6 @@ components: endpoint) error: 403 errorCode: CANNOT_CHANGE_GROUP_NAME - parameters: - - EXAMPLE reason: Forbidden schema: $ref: "#/components/schemas/ApiError" @@ -15035,8 +16102,6 @@ components: in the past. error: 410 errorCode: VERSION_GONE - parameters: - - EXAMPLE reason: Gone schema: $ref: "#/components/schemas/ApiError" @@ -15049,8 +16114,6 @@ components: endpoint) error: 500 errorCode: UNEXPECTED_ERROR - parameters: - - EXAMPLE reason: Internal Server Error schema: $ref: "#/components/schemas/ApiError" @@ -15063,8 +16126,6 @@ components: endpoint) error: 405 errorCode: ATLAS_BACKUP_CANCEL_SHARD_RESTORE_JOB_NOT_ALLOWED - parameters: - - EXAMPLE reason: Method Not Allowed schema: $ref: "#/components/schemas/ApiError" @@ -15079,8 +16140,6 @@ components: endpoint) Cannot find resource AWS error: 404 errorCode: RESOURCE_NOT_FOUND - parameters: - - AWS reason: Not Found schema: $ref: "#/components/schemas/ApiError" @@ -15093,8 +16152,6 @@ components: endpoint) error: 402 errorCode: NO_PAYMENT_INFORMATION_FOUND - parameters: - - EXAMPLE reason: Payment Required schema: $ref: "#/components/schemas/ApiError" @@ -15107,8 +16164,6 @@ components: endpoint) error: 401 errorCode: NOT_ORG_GROUP_CREATOR - parameters: - - EXAMPLE reason: Unauthorized schema: $ref: "#/components/schemas/ApiError" @@ -15257,6 +16312,13 @@ components: storage space, consider upgrading your cluster to a higher tier. maximum: 4096 minimum: 10 + diskWarmingMode: + type: string + default: FULLY_WARMED + description: Disk warming mode selection. + externalDocs: + description: Reduce Secondary Disk Warming Impact + url: https://docs.atlas.mongodb.com/reference/replica-set-tags/#reduce-secondary-disk-warming-impact encryptionAtRestProvider: type: string description: 'Cloud service provider that manages your customer keys to provide @@ -15291,13 +16353,14 @@ components: readOnly: true labels: type: array + deprecated: true description: >- Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels. - Cluster labels will be deprecated in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. + Cluster labels are deprecated and will be removed in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. items: $ref: "#/components/schemas/ComponentLabel" links: @@ -15313,7 +16376,7 @@ components: readOnly: true mongoDBMajorVersion: type: string - default: "6.0" + default: "7.0" description: Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version. mongoDBVersion: @@ -15603,6 +16666,35 @@ components: minLength: 1 pattern: ^([a-f0-9]{24})$ readOnly: true + instanceName: + type: string + description: The name of the Stream Processing Instance to which this alert + applies. The resource returns this parameter for alerts of events + impacting Stream Processing Instances. + example: foobar + readOnly: true + processorErrorMsg: + type: string + description: The error message associated with the Stream Processor to which + this alert applies. + example: "MongoServerError: Failed to start stream processor: (Location77175) + Could not connect to the Kafka topic with kafka error code: -195, + message: Local: Broker transport failure.: (Location77175)" + readOnly: true + processorName: + type: string + description: The name of the Stream Processor to which this alert applies. The + resource returns this parameter for alerts of events impacting + Stream Processors. + example: foobar + readOnly: true + processorState: + type: string + description: The state of the Stream Processor to which this alert applies. The + resource returns this parameter for alerts of events impacting + Stream Processors. + example: STARTED + readOnly: true AlertsNotificationRootForGroup: type: object description: One target that MongoDB Cloud sends notifications when an alert triggers. @@ -15639,6 +16731,11 @@ components: format: int32 description: Number of minutes that MongoDB Cloud waits after detecting an alert condition before it sends out the first notification. + integrationId: + type: string + description: The id of the associated integration, the credentials of which to + use for requests. + example: 32b6e34b3d91647abb20e7b8 intervalMin: type: integer format: int32 @@ -15655,7 +16752,7 @@ components: description: The notifierId is a system-generated unique identifier assigned to each notification method. This is needed when updating third-party notifications without requiring explicit authentication credentials. - example: 6462742adc47d365036da07c + example: 32b6e34b3d91647abb20e7b8 typeName: type: string description: Human-readable label that displays the alert notification type. @@ -15665,7 +16762,7 @@ components: description: >- Email address to which MongoDB Cloud sends alert notifications. The resource requires this parameter when `"notifications.[n].typeName" - : "EMAIL"`. You don’t need to set this value to send emails to + : "EMAIL"`. You don't need to set this value to send emails to individual or groups of MongoDB Cloud users including: @@ -15932,21 +17029,18 @@ components: type: integer format: int32 description: HTTP status code returned with this error. - maximum: 599 - minimum: 200 + externalDocs: + url: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status errorCode: type: string description: Application error code returned with this error. - example: TOO_MANY_GROUP_NOTIFICATIONS parameters: type: array - description: Parameter uses to give more information about the error. + description: Parameters used to give more information about the error. items: {} reason: type: string description: Application error message returned with this error. - example: At most one group notification can be specified for an alert - configuration. ApiHostView_Atlas: type: object properties: @@ -15972,7 +17066,7 @@ components: description: Hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (`mongod` or `mongos`). - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ readOnly: true id: type: string @@ -16080,6 +17174,7 @@ components: - publicKey ApiKeyUserDetails: type: object + description: Details of the Programmatic API Keys. properties: desc: type: string @@ -16234,6 +17329,7 @@ components: | `REGION` | Simulates a cluster outage for a region.| AtlasOrganization: type: object + description: Details that describe the organization. properties: id: type: string @@ -16296,10 +17392,6 @@ components: default: false description: Flag that indicates whether someone enabled database auditing for the specified project. - required: - - auditAuthorizationSuccess - - auditFilter - - enabled AuthFederationRoleMapping: type: object description: Mapping settings that link one IdP and MongoDB Cloud. @@ -16307,7 +17399,7 @@ components: externalGroupName: type: string description: Unique human-readable label that identifies the identity provider - group to whichthis role mapping applies. + group to which this role mapping applies. maxLength: 200 minLength: 1 id: @@ -16330,7 +17422,6 @@ components: title: Federated Authentication Role Mapping AvailableCloudProviderRegion: type: object - description: List of regions that this cloud provider supports for this instance size. properties: default: type: boolean @@ -16342,7 +17433,6 @@ components: type: string description: Human-readable label that identifies the supported region. readOnly: true - readOnly: true AvailableClustersDeployment: type: object description: Deployments that can be migrated to MongoDB Atlas. @@ -16480,6 +17570,103 @@ components: description: Flag that indicates whether the Azure encryption key can encrypt and decrypt data. readOnly: true + BackupComplianceOnDemandPolicyItem: + type: object + description: Specifications for on-demand policy. + properties: + frequencyInterval: + type: integer + format: int32 + description: Number that indicates the frequency interval for a set of + snapshots. MongoDB Cloud ignores this setting for non-hourly policy + items in Backup Compliance Policy settings. + frequencyType: + type: string + description: Human-readable label that identifies the frequency type associated + with the backup policy. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this backup + policy item. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + retentionUnit: + type: string + description: Unit of time in which MongoDB Cloud measures snapshot retention. + retentionValue: + type: integer + format: int32 + description: >- + Duration in days, weeks, months, or years that MongoDB Cloud retains + the snapshot. For less frequent policy items, MongoDB Cloud requires + that you specify a value greater than or equal to the value + specified for more frequent policy items. + + + For example: If the hourly policy item specifies a retention of two days, you must specify two days or greater for the retention of the weekly policy item. + required: + - frequencyInterval + - frequencyType + - retentionUnit + - retentionValue + BackupComplianceScheduledPolicyItem: + type: object + description: Specifications for scheduled policy. + properties: + frequencyInterval: + type: integer + format: int32 + description: >- + Number that indicates the frequency interval for a set of snapshots. + A value of `1` specifies the first instance of the corresponding + `frequencyType`. + + + - In a yearly policy item, `1` indicates that the yearly snapshot occurs on the first day of January and `12` indicates the first day of December. + + + - In a monthly policy item, `1` indicates that the monthly snapshot occurs on the first day of the month and `40` indicates the last day of the month. + + + - In a weekly policy item, `1` indicates that the weekly snapshot occurs on Monday and `7` indicates Sunday. + + + - In an hourly policy item, you can set the frequency interval to `1`, `2`, `4`, `6`, `8`, or `12`. For hourly policy items for NVMe clusters, MongoDB Cloud accepts only `12` as the frequency interval value. + + MongoDB Cloud ignores this setting for non-hourly policy items in Backup Compliance Policy settings. + frequencyType: + type: string + description: Human-readable label that identifies the frequency type associated + with the backup policy. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies this backup + policy item. + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + retentionUnit: + type: string + description: Unit of time in which MongoDB Cloud measures snapshot retention. + retentionValue: + type: integer + format: int32 + description: >- + Duration in days, weeks, months, or years that MongoDB Cloud retains + the snapshot. For less frequent policy items, MongoDB Cloud requires + that you specify a value greater than or equal to the value + specified for more frequent policy items. + + + For example: If the hourly policy item specifies a retention of two days, you must specify two days or greater for the retention of the weekly policy item. + required: + - frequencyInterval + - frequencyType + - retentionUnit + - retentionValue BackupLabel: type: object description: Collection of key-value pairs that represent custom data to add to @@ -16518,6 +17705,7 @@ components: type: string description: Human-readable label that identifies the collection for which you created the online archive. + readOnly: true collectionType: type: string default: STANDARD @@ -16527,8 +17715,11 @@ components: If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`. + readOnly: true criteria: $ref: "#/components/schemas/Criteria" + dataExpirationRule: + $ref: "#/components/schemas/DataExpirationRule" dataProcessRegion: $ref: "#/components/schemas/DataProcessRegion" dataSetName: @@ -16540,6 +17731,7 @@ components: type: string description: Human-readable label of the database that contains the collection that contains the online archive. + readOnly: true groupId: type: string description: Unique 24-hexadecimal digit string that identifies the project that @@ -16568,6 +17760,7 @@ components: items: $ref: "#/components/schemas/PartitionField" minItems: 1 + readOnly: true paused: type: boolean description: Flag that indicates whether this online archive exists in the @@ -16627,6 +17820,7 @@ components: type: string description: Human-readable label that identifies the collection for which you created the online archive. + writeOnly: true collectionType: type: string default: STANDARD @@ -16636,10 +17830,13 @@ components: If you set this parameter to `TIMESERIES`, set `"criteria.type" : "date"` and `"criteria.dateFormat" : "ISODATE"`. + writeOnly: true criteria: $ref: "#/components/schemas/Criteria" + dataExpirationRule: + $ref: "#/components/schemas/DataExpirationRule" dataProcessRegion: - $ref: "#/components/schemas/DataProcessRegion" + $ref: "#/components/schemas/CreateDataProcessRegion" dataSetName: type: string description: Human-readable label that identifies the dataset that Atlas @@ -16649,6 +17846,7 @@ components: type: string description: Human-readable label of the database that contains the collection that contains the online archive. + writeOnly: true groupId: type: string description: Unique 24-hexadecimal digit string that identifies the project that @@ -16677,6 +17875,7 @@ components: items: $ref: "#/components/schemas/PartitionField" minItems: 1 + writeOnly: true paused: type: boolean description: Flag that indicates whether this online archive exists in the @@ -17176,12 +18375,12 @@ components: retentionValue: type: integer format: int32 - description: Number that indicates the amount of days, weeks, or months that - MongoDB Cloud retains the snapshot. For less frequent policy items, - MongoDB Cloud requires that you specify a value greater than or - equal to the value specified for more frequent policy items. If the - hourly policy item specifies a retention of two days, specify two - days or greater for the retention of the weekly policy item. + description: Number that indicates the amount of days, weeks, months, or years + that MongoDB Cloud retains the snapshot. For less frequent policy + items, MongoDB Cloud requires that you specify a value greater than + or equal to the value specified for more frequent policy items. If + the hourly policy item specifies a retention of two days, specify + two days or greater for the retention of the weekly policy item. example: 5 required: - retentionUnit @@ -17308,7 +18507,7 @@ components: description: Internet Protocol (IP) addresses expressed in Classless Inter-Domain Routing (CIDR) notation of the VPC's subnet that you want to peer with the MongoDB Cloud VPC. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ statusName: type: string description: State of the network peering connection at the time you made the @@ -17379,6 +18578,13 @@ components: BaseStreamsRegion: type: string description: Name of the cloud provider region hosting Atlas Stream Processing. + BasicDBObject: + type: object + additionalProperties: + description: Fields to index for vector search. + title: Field + description: Fields to index for vector search. + title: Field BiConnector: type: object description: Settings needed to configure the MongoDB Connector for Business @@ -17751,6 +18957,8 @@ components: * GROUP_SEARCH_INDEX_EDITOR + * GROUP_STREAM_PROCESSING_OWNER + title: Role Assignment CloudAppUser: type: object @@ -17770,7 +18978,9 @@ components: emailAddress: type: string format: email + deprecated: true description: Email address that belongs to the MongoDB Cloud user. + readOnly: true firstName: type: string description: First or given name that belongs to the MongoDB Cloud user. @@ -18007,10 +19217,11 @@ components: $ref: "#/components/schemas/DatabaseUserRole" scopes: type: array - description: List that contains clusters and MongoDB Atlas Data Lakes that this - database user can access. If omitted, MongoDB Cloud grants the - database user access to all the clusters and MongoDB Atlas Data - Lakes in the project. + description: List that contains clusters, MongoDB Atlas Data Lakes, and MongoDB + Atlas Streams Instances that this database user can access. If + omitted, MongoDB Cloud grants the database user access to all the + clusters, MongoDB Atlas Data Lakes, and MongoDB Atlas Streams + Instances in the project. items: $ref: "#/components/schemas/UserScope" username: @@ -18407,7 +19618,7 @@ components: You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project. **Example:** A project in an Amazon Web Services (AWS) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of `/24` equals 27 three-node replica sets. - pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|(:{0,2}([0-9a-f]{1,4}:){0,7}[0-9a-f]{1,4}[:]{0,2}))((%2[fF]|/)[0-9]{1,3})+$ azureSubscriptionId: type: string description: Unique string that identifies the Azure subscription in which the @@ -18536,15 +19747,16 @@ components: type: string description: Physical location of your MongoDB cluster nodes. The region you choose can affect network latency for clients accessing your - databases. When MongoDB Cloud deploys a dedicated cluster, it checks - if a VPC or VPC connection exists for that provider and region. If - not, MongoDB Cloud creates them as part of the deployment. It - assigns the VPC a Classless Inter-Domain Routing (CIDR) block. To - limit a new VPC peering connection to one Classless Inter-Domain - Routing (CIDR) block and region, create the connection first. Deploy - the cluster after the connection starts. GCP Clusters and - Multi-region clusters require one VPC peering connection for each - region. MongoDB nodes can use only the peering connection that + databases. The region name is only returned in the response for + single-region clusters. When MongoDB Cloud deploys a dedicated + cluster, it checks if a VPC or VPC connection exists for that + provider and region. If not, MongoDB Cloud creates them as part of + the deployment. It assigns the VPC a Classless Inter-Domain Routing + (CIDR) block. To limit a new VPC peering connection to one Classless + Inter-Domain Routing (CIDR) block and region, create the connection + first. Deploy the cluster after the connection starts. GCP Clusters + and Multi-region clusters require one VPC peering connection for + each region. MongoDB nodes can use only the peering connection that resides in the same region as the nodes to communicate with the peered VPC. analyticsAutoScaling: @@ -18559,8 +19771,8 @@ components: type: string description: Cloud service provider on which MongoDB Cloud provisioned the multi-tenant cluster. The resource returns this parameter when - **providerSettings.providerName** is `TENANT` and - **providerSetting.instanceSizeName** is `M2` or `M5`. + **providerName** is `TENANT` and **electableSpecs.instanceSize** is + `M0`, `M2` or `M5`. title: Cloud Service Provider Settings for Multi-Cloud Clusters CloudSearchMetrics: type: object @@ -18632,7 +19844,6 @@ components: title: Automatic Cluster Scaling Settings ClusterCloudProviderInstanceSize: type: object - description: List of instances sizes that this cloud provider supports. properties: availableRegions: type: array @@ -18646,7 +19857,6 @@ components: description: Human-readable label that identifies the instance size or cluster tier. readOnly: true - readOnly: true ClusterComputeAutoScaling: type: object description: Collection of settings that configures how a cluster might scale @@ -18902,11 +20112,14 @@ components: failIndexKeyTooLong: type: boolean default: true + deprecated: true description: Flag that indicates whether you can insert or update documents where all indexed entries don't exceed 1024 bytes. If you set this to false, [mongod](https://docs.mongodb.com/upcoming/reference/program/mongod/#mongodb-binary-bin.mongod) - writes documents that exceed this limit but doesn't index them. + writes documents that exceed this limit but doesn't index them. This + parameter has been removed as of [MongoDB + 4.4](https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.failIndexKeyTooLong). externalDocs: description: This option corresponds to the `failIndexKeyTooLong` `mongod` configuration file option. @@ -18963,6 +20176,18 @@ components: description: This option corresponds to the `replication.oplogSizeMB` `mongod` configuration file option. url: https://docs.mongodb.com/upcoming/reference/configuration-options/#mongodb-setting-replication.oplogSizeMB + queryStatsLogVerbosity: + type: integer + format: int32 + default: 1 + description: May be set to 1 (disabled) or 3 (enabled). When set to 3, Atlas + will include redacted and anonymized $queryStats output in MongoDB + logs. $queryStats output does not contain literals or field values. + Enabling this setting might impact the performance of your cluster. + externalDocs: + description: This option corresponds to the queryStats component for the + logComponentVerbosity server parameter. + url: https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.logComponentVerbosity sampleRefreshIntervalBIConnector: type: integer format: int32 @@ -19005,6 +20230,33 @@ components: description: Collection of settings that configures how a cluster might scale its cluster tier and whether the cluster can scale down. title: Tenant + ClusterIPAddresses: + type: object + description: List of IP addresses in a cluster. + properties: + clusterName: + type: string + description: Human-readable label that identifies the cluster. + readOnly: true + inbound: + type: array + description: List of inbound IP addresses associated with the cluster. If your + network allows outbound HTTP requests only to specific IP addresses, + you must allow access to the following IP addresses so that your + application can connect to your Atlas cluster. + items: + type: string + readOnly: true + outbound: + type: array + description: List of outbound IP addresses associated with the cluster. If your + network allows inbound HTTP requests only from specific IP + addresses, you must allow access from the following IP addresses so + that your Atlas cluster can communicate with your webhooks and KMS. + items: + type: string + readOnly: true + title: Cluster IP Addresses ClusterOutageSimulation: type: object properties: @@ -19138,7 +20390,8 @@ components: default Input/Output Operations per Second (IOPS) rate for the selected volume size (`STANDARD`), or must fall within the allowable Input/Output Operations per Second (IOPS) range for the selected - volume size (`PROVISIONED`). + volume size (`PROVISIONED`). You must set this value to + (`PROVISIONED`) for NVMe clusters. diskTypeName: type: string description: Disk type that corresponds to the host's root volume for Azure @@ -19152,13 +20405,51 @@ components: description: Cloud service provider on which MongoDB Cloud provisioned the multi-tenant host. The resource returns this parameter when **providerSettings.providerName** is `TENANT` and - **providerSetting.instanceSizeName** is `M2` or `M5`. + **providerSetting.instanceSizeName** is `M0`, `M2` or `M5`. required: - providerName title: Cloud Service Provider Settings for a Cluster ClusterSearchIndex: type: object properties: + collectionName: + type: string + description: Human-readable label that identifies the collection that contains + one or more Atlas Search indexes. + database: + type: string + description: Human-readable label that identifies the database that contains the + collection with one or more Atlas Search indexes. + indexID: + type: string + description: Unique 24-hexadecimal digit string that identifies this Atlas + Search index. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + name: + type: string + description: Human-readable label that identifies this index. Within each + namespace, names of all indexes in the namespace must be unique. + status: + type: string + description: > + Condition of the search index when you made this request. + + + | Status | Index Condition | + |---|---| + | IN_PROGRESS | Atlas is building or re-building the index after an edit. | + | STEADY | You can use this search index. | + | FAILED | Atlas could not build the index. | + | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | + | PAUSED | The cluster is paused. | + readOnly: true + type: + type: string + description: Type of the index. Default type is search. analyzer: type: string default: lucene.standard @@ -19196,47 +20487,26 @@ components: url: https://docs.atlas.mongodb.com/atlas-search/analyzers/custom/ items: $ref: "#/components/schemas/ApiAtlasFTSAnalyzers" - collectionName: - type: string - description: Human-readable label that identifies the collection that contains - one or more Atlas Search indexes. - database: - type: string - description: Human-readable label that identifies the database that contains the - collection with one or more Atlas Search indexes. - indexID: - type: string - description: Unique 24-hexadecimal digit string that identifies this Atlas - Search index. - example: 32b6e34b3d91647abb20e7b8 - maxLength: 24 - minLength: 24 - pattern: ^([a-f0-9]{24})$ - readOnly: true mappings: $ref: "#/components/schemas/ApiAtlasFTSMappings" - name: - type: string - description: Human-readable label that identifies this index. Within each - namespace, names of all indexes in the namespace must be unique. searchAnalyzer: type: string default: lucene.standard description: Method applied to identify words when searching this index. - status: - type: string - description: > - Condition of the search index when you made this request. - - - | Status | Index Condition | - |---|---| - | IN_PROGRESS | Atlas is building or re-building the index after an edit. | - | STEADY | You can use this search index. | - | FAILED | Atlas could not build the index. | - | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. | - | PAUSED | The cluster is paused. | - readOnly: true + storedSource: + type: object + description: Flag that indicates whether to store all fields (true) on Atlas + Search. By default, Atlas doesn't store (false) the fields on Atlas + Search. Alternatively, you can specify an object that only contains + the list of fields to store (include) or not store (exclude) on + Atlas Search. To learn more, see documentation. + example: + include | exclude: + - field1 + - field2 + externalDocs: + description: Stored Source Fields + url: https://dochub.mongodb.org/core/atlas-search-stored-source synonyms: type: array description: Rule sets that map words to their synonyms in this index. @@ -19245,6 +20515,16 @@ components: url: https://docs.atlas.mongodb.com/atlas-search/synonyms/ items: $ref: "#/components/schemas/SearchSynonymMappingDefinition" + fields: + type: array + description: Settings that configure the fields, one per object, to index. You + must define at least one "vector" type field. You can optionally + define "filter" type fields also. + externalDocs: + description: Vector Search Fields + url: https://dochub.mongodb.org/core/avs-vector-type + items: + $ref: "#/components/schemas/BasicDBObject" required: - collectionName - database @@ -19441,12 +20721,13 @@ components: properties: dataAccessIdentityProviderIds: type: array - description: The collection of unique ids of the identity providers for org's - data access. + description: The collection of unique ids representing the identity providers + that can be used for data access in this organization. items: type: string - description: Unique 24-hexadecimal digit string that identifies the id of the - identity provider for org's data access. + description: Unique 24-hexadecimal digit string that represents the id of the + identity providers that can be used for data access in this + organization. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -19465,8 +20746,11 @@ components: connected org. identityProviderId: type: string - description: Unique 20-hexadecimal digit string that identifies the identity - provider that this connected org config is associated with. + description: Legacy 20-hexadecimal digit string that identifies the UI access + identity provider that this connected org config is associated with. + This id can be found within the Federation Management Console > + Identity Providers tab by clicking the info icon in the IdP ID row + of a configured identity provider. maxLength: 20 minLength: 20 pattern: ^([a-f0-9]{20})$ @@ -19482,10 +20766,12 @@ components: postAuthRoleGrants: type: array description: Atlas roles that are granted to a user in this organization after - authenticating. + authenticating. Roles are a human-readable label that identifies the + collection of privileges that MongoDB Cloud grants a specific + MongoDB Cloud user. These roles can only be organization specific + roles. items: type: string - description: Organization role the user has in Atlas. uniqueItems: true roleMappings: type: array @@ -19501,8 +20787,16 @@ components: $ref: "#/components/schemas/FederatedUser" required: - domainRestrictionEnabled - - identityProviderId - orgId + ControlPlaneIPAddresses: + type: object + description: List of IP addresses in the Atlas control plane. + properties: + inbound: + $ref: "#/components/schemas/InboundControlPlaneCloudProviderIPAddresses" + outbound: + $ref: "#/components/schemas/OutboundControlPlaneCloudProviderIPAddresses" + title: Control Plane IP Addresses CostExplorerFilterRequestBody: type: object description: Request body for a cost explorer query. @@ -19568,6 +20862,7 @@ components: type: object CreateAtlasOrganizationApiKey: type: object + description: Details of the programmatic API key to be created. properties: desc: type: string @@ -19619,7 +20914,7 @@ components: type: string description: IPv4 address of the private endpoint in your Azure VNet that someone added to this private endpoint service. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ endpointGroupName: type: string description: Human-readable label that identifies a set of endpoints. @@ -19658,7 +20953,7 @@ components: type: string description: One Private Internet Protocol version 4 (IPv4) address to which this Google Cloud consumer forwarding rule resolves. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ writeOnly: true title: GCP Forwarding Rules CreateOrganizationRequest: @@ -19724,6 +21019,73 @@ components: readOnly: true organization: $ref: "#/components/schemas/AtlasOrganization" + CreatePushBasedLogExportProjectRequest: + type: object + properties: + bucketName: + type: string + description: The name of the bucket to which the agent will send the logs to. + iamRoleId: + type: string + description: ID of the AWS IAM role that will be used to write to the S3 bucket. + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + prefixPath: + type: string + description: S3 directory in which vector will write to in order to store the + logs. An empty string denotes the root directory. + required: + - bucketName + - iamRoleId + - prefixPath + CustomZoneMappings: + type: object + properties: + customZoneMappings: + type: array + description: >- + List that contains comma-separated key value pairs to map zones to + geographic regions. These pairs map an ISO 3166-1a2 location code, + with an ISO 3166-2 subdivision code when possible, to the + human-readable label for the desired custom zone. MongoDB Cloud maps + the ISO 3166-1a2 code to the nearest geographical zone by default. + Include this parameter to override the default mappings. + + + This parameter returns an empty object if no custom zones exist. + items: + $ref: "#/components/schemas/ZoneMapping" + DBRoleToExecute: + type: object + description: The name of a Built in or Custom DB Role to connect to an Atlas Cluster. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + role: + type: string + description: The name of the role to use. Can be a built in role or a custom role. + type: + type: string + description: Type of the DB role. Can be either BuiltIn or Custom. + title: DB Role Type DBUserTLSX509Settings: type: object description: Settings to configure TLS Certificates for database users. @@ -19905,10 +21267,11 @@ components: properties: level: type: string - description: "[Read Concern - level](https://www.mongodb.com/docs/manual/reference/read-concern/#\ - read-concern-levels) that specifies the consistency and availability - of the data read." + description: Read Concern level that specifies the consistency and availability + of the data read. + externalDocs: + description: Read Concern Level + url: https://www.mongodb.com/docs/manual/reference/read-concern/#read-concern-levels DataLakeAtlasStoreReadPreference: type: object description: MongoDB Cloud cluster read preference, which describes how to route @@ -20105,6 +21468,8 @@ components: format: date-time description: Timestamp that indicates when the Data Lake Pipeline was created. readOnly: true + datasetRetentionPolicy: + $ref: "#/components/schemas/DatasetRetentionPolicy" groupId: type: string description: Unique 24-hexadecimal digit string that identifies the group. @@ -20319,25 +21684,40 @@ components: name: type: string description: Human-readable label that identifies the data lake. + privateEndpointHostnames: + type: array + description: List that contains the sets of private endpoints and hostnames. + items: + $ref: "#/components/schemas/PrivateEndpointHostname" + readOnly: true state: type: string description: Label that indicates the status of the Data Lake instance. readOnly: true storage: $ref: "#/components/schemas/DataLakeStorage" - DataProtectionSettings: + DataProtectionSettings20231001: type: object properties: authorizedEmail: type: string format: email - description: Email address of the user who authorized to updated the Backup + description: Email address of the user who authorized to update the Backup + Compliance Policy settings. + authorizedUserFirstName: + type: string + description: First name of the user who authorized to updated the Backup + Compliance Policy settings. + authorizedUserLastName: + type: string + description: Last name of the user who authorized to updated the Backup Compliance Policy settings. copyProtectionEnabled: type: boolean default: false - description: Flag that indicates whether to enable additional backup copies for - the cluster. If unspecified, this value defaults to false. + description: Flag that indicates whether to prevent cluster users from deleting + backups copied to other regions, even if those additional snapshot + regions are removed. If unspecified, this value defaults to false. encryptionAtRestEnabled: type: boolean default: false @@ -20348,7 +21728,7 @@ components: description: Encryption at Rest using Customer Key Management url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ onDemandPolicyItem: - $ref: "#/components/schemas/DiskBackupApiPolicyItem" + $ref: "#/components/schemas/BackupComplianceOnDemandPolicyItem" pitEnabled: type: boolean default: false @@ -20379,7 +21759,7 @@ components: type: array description: List that contains the specifications for one scheduled policy. items: - $ref: "#/components/schemas/DiskBackupApiPolicyItem" + $ref: "#/components/schemas/BackupComplianceScheduledPolicyItem" state: type: string description: Label that indicates the state of the Backup Compliance Policy @@ -20403,6 +21783,8 @@ components: readOnly: true required: - authorizedEmail + - authorizedUserFirstName + - authorizedUserLastName DatabaseInheritedRole: type: object description: Role inherited from another context for this database user. @@ -20543,6 +21925,29 @@ components: - databaseName - roleName title: Database User Role + DatasetRetentionPolicy: + type: object + description: Dataset Retention Policy for a Scheduled Data Lake Pipeline. + properties: + lastModifiedDate: + type: string + format: date-time + description: Date when retention policy was last modified. + readOnly: true + units: + type: string + description: Quantity of time in which the Data Lake Pipeline measures dataset + retention. + value: + type: integer + format: int32 + description: Number that indicates the amount of days, weeks, or months that the + Data Lake Pipeline will retain datasets. + minimum: 1 + required: + - units + - value + title: Dataset Retention Policy DedicatedHardwareSpec: type: object description: Hardware specifications for read-only nodes in the region. @@ -20590,7 +21995,7 @@ components: - `STANDARD` volume types can't exceed the default input/output operations per second (IOPS) rate for the selected volume size. - - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. + - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. You must set this value to (`PROVISIONED`) for NVMe clusters. instanceSize: type: string description: Hardware specification for the instance sizes in this region. Each @@ -20667,6 +22072,9 @@ components: `frequencyType`. + - In a yearly policy item, `1` indicates that the yearly snapshot occurs on the first day of January and `12` indicates the first day of December. + + - In a monthly policy item, `1` indicates that the monthly snapshot occurs on the first day of the month and `40` indicates the last day of the month. @@ -20695,8 +22103,8 @@ components: type: integer format: int32 description: >- - Duration in days, weeks, or months that MongoDB Cloud retains the - snapshot. For less frequent policy items, MongoDB Cloud requires + Duration in days, weeks, months, or years that MongoDB Cloud retains + the snapshot. For less frequent policy items, MongoDB Cloud requires that you specify a value greater than or equal to the value specified for more frequent policy items. @@ -21005,7 +22413,7 @@ components: storageSizeBytes: type: integer format: int64 - description: Number of bytes taken to store the backup snapshot. + description: Number of bytes taken to store the backup at time of snapshot. readOnly: true type: type: string @@ -21017,6 +22425,11 @@ components: type: object description: Details of the sharded cluster snapshot that MongoDB Cloud created. properties: + configServerType: + type: string + description: Human-readable label that identifies the config server type for + this snapshot. + readOnly: true createdAt: type: string format: date-time @@ -21122,7 +22535,7 @@ components: storageSizeBytes: type: integer format: int64 - description: Number of bytes taken to store the backup snapshot. + description: Number of bytes taken to store the backup at time of snapshot. readOnly: true type: type: string @@ -21238,7 +22651,7 @@ components: storageSizeBytes: type: integer format: int64 - description: Number of bytes taken to store the backup snapshot. + description: Number of bytes taken to store the backup at time of snapshot. readOnly: true type: type: string @@ -21264,6 +22677,11 @@ components: MongoDB Cloud took this snapshot. The resource returns this parameter when `"type": "replicaSet"`.' readOnly: true + configServerType: + type: string + description: Human-readable label that identifies the config server type for + this snapshot. + readOnly: true members: type: array description: 'List that includes the snapshots and the cloud provider that @@ -21312,8 +22730,10 @@ components: this snapshot. iamRoleId: type: string - description: Unique 24-hexadecimal character string that identifies the AWS IAM - role that MongoDB Cloud uses to access the AWS S3 bucket. + description: Unique 24-hexadecimal character string that identifies the Unified AWS Access role ID that MongoDB Cloud + uses to access the AWS S3 bucket. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -21498,6 +22918,12 @@ components: writeOnly: true export: $ref: "#/components/schemas/AutoExportPolicy" + extraRetentionSettings: + type: array + description: List that contains a document for each extra retention setting item + in the desired backup policy. + items: + $ref: "#/components/schemas/ExtraRetentionSetting" links: type: array description: List of one or more Uniform Resource Locators (URLs) that point to @@ -21699,7 +23125,7 @@ components: format in UTC. readOnly: true eventTypeName: - $ref: "#/components/schemas/ResourceEventType" + $ref: "#/components/schemas/StreamProcessorEventTypeViewForNdsGroup" groupId: type: string description: Unique 24-hexadecimal digit string that identifies the project in @@ -21759,7 +23185,7 @@ components: type: string description: IPv4 or IPv6 address from which the user triggered this event. example: 216.172.40.186 - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true userId: type: string @@ -21915,6 +23341,27 @@ components: type: string description: Unique identifier of resource type. example: cluster + instanceName: + type: string + description: Name of the stream processing instance associated with the event. + example: foobar + readOnly: true + processorErrorMsg: + type: string + description: Error message linked to the stream processor associated with the + event. + example: invalid auth + readOnly: true + processorName: + type: string + description: Name of the stream processor associated with the event. + example: foobar + readOnly: true + processorState: + type: string + description: State of the stream processor associated with the event. + example: FAILED + readOnly: true EventViewForOrg: type: object properties: @@ -21998,7 +23445,7 @@ components: type: string description: IPv4 or IPv6 address from which the user triggered this event. example: 216.172.40.186 - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true userId: type: string @@ -22109,6 +23556,17 @@ components: format: int32 description: Total number of collections on the replica set to export. readOnly: true + ExtraRetentionSetting: + type: object + description: extra retention setting item in the desired backup policy. + properties: + frequencyType: + type: string + description: The frequency type for the extra retention settings for the cluster. + retentionDays: + type: integer + format: int32 + description: The number of extra retention days for the cluster. FTSMetric: type: object description: Measurement of one Atlas Search status when MongoDB Atlas received @@ -22167,15 +23625,6 @@ components: FederationIdentityProvider: type: object properties: - acsUrl: - type: string - description: URL that points to where to send the SAML response. - associatedDomains: - type: array - description: List that contains the domains associated with the identity provider. - items: - type: string - uniqueItems: true associatedOrgs: type: array description: List that contains the connected organization configurations @@ -22183,23 +23632,62 @@ components: items: $ref: "#/components/schemas/ConnectedOrgConfig" uniqueItems: true - audienceUri: + createdAt: type: string - description: Unique string that identifies the intended audience of the SAML - assertion. + format: date-time + description: Date that the identity provider was created on. + readOnly: true + description: + type: string + description: The description of the identity provider. displayName: type: string description: Human-readable label that identifies the identity provider. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the identity + provider. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + idpType: + type: string + description: String enum that indicates the type of the identity provider. + Default is WORKFORCE. issuerUri: type: string - description: Unique string that identifies the issuer of the SAML Assertion. + description: Unique string that identifies the issuer of the SAML Assertion or + OIDC metadata/discovery document URL. oktaIdpId: type: string - description: Unique 20-hexadecimal digit string that identifies the identity + description: Legacy 20-hexadecimal digit string that identifies the identity provider. maxLength: 20 minLength: 20 pattern: ^([a-f0-9]{20})$ + protocol: + type: string + description: The protocol of the identity provider. Either SAML or OIDC. + updatedAt: + type: string + format: date-time + description: Date that the identity provider was last updated on. + readOnly: true + acsUrl: + type: string + description: URL that points to where to send the SAML response. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + audienceUri: + type: string + description: Unique string that identifies the intended audience of the SAML + assertion. pemFileInfo: $ref: "#/components/schemas/PemFileInfo" requestBinding: @@ -22211,6 +23699,9 @@ components: type: string description: Signature algorithm that Federated Authentication uses to encrypt the identity provider signature. + slug: + type: string + description: Custom SSO Url for the identity provider. ssoDebugEnabled: type: boolean description: Flag that indicates whether the identity provider has SSO debug @@ -22221,11 +23712,249 @@ components: status: type: string description: String enum that indicates whether the identity provider is active. - required: - - oktaIdpId - FieldTransformation: - type: object - description: Field Transformations during ingestion of a Data Lake Pipeline. + audience: + type: string + description: Identifier of the intended recipient of the token. + authorizationType: + type: string + description: Indicates whether authorization is granted based on group + membership or user ID. + clientId: + type: string + description: Client identifier that is assigned to an application by the + Identity Provider. + groupsClaim: + type: string + description: Identifier of the claim which contains IdP Group IDs in the token. + requestedScopes: + type: array + description: Scopes that MongoDB applications will request from the + authorization endpoint. + items: + type: string + userClaim: + type: string + description: Identifier of the claim which contains the user ID in the token. + required: + - id + - oktaIdpId + FederationIdentityProviderUpdate: + type: object + properties: + description: + type: string + description: The description of the identity provider. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + maxLength: 50 + minLength: 1 + idpType: + type: string + description: String enum that indicates the type of the identity provider. + Default is WORKFORCE. + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion or + OIDC metadata/discovery document URL. + example: urn:idp:default + protocol: + type: string + description: The protocol of the identity provider. Either SAML or OIDC. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + pemFileInfo: + $ref: "#/components/schemas/PemFileInfoUpdate" + requestBinding: + type: string + description: SAML Authentication Request Protocol HTTP method binding (POST or + REDIRECT) that Federated Authentication uses to send the + authentication request. + responseSignatureAlgorithm: + type: string + description: Signature algorithm that Federated Authentication uses to encrypt + the identity provider signature. + slug: + type: string + description: Custom SSO Url for the identity provider. + ssoDebugEnabled: + type: boolean + description: Flag that indicates whether the identity provider has SSO debug + enabled. + ssoUrl: + type: string + description: URL that points to the receiver of the SAML authentication request. + example: https://example.com + status: + type: string + description: String enum that indicates whether the identity provider is active. + audience: + type: string + description: Identifier of the intended recipient of the token. + authorizationType: + type: string + description: Indicates whether authorization is granted based on group + membership or user ID. + clientId: + type: string + description: Client identifier that is assigned to an application by the + Identity Provider. + groupsClaim: + type: string + description: Identifier of the claim which contains IdP Group IDs in the token. + requestedScopes: + type: array + description: Scopes that MongoDB applications will request from the + authorization endpoint. + items: + type: string + userClaim: + type: string + description: Identifier of the claim which contains the user ID in the token. + FederationOidcIdentityProvider: + type: object + properties: + associatedOrgs: + type: array + description: List that contains the connected organization configurations + associated with the identity provider. + items: + $ref: "#/components/schemas/ConnectedOrgConfig" + uniqueItems: true + audience: + type: string + description: Identifier of the intended recipient of the token. + authorizationType: + type: string + description: Indicates whether authorization is granted based on group + membership or user ID. + createdAt: + type: string + format: date-time + description: Date that the identity provider was created on. + readOnly: true + description: + type: string + description: The description of the identity provider. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + groupsClaim: + type: string + description: Identifier of the claim which contains IdP Group IDs in the token. + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the identity + provider. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + idpType: + type: string + description: String enum that indicates the type of the identity provider. + Default is WORKFORCE. + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion or + OIDC metadata/discovery document URL. + oktaIdpId: + type: string + description: Legacy 20-hexadecimal digit string that identifies the identity + provider. + maxLength: 20 + minLength: 20 + pattern: ^([a-f0-9]{20})$ + protocol: + type: string + description: The protocol of the identity provider. Either SAML or OIDC. + updatedAt: + type: string + format: date-time + description: Date that the identity provider was last updated on. + readOnly: true + userClaim: + type: string + description: Identifier of the claim which contains the user ID in the token. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + clientId: + type: string + description: Client identifier that is assigned to an application by the + Identity Provider. + requestedScopes: + type: array + description: Scopes that MongoDB applications will request from the + authorization endpoint. + items: + type: string + required: + - id + - oktaIdpId + FederationOidcIdentityProviderUpdate: + type: object + properties: + audience: + type: string + description: Identifier of the intended recipient of the token. + authorizationType: + type: string + description: Indicates whether authorization is granted based on group + membership or user ID. + description: + type: string + description: The description of the identity provider. + displayName: + type: string + description: Human-readable label that identifies the identity provider. + maxLength: 50 + minLength: 1 + groupsClaim: + type: string + description: Identifier of the claim which contains IdP Group IDs in the token. + idpType: + type: string + description: String enum that indicates the type of the identity provider. + Default is WORKFORCE. + issuerUri: + type: string + description: Unique string that identifies the issuer of the SAML Assertion or + OIDC metadata/discovery document URL. + example: urn:idp:default + protocol: + type: string + description: The protocol of the identity provider. Either SAML or OIDC. + userClaim: + type: string + description: Identifier of the claim which contains the user ID in the token. + associatedDomains: + type: array + description: List that contains the domains associated with the identity provider. + items: + type: string + uniqueItems: true + clientId: + type: string + description: Client identifier that is assigned to an application by the + Identity Provider. + requestedScopes: + type: array + description: Scopes that MongoDB applications will request from the + authorization endpoint. + items: + type: string + FieldTransformation: + type: object + description: Field Transformations during ingestion of a Data Lake Pipeline. properties: field: type: string @@ -22250,7 +23979,7 @@ components: type: string description: One Private Internet Protocol version 4 (IPv4) address to which this Google Cloud consumer forwarding rule resolves. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true status: type: string @@ -22289,6 +24018,15 @@ components: items: $ref: "#/components/schemas/ManagedNamespaces" readOnly: true + selfManagedSharding: + type: boolean + description: Boolean that controls which management mode the Global Cluster is + operating under. If this parameter is true Self-Managed Sharding is + enabled and users are in control of the zone sharding within the + Global Cluster. If this parameter is false Atlas-Managed Sharding is + enabled and Atlas is control of zone sharding within the Global + Cluster. + readOnly: true GoogleCloudKMS: type: object description: Details that define the configuration of Encryption at Rest using @@ -22388,8 +24126,35 @@ components: pattern: ^([a-f0-9]{24})$ regionUsageRestrictions: type: string - default: NONE - description: Region usage restrictions that designate the project's AWS region. + default: COMMERCIAL_FEDRAMP_REGIONS_ONLY + description: >- + Applies to Atlas for Government only. + + + In Commercial Atlas, this field will be rejected in requests and missing in responses. + + + This field sets restrictions on available regions in the project. + + + | Value | Available Regions | + + |-----------------------------------|------------| + + | `COMMERCIAL_FEDRAMP_REGIONS_ONLY` | Only allows deployments in FedRAMP Moderate regions.| + + | `GOV_REGIONS_ONLY` | Only allows deployments in GovCloud regions.| + externalDocs: + url: https://www.mongodb.com/docs/atlas/government/overview/supported-regions/#supported-cloud-providers-and-regions + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the project. + externalDocs: + description: Resource Tags + url: https://www.mongodb.com/docs/atlas/tags + items: + $ref: "#/components/schemas/ResourceTag" withDefaultAlertsSettings: type: boolean description: Flag that indicates whether to create the project with default @@ -22417,7 +24182,7 @@ components: description: Flag that indicates whether someone enabled this alert configuration for the specified project. eventTypeName: - $ref: "#/components/schemas/ServerlessEventTypeViewAlertable" + $ref: "#/components/schemas/StreamProcessorEventTypeViewAlertable" groupId: type: string description: Unique 24-hexadecimal digit string that identifies the project that @@ -22512,9 +24277,13 @@ components: Alternatively: No matchers are available for these alert types. The list is always empty. + + + Alternatively: + + List of rules that determine whether MongoDB Cloud checks an object for the alert configuration. items: - type: object - readOnly: true + $ref: "#/components/schemas/StreamsMatcher" notifications: type: array description: List that contains the targets that MongoDB Cloud sends @@ -22533,6 +24302,22 @@ components: $ref: "#/components/schemas/ServerlessMetricThreshold" threshold: $ref: "#/components/schemas/GreaterThanRawThreshold" + GroupIPAddresses: + type: object + description: List of IP addresses in a project. + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the MongoDB + Cloud project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + services: + $ref: "#/components/schemas/GroupService" + title: Group IP Address GroupInvitation: type: object properties: @@ -22606,8 +24391,7 @@ components: properties: roles: type: array - description: One or more organization or project level roles to assign to the - MongoDB Cloud user. + description: One or more project level roles to assign to the MongoDB Cloud user. items: type: string uniqueItems: true @@ -22668,6 +24452,12 @@ components: for midnight and `12` for noon. maximum: 23 minimum: 0 + numberOfDeferrals: + type: integer + format: int32 + description: Number of times the current maintenance event for this project has + been deferred. + readOnly: true startASAP: type: boolean description: Flag that indicates whether MongoDB Cloud starts the maintenance @@ -22678,15 +24468,56 @@ components: maintenance. required: - dayOfWeek - - hourOfDay - GroupName: + GroupRole: type: object - description: Request view to update the group name. properties: - name: + groupId: type: string - description: Human-readable label that identifies the project included in the - MongoDB Cloud organization. + description: Unique 24-hexadecimal digit string that identifies the project to + which this role belongs. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + groupRole: + type: string + description: >+ + Human-readable label that identifies the collection of privileges + that MongoDB Cloud grants a specific API key, MongoDB Cloud user, or + MongoDB Cloud team. These roles include project-level roles. + + + Project Roles + + + * GROUP_CLUSTER_MANAGER + + * GROUP_DATA_ACCESS_ADMIN + + * GROUP_DATA_ACCESS_READ_ONLY + + * GROUP_DATA_ACCESS_READ_WRITE + + * GROUP_OWNER + + * GROUP_READ_ONLY + + * GROUP_SEARCH_INDEX_EDITOR + + * GROUP_STREAM_PROCESSING_OWNER + + GroupService: + type: object + description: List of IP addresses in a project categorized by services. + properties: + clusters: + type: array + description: IP addresses of clusters. + items: + $ref: "#/components/schemas/ClusterIPAddresses" + readOnly: true + readOnly: true + title: Group Service IP Addresses GroupSettings: type: object description: Collection of settings that configures the project. @@ -22715,6 +24546,23 @@ components: type: boolean description: Flag that indicates whether to enable the Schema Advisor for the specified project. + GroupUpdate: + type: object + description: Request view to update the group. + properties: + name: + type: string + description: Human-readable label that identifies the project included in the + MongoDB Cloud organization. + tags: + type: array + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the project. + externalDocs: + description: Resource Tags + url: https://www.mongodb.com/docs/atlas/tags + items: + $ref: "#/components/schemas/ResourceTag" HardwareSpec: type: object description: Hardware specifications for all electable nodes deployed in the @@ -22757,7 +24605,7 @@ components: - `STANDARD` volume types can't exceed the default input/output operations per second (IOPS) rate for the selected volume size. - - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. + - `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size. You must set this value to (`PROVISIONED`) for NVMe clusters. instanceSize: type: string description: Hardware specification for the instance sizes in this region. Each @@ -22770,13 +24618,77 @@ components: format: int32 description: Number of nodes of the given type for MongoDB Cloud to deploy to the region. - IndexOptions: + InboundControlPlaneCloudProviderIPAddresses: type: object - description: One or more settings that determine how the MongoDB Cloud creates - this MongoDB index. - externalDocs: - description: Index Options - url: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options + description: List of inbound IP addresses to the Atlas control plane, + categorized by cloud provider. If your application allows outbound HTTP + requests only to specific IP addresses, you must allow access to the + following IP addresses so that your API requests can reach the Atlas + control plane. + properties: + aws: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane IP + addresses in the AWS region. + items: + type: string + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane + IP addresses in the AWS region. + readOnly: true + readOnly: true + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane IP + addresses in the AWS region. + readOnly: true + azure: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + items: + type: string + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + readOnly: true + readOnly: true + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + readOnly: true + gcp: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP + addresses in the GCP region. + items: + type: string + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP + addresses in the GCP region. + readOnly: true + readOnly: true + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP addresses + in the GCP region. + readOnly: true + readOnly: true + title: Inbound Control Plane IP Addresses By Cloud Provider + IndexOptions: + type: object + description: One or more settings that determine how the MongoDB Cloud creates + this MongoDB index. + externalDocs: + description: Index Options + url: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options properties: 2dsphereIndexVersion: type: integer @@ -23011,6 +24923,8 @@ components: `dataSource` in a Federated Database collection. example: v1$atlas$snapshot$Cluster0$myDatabase$myCollection$19700101T000000Z readOnly: true + datasetRetentionPolicy: + $ref: "#/components/schemas/DatasetRetentionPolicy" groupId: type: string description: Unique 24-hexadecimal character string that identifies the project. @@ -23038,6 +24952,12 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ readOnly: true + scheduledDeletionDate: + type: string + format: date-time + description: Timestamp that indicates when the pipeline run will expire and its + dataset will be deleted. + readOnly: true snapshotId: type: string description: Unique 24-hexadecimal character string that identifies the snapshot @@ -23266,8 +25186,9 @@ components: authorization. Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query - according to [RFC 4515](https://tools.ietf.org/search/rfc4515) and - [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). + according to [RFC + 4515](https://datatracker.ietf.org/doc/html/rfc4515) and [RFC + 4516](https://datatracker.ietf.org/doc/html/rfc4516). example: "{USER}?memberOf?base" bindPassword: type: string @@ -23298,7 +25219,7 @@ components: Protocol (IP) address of the Lightweight Directory Access Protocol (LDAP) host. This host must have access to the internet or have a Virtual Private Cloud (VPC) peering connection to your cluster. - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ links: type: array description: List of one or more Uniform Resource Locators (URLs) that point to @@ -23392,81 +25313,326 @@ components: uses this parameter only for user authorization. - Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query per [RFC 4515](https://tools.ietf.org/search/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). - example: "{USER}?memberOf?base" - writeOnly: true - bindPassword: + Use the `{USER}` placeholder in the Uniform Resource Locator (URL) to substitute the authenticated username. The query relates to the host specified with the hostname. Format this query per [RFC 4515](https://datatracker.ietf.org/doc/html/rfc4515) and [RFC 4516](https://datatracker.ietf.org/doc/html/rfc4516). + example: "{USER}?memberOf?base" + writeOnly: true + bindPassword: + type: string + description: Password that MongoDB Cloud uses to authenticate the + **bindUsername**. + writeOnly: true + bindUsername: + type: string + description: Full Distinguished Name (DN) of the Lightweight Directory Access + Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP + host. LDAP distinguished names must be formatted according to RFC + 2253. + example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + externalDocs: + description: RFC 2253 + url: https://tools.ietf.org/html/2253 + pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ + caCertificate: + type: string + description: 'Certificate Authority (CA) certificate that MongoDB Cloud uses to + verify the identity of the Lightweight Directory Access Protocol + (LDAP) host. MongoDB Cloud allows self-signed certificates. To + delete an assigned value, pass an empty string: `"caCertificate": + ""`.' + hostname: + type: string + description: Human-readable label that identifies the hostname or Internet + Protocol (IP) address of the Lightweight Directory Access Protocol + (LDAP) host. This host must have access to the internet or have a + Virtual Private Cloud (VPC) peering connection to your cluster. + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + port: + type: integer + format: int32 + default: 636 + description: IANA port to which the Lightweight Directory Access Protocol (LDAP) + host listens for client connections. + required: + - bindPassword + - bindUsername + - hostname + - port + LDAPVerifyConnectivityJobRequestValidation: + type: object + description: One test that MongoDB Cloud runs to test verification of the + provided Lightweight Directory Access Protocol (LDAP) over Transport + Layer Security (TLS) configuration details. + properties: + status: + type: string + description: Human-readable string that indicates the result of this + verification test. + readOnly: true + validationType: + type: string + description: Human-readable label that identifies this verification test that + MongoDB Cloud runs. + readOnly: true + readOnly: true + LegacyAtlasCluster: + type: object + description: Group of settings that configure a MongoDB cluster. + properties: + acceptDataRisksAndForceReplicaSetReconfig: + type: string + format: date-time + description: If reconfiguration is necessary to regain a primary due to a + regional outage, submit this field alongside your topology + reconfiguration to request a new regional outage resistant topology. + Forced reconfigurations during an outage of the majority of + electable nodes carry a risk of data loss if replicated writes (even + majority committed writes) have not been replicated to the new + primary node. MongoDB Atlas docs contain more information. To + proceed with an operation which carries that risk, set + **acceptDataRisksAndForceReplicaSetReconfig** to the current date. + externalDocs: + description: Reconfiguring a Replica Set during a regional outage + url: https://dochub.mongodb.org/core/regional-outage-reconfigure-replica-set + autoScaling: + $ref: "#/components/schemas/ClusterAutoScalingSettings" + backupEnabled: + type: boolean + description: Flag that indicates whether the cluster can perform backups. If set + to `true`, the cluster can perform backups. You must set this value + to `true` for NVMe clusters. Backup uses Cloud Backups for dedicated + clusters and Shared Cluster Backups for tenant clusters. If set to + `false`, the cluster doesn't use MongoDB Cloud backups. + biConnector: + $ref: "#/components/schemas/BiConnector" + clusterType: + type: string + description: Configuration of nodes that comprise the cluster. + connectionStrings: + $ref: "#/components/schemas/ClusterConnectionStrings" + createDate: + type: string + format: date-time + description: Date and time when MongoDB Cloud created this serverless instance. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + diskSizeGB: + type: number + format: double + description: Storage capacity that the host's root volume possesses expressed in + gigabytes. Increase this number to add capacity. MongoDB Cloud + requires this parameter if you set **replicationSpecs**. If you + specify a disk size below the minimum (10 GB), this parameter + defaults to the minimum disk size value. Storage charge calculations + depend on whether you choose the default value or a custom + value. The maximum value for disk storage cannot exceed 50 times + the maximum RAM for the selected cluster. If you require more + storage space, consider upgrading your cluster to a higher tier. + maximum: 4096 + minimum: 10 + diskWarmingMode: + type: string + default: FULLY_WARMED + description: Disk warming mode selection. + externalDocs: + description: Reduce Secondary Disk Warming Impact + url: https://docs.atlas.mongodb.com/reference/replica-set-tags/#reduce-secondary-disk-warming-impact + encryptionAtRestProvider: + type: string + description: Cloud service provider that manages your customer keys to provide + an additional layer of Encryption at Rest for the cluster. + externalDocs: + description: Encryption at Rest using Customer Key Management + url: https://www.mongodb.com/docs/atlas/security-kms-encryption/ + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the cluster. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + labels: + type: array + deprecated: true + description: >- + Collection of key-value pairs between 1 to 255 characters in length + that tag and categorize the cluster. The MongoDB Cloud console + doesn't display your labels. + + + Cluster labels are deprecated and will be removed in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. + items: + $ref: "#/components/schemas/ComponentLabel" + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + mongoDBMajorVersion: + type: string + default: "7.0" + description: Major MongoDB version of the cluster. MongoDB Cloud deploys the + cluster with the latest stable release of the specified version. + mongoDBVersion: + type: string + description: Version of MongoDB that the cluster runs. + pattern: ([\d]+\.[\d]+\.[\d]+) + mongoURI: + type: string + description: Base connection string that you can use to connect to the cluster. + MongoDB Cloud displays the string only after the cluster starts, not + while it builds the cluster. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + mongoURIUpdated: + type: string + format: date-time + description: Date and time when someone last updated the connection string. + MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. + readOnly: true + mongoURIWithOptions: + type: string + description: Connection string that you can use to connect to the cluster + including the `replicaSet`, `ssl`, and `authSource` query parameters + with values appropriate for the cluster. You may need to add MongoDB + database users. The response returns this parameter once the cluster + can receive requests, not while it builds the cluster. + externalDocs: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + name: + type: string + description: Human-readable label that identifies the cluster. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$ + numShards: + type: integer + format: int32 + default: 1 + description: Number of shards up to 50 to deploy for a sharded cluster. The + resource returns `1` to indicate a replica set and values of `2` and + higher to indicate a sharded cluster. The returned value equals the + number of shards in the cluster. + externalDocs: + description: Sharding + url: https://docs.mongodb.com/manual/sharding/ + maximum: 50 + minimum: 1 + paused: + type: boolean + description: Flag that indicates whether the cluster is paused. + pitEnabled: + type: boolean + description: Flag that indicates whether the cluster uses continuous cloud + backups. + externalDocs: + description: Continuous Cloud Backups + url: https://docs.atlas.mongodb.com/backup/cloud-backup/overview/ + providerBackupEnabled: + type: boolean + description: Flag that indicates whether the M10 or higher cluster can perform + Cloud Backups. If set to `true`, the cluster can perform backups. If + this and **backupEnabled** are set to `false`, the cluster doesn't + use MongoDB Cloud backups. + providerSettings: + $ref: "#/components/schemas/ClusterProviderSettings" + replicationFactor: + type: integer + format: int32 + default: 3 + deprecated: true + description: Number of members that belong to the replica set. Each member + retains a copy of your databases, providing high availability and + data redundancy. Use **replicationSpecs** instead. + replicationSpec: + type: object + additionalProperties: + $ref: "#/components/schemas/RegionSpec" + description: Physical location where MongoDB Cloud provisions cluster nodes. + title: Region Configuration + replicationSpecs: + type: array + description: >- + List of settings that configure your cluster regions. + + + - For Global Clusters, each object in the array represents one zone where MongoDB Cloud deploys your clusters nodes. + + - For non-Global sharded clusters and replica sets, the single object represents where MongoDB Cloud deploys your clusters nodes. + items: + $ref: "#/components/schemas/LegacyReplicationSpec" + rootCertType: type: string - description: Password that MongoDB Cloud uses to authenticate the - **bindUsername**. - writeOnly: true - bindUsername: + default: ISRGROOTX1 + description: Root Certificate Authority that MongoDB Atlas clusters uses. + MongoDB Cloud supports Internet Security Research Group. + srvAddress: type: string - description: Full Distinguished Name (DN) of the Lightweight Directory Access - Protocol (LDAP) user that MongoDB Cloud uses to connect to the LDAP - host. LDAP distinguished names must be formatted according to RFC - 2253. - example: CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com + description: Connection string that you can use to connect to the cluster. The + `+srv` modifier forces the connection to use Transport Layer + Security (TLS). The `mongoURI` parameter lists additional options. externalDocs: - description: RFC 2253 - url: https://tools.ietf.org/html/2253 - pattern: ^(?:(?CN=(?[^,]*)),)?(?:(?(?:(?:CN|OU)=[^,]+,?)+),)?(?(?:DC=[^,]+,?)+)$ - caCertificate: - type: string - description: 'Certificate Authority (CA) certificate that MongoDB Cloud uses to - verify the identity of the Lightweight Directory Access Protocol - (LDAP) host. MongoDB Cloud allows self-signed certificates. To - delete an assigned value, pass an empty string: `"caCertificate": - ""`.' - hostname: + description: Connection string URI format. + url: https://docs.mongodb.com/manual/reference/connection-string/ + readOnly: true + stateName: type: string - description: Human-readable label that identifies the hostname or Internet - Protocol (IP) address of the Lightweight Directory Access Protocol - (LDAP) host. This host must have access to the internet or have a - Virtual Private Cloud (VPC) peering connection to your cluster. - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ - links: + description: Human-readable label that indicates the current operating condition + of the cluster. + readOnly: true + tags: type: array - description: List of one or more Uniform Resource Locators (URLs) that point to - API sub-resources, related API resources, or both. RFC 5988 outlines - these relationships. + description: List that contains key-value pairs between 1 to 255 characters in + length for tagging and categorizing the cluster. externalDocs: - description: Web Linking Specification (RFC 5988) - url: https://datatracker.ietf.org/doc/html/rfc5988 + description: Resource Tags + url: https://dochub.mongodb.org/core/add-cluster-tag-atlas items: - $ref: "#/components/schemas/Link" - readOnly: true - port: - type: integer - format: int32 - default: 636 - description: IANA port to which the Lightweight Directory Access Protocol (LDAP) - host listens for client connections. - required: - - bindPassword - - bindUsername - - hostname - - port - LDAPVerifyConnectivityJobRequestValidation: - type: object - description: One test that MongoDB Cloud runs to test verification of the - provided Lightweight Directory Access Protocol (LDAP) over Transport - Layer Security (TLS) configuration details. - properties: - status: - type: string - description: Human-readable string that indicates the result of this - verification test. - readOnly: true - validationType: + $ref: "#/components/schemas/ResourceTag" + terminationProtectionEnabled: + type: boolean + default: false + description: Flag that indicates whether termination protection is enabled on + the cluster. If set to `true`, MongoDB Cloud won't delete the + cluster. If set to `false`, MongoDB Cloud will delete the cluster. + versionReleaseSystem: type: string - description: Human-readable label that identifies this verification test that - MongoDB Cloud runs. - readOnly: true - readOnly: true - LegacyAtlasCluster: + default: LTS + description: Method by which the cluster maintains the MongoDB versions. If + value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. + title: Cluster Description + LegacyAtlasTenantClusterUpgradeRequest: type: object - description: Group of settings that configure a MongoDB cluster. + description: Request containing target state of tenant cluster to be upgraded properties: acceptDataRisksAndForceReplicaSetReconfig: type: string @@ -23519,6 +25685,13 @@ components: storage space, consider upgrading your cluster to a higher tier. maximum: 4096 minimum: 10 + diskWarmingMode: + type: string + default: FULLY_WARMED + description: Disk warming mode selection. + externalDocs: + description: Reduce Secondary Disk Warming Impact + url: https://docs.atlas.mongodb.com/reference/replica-set-tags/#reduce-secondary-disk-warming-impact encryptionAtRestProvider: type: string description: Cloud service provider that manages your customer keys to provide @@ -23544,13 +25717,14 @@ components: readOnly: true labels: type: array + deprecated: true description: >- Collection of key-value pairs between 1 to 255 characters in length that tag and categorize the cluster. The MongoDB Cloud console doesn't display your labels. - Cluster labels will be deprecated in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. + Cluster labels are deprecated and will be removed in a future release. We strongly recommend that you use [resource tags](https://dochub.mongodb.org/core/add-cluster-tag-atlas) instead. items: $ref: "#/components/schemas/ComponentLabel" links: @@ -23566,7 +25740,7 @@ components: readOnly: true mongoDBMajorVersion: type: string - default: "6.0" + default: "7.0" description: Major MongoDB version of the cluster. MongoDB Cloud deploys the cluster with the latest stable release of the specified version. mongoDBVersion: @@ -23700,7 +25874,9 @@ components: default: LTS description: Method by which the cluster maintains the MongoDB versions. If value is `CONTINUOUS`, you must not specify **mongoDBMajorVersion**. - title: Cluster Description + required: + - name + title: Tenant Cluster Upgrade Request LegacyReplicationSpec: type: object properties: @@ -23723,12 +25899,15 @@ components: type: integer format: int32 default: 1 - description: Positive integer that specifies the number of shards to deploy in + description: >- + Positive integer that specifies the number of shards to deploy in each specified zone If you set this value to `1` and **clusterType** is `SHARDED`, MongoDB Cloud deploys a single-shard sharded cluster. Don't create a sharded cluster with a single shard for production environments. Single-shard sharded clusters don't provide the same benefits as multi-shard configurations. + + If you are upgrading a replica set to a sharded cluster, you cannot increase the number of shards in the same update request. You should wait until after the cluster has completed upgrading to sharded and you have reconnected all application clients to the MongoDB router before adding additional shards. Otherwise, your data might become inconsistent once MongoDB Cloud begins distributing data across shards. regionsConfig: type: object additionalProperties: @@ -23868,6 +26047,8 @@ components: example: vm001.example.com maxItems: 1 minItems: 1 + sharding: + $ref: "#/components/schemas/ShardingRequest" source: $ref: "#/components/schemas/Source" required: @@ -23901,7 +26082,7 @@ components: description: One host running a MongoDB Agent. This Agent can transfer your MongoDB data between one source and one target cluster. example: vm001.example.com - pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?$ readOnly: true readyForCutover: type: boolean @@ -24010,6 +26191,160 @@ components: description: Human-readable label of the disk or partition to which the measurements apply. readOnly: true + MeasurementsCollStatsLatencyCluster: + type: object + properties: + clusterId: + type: string + description: Unique identifier for Clusters. + readOnly: true + clusterView: + type: string + description: Cluster topology view. + readOnly: true + collectionName: + type: string + description: Human-readable label that identifies the collection. + readOnly: true + databaseName: + type: string + description: Human-readable label that identifies the database that the + specified MongoDB process serves. + readOnly: true + end: + type: string + format: date-time + description: Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + measurements: + type: array + description: List that contains measurements and their data points. + items: + $ref: "#/components/schemas/MetricsMeasurement" + readOnly: true + processId: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + MeasurementsCollStatsLatencyHost: + type: object + properties: + collectionName: + type: string + description: Human-readable label that identifies the collection. + readOnly: true + databaseName: + type: string + description: Human-readable label that identifies the database that the + specified MongoDB process serves. + readOnly: true + end: + type: string + format: date-time + description: Date and time that specifies when to stop retrieving measurements. + If you set **end**, you must set **start**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true + granularity: + type: string + description: Duration that specifies the interval between measurement data + points. The parameter expresses its value in ISO 8601 timestamp + format in UTC. If you set this parameter, you must set either + **period** or **start** and **end**. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project. The + project contains MongoDB processes that you want to return. The + MongoDB process can be either the `mongod` or `mongos`. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + measurements: + type: array + description: List that contains measurements and their data points. + items: + $ref: "#/components/schemas/MetricsMeasurement" + readOnly: true + processId: + type: string + description: Combination of hostname and Internet Assigned Numbers Authority + (IANA) port that serves the MongoDB process. The host must be the + hostname, fully qualified domain name (FQDN), or Internet Protocol + address (IPv4 or IPv6) of the host that runs the MongoDB process + (`mongod` or `mongos`). The port must be the IANA port on which the + MongoDB process listens for requests. + example: mongodb.example.com:27017 + pattern: ^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$ + readOnly: true + start: + type: string + format: date-time + description: Date and time that specifies when to start retrieving measurements. + If you set **start**, you must set **end**. You can't set this + parameter and **period** in the same request. This parameter + expresses its value in the ISO 8601 timestamp format in UTC. + readOnly: true MeasurementsIndexes: type: object properties: @@ -24292,7 +26627,7 @@ components: type: string description: Internet Protocol address that attempted to authenticate with the database. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true logLine: type: string @@ -24345,6 +26680,21 @@ components: $ref: "#/components/schemas/NamespaceObj" readOnly: true uniqueItems: true + NamespacesRequest: + type: object + properties: + namespaces: + type: array + description: List of namespace strings (combination of database and collection) + on the specified host or cluster. + items: + type: string + description: Human-readable label that identifies the namespace on the specified + host or cluster. The resource expresses this parameter value as + `.`. + writeOnly: true + uniqueItems: true + writeOnly: true NetworkPermissionEntry: type: object properties: @@ -24358,7 +26708,7 @@ components: an IP access list. You cannot set AWS security groups as temporary access list entries. Don't set this parameter if you set **cidrBlock** or **ipAddress**. - pattern: ^([0-9]*\/)?sg-([0-9]*) + pattern: ^([0-9]*/)?sg-([0-9]*) cidrBlock: type: string description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) @@ -24398,7 +26748,7 @@ components: Your IP access list entry can be one **awsSecurityGroup**, one **cidrBlock**, or one **ipAddress**. Don't set this parameter if you set **awsSecurityGroup** or **cidrBlock**. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ links: type: array description: List of one or more Uniform Resource Locators (URLs) that point to @@ -24519,7 +26869,7 @@ components: readOnly: true identityProviderId: type: string - description: Unique 20-hexadecimal digit string that identifies the identity + description: Legacy 20-hexadecimal digit string that identifies the identity provider connected to this organization. example: c2777a9eca931f29fc2f maxLength: 20 @@ -24594,9 +26944,16 @@ components: description: Date and time when the invitation from MongoDB Cloud expires. MongoDB Cloud represents this timestamp in ISO 8601 format in UTC. readOnly: true + groupRoleAssignments: + type: array + description: List of projects that the user will be added to when they accept + their invitation to the organization. + items: + $ref: "#/components/schemas/GroupRole" + uniqueItems: true id: type: string - description: Unique 24-hexadecimal digit string that identifies this organization. + description: Unique 24-hexadecimal digit string that identifies this invitation. example: 32b6e34b3d91647abb20e7b8 maxLength: 24 minLength: 24 @@ -24633,8 +26990,8 @@ components: pattern: ^[\p{L}\p{N}\-_.(),:&@+']{1,64}$ roles: type: array - description: One or more organization or project level roles to assign to the - MongoDB Cloud user. + description: One or more organization level roles to assign to the MongoDB Cloud + user. items: type: string uniqueItems: true @@ -24658,13 +27015,36 @@ components: organization. required: - orgName + OrganizationInvitationGroupRoleAssignmentsRequest: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the project to + which these roles belong. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + roles: + type: array + description: One or more project level roles to assign to the MongoDB Cloud user. + items: + type: string + uniqueItems: true OrganizationInvitationRequest: type: object properties: + groupRoleAssignments: + type: array + description: List of projects that the user will be added to when they accept + their invitation to the organization. + items: + $ref: "#/components/schemas/OrganizationInvitationGroupRoleAssignmentsRequest" roles: type: array - description: One or more organization or project level roles to assign to the - MongoDB Cloud user. + description: One or more organization level roles to assign to the MongoDB Cloud + user. items: type: string uniqueItems: true @@ -24687,10 +27067,16 @@ components: OrganizationInvitationUpdateRequest: type: object properties: + groupRoleAssignments: + type: array + description: List of projects that the user will be added to when they accept + their invitation to the organization. + items: + $ref: "#/components/schemas/OrganizationInvitationGroupRoleAssignmentsRequest" roles: type: array - description: One or more organization or project level roles to assign to the - MongoDB Cloud user. + description: One or more organization level roles to assign to the MongoDB Cloud + user. items: type: string uniqueItems: true @@ -24731,6 +27117,98 @@ components: the Atlas deployment to resolve support issues. To learn more, see: https://www.mongodb.com/docs/atlas/security-restrict-support-access\ /." + OutboundControlPlaneCloudProviderIPAddresses: + type: object + description: List of outbound IP addresses from the Atlas control plane, + categorized by cloud provider. If your network allows inbound HTTP + requests only from specific IP addresses, you must allow access from the + following IP addresses so that Atlas can communicate with your webhooks + and KMS. + properties: + aws: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane IP + addresses in the AWS region. + items: + type: string + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane + IP addresses in the AWS region. + readOnly: true + readOnly: true + description: Control plane IP addresses in AWS. Each key identifies an Amazon + Web Services (AWS) region. Each value identifies control plane IP + addresses in the AWS region. + readOnly: true + azure: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + items: + type: string + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + readOnly: true + readOnly: true + description: Control plane IP addresses in Azure. Each key identifies an Azure + region. Each value identifies control plane IP addresses in the + Azure region. + readOnly: true + gcp: + type: object + additionalProperties: + type: array + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP + addresses in the GCP region. + items: + type: string + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP + addresses in the GCP region. + readOnly: true + readOnly: true + description: Control plane IP addresses in GCP. Each key identifies a Google + Cloud (GCP) region. Each value identifies control plane IP addresses + in the GCP region. + readOnly: true + readOnly: true + title: Outbound Control Plane IP Addresses By Cloud Provider + PaginatedFederationIdentityProvider: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/FederationIdentityProvider" + readOnly: true + totalCount: + type: integer + format: int32 + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. + minimum: 0 + readOnly: true PaginatedHostView_Atlas: type: object properties: @@ -24755,19 +27233,34 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PemFileInfo: type: object - description: PEM file information for the identity provider's certificates. + description: PEM file information for the identity provider's current certificates. properties: certificates: type: array + description: List of certificates in the file. items: $ref: "#/components/schemas/X509Certificate" fileName: type: string + description: Human-readable label given to the file. + PemFileInfoUpdate: + type: object + description: PEM file information for the identity provider's current certificates. + properties: + certificates: + type: array + description: List of certificates in the file. + items: + $ref: "#/components/schemas/X509CertificateUpdate" + fileName: + type: string + description: Human-readable label given to the file. PerformanceAdvisorIndex: type: object properties: @@ -24944,6 +27437,28 @@ components: items: $ref: "#/components/schemas/PerformanceAdvisorSlowQuery" readOnly: true + PinnedNamespaces: + type: object + description: Pinned namespaces view for cluster + properties: + clusterId: + type: string + description: Unique 24-hexadecimal digit string that identifies the request + cluster. + readOnly: true + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the request + project. + readOnly: true + pinnedNamespaces: + type: array + description: List of all pinned namespaces. + items: + type: string + description: A single pinned namespace. + readOnly: true + readOnly: true PipelineRunStats: type: object description: Runtime statistics for this Data Lake Pipeline run. @@ -24960,6 +27475,19 @@ components: readOnly: true readOnly: true title: Data Lake Pipeline Run Statistics + PrivateEndpointHostname: + type: object + description: Set of Private endpoint and hostnames. + properties: + hostname: + type: string + description: Human-readable label that identifies the hostname. + readOnly: true + privateEndpoint: + type: string + description: Human-readable label that identifies private endpoint. + readOnly: true + readOnly: true PrivateLinkEndpoint: type: object properties: @@ -24992,6 +27520,34 @@ components: minLength: 24 pattern: ^([a-f0-9]{24})$ readOnly: true + privateEndpointConnectionName: + type: string + description: Human-readable label that MongoDB Cloud generates that identifies + the private endpoint connection. + pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]([-\w._()]+)%2[fF]([-\w._()]+) + readOnly: true + privateEndpointIPAddress: + type: string + description: IPv4 address of the private endpoint in your Azure VNet that + someone added to this private endpoint service. + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ + privateEndpointResourceId: + type: string + description: Unique string that identifies the Azure private endpoint's network + interface that someone added to this private endpoint service. + example: /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln + readOnly: true + status: + type: string + description: >- + State of the Azure Private Link Service connection when MongoDB + Cloud received this request. + + + Alternatively: + + State of the Google Cloud network endpoint group when MongoDB Cloud received this request. + readOnly: true endpointGroupName: type: string description: Human-readable label that identifies a set of endpoints. @@ -25009,34 +27565,6 @@ components: items: $ref: "#/components/schemas/GCPConsumerForwardingRule" readOnly: true - status: - type: string - description: >- - State of the Google Cloud network endpoint group when MongoDB Cloud - received this request. - - - Alternatively: - - State of the Azure Private Link Service connection when MongoDB Cloud received this request. - readOnly: true - privateEndpointConnectionName: - type: string - description: Human-readable label that MongoDB Cloud generates that identifies - the private endpoint connection. - pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}%2[fF]([-\w._()]+)%2[fF]([-\w._()]+) - readOnly: true - privateEndpointIPAddress: - type: string - description: IPv4 address of the private endpoint in your Azure VNet that - someone added to this private endpoint service. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ - privateEndpointResourceId: - type: string - description: Unique string that identifies the Azure private endpoint's network - interface that someone added to this private endpoint service. - example: /subscriptions/cba6d9c6-1d3f-3c11-03cb-c705d895e636/resourcegroups/qrRTqi4TSN)7yB5YLRjVDveH3.yLzpNR7Br0D3-SGrU3j0.0/providers/Microsoft.Network/privateEndpoints/pVP(vb(XeckpxtXzP0NaOsDjeWDbOK)DX8A2j2E_vBYL2.GEYIdln - readOnly: true required: - cloudProvider PrivateNetworkEndpointIdEntry: @@ -25045,6 +27573,9 @@ components: comment: type: string description: Human-readable string to associate with this private endpoint. + customerEndpointDNSName: + type: string + description: Human-readable label to identify customer's VPC endpoint DNS name. endpointId: type: string description: Unique 22-character alphanumeric string that identifies the private @@ -25062,6 +27593,10 @@ components: default: AWS description: Human-readable label that identifies the cloud service provider. Atlas Data Lake supports Amazon Web Services only. + region: + type: string + description: Human-readable label to identify the region of customer's VPC + endpoint. type: type: string default: DATA_LAKE @@ -25097,11 +27632,12 @@ components: prefixPath: type: string description: S3 directory in which vector will write to in order to store the - logs. + logs. An empty string denotes the root directory. state: type: string description: Describes whether or not the feature is enabled and what status it is in. + readOnly: true RawMetricUnits: type: string default: RAW @@ -25163,12 +27699,15 @@ components: numShards: type: integer format: int32 - description: Positive integer that specifies the number of shards to deploy in + description: >- + Positive integer that specifies the number of shards to deploy in each specified zone. If you set this value to `1` and **clusterType** is `SHARDED`, MongoDB Cloud deploys a single-shard sharded cluster. Don't create a sharded cluster with a single shard for production environments. Single-shard sharded clusters don't provide the same benefits as multi-shard configurations. + + If you are upgrading a replica set to a sharded cluster, you cannot increase the number of shards in the same update request. You should wait until after the cluster has completed upgrading to sharded and you have reconnected all application clients to the MongoDB router before adding additional shards. Otherwise, your data might become inconsistent once MongoDB Cloud begins distributing data across shards. minimum: 1 regionConfigs: type: array @@ -25222,6 +27761,9 @@ components: `production` in the `environment : production` tag." maxLength: 255 minLength: 1 + required: + - key + - value title: Resource Tag RestoreJobFileHash: type: object @@ -25288,82 +27830,35 @@ components: * ORG_OWNER - - * ORG_MEMBER - - * ORG_GROUP_CREATOR - - * ORG_BILLING_ADMIN - - * ORG_READ_ONLY - - - Project Roles - - - * GROUP_CLUSTER_MANAGER - - * GROUP_DATA_ACCESS_ADMIN - - * GROUP_DATA_ACCESS_READ_ONLY - - * GROUP_DATA_ACCESS_READ_WRITE - - * GROUP_OWNER - - * GROUP_READ_ONLY - - * GROUP_SEARCH_INDEX_EDITOR - - SamlIdentityProviderUpdate: - type: object - properties: - associatedDomains: - type: array - description: List that contains the domains associated with the identity provider. - items: - type: string - uniqueItems: true - description: - type: string - description: The description for the identity provider. - displayName: - type: string - description: Human-readable label that identifies the identity provider. - maxLength: 50 - minLength: 1 - issuerUri: - type: string - description: Unique string that identifies the issuer of the SAML Assertion. - example: urn:idp:default - pemFileInfo: - $ref: "#/components/schemas/PemFileInfo" - protocol: - type: string - description: The protocol for the identity provider. - requestBinding: - type: string - description: SAML Authentication Request Protocol HTTP method binding (POST or - REDIRECT) that Federated Authentication uses to send the - authentication request. - responseSignatureAlgorithm: - type: string - description: Signature algorithm that Federated Authentication uses to encrypt - the identity provider signature. - ssoDebugEnabled: - type: boolean - description: Flag that indicates whether the identity provider has SSO debug - enabled. - ssoUrl: - type: string - description: Unique string that identifies the intended audience of the SAML - assertion. - example: https://example.com - status: - type: string - description: String enum that indicates whether the identity provider is active. - required: - - ssoDebugEnabled + + * ORG_MEMBER + + * ORG_GROUP_CREATOR + + * ORG_BILLING_ADMIN + + * ORG_READ_ONLY + + + Project Roles + + + * GROUP_CLUSTER_MANAGER + + * GROUP_DATA_ACCESS_ADMIN + + * GROUP_DATA_ACCESS_READ_ONLY + + * GROUP_DATA_ACCESS_READ_WRITE + + * GROUP_OWNER + + * GROUP_READ_ONLY + + * GROUP_SEARCH_INDEX_EDITOR + + * GROUP_STREAM_PROCESSING_OWNER + SampleDatasetStatus: type: object properties: @@ -25662,11 +28157,6 @@ components: description: MongoDB process type to which your application connects. readOnly: true title: Serverless Instance Private Endpoint Connection String - ServerlessEventTypeViewAlertable: - type: string - description: Event type that triggers an alert. - example: OUTSIDE_SERVERLESS_METRIC_THRESHOLD - title: Serverless Event Types ServerlessInstanceDescription: type: object description: Group of settings that configure a MongoDB serverless instance. @@ -25916,7 +28406,7 @@ components: Alternatively: Unique string that identifies the Azure private endpoint's network interface that someone added to this private endpoint service. - pattern: ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + pattern: ^/subscriptions/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/resource[gG]roups/private[Ll]ink/providers/Microsoft\.Network/privateEndpoints/[-\w._()]+$ readOnly: true comment: type: string @@ -25958,9 +28448,7 @@ components: type: string description: IPv4 address of the private endpoint in your Azure VNet that someone added to this private endpoint service. - maxLength: 24 - minLength: 24 - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true privateLinkServiceResourceId: type: string @@ -25992,16 +28480,75 @@ components: Alternatively: Unique string that identifies the Azure private endpoint's network interface for this private endpoint service. - pattern: ^\/subscriptions\/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\/resource[gG]roups\/private[Ll]ink\/providers\/Microsoft\.Network\/privateEndpoints\/[-\w._()]+)$ + pattern: ^/subscriptions/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/resource[gG]roups/private[Ll]ink/providers/Microsoft\.Network/privateEndpoints/[-\w._()]+$ writeOnly: true privateEndpointIpAddress: type: string description: IPv4 address of the private endpoint in your Azure VNet that someone added to this private endpoint service. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ writeOnly: true required: - providerName + ShardEntry: + type: object + description: Sharding configuration for a collection to be sharded on the + destination cluster. + properties: + collection: + type: string + description: Human-readable label that identifies the collection to be sharded + on the destination cluster. + writeOnly: true + database: + type: string + description: Human-readable label that identifies the database that contains the + collection to be sharded on the destination cluster. + writeOnly: true + shardCollection: + $ref: "#/components/schemas/ShardKeys" + required: + - collection + - database + - shardCollection + ShardKeys: + type: object + description: Document that configures the shard key on the destination cluster. + properties: + key: + type: array + description: List of fields to use for the shard key. + items: + type: object + additionalProperties: {} + uniqueItems: true + writeOnly: true + writeOnly: true + ShardingRequest: + type: object + description: Document that configures sharding on the destination cluster when + migrating from a replica set source to a sharded cluster destination on + MongoDB 6.0 or higher. If you don't wish to shard any collections on the + destination cluster, leave this empty. + properties: + createSupportingIndexes: + type: boolean + description: Flag that lets the migration create supporting indexes for the + shard keys, if none exists, as the destination cluster also needs + compatible indexes for the specified shard keys. + writeOnly: true + shardingEntries: + type: array + description: List of shard configurations to shard destination collections. + Atlas shards only those collections that you include in the sharding + entries array. + items: + $ref: "#/components/schemas/ShardEntry" + uniqueItems: true + writeOnly: true + required: + - createSupportingIndexes + writeOnly: true Source: type: object description: Document that describes the source of the migration. @@ -26043,6 +28590,36 @@ components: - groupId - managedAuthentication - ssl + StreamConfig: + type: object + description: Configuration options for an Atlas Stream Processing Instance. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + tier: + type: string + description: Selected tier for the Stream Instance. Configures Memory / VCPU + allowances. + title: Stream Instance Tier + StreamProcessorEventTypeViewAlertable: + type: string + description: Event type that triggers an alert. + example: STREAM_PROCESSOR_STATE_IS_FAILED + title: Stream Processor Event Types + StreamProcessorEventTypeViewForNdsGroup: + type: string + description: Unique identifier of event type. + example: STREAM_PROCESSOR_STATE_IS_FAILED + title: Stream Processor Event Types StreamsConnection: type: object description: Settings that define a connection to an external data store. @@ -26060,13 +28637,16 @@ components: readOnly: true name: type: string - description: Human-readable label that identifies the stream connection. + description: Human-readable label that identifies the stream connection. In the + case of the Sample type, this is the name of the sample source. type: type: string description: Type of the connection. Can be either Cluster or Kafka. clusterName: type: string description: Name of the cluster configured for this connection. + dbRoleToExecute: + $ref: "#/components/schemas/DBRoleToExecute" authentication: $ref: "#/components/schemas/StreamsKafkaAuthentication" bootstrapServers: @@ -26089,6 +28669,8 @@ components: readOnly: true StreamsDataProcessRegion: type: object + description: Information about the cloud provider region in which MongoDB Cloud + processes the stream. properties: cloudProvider: type: string @@ -26162,6 +28744,33 @@ components: protocol: type: string description: Describes the transport type. Can be either PLAINTEXT or SSL. + StreamsMatcher: + type: object + description: Rules to apply when comparing a stream processing instance or + stream processor against this alert configuration. + properties: + fieldName: + $ref: "#/components/schemas/StreamsMatcherField" + operator: + type: string + description: Comparison operator to apply when checking the current metric value + against **matcher[n].value**. + value: + type: string + description: Value to match or exceed using the specified **matchers.operator**. + example: event-replica-set + required: + - fieldName + - operator + - value + title: Matchers + StreamsMatcherField: + type: string + description: Name of the parameter in the target object that MongoDB Cloud + checks. The parameter must match all rules for MongoDB Cloud to check + for alert configurations. + example: INSTANCE_NAME + title: Streams Matcher Fields StreamsTenant: type: object properties: @@ -26211,6 +28820,8 @@ components: name: type: string description: Human-readable label that identifies the stream instance. + streamConfig: + $ref: "#/components/schemas/StreamConfig" SynonymSource: type: object description: Data set that stores the mapping one or more words map to one or @@ -26366,6 +28977,26 @@ components: maxLength: 24 minLength: 24 pattern: ^([a-f0-9]{24})$ + TeamUpdate: + type: object + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + name: + type: string + description: Human-readable label that identifies the team. + writeOnly: true + required: + - name TenantRestore: type: object properties: @@ -26476,10 +29107,13 @@ components: required: - snapshotId - targetDeploymentItemName - ThridPartyIntegration: + ThirdPartyIntegration: type: object description: Collection of settings that describe third-party integrations. properties: + id: + type: string + description: Integration id. type: type: string description: >- @@ -26646,31 +29280,14 @@ components: type: boolean description: Flag that indicates whether someone has activated the Prometheus integration. - listenAddress: - type: string - default: :9216 - description: Combination of IPv4 address and Internet Assigned Numbers Authority - (IANA) port or the IANA port alone to which Prometheus binds to - ingest MongoDB metrics. password: type: string + description: Password needed to allow MongoDB Cloud to access your Prometheus + account. writeOnly: true - rateLimitInterval: - type: integer - format: int32 - writeOnly: true - scheme: - type: string - description: Security Scheme to apply to HyperText Transfer Protocol (HTTP) - traffic between Prometheus and MongoDB Cloud. serviceDiscovery: type: string description: Desired method to discover the Prometheus service. - tlsPemPath: - type: string - description: Root-relative path to the Transport Layer Security (TLS) Privacy - Enhanced Mail (PEM) key and certificate file on the host. - example: /path/to/file username: type: string description: Human-readable label that identifies your Prometheus incoming @@ -26731,6 +29348,8 @@ components: TriggerIngestionPipelineRequest: type: object properties: + datasetRetentionPolicy: + $ref: "#/components/schemas/DatasetRetentionPolicy" snapshotId: type: string description: Unique 24-hexadecimal character string that identifies the snapshot. @@ -26828,7 +29447,7 @@ components: items: type: string uniqueItems: true - UserAccessList: + UserAccessListRequest: type: object properties: cidrBlock: @@ -26839,6 +29458,24 @@ components: Protocol version 4 or version 6 addresses. You can set a value for this parameter or **ipAddress** but not both in the same request. example: 203.0.113.0/24 + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|(:{0,2}([0-9a-f]{1,4}:){0,7}[0-9a-f]{1,4}[:]{0,2}))((%2[fF]|/)[0-9]{1,3})+$ + ipAddress: + type: string + description: Network address that you want to add to the access list for the API + key. This parameter requires the address to be expressed as one + Internet Protocol version 4 or version 6 address. You can set a + value for this parameter or **cidrBlock** but not both in the same + request. + example: 203.0.113.10 + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ + UserAccessListResponse: + type: object + properties: + cidrBlock: + type: string + description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) + notation in the access list for the API key. + example: 203.0.113.0/24 pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ count: type: integer @@ -26857,11 +29494,7 @@ components: readOnly: true ipAddress: type: string - description: Network address that you want to add to the access list for the API - key. This parameter requires the address to be expressed as one - Internet Protocol version 4 or version 6 address. You can set a - value for this parameter or **cidrBlock** but not both in the same - request. + description: Network address in the access list for the API key. example: 203.0.113.10 pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))$ lastUsed: @@ -27058,16 +29691,47 @@ components: - match title: User to Distinguished Name Mapping X509Certificate: + type: object + properties: + notAfter: + type: string + format: date-time + description: Latest date that the certificate is valid. + notBefore: + type: string + format: date-time + description: Earliest date that the certificate is valid. + X509CertificateUpdate: type: object properties: content: type: string + description: Certificate content. notAfter: type: string format: date-time + description: Latest date that the certificate is valid. notBefore: type: string format: date-time + description: Earliest date that the certificate is valid. + ZoneMapping: + type: object + description: Human-readable label that identifies the subset of a global cluster. + properties: + location: + type: string + description: Code that represents a location that maps to a zone in your global + cluster. MongoDB Cloud represents this location with a ISO 3166-2 + location and subdivision codes when possible. + zone: + type: string + description: Human-readable label that identifies the zone in your global + cluster. This zone maps to a location code. + required: + - location + - zone + title: Global Cluster Zone raw: type: object description: Additional meta information captured about this event. The response @@ -27141,6 +29805,7 @@ components: minLength: 1 severity: type: string + description: Severity of the event. readOnly: true AWSCustomDNSEnabled: type: object @@ -27165,12 +29830,12 @@ components: type: string description: Range of IP addresses in Classless Inter-Domain Routing (CIDR) notation that found in this project's access list. - pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|([\:]{0,2}([0-9a-f]{1,4}\:){0,7}[0-9a-f]{1,4}[\:]{0,2}))((%2[fF]|\/)[0-9]{1,3})+$ + pattern: ^((([0-9]{1,3}\.){3}[0-9]{1,3})|(:{0,2}([0-9a-f]{1,4}:){0,7}[0-9a-f]{1,4}[:]{0,2}))((%2[fF]|/)[0-9]{1,3})+$ readOnly: true ipAddress: type: string description: IP address included in the API access list. - pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}\:){7}[0-9a-f]{1,4}$ + pattern: ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}|([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}$ readOnly: true required: - ipAddress @@ -27377,6 +30042,65 @@ components: represents. readOnly: true readOnly: true + ApiSearchDeploymentRequest: + type: object + properties: + specs: + type: array + description: List of settings that configure the Search Nodes for your cluster. + items: + $ref: "#/components/schemas/ApiSearchDeploymentSpec" + maxItems: 1 + minItems: 1 + required: + - specs + ApiSearchDeploymentResponse: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal character string that identifies the project. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + id: + type: string + description: Unique 24-hexadecimal digit string that identifies the search + deployment. + example: 32b6e34b3d91647abb20e7b8 + maxLength: 24 + minLength: 24 + pattern: ^([a-f0-9]{24})$ + readOnly: true + specs: + type: array + description: List of settings that configure the Search Nodes for your cluster. + items: + $ref: "#/components/schemas/ApiSearchDeploymentSpec" + readOnly: true + stateName: + type: string + description: Human-readable label that indicates the current operating condition + of this search deployment. + readOnly: true + ApiSearchDeploymentSpec: + type: object + properties: + instanceSize: + type: string + description: Hardware specification for the Search Node instance sizes. + nodeCount: + type: integer + format: int32 + description: Number of Search Nodes in the cluster. + example: 2 + maximum: 32 + minimum: 2 + required: + - instanceSize + - nodeCount AutoExportPolicy: type: object description: Policy for automatically exporting cloud backup snapshots. @@ -27394,6 +30118,27 @@ components: description: Human-readable label that indicates the rate at which the export policy item occurs. title: export + CollStatsRankedNamespaces: + type: object + properties: + groupId: + type: string + description: Unique 24-hexadecimal digit string that identifies the request + project. + readOnly: true + identifierId: + type: string + description: Unique 24-hexadecimal digit string that identifies the request + process. + readOnly: true + rankedNamespaces: + type: array + description: Ordered list of the hottest namespaces, highest value first. + items: + type: string + description: A single namespace. + readOnly: true + readOnly: true CostExplorerFilterResponse: type: object description: Response object to give information about created query. @@ -27404,10 +30149,27 @@ components: example: d9ab638a801efe182f98ae3e18ea4bb47b9fda808a28a8c7de205bb0e94f7d71 maxLength: 64 minLength: 64 + CreateDataProcessRegion: + type: object + description: Settings to configure the region where you wish to store your + archived data. + properties: + cloudProvider: + type: string + description: Human-readable label that identifies the Cloud service provider + where you wish to store your archived data. **AZURE** may be + selected only if **AZURE** is the Cloud service provider for the + cluster and no **AWS** online archive has been created for the + cluster. + region: + type: string + description: Human-readable label that identifies the geographic location of the + region where you wish to store your archived data. + writeOnly: true Criteria: type: object description: >- - Rules by which MongoDB MongoDB Cloud archives data. + Rules by which MongoDB Cloud archives data. Use the **criteria.type** field to choose how MongoDB Cloud selects data to archive. Choose data using the age of the data or a MongoDB query. @@ -27456,6 +30218,17 @@ components: description: 'Number of days after the value in the **criteria.dateField** when MongoDB Cloud archives data in the specified cluster. Set this parameter when you set **"criteria.type" : "DATE"**.' + DataExpirationRule: + type: object + description: Rule for specifying when data should be deleted from the archive. + properties: + expireAfterDays: + type: integer + format: int32 + description: Number of days used in the date criteria for nominating documents + for deletion. + maximum: 9215 + minimum: 7 DataProcessRegion: type: object description: Settings to configure the region where you wish to store your @@ -27464,11 +30237,14 @@ components: cloudProvider: type: string description: Human-readable label that identifies the Cloud service provider - where you wish to store your archived data. + where you store your archived data. + readOnly: true region: type: string description: Human-readable label that identifies the geographic location of the - region where you wish to store your archived data. + region where you store your archived data. + readOnly: true + readOnly: true GroupPaginatedEvent: type: object properties: @@ -27493,8 +30269,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true ManagedNamespace: @@ -27576,8 +30352,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAdvancedClusterDescription: @@ -27604,7 +30380,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAlertConfig: @@ -27631,8 +30408,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAlert: @@ -27659,8 +30436,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiApiUser: @@ -27687,7 +30464,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAppUser: @@ -27714,7 +30492,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasCheckpoint: @@ -27741,7 +30520,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasDatabaseUser: @@ -27770,7 +30550,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasDiskBackupExportJob: @@ -27797,7 +30578,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasProviderRegions: @@ -27824,7 +30606,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasServerlessBackupRestoreJob: @@ -27851,7 +30634,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiAtlasServerlessBackupSnapshot: @@ -27878,7 +30662,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiInvoice: @@ -27905,7 +30690,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiStreamsConnection: @@ -27932,8 +30718,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedApiStreamsTenant: @@ -27960,11 +30746,11 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true - PaginatedApiUserAccessList: + PaginatedApiUserAccessListResponse: type: object properties: links: @@ -27983,12 +30769,13 @@ components: description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: "#/components/schemas/UserAccessList" + $ref: "#/components/schemas/UserAccessListResponse" readOnly: true totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAppUser: @@ -28015,7 +30802,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedAtlasGroup: @@ -28042,7 +30830,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedBackupSnapshotExportBucket: @@ -28069,7 +30858,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedBackupSnapshot: @@ -28096,7 +30886,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedCloudBackupReplicaSet: @@ -28123,7 +30914,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedCloudBackupRestoreJob: @@ -28150,7 +30942,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedCloudBackupShardedClusterSnapshot: @@ -28177,7 +30970,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedCloudProviderContainer: @@ -28205,7 +30999,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true title: Network Peering @@ -28234,8 +31029,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedDatabase: @@ -28262,7 +31057,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedDiskPartition: @@ -28289,7 +31085,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedIntegration: @@ -28311,13 +31108,13 @@ components: description: List of returned documents that MongoDB Cloud providers when completing this request. items: - $ref: "#/components/schemas/ThridPartyIntegration" + $ref: "#/components/schemas/ThirdPartyIntegration" readOnly: true totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedNetworkAccess: @@ -28344,7 +31141,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedOnlineArchive: @@ -28371,7 +31169,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedOrgGroup: @@ -28398,7 +31197,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedOrganization: @@ -28425,7 +31225,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedPipelineRun: @@ -28452,7 +31253,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedPrivateNetworkEndpointIdEntry: @@ -28479,8 +31281,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response if **includeCount** - query param is true. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedRestoreJob: @@ -28507,7 +31309,38 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. + minimum: 0 + readOnly: true + PaginatedRoleMapping: + type: object + description: List role mappings from the specified organization in the specified + federation. + properties: + links: + type: array + description: List of one or more Uniform Resource Locators (URLs) that point to + API sub-resources, related API resources, or both. RFC 5988 outlines + these relationships. + externalDocs: + description: Web Linking Specification (RFC 5988) + url: https://datatracker.ietf.org/doc/html/rfc5988 + items: + $ref: "#/components/schemas/Link" + readOnly: true + results: + type: array + description: List of returned documents that MongoDB Cloud providers when + completing this request. + items: + $ref: "#/components/schemas/AuthFederationRoleMapping" + readOnly: true + totalCount: + type: integer + format: int32 + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedServerlessInstanceDescription: @@ -28534,7 +31367,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedSnapshot: @@ -28561,7 +31395,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedTeamRole: @@ -28588,7 +31423,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedTeam: @@ -28615,7 +31451,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedTenantRestore: @@ -28642,7 +31479,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedTenantSnapshot: @@ -28669,7 +31507,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PaginatedUserCert: @@ -28696,7 +31535,8 @@ components: totalCount: type: integer format: int32 - description: Number of documents returned in this response. + description: Total number of documents available. MongoDB Cloud omits this value + if `includeCount` is set to `false`. minimum: 0 readOnly: true PartitionField: @@ -28778,11 +31618,6 @@ components: - Set this value to `false` to disable regionalized private endpoints. required: - enabled - ResourceEventType: - type: string - description: Unique identifier of event type. - example: TAGS_MODIFIED - title: Resource Event Types ApiAtlasFTSAnalyzers: type: object description: Settings that describe one Atlas Search custom analyzer. diff --git a/tools/openapi-generator/config/go-templates/client.mustache b/tools/openapi-generator/config/go-templates/client.mustache index 33756840ed..39c19c7b6b 100644 --- a/tools/openapi-generator/config/go-templates/client.mustache +++ b/tools/openapi-generator/config/go-templates/client.mustache @@ -9,7 +9,7 @@ import ( "github.com/mongodb-forks/digest" "{{sdkImport}}/admin" "go.mongodb.org/atlas/auth" - "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/log" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/atlascli/internal/log" ) const ( diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 9f55d6a70e..1cd9673641 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -17,7 +17,7 @@ import ( "github.com/spf13/afero" "github.com/spf13/cobra" "{{sdkImport}}/admin" - "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/internal/config" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/atlascli/internal/config" ) {{#operations}} @@ -35,7 +35,7 @@ type {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Opts struct { format string tmpl *template.Template {{#returnProperty}} - resp {{#isFile}}{{dataType}}{{/isFile}}{{#isPrimitiveType}}{{dataType}}{{/isPrimitiveType}}{{^isFile}}{{^isPrimitiveType}}{{#isArray}}[]{{/isArray}}{{^isArray}}*{{/isArray}}admin.{{complexType}}{{/isPrimitiveType}}{{/isFile}} + resp {{#isFile}}io.ReadCloser{{/isFile}}{{#isPrimitiveType}}{{dataType}}{{/isPrimitiveType}}{{^isFile}}{{^isPrimitiveType}}{{#isArray}}[]{{/isArray}}{{^isArray}}*{{/isArray}}admin.{{complexType}}{{/isPrimitiveType}}{{/isFile}} {{/returnProperty}} {{/returnType}} {{#vendorExtensions.x-watcher-operation}} diff --git a/tools/openapi-generator/package.json b/tools/openapi-generator/package.json index 3f35cbd063..ec69f4c9bf 100644 --- a/tools/openapi-generator/package.json +++ b/tools/openapi-generator/package.json @@ -5,9 +5,9 @@ "private": true, "scripts": { "generate:clear": "rm -rf ../../internal/api && mkdir -p ../../internal/api && cp config/.openapi-generator-ignore ../../internal/api", - "generate:download": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); curl -L -o config/atlas-api.yaml \"https://raw.githubusercontent.com/mongodb/atlas-sdk-go/$SDKVERSION/openapi/atlas-api-transformed.yaml\"", + "generate:download": "export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | grep '// indirect' -v | awk '{print $2}'); curl -L -o config/atlas-api.yaml \"https://raw.githubusercontent.com/mongodb/atlas-sdk-go/$SDKVERSION/openapi/atlas-api-transformed.yaml\"", "generate:transform": "node merge.js config/atlas-api.yaml config/atlas-api-changes.yaml > config/atlas-api-transformed.yaml", - "generate:run": "export CURRENTYEAR=$(date -u +\"%Y\"); export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | awk '{print $1}'); export GO_POST_PROCESS_FILE='goimports -w'; openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api --additional-properties=\"sdkImport=$SDKIMPORT,sdkVersion=$SDKVERSION,currentYear=$CURRENTYEAR\"", + "generate:run": "export CURRENTYEAR=$(date -u +\"%Y\"); export SDKVERSION=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | grep '// indirect' -v | awk '{print $2}'); export SDKIMPORT=$(cat ../../go.mod | grep go.mongodb.org/atlas-sdk | grep '// indirect' -v | awk '{print $1}'); export GO_POST_PROCESS_FILE='goimports -w'; openapi-generator-cli generate --enable-post-process-file -c './config/config.yaml' --type-mappings=integer=int --type-mappings=DateTime=string -o ../../internal/api --additional-properties=\"sdkImport=$SDKIMPORT,sdkVersion=$SDKVERSION,currentYear=$CURRENTYEAR\"", "generate": "npm run generate:clear && npm run generate:download && npm run generate:transform && npm run generate:run" }, "repository": { From c22f376c863e3367ce0af48989fa5e03afa04b4a Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Mon, 29 Apr 2024 17:41:26 +0100 Subject: [PATCH 42/44] update --- internal/api/api.go | 1 - tools/openapi-generator/config/go-templates/api.mustache | 1 - 2 files changed, 2 deletions(-) diff --git a/internal/api/api.go b/internal/api/api.go index 63d6e48281..9cc66a9a6b 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -21,7 +21,6 @@ import ( ) func Builder() *cobra.Command { - const use = "api" cmd := &cobra.Command{ Use: "api", Short: "Access to api resources.", diff --git a/tools/openapi-generator/config/go-templates/api.mustache b/tools/openapi-generator/config/go-templates/api.mustache index b14da4a9a6..90d458160b 100644 --- a/tools/openapi-generator/config/go-templates/api.mustache +++ b/tools/openapi-generator/config/go-templates/api.mustache @@ -6,7 +6,6 @@ import ( ) func Builder() *cobra.Command { - const use = "api" cmd := &cobra.Command{ Use: "api", Short: "Access to api resources.", From e4e612087658934b3964d6982a2945919ff67c74 Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Mon, 29 Apr 2024 17:46:54 +0100 Subject: [PATCH 43/44] add aliases --- internal/api/api.go | 7 ++++--- internal/api/api_access_tracking_cmd.go | 7 +++++-- internal/api/api_alert_configurations_cmd.go | 7 +++++-- internal/api/api_alerts_cmd.go | 7 +++++-- internal/api/api_atlas_search_cmd.go | 7 +++++-- internal/api/api_auditing_cmd.go | 7 +++++-- internal/api/api_aws_clusters_dns_cmd.go | 7 +++++-- internal/api/api_cloud_backups_cmd.go | 7 +++++-- internal/api/api_cloud_migration_service_cmd.go | 7 +++++-- internal/api/api_cloud_provider_access_cmd.go | 7 +++++-- internal/api/api_cluster_outage_simulation_cmd.go | 7 +++++-- internal/api/api_clusters_cmd.go | 7 +++++-- internal/api/api_collection_level_metrics_cmd.go | 7 +++++-- internal/api/api_custom_database_roles_cmd.go | 7 +++++-- internal/api/api_data_federation_cmd.go | 7 +++++-- internal/api/api_data_lake_pipelines_cmd.go | 7 +++++-- internal/api/api_database_users_cmd.go | 7 +++++-- ...encryption_at_rest_using_customer_key_management_cmd.go | 7 +++++-- internal/api/api_events_cmd.go | 7 +++++-- internal/api/api_federated_authentication_cmd.go | 7 +++++-- internal/api/api_global_clusters_cmd.go | 5 ++++- internal/api/api_invoices_cmd.go | 7 +++++-- internal/api/api_ldap_configuration_cmd.go | 7 +++++-- internal/api/api_legacy_backup_cmd.go | 7 +++++-- internal/api/api_maintenance_windows__cmd.go | 7 +++++-- internal/api/api_mongo_db_cloud_users_cmd.go | 7 +++++-- internal/api/api_monitoring_and_logs_cmd.go | 7 +++++-- internal/api/api_network_peering_cmd.go | 5 ++++- internal/api/api_online_archive_cmd.go | 7 +++++-- internal/api/api_organizations_cmd.go | 7 +++++-- internal/api/api_performance_advisor_cmd.go | 7 +++++-- internal/api/api_private_endpoint_services_cmd.go | 7 +++++-- internal/api/api_programmatic_api_keys_cmd.go | 7 +++++-- internal/api/api_project_ip_access_list_cmd.go | 7 +++++-- internal/api/api_projects_cmd.go | 7 +++++-- internal/api/api_push_based_log_export_cmd.go | 7 +++++-- internal/api/api_rolling_index_cmd.go | 7 +++++-- internal/api/api_root_cmd.go | 7 +++++-- internal/api/api_serverless_instances_cmd.go | 7 +++++-- internal/api/api_serverless_private_endpoints_cmd.go | 7 +++++-- internal/api/api_shared_tier_restore_jobs_cmd.go | 7 +++++-- internal/api/api_shared_tier_snapshots_cmd.go | 7 +++++-- internal/api/api_streams_cmd.go | 7 +++++-- internal/api/api_teams_cmd.go | 7 +++++-- internal/api/api_third_party_integrations_cmd.go | 5 ++++- internal/api/api_x509_authentication_cmd.go | 7 +++++-- tools/openapi-generator/config/go-templates/api.mustache | 7 ++++--- tools/openapi-generator/config/go-templates/cmd.mustache | 5 ++++- 48 files changed, 234 insertions(+), 94 deletions(-) diff --git a/internal/api/api.go b/internal/api/api.go index 9cc66a9a6b..8d03a69cda 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -22,9 +22,10 @@ import ( func Builder() *cobra.Command { cmd := &cobra.Command{ - Use: "api", - Short: "Access to api resources.", - Long: `This command provides access to API resources specified in https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/.`, + Use: "api", + Short: "Access to api resources.", + Long: `This command provides access to API resources specified in https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/.`, + Aliases: []string{"API"}, } cmd.AddCommand( diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index b2af802512..9b1f0d98ff 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20231115012/admin" @@ -240,9 +241,11 @@ func listAccessLogsByHostnameBuilder() *cobra.Command { } func accessTrackingBuilder() *cobra.Command { + const use = "accessTracking" cmd := &cobra.Command{ - Use: "accessTracking", - Short: `Returns access logs for authentication attempts made to Atlas database deployments. To view database access history, you must have either the Project Owner or Organization Owner role.`, + Use: use, + Short: `Returns access logs for authentication attempts made to Atlas database deployments. To view database access history, you must have either the Project Owner or Organization Owner role.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( listAccessLogsByClusterNameBuilder(), diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index d57f2c253f..c3cbcc105c 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -816,9 +817,11 @@ func updateAlertConfigurationBuilder() *cobra.Command { } func alertConfigurationsBuilder() *cobra.Command { + const use = "alertConfigurations" cmd := &cobra.Command{ - Use: "alertConfigurations", - Short: `Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.`, + Use: use, + Short: `Returns and edits the conditions that trigger alerts and how MongoDB Cloud notifies users. This collection remains under revision and may change.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createAlertConfigurationBuilder(), diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index af472937c4..629c69fee6 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -441,9 +442,11 @@ func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { } func alertsBuilder() *cobra.Command { + const use = "alerts" cmd := &cobra.Command{ - Use: "alerts", - Short: `Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.`, + Use: use, + Short: `Returns and acknowledges alerts that MongoDB Cloud triggers based on the alert conditions that you define. This collection remains under revision and may change.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( acknowledgeAlertBuilder(), diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index bbbfeef86c..bacca7f176 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -969,9 +970,11 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { } func atlasSearchBuilder() *cobra.Command { + const use = "atlasSearch" cmd := &cobra.Command{ - Use: "atlasSearch", - Short: `Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.`, + Use: use, + Short: `Returns, adds, edits, and removes Atlas Search indexes for the specified cluster. Also returns and updates user-defined analyzers for the specified cluster.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createAtlasSearchDeploymentBuilder(), diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 363a4e1dcd..0a1ac28d5b 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -238,9 +239,11 @@ func updateAuditingConfigurationBuilder() *cobra.Command { } func auditingBuilder() *cobra.Command { + const use = "auditing" cmd := &cobra.Command{ - Use: "auditing", - Short: `Returns and edits database auditing settings for MongoDB Cloud projects.`, + Use: use, + Short: `Returns and edits database auditing settings for MongoDB Cloud projects.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( getAuditingConfigurationBuilder(), diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index 85f52723d9..9c29201f50 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -238,9 +239,11 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { } func aWSClustersDNSBuilder() *cobra.Command { + const use = "aWSClustersDNS" cmd := &cobra.Command{ - Use: "aWSClustersDNS", - Short: `Returns and edits custom DNS configurations for MongoDB Cloud database deployments on AWS. The resource requires your Project ID. If you use the VPC peering on AWS and you use your own DNS servers instead of Amazon Route 53, enable custom DNS. Before 31 March 2020, applications deployed within AWS using custom DNS services and VPC-peered with MongoDB Cloud couldn't connect over private IP addresses. Custom DNS resolved to public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings.`, + Use: use, + Short: `Returns and edits custom DNS configurations for MongoDB Cloud database deployments on AWS. The resource requires your Project ID. If you use the VPC peering on AWS and you use your own DNS servers instead of Amazon Route 53, enable custom DNS. Before 31 March 2020, applications deployed within AWS using custom DNS services and VPC-peered with MongoDB Cloud couldn't connect over private IP addresses. Custom DNS resolved to public IP addresses. AWS internal DNS resolved to private IP addresses. Applications deployed with custom DNS services in AWS should use Private IP for Peering connection strings.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( getAWSCustomDNSBuilder(), diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 01500d7283..7282d0462a 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -2976,9 +2977,11 @@ func updateSnapshotRetentionBuilder() *cobra.Command { } func cloudBackupsBuilder() *cobra.Command { + const use = "cloudBackups" cmd := &cobra.Command{ - Use: "cloudBackups", - Short: `Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.`, + Use: use, + Short: `Manages Cloud Backup snapshots, snapshot export buckets, restore jobs, and schedules. This resource applies only to clusters that use Cloud Backups.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( cancelBackupRestoreJobBuilder(), diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index b2a9309805..27506484b1 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -805,9 +806,11 @@ func validateMigrationBuilder() *cobra.Command { } func cloudMigrationServiceBuilder() *cobra.Command { + const use = "cloudMigrationService" cmd := &cobra.Command{ - Use: "cloudMigrationService", - Short: `Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.`, + Use: use, + Short: `Manages the Cloud Migration Service. Source organizations, projects, and MongoDB clusters reside on Cloud Manager or Ops Manager. Destination organizations, projects, and MongoDB clusters reside on MongoDB Cloud. Source databases can't use any authentication except SCRAM-SHA.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createLinkTokenBuilder(), diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index 7d18334c37..1e4378cb8b 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -519,9 +520,11 @@ func listCloudProviderAccessRolesBuilder() *cobra.Command { } func cloudProviderAccessBuilder() *cobra.Command { + const use = "cloudProviderAccess" cmd := &cobra.Command{ - Use: "cloudProviderAccess", - Short: `Returns, adds, authorizes, and removes AWS IAM roles in Atlas.`, + Use: use, + Short: `Returns, adds, authorizes, and removes AWS IAM roles in Atlas.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( authorizeCloudProviderAccessRoleBuilder(), diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index ab29d62892..f921a8ab41 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -335,9 +336,11 @@ func startOutageSimulationBuilder() *cobra.Command { } func clusterOutageSimulationBuilder() *cobra.Command { + const use = "clusterOutageSimulation" cmd := &cobra.Command{ - Use: "clusterOutageSimulation", - Short: `Returns, starts, or ends a cluster outage simulation.`, + Use: use, + Short: `Returns, starts, or ends a cluster outage simulation.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( endOutageSimulationBuilder(), diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index ffd249cb8b..6f1c5b5ee6 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -28,6 +28,7 @@ import ( "time" "github.com/briandowns/spinner" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1539,9 +1540,11 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { } func clustersBuilder() *cobra.Command { + const use = "clusters" cmd := &cobra.Command{ - Use: "clusters", - Short: `Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.`, + Use: use, + Short: `Returns, adds, edits, and removes database deployments. Changes to cluster configurations can affect costs. This resource requires your Project ID.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createClusterBuilder(), diff --git a/internal/api/api_collection_level_metrics_cmd.go b/internal/api/api_collection_level_metrics_cmd.go index e358b7cc92..919b167319 100644 --- a/internal/api/api_collection_level_metrics_cmd.go +++ b/internal/api/api_collection_level_metrics_cmd.go @@ -27,6 +27,7 @@ import ( "text/template" "time" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1074,9 +1075,11 @@ func unpinNamespacesBuilder() *cobra.Command { } func collectionLevelMetricsBuilder() *cobra.Command { + const use = "collectionLevelMetrics" cmd := &cobra.Command{ - Use: "collectionLevelMetrics", - Short: `Returns, adds, and edits pinned namespaces for the specified cluster or process. Also returns collection level latency metric data.`, + Use: use, + Short: `Returns, adds, and edits pinned namespaces for the specified cluster or process. Also returns collection level latency metric data.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( getCollStatsLatencyNamespaceClusterMeasurementsBuilder(), diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 9ee3595965..2c37c36a32 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -515,9 +516,11 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { } func customDatabaseRolesBuilder() *cobra.Command { + const use = "customDatabaseRoles" cmd := &cobra.Command{ - Use: "customDatabaseRoles", - Short: `Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the project level, for all clusters in the project. This resource supports a subset of MongoDB privilege actions. You can create a subset of custom role actions. To create a wider list of custom role actions, use the MongoDB Cloud user interface. Custom roles must include actions that all project's clusters support, and that are compatible with each MongoDB version that your project's clusters use. For example, if your project has MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4.`, + Use: use, + Short: `Returns, adds, edits, and removes custom database user privilege roles. Use custom roles to specify custom sets of actions that the MongoDB Cloud built-in roles can't describe. You define custom roles at the project level, for all clusters in the project. This resource supports a subset of MongoDB privilege actions. You can create a subset of custom role actions. To create a wider list of custom role actions, use the MongoDB Cloud user interface. Custom roles must include actions that all project's clusters support, and that are compatible with each MongoDB version that your project's clusters use. For example, if your project has MongoDB 4.2 clusters, you can't create custom roles that use actions introduced in MongoDB 4.4.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createCustomDatabaseRoleBuilder(), diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index 97ed9bfc11..b1aed696a0 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1465,9 +1466,11 @@ func updateFederatedDatabaseBuilder() *cobra.Command { } func dataFederationBuilder() *cobra.Command { + const use = "dataFederation" cmd := &cobra.Command{ - Use: "dataFederation", - Short: `Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.`, + Use: use, + Short: `Returns, adds, edits, and removes Federated Database Instances. This resource requires your project ID. Changes to federated database instance configurations can affect costs.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createDataFederationPrivateEndpointBuilder(), diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 59f2f32138..53de3fce0b 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -27,6 +27,7 @@ import ( "text/template" "time" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1338,9 +1339,11 @@ func updatePipelineBuilder() *cobra.Command { } func dataLakePipelinesBuilder() *cobra.Command { + const use = "dataLakePipelines" cmd := &cobra.Command{ - Use: "dataLakePipelines", - Short: `Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.`, + Use: use, + Short: `Returns, adds, edits, and removes Atlas Data Lake Pipelines and associated runs.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createPipelineBuilder(), diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index bb2aac366f..73d6c14d5b 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -597,9 +598,11 @@ func updateDatabaseUserBuilder() *cobra.Command { } func databaseUsersBuilder() *cobra.Command { + const use = "databaseUsers" cmd := &cobra.Command{ - Use: "databaseUsers", - Short: `Returns, adds, edits, and removes database users.`, + Use: use, + Short: `Returns, adds, edits, and removes database users.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createDatabaseUserBuilder(), diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index 8316a7bc74..dda75d68ae 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -238,9 +239,11 @@ func updateEncryptionAtRestBuilder() *cobra.Command { } func encryptionAtRestUsingCustomerKeyManagementBuilder() *cobra.Command { + const use = "encryptionAtRestUsingCustomerKeyManagement" cmd := &cobra.Command{ - Use: "encryptionAtRestUsingCustomerKeyManagement", - Short: `Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.`, + Use: use, + Short: `Returns and edits the Encryption at Rest using Customer Key Management configuration. MongoDB Cloud encrypts all storage whether or not you use your own key management.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( getEncryptionAtRestBuilder(), diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index e2f9548c52..0db64844ed 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -27,6 +27,7 @@ import ( "text/template" "time" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20231115012/admin" @@ -477,9 +478,11 @@ func listProjectEventsBuilder() *cobra.Command { } func eventsBuilder() *cobra.Command { + const use = "events" cmd := &cobra.Command{ - Use: "events", - Short: `Returns events. This collection remains under revision and may change.`, + Use: use, + Short: `Returns events. This collection remains under revision and may change.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( getOrganizationEventBuilder(), diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index a87363dc69..dc96146d6a 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1594,9 +1595,11 @@ func updateRoleMappingBuilder() *cobra.Command { } func federatedAuthenticationBuilder() *cobra.Command { + const use = "federatedAuthentication" cmd := &cobra.Command{ - Use: "federatedAuthentication", - Short: `Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.`, + Use: use, + Short: `Returns, adds, edits, and removes federation-related features such as role mappings and connected organization configurations.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createIdentityProviderBuilder(), diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 01ad5a3ca9..1d20306627 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -554,10 +555,12 @@ func getManagedNamespaceBuilder() *cobra.Command { } func globalClustersBuilder() *cobra.Command { + const use = "globalClusters" cmd := &cobra.Command{ - Use: "globalClusters", + Use: use, Short: `Returns, adds, and removes Global Cluster managed namespaces and custom zone mappings. Each collection in a Global Cluster is associated with a managed namespace. When you create a managed namespace for a Global Cluster, MongoDB Cloud creates an empty collection for that namespace. Creating a managed namespace doesn't populate a collection with data. Similarly, deleting a managed namespace doesn't delete the associated collection. MongoDB Cloud shards the empty collection using the required location field and a custom shard key. For example, if your custom shard key is `city`, the compound shard key is `location, city`. Each Global Cluster is also associated with one or more Global Writes Zones. When a user creates a Global Cluster, MongoDB Cloud automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. For example, a use case might require mapping a location code to a geographically distant zone. Administrators can manage custom zone mappings with the APIs below and the **Global Cluster Configuration** pane when you create or modify your Global Cluster.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createCustomZoneMappingBuilder(), diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index f1f0def2fc..e08db945f0 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -599,9 +600,11 @@ func listPendingInvoicesBuilder() *cobra.Command { } func invoicesBuilder() *cobra.Command { + const use = "invoices" cmd := &cobra.Command{ - Use: "invoices", - Short: `Returns invoices.`, + Use: use, + Short: `Returns invoices.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createCostExplorerQueryProcessBuilder(), diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index 806d65b5ea..a2a3e3ac40 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -532,9 +533,11 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { } func lDAPConfigurationBuilder() *cobra.Command { + const use = "lDAPConfiguration" cmd := &cobra.Command{ - Use: "lDAPConfiguration", - Short: `Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.`, + Use: use, + Short: `Returns, edits, verifies, and removes LDAP configurations. An LDAP configuration defines settings for MongoDB Cloud to connect to your LDAP server over TLS for user authentication and authorization. Your LDAP server must be visible to the internet or connected to your MongoDB Cloud cluster with VPC Peering. Also, your LDAP server must use TLS. You must have the MongoDB Cloud admin user privilege to use these endpoints. Also, to configure user authentication and authorization with LDAPS, your cluster must run MongoDB 3.6 or higher. Groups for which you have configured LDAPS can't create a cluster using a version of MongoDB 3.6 or lower.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( deleteLDAPConfigurationBuilder(), diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index b6c7c3f81b..5d5820aaec 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1170,9 +1171,11 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { } func legacyBackupBuilder() *cobra.Command { + const use = "legacyBackup" cmd := &cobra.Command{ - Use: "legacyBackup", - Short: `Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.`, + Use: use, + Short: `Manages Legacy Backup snapshots, restore jobs, schedules and checkpoints.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createLegacyBackupRestoreJobBuilder(), diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index d3dabafed9..8572d94402 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -418,9 +419,11 @@ func updateMaintenanceWindowBuilder() *cobra.Command { } func maintenanceWindowsBuilder() *cobra.Command { + const use = "maintenanceWindows" cmd := &cobra.Command{ - Use: "maintenanceWindows", - Short: `Returns, edits, and removes maintenance windows. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. You can defer a scheduled maintenance event for a project up to two times. Deferred maintenance events occur during your preferred maintenance window exactly one week after the previously scheduled date and time.`, + Use: use, + Short: `Returns, edits, and removes maintenance windows. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. You can defer a scheduled maintenance event for a project up to two times. Deferred maintenance events occur during your preferred maintenance window exactly one week after the previously scheduled date and time.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( deferMaintenanceWindowBuilder(), diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index ca5f244fd8..f9f3325d3b 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -24,6 +24,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -287,9 +288,11 @@ func getUserByUsernameBuilder() *cobra.Command { } func mongoDBCloudUsersBuilder() *cobra.Command { + const use = "mongoDBCloudUsers" cmd := &cobra.Command{ - Use: "mongoDBCloudUsers", - Short: `Returns, adds, and edits MongoDB Cloud users.`, + Use: use, + Short: `Returns, adds, and edits MongoDB Cloud users.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createUserBuilder(), diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index d5fbf91472..f12b005466 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -27,6 +27,7 @@ import ( "text/template" "time" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20231115012/admin" @@ -1555,9 +1556,11 @@ func listMetricTypesBuilder() *cobra.Command { } func monitoringAndLogsBuilder() *cobra.Command { + const use = "monitoringAndLogs" cmd := &cobra.Command{ - Use: "monitoringAndLogs", - Short: `Returns database deployment monitoring and logging data.`, + Use: use, + Short: `Returns database deployment monitoring and logging data.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( getAtlasProcessBuilder(), diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index 1e040be709..5029c21845 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1371,10 +1372,12 @@ func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { } func networkPeeringBuilder() *cobra.Command { + const use = "networkPeering" cmd := &cobra.Command{ - Use: "networkPeering", + Use: use, Short: `Returns, adds, edits, and removes network peering containers and peering connections. When you deploy an M10+ dedicated cluster, Atlas creates a VPC for the selected provider and region or regions if no existing VPC or VPC peering connection exists for that provider and region. Atlas assigns the VPC a Classless Inter-Domain Routing (CIDR) block.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createPeeringConnectionBuilder(), diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index b2b9acd755..e452125773 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -667,9 +668,11 @@ func updateOnlineArchiveBuilder() *cobra.Command { } func onlineArchiveBuilder() *cobra.Command { + const use = "onlineArchive" cmd := &cobra.Command{ - Use: "onlineArchive", - Short: `Returns, adds, edits, or removes an online archive.`, + Use: use, + Short: `Returns, adds, edits, or removes an online archive.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createOnlineArchiveBuilder(), diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 89ce93709f..2d2bd04cfd 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1751,9 +1752,11 @@ func updateOrganizationSettingsBuilder() *cobra.Command { } func organizationsBuilder() *cobra.Command { + const use = "organizations" cmd := &cobra.Command{ - Use: "organizations", - Short: `Returns, adds, and edits organizational units in MongoDB Cloud.`, + Use: use, + Short: `Returns, adds, and edits organizational units in MongoDB Cloud.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createOrganizationBuilder(), diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index 51a75425a5..f011843ecf 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20231115012/admin" @@ -661,9 +662,11 @@ func setServerlessAutoIndexingBuilder() *cobra.Command { } func performanceAdvisorBuilder() *cobra.Command { + const use = "performanceAdvisor" cmd := &cobra.Command{ - Use: "performanceAdvisor", - Short: `Returns suggested indexes and slow query data for a database deployment. Also enables or disables MongoDB Cloud-managed slow operation thresholds. To view field values in a sample query, you must have the Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted data rather than the field values.`, + Use: use, + Short: `Returns suggested indexes and slow query data for a database deployment. Also enables or disables MongoDB Cloud-managed slow operation thresholds. To view field values in a sample query, you must have the Project Data Access Read Only role or higher. Otherwise, MongoDB Cloud returns redacted data rather than the field values.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( disableSlowOperationThresholdingBuilder(), diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index 605c7f12f8..c126c886a9 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -955,9 +956,11 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { } func privateEndpointServicesBuilder() *cobra.Command { + const use = "privateEndpointServices" cmd := &cobra.Command{ - Use: "privateEndpointServices", - Short: `Returns, adds, edits, and removes private endpoint services.`, + Use: use, + Short: `Returns, adds, edits, and removes private endpoint services.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createPrivateEndpointBuilder(), diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index 7bf4d03dd6..38e9853ecf 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1528,9 +1529,11 @@ func updateApiKeyRolesBuilder() *cobra.Command { } func programmaticAPIKeysBuilder() *cobra.Command { + const use = "programmaticAPIKeys" cmd := &cobra.Command{ - Use: "programmaticAPIKeys", - Short: `Returns, adds, edits, and removes access tokens to use the MongoDB Cloud API. MongoDB Cloud applies these keys to organizations. These resources can return, assign, or revoke use of these keys within a specified project.`, + Use: use, + Short: `Returns, adds, edits, and removes access tokens to use the MongoDB Cloud API. MongoDB Cloud applies these keys to organizations. These resources can return, assign, or revoke use of these keys within a specified project.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( addProjectApiKeyBuilder(), diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index c243574061..ac3ad5cf2a 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -528,9 +529,11 @@ func listProjectIpAccessListsBuilder() *cobra.Command { } func projectIPAccessListBuilder() *cobra.Command { + const use = "projectIPAccessList" cmd := &cobra.Command{ - Use: "projectIPAccessList", - Short: `Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period.`, + Use: use, + Short: `Returns, adds, edits, and removes network access limits to database deployments in Atlas. This resource replaces the whitelist resource. Atlas removed whitelists in July 2021. Update your applications to use this new resource. This resource manages a project's IP Access List and supports creating temporary Access List entries that automatically expire within a user-configurable 7-day period.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createProjectIpAccessListBuilder(), diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 6a4ff56a13..6883f49e56 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -2351,9 +2352,11 @@ func updateProjectSettingsBuilder() *cobra.Command { } func projectsBuilder() *cobra.Command { + const use = "projects" cmd := &cobra.Command{ - Use: "projects", - Short: `Returns, adds, and edits collections of clusters and users in MongoDB Cloud.`, + Use: use, + Short: `Returns, adds, and edits collections of clusters and users in MongoDB Cloud.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( addUserToProjectBuilder(), diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index 2f1ecb3e99..555ddd6797 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -368,9 +369,11 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { } func pushBasedLogExportBuilder() *cobra.Command { + const use = "pushBasedLogExport" cmd := &cobra.Command{ - Use: "pushBasedLogExport", - Short: `You can continually push logs from mongod, mongos, and audit logs to an AWS S3 bucket. Atlas exports logs every 5 minutes.`, + Use: use, + Short: `You can continually push logs from mongod, mongos, and audit logs to an AWS S3 bucket. Atlas exports logs every 5 minutes.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createPushBasedLogConfigurationBuilder(), diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 744f9c5cb4..38128b6895 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -24,6 +24,7 @@ import ( "fmt" "io" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -130,9 +131,11 @@ func createRollingIndexBuilder() *cobra.Command { } func rollingIndexBuilder() *cobra.Command { + const use = "rollingIndex" cmd := &cobra.Command{ - Use: "rollingIndex", - Short: `Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.`, + Use: use, + Short: `Creates one index to a database deployment in a rolling manner. You can't create a rolling index on an `M0` free cluster or `M2/M5` shared cluster.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createRollingIndexBuilder(), diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index 95c55992cc..0c1d278a55 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -24,6 +24,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/cobra" "go.mongodb.org/atlas-sdk/v20231115012/admin" @@ -170,9 +171,11 @@ func returnAllControlPlaneIPAddressesBuilder() *cobra.Command { } func rootBuilder() *cobra.Command { + const use = "root" cmd := &cobra.Command{ - Use: "root", - Short: `Returns details that describe the MongoDB Cloud build and the access token that requests this resource. This starts the MongoDB Cloud API.`, + Use: use, + Short: `Returns details that describe the MongoDB Cloud build and the access token that requests this resource. This starts the MongoDB Cloud API.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( getSystemStatusBuilder(), diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index accb1ef436..5b6446c447 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -549,9 +550,11 @@ func updateServerlessInstanceBuilder() *cobra.Command { } func serverlessInstancesBuilder() *cobra.Command { + const use = "serverlessInstances" cmd := &cobra.Command{ - Use: "serverlessInstances", - Short: `Returns, adds, edits, and removes serverless instances.`, + Use: use, + Short: `Returns, adds, edits, and removes serverless instances.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createServerlessInstanceBuilder(), diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index 08bff42e24..ab68a045ae 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -560,9 +561,11 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { } func serverlessPrivateEndpointsBuilder() *cobra.Command { + const use = "serverlessPrivateEndpoints" cmd := &cobra.Command{ - Use: "serverlessPrivateEndpoints", - Short: `Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial.`, + Use: use, + Short: `Returns, adds, edits, and removes private endpoints for serverless instances. To learn more, see the Atlas Administration API tab on the following tutorial.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createServerlessPrivateEndpointBuilder(), diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index cf50d945d1..320a038ec8 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -339,9 +340,11 @@ func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { } func sharedTierRestoreJobsBuilder() *cobra.Command { + const use = "sharedTierRestoreJobs" cmd := &cobra.Command{ - Use: "sharedTierRestoreJobs", - Short: `Returns and adds restore jobs for shared-tier database deployments.`, + Use: use, + Short: `Returns and adds restore jobs for shared-tier database deployments.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createSharedClusterBackupRestoreJobBuilder(), diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index 69c0aa5e20..32b6d397e1 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -339,9 +340,11 @@ func listSharedClusterBackupsBuilder() *cobra.Command { } func sharedTierSnapshotsBuilder() *cobra.Command { + const use = "sharedTierSnapshots" cmd := &cobra.Command{ - Use: "sharedTierSnapshots", - Short: `Returns and requests to download shared-tier database deployment snapshots.`, + Use: use, + Short: `Returns and requests to download shared-tier database deployment snapshots.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( downloadSharedClusterBackupBuilder(), diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index c109ca56ae..9d157d0b76 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1177,9 +1178,11 @@ func updateStreamInstanceBuilder() *cobra.Command { } func streamsBuilder() *cobra.Command { + const use = "streams" cmd := &cobra.Command{ - Use: "streams", - Short: `Returns, adds, edits, and removes Streams Instances. This resource requires your project ID.`, + Use: use, + Short: `Returns, adds, edits, and removes Streams Instances. This resource requires your project ID.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createStreamConnectionBuilder(), diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index ed442b6715..ea01c4119c 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -1327,9 +1328,11 @@ func updateTeamRolesBuilder() *cobra.Command { } func teamsBuilder() *cobra.Command { + const use = "teams" cmd := &cobra.Command{ - Use: "teams", - Short: `Returns, adds, edits, or removes teams.`, + Use: use, + Short: `Returns, adds, edits, or removes teams.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( addAllTeamsToProjectBuilder(), diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index 65ffb64313..e75777e964 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -573,11 +574,13 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { } func thirdPartyIntegrationsBuilder() *cobra.Command { + const use = "thirdPartyIntegrations" cmd := &cobra.Command{ - Use: "thirdPartyIntegrations", + Use: use, Short: `Returns, adds, edits, and removes third-party service integration configurations. MongoDB Cloud sends alerts to each third-party service that you configure. **IMPORTANT**: Each project can only have one configuration per integrationType.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createThirdPartyIntegrationBuilder(), diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index a4910670b1..99912e3299 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -26,6 +26,7 @@ import ( "strings" "text/template" + "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli" "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/config" "github.com/spf13/afero" "github.com/spf13/cobra" @@ -340,9 +341,11 @@ func listDatabaseUserCertificatesBuilder() *cobra.Command { } func x509AuthenticationBuilder() *cobra.Command { + const use = "x509Authentication" cmd := &cobra.Command{ - Use: "x509Authentication", - Short: `Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages your certificates, it also manages your Certificate Authority and can generate certificates for your database users. No additional X.509 configuration is required. If you manage your certificates, you must provide a Certificate Authority and generate certificates for your database users.`, + Use: use, + Short: `Returns, edits, and removes user-managed X.509 configurations. Also returns and generates MongoDB Cloud-managed X.509 certificates for database users. The following resources help manage database users who authenticate using X.509 certificates. You can manage these X.509 certificates or let MongoDB Cloud do it for you. If MongoDB Cloud manages your certificates, it also manages your Certificate Authority and can generate certificates for your database users. No additional X.509 configuration is required. If you manage your certificates, you must provide a Certificate Authority and generate certificates for your database users.`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( createDatabaseUserCertificateBuilder(), diff --git a/tools/openapi-generator/config/go-templates/api.mustache b/tools/openapi-generator/config/go-templates/api.mustache index 90d458160b..05b9415758 100644 --- a/tools/openapi-generator/config/go-templates/api.mustache +++ b/tools/openapi-generator/config/go-templates/api.mustache @@ -7,9 +7,10 @@ import ( func Builder() *cobra.Command { cmd := &cobra.Command{ - Use: "api", - Short: "Access to api resources.", - Long: `This command provides access to API resources specified in https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/.`, + Use: "api", + Short: "Access to api resources.", + Long: `This command provides access to API resources specified in https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/.`, + Aliases: []string{"API"}, } cmd.AddCommand( diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 1cd9673641..7165852d79 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -18,6 +18,7 @@ import ( "github.com/spf13/cobra" "{{sdkImport}}/admin" "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/atlascli/internal/config" + "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/atlascli/internal/cli" ) {{#operations}} @@ -259,9 +260,11 @@ func {{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}Builder() *cobra.Comm {{#operations}} {{#operation}} {{#-first}} + const use = "{{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}" cmd := &cobra.Command{ - Use: "{{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}", + Use: use, Short: `{{#tags}}{{#-first}}{{description}}{{/-first}}{{/tags}}`, + Aliases: cli.GenerateAliases(use), } cmd.AddCommand( {{/-first}} From 53d9ea7dab44c8a320e66ad4d0ab1858358d771b Mon Sep 17 00:00:00 2001 From: Filipe C Menezes Date: Mon, 29 Apr 2024 17:55:28 +0100 Subject: [PATCH 44/44] fix --- internal/api/api_access_tracking_cmd.go | 12 +- internal/api/api_alert_configurations_cmd.go | 48 +++-- internal/api/api_alerts_cmd.go | 24 ++- internal/api/api_atlas_search_cmd.go | 54 ++++-- internal/api/api_auditing_cmd.go | 12 +- internal/api/api_aws_clusters_dns_cmd.go | 12 +- internal/api/api_cloud_backups_cmd.go | 174 ++++++++++++------ .../api/api_cloud_migration_service_cmd.go | 48 +++-- internal/api/api_cloud_provider_access_cmd.go | 30 ++- .../api/api_cluster_outage_simulation_cmd.go | 18 +- internal/api/api_clusters_cmd.go | 90 ++++++--- .../api/api_collection_level_metrics_cmd.go | 54 ++++-- internal/api/api_custom_database_roles_cmd.go | 30 ++- internal/api/api_data_federation_cmd.go | 84 ++++++--- internal/api/api_data_lake_pipelines_cmd.go | 78 +++++--- internal/api/api_database_users_cmd.go | 30 ++- ..._rest_using_customer_key_management_cmd.go | 12 +- internal/api/api_events_cmd.go | 24 ++- .../api/api_federated_authentication_cmd.go | 108 +++++++---- internal/api/api_global_clusters_cmd.go | 30 ++- internal/api/api_invoices_cmd.go | 36 ++-- internal/api/api_ldap_configuration_cmd.go | 30 ++- internal/api/api_legacy_backup_cmd.go | 66 ++++--- internal/api/api_maintenance_windows__cmd.go | 30 ++- internal/api/api_mongo_db_cloud_users_cmd.go | 18 +- internal/api/api_monitoring_and_logs_cmd.go | 84 ++++++--- internal/api/api_network_peering_cmd.go | 78 +++++--- internal/api/api_online_archive_cmd.go | 36 ++-- internal/api/api_organizations_cmd.go | 102 ++++++---- internal/api/api_performance_advisor_cmd.go | 42 +++-- .../api/api_private_endpoint_services_cmd.go | 54 ++++-- internal/api/api_programmatic_api_keys_cmd.go | 84 ++++++--- .../api/api_project_ip_access_list_cmd.go | 30 ++- internal/api/api_projects_cmd.go | 138 +++++++++----- internal/api/api_push_based_log_export_cmd.go | 24 ++- internal/api/api_rolling_index_cmd.go | 6 +- internal/api/api_root_cmd.go | 12 +- internal/api/api_serverless_instances_cmd.go | 30 ++- .../api_serverless_private_endpoints_cmd.go | 30 ++- .../api/api_shared_tier_restore_jobs_cmd.go | 18 +- internal/api/api_shared_tier_snapshots_cmd.go | 18 +- internal/api/api_streams_cmd.go | 66 ++++--- internal/api/api_teams_cmd.go | 78 +++++--- .../api/api_third_party_integrations_cmd.go | 30 ++- internal/api/api_x509_authentication_cmd.go | 18 +- .../config/go-templates/cmd.mustache | 4 +- 46 files changed, 1423 insertions(+), 711 deletions(-) diff --git a/internal/api/api_access_tracking_cmd.go b/internal/api/api_access_tracking_cmd.go index 9b1f0d98ff..4dd71cef1d 100644 --- a/internal/api/api_access_tracking_cmd.go +++ b/internal/api/api_access_tracking_cmd.go @@ -110,9 +110,11 @@ func (opts *listAccessLogsByClusterNameOpts) postRun(_ context.Context, w io.Wri func listAccessLogsByClusterNameBuilder() *cobra.Command { opts := listAccessLogsByClusterNameOpts{} + const use = "listAccessLogsByClusterName" cmd := &cobra.Command{ - Use: "listAccessLogsByClusterName", - Short: "Return Database Access History for One Cluster using Its Cluster Name", + Use: use, + Short: "Return Database Access History for One Cluster using Its Cluster Name", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -214,9 +216,11 @@ func (opts *listAccessLogsByHostnameOpts) postRun(_ context.Context, w io.Writer func listAccessLogsByHostnameBuilder() *cobra.Command { opts := listAccessLogsByHostnameOpts{} + const use = "listAccessLogsByHostname" cmd := &cobra.Command{ - Use: "listAccessLogsByHostname", - Short: "Return Database Access History for One Cluster using Its Hostname", + Use: use, + Short: "Return Database Access History for One Cluster using Its Hostname", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_alert_configurations_cmd.go b/internal/api/api_alert_configurations_cmd.go index c3cbcc105c..2d7a288729 100644 --- a/internal/api/api_alert_configurations_cmd.go +++ b/internal/api/api_alert_configurations_cmd.go @@ -132,9 +132,11 @@ func createAlertConfigurationBuilder() *cobra.Command { opts := createAlertConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "createAlertConfiguration" cmd := &cobra.Command{ - Use: "createAlertConfiguration", - Short: "Create One Alert Configuration in One Project", + Use: use, + Short: "Create One Alert Configuration in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -197,9 +199,11 @@ func (opts *deleteAlertConfigurationOpts) postRun(_ context.Context, _ io.Writer func deleteAlertConfigurationBuilder() *cobra.Command { opts := deleteAlertConfigurationOpts{} + const use = "deleteAlertConfiguration" cmd := &cobra.Command{ - Use: "deleteAlertConfiguration", - Short: "Remove One Alert Configuration from One Project", + Use: use, + Short: "Remove One Alert Configuration from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -285,9 +289,11 @@ func (opts *getAlertConfigurationOpts) postRun(_ context.Context, w io.Writer) e func getAlertConfigurationBuilder() *cobra.Command { opts := getAlertConfigurationOpts{} + const use = "getAlertConfiguration" cmd := &cobra.Command{ - Use: "getAlertConfiguration", - Short: "Return One Alert Configuration from One Project", + Use: use, + Short: "Return One Alert Configuration from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -358,9 +364,11 @@ func (opts *listAlertConfigurationMatchersFieldNamesOpts) postRun(_ context.Cont func listAlertConfigurationMatchersFieldNamesBuilder() *cobra.Command { opts := listAlertConfigurationMatchersFieldNamesOpts{} + const use = "listAlertConfigurationMatchersFieldNames" cmd := &cobra.Command{ - Use: "listAlertConfigurationMatchersFieldNames", - Short: "Get All Alert Configuration Matchers Field Names", + Use: use, + Short: "Get All Alert Configuration Matchers Field Names", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -448,9 +456,11 @@ func (opts *listAlertConfigurationsOpts) postRun(_ context.Context, w io.Writer) func listAlertConfigurationsBuilder() *cobra.Command { opts := listAlertConfigurationsOpts{} + const use = "listAlertConfigurations" cmd := &cobra.Command{ - Use: "listAlertConfigurations", - Short: "Return All Alert Configurations for One Project", + Use: use, + Short: "Return All Alert Configurations for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -544,9 +554,11 @@ func (opts *listAlertConfigurationsByAlertIdOpts) postRun(_ context.Context, w i func listAlertConfigurationsByAlertIdBuilder() *cobra.Command { opts := listAlertConfigurationsByAlertIdOpts{} + const use = "listAlertConfigurationsByAlertId" cmd := &cobra.Command{ - Use: "listAlertConfigurationsByAlertId", - Short: "Return All Alert Configurations Set for One Alert", + Use: use, + Short: "Return All Alert Configurations Set for One Alert", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -669,9 +681,11 @@ func toggleAlertConfigurationBuilder() *cobra.Command { opts := toggleAlertConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "toggleAlertConfiguration" cmd := &cobra.Command{ - Use: "toggleAlertConfiguration", - Short: "Toggle One State of One Alert Configuration in One Project", + Use: use, + Short: "Toggle One State of One Alert Configuration in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -793,9 +807,11 @@ func updateAlertConfigurationBuilder() *cobra.Command { opts := updateAlertConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "updateAlertConfiguration" cmd := &cobra.Command{ - Use: "updateAlertConfiguration", - Short: "Update One Alert Configuration for One Project", + Use: use, + Short: "Update One Alert Configuration for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_alerts_cmd.go b/internal/api/api_alerts_cmd.go index 629c69fee6..9eb5cdc0fb 100644 --- a/internal/api/api_alerts_cmd.go +++ b/internal/api/api_alerts_cmd.go @@ -134,9 +134,11 @@ func acknowledgeAlertBuilder() *cobra.Command { opts := acknowledgeAlertOpts{ fs: afero.NewOsFs(), } + const use = "acknowledgeAlert" cmd := &cobra.Command{ - Use: "acknowledgeAlert", - Short: "Acknowledge One Alert from One Project", + Use: use, + Short: "Acknowledge One Alert from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -225,9 +227,11 @@ func (opts *getAlertOpts) postRun(_ context.Context, w io.Writer) error { func getAlertBuilder() *cobra.Command { opts := getAlertOpts{} + const use = "getAlert" cmd := &cobra.Command{ - Use: "getAlert", - Short: "Return One Alert from One Project", + Use: use, + Short: "Return One Alert from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -320,9 +324,11 @@ func (opts *listAlertsOpts) postRun(_ context.Context, w io.Writer) error { func listAlertsBuilder() *cobra.Command { opts := listAlertsOpts{} + const use = "listAlerts" cmd := &cobra.Command{ - Use: "listAlerts", - Short: "Return All Alerts from One Project", + Use: use, + Short: "Return All Alerts from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -417,9 +423,11 @@ func (opts *listAlertsByAlertConfigurationIdOpts) postRun(_ context.Context, w i func listAlertsByAlertConfigurationIdBuilder() *cobra.Command { opts := listAlertsByAlertConfigurationIdOpts{} + const use = "listAlertsByAlertConfigurationId" cmd := &cobra.Command{ - Use: "listAlertsByAlertConfigurationId", - Short: "Return All Open Alerts for Alert Configuration", + Use: use, + Short: "Return All Open Alerts for Alert Configuration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_atlas_search_cmd.go b/internal/api/api_atlas_search_cmd.go index bacca7f176..6d5adfe1b0 100644 --- a/internal/api/api_atlas_search_cmd.go +++ b/internal/api/api_atlas_search_cmd.go @@ -134,9 +134,11 @@ func createAtlasSearchDeploymentBuilder() *cobra.Command { opts := createAtlasSearchDeploymentOpts{ fs: afero.NewOsFs(), } + const use = "createAtlasSearchDeployment" cmd := &cobra.Command{ - Use: "createAtlasSearchDeployment", - Short: "Create Search Nodes", + Use: use, + Short: "Create Search Nodes", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -258,9 +260,11 @@ func createAtlasSearchIndexBuilder() *cobra.Command { opts := createAtlasSearchIndexOpts{ fs: afero.NewOsFs(), } + const use = "createAtlasSearchIndex" cmd := &cobra.Command{ - Use: "createAtlasSearchIndex", - Short: "Create One Atlas Search Index", + Use: use, + Short: "Create One Atlas Search Index", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -325,9 +329,11 @@ func (opts *deleteAtlasSearchDeploymentOpts) postRun(_ context.Context, _ io.Wri func deleteAtlasSearchDeploymentBuilder() *cobra.Command { opts := deleteAtlasSearchDeploymentOpts{} + const use = "deleteAtlasSearchDeployment" cmd := &cobra.Command{ - Use: "deleteAtlasSearchDeployment", - Short: "Delete Search Nodes", + Use: use, + Short: "Delete Search Nodes", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -415,9 +421,11 @@ func (opts *deleteAtlasSearchIndexOpts) postRun(_ context.Context, w io.Writer) func deleteAtlasSearchIndexBuilder() *cobra.Command { opts := deleteAtlasSearchIndexOpts{} + const use = "deleteAtlasSearchIndex" cmd := &cobra.Command{ - Use: "deleteAtlasSearchIndex", - Short: "Remove One Atlas Search Index", + Use: use, + Short: "Remove One Atlas Search Index", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -506,9 +514,11 @@ func (opts *getAtlasSearchDeploymentOpts) postRun(_ context.Context, w io.Writer func getAtlasSearchDeploymentBuilder() *cobra.Command { opts := getAtlasSearchDeploymentOpts{} + const use = "getAtlasSearchDeployment" cmd := &cobra.Command{ - Use: "getAtlasSearchDeployment", - Short: "Return Search Nodes", + Use: use, + Short: "Return Search Nodes", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -597,9 +607,11 @@ func (opts *getAtlasSearchIndexOpts) postRun(_ context.Context, w io.Writer) err func getAtlasSearchIndexBuilder() *cobra.Command { opts := getAtlasSearchIndexOpts{} + const use = "getAtlasSearchIndex" cmd := &cobra.Command{ - Use: "getAtlasSearchIndex", - Short: "Return One Atlas Search Index", + Use: use, + Short: "Return One Atlas Search Index", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -692,9 +704,11 @@ func (opts *listAtlasSearchIndexesOpts) postRun(_ context.Context, w io.Writer) func listAtlasSearchIndexesBuilder() *cobra.Command { opts := listAtlasSearchIndexesOpts{} + const use = "listAtlasSearchIndexes" cmd := &cobra.Command{ - Use: "listAtlasSearchIndexes", - Short: "Return All Atlas Search Indexes for One Collection", + Use: use, + Short: "Return All Atlas Search Indexes for One Collection", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -818,9 +832,11 @@ func updateAtlasSearchDeploymentBuilder() *cobra.Command { opts := updateAtlasSearchDeploymentOpts{ fs: afero.NewOsFs(), } + const use = "updateAtlasSearchDeployment" cmd := &cobra.Command{ - Use: "updateAtlasSearchDeployment", - Short: "Update Search Nodes", + Use: use, + Short: "Update Search Nodes", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -944,9 +960,11 @@ func updateAtlasSearchIndexBuilder() *cobra.Command { opts := updateAtlasSearchIndexOpts{ fs: afero.NewOsFs(), } + const use = "updateAtlasSearchIndex" cmd := &cobra.Command{ - Use: "updateAtlasSearchIndex", - Short: "Update One Atlas Search Index", + Use: use, + Short: "Update One Atlas Search Index", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_auditing_cmd.go b/internal/api/api_auditing_cmd.go index 0a1ac28d5b..0f152a3b5e 100644 --- a/internal/api/api_auditing_cmd.go +++ b/internal/api/api_auditing_cmd.go @@ -99,9 +99,11 @@ func (opts *getAuditingConfigurationOpts) postRun(_ context.Context, w io.Writer func getAuditingConfigurationBuilder() *cobra.Command { opts := getAuditingConfigurationOpts{} + const use = "getAuditingConfiguration" cmd := &cobra.Command{ - Use: "getAuditingConfiguration", - Short: "Return the Auditing Configuration for One Project", + Use: use, + Short: "Return the Auditing Configuration for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -217,9 +219,11 @@ func updateAuditingConfigurationBuilder() *cobra.Command { opts := updateAuditingConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "updateAuditingConfiguration" cmd := &cobra.Command{ - Use: "updateAuditingConfiguration", - Short: "Update Auditing Configuration for One Project", + Use: use, + Short: "Update Auditing Configuration for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_aws_clusters_dns_cmd.go b/internal/api/api_aws_clusters_dns_cmd.go index 9c29201f50..253223c3e0 100644 --- a/internal/api/api_aws_clusters_dns_cmd.go +++ b/internal/api/api_aws_clusters_dns_cmd.go @@ -99,9 +99,11 @@ func (opts *getAWSCustomDNSOpts) postRun(_ context.Context, w io.Writer) error { func getAWSCustomDNSBuilder() *cobra.Command { opts := getAWSCustomDNSOpts{} + const use = "getAWSCustomDNS" cmd := &cobra.Command{ - Use: "getAWSCustomDNS", - Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", + Use: use, + Short: "Return One Custom DNS Configuration for Atlas Clusters on AWS", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -217,9 +219,11 @@ func toggleAWSCustomDNSBuilder() *cobra.Command { opts := toggleAWSCustomDNSOpts{ fs: afero.NewOsFs(), } + const use = "toggleAWSCustomDNS" cmd := &cobra.Command{ - Use: "toggleAWSCustomDNS", - Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", + Use: use, + Short: "Toggle State of One Custom DNS Configuration for Atlas Clusters on AWS", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_cloud_backups_cmd.go b/internal/api/api_cloud_backups_cmd.go index 7282d0462a..da42ff9fdb 100644 --- a/internal/api/api_cloud_backups_cmd.go +++ b/internal/api/api_cloud_backups_cmd.go @@ -103,9 +103,11 @@ func (opts *cancelBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) func cancelBackupRestoreJobBuilder() *cobra.Command { opts := cancelBackupRestoreJobOpts{} + const use = "cancelBackupRestoreJob" cmd := &cobra.Command{ - Use: "cancelBackupRestoreJob", - Short: "Cancel One Restore Job of One Cluster", + Use: use, + Short: "Cancel One Restore Job of One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -227,9 +229,11 @@ func createBackupExportJobBuilder() *cobra.Command { opts := createBackupExportJobOpts{ fs: afero.NewOsFs(), } + const use = "createBackupExportJob" cmd := &cobra.Command{ - Use: "createBackupExportJob", - Short: "Create One Cloud Backup Snapshot Export Job", + Use: use, + Short: "Create One Cloud Backup Snapshot Export Job", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -351,9 +355,11 @@ func createBackupRestoreJobBuilder() *cobra.Command { opts := createBackupRestoreJobOpts{ fs: afero.NewOsFs(), } + const use = "createBackupRestoreJob" cmd := &cobra.Command{ - Use: "createBackupRestoreJob", - Short: "Restore One Snapshot of One Cluster", + Use: use, + Short: "Restore One Snapshot of One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -473,9 +479,11 @@ func createExportBucketBuilder() *cobra.Command { opts := createExportBucketOpts{ fs: afero.NewOsFs(), } + const use = "createExportBucket" cmd := &cobra.Command{ - Use: "createExportBucket", - Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", + Use: use, + Short: "Grant Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -595,9 +603,11 @@ func createServerlessBackupRestoreJobBuilder() *cobra.Command { opts := createServerlessBackupRestoreJobOpts{ fs: afero.NewOsFs(), } + const use = "createServerlessBackupRestoreJob" cmd := &cobra.Command{ - Use: "createServerlessBackupRestoreJob", - Short: "Restore One Snapshot of One Serverless Instance", + Use: use, + Short: "Restore One Snapshot of One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -686,9 +696,11 @@ func (opts *deleteAllBackupSchedulesOpts) postRun(_ context.Context, w io.Writer func deleteAllBackupSchedulesBuilder() *cobra.Command { opts := deleteAllBackupSchedulesOpts{} + const use = "deleteAllBackupSchedules" cmd := &cobra.Command{ - Use: "deleteAllBackupSchedules", - Short: "Remove All Cloud Backup Schedules", + Use: use, + Short: "Remove All Cloud Backup Schedules", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -775,9 +787,11 @@ func (opts *deleteExportBucketOpts) postRun(_ context.Context, w io.Writer) erro func deleteExportBucketBuilder() *cobra.Command { opts := deleteExportBucketOpts{} + const use = "deleteExportBucket" cmd := &cobra.Command{ - Use: "deleteExportBucket", - Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", + Use: use, + Short: "Revoke Access to AWS S3 Bucket for Cloud Backup Snapshot Exports", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -866,9 +880,11 @@ func (opts *deleteReplicaSetBackupOpts) postRun(_ context.Context, w io.Writer) func deleteReplicaSetBackupBuilder() *cobra.Command { opts := deleteReplicaSetBackupOpts{} + const use = "deleteReplicaSetBackup" cmd := &cobra.Command{ - Use: "deleteReplicaSetBackup", - Short: "Remove One Replica Set Cloud Backup", + Use: use, + Short: "Remove One Replica Set Cloud Backup", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -959,9 +975,11 @@ func (opts *deleteShardedClusterBackupOpts) postRun(_ context.Context, w io.Writ func deleteShardedClusterBackupBuilder() *cobra.Command { opts := deleteShardedClusterBackupOpts{} + const use = "deleteShardedClusterBackup" cmd := &cobra.Command{ - Use: "deleteShardedClusterBackup", - Short: "Remove One Sharded Cluster Cloud Backup", + Use: use, + Short: "Remove One Sharded Cluster Cloud Backup", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1052,9 +1070,11 @@ func (opts *getBackupExportJobOpts) postRun(_ context.Context, w io.Writer) erro func getBackupExportJobBuilder() *cobra.Command { opts := getBackupExportJobOpts{} + const use = "getBackupExportJob" cmd := &cobra.Command{ - Use: "getBackupExportJob", - Short: "Return One Cloud Backup Snapshot Export Job", + Use: use, + Short: "Return One Cloud Backup Snapshot Export Job", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1145,9 +1165,11 @@ func (opts *getBackupRestoreJobOpts) postRun(_ context.Context, w io.Writer) err func getBackupRestoreJobBuilder() *cobra.Command { opts := getBackupRestoreJobOpts{} + const use = "getBackupRestoreJob" cmd := &cobra.Command{ - Use: "getBackupRestoreJob", - Short: "Return One Restore Job of One Cluster", + Use: use, + Short: "Return One Restore Job of One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1236,9 +1258,11 @@ func (opts *getBackupScheduleOpts) postRun(_ context.Context, w io.Writer) error func getBackupScheduleBuilder() *cobra.Command { opts := getBackupScheduleOpts{} + const use = "getBackupSchedule" cmd := &cobra.Command{ - Use: "getBackupSchedule", - Short: "Return One Cloud Backup Schedule", + Use: use, + Short: "Return One Cloud Backup Schedule", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1323,9 +1347,11 @@ func (opts *getDataProtectionSettingsOpts) postRun(_ context.Context, w io.Write func getDataProtectionSettingsBuilder() *cobra.Command { opts := getDataProtectionSettingsOpts{} + const use = "getDataProtectionSettings" cmd := &cobra.Command{ - Use: "getDataProtectionSettings", - Short: "Return the Backup Compliance Policy settings", + Use: use, + Short: "Return the Backup Compliance Policy settings", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1410,9 +1436,11 @@ func (opts *getExportBucketOpts) postRun(_ context.Context, w io.Writer) error { func getExportBucketBuilder() *cobra.Command { opts := getExportBucketOpts{} + const use = "getExportBucket" cmd := &cobra.Command{ - Use: "getExportBucket", - Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", + Use: use, + Short: "Return One AWS S3 Bucket Used for Cloud Backup Snapshot Exports", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1501,9 +1529,11 @@ func (opts *getReplicaSetBackupOpts) postRun(_ context.Context, w io.Writer) err func getReplicaSetBackupBuilder() *cobra.Command { opts := getReplicaSetBackupOpts{} + const use = "getReplicaSetBackup" cmd := &cobra.Command{ - Use: "getReplicaSetBackup", - Short: "Return One Replica Set Cloud Backup", + Use: use, + Short: "Return One Replica Set Cloud Backup", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1594,9 +1624,11 @@ func (opts *getServerlessBackupOpts) postRun(_ context.Context, w io.Writer) err func getServerlessBackupBuilder() *cobra.Command { opts := getServerlessBackupOpts{} + const use = "getServerlessBackup" cmd := &cobra.Command{ - Use: "getServerlessBackup", - Short: "Return One Snapshot of One Serverless Instance", + Use: use, + Short: "Return One Snapshot of One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1687,9 +1719,11 @@ func (opts *getServerlessBackupRestoreJobOpts) postRun(_ context.Context, w io.W func getServerlessBackupRestoreJobBuilder() *cobra.Command { opts := getServerlessBackupRestoreJobOpts{} + const use = "getServerlessBackupRestoreJob" cmd := &cobra.Command{ - Use: "getServerlessBackupRestoreJob", - Short: "Return One Restore Job for One Serverless Instance", + Use: use, + Short: "Return One Restore Job for One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1780,9 +1814,11 @@ func (opts *getShardedClusterBackupOpts) postRun(_ context.Context, w io.Writer) func getShardedClusterBackupBuilder() *cobra.Command { opts := getShardedClusterBackupOpts{} + const use = "getShardedClusterBackup" cmd := &cobra.Command{ - Use: "getShardedClusterBackup", - Short: "Return One Sharded Cluster Cloud Backup", + Use: use, + Short: "Return One Sharded Cluster Cloud Backup", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1877,9 +1913,11 @@ func (opts *listBackupExportJobsOpts) postRun(_ context.Context, w io.Writer) er func listBackupExportJobsBuilder() *cobra.Command { opts := listBackupExportJobsOpts{} + const use = "listBackupExportJobs" cmd := &cobra.Command{ - Use: "listBackupExportJobs", - Short: "Return All Cloud Backup Snapshot Export Jobs", + Use: use, + Short: "Return All Cloud Backup Snapshot Export Jobs", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1975,9 +2013,11 @@ func (opts *listBackupRestoreJobsOpts) postRun(_ context.Context, w io.Writer) e func listBackupRestoreJobsBuilder() *cobra.Command { opts := listBackupRestoreJobsOpts{} + const use = "listBackupRestoreJobs" cmd := &cobra.Command{ - Use: "listBackupRestoreJobs", - Short: "Return All Restore Jobs for One Cluster", + Use: use, + Short: "Return All Restore Jobs for One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2071,9 +2111,11 @@ func (opts *listExportBucketsOpts) postRun(_ context.Context, w io.Writer) error func listExportBucketsBuilder() *cobra.Command { opts := listExportBucketsOpts{} + const use = "listExportBuckets" cmd := &cobra.Command{ - Use: "listExportBuckets", - Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", + Use: use, + Short: "Return All AWS S3 Buckets Used for Cloud Backup Snapshot Exports", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2167,9 +2209,11 @@ func (opts *listReplicaSetBackupsOpts) postRun(_ context.Context, w io.Writer) e func listReplicaSetBackupsBuilder() *cobra.Command { opts := listReplicaSetBackupsOpts{} + const use = "listReplicaSetBackups" cmd := &cobra.Command{ - Use: "listReplicaSetBackups", - Short: "Return All Replica Set Cloud Backups", + Use: use, + Short: "Return All Replica Set Cloud Backups", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2265,9 +2309,11 @@ func (opts *listServerlessBackupRestoreJobsOpts) postRun(_ context.Context, w io func listServerlessBackupRestoreJobsBuilder() *cobra.Command { opts := listServerlessBackupRestoreJobsOpts{} + const use = "listServerlessBackupRestoreJobs" cmd := &cobra.Command{ - Use: "listServerlessBackupRestoreJobs", - Short: "Return All Restore Jobs for One Serverless Instance", + Use: use, + Short: "Return All Restore Jobs for One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2363,9 +2409,11 @@ func (opts *listServerlessBackupsOpts) postRun(_ context.Context, w io.Writer) e func listServerlessBackupsBuilder() *cobra.Command { opts := listServerlessBackupsOpts{} + const use = "listServerlessBackups" cmd := &cobra.Command{ - Use: "listServerlessBackups", - Short: "Return All Snapshots of One Serverless Instance", + Use: use, + Short: "Return All Snapshots of One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2455,9 +2503,11 @@ func (opts *listShardedClusterBackupsOpts) postRun(_ context.Context, w io.Write func listShardedClusterBackupsBuilder() *cobra.Command { opts := listShardedClusterBackupsOpts{} + const use = "listShardedClusterBackups" cmd := &cobra.Command{ - Use: "listShardedClusterBackups", - Short: "Return All Sharded Cluster Cloud Backups", + Use: use, + Short: "Return All Sharded Cluster Cloud Backups", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2577,9 +2627,11 @@ func takeSnapshotBuilder() *cobra.Command { opts := takeSnapshotOpts{ fs: afero.NewOsFs(), } + const use = "takeSnapshot" cmd := &cobra.Command{ - Use: "takeSnapshot", - Short: "Take One On-Demand Snapshot", + Use: use, + Short: "Take One On-Demand Snapshot", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2701,9 +2753,11 @@ func updateBackupScheduleBuilder() *cobra.Command { opts := updateBackupScheduleOpts{ fs: afero.NewOsFs(), } + const use = "updateBackupSchedule" cmd := &cobra.Command{ - Use: "updateBackupSchedule", - Short: "Update Cloud Backup Schedule for One Cluster", + Use: use, + Short: "Update Cloud Backup Schedule for One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2826,9 +2880,11 @@ func updateDataProtectionSettingsBuilder() *cobra.Command { opts := updateDataProtectionSettingsOpts{ fs: afero.NewOsFs(), } + const use = "updateDataProtectionSettings" cmd := &cobra.Command{ - Use: "updateDataProtectionSettings", - Short: "Update or enable the Backup Compliance Policy settings", + Use: use, + Short: "Update or enable the Backup Compliance Policy settings", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2951,9 +3007,11 @@ func updateSnapshotRetentionBuilder() *cobra.Command { opts := updateSnapshotRetentionOpts{ fs: afero.NewOsFs(), } + const use = "updateSnapshotRetention" cmd := &cobra.Command{ - Use: "updateSnapshotRetention", - Short: "Change Expiration Date for One Cloud Backup", + Use: use, + Short: "Change Expiration Date for One Cloud Backup", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_cloud_migration_service_cmd.go b/internal/api/api_cloud_migration_service_cmd.go index 27506484b1..8d49db9f72 100644 --- a/internal/api/api_cloud_migration_service_cmd.go +++ b/internal/api/api_cloud_migration_service_cmd.go @@ -132,9 +132,11 @@ func createLinkTokenBuilder() *cobra.Command { opts := createLinkTokenOpts{ fs: afero.NewOsFs(), } + const use = "createLinkToken" cmd := &cobra.Command{ - Use: "createLinkToken", - Short: "Create One Link-Token", + Use: use, + Short: "Create One Link-Token", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -252,9 +254,11 @@ func createPushMigrationBuilder() *cobra.Command { opts := createPushMigrationOpts{ fs: afero.NewOsFs(), } + const use = "createPushMigration" cmd := &cobra.Command{ - Use: "createPushMigration", - Short: "Migrate One Local Managed Cluster to MongoDB Atlas", + Use: use, + Short: "Migrate One Local Managed Cluster to MongoDB Atlas", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -317,9 +321,11 @@ func (opts *cutoverMigrationOpts) postRun(_ context.Context, _ io.Writer) error func cutoverMigrationBuilder() *cobra.Command { opts := cutoverMigrationOpts{} + const use = "cutoverMigration" cmd := &cobra.Command{ - Use: "cutoverMigration", - Short: "Cut Over the Migrated Cluster", + Use: use, + Short: "Cut Over the Migrated Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -403,9 +409,11 @@ func (opts *deleteLinkTokenOpts) postRun(_ context.Context, w io.Writer) error { func deleteLinkTokenBuilder() *cobra.Command { opts := deleteLinkTokenOpts{} + const use = "deleteLinkToken" cmd := &cobra.Command{ - Use: "deleteLinkToken", - Short: "Remove One Link-Token", + Use: use, + Short: "Remove One Link-Token", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -490,9 +498,11 @@ func (opts *getPushMigrationOpts) postRun(_ context.Context, w io.Writer) error func getPushMigrationBuilder() *cobra.Command { opts := getPushMigrationOpts{} + const use = "getPushMigration" cmd := &cobra.Command{ - Use: "getPushMigration", - Short: "Return One Migration Job", + Use: use, + Short: "Return One Migration Job", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -579,9 +589,11 @@ func (opts *getValidationStatusOpts) postRun(_ context.Context, w io.Writer) err func getValidationStatusBuilder() *cobra.Command { opts := getValidationStatusOpts{} + const use = "getValidationStatus" cmd := &cobra.Command{ - Use: "getValidationStatus", - Short: "Return One Migration Validation Job", + Use: use, + Short: "Return One Migration Validation Job", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -666,9 +678,11 @@ func (opts *listSourceProjectsOpts) postRun(_ context.Context, w io.Writer) erro func listSourceProjectsBuilder() *cobra.Command { opts := listSourceProjectsOpts{} + const use = "listSourceProjects" cmd := &cobra.Command{ - Use: "listSourceProjects", - Short: "Return All Projects Available for Migration", + Use: use, + Short: "Return All Projects Available for Migration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -784,9 +798,11 @@ func validateMigrationBuilder() *cobra.Command { opts := validateMigrationOpts{ fs: afero.NewOsFs(), } + const use = "validateMigration" cmd := &cobra.Command{ - Use: "validateMigration", - Short: "Validate One Migration Request", + Use: use, + Short: "Validate One Migration Request", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_cloud_provider_access_cmd.go b/internal/api/api_cloud_provider_access_cmd.go index 1e4378cb8b..4ea5812f52 100644 --- a/internal/api/api_cloud_provider_access_cmd.go +++ b/internal/api/api_cloud_provider_access_cmd.go @@ -134,9 +134,11 @@ func authorizeCloudProviderAccessRoleBuilder() *cobra.Command { opts := authorizeCloudProviderAccessRoleOpts{ fs: afero.NewOsFs(), } + const use = "authorizeCloudProviderAccessRole" cmd := &cobra.Command{ - Use: "authorizeCloudProviderAccessRole", - Short: "Authorize One Cloud Provider Access Role", + Use: use, + Short: "Authorize One Cloud Provider Access Role", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -256,9 +258,11 @@ func createCloudProviderAccessRoleBuilder() *cobra.Command { opts := createCloudProviderAccessRoleOpts{ fs: afero.NewOsFs(), } + const use = "createCloudProviderAccessRole" cmd := &cobra.Command{ - Use: "createCloudProviderAccessRole", - Short: "Create One Cloud Provider Access Role", + Use: use, + Short: "Create One Cloud Provider Access Role", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -323,9 +327,11 @@ func (opts *deauthorizeCloudProviderAccessRoleOpts) postRun(_ context.Context, _ func deauthorizeCloudProviderAccessRoleBuilder() *cobra.Command { opts := deauthorizeCloudProviderAccessRoleOpts{} + const use = "deauthorizeCloudProviderAccessRole" cmd := &cobra.Command{ - Use: "deauthorizeCloudProviderAccessRole", - Short: "Deauthorize One Cloud Provider Access Role", + Use: use, + Short: "Deauthorize One Cloud Provider Access Role", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -413,9 +419,11 @@ func (opts *getCloudProviderAccessRoleOpts) postRun(_ context.Context, w io.Writ func getCloudProviderAccessRoleBuilder() *cobra.Command { opts := getCloudProviderAccessRoleOpts{} + const use = "getCloudProviderAccessRole" cmd := &cobra.Command{ - Use: "getCloudProviderAccessRole", - Short: "Return specified Cloud Provider Access Role", + Use: use, + Short: "Return specified Cloud Provider Access Role", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -500,9 +508,11 @@ func (opts *listCloudProviderAccessRolesOpts) postRun(_ context.Context, w io.Wr func listCloudProviderAccessRolesBuilder() *cobra.Command { opts := listCloudProviderAccessRolesOpts{} + const use = "listCloudProviderAccessRoles" cmd := &cobra.Command{ - Use: "listCloudProviderAccessRoles", - Short: "Return All Cloud Provider Access Roles", + Use: use, + Short: "Return All Cloud Provider Access Roles", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_cluster_outage_simulation_cmd.go b/internal/api/api_cluster_outage_simulation_cmd.go index f921a8ab41..b2b4d88a8e 100644 --- a/internal/api/api_cluster_outage_simulation_cmd.go +++ b/internal/api/api_cluster_outage_simulation_cmd.go @@ -101,9 +101,11 @@ func (opts *endOutageSimulationOpts) postRun(_ context.Context, w io.Writer) err func endOutageSimulationBuilder() *cobra.Command { opts := endOutageSimulationOpts{} + const use = "endOutageSimulation" cmd := &cobra.Command{ - Use: "endOutageSimulation", - Short: "End an Outage Simulation", + Use: use, + Short: "End an Outage Simulation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -190,9 +192,11 @@ func (opts *getOutageSimulationOpts) postRun(_ context.Context, w io.Writer) err func getOutageSimulationBuilder() *cobra.Command { opts := getOutageSimulationOpts{} + const use = "getOutageSimulation" cmd := &cobra.Command{ - Use: "getOutageSimulation", - Short: "Return One Outage Simulation", + Use: use, + Short: "Return One Outage Simulation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -312,9 +316,11 @@ func startOutageSimulationBuilder() *cobra.Command { opts := startOutageSimulationOpts{ fs: afero.NewOsFs(), } + const use = "startOutageSimulation" cmd := &cobra.Command{ - Use: "startOutageSimulation", - Short: "Start an Outage Simulation", + Use: use, + Short: "Start an Outage Simulation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_clusters_cmd.go b/internal/api/api_clusters_cmd.go index 6f1c5b5ee6..ad5db249c5 100644 --- a/internal/api/api_clusters_cmd.go +++ b/internal/api/api_clusters_cmd.go @@ -175,9 +175,11 @@ func createClusterBuilder() *cobra.Command { opts := createClusterOpts{ fs: afero.NewOsFs(), } + const use = "createCluster" cmd := &cobra.Command{ - Use: "createCluster", - Short: "TEST DESCRIPTION", + Use: use, + Short: "TEST DESCRIPTION", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -244,9 +246,11 @@ func (opts *deleteClusterOpts) postRun(_ context.Context, _ io.Writer) error { func deleteClusterBuilder() *cobra.Command { opts := deleteClusterOpts{} + const use = "deleteCluster" cmd := &cobra.Command{ - Use: "deleteCluster", - Short: "Remove One Cluster from One Project", + Use: use, + Short: "Remove One Cluster from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -333,9 +337,11 @@ func (opts *getClusterOpts) postRun(_ context.Context, w io.Writer) error { func getClusterBuilder() *cobra.Command { opts := getClusterOpts{} + const use = "getCluster" cmd := &cobra.Command{ - Use: "getCluster", - Short: "Return One Cluster from One Project", + Use: use, + Short: "Return One Cluster from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -422,9 +428,11 @@ func (opts *getClusterAdvancedConfigurationOpts) postRun(_ context.Context, w io func getClusterAdvancedConfigurationBuilder() *cobra.Command { opts := getClusterAdvancedConfigurationOpts{} + const use = "getClusterAdvancedConfiguration" cmd := &cobra.Command{ - Use: "getClusterAdvancedConfiguration", - Short: "Return One Advanced Configuration Options for One Cluster", + Use: use, + Short: "Return One Advanced Configuration Options for One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -511,9 +519,11 @@ func (opts *getClusterStatusOpts) postRun(_ context.Context, w io.Writer) error func getClusterStatusBuilder() *cobra.Command { opts := getClusterStatusOpts{} + const use = "getClusterStatus" cmd := &cobra.Command{ - Use: "getClusterStatus", - Short: "Return Status of All Cluster Operations", + Use: use, + Short: "Return Status of All Cluster Operations", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -600,9 +610,11 @@ func (opts *getSampleDatasetLoadStatusOpts) postRun(_ context.Context, w io.Writ func getSampleDatasetLoadStatusBuilder() *cobra.Command { opts := getSampleDatasetLoadStatusOpts{} + const use = "getSampleDatasetLoadStatus" cmd := &cobra.Command{ - Use: "getSampleDatasetLoadStatus", - Short: "Check Status of Cluster Sample Dataset Request", + Use: use, + Short: "Check Status of Cluster Sample Dataset Request", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -697,9 +709,11 @@ func (opts *listCloudProviderRegionsOpts) postRun(_ context.Context, w io.Writer func listCloudProviderRegionsBuilder() *cobra.Command { opts := listCloudProviderRegionsOpts{} + const use = "listCloudProviderRegions" cmd := &cobra.Command{ - Use: "listCloudProviderRegions", - Short: "Return All Cloud Provider Regions", + Use: use, + Short: "Return All Cloud Provider Regions", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -795,9 +809,11 @@ func (opts *listClustersOpts) postRun(_ context.Context, w io.Writer) error { func listClustersBuilder() *cobra.Command { opts := listClustersOpts{} + const use = "listClusters" cmd := &cobra.Command{ - Use: "listClusters", - Short: "Return All Clusters in One Project", + Use: use, + Short: "Return All Clusters in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -877,9 +893,11 @@ func (opts *listClustersForAllProjectsOpts) postRun(_ context.Context, w io.Writ func listClustersForAllProjectsBuilder() *cobra.Command { opts := listClustersForAllProjectsOpts{} + const use = "listClustersForAllProjects" cmd := &cobra.Command{ - Use: "listClustersForAllProjects", - Short: "Return All Authorized Clusters in All Projects", + Use: use, + Short: "Return All Authorized Clusters in All Projects", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -966,9 +984,11 @@ func (opts *loadSampleDatasetOpts) postRun(_ context.Context, w io.Writer) error func loadSampleDatasetBuilder() *cobra.Command { opts := loadSampleDatasetOpts{} + const use = "loadSampleDataset" cmd := &cobra.Command{ - Use: "loadSampleDataset", - Short: "Load Sample Dataset Request into Cluster", + Use: use, + Short: "Load Sample Dataset Request into Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1031,9 +1051,11 @@ func (opts *testFailoverOpts) postRun(_ context.Context, _ io.Writer) error { func testFailoverBuilder() *cobra.Command { opts := testFailoverOpts{} + const use = "testFailover" cmd := &cobra.Command{ - Use: "testFailover", - Short: "Test Failover for One Cluster", + Use: use, + Short: "Test Failover for One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1152,9 +1174,11 @@ func updateClusterBuilder() *cobra.Command { opts := updateClusterOpts{ fs: afero.NewOsFs(), } + const use = "updateCluster" cmd := &cobra.Command{ - Use: "updateCluster", - Short: "Modify One Cluster from One Project", + Use: use, + Short: "Modify One Cluster from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1276,9 +1300,11 @@ func updateClusterAdvancedConfigurationBuilder() *cobra.Command { opts := updateClusterAdvancedConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "updateClusterAdvancedConfiguration" cmd := &cobra.Command{ - Use: "updateClusterAdvancedConfiguration", - Short: "Update Advanced Configuration Options for One Cluster", + Use: use, + Short: "Update Advanced Configuration Options for One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1398,9 +1424,11 @@ func upgradeSharedClusterBuilder() *cobra.Command { opts := upgradeSharedClusterOpts{ fs: afero.NewOsFs(), } + const use = "upgradeSharedCluster" cmd := &cobra.Command{ - Use: "upgradeSharedCluster", - Short: "Upgrade One Shared-tier Cluster", + Use: use, + Short: "Upgrade One Shared-tier Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1518,9 +1546,11 @@ func upgradeSharedClusterToServerlessBuilder() *cobra.Command { opts := upgradeSharedClusterToServerlessOpts{ fs: afero.NewOsFs(), } + const use = "upgradeSharedClusterToServerless" cmd := &cobra.Command{ - Use: "upgradeSharedClusterToServerless", - Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", + Use: use, + Short: "Upgrades One Shared-Tier Cluster to the Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_collection_level_metrics_cmd.go b/internal/api/api_collection_level_metrics_cmd.go index 919b167319..8105820be3 100644 --- a/internal/api/api_collection_level_metrics_cmd.go +++ b/internal/api/api_collection_level_metrics_cmd.go @@ -134,9 +134,11 @@ func (opts *getCollStatsLatencyNamespaceClusterMeasurementsOpts) postRun(_ conte func getCollStatsLatencyNamespaceClusterMeasurementsBuilder() *cobra.Command { opts := getCollStatsLatencyNamespaceClusterMeasurementsOpts{} + const use = "getCollStatsLatencyNamespaceClusterMeasurements" cmd := &cobra.Command{ - Use: "getCollStatsLatencyNamespaceClusterMeasurements", - Short: "Return Cluster-Level Query Latency", + Use: use, + Short: "Return Cluster-Level Query Latency", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -263,9 +265,11 @@ func (opts *getCollStatsLatencyNamespaceHostMeasurementsOpts) postRun(_ context. func getCollStatsLatencyNamespaceHostMeasurementsBuilder() *cobra.Command { opts := getCollStatsLatencyNamespaceHostMeasurementsOpts{} + const use = "getCollStatsLatencyNamespaceHostMeasurements" cmd := &cobra.Command{ - Use: "getCollStatsLatencyNamespaceHostMeasurements", - Short: "Return Host-Level Query Latency", + Use: use, + Short: "Return Host-Level Query Latency", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -358,9 +362,11 @@ func (opts *getCollStatsLatencyNamespaceMetricsOpts) postRun(_ context.Context, func getCollStatsLatencyNamespaceMetricsBuilder() *cobra.Command { opts := getCollStatsLatencyNamespaceMetricsOpts{} + const use = "getCollStatsLatencyNamespaceMetrics" cmd := &cobra.Command{ - Use: "getCollStatsLatencyNamespaceMetrics", - Short: "Return all metric names", + Use: use, + Short: "Return all metric names", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -471,9 +477,11 @@ func (opts *getCollStatsLatencyNamespacesForClusterOpts) postRun(_ context.Conte func getCollStatsLatencyNamespacesForClusterBuilder() *cobra.Command { opts := getCollStatsLatencyNamespacesForClusterOpts{} + const use = "getCollStatsLatencyNamespacesForCluster" cmd := &cobra.Command{ - Use: "getCollStatsLatencyNamespacesForCluster", - Short: "Return Ranked Namespaces from a Cluster", + Use: use, + Short: "Return Ranked Namespaces from a Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -589,9 +597,11 @@ func (opts *getCollStatsLatencyNamespacesForHostOpts) postRun(_ context.Context, func getCollStatsLatencyNamespacesForHostBuilder() *cobra.Command { opts := getCollStatsLatencyNamespacesForHostOpts{} + const use = "getCollStatsLatencyNamespacesForHost" cmd := &cobra.Command{ - Use: "getCollStatsLatencyNamespacesForHost", - Short: "Return Ranked Namespaces from a Host", + Use: use, + Short: "Return Ranked Namespaces from a Host", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -681,9 +691,11 @@ func (opts *getPinnedNamespacesOpts) postRun(_ context.Context, w io.Writer) err func getPinnedNamespacesBuilder() *cobra.Command { opts := getPinnedNamespacesOpts{} + const use = "getPinnedNamespaces" cmd := &cobra.Command{ - Use: "getPinnedNamespaces", - Short: "Return Pinned Namespaces", + Use: use, + Short: "Return Pinned Namespaces", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -803,9 +815,11 @@ func pinNamespacesPatchBuilder() *cobra.Command { opts := pinNamespacesPatchOpts{ fs: afero.NewOsFs(), } + const use = "pinNamespacesPatch" cmd := &cobra.Command{ - Use: "pinNamespacesPatch", - Short: "Add Pinned Namespaces", + Use: use, + Short: "Add Pinned Namespaces", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -927,9 +941,11 @@ func pinNamespacesPutBuilder() *cobra.Command { opts := pinNamespacesPutOpts{ fs: afero.NewOsFs(), } + const use = "pinNamespacesPut" cmd := &cobra.Command{ - Use: "pinNamespacesPut", - Short: "Pin Namespaces", + Use: use, + Short: "Pin Namespaces", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1051,9 +1067,11 @@ func unpinNamespacesBuilder() *cobra.Command { opts := unpinNamespacesOpts{ fs: afero.NewOsFs(), } + const use = "unpinNamespaces" cmd := &cobra.Command{ - Use: "unpinNamespaces", - Short: "Unpin namespaces", + Use: use, + Short: "Unpin namespaces", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_custom_database_roles_cmd.go b/internal/api/api_custom_database_roles_cmd.go index 2c37c36a32..6030353b59 100644 --- a/internal/api/api_custom_database_roles_cmd.go +++ b/internal/api/api_custom_database_roles_cmd.go @@ -132,9 +132,11 @@ func createCustomDatabaseRoleBuilder() *cobra.Command { opts := createCustomDatabaseRoleOpts{ fs: afero.NewOsFs(), } + const use = "createCustomDatabaseRole" cmd := &cobra.Command{ - Use: "createCustomDatabaseRole", - Short: "Create One Custom Role", + Use: use, + Short: "Create One Custom Role", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -197,9 +199,11 @@ func (opts *deleteCustomDatabaseRoleOpts) postRun(_ context.Context, _ io.Writer func deleteCustomDatabaseRoleBuilder() *cobra.Command { opts := deleteCustomDatabaseRoleOpts{} + const use = "deleteCustomDatabaseRole" cmd := &cobra.Command{ - Use: "deleteCustomDatabaseRole", - Short: "Remove One Custom Role from One Project", + Use: use, + Short: "Remove One Custom Role from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -285,9 +289,11 @@ func (opts *getCustomDatabaseRoleOpts) postRun(_ context.Context, w io.Writer) e func getCustomDatabaseRoleBuilder() *cobra.Command { opts := getCustomDatabaseRoleOpts{} + const use = "getCustomDatabaseRole" cmd := &cobra.Command{ - Use: "getCustomDatabaseRole", - Short: "Return One Custom Role in One Project", + Use: use, + Short: "Return One Custom Role in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -372,9 +378,11 @@ func (opts *listCustomDatabaseRolesOpts) postRun(_ context.Context, w io.Writer) func listCustomDatabaseRolesBuilder() *cobra.Command { opts := listCustomDatabaseRolesOpts{} + const use = "listCustomDatabaseRoles" cmd := &cobra.Command{ - Use: "listCustomDatabaseRoles", - Short: "Return All Custom Roles in One Project", + Use: use, + Short: "Return All Custom Roles in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -492,9 +500,11 @@ func updateCustomDatabaseRoleBuilder() *cobra.Command { opts := updateCustomDatabaseRoleOpts{ fs: afero.NewOsFs(), } + const use = "updateCustomDatabaseRole" cmd := &cobra.Command{ - Use: "updateCustomDatabaseRole", - Short: "Update One Custom Role in One Project", + Use: use, + Short: "Update One Custom Role in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_data_federation_cmd.go b/internal/api/api_data_federation_cmd.go index b1aed696a0..1db61250c3 100644 --- a/internal/api/api_data_federation_cmd.go +++ b/internal/api/api_data_federation_cmd.go @@ -132,9 +132,11 @@ func createDataFederationPrivateEndpointBuilder() *cobra.Command { opts := createDataFederationPrivateEndpointOpts{ fs: afero.NewOsFs(), } + const use = "createDataFederationPrivateEndpoint" cmd := &cobra.Command{ - Use: "createDataFederationPrivateEndpoint", - Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", + Use: use, + Short: "Create One Federated Database Instance and Online Archive Private Endpoint for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -255,9 +257,11 @@ func createFederatedDatabaseBuilder() *cobra.Command { opts := createFederatedDatabaseOpts{ fs: afero.NewOsFs(), } + const use = "createFederatedDatabase" cmd := &cobra.Command{ - Use: "createFederatedDatabase", - Short: "Create One Federated Database Instance in One Project", + Use: use, + Short: "Create One Federated Database Instance in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -380,9 +384,11 @@ func createOneDataFederationQueryLimitBuilder() *cobra.Command { opts := createOneDataFederationQueryLimitOpts{ fs: afero.NewOsFs(), } + const use = "createOneDataFederationQueryLimit" cmd := &cobra.Command{ - Use: "createOneDataFederationQueryLimit", - Short: "Configure One Query Limit for One Federated Database Instance", + Use: use, + Short: "Configure One Query Limit for One Federated Database Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -481,9 +487,11 @@ func (opts *deleteDataFederationPrivateEndpointOpts) postRun(_ context.Context, func deleteDataFederationPrivateEndpointBuilder() *cobra.Command { opts := deleteDataFederationPrivateEndpointOpts{} + const use = "deleteDataFederationPrivateEndpoint" cmd := &cobra.Command{ - Use: "deleteDataFederationPrivateEndpoint", - Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", + Use: use, + Short: "Remove One Federated Database Instance and Online Archive Private Endpoint from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -570,9 +578,11 @@ func (opts *deleteFederatedDatabaseOpts) postRun(_ context.Context, w io.Writer) func deleteFederatedDatabaseBuilder() *cobra.Command { opts := deleteFederatedDatabaseOpts{} + const use = "deleteFederatedDatabase" cmd := &cobra.Command{ - Use: "deleteFederatedDatabase", - Short: "Remove One Federated Database Instance from One Project", + Use: use, + Short: "Remove One Federated Database Instance from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -661,9 +671,11 @@ func (opts *deleteOneDataFederationInstanceQueryLimitOpts) postRun(_ context.Con func deleteOneDataFederationInstanceQueryLimitBuilder() *cobra.Command { opts := deleteOneDataFederationInstanceQueryLimitOpts{} + const use = "deleteOneDataFederationInstanceQueryLimit" cmd := &cobra.Command{ - Use: "deleteOneDataFederationInstanceQueryLimit", - Short: "Delete One Query Limit For One Federated Database Instance", + Use: use, + Short: "Delete One Query Limit For One Federated Database Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -764,9 +776,11 @@ func (opts *downloadFederatedDatabaseQueryLogsOpts) postRun(_ context.Context, w func downloadFederatedDatabaseQueryLogsBuilder() *cobra.Command { opts := downloadFederatedDatabaseQueryLogsOpts{} + const use = "downloadFederatedDatabaseQueryLogs" cmd := &cobra.Command{ - Use: "downloadFederatedDatabaseQueryLogs", - Short: "Download Query Logs for One Federated Database Instance", + Use: use, + Short: "Download Query Logs for One Federated Database Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -855,9 +869,11 @@ func (opts *getDataFederationPrivateEndpointOpts) postRun(_ context.Context, w i func getDataFederationPrivateEndpointBuilder() *cobra.Command { opts := getDataFederationPrivateEndpointOpts{} + const use = "getDataFederationPrivateEndpoint" cmd := &cobra.Command{ - Use: "getDataFederationPrivateEndpoint", - Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", + Use: use, + Short: "Return One Federated Database Instance and Online Archive Private Endpoint in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -944,9 +960,11 @@ func (opts *getFederatedDatabaseOpts) postRun(_ context.Context, w io.Writer) er func getFederatedDatabaseBuilder() *cobra.Command { opts := getFederatedDatabaseOpts{} + const use = "getFederatedDatabase" cmd := &cobra.Command{ - Use: "getFederatedDatabase", - Short: "Return One Federated Database Instance in One Project", + Use: use, + Short: "Return One Federated Database Instance in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1037,9 +1055,11 @@ func (opts *listDataFederationPrivateEndpointsOpts) postRun(_ context.Context, w func listDataFederationPrivateEndpointsBuilder() *cobra.Command { opts := listDataFederationPrivateEndpointsOpts{} + const use = "listDataFederationPrivateEndpoints" cmd := &cobra.Command{ - Use: "listDataFederationPrivateEndpoints", - Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", + Use: use, + Short: "Return All Federated Database Instance and Online Archive Private Endpoints in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1127,9 +1147,11 @@ func (opts *listFederatedDatabasesOpts) postRun(_ context.Context, w io.Writer) func listFederatedDatabasesBuilder() *cobra.Command { opts := listFederatedDatabasesOpts{} + const use = "listFederatedDatabases" cmd := &cobra.Command{ - Use: "listFederatedDatabases", - Short: "Return All Federated Database Instances in One Project", + Use: use, + Short: "Return All Federated Database Instances in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1217,9 +1239,11 @@ func (opts *returnFederatedDatabaseQueryLimitOpts) postRun(_ context.Context, w func returnFederatedDatabaseQueryLimitBuilder() *cobra.Command { opts := returnFederatedDatabaseQueryLimitOpts{} + const use = "returnFederatedDatabaseQueryLimit" cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimit", - Short: "Return One Federated Database Instance Query Limit for One Project", + Use: use, + Short: "Return One Federated Database Instance Query Limit for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1316,9 +1340,11 @@ func (opts *returnFederatedDatabaseQueryLimitsOpts) postRun(_ context.Context, w func returnFederatedDatabaseQueryLimitsBuilder() *cobra.Command { opts := returnFederatedDatabaseQueryLimitsOpts{} + const use = "returnFederatedDatabaseQueryLimits" cmd := &cobra.Command{ - Use: "returnFederatedDatabaseQueryLimits", - Short: "Return All Query Limits for One Federated Database Instance", + Use: use, + Short: "Return All Query Limits for One Federated Database Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1440,9 +1466,11 @@ func updateFederatedDatabaseBuilder() *cobra.Command { opts := updateFederatedDatabaseOpts{ fs: afero.NewOsFs(), } + const use = "updateFederatedDatabase" cmd := &cobra.Command{ - Use: "updateFederatedDatabase", - Short: "Update One Federated Database Instance in One Project", + Use: use, + Short: "Update One Federated Database Instance in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_data_lake_pipelines_cmd.go b/internal/api/api_data_lake_pipelines_cmd.go index 53de3fce0b..71d79fd13f 100644 --- a/internal/api/api_data_lake_pipelines_cmd.go +++ b/internal/api/api_data_lake_pipelines_cmd.go @@ -133,9 +133,11 @@ func createPipelineBuilder() *cobra.Command { opts := createPipelineOpts{ fs: afero.NewOsFs(), } + const use = "createPipeline" cmd := &cobra.Command{ - Use: "createPipeline", - Short: "Create One Data Lake Pipeline", + Use: use, + Short: "Create One Data Lake Pipeline", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -222,9 +224,11 @@ func (opts *deletePipelineOpts) postRun(_ context.Context, w io.Writer) error { func deletePipelineBuilder() *cobra.Command { opts := deletePipelineOpts{} + const use = "deletePipeline" cmd := &cobra.Command{ - Use: "deletePipeline", - Short: "Remove One Data Lake Pipeline", + Use: use, + Short: "Remove One Data Lake Pipeline", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -313,9 +317,11 @@ func (opts *deletePipelineRunDatasetOpts) postRun(_ context.Context, w io.Writer func deletePipelineRunDatasetBuilder() *cobra.Command { opts := deletePipelineRunDatasetOpts{} + const use = "deletePipelineRunDataset" cmd := &cobra.Command{ - Use: "deletePipelineRunDataset", - Short: "Delete Pipeline Run Dataset", + Use: use, + Short: "Delete Pipeline Run Dataset", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -404,9 +410,11 @@ func (opts *getPipelineOpts) postRun(_ context.Context, w io.Writer) error { func getPipelineBuilder() *cobra.Command { opts := getPipelineOpts{} + const use = "getPipeline" cmd := &cobra.Command{ - Use: "getPipeline", - Short: "Return One Data Lake Pipeline", + Use: use, + Short: "Return One Data Lake Pipeline", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -495,9 +503,11 @@ func (opts *getPipelineRunOpts) postRun(_ context.Context, w io.Writer) error { func getPipelineRunBuilder() *cobra.Command { opts := getPipelineRunOpts{} + const use = "getPipelineRun" cmd := &cobra.Command{ - Use: "getPipelineRun", - Short: "Return One Data Lake Pipeline Run", + Use: use, + Short: "Return One Data Lake Pipeline Run", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -603,9 +613,11 @@ func (opts *listPipelineRunsOpts) postRun(_ context.Context, w io.Writer) error func listPipelineRunsBuilder() *cobra.Command { opts := listPipelineRunsOpts{} + const use = "listPipelineRuns" cmd := &cobra.Command{ - Use: "listPipelineRuns", - Short: "Return All Data Lake Pipeline Runs from One Project", + Use: use, + Short: "Return All Data Lake Pipeline Runs from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -696,9 +708,11 @@ func (opts *listPipelineSchedulesOpts) postRun(_ context.Context, w io.Writer) e func listPipelineSchedulesBuilder() *cobra.Command { opts := listPipelineSchedulesOpts{} + const use = "listPipelineSchedules" cmd := &cobra.Command{ - Use: "listPipelineSchedules", - Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", + Use: use, + Short: "Return Available Ingestion Schedules for One Data Lake Pipeline", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -802,9 +816,11 @@ func (opts *listPipelineSnapshotsOpts) postRun(_ context.Context, w io.Writer) e func listPipelineSnapshotsBuilder() *cobra.Command { opts := listPipelineSnapshotsOpts{} + const use = "listPipelineSnapshots" cmd := &cobra.Command{ - Use: "listPipelineSnapshots", - Short: "Return Available Backup Snapshots for One Data Lake Pipeline", + Use: use, + Short: "Return Available Backup Snapshots for One Data Lake Pipeline", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -893,9 +909,11 @@ func (opts *listPipelinesOpts) postRun(_ context.Context, w io.Writer) error { func listPipelinesBuilder() *cobra.Command { opts := listPipelinesOpts{} + const use = "listPipelines" cmd := &cobra.Command{ - Use: "listPipelines", - Short: "Return All Data Lake Pipelines from One Project", + Use: use, + Short: "Return All Data Lake Pipelines from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -980,9 +998,11 @@ func (opts *pausePipelineOpts) postRun(_ context.Context, w io.Writer) error { func pausePipelineBuilder() *cobra.Command { opts := pausePipelineOpts{} + const use = "pausePipeline" cmd := &cobra.Command{ - Use: "pausePipeline", - Short: "Pause One Data Lake Pipeline", + Use: use, + Short: "Pause One Data Lake Pipeline", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1069,9 +1089,11 @@ func (opts *resumePipelineOpts) postRun(_ context.Context, w io.Writer) error { func resumePipelineBuilder() *cobra.Command { opts := resumePipelineOpts{} + const use = "resumePipeline" cmd := &cobra.Command{ - Use: "resumePipeline", - Short: "Resume One Data Lake Pipeline", + Use: use, + Short: "Resume One Data Lake Pipeline", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1191,9 +1213,11 @@ func triggerSnapshotIngestionBuilder() *cobra.Command { opts := triggerSnapshotIngestionOpts{ fs: afero.NewOsFs(), } + const use = "triggerSnapshotIngestion" cmd := &cobra.Command{ - Use: "triggerSnapshotIngestion", - Short: "Trigger on demand snapshot ingestion", + Use: use, + Short: "Trigger on demand snapshot ingestion", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1315,9 +1339,11 @@ func updatePipelineBuilder() *cobra.Command { opts := updatePipelineOpts{ fs: afero.NewOsFs(), } + const use = "updatePipeline" cmd := &cobra.Command{ - Use: "updatePipeline", - Short: "Update One Data Lake Pipeline", + Use: use, + Short: "Update One Data Lake Pipeline", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_database_users_cmd.go b/internal/api/api_database_users_cmd.go index 73d6c14d5b..da8344bf6b 100644 --- a/internal/api/api_database_users_cmd.go +++ b/internal/api/api_database_users_cmd.go @@ -132,9 +132,11 @@ func createDatabaseUserBuilder() *cobra.Command { opts := createDatabaseUserOpts{ fs: afero.NewOsFs(), } + const use = "createDatabaseUser" cmd := &cobra.Command{ - Use: "createDatabaseUser", - Short: "Create One Database User in One Project", + Use: use, + Short: "Create One Database User in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -223,9 +225,11 @@ func (opts *deleteDatabaseUserOpts) postRun(_ context.Context, w io.Writer) erro func deleteDatabaseUserBuilder() *cobra.Command { opts := deleteDatabaseUserOpts{} + const use = "deleteDatabaseUser" cmd := &cobra.Command{ - Use: "deleteDatabaseUser", - Short: "Remove One Database User from One Project", + Use: use, + Short: "Remove One Database User from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -328,9 +332,11 @@ func (opts *getDatabaseUserOpts) postRun(_ context.Context, w io.Writer) error { func getDatabaseUserBuilder() *cobra.Command { opts := getDatabaseUserOpts{} + const use = "getDatabaseUser" cmd := &cobra.Command{ - Use: "getDatabaseUser", - Short: "Return One Database User from One Project", + Use: use, + Short: "Return One Database User from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -435,9 +441,11 @@ func (opts *listDatabaseUsersOpts) postRun(_ context.Context, w io.Writer) error func listDatabaseUsersBuilder() *cobra.Command { opts := listDatabaseUsersOpts{} + const use = "listDatabaseUsers" cmd := &cobra.Command{ - Use: "listDatabaseUsers", - Short: "Return All Database Users from One Project", + Use: use, + Short: "Return All Database Users from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -560,9 +568,11 @@ func updateDatabaseUserBuilder() *cobra.Command { opts := updateDatabaseUserOpts{ fs: afero.NewOsFs(), } + const use = "updateDatabaseUser" cmd := &cobra.Command{ - Use: "updateDatabaseUser", - Short: "Update One Database User in One Project", + Use: use, + Short: "Update One Database User in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go index dda75d68ae..6f5dbc86e5 100644 --- a/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go +++ b/internal/api/api_encryption_at_rest_using_customer_key_management_cmd.go @@ -99,9 +99,11 @@ func (opts *getEncryptionAtRestOpts) postRun(_ context.Context, w io.Writer) err func getEncryptionAtRestBuilder() *cobra.Command { opts := getEncryptionAtRestOpts{} + const use = "getEncryptionAtRest" cmd := &cobra.Command{ - Use: "getEncryptionAtRest", - Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", + Use: use, + Short: "Return One Configuration for Encryption at Rest using Customer-Managed Keys for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -217,9 +219,11 @@ func updateEncryptionAtRestBuilder() *cobra.Command { opts := updateEncryptionAtRestOpts{ fs: afero.NewOsFs(), } + const use = "updateEncryptionAtRest" cmd := &cobra.Command{ - Use: "updateEncryptionAtRest", - Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", + Use: use, + Short: "Update Configuration for Encryption at Rest using Customer-Managed Keys for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_events_cmd.go b/internal/api/api_events_cmd.go index 0db64844ed..a62442cccb 100644 --- a/internal/api/api_events_cmd.go +++ b/internal/api/api_events_cmd.go @@ -103,9 +103,11 @@ func (opts *getOrganizationEventOpts) postRun(_ context.Context, w io.Writer) er func getOrganizationEventBuilder() *cobra.Command { opts := getOrganizationEventOpts{} + const use = "getOrganizationEvent" cmd := &cobra.Command{ - Use: "getOrganizationEvent", - Short: "Return One Event from One Organization", + Use: use, + Short: "Return One Event from One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -195,9 +197,11 @@ func (opts *getProjectEventOpts) postRun(_ context.Context, w io.Writer) error { func getProjectEventBuilder() *cobra.Command { opts := getProjectEventOpts{} + const use = "getProjectEvent" cmd := &cobra.Command{ - Use: "getProjectEvent", - Short: "Return One Event from One Project", + Use: use, + Short: "Return One Event from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -315,9 +319,11 @@ func (opts *listOrganizationEventsOpts) postRun(_ context.Context, w io.Writer) func listOrganizationEventsBuilder() *cobra.Command { opts := listOrganizationEventsOpts{} + const use = "listOrganizationEvents" cmd := &cobra.Command{ - Use: "listOrganizationEvents", - Short: "Return All Events from One Organization", + Use: use, + Short: "Return All Events from One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -445,9 +451,11 @@ func (opts *listProjectEventsOpts) postRun(_ context.Context, w io.Writer) error func listProjectEventsBuilder() *cobra.Command { opts := listProjectEventsOpts{} + const use = "listProjectEvents" cmd := &cobra.Command{ - Use: "listProjectEvents", - Short: "Return All Events from One Project", + Use: use, + Short: "Return All Events from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_federated_authentication_cmd.go b/internal/api/api_federated_authentication_cmd.go index dc96146d6a..edc7706230 100644 --- a/internal/api/api_federated_authentication_cmd.go +++ b/internal/api/api_federated_authentication_cmd.go @@ -121,9 +121,11 @@ func createIdentityProviderBuilder() *cobra.Command { opts := createIdentityProviderOpts{ fs: afero.NewOsFs(), } + const use = "createIdentityProvider" cmd := &cobra.Command{ - Use: "createIdentityProvider", - Short: "Create one identity provider", + Use: use, + Short: "Create one identity provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -244,9 +246,11 @@ func createRoleMappingBuilder() *cobra.Command { opts := createRoleMappingOpts{ fs: afero.NewOsFs(), } + const use = "createRoleMapping" cmd := &cobra.Command{ - Use: "createRoleMapping", - Short: "Add One Role Mapping to One Organization", + Use: use, + Short: "Add One Role Mapping to One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -298,9 +302,11 @@ func (opts *deleteFederationAppOpts) postRun(_ context.Context, _ io.Writer) err func deleteFederationAppBuilder() *cobra.Command { opts := deleteFederationAppOpts{} + const use = "deleteFederationApp" cmd := &cobra.Command{ - Use: "deleteFederationApp", - Short: "Delete the federation settings instance.", + Use: use, + Short: "Delete the federation settings instance.", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -350,9 +356,11 @@ func (opts *deleteIdentityProviderOpts) postRun(_ context.Context, _ io.Writer) func deleteIdentityProviderBuilder() *cobra.Command { opts := deleteIdentityProviderOpts{} + const use = "deleteIdentityProvider" cmd := &cobra.Command{ - Use: "deleteIdentityProvider", - Short: "Delete the identity provider.", + Use: use, + Short: "Delete the identity provider.", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -417,9 +425,11 @@ func (opts *deleteRoleMappingOpts) postRun(_ context.Context, _ io.Writer) error func deleteRoleMappingBuilder() *cobra.Command { opts := deleteRoleMappingOpts{} + const use = "deleteRoleMapping" cmd := &cobra.Command{ - Use: "deleteRoleMapping", - Short: "Remove One Role Mapping from One Organization", + Use: use, + Short: "Remove One Role Mapping from One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -496,9 +506,11 @@ func (opts *getConnectedOrgConfigOpts) postRun(_ context.Context, w io.Writer) e func getConnectedOrgConfigBuilder() *cobra.Command { opts := getConnectedOrgConfigOpts{} + const use = "getConnectedOrgConfig" cmd := &cobra.Command{ - Use: "getConnectedOrgConfig", - Short: "Return One Org Config Connected to One Federation", + Use: use, + Short: "Return One Org Config Connected to One Federation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -584,9 +596,11 @@ func (opts *getFederationSettingsOpts) postRun(_ context.Context, w io.Writer) e func getFederationSettingsBuilder() *cobra.Command { opts := getFederationSettingsOpts{} + const use = "getFederationSettings" cmd := &cobra.Command{ - Use: "getFederationSettings", - Short: "Return Federation Settings for One Organization", + Use: use, + Short: "Return Federation Settings for One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -660,9 +674,11 @@ func (opts *getIdentityProviderOpts) postRun(_ context.Context, w io.Writer) err func getIdentityProviderBuilder() *cobra.Command { opts := getIdentityProviderOpts{} + const use = "getIdentityProvider" cmd := &cobra.Command{ - Use: "getIdentityProvider", - Short: "Return one identity provider from the specified federation by id.", + Use: use, + Short: "Return one identity provider from the specified federation by id.", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -739,9 +755,11 @@ func (opts *getIdentityProviderMetadataOpts) postRun(_ context.Context, w io.Wri func getIdentityProviderMetadataBuilder() *cobra.Command { opts := getIdentityProviderMetadataOpts{} + const use = "getIdentityProviderMetadata" cmd := &cobra.Command{ - Use: "getIdentityProviderMetadata", - Short: "Return the metadata of one identity provider in the specified federation.", + Use: use, + Short: "Return the metadata of one identity provider in the specified federation.", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -831,9 +849,11 @@ func (opts *getRoleMappingOpts) postRun(_ context.Context, w io.Writer) error { func getRoleMappingBuilder() *cobra.Command { opts := getRoleMappingOpts{} + const use = "getRoleMapping" cmd := &cobra.Command{ - Use: "getRoleMapping", - Short: "Return One Role Mapping from One Organization", + Use: use, + Short: "Return One Role Mapping from One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -909,9 +929,11 @@ func (opts *listConnectedOrgConfigsOpts) postRun(_ context.Context, w io.Writer) func listConnectedOrgConfigsBuilder() *cobra.Command { opts := listConnectedOrgConfigsOpts{} + const use = "listConnectedOrgConfigs" cmd := &cobra.Command{ - Use: "listConnectedOrgConfigs", - Short: "Return All Connected Org Configs from the Federation", + Use: use, + Short: "Return All Connected Org Configs from the Federation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -992,9 +1014,11 @@ func (opts *listIdentityProvidersOpts) postRun(_ context.Context, w io.Writer) e func listIdentityProvidersBuilder() *cobra.Command { opts := listIdentityProvidersOpts{} + const use = "listIdentityProviders" cmd := &cobra.Command{ - Use: "listIdentityProviders", - Short: "Return all identity providers from the specified federation.", + Use: use, + Short: "Return all identity providers from the specified federation.", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1084,9 +1108,11 @@ func (opts *listRoleMappingsOpts) postRun(_ context.Context, w io.Writer) error func listRoleMappingsBuilder() *cobra.Command { opts := listRoleMappingsOpts{} + const use = "listRoleMappings" cmd := &cobra.Command{ - Use: "listRoleMappings", - Short: "Return All Role Mappings from One Organization", + Use: use, + Short: "Return All Role Mappings from One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1162,9 +1188,11 @@ func (opts *removeConnectedOrgConfigOpts) postRun(_ context.Context, w io.Writer func removeConnectedOrgConfigBuilder() *cobra.Command { opts := removeConnectedOrgConfigOpts{} + const use = "removeConnectedOrgConfig" cmd := &cobra.Command{ - Use: "removeConnectedOrgConfig", - Short: "Remove One Org Config Connected to One Federation", + Use: use, + Short: "Remove One Org Config Connected to One Federation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1217,9 +1245,11 @@ func (opts *revokeJwksFromIdentityProviderOpts) postRun(_ context.Context, _ io. func revokeJwksFromIdentityProviderBuilder() *cobra.Command { opts := revokeJwksFromIdentityProviderOpts{} + const use = "revokeJwksFromIdentityProvider" cmd := &cobra.Command{ - Use: "revokeJwksFromIdentityProvider", - Short: "Revoke the JWKS tokens from an OIDC identity provider.", + Use: use, + Short: "Revoke the JWKS tokens from an OIDC identity provider.", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1328,9 +1358,11 @@ func updateConnectedOrgConfigBuilder() *cobra.Command { opts := updateConnectedOrgConfigOpts{ fs: afero.NewOsFs(), } + const use = "updateConnectedOrgConfig" cmd := &cobra.Command{ - Use: "updateConnectedOrgConfig", - Short: "Update One Org Config Connected to One Federation", + Use: use, + Short: "Update One Org Config Connected to One Federation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1442,9 +1474,11 @@ func updateIdentityProviderBuilder() *cobra.Command { opts := updateIdentityProviderOpts{ fs: afero.NewOsFs(), } + const use = "updateIdentityProvider" cmd := &cobra.Command{ - Use: "updateIdentityProvider", - Short: "Update the identity provider.", + Use: use, + Short: "Update the identity provider.", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1569,9 +1603,11 @@ func updateRoleMappingBuilder() *cobra.Command { opts := updateRoleMappingOpts{ fs: afero.NewOsFs(), } + const use = "updateRoleMapping" cmd := &cobra.Command{ - Use: "updateRoleMapping", - Short: "Update One Role Mapping in One Organization", + Use: use, + Short: "Update One Role Mapping in One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_global_clusters_cmd.go b/internal/api/api_global_clusters_cmd.go index 1d20306627..5fde67e5a5 100644 --- a/internal/api/api_global_clusters_cmd.go +++ b/internal/api/api_global_clusters_cmd.go @@ -134,9 +134,11 @@ func createCustomZoneMappingBuilder() *cobra.Command { opts := createCustomZoneMappingOpts{ fs: afero.NewOsFs(), } + const use = "createCustomZoneMapping" cmd := &cobra.Command{ - Use: "createCustomZoneMapping", - Short: "Add One Entry to One Custom Zone Mapping", + Use: use, + Short: "Add One Entry to One Custom Zone Mapping", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -258,9 +260,11 @@ func createManagedNamespaceBuilder() *cobra.Command { opts := createManagedNamespaceOpts{ fs: afero.NewOsFs(), } + const use = "createManagedNamespace" cmd := &cobra.Command{ - Use: "createManagedNamespace", - Short: "Create One Managed Namespace in One Global Cluster", + Use: use, + Short: "Create One Managed Namespace in One Global Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -349,9 +353,11 @@ func (opts *deleteAllCustomZoneMappingsOpts) postRun(_ context.Context, w io.Wri func deleteAllCustomZoneMappingsBuilder() *cobra.Command { opts := deleteAllCustomZoneMappingsOpts{} + const use = "deleteAllCustomZoneMappings" cmd := &cobra.Command{ - Use: "deleteAllCustomZoneMappings", - Short: "Remove All Custom Zone Mappings from One Global Cluster", + Use: use, + Short: "Remove All Custom Zone Mappings from One Global Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -442,9 +448,11 @@ func (opts *deleteManagedNamespaceOpts) postRun(_ context.Context, w io.Writer) func deleteManagedNamespaceBuilder() *cobra.Command { opts := deleteManagedNamespaceOpts{} + const use = "deleteManagedNamespace" cmd := &cobra.Command{ - Use: "deleteManagedNamespace", - Short: "Remove One Managed Namespace from One Global Cluster", + Use: use, + Short: "Remove One Managed Namespace from One Global Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -533,9 +541,11 @@ func (opts *getManagedNamespaceOpts) postRun(_ context.Context, w io.Writer) err func getManagedNamespaceBuilder() *cobra.Command { opts := getManagedNamespaceOpts{} + const use = "getManagedNamespace" cmd := &cobra.Command{ - Use: "getManagedNamespace", - Short: "Return One Managed Namespace in One Global Cluster", + Use: use, + Short: "Return One Managed Namespace in One Global Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_invoices_cmd.go b/internal/api/api_invoices_cmd.go index e08db945f0..796a4df6ba 100644 --- a/internal/api/api_invoices_cmd.go +++ b/internal/api/api_invoices_cmd.go @@ -132,9 +132,11 @@ func createCostExplorerQueryProcessBuilder() *cobra.Command { opts := createCostExplorerQueryProcessOpts{ fs: afero.NewOsFs(), } + const use = "createCostExplorerQueryProcess" cmd := &cobra.Command{ - Use: "createCostExplorerQueryProcess", - Short: "Create Cost Explorer query process", + Use: use, + Short: "Create Cost Explorer query process", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -221,9 +223,11 @@ func (opts *createCostExplorerQueryProcess1Opts) postRun(_ context.Context, w io func createCostExplorerQueryProcess1Builder() *cobra.Command { opts := createCostExplorerQueryProcess1Opts{} + const use = "createCostExplorerQueryProcess1" cmd := &cobra.Command{ - Use: "createCostExplorerQueryProcess1", - Short: "Return results from a given Cost Explorer query, or notify that the results are not ready yet.", + Use: use, + Short: "Return results from a given Cost Explorer query, or notify that the results are not ready yet.", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -310,9 +314,11 @@ func (opts *downloadInvoiceCSVOpts) postRun(_ context.Context, w io.Writer) erro func downloadInvoiceCSVBuilder() *cobra.Command { opts := downloadInvoiceCSVOpts{} + const use = "downloadInvoiceCSV" cmd := &cobra.Command{ - Use: "downloadInvoiceCSV", - Short: "Return One Organization Invoice as CSV", + Use: use, + Short: "Return One Organization Invoice as CSV", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -399,9 +405,11 @@ func (opts *getInvoiceOpts) postRun(_ context.Context, w io.Writer) error { func getInvoiceBuilder() *cobra.Command { opts := getInvoiceOpts{} + const use = "getInvoice" cmd := &cobra.Command{ - Use: "getInvoice", - Short: "Return One Organization Invoice", + Use: use, + Short: "Return One Organization Invoice", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -492,9 +500,11 @@ func (opts *listInvoicesOpts) postRun(_ context.Context, w io.Writer) error { func listInvoicesBuilder() *cobra.Command { opts := listInvoicesOpts{} + const use = "listInvoices" cmd := &cobra.Command{ - Use: "listInvoices", - Short: "Return All Invoices for One Organization", + Use: use, + Short: "Return All Invoices for One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -580,9 +590,11 @@ func (opts *listPendingInvoicesOpts) postRun(_ context.Context, w io.Writer) err func listPendingInvoicesBuilder() *cobra.Command { opts := listPendingInvoicesOpts{} + const use = "listPendingInvoices" cmd := &cobra.Command{ - Use: "listPendingInvoices", - Short: "Return All Pending Invoices for One Organization", + Use: use, + Short: "Return All Pending Invoices for One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_ldap_configuration_cmd.go b/internal/api/api_ldap_configuration_cmd.go index a2a3e3ac40..08091b4847 100644 --- a/internal/api/api_ldap_configuration_cmd.go +++ b/internal/api/api_ldap_configuration_cmd.go @@ -99,9 +99,11 @@ func (opts *deleteLDAPConfigurationOpts) postRun(_ context.Context, w io.Writer) func deleteLDAPConfigurationBuilder() *cobra.Command { opts := deleteLDAPConfigurationOpts{} + const use = "deleteLDAPConfiguration" cmd := &cobra.Command{ - Use: "deleteLDAPConfiguration", - Short: "Remove the Current LDAP User to DN Mapping", + Use: use, + Short: "Remove the Current LDAP User to DN Mapping", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -184,9 +186,11 @@ func (opts *getLDAPConfigurationOpts) postRun(_ context.Context, w io.Writer) er func getLDAPConfigurationBuilder() *cobra.Command { opts := getLDAPConfigurationOpts{} + const use = "getLDAPConfiguration" cmd := &cobra.Command{ - Use: "getLDAPConfiguration", - Short: "Return the Current LDAP or X.509 Configuration", + Use: use, + Short: "Return the Current LDAP or X.509 Configuration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -271,9 +275,11 @@ func (opts *getLDAPConfigurationStatusOpts) postRun(_ context.Context, w io.Writ func getLDAPConfigurationStatusBuilder() *cobra.Command { opts := getLDAPConfigurationStatusOpts{} + const use = "getLDAPConfigurationStatus" cmd := &cobra.Command{ - Use: "getLDAPConfigurationStatus", - Short: "Return the Status of One Verify LDAP Configuration Request", + Use: use, + Short: "Return the Status of One Verify LDAP Configuration Request", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -391,9 +397,11 @@ func saveLDAPConfigurationBuilder() *cobra.Command { opts := saveLDAPConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "saveLDAPConfiguration" cmd := &cobra.Command{ - Use: "saveLDAPConfiguration", - Short: "Edit the LDAP or X.509 Configuration", + Use: use, + Short: "Edit the LDAP or X.509 Configuration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -511,9 +519,11 @@ func verifyLDAPConfigurationBuilder() *cobra.Command { opts := verifyLDAPConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "verifyLDAPConfiguration" cmd := &cobra.Command{ - Use: "verifyLDAPConfiguration", - Short: "Verify the LDAP Configuration in One Project", + Use: use, + Short: "Verify the LDAP Configuration in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_legacy_backup_cmd.go b/internal/api/api_legacy_backup_cmd.go index 5d5820aaec..7398a117b3 100644 --- a/internal/api/api_legacy_backup_cmd.go +++ b/internal/api/api_legacy_backup_cmd.go @@ -134,9 +134,11 @@ func createLegacyBackupRestoreJobBuilder() *cobra.Command { opts := createLegacyBackupRestoreJobOpts{ fs: afero.NewOsFs(), } + const use = "createLegacyBackupRestoreJob" cmd := &cobra.Command{ - Use: "createLegacyBackupRestoreJob", - Short: "Create One Legacy Backup Restore Job", + Use: use, + Short: "Create One Legacy Backup Restore Job", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -227,9 +229,11 @@ func (opts *deleteLegacySnapshotOpts) postRun(_ context.Context, w io.Writer) er func deleteLegacySnapshotBuilder() *cobra.Command { opts := deleteLegacySnapshotOpts{} + const use = "deleteLegacySnapshot" cmd := &cobra.Command{ - Use: "deleteLegacySnapshot", - Short: "Remove One Legacy Backup Snapshot", + Use: use, + Short: "Remove One Legacy Backup Snapshot", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -320,9 +324,11 @@ func (opts *getLegacyBackupCheckpointOpts) postRun(_ context.Context, w io.Write func getLegacyBackupCheckpointBuilder() *cobra.Command { opts := getLegacyBackupCheckpointOpts{} + const use = "getLegacyBackupCheckpoint" cmd := &cobra.Command{ - Use: "getLegacyBackupCheckpoint", - Short: "Return One Legacy Backup Checkpoint", + Use: use, + Short: "Return One Legacy Backup Checkpoint", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -413,9 +419,11 @@ func (opts *getLegacyBackupRestoreJobOpts) postRun(_ context.Context, w io.Write func getLegacyBackupRestoreJobBuilder() *cobra.Command { opts := getLegacyBackupRestoreJobOpts{} + const use = "getLegacyBackupRestoreJob" cmd := &cobra.Command{ - Use: "getLegacyBackupRestoreJob", - Short: "Return One Legacy Backup Restore Job", + Use: use, + Short: "Return One Legacy Backup Restore Job", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -506,9 +514,11 @@ func (opts *getLegacySnapshotOpts) postRun(_ context.Context, w io.Writer) error func getLegacySnapshotBuilder() *cobra.Command { opts := getLegacySnapshotOpts{} + const use = "getLegacySnapshot" cmd := &cobra.Command{ - Use: "getLegacySnapshot", - Short: "Return One Legacy Backup Snapshot", + Use: use, + Short: "Return One Legacy Backup Snapshot", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -597,9 +607,11 @@ func (opts *getLegacySnapshotScheduleOpts) postRun(_ context.Context, w io.Write func getLegacySnapshotScheduleBuilder() *cobra.Command { opts := getLegacySnapshotScheduleOpts{} + const use = "getLegacySnapshotSchedule" cmd := &cobra.Command{ - Use: "getLegacySnapshotSchedule", - Short: "Return One Snapshot Schedule", + Use: use, + Short: "Return One Snapshot Schedule", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -692,9 +704,11 @@ func (opts *listLegacyBackupCheckpointsOpts) postRun(_ context.Context, w io.Wri func listLegacyBackupCheckpointsBuilder() *cobra.Command { opts := listLegacyBackupCheckpointsOpts{} + const use = "listLegacyBackupCheckpoints" cmd := &cobra.Command{ - Use: "listLegacyBackupCheckpoints", - Short: "Return All Legacy Backup Checkpoints", + Use: use, + Short: "Return All Legacy Backup Checkpoints", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -792,9 +806,11 @@ func (opts *listLegacyBackupRestoreJobsOpts) postRun(_ context.Context, w io.Wri func listLegacyBackupRestoreJobsBuilder() *cobra.Command { opts := listLegacyBackupRestoreJobsOpts{} + const use = "listLegacyBackupRestoreJobs" cmd := &cobra.Command{ - Use: "listLegacyBackupRestoreJobs", - Short: "Return All Legacy Backup Restore Jobs", + Use: use, + Short: "Return All Legacy Backup Restore Jobs", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -893,9 +909,11 @@ func (opts *listLegacySnapshotsOpts) postRun(_ context.Context, w io.Writer) err func listLegacySnapshotsBuilder() *cobra.Command { opts := listLegacySnapshotsOpts{} + const use = "listLegacySnapshots" cmd := &cobra.Command{ - Use: "listLegacySnapshots", - Short: "Return All Legacy Backup Snapshots", + Use: use, + Short: "Return All Legacy Backup Snapshots", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1021,9 +1039,11 @@ func updateLegacySnapshotRetentionBuilder() *cobra.Command { opts := updateLegacySnapshotRetentionOpts{ fs: afero.NewOsFs(), } + const use = "updateLegacySnapshotRetention" cmd := &cobra.Command{ - Use: "updateLegacySnapshotRetention", - Short: "Change One Legacy Backup Snapshot Expiration", + Use: use, + Short: "Change One Legacy Backup Snapshot Expiration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1147,9 +1167,11 @@ func updateLegacySnapshotScheduleBuilder() *cobra.Command { opts := updateLegacySnapshotScheduleOpts{ fs: afero.NewOsFs(), } + const use = "updateLegacySnapshotSchedule" cmd := &cobra.Command{ - Use: "updateLegacySnapshotSchedule", - Short: "Update Snapshot Schedule for One Cluster", + Use: use, + Short: "Update Snapshot Schedule for One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_maintenance_windows__cmd.go b/internal/api/api_maintenance_windows__cmd.go index 8572d94402..401d30f8d4 100644 --- a/internal/api/api_maintenance_windows__cmd.go +++ b/internal/api/api_maintenance_windows__cmd.go @@ -75,9 +75,11 @@ func (opts *deferMaintenanceWindowOpts) postRun(_ context.Context, _ io.Writer) func deferMaintenanceWindowBuilder() *cobra.Command { opts := deferMaintenanceWindowOpts{} + const use = "deferMaintenanceWindow" cmd := &cobra.Command{ - Use: "deferMaintenanceWindow", - Short: "Defer One Maintenance Window for One Project", + Use: use, + Short: "Defer One Maintenance Window for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -159,9 +161,11 @@ func (opts *getMaintenanceWindowOpts) postRun(_ context.Context, w io.Writer) er func getMaintenanceWindowBuilder() *cobra.Command { opts := getMaintenanceWindowOpts{} + const use = "getMaintenanceWindow" cmd := &cobra.Command{ - Use: "getMaintenanceWindow", - Short: "Return One Maintenance Window for One Project", + Use: use, + Short: "Return One Maintenance Window for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -220,9 +224,11 @@ func (opts *resetMaintenanceWindowOpts) postRun(_ context.Context, _ io.Writer) func resetMaintenanceWindowBuilder() *cobra.Command { opts := resetMaintenanceWindowOpts{} + const use = "resetMaintenanceWindow" cmd := &cobra.Command{ - Use: "resetMaintenanceWindow", - Short: "Reset One Maintenance Window for One Project", + Use: use, + Short: "Reset One Maintenance Window for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -280,9 +286,11 @@ func (opts *toggleMaintenanceAutoDeferOpts) postRun(_ context.Context, _ io.Writ func toggleMaintenanceAutoDeferBuilder() *cobra.Command { opts := toggleMaintenanceAutoDeferOpts{} + const use = "toggleMaintenanceAutoDefer" cmd := &cobra.Command{ - Use: "toggleMaintenanceAutoDefer", - Short: "Toggle Automatic Deferral of Maintenance for One Project", + Use: use, + Short: "Toggle Automatic Deferral of Maintenance for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -397,9 +405,11 @@ func updateMaintenanceWindowBuilder() *cobra.Command { opts := updateMaintenanceWindowOpts{ fs: afero.NewOsFs(), } + const use = "updateMaintenanceWindow" cmd := &cobra.Command{ - Use: "updateMaintenanceWindow", - Short: "Update Maintenance Window for One Project", + Use: use, + Short: "Update Maintenance Window for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_mongo_db_cloud_users_cmd.go b/internal/api/api_mongo_db_cloud_users_cmd.go index f9f3325d3b..e641ca7a0c 100644 --- a/internal/api/api_mongo_db_cloud_users_cmd.go +++ b/internal/api/api_mongo_db_cloud_users_cmd.go @@ -117,9 +117,11 @@ func createUserBuilder() *cobra.Command { opts := createUserOpts{ fs: afero.NewOsFs(), } + const use = "createUser" cmd := &cobra.Command{ - Use: "createUser", - Short: "Create One MongoDB Cloud User", + Use: use, + Short: "Create One MongoDB Cloud User", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -192,9 +194,11 @@ func (opts *getUserOpts) postRun(_ context.Context, w io.Writer) error { func getUserBuilder() *cobra.Command { opts := getUserOpts{} + const use = "getUser" cmd := &cobra.Command{ - Use: "getUser", - Short: "Return One MongoDB Cloud User using Its ID", + Use: use, + Short: "Return One MongoDB Cloud User using Its ID", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -267,9 +271,11 @@ func (opts *getUserByUsernameOpts) postRun(_ context.Context, w io.Writer) error func getUserByUsernameBuilder() *cobra.Command { opts := getUserByUsernameOpts{} + const use = "getUserByUsername" cmd := &cobra.Command{ - Use: "getUserByUsername", - Short: "Return One MongoDB Cloud User using Their Username", + Use: use, + Short: "Return One MongoDB Cloud User using Their Username", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_monitoring_and_logs_cmd.go b/internal/api/api_monitoring_and_logs_cmd.go index f12b005466..33c01c2389 100644 --- a/internal/api/api_monitoring_and_logs_cmd.go +++ b/internal/api/api_monitoring_and_logs_cmd.go @@ -101,9 +101,11 @@ func (opts *getAtlasProcessOpts) postRun(_ context.Context, w io.Writer) error { func getAtlasProcessBuilder() *cobra.Command { opts := getAtlasProcessOpts{} + const use = "getAtlasProcess" cmd := &cobra.Command{ - Use: "getAtlasProcess", - Short: "Return One MongoDB Process by ID", + Use: use, + Short: "Return One MongoDB Process by ID", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -192,9 +194,11 @@ func (opts *getDatabaseOpts) postRun(_ context.Context, w io.Writer) error { func getDatabaseBuilder() *cobra.Command { opts := getDatabaseOpts{} + const use = "getDatabase" cmd := &cobra.Command{ - Use: "getDatabase", - Short: "Return One Database for a MongoDB Process", + Use: use, + Short: "Return One Database for a MongoDB Process", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -313,9 +317,11 @@ func (opts *getDatabaseMeasurementsOpts) postRun(_ context.Context, w io.Writer) func getDatabaseMeasurementsBuilder() *cobra.Command { opts := getDatabaseMeasurementsOpts{} + const use = "getDatabaseMeasurements" cmd := &cobra.Command{ - Use: "getDatabaseMeasurements", - Short: "Return Measurements of One Database for One MongoDB Process", + Use: use, + Short: "Return Measurements of One Database for One MongoDB Process", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -440,9 +446,11 @@ func (opts *getDiskMeasurementsOpts) postRun(_ context.Context, w io.Writer) err func getDiskMeasurementsBuilder() *cobra.Command { opts := getDiskMeasurementsOpts{} + const use = "getDiskMeasurements" cmd := &cobra.Command{ - Use: "getDiskMeasurements", - Short: "Return Measurements of One Disk for One MongoDB Process", + Use: use, + Short: "Return Measurements of One Disk for One MongoDB Process", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -543,9 +551,11 @@ func (opts *getHostLogsOpts) postRun(_ context.Context, w io.Writer) error { func getHostLogsBuilder() *cobra.Command { opts := getHostLogsOpts{} + const use = "getHostLogs" cmd := &cobra.Command{ - Use: "getHostLogs", - Short: "Download Logs for One Cluster Host in One Project", + Use: use, + Short: "Download Logs for One Cluster Host in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -664,9 +674,11 @@ func (opts *getHostMeasurementsOpts) postRun(_ context.Context, w io.Writer) err func getHostMeasurementsBuilder() *cobra.Command { opts := getHostMeasurementsOpts{} + const use = "getHostMeasurements" cmd := &cobra.Command{ - Use: "getHostMeasurements", - Short: "Return Measurements for One MongoDB Process", + Use: use, + Short: "Return Measurements for One MongoDB Process", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -793,9 +805,11 @@ func (opts *getIndexMetricsOpts) postRun(_ context.Context, w io.Writer) error { func getIndexMetricsBuilder() *cobra.Command { opts := getIndexMetricsOpts{} + const use = "getIndexMetrics" cmd := &cobra.Command{ - Use: "getIndexMetrics", - Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", + Use: use, + Short: "Return Atlas Search Metrics for One Index in One Specified Namespace", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -923,9 +937,11 @@ func (opts *getMeasurementsOpts) postRun(_ context.Context, w io.Writer) error { func getMeasurementsBuilder() *cobra.Command { opts := getMeasurementsOpts{} + const use = "getMeasurements" cmd := &cobra.Command{ - Use: "getMeasurements", - Short: "Return Atlas Search Hardware and Status Metrics", + Use: use, + Short: "Return Atlas Search Hardware and Status Metrics", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1023,9 +1039,11 @@ func (opts *listAtlasProcessesOpts) postRun(_ context.Context, w io.Writer) erro func listAtlasProcessesBuilder() *cobra.Command { opts := listAtlasProcessesOpts{} + const use = "listAtlasProcesses" cmd := &cobra.Command{ - Use: "listAtlasProcesses", - Short: "Return All MongoDB Processes in One Project", + Use: use, + Short: "Return All MongoDB Processes in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1119,9 +1137,11 @@ func (opts *listDatabasesOpts) postRun(_ context.Context, w io.Writer) error { func listDatabasesBuilder() *cobra.Command { opts := listDatabasesOpts{} + const use = "listDatabases" cmd := &cobra.Command{ - Use: "listDatabases", - Short: "Return Available Databases for One MongoDB Process", + Use: use, + Short: "Return Available Databases for One MongoDB Process", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1213,9 +1233,11 @@ func (opts *listDiskMeasurementsOpts) postRun(_ context.Context, w io.Writer) er func listDiskMeasurementsBuilder() *cobra.Command { opts := listDiskMeasurementsOpts{} + const use = "listDiskMeasurements" cmd := &cobra.Command{ - Use: "listDiskMeasurements", - Short: "Return Measurements of One Disk", + Use: use, + Short: "Return Measurements of One Disk", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1310,9 +1332,11 @@ func (opts *listDiskPartitionsOpts) postRun(_ context.Context, w io.Writer) erro func listDiskPartitionsBuilder() *cobra.Command { opts := listDiskPartitionsOpts{} + const use = "listDiskPartitions" cmd := &cobra.Command{ - Use: "listDiskPartitions", - Short: "Return Available Disks for One MongoDB Process", + Use: use, + Short: "Return Available Disks for One MongoDB Process", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1434,9 +1458,11 @@ func (opts *listIndexMetricsOpts) postRun(_ context.Context, w io.Writer) error func listIndexMetricsBuilder() *cobra.Command { opts := listIndexMetricsOpts{} + const use = "listIndexMetrics" cmd := &cobra.Command{ - Use: "listIndexMetrics", - Short: "Return All Atlas Search Index Metrics for One Namespace", + Use: use, + Short: "Return All Atlas Search Index Metrics for One Namespace", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1534,9 +1560,11 @@ func (opts *listMetricTypesOpts) postRun(_ context.Context, w io.Writer) error { func listMetricTypesBuilder() *cobra.Command { opts := listMetricTypesOpts{} + const use = "listMetricTypes" cmd := &cobra.Command{ - Use: "listMetricTypes", - Short: "Return All Atlas Search Metric Types for One Process", + Use: use, + Short: "Return All Atlas Search Metric Types for One Process", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_network_peering_cmd.go b/internal/api/api_network_peering_cmd.go index 5029c21845..9bdbe89f2f 100644 --- a/internal/api/api_network_peering_cmd.go +++ b/internal/api/api_network_peering_cmd.go @@ -132,9 +132,11 @@ func createPeeringConnectionBuilder() *cobra.Command { opts := createPeeringConnectionOpts{ fs: afero.NewOsFs(), } + const use = "createPeeringConnection" cmd := &cobra.Command{ - Use: "createPeeringConnection", - Short: "Create One New Network Peering Connection", + Use: use, + Short: "Create One New Network Peering Connection", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -252,9 +254,11 @@ func createPeeringContainerBuilder() *cobra.Command { opts := createPeeringContainerOpts{ fs: afero.NewOsFs(), } + const use = "createPeeringContainer" cmd := &cobra.Command{ - Use: "createPeeringContainer", - Short: "Create One New Network Peering Container", + Use: use, + Short: "Create One New Network Peering Container", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -341,9 +345,11 @@ func (opts *deletePeeringConnectionOpts) postRun(_ context.Context, w io.Writer) func deletePeeringConnectionBuilder() *cobra.Command { opts := deletePeeringConnectionOpts{} + const use = "deletePeeringConnection" cmd := &cobra.Command{ - Use: "deletePeeringConnection", - Short: "Remove One Existing Network Peering Connection", + Use: use, + Short: "Remove One Existing Network Peering Connection", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -430,9 +436,11 @@ func (opts *deletePeeringContainerOpts) postRun(_ context.Context, w io.Writer) func deletePeeringContainerBuilder() *cobra.Command { opts := deletePeeringContainerOpts{} + const use = "deletePeeringContainer" cmd := &cobra.Command{ - Use: "deletePeeringContainer", - Short: "Remove One Network Peering Container", + Use: use, + Short: "Remove One Network Peering Container", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -550,9 +558,11 @@ func disablePeeringBuilder() *cobra.Command { opts := disablePeeringOpts{ fs: afero.NewOsFs(), } + const use = "disablePeering" cmd := &cobra.Command{ - Use: "disablePeering", - Short: "Disable Connect via Peering Only Mode for One Project", + Use: use, + Short: "Disable Connect via Peering Only Mode for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -639,9 +649,11 @@ func (opts *getPeeringConnectionOpts) postRun(_ context.Context, w io.Writer) er func getPeeringConnectionBuilder() *cobra.Command { opts := getPeeringConnectionOpts{} + const use = "getPeeringConnection" cmd := &cobra.Command{ - Use: "getPeeringConnection", - Short: "Return One Network Peering Connection in One Project", + Use: use, + Short: "Return One Network Peering Connection in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -728,9 +740,11 @@ func (opts *getPeeringContainerOpts) postRun(_ context.Context, w io.Writer) err func getPeeringContainerBuilder() *cobra.Command { opts := getPeeringContainerOpts{} + const use = "getPeeringContainer" cmd := &cobra.Command{ - Use: "getPeeringContainer", - Short: "Return One Network Peering Container", + Use: use, + Short: "Return One Network Peering Container", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -823,9 +837,11 @@ func (opts *listPeeringConnectionsOpts) postRun(_ context.Context, w io.Writer) func listPeeringConnectionsBuilder() *cobra.Command { opts := listPeeringConnectionsOpts{} + const use = "listPeeringConnections" cmd := &cobra.Command{ - Use: "listPeeringConnections", - Short: "Return All Network Peering Connections in One Project", + Use: use, + Short: "Return All Network Peering Connections in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -920,9 +936,11 @@ func (opts *listPeeringContainerByCloudProviderOpts) postRun(_ context.Context, func listPeeringContainerByCloudProviderBuilder() *cobra.Command { opts := listPeeringContainerByCloudProviderOpts{} + const use = "listPeeringContainerByCloudProvider" cmd := &cobra.Command{ - Use: "listPeeringContainerByCloudProvider", - Short: "Return All Network Peering Containers in One Project for One Cloud Provider", + Use: use, + Short: "Return All Network Peering Containers in One Project for One Cloud Provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1016,9 +1034,11 @@ func (opts *listPeeringContainersOpts) postRun(_ context.Context, w io.Writer) e func listPeeringContainersBuilder() *cobra.Command { opts := listPeeringContainersOpts{} + const use = "listPeeringContainers" cmd := &cobra.Command{ - Use: "listPeeringContainers", - Short: "Return All Network Peering Containers in One Project", + Use: use, + Short: "Return All Network Peering Containers in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1139,9 +1159,11 @@ func updatePeeringConnectionBuilder() *cobra.Command { opts := updatePeeringConnectionOpts{ fs: afero.NewOsFs(), } + const use = "updatePeeringConnection" cmd := &cobra.Command{ - Use: "updatePeeringConnection", - Short: "Update One New Network Peering Connection", + Use: use, + Short: "Update One New Network Peering Connection", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1263,9 +1285,11 @@ func updatePeeringContainerBuilder() *cobra.Command { opts := updatePeeringContainerOpts{ fs: afero.NewOsFs(), } + const use = "updatePeeringContainer" cmd := &cobra.Command{ - Use: "updatePeeringContainer", - Short: "Update One Network Peering Container", + Use: use, + Short: "Update One Network Peering Container", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1352,9 +1376,11 @@ func (opts *verifyConnectViaPeeringOnlyModeForOneProjectOpts) postRun(_ context. func verifyConnectViaPeeringOnlyModeForOneProjectBuilder() *cobra.Command { opts := verifyConnectViaPeeringOnlyModeForOneProjectOpts{} + const use = "verifyConnectViaPeeringOnlyModeForOneProject" cmd := &cobra.Command{ - Use: "verifyConnectViaPeeringOnlyModeForOneProject", - Short: "Verify Connect via Peering Only Mode for One Project", + Use: use, + Short: "Verify Connect via Peering Only Mode for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_online_archive_cmd.go b/internal/api/api_online_archive_cmd.go index e452125773..9d0770b748 100644 --- a/internal/api/api_online_archive_cmd.go +++ b/internal/api/api_online_archive_cmd.go @@ -134,9 +134,11 @@ func createOnlineArchiveBuilder() *cobra.Command { opts := createOnlineArchiveOpts{ fs: afero.NewOsFs(), } + const use = "createOnlineArchive" cmd := &cobra.Command{ - Use: "createOnlineArchive", - Short: "Create One Online Archive", + Use: use, + Short: "Create One Online Archive", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -227,9 +229,11 @@ func (opts *deleteOnlineArchiveOpts) postRun(_ context.Context, w io.Writer) err func deleteOnlineArchiveBuilder() *cobra.Command { opts := deleteOnlineArchiveOpts{} + const use = "deleteOnlineArchive" cmd := &cobra.Command{ - Use: "deleteOnlineArchive", - Short: "Remove One Online Archive", + Use: use, + Short: "Remove One Online Archive", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -324,9 +328,11 @@ func (opts *downloadOnlineArchiveQueryLogsOpts) postRun(_ context.Context, w io. func downloadOnlineArchiveQueryLogsBuilder() *cobra.Command { opts := downloadOnlineArchiveQueryLogsOpts{} + const use = "downloadOnlineArchiveQueryLogs" cmd := &cobra.Command{ - Use: "downloadOnlineArchiveQueryLogs", - Short: "Download Online Archive Query Logs", + Use: use, + Short: "Download Online Archive Query Logs", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -418,9 +424,11 @@ func (opts *getOnlineArchiveOpts) postRun(_ context.Context, w io.Writer) error func getOnlineArchiveBuilder() *cobra.Command { opts := getOnlineArchiveOpts{} + const use = "getOnlineArchive" cmd := &cobra.Command{ - Use: "getOnlineArchive", - Short: "Return One Online Archive", + Use: use, + Short: "Return One Online Archive", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -515,9 +523,11 @@ func (opts *listOnlineArchivesOpts) postRun(_ context.Context, w io.Writer) erro func listOnlineArchivesBuilder() *cobra.Command { opts := listOnlineArchivesOpts{} + const use = "listOnlineArchives" cmd := &cobra.Command{ - Use: "listOnlineArchives", - Short: "Return All Online Archives for One Cluster", + Use: use, + Short: "Return All Online Archives for One Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -642,9 +652,11 @@ func updateOnlineArchiveBuilder() *cobra.Command { opts := updateOnlineArchiveOpts{ fs: afero.NewOsFs(), } + const use = "updateOnlineArchive" cmd := &cobra.Command{ - Use: "updateOnlineArchive", - Short: "Update One Online Archive", + Use: use, + Short: "Update One Online Archive", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_organizations_cmd.go b/internal/api/api_organizations_cmd.go index 2d2bd04cfd..6dfd0a386f 100644 --- a/internal/api/api_organizations_cmd.go +++ b/internal/api/api_organizations_cmd.go @@ -119,9 +119,11 @@ func createOrganizationBuilder() *cobra.Command { opts := createOrganizationOpts{ fs: afero.NewOsFs(), } + const use = "createOrganization" cmd := &cobra.Command{ - Use: "createOrganization", - Short: "Create One Organization", + Use: use, + Short: "Create One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -238,9 +240,11 @@ func createOrganizationInvitationBuilder() *cobra.Command { opts := createOrganizationInvitationOpts{ fs: afero.NewOsFs(), } + const use = "createOrganizationInvitation" cmd := &cobra.Command{ - Use: "createOrganizationInvitation", - Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", + Use: use, + Short: "Invite One MongoDB Cloud User to Join One Atlas Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -325,9 +329,11 @@ func (opts *deleteOrganizationOpts) postRun(_ context.Context, w io.Writer) erro func deleteOrganizationBuilder() *cobra.Command { opts := deleteOrganizationOpts{} + const use = "deleteOrganization" cmd := &cobra.Command{ - Use: "deleteOrganization", - Short: "Remove One Organization", + Use: use, + Short: "Remove One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -412,9 +418,11 @@ func (opts *deleteOrganizationInvitationOpts) postRun(_ context.Context, w io.Wr func deleteOrganizationInvitationBuilder() *cobra.Command { opts := deleteOrganizationInvitationOpts{} + const use = "deleteOrganizationInvitation" cmd := &cobra.Command{ - Use: "deleteOrganizationInvitation", - Short: "Cancel One Organization Invitation", + Use: use, + Short: "Cancel One Organization Invitation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -499,9 +507,11 @@ func (opts *getOrganizationOpts) postRun(_ context.Context, w io.Writer) error { func getOrganizationBuilder() *cobra.Command { opts := getOrganizationOpts{} + const use = "getOrganization" cmd := &cobra.Command{ - Use: "getOrganization", - Short: "Return One Organization", + Use: use, + Short: "Return One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -586,9 +596,11 @@ func (opts *getOrganizationInvitationOpts) postRun(_ context.Context, w io.Write func getOrganizationInvitationBuilder() *cobra.Command { opts := getOrganizationInvitationOpts{} + const use = "getOrganizationInvitation" cmd := &cobra.Command{ - Use: "getOrganizationInvitation", - Short: "Return One Organization Invitation", + Use: use, + Short: "Return One Organization Invitation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -673,9 +685,11 @@ func (opts *getOrganizationSettingsOpts) postRun(_ context.Context, w io.Writer) func getOrganizationSettingsBuilder() *cobra.Command { opts := getOrganizationSettingsOpts{} + const use = "getOrganizationSettings" cmd := &cobra.Command{ - Use: "getOrganizationSettings", - Short: "Return Settings for One Organization", + Use: use, + Short: "Return Settings for One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -760,9 +774,11 @@ func (opts *listOrganizationInvitationsOpts) postRun(_ context.Context, w io.Wri func listOrganizationInvitationsBuilder() *cobra.Command { opts := listOrganizationInvitationsOpts{} + const use = "listOrganizationInvitations" cmd := &cobra.Command{ - Use: "listOrganizationInvitations", - Short: "Return All Organization Invitations", + Use: use, + Short: "Return All Organization Invitations", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -854,9 +870,11 @@ func (opts *listOrganizationProjectsOpts) postRun(_ context.Context, w io.Writer func listOrganizationProjectsBuilder() *cobra.Command { opts := listOrganizationProjectsOpts{} + const use = "listOrganizationProjects" cmd := &cobra.Command{ - Use: "listOrganizationProjects", - Short: "Return One or More Projects in One Organization", + Use: use, + Short: "Return One or More Projects in One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -949,9 +967,11 @@ func (opts *listOrganizationUsersOpts) postRun(_ context.Context, w io.Writer) e func listOrganizationUsersBuilder() *cobra.Command { opts := listOrganizationUsersOpts{} + const use = "listOrganizationUsers" cmd := &cobra.Command{ - Use: "listOrganizationUsers", - Short: "Return All MongoDB Cloud Users in One Organization", + Use: use, + Short: "Return All MongoDB Cloud Users in One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1032,9 +1052,11 @@ func (opts *listOrganizationsOpts) postRun(_ context.Context, w io.Writer) error func listOrganizationsBuilder() *cobra.Command { opts := listOrganizationsOpts{} + const use = "listOrganizations" cmd := &cobra.Command{ - Use: "listOrganizations", - Short: "Return All Organizations", + Use: use, + Short: "Return All Organizations", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1122,9 +1144,11 @@ func (opts *removeOrganizationUserOpts) postRun(_ context.Context, w io.Writer) func removeOrganizationUserBuilder() *cobra.Command { opts := removeOrganizationUserOpts{} + const use = "removeOrganizationUser" cmd := &cobra.Command{ - Use: "removeOrganizationUser", - Short: "Remove One MongoDB Cloud User from One Organization", + Use: use, + Short: "Remove One MongoDB Cloud User from One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1242,9 +1266,11 @@ func renameOrganizationBuilder() *cobra.Command { opts := renameOrganizationOpts{ fs: afero.NewOsFs(), } + const use = "renameOrganization" cmd := &cobra.Command{ - Use: "renameOrganization", - Short: "Rename One Organization", + Use: use, + Short: "Rename One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1362,9 +1388,11 @@ func updateOrganizationInvitationBuilder() *cobra.Command { opts := updateOrganizationInvitationOpts{ fs: afero.NewOsFs(), } + const use = "updateOrganizationInvitation" cmd := &cobra.Command{ - Use: "updateOrganizationInvitation", - Short: "Update One Organization Invitation", + Use: use, + Short: "Update One Organization Invitation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1484,9 +1512,11 @@ func updateOrganizationInvitationByIdBuilder() *cobra.Command { opts := updateOrganizationInvitationByIdOpts{ fs: afero.NewOsFs(), } + const use = "updateOrganizationInvitationById" cmd := &cobra.Command{ - Use: "updateOrganizationInvitationById", - Short: "Update One Organization Invitation by Invitation ID", + Use: use, + Short: "Update One Organization Invitation by Invitation ID", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1608,9 +1638,11 @@ func updateOrganizationRolesBuilder() *cobra.Command { opts := updateOrganizationRolesOpts{ fs: afero.NewOsFs(), } + const use = "updateOrganizationRoles" cmd := &cobra.Command{ - Use: "updateOrganizationRoles", - Short: "Update Organization Roles for One MongoDB Cloud User", + Use: use, + Short: "Update Organization Roles for One MongoDB Cloud User", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1730,9 +1762,11 @@ func updateOrganizationSettingsBuilder() *cobra.Command { opts := updateOrganizationSettingsOpts{ fs: afero.NewOsFs(), } + const use = "updateOrganizationSettings" cmd := &cobra.Command{ - Use: "updateOrganizationSettings", - Short: "Update Settings for One Organization", + Use: use, + Short: "Update Settings for One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_performance_advisor_cmd.go b/internal/api/api_performance_advisor_cmd.go index f011843ecf..09a2dcda7b 100644 --- a/internal/api/api_performance_advisor_cmd.go +++ b/internal/api/api_performance_advisor_cmd.go @@ -74,9 +74,11 @@ func (opts *disableSlowOperationThresholdingOpts) postRun(_ context.Context, _ i func disableSlowOperationThresholdingBuilder() *cobra.Command { opts := disableSlowOperationThresholdingOpts{} + const use = "disableSlowOperationThresholding" cmd := &cobra.Command{ - Use: "disableSlowOperationThresholding", - Short: "Disable Managed Slow Operation Threshold", + Use: use, + Short: "Disable Managed Slow Operation Threshold", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -134,9 +136,11 @@ func (opts *enableSlowOperationThresholdingOpts) postRun(_ context.Context, _ io func enableSlowOperationThresholdingBuilder() *cobra.Command { opts := enableSlowOperationThresholdingOpts{} + const use = "enableSlowOperationThresholding" cmd := &cobra.Command{ - Use: "enableSlowOperationThresholding", - Short: "Enable Managed Slow Operation Threshold", + Use: use, + Short: "Enable Managed Slow Operation Threshold", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -220,9 +224,11 @@ func (opts *getServerlessAutoIndexingOpts) postRun(_ context.Context, w io.Write func getServerlessAutoIndexingBuilder() *cobra.Command { opts := getServerlessAutoIndexingOpts{} + const use = "getServerlessAutoIndexing" cmd := &cobra.Command{ - Use: "getServerlessAutoIndexing", - Short: "Return Serverless Auto Indexing Enabled", + Use: use, + Short: "Return Serverless Auto Indexing Enabled", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -317,9 +323,11 @@ func (opts *listSlowQueriesOpts) postRun(_ context.Context, w io.Writer) error { func listSlowQueriesBuilder() *cobra.Command { opts := listSlowQueriesOpts{} + const use = "listSlowQueries" cmd := &cobra.Command{ - Use: "listSlowQueries", - Short: "Return Slow Queries", + Use: use, + Short: "Return Slow Queries", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -420,9 +428,11 @@ func (opts *listSlowQueryNamespacesOpts) postRun(_ context.Context, w io.Writer) func listSlowQueryNamespacesBuilder() *cobra.Command { opts := listSlowQueryNamespacesOpts{} + const use = "listSlowQueryNamespaces" cmd := &cobra.Command{ - Use: "listSlowQueryNamespaces", - Short: "Return All Namespaces for One Host", + Use: use, + Short: "Return All Namespaces for One Host", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -533,9 +543,11 @@ func (opts *listSuggestedIndexesOpts) postRun(_ context.Context, w io.Writer) er func listSuggestedIndexesBuilder() *cobra.Command { opts := listSuggestedIndexesOpts{} + const use = "listSuggestedIndexes" cmd := &cobra.Command{ - Use: "listSuggestedIndexes", - Short: "Return Suggested Indexes", + Use: use, + Short: "Return Suggested Indexes", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -638,9 +650,11 @@ func (opts *setServerlessAutoIndexingOpts) postRun(_ context.Context, w io.Write func setServerlessAutoIndexingBuilder() *cobra.Command { opts := setServerlessAutoIndexingOpts{} + const use = "setServerlessAutoIndexing" cmd := &cobra.Command{ - Use: "setServerlessAutoIndexing", - Short: "Set Serverless Auto Indexing", + Use: use, + Short: "Set Serverless Auto Indexing", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_private_endpoint_services_cmd.go b/internal/api/api_private_endpoint_services_cmd.go index c126c886a9..01aab55527 100644 --- a/internal/api/api_private_endpoint_services_cmd.go +++ b/internal/api/api_private_endpoint_services_cmd.go @@ -136,9 +136,11 @@ func createPrivateEndpointBuilder() *cobra.Command { opts := createPrivateEndpointOpts{ fs: afero.NewOsFs(), } + const use = "createPrivateEndpoint" cmd := &cobra.Command{ - Use: "createPrivateEndpoint", - Short: "Create One Private Endpoint for One Provider", + Use: use, + Short: "Create One Private Endpoint for One Provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -260,9 +262,11 @@ func createPrivateEndpointServiceBuilder() *cobra.Command { opts := createPrivateEndpointServiceOpts{ fs: afero.NewOsFs(), } + const use = "createPrivateEndpointService" cmd := &cobra.Command{ - Use: "createPrivateEndpointService", - Short: "Create One Private Endpoint Service for One Provider", + Use: use, + Short: "Create One Private Endpoint Service for One Provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -353,9 +357,11 @@ func (opts *deletePrivateEndpointOpts) postRun(_ context.Context, w io.Writer) e func deletePrivateEndpointBuilder() *cobra.Command { opts := deletePrivateEndpointOpts{} + const use = "deletePrivateEndpoint" cmd := &cobra.Command{ - Use: "deletePrivateEndpoint", - Short: "Remove One Private Endpoint for One Provider", + Use: use, + Short: "Remove One Private Endpoint for One Provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -448,9 +454,11 @@ func (opts *deletePrivateEndpointServiceOpts) postRun(_ context.Context, w io.Wr func deletePrivateEndpointServiceBuilder() *cobra.Command { opts := deletePrivateEndpointServiceOpts{} + const use = "deletePrivateEndpointService" cmd := &cobra.Command{ - Use: "deletePrivateEndpointService", - Short: "Remove One Private Endpoint Service for One Provider", + Use: use, + Short: "Remove One Private Endpoint Service for One Provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -543,9 +551,11 @@ func (opts *getPrivateEndpointOpts) postRun(_ context.Context, w io.Writer) erro func getPrivateEndpointBuilder() *cobra.Command { opts := getPrivateEndpointOpts{} + const use = "getPrivateEndpoint" cmd := &cobra.Command{ - Use: "getPrivateEndpoint", - Short: "Return One Private Endpoint for One Provider", + Use: use, + Short: "Return One Private Endpoint for One Provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -638,9 +648,11 @@ func (opts *getPrivateEndpointServiceOpts) postRun(_ context.Context, w io.Write func getPrivateEndpointServiceBuilder() *cobra.Command { opts := getPrivateEndpointServiceOpts{} + const use = "getPrivateEndpointService" cmd := &cobra.Command{ - Use: "getPrivateEndpointService", - Short: "Return One Private Endpoint Service for One Provider", + Use: use, + Short: "Return One Private Endpoint Service for One Provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -727,9 +739,11 @@ func (opts *getRegionalizedPrivateEndpointSettingOpts) postRun(_ context.Context func getRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { opts := getRegionalizedPrivateEndpointSettingOpts{} + const use = "getRegionalizedPrivateEndpointSetting" cmd := &cobra.Command{ - Use: "getRegionalizedPrivateEndpointSetting", - Short: "Return Regionalized Private Endpoint Status", + Use: use, + Short: "Return Regionalized Private Endpoint Status", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -814,9 +828,11 @@ func (opts *listPrivateEndpointServicesOpts) postRun(_ context.Context, w io.Wri func listPrivateEndpointServicesBuilder() *cobra.Command { opts := listPrivateEndpointServicesOpts{} + const use = "listPrivateEndpointServices" cmd := &cobra.Command{ - Use: "listPrivateEndpointServices", - Short: "Return All Private Endpoint Services for One Provider", + Use: use, + Short: "Return All Private Endpoint Services for One Provider", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -934,9 +950,11 @@ func toggleRegionalizedPrivateEndpointSettingBuilder() *cobra.Command { opts := toggleRegionalizedPrivateEndpointSettingOpts{ fs: afero.NewOsFs(), } + const use = "toggleRegionalizedPrivateEndpointSetting" cmd := &cobra.Command{ - Use: "toggleRegionalizedPrivateEndpointSetting", - Short: "Toggle Regionalized Private Endpoint Status", + Use: use, + Short: "Toggle Regionalized Private Endpoint Status", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_programmatic_api_keys_cmd.go b/internal/api/api_programmatic_api_keys_cmd.go index 38e9853ecf..2a6c186d79 100644 --- a/internal/api/api_programmatic_api_keys_cmd.go +++ b/internal/api/api_programmatic_api_keys_cmd.go @@ -134,9 +134,11 @@ func addProjectApiKeyBuilder() *cobra.Command { opts := addProjectApiKeyOpts{ fs: afero.NewOsFs(), } + const use = "addProjectApiKey" cmd := &cobra.Command{ - Use: "addProjectApiKey", - Short: "Assign One Organization API Key to One Project", + Use: use, + Short: "Assign One Organization API Key to One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -256,9 +258,11 @@ func createApiKeyBuilder() *cobra.Command { opts := createApiKeyOpts{ fs: afero.NewOsFs(), } + const use = "createApiKey" cmd := &cobra.Command{ - Use: "createApiKey", - Short: "Create One Organization API Key", + Use: use, + Short: "Create One Organization API Key", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -385,9 +389,11 @@ func createApiKeyAccessListBuilder() *cobra.Command { opts := createApiKeyAccessListOpts{ fs: afero.NewOsFs(), } + const use = "createApiKeyAccessList" cmd := &cobra.Command{ - Use: "createApiKeyAccessList", - Short: "Create Access List Entries for One Organization API Key", + Use: use, + Short: "Create Access List Entries for One Organization API Key", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -510,9 +516,11 @@ func createProjectApiKeyBuilder() *cobra.Command { opts := createProjectApiKeyOpts{ fs: afero.NewOsFs(), } + const use = "createProjectApiKey" cmd := &cobra.Command{ - Use: "createProjectApiKey", - Short: "Create and Assign One Organization API Key to One Project", + Use: use, + Short: "Create and Assign One Organization API Key to One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -599,9 +607,11 @@ func (opts *deleteApiKeyOpts) postRun(_ context.Context, w io.Writer) error { func deleteApiKeyBuilder() *cobra.Command { opts := deleteApiKeyOpts{} + const use = "deleteApiKey" cmd := &cobra.Command{ - Use: "deleteApiKey", - Short: "Remove One Organization API Key", + Use: use, + Short: "Remove One Organization API Key", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -690,9 +700,11 @@ func (opts *deleteApiKeyAccessListEntryOpts) postRun(_ context.Context, w io.Wri func deleteApiKeyAccessListEntryBuilder() *cobra.Command { opts := deleteApiKeyAccessListEntryOpts{} + const use = "deleteApiKeyAccessListEntry" cmd := &cobra.Command{ - Use: "deleteApiKeyAccessListEntry", - Short: "Remove One Access List Entry for One Organization API Key", + Use: use, + Short: "Remove One Access List Entry for One Organization API Key", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -781,9 +793,11 @@ func (opts *getApiKeyOpts) postRun(_ context.Context, w io.Writer) error { func getApiKeyBuilder() *cobra.Command { opts := getApiKeyOpts{} + const use = "getApiKey" cmd := &cobra.Command{ - Use: "getApiKey", - Short: "Return One Organization API Key", + Use: use, + Short: "Return One Organization API Key", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -872,9 +886,11 @@ func (opts *getApiKeyAccessListOpts) postRun(_ context.Context, w io.Writer) err func getApiKeyAccessListBuilder() *cobra.Command { opts := getApiKeyAccessListOpts{} + const use = "getApiKeyAccessList" cmd := &cobra.Command{ - Use: "getApiKeyAccessList", - Short: "Return One Access List Entry for One Organization API Key", + Use: use, + Short: "Return One Access List Entry for One Organization API Key", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -969,9 +985,11 @@ func (opts *listApiKeyAccessListsEntriesOpts) postRun(_ context.Context, w io.Wr func listApiKeyAccessListsEntriesBuilder() *cobra.Command { opts := listApiKeyAccessListsEntriesOpts{} + const use = "listApiKeyAccessListsEntries" cmd := &cobra.Command{ - Use: "listApiKeyAccessListsEntries", - Short: "Return All Access List Entries for One Organization API Key", + Use: use, + Short: "Return All Access List Entries for One Organization API Key", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1065,9 +1083,11 @@ func (opts *listApiKeysOpts) postRun(_ context.Context, w io.Writer) error { func listApiKeysBuilder() *cobra.Command { opts := listApiKeysOpts{} + const use = "listApiKeys" cmd := &cobra.Command{ - Use: "listApiKeys", - Short: "Return All Organization API Keys", + Use: use, + Short: "Return All Organization API Keys", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1159,9 +1179,11 @@ func (opts *listProjectApiKeysOpts) postRun(_ context.Context, w io.Writer) erro func listProjectApiKeysBuilder() *cobra.Command { opts := listProjectApiKeysOpts{} + const use = "listProjectApiKeys" cmd := &cobra.Command{ - Use: "listProjectApiKeys", - Short: "Return All Organization API Keys Assigned to One Project", + Use: use, + Short: "Return All Organization API Keys Assigned to One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1249,9 +1271,11 @@ func (opts *removeProjectApiKeyOpts) postRun(_ context.Context, w io.Writer) err func removeProjectApiKeyBuilder() *cobra.Command { opts := removeProjectApiKeyOpts{} + const use = "removeProjectApiKey" cmd := &cobra.Command{ - Use: "removeProjectApiKey", - Short: "Unassign One Organization API Key from One Project", + Use: use, + Short: "Unassign One Organization API Key from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1371,9 +1395,11 @@ func updateApiKeyBuilder() *cobra.Command { opts := updateApiKeyOpts{ fs: afero.NewOsFs(), } + const use = "updateApiKey" cmd := &cobra.Command{ - Use: "updateApiKey", - Short: "Update One Organization API Key", + Use: use, + Short: "Update One Organization API Key", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1502,9 +1528,11 @@ func updateApiKeyRolesBuilder() *cobra.Command { opts := updateApiKeyRolesOpts{ fs: afero.NewOsFs(), } + const use = "updateApiKeyRoles" cmd := &cobra.Command{ - Use: "updateApiKeyRoles", - Short: "Update Roles of One Organization API Key to One Project", + Use: use, + Short: "Update Roles of One Organization API Key to One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_project_ip_access_list_cmd.go b/internal/api/api_project_ip_access_list_cmd.go index ac3ad5cf2a..3e6b91d436 100644 --- a/internal/api/api_project_ip_access_list_cmd.go +++ b/internal/api/api_project_ip_access_list_cmd.go @@ -139,9 +139,11 @@ func createProjectIpAccessListBuilder() *cobra.Command { opts := createProjectIpAccessListOpts{ fs: afero.NewOsFs(), } + const use = "createProjectIpAccessList" cmd := &cobra.Command{ - Use: "createProjectIpAccessList", - Short: "Add Entries to Project IP Access List", + Use: use, + Short: "Add Entries to Project IP Access List", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -231,9 +233,11 @@ func (opts *deleteProjectIpAccessListOpts) postRun(_ context.Context, w io.Write func deleteProjectIpAccessListBuilder() *cobra.Command { opts := deleteProjectIpAccessListOpts{} + const use = "deleteProjectIpAccessList" cmd := &cobra.Command{ - Use: "deleteProjectIpAccessList", - Short: "Remove One Entry from One Project IP Access List", + Use: use, + Short: "Remove One Entry from One Project IP Access List", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -324,9 +328,11 @@ func (opts *getProjectIpAccessListStatusOpts) postRun(_ context.Context, w io.Wr func getProjectIpAccessListStatusBuilder() *cobra.Command { opts := getProjectIpAccessListStatusOpts{} + const use = "getProjectIpAccessListStatus" cmd := &cobra.Command{ - Use: "getProjectIpAccessListStatus", - Short: "Return Status of One Project IP Access List Entry", + Use: use, + Short: "Return Status of One Project IP Access List Entry", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -413,9 +419,11 @@ func (opts *getProjectIpListOpts) postRun(_ context.Context, w io.Writer) error func getProjectIpListBuilder() *cobra.Command { opts := getProjectIpListOpts{} + const use = "getProjectIpList" cmd := &cobra.Command{ - Use: "getProjectIpList", - Short: "Return One Project IP Access List Entry", + Use: use, + Short: "Return One Project IP Access List Entry", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -506,9 +514,11 @@ func (opts *listProjectIpAccessListsOpts) postRun(_ context.Context, w io.Writer func listProjectIpAccessListsBuilder() *cobra.Command { opts := listProjectIpAccessListsOpts{} + const use = "listProjectIpAccessLists" cmd := &cobra.Command{ - Use: "listProjectIpAccessLists", - Short: "Return Project IP Access List", + Use: use, + Short: "Return Project IP Access List", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_projects_cmd.go b/internal/api/api_projects_cmd.go index 6883f49e56..d2ce341420 100644 --- a/internal/api/api_projects_cmd.go +++ b/internal/api/api_projects_cmd.go @@ -132,9 +132,11 @@ func addUserToProjectBuilder() *cobra.Command { opts := addUserToProjectOpts{ fs: afero.NewOsFs(), } + const use = "addUserToProject" cmd := &cobra.Command{ - Use: "addUserToProject", - Short: "Add One MongoDB Cloud User to One Project", + Use: use, + Short: "Add One MongoDB Cloud User to One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -242,9 +244,11 @@ func createProjectBuilder() *cobra.Command { opts := createProjectOpts{ fs: afero.NewOsFs(), } + const use = "createProject" cmd := &cobra.Command{ - Use: "createProject", - Short: "Create One Project", + Use: use, + Short: "Create One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -362,9 +366,11 @@ func createProjectInvitationBuilder() *cobra.Command { opts := createProjectInvitationOpts{ fs: afero.NewOsFs(), } + const use = "createProjectInvitation" cmd := &cobra.Command{ - Use: "createProjectInvitation", - Short: "Invite One MongoDB Cloud User to Join One Project", + Use: use, + Short: "Invite One MongoDB Cloud User to Join One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -449,9 +455,11 @@ func (opts *deleteProjectOpts) postRun(_ context.Context, w io.Writer) error { func deleteProjectBuilder() *cobra.Command { opts := deleteProjectOpts{} + const use = "deleteProject" cmd := &cobra.Command{ - Use: "deleteProject", - Short: "Remove One Project", + Use: use, + Short: "Remove One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -536,9 +544,11 @@ func (opts *deleteProjectInvitationOpts) postRun(_ context.Context, w io.Writer) func deleteProjectInvitationBuilder() *cobra.Command { opts := deleteProjectInvitationOpts{} + const use = "deleteProjectInvitation" cmd := &cobra.Command{ - Use: "deleteProjectInvitation", - Short: "Cancel One Project Invitation", + Use: use, + Short: "Cancel One Project Invitation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -625,9 +635,11 @@ func (opts *deleteProjectLimitOpts) postRun(_ context.Context, w io.Writer) erro func deleteProjectLimitBuilder() *cobra.Command { opts := deleteProjectLimitOpts{} + const use = "deleteProjectLimit" cmd := &cobra.Command{ - Use: "deleteProjectLimit", - Short: "Remove One Project Limit", + Use: use, + Short: "Remove One Project Limit", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -728,9 +740,11 @@ func (opts *getProjectOpts) postRun(_ context.Context, w io.Writer) error { func getProjectBuilder() *cobra.Command { opts := getProjectOpts{} + const use = "getProject" cmd := &cobra.Command{ - Use: "getProject", - Short: "Return One Project", + Use: use, + Short: "Return One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -802,9 +816,11 @@ func (opts *getProjectByNameOpts) postRun(_ context.Context, w io.Writer) error func getProjectByNameBuilder() *cobra.Command { opts := getProjectByNameOpts{} + const use = "getProjectByName" cmd := &cobra.Command{ - Use: "getProjectByName", - Short: "Return One Project using Its Name", + Use: use, + Short: "Return One Project using Its Name", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -890,9 +906,11 @@ func (opts *getProjectInvitationOpts) postRun(_ context.Context, w io.Writer) er func getProjectInvitationBuilder() *cobra.Command { opts := getProjectInvitationOpts{} + const use = "getProjectInvitation" cmd := &cobra.Command{ - Use: "getProjectInvitation", - Short: "Return One Project Invitation", + Use: use, + Short: "Return One Project Invitation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -979,9 +997,11 @@ func (opts *getProjectLimitOpts) postRun(_ context.Context, w io.Writer) error { func getProjectLimitBuilder() *cobra.Command { opts := getProjectLimitOpts{} + const use = "getProjectLimit" cmd := &cobra.Command{ - Use: "getProjectLimit", - Short: "Return One Limit for One Project", + Use: use, + Short: "Return One Limit for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1082,9 +1102,11 @@ func (opts *getProjectSettingsOpts) postRun(_ context.Context, w io.Writer) erro func getProjectSettingsBuilder() *cobra.Command { opts := getProjectSettingsOpts{} + const use = "getProjectSettings" cmd := &cobra.Command{ - Use: "getProjectSettings", - Short: "Return One Project Settings", + Use: use, + Short: "Return One Project Settings", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1169,9 +1191,11 @@ func (opts *listProjectInvitationsOpts) postRun(_ context.Context, w io.Writer) func listProjectInvitationsBuilder() *cobra.Command { opts := listProjectInvitationsOpts{} + const use = "listProjectInvitations" cmd := &cobra.Command{ - Use: "listProjectInvitations", - Short: "Return All Project Invitations", + Use: use, + Short: "Return All Project Invitations", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1255,9 +1279,11 @@ func (opts *listProjectLimitsOpts) postRun(_ context.Context, w io.Writer) error func listProjectLimitsBuilder() *cobra.Command { opts := listProjectLimitsOpts{} + const use = "listProjectLimits" cmd := &cobra.Command{ - Use: "listProjectLimits", - Short: "Return All Limits for One Project", + Use: use, + Short: "Return All Limits for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1350,9 +1376,11 @@ func (opts *listProjectUsersOpts) postRun(_ context.Context, w io.Writer) error func listProjectUsersBuilder() *cobra.Command { opts := listProjectUsersOpts{} + const use = "listProjectUsers" cmd := &cobra.Command{ - Use: "listProjectUsers", - Short: "Return All Users in One Project", + Use: use, + Short: "Return All Users in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1433,9 +1461,11 @@ func (opts *listProjectsOpts) postRun(_ context.Context, w io.Writer) error { func listProjectsBuilder() *cobra.Command { opts := listProjectsOpts{} + const use = "listProjects" cmd := &cobra.Command{ - Use: "listProjects", - Short: "Return All Projects", + Use: use, + Short: "Return All Projects", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1498,9 +1528,11 @@ func (opts *removeProjectUserOpts) postRun(_ context.Context, _ io.Writer) error func removeProjectUserBuilder() *cobra.Command { opts := removeProjectUserOpts{} + const use = "removeProjectUser" cmd := &cobra.Command{ - Use: "removeProjectUser", - Short: "Remove One User from One Project", + Use: use, + Short: "Remove One User from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1584,9 +1616,11 @@ func (opts *returnAllIPAddressesOpts) postRun(_ context.Context, w io.Writer) er func returnAllIPAddressesBuilder() *cobra.Command { opts := returnAllIPAddressesOpts{} + const use = "returnAllIPAddresses" cmd := &cobra.Command{ - Use: "returnAllIPAddresses", - Short: "Return All IP Addresses for One Project", + Use: use, + Short: "Return All IP Addresses for One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1704,9 +1738,11 @@ func setProjectLimitBuilder() *cobra.Command { opts := setProjectLimitOpts{ fs: afero.NewOsFs(), } + const use = "setProjectLimit" cmd := &cobra.Command{ - Use: "setProjectLimit", - Short: "Set One Project Limit", + Use: use, + Short: "Set One Project Limit", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1842,9 +1878,11 @@ func updateProjectBuilder() *cobra.Command { opts := updateProjectOpts{ fs: afero.NewOsFs(), } + const use = "updateProject" cmd := &cobra.Command{ - Use: "updateProject", - Short: "Update One Project", + Use: use, + Short: "Update One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1962,9 +2000,11 @@ func updateProjectInvitationBuilder() *cobra.Command { opts := updateProjectInvitationOpts{ fs: afero.NewOsFs(), } + const use = "updateProjectInvitation" cmd := &cobra.Command{ - Use: "updateProjectInvitation", - Short: "Update One Project Invitation", + Use: use, + Short: "Update One Project Invitation", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2084,9 +2124,11 @@ func updateProjectInvitationByIdBuilder() *cobra.Command { opts := updateProjectInvitationByIdOpts{ fs: afero.NewOsFs(), } + const use = "updateProjectInvitationById" cmd := &cobra.Command{ - Use: "updateProjectInvitationById", - Short: "Update One Project Invitation by Invitation ID", + Use: use, + Short: "Update One Project Invitation by Invitation ID", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2208,9 +2250,11 @@ func updateProjectRolesBuilder() *cobra.Command { opts := updateProjectRolesOpts{ fs: afero.NewOsFs(), } + const use = "updateProjectRoles" cmd := &cobra.Command{ - Use: "updateProjectRoles", - Short: "Update Project Roles for One MongoDB Cloud User", + Use: use, + Short: "Update Project Roles for One MongoDB Cloud User", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -2330,9 +2374,11 @@ func updateProjectSettingsBuilder() *cobra.Command { opts := updateProjectSettingsOpts{ fs: afero.NewOsFs(), } + const use = "updateProjectSettings" cmd := &cobra.Command{ - Use: "updateProjectSettings", - Short: "Update One Project Settings", + Use: use, + Short: "Update One Project Settings", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_push_based_log_export_cmd.go b/internal/api/api_push_based_log_export_cmd.go index 555ddd6797..345e53d574 100644 --- a/internal/api/api_push_based_log_export_cmd.go +++ b/internal/api/api_push_based_log_export_cmd.go @@ -108,9 +108,11 @@ func createPushBasedLogConfigurationBuilder() *cobra.Command { opts := createPushBasedLogConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "createPushBasedLogConfiguration" cmd := &cobra.Command{ - Use: "createPushBasedLogConfiguration", - Short: "Enable the push-based log export feature for a project", + Use: use, + Short: "Enable the push-based log export feature for a project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -170,9 +172,11 @@ func (opts *deletePushBasedLogConfigurationOpts) postRun(_ context.Context, _ io func deletePushBasedLogConfigurationBuilder() *cobra.Command { opts := deletePushBasedLogConfigurationOpts{} + const use = "deletePushBasedLogConfiguration" cmd := &cobra.Command{ - Use: "deletePushBasedLogConfiguration", - Short: "Disable the push-based log export feature for a project", + Use: use, + Short: "Disable the push-based log export feature for a project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -254,9 +258,11 @@ func (opts *getPushBasedLogConfigurationOpts) postRun(_ context.Context, w io.Wr func getPushBasedLogConfigurationBuilder() *cobra.Command { opts := getPushBasedLogConfigurationOpts{} + const use = "getPushBasedLogConfiguration" cmd := &cobra.Command{ - Use: "getPushBasedLogConfiguration", - Short: "Get the push-based log export configuration for a project", + Use: use, + Short: "Get the push-based log export configuration for a project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -348,9 +354,11 @@ func updatePushBasedLogConfigurationBuilder() *cobra.Command { opts := updatePushBasedLogConfigurationOpts{ fs: afero.NewOsFs(), } + const use = "updatePushBasedLogConfiguration" cmd := &cobra.Command{ - Use: "updatePushBasedLogConfiguration", - Short: "Update the push-based log export feature for a project", + Use: use, + Short: "Update the push-based log export feature for a project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_rolling_index_cmd.go b/internal/api/api_rolling_index_cmd.go index 38128b6895..93918ce57b 100644 --- a/internal/api/api_rolling_index_cmd.go +++ b/internal/api/api_rolling_index_cmd.go @@ -108,9 +108,11 @@ func createRollingIndexBuilder() *cobra.Command { opts := createRollingIndexOpts{ fs: afero.NewOsFs(), } + const use = "createRollingIndex" cmd := &cobra.Command{ - Use: "createRollingIndex", - Short: "Create One Rolling Index", + Use: use, + Short: "Create One Rolling Index", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_root_cmd.go b/internal/api/api_root_cmd.go index 0c1d278a55..1bdaa3e608 100644 --- a/internal/api/api_root_cmd.go +++ b/internal/api/api_root_cmd.go @@ -82,9 +82,11 @@ func (opts *getSystemStatusOpts) postRun(_ context.Context, w io.Writer) error { func getSystemStatusBuilder() *cobra.Command { opts := getSystemStatusOpts{} + const use = "getSystemStatus" cmd := &cobra.Command{ - Use: "getSystemStatus", - Short: "Return the status of this MongoDB application", + Use: use, + Short: "Return the status of this MongoDB application", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -152,9 +154,11 @@ func (opts *returnAllControlPlaneIPAddressesOpts) postRun(_ context.Context, w i func returnAllControlPlaneIPAddressesBuilder() *cobra.Command { opts := returnAllControlPlaneIPAddressesOpts{} + const use = "returnAllControlPlaneIPAddresses" cmd := &cobra.Command{ - Use: "returnAllControlPlaneIPAddresses", - Short: "Return All Control Plane IP Addresses", + Use: use, + Short: "Return All Control Plane IP Addresses", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_serverless_instances_cmd.go b/internal/api/api_serverless_instances_cmd.go index 5b6446c447..5b4b460398 100644 --- a/internal/api/api_serverless_instances_cmd.go +++ b/internal/api/api_serverless_instances_cmd.go @@ -132,9 +132,11 @@ func createServerlessInstanceBuilder() *cobra.Command { opts := createServerlessInstanceOpts{ fs: afero.NewOsFs(), } + const use = "createServerlessInstance" cmd := &cobra.Command{ - Use: "createServerlessInstance", - Short: "Create One Serverless Instance in One Project", + Use: use, + Short: "Create One Serverless Instance in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -221,9 +223,11 @@ func (opts *deleteServerlessInstanceOpts) postRun(_ context.Context, w io.Writer func deleteServerlessInstanceBuilder() *cobra.Command { opts := deleteServerlessInstanceOpts{} + const use = "deleteServerlessInstance" cmd := &cobra.Command{ - Use: "deleteServerlessInstance", - Short: "Remove One Serverless Instance from One Project", + Use: use, + Short: "Remove One Serverless Instance from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -310,9 +314,11 @@ func (opts *getServerlessInstanceOpts) postRun(_ context.Context, w io.Writer) e func getServerlessInstanceBuilder() *cobra.Command { opts := getServerlessInstanceOpts{} + const use = "getServerlessInstance" cmd := &cobra.Command{ - Use: "getServerlessInstance", - Short: "Return One Serverless Instance from One Project", + Use: use, + Short: "Return One Serverless Instance from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -403,9 +409,11 @@ func (opts *listServerlessInstancesOpts) postRun(_ context.Context, w io.Writer) func listServerlessInstancesBuilder() *cobra.Command { opts := listServerlessInstancesOpts{} + const use = "listServerlessInstances" cmd := &cobra.Command{ - Use: "listServerlessInstances", - Short: "Return All Serverless Instances from One Project", + Use: use, + Short: "Return All Serverless Instances from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -526,9 +534,11 @@ func updateServerlessInstanceBuilder() *cobra.Command { opts := updateServerlessInstanceOpts{ fs: afero.NewOsFs(), } + const use = "updateServerlessInstance" cmd := &cobra.Command{ - Use: "updateServerlessInstance", - Short: "Update One Serverless Instance in One Project", + Use: use, + Short: "Update One Serverless Instance in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_serverless_private_endpoints_cmd.go b/internal/api/api_serverless_private_endpoints_cmd.go index ab68a045ae..b09229232f 100644 --- a/internal/api/api_serverless_private_endpoints_cmd.go +++ b/internal/api/api_serverless_private_endpoints_cmd.go @@ -134,9 +134,11 @@ func createServerlessPrivateEndpointBuilder() *cobra.Command { opts := createServerlessPrivateEndpointOpts{ fs: afero.NewOsFs(), } + const use = "createServerlessPrivateEndpoint" cmd := &cobra.Command{ - Use: "createServerlessPrivateEndpoint", - Short: "Create One Private Endpoint for One Serverless Instance", + Use: use, + Short: "Create One Private Endpoint for One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -227,9 +229,11 @@ func (opts *deleteServerlessPrivateEndpointOpts) postRun(_ context.Context, w io func deleteServerlessPrivateEndpointBuilder() *cobra.Command { opts := deleteServerlessPrivateEndpointOpts{} + const use = "deleteServerlessPrivateEndpoint" cmd := &cobra.Command{ - Use: "deleteServerlessPrivateEndpoint", - Short: "Remove One Private Endpoint for One Serverless Instance", + Use: use, + Short: "Remove One Private Endpoint for One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -320,9 +324,11 @@ func (opts *getServerlessPrivateEndpointOpts) postRun(_ context.Context, w io.Wr func getServerlessPrivateEndpointBuilder() *cobra.Command { opts := getServerlessPrivateEndpointOpts{} + const use = "getServerlessPrivateEndpoint" cmd := &cobra.Command{ - Use: "getServerlessPrivateEndpoint", - Short: "Return One Private Endpoint for One Serverless Instance", + Use: use, + Short: "Return One Private Endpoint for One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -411,9 +417,11 @@ func (opts *listServerlessPrivateEndpointsOpts) postRun(_ context.Context, w io. func listServerlessPrivateEndpointsBuilder() *cobra.Command { opts := listServerlessPrivateEndpointsOpts{} + const use = "listServerlessPrivateEndpoints" cmd := &cobra.Command{ - Use: "listServerlessPrivateEndpoints", - Short: "Return All Private Endpoints for One Serverless Instance", + Use: use, + Short: "Return All Private Endpoints for One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -535,9 +543,11 @@ func updateServerlessPrivateEndpointBuilder() *cobra.Command { opts := updateServerlessPrivateEndpointOpts{ fs: afero.NewOsFs(), } + const use = "updateServerlessPrivateEndpoint" cmd := &cobra.Command{ - Use: "updateServerlessPrivateEndpoint", - Short: "Update One Private Endpoint for One Serverless Instance", + Use: use, + Short: "Update One Private Endpoint for One Serverless Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_shared_tier_restore_jobs_cmd.go b/internal/api/api_shared_tier_restore_jobs_cmd.go index 320a038ec8..3caa8fabdf 100644 --- a/internal/api/api_shared_tier_restore_jobs_cmd.go +++ b/internal/api/api_shared_tier_restore_jobs_cmd.go @@ -134,9 +134,11 @@ func createSharedClusterBackupRestoreJobBuilder() *cobra.Command { opts := createSharedClusterBackupRestoreJobOpts{ fs: afero.NewOsFs(), } + const use = "createSharedClusterBackupRestoreJob" cmd := &cobra.Command{ - Use: "createSharedClusterBackupRestoreJob", - Short: "Create One Restore Job from One M2 or M5 Cluster", + Use: use, + Short: "Create One Restore Job from One M2 or M5 Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -227,9 +229,11 @@ func (opts *getSharedClusterBackupRestoreJobOpts) postRun(_ context.Context, w i func getSharedClusterBackupRestoreJobBuilder() *cobra.Command { opts := getSharedClusterBackupRestoreJobOpts{} + const use = "getSharedClusterBackupRestoreJob" cmd := &cobra.Command{ - Use: "getSharedClusterBackupRestoreJob", - Short: "Return One Restore Job for One M2 or M5 Cluster", + Use: use, + Short: "Return One Restore Job for One M2 or M5 Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -318,9 +322,11 @@ func (opts *listSharedClusterBackupRestoreJobsOpts) postRun(_ context.Context, w func listSharedClusterBackupRestoreJobsBuilder() *cobra.Command { opts := listSharedClusterBackupRestoreJobsOpts{} + const use = "listSharedClusterBackupRestoreJobs" cmd := &cobra.Command{ - Use: "listSharedClusterBackupRestoreJobs", - Short: "Return All Restore Jobs for One M2 or M5 Cluster", + Use: use, + Short: "Return All Restore Jobs for One M2 or M5 Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_shared_tier_snapshots_cmd.go b/internal/api/api_shared_tier_snapshots_cmd.go index 32b6d397e1..5704c4b589 100644 --- a/internal/api/api_shared_tier_snapshots_cmd.go +++ b/internal/api/api_shared_tier_snapshots_cmd.go @@ -134,9 +134,11 @@ func downloadSharedClusterBackupBuilder() *cobra.Command { opts := downloadSharedClusterBackupOpts{ fs: afero.NewOsFs(), } + const use = "downloadSharedClusterBackup" cmd := &cobra.Command{ - Use: "downloadSharedClusterBackup", - Short: "Download One M2 or M5 Cluster Snapshot", + Use: use, + Short: "Download One M2 or M5 Cluster Snapshot", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -227,9 +229,11 @@ func (opts *getSharedClusterBackupOpts) postRun(_ context.Context, w io.Writer) func getSharedClusterBackupBuilder() *cobra.Command { opts := getSharedClusterBackupOpts{} + const use = "getSharedClusterBackup" cmd := &cobra.Command{ - Use: "getSharedClusterBackup", - Short: "Return One Snapshot for One M2 or M5 Cluster", + Use: use, + Short: "Return One Snapshot for One M2 or M5 Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -318,9 +322,11 @@ func (opts *listSharedClusterBackupsOpts) postRun(_ context.Context, w io.Writer func listSharedClusterBackupsBuilder() *cobra.Command { opts := listSharedClusterBackupsOpts{} + const use = "listSharedClusterBackups" cmd := &cobra.Command{ - Use: "listSharedClusterBackups", - Short: "Return All Snapshots for One M2 or M5 Cluster", + Use: use, + Short: "Return All Snapshots for One M2 or M5 Cluster", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_streams_cmd.go b/internal/api/api_streams_cmd.go index 9d157d0b76..8abba4930c 100644 --- a/internal/api/api_streams_cmd.go +++ b/internal/api/api_streams_cmd.go @@ -134,9 +134,11 @@ func createStreamConnectionBuilder() *cobra.Command { opts := createStreamConnectionOpts{ fs: afero.NewOsFs(), } + const use = "createStreamConnection" cmd := &cobra.Command{ - Use: "createStreamConnection", - Short: "Create One Connection", + Use: use, + Short: "Create One Connection", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -256,9 +258,11 @@ func createStreamInstanceBuilder() *cobra.Command { opts := createStreamInstanceOpts{ fs: afero.NewOsFs(), } + const use = "createStreamInstance" cmd := &cobra.Command{ - Use: "createStreamInstance", - Short: "Create One Stream Instance", + Use: use, + Short: "Create One Stream Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -347,9 +351,11 @@ func (opts *deleteStreamConnectionOpts) postRun(_ context.Context, w io.Writer) func deleteStreamConnectionBuilder() *cobra.Command { opts := deleteStreamConnectionOpts{} + const use = "deleteStreamConnection" cmd := &cobra.Command{ - Use: "deleteStreamConnection", - Short: "Delete One Stream Connection", + Use: use, + Short: "Delete One Stream Connection", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -438,9 +444,11 @@ func (opts *deleteStreamInstanceOpts) postRun(_ context.Context, w io.Writer) er func deleteStreamInstanceBuilder() *cobra.Command { opts := deleteStreamInstanceOpts{} + const use = "deleteStreamInstance" cmd := &cobra.Command{ - Use: "deleteStreamInstance", - Short: "Delete One Stream Instance", + Use: use, + Short: "Delete One Stream Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -531,9 +539,11 @@ func (opts *downloadStreamTenantAuditLogsOpts) postRun(_ context.Context, w io.W func downloadStreamTenantAuditLogsBuilder() *cobra.Command { opts := downloadStreamTenantAuditLogsOpts{} + const use = "downloadStreamTenantAuditLogs" cmd := &cobra.Command{ - Use: "downloadStreamTenantAuditLogs", - Short: "Download Audit Logs for One Atlas Stream Processing Instance", + Use: use, + Short: "Download Audit Logs for One Atlas Stream Processing Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -624,9 +634,11 @@ func (opts *getStreamConnectionOpts) postRun(_ context.Context, w io.Writer) err func getStreamConnectionBuilder() *cobra.Command { opts := getStreamConnectionOpts{} + const use = "getStreamConnection" cmd := &cobra.Command{ - Use: "getStreamConnection", - Short: "Return One Stream Connection", + Use: use, + Short: "Return One Stream Connection", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -717,9 +729,11 @@ func (opts *getStreamInstanceOpts) postRun(_ context.Context, w io.Writer) error func getStreamInstanceBuilder() *cobra.Command { opts := getStreamInstanceOpts{} + const use = "getStreamInstance" cmd := &cobra.Command{ - Use: "getStreamInstance", - Short: "Return One Stream Instance", + Use: use, + Short: "Return One Stream Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -811,9 +825,11 @@ func (opts *listStreamConnectionsOpts) postRun(_ context.Context, w io.Writer) e func listStreamConnectionsBuilder() *cobra.Command { opts := listStreamConnectionsOpts{} + const use = "listStreamConnections" cmd := &cobra.Command{ - Use: "listStreamConnections", - Short: "Return All Connections Of The Stream Instances", + Use: use, + Short: "Return All Connections Of The Stream Instances", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -904,9 +920,11 @@ func (opts *listStreamInstancesOpts) postRun(_ context.Context, w io.Writer) err func listStreamInstancesBuilder() *cobra.Command { opts := listStreamInstancesOpts{} + const use = "listStreamInstances" cmd := &cobra.Command{ - Use: "listStreamInstances", - Short: "Return All Project Stream Instances", + Use: use, + Short: "Return All Project Stream Instances", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1028,9 +1046,11 @@ func updateStreamConnectionBuilder() *cobra.Command { opts := updateStreamConnectionOpts{ fs: afero.NewOsFs(), } + const use = "updateStreamConnection" cmd := &cobra.Command{ - Use: "updateStreamConnection", - Short: "Update One Stream Connection", + Use: use, + Short: "Update One Stream Connection", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1154,9 +1174,11 @@ func updateStreamInstanceBuilder() *cobra.Command { opts := updateStreamInstanceOpts{ fs: afero.NewOsFs(), } + const use = "updateStreamInstance" cmd := &cobra.Command{ - Use: "updateStreamInstance", - Short: "Update One Stream Instance", + Use: use, + Short: "Update One Stream Instance", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_teams_cmd.go b/internal/api/api_teams_cmd.go index ea01c4119c..93f8f6755a 100644 --- a/internal/api/api_teams_cmd.go +++ b/internal/api/api_teams_cmd.go @@ -132,9 +132,11 @@ func addAllTeamsToProjectBuilder() *cobra.Command { opts := addAllTeamsToProjectOpts{ fs: afero.NewOsFs(), } + const use = "addAllTeamsToProject" cmd := &cobra.Command{ - Use: "addAllTeamsToProject", - Short: "Add One or More Teams to One Project", + Use: use, + Short: "Add One or More Teams to One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -254,9 +256,11 @@ func addTeamUserBuilder() *cobra.Command { opts := addTeamUserOpts{ fs: afero.NewOsFs(), } + const use = "addTeamUser" cmd := &cobra.Command{ - Use: "addTeamUser", - Short: "Assign MongoDB Cloud Users from One Organization to One Team", + Use: use, + Short: "Assign MongoDB Cloud Users from One Organization to One Team", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -376,9 +380,11 @@ func createTeamBuilder() *cobra.Command { opts := createTeamOpts{ fs: afero.NewOsFs(), } + const use = "createTeam" cmd := &cobra.Command{ - Use: "createTeam", - Short: "Create One Team in One Organization", + Use: use, + Short: "Create One Team in One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -465,9 +471,11 @@ func (opts *deleteTeamOpts) postRun(_ context.Context, w io.Writer) error { func deleteTeamBuilder() *cobra.Command { opts := deleteTeamOpts{} + const use = "deleteTeam" cmd := &cobra.Command{ - Use: "deleteTeam", - Short: "Remove One Team from One Organization", + Use: use, + Short: "Remove One Team from One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -554,9 +562,11 @@ func (opts *getTeamByIdOpts) postRun(_ context.Context, w io.Writer) error { func getTeamByIdBuilder() *cobra.Command { opts := getTeamByIdOpts{} + const use = "getTeamById" cmd := &cobra.Command{ - Use: "getTeamById", - Short: "Return One Team using its ID", + Use: use, + Short: "Return One Team using its ID", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -643,9 +653,11 @@ func (opts *getTeamByNameOpts) postRun(_ context.Context, w io.Writer) error { func getTeamByNameBuilder() *cobra.Command { opts := getTeamByNameOpts{} + const use = "getTeamByName" cmd := &cobra.Command{ - Use: "getTeamByName", - Short: "Return One Team using its Name", + Use: use, + Short: "Return One Team using its Name", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -736,9 +748,11 @@ func (opts *listOrganizationTeamsOpts) postRun(_ context.Context, w io.Writer) e func listOrganizationTeamsBuilder() *cobra.Command { opts := listOrganizationTeamsOpts{} + const use = "listOrganizationTeams" cmd := &cobra.Command{ - Use: "listOrganizationTeams", - Short: "Return All Teams in One Organization", + Use: use, + Short: "Return All Teams in One Organization", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -830,9 +844,11 @@ func (opts *listProjectTeamsOpts) postRun(_ context.Context, w io.Writer) error func listProjectTeamsBuilder() *cobra.Command { opts := listProjectTeamsOpts{} + const use = "listProjectTeams" cmd := &cobra.Command{ - Use: "listProjectTeams", - Short: "Return All Teams in One Project", + Use: use, + Short: "Return All Teams in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -924,9 +940,11 @@ func (opts *listTeamUsersOpts) postRun(_ context.Context, w io.Writer) error { func listTeamUsersBuilder() *cobra.Command { opts := listTeamUsersOpts{} + const use = "listTeamUsers" cmd := &cobra.Command{ - Use: "listTeamUsers", - Short: "Return All MongoDB Cloud Users Assigned to One Team", + Use: use, + Short: "Return All MongoDB Cloud Users Assigned to One Team", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -991,9 +1009,11 @@ func (opts *removeProjectTeamOpts) postRun(_ context.Context, _ io.Writer) error func removeProjectTeamBuilder() *cobra.Command { opts := removeProjectTeamOpts{} + const use = "removeProjectTeam" cmd := &cobra.Command{ - Use: "removeProjectTeam", - Short: "Remove One Team from One Project", + Use: use, + Short: "Remove One Team from One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1057,9 +1077,11 @@ func (opts *removeTeamUserOpts) postRun(_ context.Context, _ io.Writer) error { func removeTeamUserBuilder() *cobra.Command { opts := removeTeamUserOpts{} + const use = "removeTeamUser" cmd := &cobra.Command{ - Use: "removeTeamUser", - Short: "Remove One MongoDB Cloud User from One Team", + Use: use, + Short: "Remove One MongoDB Cloud User from One Team", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1180,9 +1202,11 @@ func renameTeamBuilder() *cobra.Command { opts := renameTeamOpts{ fs: afero.NewOsFs(), } + const use = "renameTeam" cmd := &cobra.Command{ - Use: "renameTeam", - Short: "Rename One Team", + Use: use, + Short: "Rename One Team", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -1304,9 +1328,11 @@ func updateTeamRolesBuilder() *cobra.Command { opts := updateTeamRolesOpts{ fs: afero.NewOsFs(), } + const use = "updateTeamRoles" cmd := &cobra.Command{ - Use: "updateTeamRoles", - Short: "Update Team Roles in One Project", + Use: use, + Short: "Update Team Roles in One Project", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_third_party_integrations_cmd.go b/internal/api/api_third_party_integrations_cmd.go index e75777e964..597d28be45 100644 --- a/internal/api/api_third_party_integrations_cmd.go +++ b/internal/api/api_third_party_integrations_cmd.go @@ -141,9 +141,11 @@ func createThirdPartyIntegrationBuilder() *cobra.Command { opts := createThirdPartyIntegrationOpts{ fs: afero.NewOsFs(), } + const use = "createThirdPartyIntegration" cmd := &cobra.Command{ - Use: "createThirdPartyIntegration", - Short: "Configure One Third-Party Service Integration", + Use: use, + Short: "Configure One Third-Party Service Integration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -235,9 +237,11 @@ func (opts *deleteThirdPartyIntegrationOpts) postRun(_ context.Context, w io.Wri func deleteThirdPartyIntegrationBuilder() *cobra.Command { opts := deleteThirdPartyIntegrationOpts{} + const use = "deleteThirdPartyIntegration" cmd := &cobra.Command{ - Use: "deleteThirdPartyIntegration", - Short: "Remove One Third-Party Service Integration", + Use: use, + Short: "Remove One Third-Party Service Integration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -324,9 +328,11 @@ func (opts *getThirdPartyIntegrationOpts) postRun(_ context.Context, w io.Writer func getThirdPartyIntegrationBuilder() *cobra.Command { opts := getThirdPartyIntegrationOpts{} + const use = "getThirdPartyIntegration" cmd := &cobra.Command{ - Use: "getThirdPartyIntegration", - Short: "Return One Third-Party Service Integration", + Use: use, + Short: "Return One Third-Party Service Integration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -417,9 +423,11 @@ func (opts *listThirdPartyIntegrationsOpts) postRun(_ context.Context, w io.Writ func listThirdPartyIntegrationsBuilder() *cobra.Command { opts := listThirdPartyIntegrationsOpts{} + const use = "listThirdPartyIntegrations" cmd := &cobra.Command{ - Use: "listThirdPartyIntegrations", - Short: "Return All Active Third-Party Service Integrations", + Use: use, + Short: "Return All Active Third-Party Service Integrations", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -547,9 +555,11 @@ func updateThirdPartyIntegrationBuilder() *cobra.Command { opts := updateThirdPartyIntegrationOpts{ fs: afero.NewOsFs(), } + const use = "updateThirdPartyIntegration" cmd := &cobra.Command{ - Use: "updateThirdPartyIntegration", - Short: "Update One Third-Party Service Integration", + Use: use, + Short: "Update One Third-Party Service Integration", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/internal/api/api_x509_authentication_cmd.go b/internal/api/api_x509_authentication_cmd.go index 99912e3299..3c2464a2e6 100644 --- a/internal/api/api_x509_authentication_cmd.go +++ b/internal/api/api_x509_authentication_cmd.go @@ -134,9 +134,11 @@ func createDatabaseUserCertificateBuilder() *cobra.Command { opts := createDatabaseUserCertificateOpts{ fs: afero.NewOsFs(), } + const use = "createDatabaseUserCertificate" cmd := &cobra.Command{ - Use: "createDatabaseUserCertificate", - Short: "Create One X.509 Certificate for One MongoDB User", + Use: use, + Short: "Create One X.509 Certificate for One MongoDB User", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -223,9 +225,11 @@ func (opts *disableCustomerManagedX509Opts) postRun(_ context.Context, w io.Writ func disableCustomerManagedX509Builder() *cobra.Command { opts := disableCustomerManagedX509Opts{} + const use = "disableCustomerManagedX509" cmd := &cobra.Command{ - Use: "disableCustomerManagedX509", - Short: "Disable Customer-Managed X.509", + Use: use, + Short: "Disable Customer-Managed X.509", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, @@ -316,9 +320,11 @@ func (opts *listDatabaseUserCertificatesOpts) postRun(_ context.Context, w io.Wr func listDatabaseUserCertificatesBuilder() *cobra.Command { opts := listDatabaseUserCertificatesOpts{} + const use = "listDatabaseUserCertificates" cmd := &cobra.Command{ - Use: "listDatabaseUserCertificates", - Short: "Return All X.509 Certificates Assigned to One MongoDB User", + Use: use, + Short: "Return All X.509 Certificates Assigned to One MongoDB User", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() }, diff --git a/tools/openapi-generator/config/go-templates/cmd.mustache b/tools/openapi-generator/config/go-templates/cmd.mustache index 7165852d79..bd9421d35d 100644 --- a/tools/openapi-generator/config/go-templates/cmd.mustache +++ b/tools/openapi-generator/config/go-templates/cmd.mustache @@ -223,9 +223,11 @@ func {{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}Builder() *cobra.C fs: afero.NewOsFs(), {{/bodyParam}} } + const use = "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}" cmd := &cobra.Command{ - Use: "{{#lambda.camelcase}}{{operationId}}{{/lambda.camelcase}}", + Use: use, Short: "{{ summary }}", + Aliases: cli.GenerateAliases(use), PreRunE: func(cmd *cobra.Command, args []string) error { return opts.preRun() },